c语⾔max()头⽂件,C语⾔头⽂件stdint.h [CX]
Some
of the functionality described on this reference page extends the
ISO C standard. Applications shall define the
appropriate feature test macro (see the System Interfaces volume of
IEEE Std 1003.1-2001,Section
2.2, The Compilation Environment) to enable the visibility of
these symbols in this header.
Theheader shall declare sets
of integer types having specified widths, and shall define
corresponding sets of macros. It shall also define macros that
specify limits of integer types corresponding to types defined in
other standard headers.
Note:
The "width" of an integer type is the number of bits used to
store its value in a pure binary system; the actual type may use
more bits than that (for example, a 28-bit type could be stored in
32 bits of actual storage). AnN-bit signed type
has values in the range
-2N-1or
1-2N-1to
2N-1-1, while anN-bit unsigned
type has values in the range 0 to
2N-1.
Types are defined in the following categories:
Integer types having certain exact widths
Integer types having at least certain specified widths
Fastest integer types having at least certain specified
widths
Integer types wide enough to hold pointers to objects
Integer types having greatest width
(Some of these types may denote the same type.)
Corresponding macros specify limits of the declared types and
construct suitable constants.
For each type described herein that the implementation provides,
theheader shall declare
thattypedefname
and define the associated macros. Conversely, for each type
described herein that the implementation does not provide,
theheader shall not declare
thattypedefname,
nor shall it define the associated macros. An implementation shall
provide those types described as required, but need not provide any
of the others (described as optional).
Integer
Types
Whentypedefnames
differing only in the absence or presence of the
initialuare defined, they shall
denote corresponding signed and unsigned types as described in the
ISO/IEC 9899:1999 standard, Section 6.2.5; an
implementation providing one of these corresponding types shall
also provide the other.
In the following descriptions, the symbolNrepresents an unsigned
decimal integer with no leading zeros (for example, 8 or 24, but
not 04 or 048).
Exact-width integer types
ThetypedefnameintN_tdesignates
a signed integer type with widthN, no padding
bits, and a two's-complement representation. Thus,int8_tdenotes a signed integer type with a width of exactly 8 bits.
ThetypedefnameuintN_tdesignates
an unsigned integer type with widthN.
Thus,uint24_tdenotes
an unsigned integer type with a width of exactly 24 bits.
[CX]The
following types are required:
int8_t
int16_t
int32_t
uint8_t
uint16_t
system的头文件
uint32_t
If an implementation provides integer types with width 64 that
meet these requirements, then the following types are
required:int64_tuint64_t
[CX]In
particular, this will be the case if any of the following are
true:
The implementation supports the _POSIX_V6_ILP32_OFFBIG
programming environment and the application is being built in the
_POSIX_V6_ILP32_OFFBIG programming environment (see the Shell and
Utilities volume of
IEEE Std 1003.1-2001,c99,
Programming Environments).
The implementation supports the _POSIX_V6_LP64_OFF64 programming
environment and the application is being built in the
_POSIX_V6_LP64_OFF64 programming environment.
The implementation supports the _POSIX_V6_LPBIG_OFFBIG
programming environment and the application is being built in the
_POSIX_V6_LPBIG_OFFBIG programming environment. All other types of this form are optional.
Minimum-width integer types
Thetypedefnameint_leastN_tdesignates
a signed integer type with a width of at leastN, such that no
signed integer type with lesser size has at least the specified
width. Thus,int_least32_tdenotes
a signed integer type with a width of at least 32 bits.
Thetypedefnameuint_leastN_tdesignates
an unsigned integer type with a width of at leastN, such that no
unsigned integer type with lesser size has at least the specified
width. Thus,uint_least16_tdenotes
an unsigned integer type with a width of at least 16 bits.
The following types are
required:int_least8_tint_least16_tint_least32_tint_least64_tuint_least8_tuint_least16_tuint_least32_tuint_least64_t All other types of this form are optional.
Fastest minimum-width integer types
Each of the following types designates an integer type that is
usually fastest to operate with among all integer types that have
at least the specified width.
The designated type is not guaranteed to be fastest for all
purposes; if the implementation has no clear grounds for choosing
one type over another, it will simply pick some integer type
satisfying the signedness and width requirements.
Thetypedefnameint_fastN_tdesignates
the fastest signed integer type with a width of at
leastN. Thetypedefnameuint_fastN_tdesignates
the fastest unsigned integer type with a width of at
leastN.
The following types are
required:int_fast8_tint_fast16_tint_fast32_tint_fast64_tuint_fast8_tuint_fast16_tuint_fast32_tuint_fast64_t
All other types of this form are optional.
Integer types capable of holding object pointers
The following type designates a signed integer type with the
property that any valid pointer tovoidcan be converted to this
type, then converted back to a pointer tovoid, and the
result will compare equal to the original pointer:intptr_t
The following type designates an unsigned integer type with the
property that any valid pointer tovoidcan be converted to this
type, then converted back to a pointer tovoid, and the
result will compare equal to the original pointer:uintptr_t
On
XSI-conformant systems, theintptr_tanduintptr_ttypes
are required; otherwise,
they are optional.
Greatest-width integer types
The following type designates a signed integer type capable of representing any value of any signed integer type:intmax_t
The following type designates an unsigned integer type capable
of representing any value of any unsigned integer type:uintmax_t These types are required.
Note:
Applications can test for optional types by using the
corresponding limit macro fromLimits
of Specified-Width Integer Types.
Limits of
Specified-Width Integer Types
The following macros specify the minimum and maximum limits of the types declared in theheader. Each macro name
corresponds to a similar type name inInteger
Types.
Each instance of any defined macro shall be replaced by a
constant expression suitable for use in#ifpreprocessing directives, and this expression shall have the same type as would an expression that is an object of the corresponding type converted according to the integer promotions. Its implementation-defined value shall be equal to or greater in magnitude (absolute value) than the corresponding value given below, with the same sign, except where stated to be exactly the given value.
Limits of exact-width integer types
Minimum values of exact-width signed integer types:
{INTN_MIN}
Exactly -(2N-1)
Maximum values of exact-width signed integer types:
{INTN_MAX}
Exactly 2N-1-1
Maximum values of exact-width unsigned integer types:
{UINTN_MAX}
Exactly 2N-1

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。