标准库头文件 <cstdint> (C++11)
来自 cppreference.cn
此头文件最初在 C 标准库中为 <stdint.h>。
此头文件是类型支持库的一部分,提供固定宽度整数类型和C 数值限制接口的一部分。
类型 | ||
int8_tint16_tint32_tint64_t (可选) |
宽度分别为 8、16、32 和 64 位的有符号整数类型 没有填充位,并使用 2 的补码表示负值 (当且仅当实现直接支持该类型时提供) (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 = /* signed integer type */; // optional using int16_t = /* signed integer type */; // optional using int32_t = /* signed integer type */; // optional using int64_t = /* signed integer type */; // optional using intN_t = /* see description */; // optional, see description using int_fast8_t = /* signed integer type */; using int_fast16_t = /* signed integer type */; using int_fast32_t = /* signed integer type */; using int_fast64_t = /* signed integer type */; using int_fastN_t = /* see description */; // optional, see description using int_least8_t = /* signed integer type */; using int_least16_t = /* signed integer type */; using int_least32_t = /* signed integer type */; using int_least64_t = /* signed integer type */; using int_leastN_t = /* see description */; // optional, see description using intmax_t = /* signed integer type */; using intptr_t = /* signed integer type */; // optional using uint8_t = /* unsigned integer type */; // optional using uint16_t = /* unsigned integer type */; // optional using uint32_t = /* unsigned integer type */; // optional using uint64_t = /* unsigned integer type */; // optional using uintN_t = /* see description */; // optional, see description using uint_fast8_t = /* unsigned integer type */; using uint_fast16_t = /* unsigned integer type */; using uint_fast32_t = /* unsigned integer type */; using uint_fast64_t = /* unsigned integer type */; using uint_fastN_t = /* see description */; // optional, see description using uint_least8_t = /* unsigned integer type */; using uint_least16_t = /* unsigned integer type */; using uint_least32_t = /* unsigned integer type */; using uint_least64_t = /* unsigned integer type */; using uint_leastN_t = /* see description */; // optional, see description using uintmax_t = /* unsigned integer type */; using uintptr_t = /* unsigned integer type */; // optional } #define INTN_MIN /* see description */ #define INTN_MAX /* see description */ #define UINTN_MAX /* see description */ #define INT_FASTN_MIN /* see description */ #define INT_FASTN_MAX /* see description */ #define UINT_FASTN_MAX /* see description */ #define INT_LEASTN_MIN /* see description */ #define INT_LEASTN_MAX /* see description */ #define UINT_LEASTN_MAX /* see description */ #define INTMAX_MIN /* see description */ #define INTMAX_MAX /* see description */ #define UINTMAX_MAX /* see description */ #define INTPTR_MIN /* see description */ // optional #define INTPTR_MAX /* see description */ // optional #define UINTPTR_MAX /* see description */ // optional #define PTRDIFF_MIN /* see description */ #define PTRDIFF_MAX /* see description */ #define SIZE_MAX /* see description */ #define SIG_ATOMIC_MIN /* see description */ #define SIG_ATOMIC_MAX /* see description */ #define WCHAR_MIN /* see description */ #define WCHAR_MAX /* see description */ #define WINT_MIN /* see description */ #define WINT_MAX /* see description */ #define INTN_C(value) /* see description */ #define UINTN_C(value) /* see description */ #define INTMAX_C(value) /* see description */ #define UINTMAX_C(value) /* see description */