Standard library header <cstdint> - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <cstdint>

From cppreference.com
< cpp‎ | header

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.

### [edit] Types

Defined in header `<cstdint>`
int8_tint16_tint32_tint64_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 only if the implementation directly supports the type) (typedef) [edit]
int_fast8_tint_fast16_tint_fast32_tint_fast64_t | fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) [edit]
int_least8_tint_least16_tint_least32_tint_least64_t | smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) [edit]
intmax_t | maximum width integer type (typedef) [edit]
intptr_t (optional) | integer type capable of holding a pointer (typedef) [edit]
uint8_tuint16_tuint32_tuint64_t (optional) | unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively (provided only if the implementation directly supports the type) (typedef) [edit]
uint_fast8_tuint_fast16_tuint_fast32_tuint_fast64_t | fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) [edit]
uint_least8_tuint_least16_tuint_least32_tuint_least64_t | smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) [edit]
uintmax_t | maximum width unsigned integer type (typedef) [edit]
uintptr_t (optional) | unsigned integer type capable of holding a pointer (typedef) [edit]

### [edit] Macros

Defined in header `<cstdint>`
##### Signed integers : minimum value
INT8_MININT16_MININT32_MININT64_MIN | minimum value of an object of type int8_t, int16_t, int32_t, int64_t (macro constant) [edit]
INT_FAST8_MININT_FAST16_MININT_FAST32_MININT_FAST64_MIN | minimum value of an object of type int_fast8_t, int_fast16_t, int_fast32_t, int_fast64_t (macro constant) [edit]
INT_LEAST8_MININT_LEAST16_MININT_LEAST32_MININT_LEAST64_MIN | minimum value of an object of type int_least8_t, int_least16_t, int_least32_t, int_least64_t (macro constant) [edit]
INTPTR_MIN | minimum value of an object of type intptr_t (macro constant) [edit]
INTMAX_MIN | minimum value of an object of type intmax_t (macro constant) [edit]
##### Signed integers : maximum value
INT8_MAXINT16_MAXINT32_MAXINT64_MAX | maximum value of an object of type int8_t, int16_t, int32_t, int64_t (macro constant) [edit]
INT_FAST8_MAXINT_FAST16_MAXINT_FAST32_MAXINT_FAST64_MAX | maximum value of an object of type int_fast8_t, int_fast16_t, int_fast32_t, int_fast64_t (macro constant) [edit]
INT_LEAST8_MAXINT_LEAST16_MAXINT_LEAST32_MAXINT_LEAST64_MAX | maximum value of an object of type int_least8_t, int_least16_t, int_least32_t, int_least64_t (macro constant) [edit]
INTPTR_MAX | maximum value of an object of type intptr_t (macro constant) [edit]
INTMAX_MAX | maximum value of an object of type intmax_t (macro constant) [edit]
##### Unsigned integers : maximum value
UINT8_MAXUINT16_MAXUINT32_MAXUINT64_MAX | maximum value of an object of type uint8_t, uint16_t, uint32_t, uint64_t (macro constant) [edit]
UINT_FAST8_MAXUINT_FAST16_MAXUINT_FAST32_MAXUINT_FAST64_MAX | maximum value of an object of type uint_fast8_t, uint_fast16_t, uint_fast32_t, uint_fast64_t (macro constant) [edit]
UINT_LEAST8_MAXUINT_LEAST16_MAXUINT_LEAST32_MAXUINT_LEAST64_MAX | maximum value of an object of type uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t (macro constant) [edit]
UINTPTR_MAX | maximum value of an object of type uintptr_t (macro constant) [edit]
UINTMAX_MAX | maximum value of an object of type uintmax_t (macro constant) [edit]
##### Limits of other integer types
PTRDIFF_MIN (C++11) | minimum value of object of std::ptrdiff_t type (macro constant) [edit]
PTRDIFF_MAX (C++11) | maximum value of object of std::ptrdiff_t type (macro constant) [edit]
SIZE_MAX (C++11) | maximum value of object of std::size_t type (macro constant) [edit]
SIG_ATOMIC_MIN (C++11) | minimum value of object of std::sig_atomic_t type (macro constant) [edit]
SIG_ATOMIC_MAX (C++11) | maximum value of object of std::sig_atomic_t type (macro constant) [edit]
WCHAR_MIN (C++11) | minimum value of object of wchar_t type (macro constant) [edit]
WCHAR_MAX (C++11) | maximum value of object of wchar_t type (macro constant) [edit]
WINT_MIN (C++11) | minimum value of object of std::wint_t type (macro constant) [edit]
WINT_MAX (C++11) | maximum value of object of std::wint_t type (macro constant) [edit]
##### Function macros for integer constants
INT8_CINT16_CINT32_CINT64_C | expands to an integer constant expression having the value specified by its argument and the type int_least8_t, int_least16_t, int_least32_t, int_least64_t respectively (function macro) [edit]
INTMAX_C | expands to an integer constant expression having the value specified by its argument and the type intmax_t (function macro) [edit]
UINT8_CUINT16_CUINT32_CUINT64_C | expands to an integer constant expression having the value specified by its argument and the type uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t respectively (function macro) [edit]
UINTMAX_C | expands to an integer constant expression having the value specified by its argument and the type uintmax_t (function macro) [edit]

### [edit] 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 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_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 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 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_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 uintmax_t = /*unsigned integer type*/ ;
      using uintptr_t = /*unsigned integer type*/ ; // optional
    }
    /* also defines macros of the form:
    INT_[FAST LEAST]{8 16 32 64}_MIN
    [U]INT_[FAST LEAST]{8 16 32 64}_MAX
    INT{MAX PTR}_MIN
    [U]INT{MAX PTR}_MAX
    {PTRDIFF SIG_ATOMIC WCHAR WINT}{_MAX _MIN}
    SIZE_MAX
    */
    /* also defines function-like macros of the form:
    [U]INT{8 16 32 64 MAX}_C
    */

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/cstdint&oldid=89001"