Namespaces
Variants

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_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) [edit]
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) [edit]
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) [edit]
intmax_t
maximum-width signed integer type
(typedef) [edit]
intptr_t
(optional)
signed integer type capable of holding a pointer to void
(typedef) [edit]
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) [edit]
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) [edit]
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) [edit]
uintmax_t
maximum-width unsigned integer type
(typedef) [edit]
uintptr_t
(optional)
unsigned integer type capable of holding a pointer to void
(typedef) [edit]

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) [edit]
INT_FASTN_WIDTH
(C++26)(conditionally present)
bit width of std::int_fastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INT_LEASTN_WIDTH
(C++26)(conditionally present)
bit width of std::int_leastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INTMAX_WIDTH
(C++26)
bit width of std::intmax_t
(macro constant) [edit]
INTPTR_WIDTH
(C++26)(conditionally present)
bit width of std::intptr_t
(macro constant) [edit]
Signed integers : minimum value
INTN_MIN
(conditionally present)
minimum value of std::intN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INT_FASTN_MIN
(conditionally present)
minimum value of std::int_fastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INT_LEASTN_MIN
(conditionally present)
minimum value of std::int_leastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INTMAX_MIN
minimum value of std::intmax_t
(macro constant) [edit]
INTPTR_MIN
(conditionally present)
minimum value of std::intptr_t
(macro constant) [edit]
Signed integers : maximum value
INTN_MAX
(conditionally present)
maximum value of std::intN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INT_FASTN_MAX
(conditionally present)
maximum value of std::int_fastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INT_LEASTN_MAX
(conditionally present)
maximum value of std::int_leastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
INTMAX_MAX
maximum value of std::intmax_t
(macro constant) [edit]
INTPTR_MAX
(conditionally present)
maximum value of std::intptr_t
(macro constant) [edit]
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) [edit]
UINT_FASTN_WIDTH
(C++26)(conditionally present)
bit width of std::uint_fastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
UINT_LEASTN_WIDTH
(C++26)(conditionally present)
bit width of std::uint_leastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
UINTMAX_WIDTH
(C++26)
bit width of std::uintmax_t
(macro constant) [edit]
UINTPTR_WIDTH
(C++26)(conditionally present)
bit width of std::uintptr_t
(macro constant) [edit]
Unsigned integers : maximum value
UINTN_MAX
(conditionally present)
maximum value of std::uintN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
UINT_FASTN_MAX
(conditionally present)
maximum value of std::uint_fastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
UINT_LEASTN_MAX
(conditionally present)
maximum value of std::uint_leastN_t (N is typically 8, 16, 32 or 64)
(macro constant) [edit]
UINTMAX_MAX
maximum value of std::uintmax_t
(macro constant) [edit]
UINTPTR_MAX
(conditionally present)
maximum value of std::uintptr_t
(macro constant) [edit]
Characteristics of other integer types
PTRDIFF_WIDTH
(C++26)
bit width of std::ptrdiff_t
(macro constant) [edit]
PTRDIFF_MIN
minimum value of std::ptrdiff_t
(macro constant) [edit]
PTRDIFF_MAX
maximum value of std::ptrdiff_t
(macro constant) [edit]
SIZE_WIDTH
(C++26)
bit width of std::size_t
(macro constant) [edit]
SIZE_MAX
maximum value of std::size_t
(macro constant) [edit]
SIG_ATOMIC_WIDTH
(C++26)
bit width of std::sig_atomic_t
(macro constant) [edit]
SIG_ATOMIC_MIN
minimum value of std::sig_atomic_t
(macro constant) [edit]
SIG_ATOMIC_MAX
maximum value of std::sig_atomic_t
(macro constant) [edit]
WINT_WIDTH
(C++26)
bit width of std::wint_t
(macro constant) [edit]
WINT_MIN
minimum value of std::wint_t
(macro constant) [edit]
WINT_MAX
maximum value of std::wint_t
(macro constant) [edit]
WCHAR_WIDTH
(C++26)
bit width of wchar_t
(macro constant) [edit]
WCHAR_MIN
minimum value of wchar_t
(macro constant) [edit]
WCHAR_MAX
maximum value of wchar_t
(macro constant) [edit]
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) [edit]
INTMAX_C
expands to an integer constant expression of type std::intmax_t, its value is specified by the argument
(function macro) [edit]
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) [edit]
UINTMAX_C
expands to an integer constant expression of type std::uintmax_t, its value is specified by the argument
(function macro) [edit]

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

// all freestanding
#define __STDC_VERSION_STDINT_H__ 202311L

namespace std {
  using int8_t = /* implementation-defined */;     // optional
  using int16_t = /* implementation-defined */;    // optional
  using int32_t = /* implementation-defined */;    // optional
  using int64_t = /* implementation-defined */;    // optional
  using int/*N*/_t = /* see description */;        // optional

  using int_fast8_t = /* implementation-defined */;
  using int_fast16_t = /* implementation-defined */;
  using int_fast32_t = /* implementation-defined */;
  using int_fast64_t = /* implementation-defined */;
  using int_fast/*N*/_t = /* see description */;   // optional

  using int_least8_t = /* implementation-defined */;
  using int_least16_t = /* implementation-defined */;
  using int_least32_t = /* implementation-defined */;
  using int_least64_t = /* implementation-defined */;
  using int_least/*N*/_t = /* see description */;  // optional

  using intmax_t = /* implementation-defined */;
  using intptr_t = /* implementation-defined */;   // optional

  using uint8_t = /* implementation-defined */;    // optional
  using uint16_t = /* implementation-defined */;   // optional
  using uint32_t = /* implementation-defined */;   // optional
  using uint64_t = /* implementation-defined */;   // optional
  using uint/*N*/_t = /* see description */;       // optional

  using uint_fast8_t = /* implementation-defined */;
  using uint_fast16_t = /* implementation-defined */;
  using uint_fast32_t = /* implementation-defined */;
  using uint_fast64_t = /* implementation-defined */;
  using uint_fast/*N*/_t = /* see description */;  // optional

  using uint_least8_t = /* implementation-defined */;
  using uint_least16_t = /* implementation-defined */;
  using uint_least32_t = /* implementation-defined */;
  using uint_least64_t = /* implementation-defined */;
  using uint_least/*N*/_t = /* see description */; // optional

  using uintmax_t = /* implementation-defined */;
  using uintptr_t = /* implementation-defined */;  // optional
}

#define INT/*N*/_MIN                               /* see description */
#define INT/*N*/_MAX                               /* see description */
#define UINT/*N*/_MAX                              /* see description */
#define INT/*N*/_WIDTH                             /* see description */
#define UINT/*N*/_WIDTH                            /* see description */

#define INT_FAST/*N*/_MIN                          /* see description */
#define INT_FAST/*N*/_MAX                          /* see description */
#define UINT_FAST/*N*/_MAX                         /* see description */
#define INT_FAST/*N*/_WIDTH                        /* see description */
#define UINT_FAST/*N*/_WIDTH                       /* see description */

#define INT_LEAST/*N*/_MIN                         /* see description */
#define INT_LEAST/*N*/_MAX                         /* see description */
#define UINT_LEAST/*N*/_MAX                        /* see description */
#define INT_LEAST/*N*/_WIDTH                       /* see description */
#define UINT_LEAST/*N*/_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 INT/*N*/_C(value)                          /* see description */
#define UINT/*N*/_C(value)                         /* see description */
#define INTMAX_C(value)                            /* see description */
#define UINTMAX_C(value)                           /* see description */