Jump to content

inttypes.h

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 1exec1 (talk | contribs) at 14:38, 31 October 2011 (Naming Convention for Macros: already at C data types#Printf and scanf format specifiers). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The inttypes.h file is a C header file that is part of the C standard library and API. It was added with the 1999 version of the ISO C standard (known as C99). It includes the stdint.h header and defines a number of macros for using it with the printf and scanf family of functions, as well as functions for working with the intmax_t type.

Dependency Graph

The flowchart below shows the dependency graph for inttypes.h[1]

Dependency Graph

Rationale

The difference in processing speeds in different processors like 16-bit, 32-bit and 64-bit systems, called for a uniform size for various data types. ISO/IEC 9899:1990 specified that the language should support basic data types like char, int, short and long but did not restrict the minimum or maximum size for these data types, expect that int be at least 16-bits long and long be 32-bits long.

In 16-bit systems, most implementations assigned 8, 16, 16 and 32 bits for char, int, short and long data types, respectively. In 32-bit systems, it was 8, 32, 16 and 32 bits for char, int, short and long data types[2]. The difference in size of int caused problems to users who migrated from one system to another.

The main purpose of including this header file is to restrict, or in other words, limit the exact size of int data type to a particular value(may be 16 bits or 32 bits)[3]. It can also be used to limit the size of data type modifiers like unsigned int and signed to specific values by using the macros listed in the header file.[4]

See also

References

  1. ^ http://api.plexyplanet.org/inttypes_8h.html
  2. ^ Cite error: The named reference man was invoked but never defined (see the help page).
  3. ^ The Open Group Specifications Issue 6. "Application Usage and Rationale". The IEEE and The Open Group.{{cite web}}: CS1 maint: numeric names: authors list (link)
  4. ^ The Open Group Specifications Issue 6. "Application Usage and Rationale". The IEEE and The Open Group Base. Retrieved 14 September, 2011. {{cite web}}: Check date values in: |accessdate= (help)CS1 maint: numeric names: authors list (link)