logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

inttypes.h.0p (6872B)


  1. '\" et
  2. .TH inttypes.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. inttypes.h
  12. \(em fixed size integer types
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <inttypes.h>
  17. .fi
  18. .SH DESCRIPTION
  19. Some of the functionality described on this reference page extends the
  20. ISO\ C standard. Applications shall define the appropriate feature test macro
  21. (see the System Interfaces volume of POSIX.1\(hy2017,
  22. .IR "Section 2.2" ", " "The Compilation Environment")
  23. to enable the visibility of these symbols in this header.
  24. .P
  25. The
  26. .IR <inttypes.h>
  27. header shall include the
  28. .IR <stdint.h>
  29. header.
  30. .P
  31. The
  32. .IR <inttypes.h>
  33. header shall define at least the following types:
  34. .IP "\fBimaxdiv_t\fR" 12
  35. Structure type that is the type of the value returned by the
  36. \fIimaxdiv\fR()
  37. function.
  38. .IP "\fBwchar_t\fR" 12
  39. As described in
  40. .IR <stddef.h> .
  41. .P
  42. The
  43. .IR <inttypes.h>
  44. header shall define the following macros. Each expands to a
  45. character string literal containing a conversion specifier, possibly
  46. modified by a length modifier, suitable for use within the
  47. .IR format
  48. argument of a formatted input/output function when converting the
  49. corresponding integer type. These macros have the general form of
  50. PRI (character string literals for the
  51. \fIfprintf\fR()
  52. and
  53. \fIfwprintf\fR()
  54. family of functions) or SCN (character string literals for the
  55. \fIfscanf\fR()
  56. and
  57. \fIfwscanf\fR()
  58. family of functions), followed by the conversion specifier, followed by
  59. a name corresponding to a similar type name in
  60. .IR <stdint.h> .
  61. In these names,
  62. .IR N
  63. represents the width of the type as described in
  64. .IR <stdint.h> .
  65. For example,
  66. .IR PRIdFAST32
  67. can be used in a format string to print the value of an integer of type
  68. .BR int_fast32_t .
  69. .P
  70. The
  71. \fIfprintf\fR()
  72. macros for signed integers are:
  73. .sp
  74. .RS
  75. .TS
  76. tab(!);
  77. le le le le le.
  78. PRId\fIN\fR!PRIdLEAST\fIN\fR!PRIdFAST\fIN\fR!PRIdMAX!PRIdPTR
  79. PRIi\fIN\fR!PRIiLEAST\fIN\fR!PRIiFAST\fIN\fR!PRIiMAX!PRIiPTR
  80. .TE
  81. .RE
  82. .P
  83. The
  84. \fIfprintf\fR()
  85. macros for unsigned integers are:
  86. .sp
  87. .RS
  88. .TS
  89. tab(!);
  90. le le le le le.
  91. PRIo\fIN\fR!PRIoLEAST\fIN\fR!PRIoFAST\fIN\fR!PRIoMAX!PRIoPTR
  92. PRIu\fIN\fR!PRIuLEAST\fIN\fR!PRIuFAST\fIN\fR!PRIuMAX!PRIuPTR
  93. PRIx\fIN\fR!PRIxLEAST\fIN\fR!PRIxFAST\fIN\fR!PRIxMAX!PRIxPTR
  94. PRIX\fIN\fR!PRIXLEAST\fIN\fR!PRIXFAST\fIN\fR!PRIXMAX!PRIXPTR
  95. .TE
  96. .RE
  97. .P
  98. The
  99. \fIfscanf\fR()
  100. macros for signed integers are:
  101. .sp
  102. .RS
  103. .TS
  104. tab(!);
  105. le le le le le.
  106. SCNd\fIN\fR!SCNdLEAST\fIN\fR!SCNdFAST\fIN\fR!SCNdMAX!SCNdPTR
  107. SCNi\fIN\fR!SCNiLEAST\fIN\fR!SCNiFAST\fIN\fR!SCNiMAX!SCNiPTR
  108. .TE
  109. .RE
  110. .P
  111. The
  112. \fIfscanf\fR()
  113. macros for unsigned integers are:
  114. .sp
  115. .RS
  116. .TS
  117. tab(!);
  118. le le le le le.
  119. SCNo\fIN\fR!SCNoLEAST\fIN\fR!SCNoFAST\fIN\fR!SCNoMAX!SCNoPTR
  120. SCNu\fIN\fR!SCNuLEAST\fIN\fR!SCNuFAST\fIN\fR!SCNuMAX!SCNuPTR
  121. SCNx\fIN\fR!SCNxLEAST\fIN\fR!SCNxFAST\fIN\fR!SCNxMAX!SCNxPTR
  122. .TE
  123. .RE
  124. .P
  125. For each type that the implementation provides in
  126. .IR <stdint.h> ,
  127. the corresponding
  128. \fIfprintf\fR()
  129. and
  130. \fIfwprintf\fR()
  131. macros shall be defined and the corresponding
  132. \fIfscanf\fR()
  133. and
  134. \fIfwscanf\fR()
  135. macros shall be defined unless the implementation does not have a
  136. suitable modifier for the type.
  137. .P
  138. The following shall be declared as functions and may also be defined as
  139. macros. Function prototypes shall be provided.
  140. .sp
  141. .RS 4
  142. .nf
  143. intmax_t imaxabs(intmax_t);
  144. imaxdiv_t imaxdiv(intmax_t, intmax_t);
  145. intmax_t strtoimax(const char *restrict, char **restrict, int);
  146. uintmax_t strtoumax(const char *restrict, char **restrict, int);
  147. intmax_t wcstoimax(const wchar_t *restrict, wchar_t **restrict, int);
  148. uintmax_t wcstoumax(const wchar_t *restrict, wchar_t **restrict, int);
  149. .fi
  150. .P
  151. .RE
  152. .LP
  153. .IR "The following sections are informative."
  154. .SH "EXAMPLES"
  155. .LP
  156. .nf
  157. #include <inttypes.h>
  158. #include <wchar.h>
  159. int main(void)
  160. {
  161. uintmax_t i = UINTMAX_MAX; // This type always exists.
  162. wprintf(L"The largest integer value is %020"
  163. PRIxMAX "\en", i);
  164. return 0;
  165. }
  166. .fi
  167. .SH "APPLICATION USAGE"
  168. The purpose of
  169. .IR <inttypes.h>
  170. is to provide a set of integer types whose definitions are consistent
  171. across machines and independent of operating systems and other
  172. implementation idiosyncrasies. It defines, through
  173. .BR typedef ,
  174. integer types of various sizes. Implementations are free to
  175. .BR typedef
  176. them as ISO\ C standard integer types or extensions that they support. Consistent
  177. use of this header will greatly increase the portability of applications
  178. across platforms.
  179. .SH RATIONALE
  180. The ISO/IEC\ 9899:\|1990 standard specified that the language should support four signed and
  181. unsigned integer data types\(em\c
  182. .BR char ,
  183. .BR short ,
  184. .BR int ,
  185. and
  186. .BR long \(em\c
  187. but placed very little requirement on their size other than that
  188. .BR int
  189. and
  190. .BR short
  191. be at least 16 bits and
  192. .BR long
  193. be at least as long as
  194. .BR int
  195. and not smaller than 32 bits. For 16-bit systems, most implementations
  196. assigned 8, 16, 16, and 32 bits to
  197. .BR char ,
  198. .BR short ,
  199. .BR int ,
  200. and
  201. .BR long ,
  202. respectively. For 32-bit systems, the common practice has been to
  203. assign 8, 16, 32, and 32 bits to these types. This difference in
  204. .BR int
  205. size can create some problems for users who migrate from one system to
  206. another which assigns different sizes to integer types, because the
  207. ISO\ C standard integer promotion rule can produce silent changes unexpectedly.
  208. The need for defining an extended integer type increased with the
  209. introduction of 64-bit systems.
  210. .SH "FUTURE DIRECTIONS"
  211. Macro names beginning with PRI or SCN followed by any lowercase letter
  212. or
  213. .BR 'X'
  214. may be added to the macros defined in the
  215. .IR <inttypes.h>
  216. header.
  217. .SH "SEE ALSO"
  218. .IR "\fB<stddef.h>\fP"
  219. .P
  220. The System Interfaces volume of POSIX.1\(hy2017,
  221. .IR "Section 2.2" ", " "The Compilation Environment",
  222. .IR "\fIimaxabs\fR\^(\|)",
  223. .IR "\fIimaxdiv\fR\^(\|)",
  224. .IR "\fIstrtoimax\fR\^(\|)",
  225. .IR "\fIwcstoimax\fR\^(\|)"
  226. .\"
  227. .SH COPYRIGHT
  228. Portions of this text are reprinted and reproduced in electronic form
  229. from IEEE Std 1003.1-2017, Standard for Information Technology
  230. -- Portable Operating System Interface (POSIX), The Open Group Base
  231. Specifications Issue 7, 2018 Edition,
  232. Copyright (C) 2018 by the Institute of
  233. Electrical and Electronics Engineers, Inc and The Open Group.
  234. In the event of any discrepancy between this version and the original IEEE and
  235. The Open Group Standard, the original IEEE and The Open Group Standard
  236. is the referee document. The original Standard can be obtained online at
  237. http://www.opengroup.org/unix/online.html .
  238. .PP
  239. Any typographical or formatting errors that appear
  240. in this page are most likely
  241. to have been introduced during the conversion of the source files to
  242. man page format. To report such errors, see
  243. https://www.kernel.org/doc/man-pages/reporting_bugs.html .