Standard library header <cstdint> (C++11)
From cppreference.net
此头文件最初作为 <stdint.h> 存在于C标准库中。
此头文件是 类型支持 库的组成部分,提供 固定宽度整数类型 并实现部分 C数值极限接口 。
类型 |
||
|
int8_t
int16_t
int32_t
int64_t
(可选)
|
宽度恰好分别为8、16、32和64位的有符号整数类型
无填充位且使用二进制补码表示负值 (当且仅当实现直接支持该类型时提供) (类型定义) |
|
|
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
|
宽度至少分别为8、16、32和64位的最快有符号整数类型
(类型定义) |
|
|
int_least8_t
int_least16_t
int_least32_t
int_least64_t
|
宽度至少分别为8位、16位、32位和64位的最小有符号整数类型
(类型定义) |
|
|
intmax_t
|
最大宽度有符号整数类型
(typedef) |
|
|
intptr_t
(可选)
|
能够容纳指向
void
指针的有符号整数类型
(类型定义) |
|
|
uint8_t
uint16_t
uint32_t
uint64_t
(可选)
|
宽度分别为精确8位、16位、32位和64位的无符号整数类型
(当且仅当实现直接支持该类型时提供) (类型定义) |
|
|
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
|
宽度至少分别为8、16、32和64位的最快无符号整数类型
(类型定义) |
|
|
uint_least8_t
uint_least16_t
uint_least32_t
uint_least64_t
|
宽度至少分别为8、16、32和64位的最小无符号整数类型
(类型定义) |
|
|
uintmax_t
|
最大宽度无符号整数类型
(typedef) |
|
|
uintptr_t
(optional)
|
能够容纳指向
void
指针的无符号整数类型
(typedef) |
|
宏 |
||
有符号整数:最小值 |
||
|
INT8_MIN
INT16_MIN
INT32_MIN
INT64_MIN
(可选)
|
std::int8_t
、
std::int16_t
、
std::int32_t
和
std::int64_t
的最小值
(宏常量) |
|
|
INT_FAST8_MIN
INT_FAST16_MIN
INT_FAST32_MIN
INT_FAST64_MIN
|
分别为
std::int_fast8_t
、
std::int_fast16_t
、
std::int_fast32_t
和
std::int_fast64_t
的最小值
(宏常量) |
|
|
INT_LEAST8_MIN
INT_LEAST16_MIN
INT_LEAST32_MIN
INT_LEAST64_MIN
|
分别表示
std::int_least8_t
、
std::int_least16_t
、
std::int_least32_t
和
std::int_least64_t
的最小值
(宏常量) |
|
|
INTPTR_MIN
(可选)
|
std::intptr_t
的最小值
(宏常量) |
|
|
INTMAX_MIN
|
std::intmax_t
的最小值
(宏常量) |
|
有符号整数:最大值 |
||
|
INT8_MAX
INT16_MAX
INT32_MAX
INT64_MAX
(可选)
|
std::int8_t
、
std::int16_t
、
std::int32_t
和
std::int64_t
的最大值
(宏常量) |
|
|
INT_FAST8_MAX
INT_FAST16_MAX
INT_FAST32_MAX
INT_FAST64_MAX
|
分别表示
std::int_fast8_t
、
std::int_fast16_t
、
std::int_fast32_t
和
std::int_fast64_t
的最大值
(宏常量) |
|
|
INT_LEAST8_MAX
INT_LEAST16_MAX
INT_LEAST32_MAX
INT_LEAST64_MAX
|
分别表示
std::int_least8_t
、
std::int_least16_t
、
std::int_least32_t
和
std::int_least64_t
的最大值
(宏常量) |
|
|
INTPTR_MAX
(可选)
|
std::intptr_t
的最大值
(宏常量) |
|
|
INTMAX_MAX
|
std::intmax_t 的最大值
std::intmax_t
(宏常量) |
|
无符号整数:最大值 |
||
|
UINT8_MAX
UINT16_MAX
UINT32_MAX
UINT64_MAX
(可选)
|
std::uint8_t
、
std::uint16_t
、
std::uint32_t
和
std::uint64_t
的最大值
(宏常量) |
|
|
UINT_FAST8_MAX
UINT_FAST16_MAX
UINT_FAST32_MAX
UINT_FAST64_MAX
|
std::uint_fast8_t
、
std::uint_fast16_t
、
std::uint_fast32_t
和
std::uint_fast64_t
的
最大值
(宏常量) |
|
|
UINT_LEAST8_MAX
UINT_LEAST16_MAX
UINT_LEAST32_MAX
UINT_LEAST64_MAX
|
分别表示
std::uint_least8_t
、
std::uint_least16_t
、
std::uint_least32_t
和
std::uint_least64_t
的最大值
(宏常量) |
|
|
UINTPTR_MAX
(可选)
|
std::uintptr_t
的最大值
(宏常量) |
|
|
UINTMAX_MAX
|
std::uintmax_t
的最大值
(宏常量) |
|
其他整数类型的限制 |
||
|
PTRDIFF_MIN
(C++11)
|
std::ptrdiff_t 的最小值
std::ptrdiff_t
(宏常量) |
|
|
PTRDIFF_MAX
(C++11)
|
std::ptrdiff_t
的最大值
(宏常量) |
|
|
SIZE_MAX
(C++11)
|
std::size_t
的最大值
(宏常量) |
|
|
SIG_ATOMIC_MIN
(C++11)
|
std::sig_atomic_t
的最小值
(宏常量) |
|
|
SIG_ATOMIC_MAX
(C++11)
|
std::sig_atomic_t
的最大值
(宏常量) |
|
|
WCHAR_MIN
(C++11)
|
wchar_t
的最小值
(宏常量) |
|
|
WCHAR_MAX
(C++11)
|
wchar_t
的最大值
(宏常量) |
|
|
WINT_MIN
(C++11)
|
std::wint_t
的最小值
(宏常量) |
|
|
WINT_MAX
(C++11)
|
std::wint_t
的最大值
(宏常量) |
|
整型常量的函数宏 |
||
|
INT8_C
INT16_C
INT32_C
INT64_C
|
扩展为具有指定参数值的整型常量表达式,其类型分别为
promoted
类型的
std::int_least8_t
、
std::int_least16_t
、
std::int_least32_t
和
std::int_least64_t
(函数宏) |
|
|
INTMAX_C
|
扩展为具有指定参数值且类型为
std::intmax_t
的整型常量表达式
(函数宏) |
|
|
UINT8_C
UINT16_C
UINT32_C
UINT64_C
|
扩展为具有指定参数值的整型常量表达式,其类型分别为
promoted
类型
std::uint_least8_t
、
std::uint_least16_t
、
std::uint_least32_t
和
std::uint_least64_t
(函数宏) |
|
|
UINTMAX_C
|
扩展为具有指定参数值且类型为
std::uintmax_t
的整型常量表达式
(函数宏) |
|
概要
namespace std { using int8_t = /* 有符号整数类型 */; // 可选 using int16_t = /* 有符号整数类型 */; // 可选 using int32_t = /* 有符号整数类型 */; // 可选 using int64_t = /* 有符号整数类型 */; // 可选 using intN_t = /* 参见描述 */; // 可选,参见描述 using int_fast8_t = /* 有符号整数类型 */; using int_fast16_t = /* 有符号整数类型 */; using int_fast32_t = /* 有符号整数类型 */; using int_fast64_t = /* 有符号整数类型 */; using int_fastN_t = /* 参见描述 */; // 可选,参见描述 using int_least8_t = /* 有符号整数类型 */; using int_least16_t = /* 有符号整数类型 */; using int_least32_t = /* 有符号整数类型 */; using int_least64_t = /* 有符号整数类型 */; using int_leastN_t = /* 参见描述 */; // 可选,参见描述 using intmax_t = /* 有符号整数类型 */; using intptr_t = /* 有符号整数类型 */; // 可选 using uint8_t = /* 无符号整数类型 */; // 可选 using uint16_t = /* 无符号整数类型 */; // 可选 using uint32_t = /* 无符号整数类型 */; // 可选 using uint64_t = /* 无符号整数类型 */; // 可选 using uintN_t = /* 参见描述 */; // 可选,参见描述 using uint_fast8_t = /* 无符号整数类型 */; using uint_fast16_t = /* 无符号整数类型 */; using uint_fast32_t = /* 无符号整数类型 */; using uint_fast64_t = /* 无符号整数类型 */; using uint_fastN_t = /* 参见描述 */; // 可选,参见描述 using uint_least8_t = /* 无符号整数类型 */; using uint_least16_t = /* 无符号整数类型 */; using uint_least32_t = /* 无符号整数类型 */; using uint_least64_t = /* 无符号整数类型 */; using uint_leastN_t = /* 参见描述 */; // 可选,参见描述 using uintmax_t = /* 无符号整数类型 */; using uintptr_t = /* 无符号整数类型 */; // 可选 } #define INTN_MIN /* 参见描述 */ #define INTN_MAX /* 参见描述 */ #define UINTN_MAX /* 参见描述 */ #define INT_FASTN_MIN /* 参见描述 */ #define INT_FASTN_MAX /* 参见描述 */ #define UINT_FASTN_MAX /* 参见描述 */ #define INT_LEASTN_MIN /* 参见描述 */ #define INT_LEASTN_MAX /* 参见描述 */ #define UINT_LEASTN_MAX /* 参见描述 */ #define INTMAX_MIN /* 参见描述 */ #define INTMAX_MAX /* 参见描述 */ #define UINTMAX_MAX /* 参见描述 */ #define INTPTR_MIN /* 参见描述 */ // 可选 #define INTPTR_MAX /* 参见描述 */ // 可选 #define UINTPTR_MAX /* 参见描述 */ // 可选 #define PTRDIFF_MIN /* 参见描述 */ #define PTRDIFF_MAX /* 参见描述 */ #define SIZE_MAX /* 参见描述 */ #define SIG_ATOMIC_MIN /* 参见描述 */ #define SIG_ATOMIC_MAX /* 参见描述 */ #define WCHAR_MIN /* 参见描述 */ #define WCHAR_MAX /* 参见描述 */ #define WINT_MIN /* 参见描述 */ #define WINT_MAX /* 参见描述 */ #define INTN_C(value) /* 参见描述 */ #define UINTN_C(value) /* 参见描述 */ #define INTMAX_C(value) /* 参见描述 */ #define UINTMAX_C(value) /* 参见描述 */