C++ 数据类型
C++ 的主要数据类型,主要分为三类:布尔型,整型(char型从本质上说,也是种整型类型,它是长度为1的整数,通常用来存放字符的ASCII码),浮点型。
而 *_t是typedef定义的表示标志,是结构的一种标注。即我们所看到的 uint8_t、uint16_t、uint32_t都不是新的数据类型,而是通过typedef给类型起得别名。
uint8_t / uint16_t / uint32_t /uint64_t 是什么数据类型
这些数据类型是 C99 中定义的,具体定义在:/usr/include/stdint.h ISO C99: 7.18 Integer types
/* 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