xref: /dflybsd-src/share/man/man7/stdint.7 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
2*86d7f5d3SJohn Marino.\" All rights reserved.
3*86d7f5d3SJohn Marino.\"
4*86d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
5*86d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
6*86d7f5d3SJohn Marino.\" are met:
7*86d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
8*86d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
9*86d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
10*86d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
11*86d7f5d3SJohn Marino.\"    documentation and/or other materials provided with the distribution.
12*86d7f5d3SJohn Marino.\"
13*86d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*86d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*86d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*86d7f5d3SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*86d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*86d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*86d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*86d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*86d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*86d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*86d7f5d3SJohn Marino.\" SUCH DAMAGE.
24*86d7f5d3SJohn Marino.\"
25*86d7f5d3SJohn Marino.\" $FreeBSD: src/share/man/man7/stdint.7,v 1.5 2003/09/08 19:57:21 ru Exp $
26*86d7f5d3SJohn Marino.\"
27*86d7f5d3SJohn Marino.Dd March 22, 2009
28*86d7f5d3SJohn Marino.Dt STDINT 7
29*86d7f5d3SJohn Marino.Os
30*86d7f5d3SJohn Marino.Sh NAME
31*86d7f5d3SJohn Marino.Nm stdint
32*86d7f5d3SJohn Marino.Nd "standard integer types"
33*86d7f5d3SJohn Marino.Sh SYNOPSIS
34*86d7f5d3SJohn Marino.In stdint.h
35*86d7f5d3SJohn Marino.Sh DESCRIPTION
36*86d7f5d3SJohn MarinoThe
37*86d7f5d3SJohn Marino.In stdint.h
38*86d7f5d3SJohn Marinoheader provides source-portable integer types of a specific
39*86d7f5d3SJohn Marinosize, smallest memory footprint with a minimum size, fastest
40*86d7f5d3SJohn Marinoaccess speed with a minimum size, largest integer size, and
41*86d7f5d3SJohn Marinothose capable of storing pointers.
42*86d7f5d3SJohn Marino.Pp
43*86d7f5d3SJohn MarinoThe types
44*86d7f5d3SJohn Marino.Vt int8_t ,
45*86d7f5d3SJohn Marino.Vt int16_t ,
46*86d7f5d3SJohn Marino.Vt int32_t ,
47*86d7f5d3SJohn Marinoand
48*86d7f5d3SJohn Marino.Vt int64_t
49*86d7f5d3SJohn Marinoprovide a signed integer type of width 8, 16, 32, or 64 bits, respectively.
50*86d7f5d3SJohn MarinoThe types
51*86d7f5d3SJohn Marino.Vt uint8_t ,
52*86d7f5d3SJohn Marino.Vt uint16_t ,
53*86d7f5d3SJohn Marino.Vt uint32_t ,
54*86d7f5d3SJohn Marinoand
55*86d7f5d3SJohn Marino.Vt uint64_t
56*86d7f5d3SJohn Marinoprovide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively.
57*86d7f5d3SJohn MarinoThese integer types should be used when a specific size is required.
58*86d7f5d3SJohn Marino.Pp
59*86d7f5d3SJohn MarinoThe types
60*86d7f5d3SJohn Marino.Vt int_fast8_t ,
61*86d7f5d3SJohn Marino.Vt int_fast16_t ,
62*86d7f5d3SJohn Marino.Vt int_fast32_t ,
63*86d7f5d3SJohn Marinoand
64*86d7f5d3SJohn Marino.Vt int_fast64_t
65*86d7f5d3SJohn Marinoprovide the fastest signed integer type with a width
66*86d7f5d3SJohn Marinoof at least 8, 16, 32, or 64 bits, respectively.
67*86d7f5d3SJohn MarinoThe types
68*86d7f5d3SJohn Marino.Vt uint_fast8_t ,
69*86d7f5d3SJohn Marino.Vt uint_fast16_t ,
70*86d7f5d3SJohn Marino.Vt uint_fast32_t ,
71*86d7f5d3SJohn Marinoand
72*86d7f5d3SJohn Marino.Vt uint_fast64_t
73*86d7f5d3SJohn Marinoprovide the fastest unsigned integer type with a width
74*86d7f5d3SJohn Marinoof at least 8, 16, 32, or 64 bits, respectively.
75*86d7f5d3SJohn MarinoThese types should be used when access speed is
76*86d7f5d3SJohn Marinoparamount, and when a specific size is not required.
77*86d7f5d3SJohn Marino.Pp
78*86d7f5d3SJohn MarinoThe types
79*86d7f5d3SJohn Marino.Vt int_least8_t ,
80*86d7f5d3SJohn Marino.Vt int_least16_t ,
81*86d7f5d3SJohn Marino.Vt int_least32_t ,
82*86d7f5d3SJohn Marinoand
83*86d7f5d3SJohn Marino.Vt int_least64_t
84*86d7f5d3SJohn Marinoprovide the smallest memory footprint signed integer type with
85*86d7f5d3SJohn Marinoa width of at least 8, 16, 32, or 64 bits, respectively.
86*86d7f5d3SJohn MarinoThe types
87*86d7f5d3SJohn Marino.Vt uint_least8_t ,
88*86d7f5d3SJohn Marino.Vt uint_least16_t ,
89*86d7f5d3SJohn Marino.Vt uint_least32_t ,
90*86d7f5d3SJohn Marinoand
91*86d7f5d3SJohn Marino.Vt uint_least64_t
92*86d7f5d3SJohn Marinoprovide the smallest memory footprint unsigned integer type with
93*86d7f5d3SJohn Marinoa width of at least 8, 16, 32, or 64 bits, respectively.
94*86d7f5d3SJohn MarinoThese types should be used when memory storage is of
95*86d7f5d3SJohn Marinoconcern, and when a specific size is not required.
96*86d7f5d3SJohn Marino.Pp
97*86d7f5d3SJohn MarinoThe type
98*86d7f5d3SJohn Marino.Vt intmax_t
99*86d7f5d3SJohn Marinoprovides a signed integer type large
100*86d7f5d3SJohn Marinoenough to hold any other signed integer.
101*86d7f5d3SJohn MarinoThe type
102*86d7f5d3SJohn Marino.Vt uintmax_t
103*86d7f5d3SJohn Marinoprovides an unsigned integer type large
104*86d7f5d3SJohn Marinoenough to hold any other unsigned integer.
105*86d7f5d3SJohn MarinoThese types are generally the largest signed and unsigned
106*86d7f5d3SJohn Marinointeger types available on a specific architecture.
107*86d7f5d3SJohn Marino.Pp
108*86d7f5d3SJohn MarinoThe type
109*86d7f5d3SJohn Marino.Vt intptr_t
110*86d7f5d3SJohn Marinoprovides a signed integer type with the ability to hold a pointer to
111*86d7f5d3SJohn Marino.Vt void ,
112*86d7f5d3SJohn Marinothat can later be converted back to a pointer to
113*86d7f5d3SJohn Marino.Vt void .
114*86d7f5d3SJohn Marinoand the result will compare equal to the original pointer.
115*86d7f5d3SJohn Marino.Pp
116*86d7f5d3SJohn MarinoThe type
117*86d7f5d3SJohn Marino.Vt uintptr_t
118*86d7f5d3SJohn Marinoprovides an unsigned integer type with the ability to hold a pointer to
119*86d7f5d3SJohn Marino.Vt void ,
120*86d7f5d3SJohn Marinothat can later be converted back to a pointer to
121*86d7f5d3SJohn Marino.Vt void .
122*86d7f5d3SJohn Marinoand the result will compare equal to the original pointer.
123*86d7f5d3SJohn Marino.Pp
124*86d7f5d3SJohn MarinoThe
125*86d7f5d3SJohn Marino.Fn INTX_C
126*86d7f5d3SJohn Marinoexpands to an integer constant expression corresponding to the type
127*86d7f5d3SJohn Marino.Vt int_leastX_t .
128*86d7f5d3SJohn MarinoThe
129*86d7f5d3SJohn Marino.Fn UINTX_C
130*86d7f5d3SJohn Marinoexpands to an integer constant expression corresponding to the type
131*86d7f5d3SJohn Marino.Vt uint_leastX_t .
132*86d7f5d3SJohn MarinoFor example,
133*86d7f5d3SJohn Marino.Fn UINT64_C 0x123
134*86d7f5d3SJohn Marinoexpands to integer constant
135*86d7f5d3SJohn Marino.Li 0x123ULL .
136*86d7f5d3SJohn Marino.Pp
137*86d7f5d3SJohn MarinoThe
138*86d7f5d3SJohn Marino.Fn INTMAX_C
139*86d7f5d3SJohn Marinomacro expands to an integer constant expression having the value specified
140*86d7f5d3SJohn Marinoby its argument and the type
141*86d7f5d3SJohn Marino.Vt intmax_t .
142*86d7f5d3SJohn MarinoThe
143*86d7f5d3SJohn Marino.Fn UINTMAX_C
144*86d7f5d3SJohn Marinomacro expands to an integer constant expression having the value specified
145*86d7f5d3SJohn Marinoby its argument and the type
146*86d7f5d3SJohn Marino.Vt uintmax_t .
147*86d7f5d3SJohn Marino.Sh STANDARDS
148*86d7f5d3SJohn MarinoThe
149*86d7f5d3SJohn Marino.In stdint.h
150*86d7f5d3SJohn Marinoheader conforms to
151*86d7f5d3SJohn Marino.St -isoC-99
152*86d7f5d3SJohn Marinoand
153*86d7f5d3SJohn Marino.St -p1003.1-2001 .
154