今天看到uint32_t有点懵,所以特意去查了查。。。
如下:
![](https://img-blog.csdnimg.cn/img_convert/26b9fc7ef82a40ce8ab600541c038f96.png)
![](https://img-blog.csdnimg.cn/img_convert/25b45e47ce6f4ca3a529704309cd98a5.png)
那么uint32_t 到底代表什么呢?
其实uint8_t / uint16_t / uint32_t /uint64_t 这些数据类型是 C99 中定义的:
/* There is some amount of overlap with <sys/types.h> as known by inet code */
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
# if __WORDSIZE == 64
typedef long int int64_t;
# else
__extension__
typedef long long int int64_t;
# endif
#endif
/* Unsigned. */
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
#ifndef __uint32_t_defined
typedef unsigned int uint32_t;
# define __uint32_t_defined
#endif
#if __WORDSIZE == 64
typedef unsigned long int uint64_t;
#else
__extension__
typedef unsigned long long int uint64_t;
#endif
即uint8_t实际上就是一个char,uint32_t就是unsigned int(依次类推)。