Defined in header <cstdint>
int8_t
int16_t
int32_t
int64_t
(optional)
signed integer type with width of exactly 8, 16, 32 and 64 bits respectively
with no padding bits and using 2's complement for negative values
(provided only if the implementation directly supports the type)
(typedef)
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
int_least8_t
int_least16_t
int_least32_t
int_least64_t
smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
intmax_t
maximum-width signed integer type
(typedef)
intptr_t
(optional)
signed integer type capable of holding a pointer
(typedef)
uint8_t
uint16_t
uint32_t
uint64_t
(optional)
unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively
(provided only if the implementation directly supports the type)
(typedef)
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
uint_least8_t
uint_least16_t
uint_least32_t
uint_least64_t
smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
uintmax_t
maximum-width unsigned integer type
(typedef)
uintptr_t
(optional)
unsigned integer type capable of holding a pointer
(typedef)
从 开始,
C++11语言标准中有保证长度的类型:在标准采用近 10 年后
C++11,您需要使用编译器的情况C++98看起来极不可能,这本身就是一个值得讨论的理由。这就像在网络上支持 IE6 - 你可以,但它非常昂贵。通常这样的检查是由程序来完成的
./configure。编写一个脚本,该脚本将创建一个包含很长声明和一个小测试的文件。该文件被编译(并在测试需要时执行)。如果测试失败,则将变量写入头文件或生成文件。对于 autoconf 项目,使用 AC_COMPILE_IFELSE 宏https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Running-the-Compiler.html