📄 stdint.h.html
字号:
<p>Limits of fastest minimum-width integer types</p><ul><li><p>Minimum values of fastest minimum-width signed integer types:</p><dl compact><dt>{INT_FAST<i>N</i>_MIN}</dt><dd>-(2 <small><sup> N-1</sup></small> -1)</dd></dl></li><li><p>Maximum values of fastest minimum-width signed integer types:</p><dl compact><dt>{INT_FAST<i>N</i>_MAX}</dt><dd>2 <small><sup> N-1</sup></small> -1</dd></dl></li><li><p>Maximum values of fastest minimum-width unsigned integer types:</p><dl compact><dt>{UINT_FAST<i>N</i>_MAX}</dt><dd>2 <small><sup> N</sup></small> -1</dd></dl></li></ul></li><li><p>Limits of integer types capable of holding object pointers</p><ul><li><p>Minimum value of pointer-holding signed integer type:</p><dl compact><dt>{INTPTR_MIN}</dt><dd>-(2 <small><sup> 15</sup></small> -1)</dd></dl></li><li><p>Maximum value of pointer-holding signed integer type:</p><dl compact><dt>{INTPTR_MAX}</dt><dd>2 <small><sup> 15</sup></small> -1</dd></dl></li><li><p>Maximum value of pointer-holding unsigned integer type:</p><dl compact><dt>{UINTPTR_MAX}</dt><dd>2 <small><sup> 16</sup></small> -1</dd></dl></li></ul></li><li><p>Limits of greatest-width integer types</p><ul><li><p>Minimum value of greatest-width signed integer type:</p><dl compact><dt>{INTMAX_MIN}</dt><dd>-(2 <small><sup> 63</sup></small> -1)</dd></dl></li><li><p>Maximum value of greatest-width signed integer type:</p><dl compact><dt>{INTMAX_MAX}</dt><dd>2 <small><sup> 63</sup></small> -1</dd></dl></li><li><p>Maximum value of greatest-width unsigned integer type:</p><dl compact><dt>{UINTMAX_MAX}</dt><dd>2 <small><sup> 64</sup></small> -1</dd></dl></li></ul></li></ul><h5><a name="tag_13_48_03_03"></a>Limits of Other Integer Types</h5><p>The following macros specify the minimum and maximum limits of integer types corresponding to types defined in other standardheaders.</p><p>Each instance of these macros shall be replaced by a constant expression suitable for use in <b>#if</b> preprocessingdirectives, and this expression shall have the same type as would an expression that is an object of the corresponding typeconverted according to the integer promotions. Its implementation-defined value shall be equal to or greater in magnitude (absolutevalue) than the corresponding value given below, with the same sign.</p><ul><li><p>Limits of <b>ptrdiff_t</b>:</p><dl compact><dt>{PTRDIFF_MIN}</dt><dd>-65535</dd><dt>{PTRDIFF_MAX}</dt><dd>+65535</dd></dl></li><li><p>Limits of <b>sig_atomic_t</b>:</p><dl compact><dt>{SIG_ATOMIC_MIN}</dt><dd>See below.</dd><dt>{SIG_ATOMIC_MAX}</dt><dd>See below.</dd></dl></li><li><p>Limit of <b>size_t</b>:</p><dl compact><dt>{SIZE_MAX}</dt><dd>65535</dd></dl></li><li><p>Limits of <b>wchar_t</b>:</p><dl compact><dt>{WCHAR_MIN}</dt><dd>See below.</dd><dt>{WCHAR_MAX}</dt><dd>See below.</dd></dl></li><li><p>Limits of <b>wint_t</b>:</p><dl compact><dt>{WINT_MIN}</dt><dd>See below.</dd><dt>{WINT_MAX}</dt><dd>See below.</dd></dl></li></ul><p>If <b>sig_atomic_t</b> (see the <a href="../basedefs/signal.h.html"><i><signal.h></i></a> header) is defined as a signedinteger type, the value of {SIG_ATOMIC_MIN} shall be no greater than -127 and the value of {SIG_ATOMIC_MAX} shall be no less than127; otherwise, <b>sig_atomic_t</b> shall be defined as an unsigned integer type, and the value of {SIG_ATOMIC_MIN} shall be 0 andthe value of {SIG_ATOMIC_MAX} shall be no less than 255.</p><p>If <b>wchar_t</b> (see the <a href="../basedefs/stddef.h.html"><i><stddef.h></i></a> header) is defined as a signedinteger 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, <b>wchar_t</b> 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.</p><p>If <b>wint_t</b> (see the <a href="../basedefs/wchar.h.html"><i><wchar.h></i></a> header) is defined as a signed integertype, the value of {WINT_MIN} shall be no greater than -32767 and the value of {WINT_MAX} shall be no less than 32767; otherwise,<b>wint_t</b> 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.</p><h5><a name="tag_13_48_03_04"></a>Macros for Integer Constant Expressions</h5><p>The following macros expand to integer constant expressions suitable for initializing objects that have integer typescorresponding to types defined in the <i><stdint.h></i> header. Each macro name corresponds to a similar type name listedunder <i>Minimum-width integer types</i> and <i>Greatest-width integer types</i>.</p><p>Each invocation of one of these macros shall expand to an integer constant expression suitable for use in <b>#if</b>preprocessing directives. The type of the expression shall have the same type as would an expression that is an object of thecorresponding type converted according to the integer promotions. The value of the expression shall be that of the argument.</p><p>The argument in any instance of these macros shall be a decimal, octal, or hexadecimal constant with a value that does notexceed the limits for the corresponding type.</p><ul><li><p>Macros for minimum-width integer constant expressions</p><p>The macro <i>INTN_C</i>( <i>value</i>) shall expand to an integer constant expression corresponding to the type <b>int_least</b><i>N</i> <b>_t</b>. The macro <i>UINTN_C</i>( <i>value</i>) shall expand to an integer constant expression corresponding to thetype <b>uint_least</b> <i>N</i> <b>_t</b>. For example, if <b>uint_least64_t</b> is a name for the type <b>unsigned long long</b>,then <i>UINT64_C</i>(0x123) might expand to the integer constant 0x123ULL.</p></li><li><p>Macros for greatest-width integer constant expressions</p><p>The following macro expands to an integer constant expression having the value specified by its argument and the type<b>intmax_t</b>: INTMAX_C(<i>value</i>)</p><p>The following macro expands to an integer constant expression having the value specified by its argument and the type<b>uintmax_t</b>: UINTMAX_C(<i>value</i>)</p></li></ul></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_13_48_04"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_13_48_05"></a>RATIONALE</h4><blockquote><p>The <i><stdint.h></i> header is a subset of the <a href="../basedefs/inttypes.h.html"><i><inttypes.h></i></a> headermore suitable for use in freestanding environments, which might not support the formatted I/O functions. In some environments, ifthe formatted conversion support is not wanted, using this header instead of the <a href="../basedefs/inttypes.h.html"><i><inttypes.h></i></a> header avoids defining such a large number of macros.</p><p>As a consequence of adding <b>int8_t</b>, the following are true:</p><ul><li><p>A byte is exactly 8 bits.</p></li><li><p>{CHAR_BIT} has the value 8, {SCHAR_MAX} has the value 127, {SCHAR_MIN} has the value -127 or -128, and {UCHAR_MAX} has the value255.</p></li></ul></blockquote><h4><a name="tag_13_48_06"></a>FUTURE DIRECTIONS</h4><blockquote><p><b>typedef</b> names beginning with <b>int</b> or <b>uint</b> and ending with _t may be added to the types defined in the<i><stdint.h></i> header. Macro names beginning with INT or UINT and ending with _MAX, _MIN, or _C may be added to the macrosdefined in the <i><stdint.h></i> header.</p></blockquote><h4><a name="tag_13_48_07"></a>SEE ALSO</h4><blockquote><p><a href="inttypes.h.html"><i><inttypes.h></i></a> , <a href="signal.h.html"><i><signal.h></i></a> , <a href="stddef.h.html"><i><stddef.h></i></a> , <a href="wchar.h.html"><i><wchar.h></i></a></p></blockquote><h4><a name="tag_13_48_08"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 6. Included for alignment with the ISO/IEC 9899:1999 standard.</p><p>ISO/IEC 9899:1999 standard, Technical Corrigendum No. 1 is incorporated.<br></p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -