命名空间
变体
操作

标准库头文件 <cstdint> (C++11)

来自 cppreference.cn
< cpp‎ | header
 
 
标准库头文件
算法
<algorithm>
<numeric>
字符串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文本处理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
数值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
时间
<chrono> (C++11)
<ctime>
C 兼容性
<ccomplex> (C++11/17/20*)
<ciso646> (直到 C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此头文件最初在 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_tstd::int16_tstd::int32_tstd::int64_t 的最小值
(宏常量) [编辑]
INT_FAST8_MININT_FAST16_MININT_FAST32_MININT_FAST64_MIN
分别为 std::int_fast8_tstd::int_fast16_tstd::int_fast32_tstd::int_fast64_t 的最小值
(宏常量) [编辑]
INT_LEAST8_MININT_LEAST16_MININT_LEAST32_MININT_LEAST64_MIN
分别为 std::int_least8_tstd::int_least16_tstd::int_least32_tstd::int_least64_t 的最小值
(宏常量) [编辑]
INTPTR_MIN
(可选)
std::intptr_t 的最小值
(宏常量) [编辑]
INTMAX_MIN
std::intmax_t 的最小值
(宏常量) [编辑]
有符号整数 : 最大值
INT8_MAXINT16_MAXINT32_MAXINT64_MAX
(可选)
分别为 std::int8_tstd::int16_tstd::int32_tstd::int64_t 的最大值
(宏常量) [编辑]
INT_FAST8_MAXINT_FAST16_MAXINT_FAST32_MAXINT_FAST64_MAX
分别为 std::int_fast8_tstd::int_fast16_tstd::int_fast32_tstd::int_fast64_t 的最大值
(宏常量) [编辑]
INT_LEAST8_MAXINT_LEAST16_MAXINT_LEAST32_MAXINT_LEAST64_MAX
分别为 std::int_least8_tstd::int_least16_tstd::int_least32_tstd::int_least64_t 的最大值
(宏常量) [编辑]
INTPTR_MAX
(可选)
std::intptr_t 的最大值
(宏常量) [编辑]
INTMAX_MAX
std::intmax_t 的最大值
(宏常量) [编辑]
无符号整数 : 最大值
UINT8_MAXUINT16_MAXUINT32_MAXUINT64_MAX
(可选)
分别为 std::uint8_tstd::uint16_tstd::uint32_tstd::uint64_t 的最大值
(宏常量) [编辑]
UINT_FAST8_MAXUINT_FAST16_MAXUINT_FAST32_MAXUINT_FAST64_MAX
分别为 std::uint_fast8_tstd::uint_fast16_tstd::uint_fast32_tstd::uint_fast64_t 的最大值
(宏常量) [编辑]
UINT_LEAST8_MAXUINT_LEAST16_MAXUINT_LEAST32_MAXUINT_LEAST64_MAX
分别为 std::uint_least8_tstd::uint_least16_tstd::uint_least32_tstd::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_tstd::int_least16_tstd::int_least32_tstd::int_least64_t提升后类型
(函数宏) [编辑]
INTMAX_C
扩展为具有由其参数指定的值的整数常量表达式,并且类型为 std::intmax_t
(函数宏) [编辑]
UINT8_CUINT16_CUINT32_CUINT64_C
扩展为具有由其参数指定的值的整数常量表达式,并且其类型分别为 std::uint_least8_tstd::uint_least16_tstd::uint_least32_tstd::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 */