MinGW stdint.h:为什么“ typedef unsigned”;而不是“ typedef unsigned int;”?

时间:2019-02-10 12:08:52

标签: c mingw mingw32

我正在将MinGW与mingw32-gcc 5.3.0-3一起使用。

在stdint.h中,uint32_t的定义与其他uint的定义不一致,并且看起来不正确。但是它适合uint_fast32_t:

/* 7.18.1.1  Exact-width integer types.
 */
typedef signed char     int8_t;
typedef unsigned char       uint8_t;
typedef short           int16_t;
typedef unsigned short      uint16_t;
typedef int         int32_t;
typedef unsigned        uint32_t;   //====== WRONG? (Where's the "int"?)
typedef long long       int64_t;
typedef unsigned long long  uint64_t;

...

/*  7.18.1.3  Fastest minimum-width integer types
 *  Not actually guaranteed to be fastest for all purposes
 *  Here we use the exact-width types for 8 and 16-bit ints.
 */
typedef signed char     int_fast8_t;
typedef unsigned char       uint_fast8_t;
typedef short           int_fast16_t;
typedef unsigned short      uint_fast16_t;
typedef int         int_fast32_t;
typedef unsigned  int       uint_fast32_t; //====== Ahh, that's what I expected!
typedef long long       int_fast64_t;
typedef unsigned long long  uint_fast64_t;

我很难相信这是一个错误,但是我不知道它是如何工作的。只能使用unsigned而不是unsigned int的typedef吗?

stdint.h标头日期为: * $Id: stdint.h,v 0e4f78dbc1ba 2016/06/17 14:16:01

0 个答案:

没有答案