cppreference.com
Create account
Namespaces
Variants
Actions
 
 
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)
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 until c++29)
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 until c++29)
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

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