NAME

inttypes.h - fixed size integer types

SYNOPSIS

#include <inttypes.h>

DESCRIPTION

[CX] Some of the functionality described on this reference page extends the ISO C standard. Applications shall define
the appropriate feature test macro (see XSH The Compilation Environment
) to enable the visibility of these symbols in this header.

The <inttypes.h> header shall define the following macros. Each expands to a character string literal containing a
conversion specifier, possibly modified by a length modifier, suitable for use within the format argument of a formatted
input/output function when converting the corresponding integer type. These macros have the general form of PRI (character string
literals for the fprintf() and fwprintf() family of functions) or SCN (character string literals for the fscanf() and fwscanf() family of functions),
followed by the conversion specifier, followed by a name corresponding to a similar type name in <stdint.h>. In these names, N represents the width of the type as described in
<stdint.h>. For example, PRIdFAST32 can be used in a format string to
print the value of an integer of type int_fast32_t.

For each type that the implementation provides in <stdint.h>, the
corresponding fprintf() and fwprintf() macros shall be defined and the corresponding fscanf() and fwscanf() macros shall be defined
unless the implementation does not have a suitable modifier for the type.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

EXAMPLES

APPLICATION USAGE

The purpose of <inttypes.h> is to provide a set of integer types whose definitions are consistent across machines
and independent of operating systems and other implementation idiosyncrasies. It defines, through typedef, integer types of
various sizes. Implementations are free to typedef them as ISO C standard integer types or extensions that they
support. Consistent use of this header will greatly increase the portability of applications across platforms.

RATIONALE

The ISO/IEC 9899:1990 standard specified that the language should support four signed and unsigned integer data types-
char, short, int, and long- but placed very little requirement on their size other than that int
and short be at least 16 bits and long be at least as long as int and not smaller than 32 bits. For 16-bit
systems, most implementations assigned 8, 16, 16, and 32 bits to char, short, int, and long,
respectively. For 32-bit systems, the common practice has been to assign 8, 16, 32, and 32 bits to these types. This difference in
int size can create some problems for users who migrate from one system to another which assigns different sizes to integer
types, because the ISO C standard integer promotion rule can produce silent changes unexpectedly. The need for defining an
extended integer type increased with the introduction of 64-bit systems.

FUTURE DIRECTIONS

Macro names beginning with PRI or SCN followed by any lowercase letter or 'X' may be added to the macros defined in the
<inttypes.h> header.