stdint.h(3)                POSIX Programmer's Manual               stdint.h(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       stdint.h -- integer types

SSYYNNOOPPSSIISS
       #include <stdint.h>

DDEESSCCRRIIPPTTIIOONN
       Some of the functionality described on this reference page extends the
       ISO C standard. Applications shall define the appropriate feature test
       macro (see the System Interfaces volume of POSIX.1-2017, _S_e_c_t_i_o_n _2_._2,
       _T_h_e _C_o_m_p_i_l_a_t_i_o_n _E_n_v_i_r_o_n_m_e_n_t) to enable the visibility of these symbols
       in this header.

       The _<_s_t_d_i_n_t_._h_> header shall declare sets of integer types having
       specified widths, and shall define corresponding sets of macros. It
       shall also define macros that specify limits of integer types
       corresponding to types defined in other standard headers.

       NNoottee::     The ``width'' of an integer type is the number of bits used
                 to store its value in a pure binary system; the actual type
                 may use more bits than that (for example, a 28-bit type could
                 be stored in 32 bits of actual storage). An _N-bit signed type
                 has values in the range -2_N-1 or 1-2_N-1 to 2_N-1-1, while an
                 _N-bit unsigned type has values in the range 0 to 2_N-1.

       Types are defined in the following categories:

        *  Integer types having certain exact widths

        *  Integer types having at least certain specified widths

        *  Fastest integer types having at least certain specified widths

        *  Integer types wide enough to hold pointers to objects

        *  Integer types having greatest width

       (Some of these types may denote the same type.)

       Corresponding macros specify limits of the declared types and construct
       suitable constants.

       For each type described herein that the implementation provides, the
       _<_s_t_d_i_n_t_._h_> header shall declare that ttyyppeeddeeff name and define the
       associated macros. Conversely, for each type described herein that the
       implementation does not provide, the _<_s_t_d_i_n_t_._h_> header shall not
       declare that ttyyppeeddeeff name, nor shall it define the associated macros.
       An implementation shall provide those types described as required, but
       need not provide any of the others (described as optional).

   IInntteeggeerr TTyyppeess
       When ttyyppeeddeeff names differing only in the absence or presence of the
       initial _u are defined, they shall denote corresponding signed and
       unsigned types as described in the ISO/IEC 9899:1999 standard, Section
       6.2.5; an implementation providing one of these corresponding types
       shall also provide the other.

       In the following descriptions, the symbol _N represents an unsigned
       decimal integer with no leading zeros (for example, 8 or 24, but not 04
       or 048).

        *  Exact-width integer types

           The ttyyppeeddeeff name iinntt_N__tt designates a signed integer type with width
           _N, no padding bits, and a two's-complement representation. Thus,
           iinntt88__tt denotes a signed integer type with a width of exactly 8
           bits.

           The ttyyppeeddeeff name uuiinntt_N__tt designates an unsigned integer type with
           width _N.  Thus, uuiinntt2244__tt denotes an unsigned integer type with a
           width of exactly 24 bits.

           The following types are required:

           iinntt88__tt
           iinntt1166__tt
           iinntt3322__tt
           uuiinntt88__tt
           uuiinntt1166__tt
           uuiinntt3322__tt

           If an implementation provides integer types with width 64 that meet
           these requirements, then the following types are required: iinntt6644__tt
           uuiinntt6644__tt

           In particular, this will be the case if any of the following are
           true:

           --  The implementation supports the _POSIX_V7_ILP32_OFFBIG
               programming environment and the application is being built in
               the _POSIX_V7_ILP32_OFFBIG programming environment (see the
               Shell and Utilities volume of POSIX.1-2017, _c_9_9, Programming
               Environments).

           --  The implementation supports the _POSIX_V7_LP64_OFF64
               programming environment and the application is being built in
               the _POSIX_V7_LP64_OFF64 programming environment.

           --  The implementation supports the _POSIX_V7_LPBIG_OFFBIG
               programming environment and the application is being built in
               the _POSIX_V7_LPBIG_OFFBIG programming environment.

           All other types of this form are optional.

        *  Minimum-width integer types

           The ttyyppeeddeeff name iinntt__lleeaasstt_N__tt designates a signed integer type with
           a width of at least _N, such that no signed integer type with lesser
           size has at least the specified width. Thus, iinntt__lleeaasstt3322__tt denotes
           a signed integer type with a width of at least 32 bits.

           The ttyyppeeddeeff name uuiinntt__lleeaasstt_N__tt designates an unsigned integer type
           with a width of at least _N, such that no unsigned integer type with
           lesser size has at least the specified width. Thus, uuiinntt__lleeaasstt1166__tt
           denotes an unsigned integer type with a width of at least 16 bits.

           The following types are required: iinntt__lleeaasstt88__tt iinntt__lleeaasstt1166__tt
           iinntt__lleeaasstt3322__tt iinntt__lleeaasstt6644__tt uuiinntt__lleeaasstt88__tt uuiinntt__lleeaasstt1166__tt
           uuiinntt__lleeaasstt3322__tt uuiinntt__lleeaasstt6644__tt

           All other types of this form are optional.

        *  Fastest minimum-width integer types

           Each of the following types designates an integer type that is
           usually fastest to operate with among all integer types that have
           at least the specified width.

           The designated type is not guaranteed to be fastest for all
           purposes; if the implementation has no clear grounds for choosing
           one type over another, it will simply pick some integer type
           satisfying the signedness and width requirements.

           The ttyyppeeddeeff name iinntt__ffaasstt_N__tt designates the fastest signed integer
           type with a width of at least _N.  The ttyyppeeddeeff name uuiinntt__ffaasstt_N__tt
           designates the fastest unsigned integer type with a width of at
           least _N.

           The following types are required: iinntt__ffaasstt88__tt iinntt__ffaasstt1166__tt
           iinntt__ffaasstt3322__tt iinntt__ffaasstt6644__tt uuiinntt__ffaasstt88__tt uuiinntt__ffaasstt1166__tt uuiinntt__ffaasstt3322__tt
           uuiinntt__ffaasstt6644__tt

           All other types of this form are optional.

        *  Integer types capable of holding object pointers

           The following type designates a signed integer type with the
           property that any valid pointer to vvooiidd can be converted to this
           type, then converted back to a pointer to vvooiidd, and the result will
           compare equal to the original pointer: iinnttppttrr__tt

           The following type designates an unsigned integer type with the
           property that any valid pointer to vvooiidd can be converted to this
           type, then converted back to a pointer to vvooiidd, and the result will
           compare equal to the original pointer: uuiinnttppttrr__tt

           On XSI-conformant systems, the iinnttppttrr__tt and uuiinnttppttrr__tt types are
           required; otherwise, they are optional.

        *  Greatest-width integer types

           The following type designates a signed integer type capable of
           representing any value of any signed integer type: iinnttmmaaxx__tt

           The following type designates an unsigned integer type capable of
           representing any value of any unsigned integer type: uuiinnttmmaaxx__tt

           These types are required.

       NNoottee::     Applications can test for optional types by using the
                 corresponding limit macro from _L_i_m_i_t_s _o_f _S_p_e_c_i_f_i_e_d_-_W_i_d_t_h
                 _I_n_t_e_g_e_r _T_y_p_e_s.

   LLiimmiittss ooff SSppeecciiffiieedd--WWiiddtthh IInntteeggeerr TTyyppeess
       The following macros specify the minimum and maximum limits of the
       types declared in the _<_s_t_d_i_n_t_._h_> header. Each macro name corresponds to
       a similar type name in _I_n_t_e_g_e_r _T_y_p_e_s.

       Each instance of any defined macro shall be replaced by a constant
       expression suitable for use in ##iiff preprocessing directives, and this
       expression shall have the same type as would an expression that is an
       object of the corresponding type converted according to the integer
       promotions. Its implementation-defined value shall be equal to or
       greater in magnitude (absolute value) than the corresponding value
       given below, with the same sign, except where stated to be exactly the
       given value.

        *  Limits of exact-width integer types

           --  Minimum values of exact-width signed integer types:

               {INT_N_MIN}      Exactly -(2_^_N-1)

           --  Maximum values of exact-width signed integer types:

               {INT_N_MAX}      Exactly 2_^_N-1 -1

           --  Maximum values of exact-width unsigned integer types:

               {UINT_N_MAX}     Exactly 2_^_N -1

        *  Limits of minimum-width integer types

           --  Minimum values of minimum-width signed integer types:

               {INT_LEAST_N_MIN}
                               -(2_^_N-1 -1)

           --  Maximum values of minimum-width signed integer types:

               {INT_LEAST_N_MAX}
                               2_^_N-1 -1

           --  Maximum values of minimum-width unsigned integer types:

               {UINT_LEAST_N_MAX}
                               2_^_N -1

        *  Limits of fastest minimum-width integer types

           --  Minimum values of fastest minimum-width signed integer types:

               {INT_FAST_N_MIN} -(2_^_N-1 -1)

           --  Maximum values of fastest minimum-width signed integer types:

               {INT_FAST_N_MAX} 2_^_N-1 -1

           --  Maximum values of fastest minimum-width unsigned integer types:

               {UINT_FAST_N_MAX}
                               2_^_N -1

        *  Limits of integer types capable of holding object pointers

           --  Minimum value of pointer-holding signed integer type:

               {INTPTR_MIN}    -(2_^15 -1)

           --  Maximum value of pointer-holding signed integer type:

               {INTPTR_MAX}    2_^15 -1

           --  Maximum value of pointer-holding unsigned integer type:

               {UINTPTR_MAX}   2_^16 -1

        *  Limits of greatest-width integer types

           --  Minimum value of greatest-width signed integer type:

               {INTMAX_MIN}    -(2_^63 -1)

           --  Maximum value of greatest-width signed integer type:

               {INTMAX_MAX}    2_^63 -1

           --  Maximum value of greatest-width unsigned integer type:

               {UINTMAX_MAX}   2_^64 -1

   LLiimmiittss ooff OOtthheerr IInntteeggeerr TTyyppeess
       The following macros specify the minimum and maximum limits of integer
       types corresponding to types defined in other standard headers.

       Each instance of these macros shall be replaced by a constant
       expression suitable for use in ##iiff preprocessing directives, and this
       expression shall have the same type as would an expression that is an
       object of the corresponding type converted according to the integer
       promotions. Its implementation-defined value shall be equal to or
       greater in magnitude (absolute value) than the corresponding value
       given below, with the same sign.

        *  Limits of ppttrrddiiffff__tt:

           {PTRDIFF_MIN}   -65535

           {PTRDIFF_MAX}   +65535

        *  Limits of ssiigg__aattoommiicc__tt:

           {SIG_ATOMIC_MIN}
                           See below.

           {SIG_ATOMIC_MAX}
                           See below.

        *  Limit of ssiizzee__tt:

           {SIZE_MAX}      65535

        *  Limits of wwcchhaarr__tt:

           {WCHAR_MIN}     See below.

           {WCHAR_MAX}     See below.

        *  Limits of wwiinntt__tt:

           {WINT_MIN}      See below.

           {WINT_MAX}      See below.

       If ssiigg__aattoommiicc__tt (see the _<_s_i_g_n_a_l_._h_> header) is defined as a signed
       integer type, the value of {SIG_ATOMIC_MIN} shall be no greater than
       -127 and the value of {SIG_ATOMIC_MAX} shall be no less than 127;
       otherwise, ssiigg__aattoommiicc__tt shall be defined as an unsigned integer type,
       and the value of {SIG_ATOMIC_MIN} shall be 0 and the value of
       {SIG_ATOMIC_MAX} shall be no less than 255.

       If wwcchhaarr__tt (see the _<_s_t_d_d_e_f_._h_> header) is defined as a signed integer
       type, the value of {WCHAR_MIN} shall be no greater than -127 and the
       value of {WCHAR_MAX} shall be no less than 127; otherwise, wwcchhaarr__tt
       shall be defined as an unsigned integer type, and the value of
       {WCHAR_MIN} shall be 0 and the value of {WCHAR_MAX} shall be no less
       than 255.

       If wwiinntt__tt (see the _<_w_c_h_a_r_._h_> header) is defined as a signed integer
       type, the value of {WINT_MIN} shall be no greater than -32767 and the
       value of {WINT_MAX} shall be no less than 32767; otherwise, wwiinntt__tt
       shall be defined as an unsigned integer type, and the value of
       {WINT_MIN} shall be 0 and the value of {WINT_MAX} shall be no less than
       65535.

   MMaaccrrooss ffoorr IInntteeggeerr CCoonnssttaanntt EExxpprreessssiioonnss
       The following macros expand to integer constant expressions suitable
       for initializing objects that have integer types corresponding to types
       defined in the _<_s_t_d_i_n_t_._h_> header. Each macro name corresponds to a
       similar type name listed under _M_i_n_i_m_u_m_-_w_i_d_t_h _i_n_t_e_g_e_r _t_y_p_e_s and
       _G_r_e_a_t_e_s_t_-_w_i_d_t_h _i_n_t_e_g_e_r _t_y_p_e_s.

       Each invocation of one of these macros shall expand to an integer
       constant expression suitable for use in ##iiff preprocessing directives.
       The type of the expression shall have the same type as would an
       expression that is an object of the corresponding type converted
       according to the integer promotions. The value of the expression shall
       be that of the argument.

       The argument in any instance of these macros shall be an unsuffixed
       integer constant with a value that does not exceed the limits for the
       corresponding type.

        *  Macros for minimum-width integer constant expressions

           The macro _I_N_T_N___C(_v_a_l_u_e) shall expand to an integer constant
           expression corresponding to the type iinntt__lleeaasstt_N__tt.  The macro
           _U_I_N_T_N___C(_v_a_l_u_e) shall expand to an integer constant expression
           corresponding to the type uuiinntt__lleeaasstt_N__tt.  For example, if
           uuiinntt__lleeaasstt6644__tt is a name for the type uunnssiiggnneedd lloonngg lloonngg, then
           _U_I_N_T_6_4___C(0x123) might expand to the integer constant 0x123ULL.

        *  Macros for greatest-width integer constant expressions

           The following macro expands to an integer constant expression
           having the value specified by its argument and the type iinnttmmaaxx__tt:
           INTMAX_C(_v_a_l_u_e)

           The following macro expands to an integer constant expression
           having the value specified by its argument and the type uuiinnttmmaaxx__tt:
           UINTMAX_C(_v_a_l_u_e)

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       The _<_s_t_d_i_n_t_._h_> header is a subset of the _<_i_n_t_t_y_p_e_s_._h_> header more
       suitable for use in freestanding environments, which might not support
       the formatted I/O functions. In some environments, if the formatted
       conversion support is not wanted, using this header instead of the
       _<_i_n_t_t_y_p_e_s_._h_> header avoids defining such a large number of macros.

       As a consequence of adding iinntt88__tt, the following are true:

        *  A byte is exactly 8 bits.

        *  {CHAR_BIT} has the value 8, {SCHAR_MAX} has the value 127,
           {SCHAR_MIN} has the value -128, and {UCHAR_MAX} has the value 255.

       (The POSIX standard explicitly requires 8-bit char and two's-complement
       arithmetic.)

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       ttyyppeeddeeff names beginning with iinntt or uuiinntt and ending with _t may be
       added to the types defined in the _<_s_t_d_i_n_t_._h_> header. Macro names
       beginning with INT or UINT and ending with _MAX, _MIN, or _C may be
       added to the macros defined in the _<_s_t_d_i_n_t_._h_> header.

SSEEEE AALLSSOO
       <<iinnttttyyppeess..hh>>, <<ssiiggnnaall..hh>>, <<ssttddddeeff..hh>>, <<wwcchhaarr..hh>>

       The System Interfaces volume of POSIX.1-2017, _S_e_c_t_i_o_n _2_._2, _T_h_e
       _C_o_m_p_i_l_a_t_i_o_n _E_n_v_i_r_o_n_m_e_n_t

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                          stdint.h(3)
