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

stdint.h.0p (16617B)


  1. '\" et
  2. .TH stdint.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. .EQ
  11. delim $$
  12. .EN
  13. .SH NAME
  14. stdint.h
  15. \(em integer types
  16. .SH SYNOPSIS
  17. .LP
  18. .nf
  19. #include <stdint.h>
  20. .fi
  21. .SH DESCRIPTION
  22. Some of the functionality described on this reference page extends the
  23. ISO\ C standard. Applications shall define the appropriate feature test macro
  24. (see the System Interfaces volume of POSIX.1\(hy2017,
  25. .IR "Section 2.2" ", " "The Compilation Environment")
  26. to enable the visibility of these symbols in this header.
  27. .P
  28. The
  29. .IR <stdint.h>
  30. header shall declare sets of integer types having specified widths, and
  31. shall define corresponding sets of macros. It shall also define macros
  32. that specify limits of integer types corresponding to types defined in
  33. other standard headers.
  34. .TP 10
  35. .BR Note:
  36. The ``width'' of an integer type is the number of bits used to store
  37. its value in a pure binary system; the actual type may use more bits
  38. than that (for example, a 28-bit type could be stored in 32 bits of
  39. actual storage). An
  40. .IR N -bit
  41. signed type has values in the range \-2\s-3\u\fIN\fR\-1\d\s+3 or
  42. 1\-2\s-3\u\fIN\fR\-1\d\s+3 to 2\s-3\u\fIN\fR\-1\d\s+3\-1, while
  43. an
  44. .IR N -bit
  45. unsigned type has values in the range 0 to 2\s-3\u\fIN\fR\d\s+3\-1.
  46. .P
  47. .P
  48. Types are defined in the following categories:
  49. .IP " *" 4
  50. Integer types having certain exact widths
  51. .IP " *" 4
  52. Integer types having at least certain specified widths
  53. .IP " *" 4
  54. Fastest integer types having at least certain specified widths
  55. .IP " *" 4
  56. Integer types wide enough to hold pointers to objects
  57. .IP " *" 4
  58. Integer types having greatest width
  59. .P
  60. (Some of these types may denote the same type.)
  61. .P
  62. Corresponding macros specify limits of the declared types and construct
  63. suitable constants.
  64. .P
  65. For each type described herein that the implementation provides, the
  66. .IR <stdint.h>
  67. header shall declare that
  68. .BR typedef
  69. name and define the associated macros. Conversely, for each type
  70. described herein that the implementation does not provide, the
  71. .IR <stdint.h>
  72. header shall not declare that
  73. .BR typedef
  74. name, nor shall it define the associated macros. An implementation
  75. shall provide those types described as required, but need not provide
  76. any of the others (described as optional).
  77. .SS "Integer Types"
  78. .P
  79. When
  80. .BR typedef
  81. names differing only in the absence or presence of the initial
  82. .IR u
  83. are defined, they shall denote corresponding signed and unsigned types
  84. as described in the ISO/IEC\ 9899:\|1999 standard, Section 6.2.5; an implementation providing
  85. one of these corresponding types shall also provide the other.
  86. .P
  87. In the following descriptions, the symbol
  88. .IR N
  89. represents an unsigned decimal integer with no leading zeros (for
  90. example, 8 or 24, but not 04 or 048).
  91. .IP " *" 4
  92. Exact-width integer types
  93. .RS 4
  94. .P
  95. The
  96. .BR typedef
  97. name
  98. .BR int \c
  99. .IR N \c
  100. .BR _t
  101. designates a signed integer type with width
  102. .IR N ,
  103. no padding bits, and a two's-complement representation. Thus,
  104. .BR int8_t
  105. denotes a signed integer type with a width of exactly 8 bits.
  106. .P
  107. The
  108. .BR typedef
  109. name
  110. .BR uint \c
  111. .IR N \c
  112. .BR _t
  113. designates an unsigned integer type with width
  114. .IR N .
  115. Thus,
  116. .BR uint24_t
  117. denotes an unsigned integer type with a width of exactly 24 bits.
  118. .P
  119. The following types are required:
  120. .P
  121. .nf
  122. .BR int8_t
  123. .BR int16_t
  124. .BR int32_t
  125. .BR uint8_t
  126. .BR uint16_t
  127. .BR uint32_t
  128. .fi
  129. .P
  130. If an implementation provides integer types with width 64 that
  131. meet these requirements, then the following types are required:
  132. .BR int64_t
  133. .BR uint64_t
  134. .P
  135. In particular, this will be the case if any of the following are
  136. true:
  137. .IP -- 4
  138. The implementation supports the _POSIX_V7_ILP32_OFFBIG programming
  139. environment and the application is being built in the
  140. _POSIX_V7_ILP32_OFFBIG programming environment (see the Shell and Utilities volume of POSIX.1\(hy2017,
  141. .IR c99 ,
  142. Programming Environments).
  143. .IP -- 4
  144. The implementation supports the _POSIX_V7_LP64_OFF64 programming
  145. environment and the application is being built in the
  146. _POSIX_V7_LP64_OFF64 programming environment.
  147. .IP -- 4
  148. The implementation supports the _POSIX_V7_LPBIG_OFFBIG programming
  149. environment and the application is being built in the
  150. _POSIX_V7_LPBIG_OFFBIG programming environment.
  151. .P
  152. All other types of this form are optional.
  153. .RE
  154. .IP " *" 4
  155. Minimum-width integer types
  156. .RS 4
  157. .P
  158. The
  159. .BR typedef
  160. name
  161. .BR int_least \c
  162. .IR N \c
  163. .BR _t
  164. designates a signed integer type with a width of at least
  165. .IR N ,
  166. such that no signed integer type with lesser size has at least the
  167. specified width. Thus,
  168. .BR int_least32_t
  169. denotes a signed integer type with a width of at least 32 bits.
  170. .P
  171. The
  172. .BR typedef
  173. name
  174. .BR uint_least \c
  175. .IR N \c
  176. .BR _t
  177. designates an unsigned integer type with a width of at least
  178. .IR N ,
  179. such that no unsigned integer type with lesser size has at least the
  180. specified width. Thus,
  181. .BR uint_least16_t
  182. denotes an unsigned integer type with a width of at least 16 bits.
  183. .P
  184. The following types are required:
  185. .BR int_least8_t
  186. .BR int_least16_t
  187. .BR int_least32_t
  188. .BR int_least64_t
  189. .BR uint_least8_t
  190. .BR uint_least16_t
  191. .BR uint_least32_t
  192. .BR uint_least64_t
  193. .P
  194. All other types of this form are optional.
  195. .RE
  196. .IP " *" 4
  197. Fastest minimum-width integer types
  198. .RS 4
  199. .P
  200. Each of the following types designates an integer type that is usually
  201. fastest to operate with among all integer types that have at least the
  202. specified width.
  203. .P
  204. The designated type is not guaranteed to be fastest for all purposes;
  205. if the implementation has no clear grounds for choosing one type over
  206. another, it will simply pick some integer type satisfying the
  207. signedness and width requirements.
  208. .P
  209. The
  210. .BR typedef
  211. name
  212. .BR int_fast \c
  213. .IR N \c
  214. .BR _t
  215. designates the fastest signed integer type with a width of at least
  216. .IR N .
  217. The
  218. .BR typedef
  219. name
  220. .BR uint_fast \c
  221. .IR N \c
  222. .BR _t
  223. designates the fastest unsigned integer type with a width of at least
  224. .IR N .
  225. .P
  226. The following types are required:
  227. .BR int_fast8_t
  228. .BR int_fast16_t
  229. .BR int_fast32_t
  230. .BR int_fast64_t
  231. .BR uint_fast8_t
  232. .BR uint_fast16_t
  233. .BR uint_fast32_t
  234. .BR uint_fast64_t
  235. .P
  236. All other types of this form are optional.
  237. .RE
  238. .IP " *" 4
  239. Integer types capable of holding object pointers
  240. .RS 4
  241. .P
  242. The following type designates a signed integer type with the property
  243. that any valid pointer to
  244. .BR void
  245. can be converted to this type, then converted back to a pointer to
  246. .BR void ,
  247. and the result will compare equal to the original pointer:
  248. .BR intptr_t
  249. .P
  250. The following type designates an unsigned integer type with the
  251. property that any valid pointer to
  252. .BR void
  253. can be converted to this type, then converted back to a pointer to
  254. .BR void ,
  255. and the result will compare equal to the original pointer:
  256. .BR uintptr_t
  257. .P
  258. On XSI-conformant systems, the
  259. .BR intptr_t
  260. and
  261. .BR uintptr_t
  262. types are required;
  263. otherwise, they are optional.
  264. .RE
  265. .IP " *" 4
  266. Greatest-width integer types
  267. .RS 4
  268. .P
  269. The following type designates a signed integer type capable of
  270. representing any value of any signed integer type:
  271. .BR intmax_t
  272. .P
  273. The following type designates an unsigned integer type capable of
  274. representing any value of any unsigned integer type:
  275. .BR uintmax_t
  276. .P
  277. These types are required.
  278. .RE
  279. .TP 10
  280. .BR Note:
  281. Applications can test for optional types by using the corresponding
  282. limit macro from
  283. .IR "Limits of Specified-Width Integer Types".
  284. .P
  285. .SS "Limits of Specified-Width Integer Types"
  286. .P
  287. The following macros specify the minimum and maximum limits of the
  288. types declared in the
  289. .IR <stdint.h>
  290. header. Each macro name corresponds to a similar type name in
  291. .IR "Integer Types".
  292. .P
  293. Each instance of any defined macro shall be replaced by a constant
  294. expression suitable for use in
  295. .BR #if
  296. preprocessing directives, and this expression shall have the same type
  297. as would an expression that is an object of the corresponding type
  298. converted according to the integer promotions. Its
  299. implementation-defined value shall be equal to or greater in magnitude
  300. (absolute value) than the corresponding value given below, with the
  301. same sign, except where stated to be exactly the given value.
  302. .IP " *" 4
  303. Limits of exact-width integer types
  304. .RS 4
  305. .IP -- 4
  306. Minimum values of exact-width signed integer types:
  307. .RS 4
  308. .IP "{INT\fIN\fR_MIN}" 16
  309. Exactly \-($2"^" N\-1$)
  310. .RE
  311. .IP -- 4
  312. Maximum values of exact-width signed integer types:
  313. .RS 4
  314. .IP "{INT\fIN\fR_MAX}" 16
  315. Exactly $2"^" N\-1$ \-1
  316. .RE
  317. .IP -- 4
  318. Maximum values of exact-width unsigned integer types:
  319. .RS 4
  320. .IP "{UINT\fIN\fR_MAX}" 16
  321. Exactly $2"^" N$ \-1
  322. .RE
  323. .RE
  324. .IP " *" 4
  325. Limits of minimum-width integer types
  326. .RS 4
  327. .IP -- 4
  328. Minimum values of minimum-width signed integer types:
  329. .RS 4
  330. .IP "{INT_LEAST\fIN\fR_MIN}" 16
  331. \-($2"^" N\-1$ \-1)
  332. .RE
  333. .IP -- 4
  334. Maximum values of minimum-width signed integer types:
  335. .RS 4
  336. .IP "{INT_LEAST\fIN\fR_MAX}" 16
  337. $2"^" N\-1$ \-1
  338. .RE
  339. .IP -- 4
  340. Maximum values of minimum-width unsigned integer types:
  341. .RS 4
  342. .IP "{UINT_LEAST\fIN\fR_MAX}" 16
  343. $2"^" N$ \-1
  344. .RE
  345. .RE
  346. .IP " *" 4
  347. Limits of fastest minimum-width integer types
  348. .RS 4
  349. .IP -- 4
  350. Minimum values of fastest minimum-width signed integer types:
  351. .RS 4
  352. .IP "{INT_FAST\fIN\fR_MIN}" 16
  353. \-($2"^" N\-1$ \-1)
  354. .RE
  355. .IP -- 4
  356. Maximum values of fastest minimum-width signed integer types:
  357. .RS 4
  358. .IP "{INT_FAST\fIN\fR_MAX}" 16
  359. $2"^" N\-1$ \-1
  360. .RE
  361. .IP -- 4
  362. Maximum values of fastest minimum-width unsigned integer types:
  363. .RS 4
  364. .IP "{UINT_FAST\fIN\fR_MAX}" 16
  365. $2"^" N$ \-1
  366. .RE
  367. .RE
  368. .IP " *" 4
  369. Limits of integer types capable of holding object pointers
  370. .RS 4
  371. .IP -- 4
  372. Minimum value of pointer-holding signed integer type:
  373. .RS 4
  374. .IP {INTPTR_MIN} 16
  375. \-($2"^" 15$ \-1)
  376. .RE
  377. .IP -- 4
  378. Maximum value of pointer-holding signed integer type:
  379. .RS 4
  380. .IP {INTPTR_MAX} 16
  381. $2"^" 15$ \-1
  382. .RE
  383. .IP -- 4
  384. Maximum value of pointer-holding unsigned integer type:
  385. .RS 4
  386. .IP {UINTPTR_MAX} 16
  387. $2"^" 16$ \-1
  388. .RE
  389. .RE
  390. .IP " *" 4
  391. Limits of greatest-width integer types
  392. .RS 4
  393. .IP -- 4
  394. Minimum value of greatest-width signed integer type:
  395. .RS 4
  396. .IP {INTMAX_MIN} 16
  397. \-($2"^" 63$ \-1)
  398. .RE
  399. .IP -- 4
  400. Maximum value of greatest-width signed integer type:
  401. .RS 4
  402. .IP {INTMAX_MAX} 16
  403. $2"^" 63$ \-1
  404. .RE
  405. .IP -- 4
  406. Maximum value of greatest-width unsigned integer type:
  407. .RS 4
  408. .IP {UINTMAX_MAX} 16
  409. $2"^" 64$ \-1
  410. .RE
  411. .RE
  412. .SS "Limits of Other Integer Types"
  413. .P
  414. The following macros specify the minimum and maximum limits of integer
  415. types corresponding to types defined in other standard headers.
  416. .P
  417. Each instance of these macros shall be replaced by a constant
  418. expression suitable for use in
  419. .BR #if
  420. preprocessing directives, and this expression shall have the same type
  421. as would an expression that is an object of the corresponding type
  422. converted according to the integer promotions. Its
  423. implementation-defined value shall be equal to or greater in magnitude
  424. (absolute value) than the corresponding value given below, with the
  425. same sign.
  426. .IP " *" 4
  427. Limits of \fBptrdiff_t\fR:
  428. .RS 4
  429. .IP {PTRDIFF_MIN} 16
  430. \-65\|535
  431. .IP {PTRDIFF_MAX} 16
  432. +65\|535
  433. .RE
  434. .IP " *" 4
  435. Limits of \fBsig_atomic_t\fR:
  436. .RS 4
  437. .IP {SIG_ATOMIC_MIN} 16
  438. See below.
  439. .IP {SIG_ATOMIC_MAX} 16
  440. See below.
  441. .RE
  442. .IP " *" 4
  443. Limit of \fBsize_t\fR:
  444. .RS 4
  445. .IP {SIZE_MAX} 16
  446. 65\|535
  447. .RE
  448. .IP " *" 4
  449. Limits of \fBwchar_t\fR:
  450. .RS 4
  451. .IP {WCHAR_MIN} 16
  452. See below.
  453. .IP {WCHAR_MAX} 16
  454. See below.
  455. .RE
  456. .IP " *" 4
  457. Limits of \fBwint_t\fR:
  458. .RS 4
  459. .IP {WINT_MIN} 16
  460. See below.
  461. .IP {WINT_MAX} 16
  462. See below.
  463. .RE
  464. .P
  465. If
  466. .BR sig_atomic_t
  467. (see the
  468. .IR <signal.h>
  469. header) is defined as a signed integer type, the value of
  470. {SIG_ATOMIC_MIN}
  471. shall be no greater than \-127 and the value of
  472. {SIG_ATOMIC_MAX}
  473. shall be no less than 127; otherwise,
  474. .BR sig_atomic_t
  475. shall be defined as an unsigned integer type, and the value of
  476. {SIG_ATOMIC_MIN}
  477. shall be 0 and the value of
  478. {SIG_ATOMIC_MAX}
  479. shall be no less than 255.
  480. .P
  481. If
  482. .BR wchar_t
  483. (see the
  484. .IR <stddef.h>
  485. header) is defined as a signed integer type, the value of
  486. {WCHAR_MIN}
  487. shall be no greater than \-127 and the value of
  488. {WCHAR_MAX}
  489. shall be no less than 127; otherwise,
  490. .BR wchar_t
  491. shall be defined as an unsigned integer type, and the value of
  492. {WCHAR_MIN}
  493. shall be 0 and the value of
  494. {WCHAR_MAX}
  495. shall be no less than 255.
  496. .P
  497. If
  498. .BR wint_t
  499. (see the
  500. .IR <wchar.h>
  501. header) is defined as a signed integer type, the value of
  502. {WINT_MIN}
  503. shall be no greater than \-32\|767 and the value of
  504. {WINT_MAX}
  505. shall be no less than 32\|767; otherwise,
  506. .BR wint_t
  507. shall be defined as an unsigned integer type, and the value of
  508. {WINT_MIN}
  509. shall be 0 and the value of
  510. {WINT_MAX}
  511. shall be no less than 65\|535.
  512. .SS "Macros for Integer Constant Expressions"
  513. .P
  514. The following macros expand to integer constant expressions suitable for
  515. initializing objects that have integer types corresponding to types
  516. defined in the
  517. .IR <stdint.h>
  518. header. Each macro name corresponds to a similar type name listed under
  519. \fIMinimum-width integer types\fR and \fIGreatest-width integer
  520. types\fR.
  521. .P
  522. Each invocation of one of these macros shall expand to an integer
  523. constant expression suitable for use in
  524. .BR #if
  525. preprocessing directives. The type of the expression shall have the
  526. same type as would an expression that is an object of the corresponding
  527. type converted according to the integer promotions. The value of the
  528. expression shall be that of the argument.
  529. .P
  530. The argument in any instance of these macros shall be an unsuffixed
  531. integer constant with a value that does not exceed the limits for the
  532. corresponding type.
  533. .IP " *" 4
  534. Macros for minimum-width integer constant expressions
  535. .RS 4
  536. .P
  537. The macro
  538. .IR INTN_C (\c
  539. .IR value )
  540. shall expand to an integer constant expression corresponding to the
  541. type
  542. .BR int_least \c
  543. .IR N \c
  544. .BR _t .
  545. The macro
  546. .IR UINTN_C (\c
  547. .IR value )
  548. shall expand to an integer constant expression corresponding to the
  549. type
  550. .BR uint_least \c
  551. .IR N \c
  552. .BR _t .
  553. For example, if
  554. .BR uint_least64_t
  555. is a name for the type
  556. .BR "unsigned long long" ,
  557. then
  558. .IR UINT64_C (0x123)
  559. might expand to the integer constant 0x123ULL.
  560. .RE
  561. .IP " *" 4
  562. Macros for greatest-width integer constant expressions
  563. .RS 4
  564. .P
  565. The following macro expands to an integer constant expression having
  566. the value specified by its argument and the type
  567. .BR intmax_t :
  568. INTMAX_C(\fIvalue\fR)
  569. .P
  570. The following macro expands to an integer constant expression having
  571. the value specified by its argument and the type
  572. .BR uintmax_t :
  573. UINTMAX_C(\fIvalue\fR)
  574. .RE
  575. .LP
  576. .IR "The following sections are informative."
  577. .SH "APPLICATION USAGE"
  578. None.
  579. .SH RATIONALE
  580. The
  581. .IR <stdint.h>
  582. header is a subset of the
  583. .IR <inttypes.h>
  584. header more suitable for use in freestanding environments, which might
  585. not support the formatted I/O functions. In some environments, if the
  586. formatted conversion support is not wanted, using this header instead
  587. of the
  588. .IR <inttypes.h>
  589. header avoids defining such a large number of macros.
  590. .br
  591. .P
  592. As a consequence of adding
  593. .BR int8_t ,
  594. the following are true:
  595. .IP " *" 4
  596. A byte is exactly 8 bits.
  597. .IP " *" 4
  598. {CHAR_BIT}
  599. has the value 8,
  600. {SCHAR_MAX}
  601. has the value 127,
  602. {SCHAR_MIN}
  603. has the value \-128, and
  604. {UCHAR_MAX}
  605. has the value 255.
  606. .P
  607. (The POSIX standard explicitly requires 8-bit char and
  608. two's-complement arithmetic.)
  609. .SH "FUTURE DIRECTIONS"
  610. .BR typedef
  611. names beginning with
  612. .BR int
  613. or
  614. .BR uint
  615. and ending with _t may be added to the types defined in the
  616. .IR <stdint.h>
  617. header. Macro names beginning with INT or UINT and ending with _MAX,
  618. _MIN, or _C may be added to the macros defined in the
  619. .IR <stdint.h>
  620. header.
  621. .SH "SEE ALSO"
  622. .IR "\fB<inttypes.h>\fP",
  623. .IR "\fB<signal.h>\fP",
  624. .IR "\fB<stddef.h>\fP",
  625. .IR "\fB<wchar.h>\fP"
  626. .P
  627. The System Interfaces volume of POSIX.1\(hy2017,
  628. .IR "Section 2.2" ", " "The Compilation Environment"
  629. .\"
  630. .SH COPYRIGHT
  631. Portions of this text are reprinted and reproduced in electronic form
  632. from IEEE Std 1003.1-2017, Standard for Information Technology
  633. -- Portable Operating System Interface (POSIX), The Open Group Base
  634. Specifications Issue 7, 2018 Edition,
  635. Copyright (C) 2018 by the Institute of
  636. Electrical and Electronics Engineers, Inc and The Open Group.
  637. In the event of any discrepancy between this version and the original IEEE and
  638. The Open Group Standard, the original IEEE and The Open Group Standard
  639. is the referee document. The original Standard can be obtained online at
  640. http://www.opengroup.org/unix/online.html .
  641. .PP
  642. Any typographical or formatting errors that appear
  643. in this page are most likely
  644. to have been introduced during the conversion of the source files to
  645. man page format. To report such errors, see
  646. https://www.kernel.org/doc/man-pages/reporting_bugs.html .