Standard library header <cstdint> (C++11)

From cppreference.com
Standard library headers

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_t int16_t int32_t int64_t
(optional)
signed integer type with width of exactly 8, 16, 32 and 64 bits respectively
with no padding bits and using 2's complement for negative values
(provided if and only if the implementation directly supports the type)
(typedef)
int_fast8_t int_fast16_t int_fast32_t int_fast64_t
fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
int_least8_t int_least16_t int_least32_t int_least64_t
smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
intmax_t
maximum-width signed integer type
(typedef)
intptr_t
(optional)
signed integer type capable of holding a pointer to void
(typedef)
uint8_t uint16_t uint32_t uint64_t
(optional)
unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively
(provided if and only if the implementation directly supports the type)
(typedef)
uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively
(typedef)
uint_least8_t uint_least16_t uint_least32_t uint_least64_t
smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively
(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 : minimum value
INT8_MIN INT16_MIN INT32_MIN INT64_MIN
(optional)
minimum value of std::int8_t , std::int16_t , std::int32_t and std::int64_t respectively
(macro constant)
INT_FAST8_MIN INT_FAST16_MIN INT_FAST32_MIN INT_FAST64_MIN
minimum value of std::int_fast8_t , std::int_fast16_t , std::int_fast32_t and std::int_fast64_t respectively
(macro constant)
INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN
minimum value of std::int_least8_t , std::int_least16_t , std::int_least32_t and std::int_least64_t respectively
(macro constant)
INTPTR_MIN
(optional)
minimum value of std::intptr_t
(macro constant)
INTMAX_MIN
minimum value of std::intmax_t
(macro constant)
Signed integers : maximum value
INT8_MAX INT16_MAX INT32_MAX INT64_MAX
(optional)
maximum value of std::int8_t , std::int16_t , std::int32_t and std::int64_t respectively
(macro constant)
INT_FAST8_MAX INT_FAST16_MAX INT_FAST32_MAX INT_FAST64_MAX
maximum value of std::int_fast8_t , std::int_fast16_t , std::int_fast32_t and std::int_fast64_t respectively
(macro constant)
INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX
maximum value of std::int_least8_t , std::int_least16_t , std::int_least32_t and std::int_least64_t respectively
(macro constant)
INTPTR_MAX
(optional)
maximum value of std::intptr_t
(macro constant)
INTMAX_MAX
maximum value of std::intmax_t
(macro constant)
Unsigned integers : maximum value
UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX
(optional)
maximum value of std::uint8_t , std::uint16_t , std::uint32_t and std::uint64_t respectively
(macro constant)
UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX
maximum value of std::uint_fast8_t , std::uint_fast16_t , std::uint_fast32_t and std::uint_fast64_t respectively
(macro constant)
UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX
maximum value of std::uint_least8_t , std::uint_least16_t , std::uint_least32_t and std::uint_least64_t respectively
(macro constant)
UINTPTR_MAX
(optional)
maximum value of std::uintptr_t
(macro constant)
UINTMAX_MAX
maximum value of std::uintmax_t
(macro constant)
Limits of other integer types
PTRDIFF_MIN
(C++11)
minimum value of std::ptrdiff_t
(macro constant)
PTRDIFF_MAX
(C++11)
maximum value of std::ptrdiff_t
(macro constant)
SIZE_MAX
(C++11)
maximum value of std::size_t
(macro constant)
SIG_ATOMIC_MIN
(C++11)
minimum value of std::sig_atomic_t
(macro constant)
SIG_ATOMIC_MAX
(C++11)
maximum value of std::sig_atomic_t
(macro constant)
WCHAR_MIN
(C++11)
minimum value of wchar_t
(macro constant)
WCHAR_MAX
(C++11)
maximum value of wchar_t
(macro constant)
WINT_MIN
(C++11)
minimum value of std::wint_t
(macro constant)
WINT_MAX
(C++11)
maximum value of std::wint_t
(macro constant)
Function macros for integer constants
INT8_C INT16_C INT32_C INT64_C
expands to an integer constant expression having the value specified by its argument and whose type is the promoted type of std::int_least8_t , std::int_least16_t , std::int_least32_t and std::int_least64_t respectively
(function macro)
INTMAX_C
expands to an integer constant expression having the value specified by its argument and the type std::intmax_t
(function macro)
UINT8_C UINT16_C UINT32_C UINT64_C
expands to an integer constant expression having the value specified by its argument and whose type is the promoted type of std::uint_least8_t , std::uint_least16_t , std::uint_least32_t and std::uint_least64_t respectively
(function macro)
UINTMAX_C
expands to an integer constant expression having the value specified by its argument and the type std::uintmax_t
(function macro)

Synopsis

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 */