标准库标头 <cstdint> (C++11)
来自cppreference.com
此标头原作为 <stdint.h> 存在于 C 标准库。
此头文件是类型支持库的一部分,提供定宽整数类型和部分 C 数值极限接口。
类型 | ||
int8_tint16_tint32_tint64_t (可选) | 分别是宽度正好是 8、16、32 和 64 位的有符号整数类型 无填充位并对负值使用补码 (当且仅当实现直接支持该类型时才会提供) (typedef) | |
int_fast8_tint_fast16_tint_fast32_tint_fast64_t | 分别是宽度至少有 8、16、32 和 64 位的最快的有符号整数类型 (typedef) | |
int_least8_tint_least16_tint_least32_tint_least64_t | 分别是宽度至少有 8、16、32 和 64 位的最小的有符号整数类型 (typedef) | |
intmax_t | 最大宽度的有符号整数类型 (typedef) | |
intptr_t (可选) | 足以保有指向 void 的指针的有符号整数类型 (typedef) | |
uint8_tuint16_tuint32_tuint64_t (可选) | 分别是宽度正好是 8、16、32 和 64 位的无符号整数类型 (当且仅当实现直接支持该类型时才会提供) (typedef) | |
uint_fast8_tuint_fast16_tuint_fast32_tuint_fast64_t | 分别是宽度至少有 8、16、32 和 64 位的最快的无符号整数类型 (typedef) | |
uint_least8_tuint_least16_tuint_least32_tuint_least64_t | 分别是宽度至少有 8、16、32 和 64 位的最小的无符号整数类型 (typedef) | |
uintmax_t | 最大宽度的无符号整数类型 (typedef) | |
uintptr_t (可选) | 足以保有指向 void 的指针的无符号整数类型 (typedef) | |
宏 | ||
有符号整数:最小值 | ||
INT8_MININT16_MININT32_MININT64_MIN (可选) | 分别是 std::int8_t 、std::int16_t 、std::int32_t 和 std::int64_t 的最小值 (宏常量) | |
INT_FAST8_MININT_FAST16_MININT_FAST32_MININT_FAST64_MIN | 分别是 std::int_fast8_t 、std::int_fast16_t 、std::int_fast32_t 和 std::int_fast64_t 的最小值 (宏常量) | |
INT_LEAST8_MININT_LEAST16_MININT_LEAST32_MININT_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_MAXINT16_MAXINT32_MAXINT64_MAX (可选) | 分别是 std::int8_t 、std::int16_t 、std::int32_t 和 std::int64_t 的最大值 (宏常量) | |
INT_FAST8_MAXINT_FAST16_MAXINT_FAST32_MAXINT_FAST64_MAX | 分别是 std::int_fast8_t 、std::int_fast16_t 、std::int_fast32_t 和 std::int_fast64_t 的最大值 (宏常量) | |
INT_LEAST8_MAXINT_LEAST16_MAXINT_LEAST32_MAXINT_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 的最大值 (宏常量) | |
无符号整数:最大值 | ||
UINT8_MAXUINT16_MAXUINT32_MAXUINT64_MAX (可选) | 分别是 std::uint8_t 、std::uint16_t 、std::uint32_t 和 std::uint64_t 的最大值 (宏常量) | |
UINT_FAST8_MAXUINT_FAST16_MAXUINT_FAST32_MAXUINT_FAST64_MAX | 分别是 std::uint_fast8_t 、std::uint_fast16_t 、std::uint_fast32_t 和 std::uint_fast64_t 的最大值 (宏常量) | |
UINT_LEAST8_MAXUINT_LEAST16_MAXUINT_LEAST32_MAXUINT_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 的最小值 (宏常量) | |
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_CINT16_CINT32_CINT64_C | 展开成拥有它的实参所指定的值且类型分别是 std::int_least8_t 、std::int_least16_t 、std::int_least32_t 和 std::int_least64_t 的提升类型的整数常量表达式 (宏函数) | |
INTMAX_C | 展开成拥有它的实参所指定的值且类型是 std::intmax_t 的整数常量表达式 (宏函数) | |
UINT8_CUINT16_CUINT32_CUINT64_C | 展开成拥有它的实参所指定的值且类型分别是 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) /* 见描述 */