Standard library header <cstdint> (C++11)
From cppreference.com
This header was originally in the C standard library as <stdint.h>.
This header is part of the type support library, providing fixed width integer types and part of C numeric limits interface.
Types | |
int8_tint16_tint32_tint64_tintN_t (optional)(optional)(optional)(optional)(optional) |
signed integer type with width of exactly N (typically 8, 16, 32 or 64) bits and no padding bits (typedef) |
int_fast8_tint_fast16_tint_fast32_tint_fast64_tint_fastN_t (optional) |
fastest signed integer type with width of at least N (typically 8, 16, 32 or 64) bits (typedef) |
int_least8_tint_least16_tint_least32_tint_least64_tint_leastN_t (optional) |
smallest signed integer type with width of at least N (typically 8, 16, 32 or 64) bits (if std::intN_t is defined, std::int_leastN_t designates the same type) (typedef) |
intmax_t |
maximum-width signed integer type (typedef) |
intptr_t (optional) |
signed integer type capable of holding a pointer to void (typedef) |
uint8_tuint16_tuint32_tuint64_tuintN_t (optional)(optional)(optional)(optional)(optional) |
unsigned integer type with width of exactly N (typically 8, 16, 32 or 64) bits and no padding bits (typedef) |
uint_fast8_tuint_fast16_tuint_fast32_tuint_fast64_tuint_fastN_t (optional) |
fastest unsigned integer type with width of at least N (typically 8, 16, 32 or 64) bits (typedef) |
uint_least8_tuint_least16_tuint_least32_tuint_least64_tuint_leastN_t (optional) |
smallest unsigned integer type with width of at least N (typically 8, 16, 32 or 64) bits (if std::uintN_t is defined, std::uint_leastN_t designates the same type) (typedef) |
uintmax_t |
maximum-width unsigned integer type (typedef) |
uintptr_t (optional) |
unsigned integer type capable of holding a pointer to void (typedef) |
Macros | |
Signed integers : bit width | |
INTN_WIDTH (C++26)(conditionally present) |
bit width of std::intN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INT_FASTN_WIDTH (C++26)(conditionally present) |
bit width of std::int_fastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INT_LEASTN_WIDTH (C++26)(conditionally present) |
bit width of std::int_leastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INTMAX_WIDTH (C++26) |
bit width of std::intmax_t (macro constant) |
INTPTR_WIDTH (C++26)(conditionally present) |
bit width of std::intptr_t (macro constant) |
Signed integers : minimum value | |
INTN_MIN (conditionally present) |
minimum value of std::intN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INT_FASTN_MIN (conditionally present) |
minimum value of std::int_fastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INT_LEASTN_MIN (conditionally present) |
minimum value of std::int_leastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INTMAX_MIN |
minimum value of std::intmax_t (macro constant) |
INTPTR_MIN (conditionally present) |
minimum value of std::intptr_t (macro constant) |
Signed integers : maximum value | |
INTN_MAX (conditionally present) |
maximum value of std::intN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INT_FASTN_MAX (conditionally present) |
maximum value of std::int_fastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INT_LEASTN_MAX (conditionally present) |
maximum value of std::int_leastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
INTMAX_MAX |
maximum value of std::intmax_t (macro constant) |
INTPTR_MAX (conditionally present) |
maximum value of std::intptr_t (macro constant) |
Unsigned integers : bit width | |
UINTN_WIDTH (C++26)(conditionally present) |
bit width of std::uintN_t (N is typically 8, 16, 32 or 64) (macro constant) |
UINT_FASTN_WIDTH (C++26)(conditionally present) |
bit width of std::uint_fastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
UINT_LEASTN_WIDTH (C++26)(conditionally present) |
bit width of std::uint_leastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
UINTMAX_WIDTH (C++26) |
bit width of std::uintmax_t (macro constant) |
UINTPTR_WIDTH (C++26)(conditionally present) |
bit width of std::uintptr_t (macro constant) |
Unsigned integers : maximum value | |
UINTN_MAX (conditionally present) |
maximum value of std::uintN_t (N is typically 8, 16, 32 or 64) (macro constant) |
UINT_FASTN_MAX (conditionally present) |
maximum value of std::uint_fastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
UINT_LEASTN_MAX (conditionally present) |
maximum value of std::uint_leastN_t (N is typically 8, 16, 32 or 64) (macro constant) |
UINTMAX_MAX |
maximum value of std::uintmax_t (macro constant) |
UINTPTR_MAX (conditionally present) |
maximum value of std::uintptr_t (macro constant) |
Characteristics of other integer types | |
PTRDIFF_WIDTH (C++26) |
bit width of std::ptrdiff_t (macro constant) |
PTRDIFF_MIN |
minimum value of std::ptrdiff_t (macro constant) |
PTRDIFF_MAX |
maximum value of std::ptrdiff_t (macro constant) |
SIZE_WIDTH (C++26) |
bit width of std::size_t (macro constant) |
SIZE_MAX |
maximum value of std::size_t (macro constant) |
SIG_ATOMIC_WIDTH (C++26) |
bit width of std::sig_atomic_t (macro constant) |
SIG_ATOMIC_MIN |
minimum value of std::sig_atomic_t (macro constant) |
SIG_ATOMIC_MAX |
maximum value of std::sig_atomic_t (macro constant) |
WINT_WIDTH (C++26) |
bit width of std::wint_t (macro constant) |
WINT_MIN |
minimum value of std::wint_t (macro constant) |
WINT_MAX |
maximum value of std::wint_t (macro constant) |
WCHAR_WIDTH (C++26) |
bit width of wchar_t (macro constant) |
WCHAR_MIN |
minimum value of wchar_t (macro constant) |
WCHAR_MAX |
maximum value of wchar_t (macro constant) |
Function macros for integer constants | |
INTN_C (conditionally present) |
expands to an integer constant expression of type std::int_leastN_t, its value is specified by the argument (function macro) |
INTMAX_C |
expands to an integer constant expression of type std::intmax_t, its value is specified by the argument (function macro) |
UINTN_C (conditionally present) |
expands to an integer constant expression of type std::uint_leastN_t, its value is specified by the argument (function macro) |
UINTMAX_C |
expands to an integer constant expression of type std::uintmax_t, its value is specified by the argument (function macro) |
Note
For each of the typedef names listed above marked (optional), an implementation defines it if and only if the implementation provides a corresponding type.
For each of the macros marked listed above (conditionally present), an implementation defines it if and only if the implementation defines the corresponding typedef name.
Synopsis
#define STDC_VERSION_STDINT_H 202311L
namespace std {
// see description of intN_t
using int8_t = /* see description */;
using int16_t = /* see description */;
using int32_t = /* see description */;
using int64_t = /* see description */;
using intN_t = /* see description */; // optional
// see description of int_fastN_t
using int_fast8_t = /* see description */;
using int_fast16_t = /* see description */;
using int_fast32_t = /* see description */;
using int_fast64_t = /* see description */;
using int_fastN_t = /* see description */; // optional
// see description of int_leastN_t
using int_least8_t = /* see description */;
using int_least16_t = /* see description */;
using int_least32_t = /* see description */;
using int_least64_t = /* see description */;
using int_leastN_t = /* see description */; // optional
using intmax_t = /* see description */;
using intptr_t = /* see description */; // optional
// see description of uintN_t
using uint8_t = /* see description */; // optional
using uint16_t = /* see description */; // optional
using uint32_t = /* see description */; // optional
using uint64_t = /* see description */; // optional
using uintN_t = /* see description */; // optional
// see description of uint_fastN_t
using uint_fast8_t = /* see description */;
using uint_fast16_t = /* see description */;
using uint_fast32_t = /* see description */;
using uint_fast64_t = /* see description */;
using uint_fastN_t = /* see description */; // optional
// see description of uint_leastN_t
using uint_least8_t = /* see description */;
using uint_least16_t = /* see description */;
using uint_least32_t = /* see description */;
using uint_least64_t = /* see description */;
using uint_leastN_t = /* see description */; // optional
using uintmax_t = /* see description */;
using uintptr_t = /* see description */; // optional
}
#define INTN_MIN /* see description */
#define INTN_MAX /* see description */
#define UINTN_MAX /* see description */
#define INTN_WIDTH /* see description */
#define UINTN_WIDTH /* see description */
#define INT_FASTN_MIN /* see description */
#define INT_FASTN_MAX /* see description */
#define UINT_FASTN_MAX /* see description */
#define INT_FASTN_WIDTH /* see description */
#define UINT_FASTN_WIDTH /* see description */
#define INT_LEASTN_MIN /* see description */
#define INT_LEASTN_MAX /* see description */
#define UINT_LEASTN_MAX /* see description */
#define INT_LEASTN_WIDTH /* see description */
#define UINT_LEASTN_WIDTH /* see description */
#define INTMAX_MIN /* see description */
#define INTMAX_MAX /* see description */
#define UINTMAX_MAX /* see description */
#define INTMAX_WIDTH /* see description */
#define UINTMAX_WIDTH /* see description */
#define INTPTR_MIN /* see description */ // optional
#define INTPTR_MAX /* see description */ // optional
#define UINTPTR_MAX /* see description */ // optional
#define INTPTR_WIDTH /* see description */ // optional
#define UINTPTR_WIDTH /* see description */ // optional
#define PTRDIFF_MIN /* see description */
#define PTRDIFF_MAX /* see description */
#define PTRDIFF_WIDTH /* see description */
#define SIZE_MAX /* see description */
#define SIZE_WIDTH /* see description */
#define SIG_ATOMIC_MIN /* see description */
#define SIG_ATOMIC_MAX /* see description */
#define SIG_ATOMIC_WIDTH /* see description */
#define WCHAR_MIN /* see description */
#define WCHAR_MAX /* see description */
#define WCHAR_WIDTH /* see description */
#define WINT_MIN /* see description */
#define WINT_MAX /* see description */
#define WINT_WIDTH /* 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 */