工作
中经常碰到
int8_t、
int16_t、
int32_t、
int64_t、u
int8_t、size_t、ssize_t等数据类型,所以有必要对此进行梳理。
int_t同类
int_t 为一个结构的标注,可以
理解为type/typedef的缩写,表示它是通过typedef定义的,而不是一种新的数据类型。因为跨平台,不同的平台会有不同的字长,所以利用预编译和typedef可以最有效的维护代码。
听说这个有用
The following are typedefs of fundamental integral types or extended integral types.
signed type unsigned type description
intmax_t uintmax_t Integer type with the maximum width supported.
int8_t uint8_t Integer type with a width of exactly 8, 16, 32, or 64 bits.
For signed types, negative values are represented using 2's complement.
No padding bits.
Optional: These typedefs are not defined if no types with such characteristics exist.*
int16_t uint16_t
int32_t uint32_t
int64_t uint64_t
int_least8_t uint_least8_t Integer type with a minimum of 8, 16, 32, or 64 bits.
No other integer type exists with lesser size and at least the specified width.
int_least16_t uint_least16_t
int_least32_t uint_least32_t
int_least64_t uint_least64_t
int_fast8_t uint_fast8_t Integer type with a minimum of 8, 16, 32, or 64 bits.
At least as fast as any other integer type with at least the specified width.
int_fast16_t uint_fast16_t
int_fast32_t uint_fast32_t
int_fast64_t uint_fast64_t
intptr_t uintptr_t Integer type capable of holding a value converted from a void pointer and then be converted back to that type with a value that compares equal to the original pointer.
Optional: These typedefs may not be defined in some library implementations.*
Some of these typedefs may denote the same types. Therefore, function overloads should not rely on these being different.
* Notice that some types are optional (and thus, with no portability guarantees). A particular library implementation may also define additional types with other widths supported by its system. In any case, if either the signed or the unsigned version is defined, both the signed and unsigned versions are defined.
在上个项目的网络编程
中,遇到了很多typedef定义的数据类型,现进行记录,主要参考了一下链接:
https://blog.csdn.net/EUSIA/article/details/7
6401235
https://www.cnblogs.com/curo0119/p/8891906.html
https://www.jb51.net/article/109690...