Headers stdint.h(3HEAD)
NAME
stdint.h, stdint - integer types
SYNOPSIS
#include
DESCRIPTION
The header declares sets of integer types having
specified widths, and defines corresponding sets of macros.
It also defines macros that specify limits of integer types
corresponding to types defined in other standard headers.
The ``width'' of an integer type is the number of bits used
to store its value in a pure binary system; the actual type
can use more bits than that (for example, a 28-bit type
could be stored in 32 bits of actual storage). An N-bit
signed type has values in the range -2^N-1 or 1-2^N-1 to
2^N-1-1, while an N-bit unsigned type has values in the
range 0 to 2^N-1.
Types are defined in the following categories:
o integer types having certain exact widths
o integer types having at least certain specified
widths
o fastest integer types having at least certain
specified widths
o integer types wide enough to hold pointers to
objects
o 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 pro-
vides, the header declares that typedef name and
defines the associated macros. Conversely, for each type
described herein that the implementation does not provide,
the header does not declare that typedef name,
nor does it define the associated macros. An implementation
SunOS 5.11 Last change: 10 Sep 2004 1
Headers stdint.h(3HEAD)
provides those types described as required, but need not
provide any of the others (described as optional).
Integer Types
When typedef names differing only in the absence or presence
of the initial u are defined, they 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 must also provide the
other.
In the following descriptions, the symbol N represents an
unsigned decimal integer with no leading zeros (for example,
8 or 24, but not 04 or 048).
Exact-width integer types
The typedef name intNt designates a signed integer type
with width N, no padding bits, and a two's-complement
representation. Thus, int8t denotes a signed integer
type with a width of exactly 8 bits.
The typedef name uintNt designates an unsigned integer
type with width N. Thus, uint24t denotes an unsigned
integer type with a width of exactly 24 bits.
The following types are required:
int8t
int16t
int32t
uint8t
uint16t
uint32t
If an implementation provides integer types with width
64 that meet these requirements, then the following
types are required:
int64t
uint64t
In particular, this is the case if any of the following
are true:
o The implementation supports the
POSIXV6ILP32OFBIG programming environment
and the application is being built in the POSI
XV6ILP32OFBIG programming environment (see
the Shell and Utilities volume of IE Std
1003.1-200x, c99, Programming Environments).
SunOS 5.11 Last change: 10 Sep 2004 2
Headers stdint.h(3HEAD)
o The implementation supports the
POSIXV6LP64OF64 programming environment
and the application is being built in the
POSIX V6LP64OF64 programming environment.
o The implementation supports the
POSIXV6LPBIGOFBIG programming environment
and the application is being built in the
POSIXV6LPBIGOFBIG programming environment.
All other types of this form are optional.
Minimum-width integer types
The typedef name intleastNt designates a signed
integer type with a width of at least N, such that no
signed integer type with lesser size has at least the
specified width. Thus, intleast32 t denotes a signed
integer type with a width of at least 32 bits.
The typedef name uintleastNt designates an unsigned
integer type with a width of at least N, such that no
unsigned integer type with lesser size has at least the
specified width. Thus, uint least16t denotes an
unsigned integer type with a width of at least 16 bits.
The following types are required:
intleast8t
intleast16t
intleast32t
intleast64t
uintleast8t
uintleast16t
uintleast32t
uintleast64t
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.
SunOS 5.11 Last change: 10 Sep 2004 3
Headers stdint.h(3HEAD)
The typedef name intfastNt designates the fastest
signed integer type with a width of at least N. The
typedef name uintfastN t designates the fastest
unsigned integer type with a width of at least N.
The following types are required:
intfast8t
intfast16t
intfast32t
intfast64t
uintfast8t
uintfast16t
uintfast32t
uintfast64t
All other types of this form are optional.
Integer types capable of holding object pointers
intptrt Designates a signed integer type with the
property that any valid pointer to void can
be converted to this type, then converted
back to a pointer to void, and the result
will compare equal to the original pointer.
uintptrt Designates an unsigned integer type with
the property that any valid pointer to void
can be converted to this type, then con-
verted back to a pointer to void, and the
result will compare equal to the original
pointer.
On standard-conforming systems, the intptrt and
uintptrt types are required; otherwise, they are
optional.
Greatest-width integer types
intmaxt Designates a signed integer type capable of
representing any value of any signed
integer type.
uintmaxt Designates an unsigned integer type capable
of representing any value of any unsigned
integer type.
SunOS 5.11 Last change: 10 Sep 2004 4
Headers stdint.h(3HEAD)
These types are required.
Applications can test for optional types by using the
corresponding limit macro from Limits 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 the header. Each macro
name corresponds to a similar type name in Integer Types.
Each instance of any defined macro is replaced by a constant
expression suitable for use in #if preprocessing directives.
This expression has 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 is 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
o Minimum values of exact-width signed integer
types:
{INTNMIN} Exactly -(2^N-1)
o Maximum values of exact-width signed integer
types:
{INTNMAX} Exactly 2^N-1 -1
o Maximum values of exact-width unsigned integer
types:
{UINTNMAX} Exactly 2^N -1
SunOS 5.11 Last change: 10 Sep 2004 5
Headers stdint.h(3HEAD)
Limits of minimum-width integer types
o Minimum values of minimum-width signed integer
types:
{INTLEASTNMIN} -(2^N-1 -1)
o Maximum values of minimum-width signed integer
types:
{INTLEASTNMAX} 2^N-1 -1
o Maximum values of minimum-width unsigned
integer types:
{UINTLEASTNMAX} 2^N -1
Limits of fastest minimum-width integer types
o Minimum values of fastest minimum-width signed
integer types:
{INTFASTNMIN} -(2^N-1 -1)
o Maximum values of fastest minimum-width signed
integer types:
{INTFASTNMAX} 2^N-1 -1
o Maximum values of fastest minimum-width
unsigned integer types:
SunOS 5.11 Last change: 10 Sep 2004 6
Headers stdint.h(3HEAD)
{UINTFASTNMAX} 2^N-1 -1
Limits of integer types capable of holding object pointers
o Minimum value of pointer-holding signed integer
type:
{INTPTRMIN} -(2^15 -1)
o Maximum value of pointer-holding signed integer
type:
{INTPTRMAX} 2^15 -1
o Minimum value of pointer-holding signed integer
type:
{UINTPTRMAX} 2^16 -1
Limits of greatest-width integer types
o Minimum value of greatest-width signed integer
type:
{INTMAXMIN} -(2^63 -1)
o Maximum value of greatest-width signed integer
type:
{INTMAXMIN} 2^63 -1
SunOS 5.11 Last change: 10 Sep 2004 7
Headers stdint.h(3HEAD)
o Maximum value of greatest-width unsigned
integer type:
{UINTMAXMIN} 2^64 -1
Limits of Other Integer Types
The following macros specify the minimum and maximum limits
of integer types corresponding to types defined in other
standard headers.
Each instance of these macros is replaced by a constant
expression suitable for use in #if preprocessing directives.
This expression has 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 is equal to or greater in magnitude (absolute
value) than the corresponding value given below, with the
same sign.
Limits of ptrdifft:
{PTRDIFMIN} -65535
{PTRDIFMAX} ]65535
Limits of sigatomict:
{SIGATOMICMIN} See below.
{SIGATOMICMAX} See below.
Limits of sizet:
{SIZEMAX} 65535
Limits of wchart:
{WCHARMIN} See below.
SunOS 5.11 Last change: 10 Sep 2004 8
Headers stdint.h(3HEAD)
{WCHARMAX} See below.
Limits of wintt:
{WINTMIN} See below.
{WINTMAX} See below.
If sigatomict (see the header) is defined as a
signed integer type, the value of {SIGATOMICMIN} is no
greater than -127 and the value of {SIGATOMICMAX} is no
less than 127. Otherwise, sigatomict is defined as an
unsigned integer type, the value of {SIGATOMICMIN} is 0,
and the value of {SIGATOMICMAX} is no less than 255.
If wchart (see the header) is defined as a
signed integer type, the value of {WCHARMIN} is no greater
than -127 and the value of {WCHARMAX} is no less than 127.
Otherwise, wchart is defined as an unsigned integer type,
and the value of {WCHARMIN} is 0 and the value of
{WCHARMAX} is no less than 255.
If wintt (see the header) is defined as a signed
integer type, the value of {WINTMIN} is no greater than
-32767 and the value of {WINTMAX} is no less than 32767.
Otherwise, wintt is defined as an unsigned integer type,
and the value of {WINTMIN} is 0 and the value of {WINTMAX}
is no less than 65535.
Macros for Integer Constant Expressions
The following macros expand to integer constant expressions
suitable for initializing objects that have integer types
corresponding to types defined in the header.
Each macro name corresponds to a similar type name listed
under minimum-width integer types and greatest-width integer
types.
Each invocation of one of these macros expands to an integer
constant expression suitable for use in #if preprocessing
directives. The type of the expression has the same type as
would an expression that is an object of the corresponding
type converted according to the integer promotions. The
value of the expression is that of the argument. The argu-
ment in any instance of these macros is a decimal, octal, or
SunOS 5.11 Last change: 10 Sep 2004 9
Headers stdint.h(3HEAD)
hexadecimal constant with a value that does not exceed the
limits for the corresponding type.
Macros for minimum-width integer constant expressions
The macro INTNC(value) expands to an integer constant
expression corresponding to the type intleastNt. The
macro UINTNC(value) expands to an integer constant
expression corresponding to the type uintleastNt. For
example, if uintleast64t is a name for the type
unsigned long long, then UINT64C(0x123) might expand to
the integer constant 0x123UL.
Macros for greatest-width integer constant expressions
The following macro expands to an integer constant
expression having the value specified by its argument
and the type intmaxt:
INTMAXC(value)
The following macro expands to an integer constant
expression having the value specified by its argument
and the type uintmaxt:
UINTMAXC(value)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
SEE ALSO
inttypes.h(3HEAD), signal.h(3HEAD), stddef.h(3HEAD),
wchar.h(3HEAD), attributes(5), standards(5)
SunOS 5.11 Last change: 10 Sep 2004 10
|