Debian Codegraph @

upstream/debian-unstable/man3/intN_t.3type

raw
1 .\" Copyright 2020, Michael Kerrisk <[email protected]>
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH intN_t 3type 2026-02-16 "Linux man-pages 6.18"
7 .SH NAME
8 intN_t, int8_t, int16_t, int32_t, int64_t,
9 uintN_t, uint8_t, uint16_t, uint32_t, uint64_t
10 \- fixed-width basic integer types
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <stdint.h>
17 .P
18 .BR typedef " /* ... */ " int8_t;
19 .BR typedef " /* ... */ " int16_t;
20 .BR typedef " /* ... */ " int32_t;
21 .BR typedef " /* ... */ " int64_t;
22 .P
23 .BR typedef " /* ... */ " uint8_t;
24 .BR typedef " /* ... */ " uint16_t;
25 .BR typedef " /* ... */ " uint32_t;
26 .BR typedef " /* ... */ " uint64_t;
27 .P
28 .B "#define INT8_WIDTH 8"
29 .B "#define INT16_WIDTH 16"
30 .B "#define INT32_WIDTH 32"
31 .B "#define INT64_WIDTH 64"
32 .P
33 .B "#define UINT8_WIDTH 8"
34 .B "#define UINT16_WIDTH 16"
35 .B "#define UINT32_WIDTH 32"
36 .B "#define UINT64_WIDTH 64"
37 .P
38 .BR "#define INT8_MAX " "/* 2**(INT8_WIDTH - 1) - 1 */"
39 .BR "#define INT16_MAX " "/* 2**(INT16_WIDTH - 1) - 1 */"
40 .BR "#define INT32_MAX " "/* 2**(INT32_WIDTH - 1) - 1 */"
41 .BR "#define INT64_MAX " "/* 2**(INT64_WIDTH - 1) - 1 */"
42 .P
43 .BR "#define INT8_MIN " "/* - 2**(INT8_WIDTH - 1) */"
44 .BR "#define INT16_MIN " "/* - 2**(INT16_WIDTH - 1) */"
45 .BR "#define INT32_MIN " "/* - 2**(INT32_WIDTH - 1) */"
46 .BR "#define INT64_MIN " "/* - 2**(INT64_WIDTH - 1) */"
47 .P
48 .BR "#define UINT8_MAX " "/* 2**INT8_WIDTH - 1 */"
49 .BR "#define UINT16_MAX " "/* 2**INT16_WIDTH - 1 */"
50 .BR "#define UINT32_MAX " "/* 2**INT32_WIDTH - 1 */"
51 .BR "#define UINT64_MAX " "/* 2**INT64_WIDTH - 1 */"
52 .P
53 .BI "#define INT8_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
54 .BI "#define INT16_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
55 .BI "#define INT32_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
56 .BI "#define INT64_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
57 .P
58 .BI "#define UINT8_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
59 .BI "#define UINT16_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
60 .BI "#define UINT32_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
61 .BI "#define UINT64_C(" c ") " c " ## " "\f[R]/* ... */\f[]"
62 .fi
63 .SH DESCRIPTION
64 .IR int N _t
65 are
66 signed integer types
67 of a fixed width of exactly N bits,
68 .I N
69 being the value specified in its type name.
70 They are be capable of storing values in the range
71 .RB [ INT \f[I]N\f[] _MIN ,
72 .BR INT \f[I]N\f[] _MAX ],
73 substituting
74 .I N
75 by the appropriate number.
76 .P
77 .IR uint N _t
78 are
79 unsigned integer types
80 of a fixed width of exactly N bits,
81 N being the value specified in its type name.
82 They are capable of storing values in the range
83 .RB [ 0 ,
84 .BR UINT \f[I]N\f[] _MAX ],
85 substituting
86 .I N
87 by the appropriate number.
88 .P
89 According to POSIX,
90 .RI [ u ] int8_t ,
91 .RI [ u ] int16_t ,
92 and
93 .RI [ u ] int32_t
94 are required;
95 .RI [ u ] int64_t
96 are only required in implementations that provide integer types with width 64;
97 and all other types of this form are optional.
98 .P
99 The macros
100 .RB [ U ] INT \f[I]N\f[] _WIDTH
101 expand to the width in bits of these types
102 .RI ( N ).
103 .P
104 The macros
105 .RB [ U ] INT \f[I]N\f[] _MAX
106 expand to the maximum value that these types can hold.
107 .P
108 The macros
109 .BI INT N _MIN
110 expand to the minimum value that these types can hold.
111 .P
112 The macros
113 .RB [ U ] INT \f[I]N\f[] _C ()
114 expand their argument to an integer constant of type
115 .RI [ u ] int N _t .
116 .P
117 The length modifiers for the
118 .RI [ u ] int N _t
119 types for the
120 .BR printf (3)
121 and
122 .BR scanf (3)
123 families of functions
124 are
125 .BR w \f[I]N\f[],
126 resulting for example in
127 .B %w64d
128 or
129 .B %w64i
130 for printing or scanning
131 .I int64_t
132 values.
133 .SH STANDARDS
134 C23, POSIX.1-2024.
135 .SH HISTORY
136 .TP
137 .RI [ u ] int N _t
138 C99,
139 SUSv2,
140 POSIX.1-2001.
141 .TP
142 .RB [ U ] INT \f[I]N\f[] _MAX
143 .TQ
144 .BI INT N _MIN
145 .TQ
146 .RB [ U ] INT \f[I]N\f[] _C ()
147 C99, POSIX.1-2001.
148 .TP
149 .RB [ U ] INT \f[I]N\f[] _WIDTH
150 C23.
151 .P
152 Initially, SUSv2 did not include
153 .I <stdint.h>
154 as a standard header.
155 The
156 .RI [ u ] int N _t
157 types were instead defined in
158 .IR <inttypes.h> .
159 This was remedied in POSIX.1-2001.
160 .SH NOTES
161 The following header also provides these types:
162 .IR <inttypes.h> .
163 .I <arpa/inet.h>
164 also provides
165 .I uint16_t
166 and
167 .IR uint32_t .
168 .SH SEE ALSO
169 .BR intmax_t (3type),
170 .BR intptr_t (3type),
171 .BR printf (3)