1 <html><head><title>C</title></head><body>
2 <pre><!--page 1 indent 0-->
3 WG14/N1256 Committee Draft -- Septermber 7, 2007 ISO/IEC 9899:TC3
8 <a name="Contents" href="#Contents"><h2>Contents</h2></a>
10 Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
11 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
12 1. Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
13 2. Normative references . . . . . . . . . . . . . . . . . . . . . . . 2
14 3. Terms, definitions, and symbols . . . . . . . . . . . . . . . . . . . 3
15 4. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . 7
16 5. Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 9
17 5.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . 9
18 5.1.1 Translation environment . . . . . . . . . . . . . . . . 9
19 5.1.2 Execution environments . . . . . . . . . . . . . . . . 11
20 5.2 Environmental considerations . . . . . . . . . . . . . . . . . 17
21 5.2.1 Character sets . . . . . . . . . . . . . . . . . . . . 17
22 5.2.2 Character display semantics . . . . . . . . . . . . . . 19
23 5.2.3 Signals and interrupts . . . . . . . . . . . . . . . . . 20
24 5.2.4 Environmental limits . . . . . . . . . . . . . . . . . 20
25 6. Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
26 6.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 29
27 6.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 29
28 6.2.1 Scopes of identifiers . . . . . . . . . . . . . . . . . 29
29 6.2.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 30
30 6.2.3 Name spaces of identifiers . . . . . . . . . . . . . . . 31
31 6.2.4 Storage durations of objects . . . . . . . . . . . . . . 32
32 6.2.5 Types . . . . . . . . . . . . . . . . . . . . . . . 33
33 6.2.6 Representations of types . . . . . . . . . . . . . . . . 37
34 6.2.7 Compatible type and composite type . . . . . . . . . . . 40
35 6.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 42
36 6.3.1 Arithmetic operands . . . . . . . . . . . . . . . . . 42
37 6.3.2 Other operands . . . . . . . . . . . . . . . . . . . 46
38 6.4 Lexical elements . . . . . . . . . . . . . . . . . . . . . . 49
39 6.4.1 Keywords . . . . . . . . . . . . . . . . . . . . . . 50
40 6.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . 51
41 6.4.3 Universal character names . . . . . . . . . . . . . . . 53
42 6.4.4 Constants . . . . . . . . . . . . . . . . . . . . . . 54
43 6.4.5 String literals . . . . . . . . . . . . . . . . . . . . 62
44 6.4.6 Punctuators . . . . . . . . . . . . . . . . . . . . . 63
45 6.4.7 Header names . . . . . . . . . . . . . . . . . . . . 64
46 6.4.8 Preprocessing numbers . . . . . . . . . . . . . . . . 65
47 6.4.9 Comments . . . . . . . . . . . . . . . . . . . . . 66
48 6.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . 67
49 <!--page 2 indent -1-->
50 6.5.1 Primary expressions . . . . . . . . . . . . . . . . . 69
51 6.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . 69
52 6.5.3 Unary operators . . . . . . . . . . . . . . . . . . . 78
53 6.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . 81
54 6.5.5 Multiplicative operators . . . . . . . . . . . . . . . . 82
55 6.5.6 Additive operators . . . . . . . . . . . . . . . . . . 82
56 6.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . 84
57 6.5.8 Relational operators . . . . . . . . . . . . . . . . . . 85
58 6.5.9 Equality operators . . . . . . . . . . . . . . . . . . 86
59 6.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . 87
60 6.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . 88
61 6.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . 88
62 6.5.13 Logical AND operator . . . . . . . . . . . . . . . . . 89
63 6.5.14 Logical OR operator . . . . . . . . . . . . . . . . . 89
64 6.5.15 Conditional operator . . . . . . . . . . . . . . . . . 90
65 6.5.16 Assignment operators . . . . . . . . . . . . . . . . . 91
66 6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . 94
67 6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . 95
68 6.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . 97
69 6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . 98
70 6.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . 99
71 6.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . 108
72 6.7.4 Function specifiers . . . . . . . . . . . . . . . . . . 112
73 6.7.5 Declarators . . . . . . . . . . . . . . . . . . . . . 114
74 6.7.6 Type names . . . . . . . . . . . . . . . . . . . . . 122
75 6.7.7 Type definitions . . . . . . . . . . . . . . . . . . . 123
76 6.7.8 Initialization . . . . . . . . . . . . . . . . . . . . 125
77 6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . 131
78 6.8.1 Labeled statements . . . . . . . . . . . . . . . . . . 131
79 6.8.2 Compound statement . . . . . . . . . . . . . . . . . 132
80 6.8.3 Expression and null statements . . . . . . . . . . . . . 132
81 6.8.4 Selection statements . . . . . . . . . . . . . . . . . 133
82 6.8.5 Iteration statements . . . . . . . . . . . . . . . . . . 135
83 6.8.6 Jump statements . . . . . . . . . . . . . . . . . . . 136
84 6.9 External definitions . . . . . . . . . . . . . . . . . . . . . 140
85 6.9.1 Function definitions . . . . . . . . . . . . . . . . . . 141
86 6.9.2 External object definitions . . . . . . . . . . . . . . . 143
87 6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . 145
88 6.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . 147
89 6.10.2 Source file inclusion . . . . . . . . . . . . . . . . . 149
90 6.10.3 Macro replacement . . . . . . . . . . . . . . . . . . 151
91 6.10.4 Line control . . . . . . . . . . . . . . . . . . . . . 158
92 6.10.5 Error directive . . . . . . . . . . . . . . . . . . . . 159
93 6.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . 159
94 <!--page 3 indent 0-->
95 6.10.7 Null directive . . . . . . . . . . . . . . . . . . . . 160
96 6.10.8 Predefined macro names . . . . . . . . . . . . . . . . 160
97 6.10.9 Pragma operator . . . . . . . . . . . . . . . . . . . 161
98 6.11 Future language directions . . . . . . . . . . . . . . . . . . 163
99 6.11.1 Floating types . . . . . . . . . . . . . . . . . . . . 163
100 6.11.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 163
101 6.11.3 External names . . . . . . . . . . . . . . . . . . . 163
102 6.11.4 Character escape sequences . . . . . . . . . . . . . . 163
103 6.11.5 Storage-class specifiers . . . . . . . . . . . . . . . . 163
104 6.11.6 Function declarators . . . . . . . . . . . . . . . . . 163
105 6.11.7 Function definitions . . . . . . . . . . . . . . . . . . 163
106 6.11.8 Pragma directives . . . . . . . . . . . . . . . . . . 163
107 6.11.9 Predefined macro names . . . . . . . . . . . . . . . . 163
108 7. Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
109 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 164
110 7.1.1 Definitions of terms . . . . . . . . . . . . . . . . . . 164
111 7.1.2 Standard headers . . . . . . . . . . . . . . . . . . . 165
112 7.1.3 Reserved identifiers . . . . . . . . . . . . . . . . . . 166
113 7.1.4 Use of library functions . . . . . . . . . . . . . . . . 166
114 7.2 Diagnostics <assert.h> . . . . . . . . . . . . . . . . . . 169
115 7.2.1 Program diagnostics . . . . . . . . . . . . . . . . . 169
116 7.3 Complex arithmetic <complex.h> . . . . . . . . . . . . . . 170
117 7.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . 170
118 7.3.2 Conventions . . . . . . . . . . . . . . . . . . . . . 171
119 7.3.3 Branch cuts . . . . . . . . . . . . . . . . . . . . . 171
120 7.3.4 The CX_LIMITED_RANGE pragma . . . . . . . . . . . 171
121 7.3.5 Trigonometric functions . . . . . . . . . . . . . . . . 172
122 7.3.6 Hyperbolic functions . . . . . . . . . . . . . . . . . 174
123 7.3.7 Exponential and logarithmic functions . . . . . . . . . . 176
124 7.3.8 Power and absolute-value functions . . . . . . . . . . . 177
125 7.3.9 Manipulation functions . . . . . . . . . . . . . . . . 178
126 7.4 Character handling <ctype.h> . . . . . . . . . . . . . . . . 181
127 7.4.1 Character classification functions . . . . . . . . . . . . 181
128 7.4.2 Character case mapping functions . . . . . . . . . . . . 184
129 7.5 Errors <errno.h> . . . . . . . . . . . . . . . . . . . . . 186
130 7.6 Floating-point environment <fenv.h> . . . . . . . . . . . . . 187
131 7.6.1 The FENV_ACCESS pragma . . . . . . . . . . . . . . 189
132 7.6.2 Floating-point exceptions . . . . . . . . . . . . . . . 190
133 7.6.3 Rounding . . . . . . . . . . . . . . . . . . . . . . 193
134 7.6.4 Environment . . . . . . . . . . . . . . . . . . . . 194
135 7.7 Characteristics of floating types <float.h> . . . . . . . . . . . 197
136 7.8 Format conversion of integer types <inttypes.h> . . . . . . . . 198
137 7.8.1 Macros for format specifiers . . . . . . . . . . . . . . 198
138 7.8.2 Functions for greatest-width integer types . . . . . . . . . 199
139 <!--page 4 indent -1-->
140 7.9 Alternative spellings <iso646.h> . . . . . . . . . . . . . . . 202
141 7.10 Sizes of integer types <limits.h> . . . . . . . . . . . . . . 203
142 7.11 Localization <locale.h> . . . . . . . . . . . . . . . . . . 204
143 7.11.1 Locale control . . . . . . . . . . . . . . . . . . . . 205
144 7.11.2 Numeric formatting convention inquiry . . . . . . . . . . 206
145 7.12 Mathematics <math.h> . . . . . . . . . . . . . . . . . . . 212
146 7.12.1 Treatment of error conditions . . . . . . . . . . . . . . 214
147 7.12.2 The FP_CONTRACT pragma . . . . . . . . . . . . . . 215
148 7.12.3 Classification macros . . . . . . . . . . . . . . . . . 216
149 7.12.4 Trigonometric functions . . . . . . . . . . . . . . . . 218
150 7.12.5 Hyperbolic functions . . . . . . . . . . . . . . . . . 221
151 7.12.6 Exponential and logarithmic functions . . . . . . . . . . 223
152 7.12.7 Power and absolute-value functions . . . . . . . . . . . 228
153 7.12.8 Error and gamma functions . . . . . . . . . . . . . . . 230
154 7.12.9 Nearest integer functions . . . . . . . . . . . . . . . . 231
155 7.12.10 Remainder functions . . . . . . . . . . . . . . . . . 235
156 7.12.11 Manipulation functions . . . . . . . . . . . . . . . . 236
157 7.12.12 Maximum, minimum, and positive difference functions . . . 238
158 7.12.13 Floating multiply-add . . . . . . . . . . . . . . . . . 239
159 7.12.14 Comparison macros . . . . . . . . . . . . . . . . . . 240
160 7.13 Nonlocal jumps <setjmp.h> . . . . . . . . . . . . . . . . 243
161 7.13.1 Save calling environment . . . . . . . . . . . . . . . 243
162 7.13.2 Restore calling environment . . . . . . . . . . . . . . 244
163 7.14 Signal handling <signal.h> . . . . . . . . . . . . . . . . . 246
164 7.14.1 Specify signal handling . . . . . . . . . . . . . . . . 247
165 7.14.2 Send signal . . . . . . . . . . . . . . . . . . . . . 248
166 7.15 Variable arguments <stdarg.h> . . . . . . . . . . . . . . . 249
167 7.15.1 Variable argument list access macros . . . . . . . . . . . 249
168 7.16 Boolean type and values <stdbool.h> . . . . . . . . . . . . 253
169 7.17 Common definitions <stddef.h> . . . . . . . . . . . . . . . 254
170 7.18 Integer types <stdint.h> . . . . . . . . . . . . . . . . . . 255
171 7.18.1 Integer types . . . . . . . . . . . . . . . . . . . . 255
172 7.18.2 Limits of specified-width integer types . . . . . . . . . . 257
173 7.18.3 Limits of other integer types . . . . . . . . . . . . . . 259
174 7.18.4 Macros for integer constants . . . . . . . . . . . . . . 260
175 7.19 Input/output <stdio.h> . . . . . . . . . . . . . . . . . . 262
176 7.19.1 Introduction . . . . . . . . . . . . . . . . . . . . . 262
177 7.19.2 Streams . . . . . . . . . . . . . . . . . . . . . . 264
178 7.19.3 Files . . . . . . . . . . . . . . . . . . . . . . . . 266
179 7.19.4 Operations on files . . . . . . . . . . . . . . . . . . 268
180 7.19.5 File access functions . . . . . . . . . . . . . . . . . 270
181 7.19.6 Formatted input/output functions . . . . . . . . . . . . 274
182 7.19.7 Character input/output functions . . . . . . . . . . . . . 296
183 7.19.8 Direct input/output functions . . . . . . . . . . . . . . 301
184 <!--page 5 indent -1-->
185 7.19.9 File positioning functions . . . . . . . . . . . . . . . 302
186 7.19.10 Error-handling functions . . . . . . . . . . . . . . . . 304
187 7.20 General utilities <stdlib.h> . . . . . . . . . . . . . . . . 306
188 7.20.1 Numeric conversion functions . . . . . . . . . . . . . . 307
189 7.20.2 Pseudo-random sequence generation functions . . . . . . . 312
190 7.20.3 Memory management functions . . . . . . . . . . . . . 313
191 7.20.4 Communication with the environment . . . . . . . . . . 315
192 7.20.5 Searching and sorting utilities . . . . . . . . . . . . . . 318
193 7.20.6 Integer arithmetic functions . . . . . . . . . . . . . . 320
194 7.20.7 Multibyte/wide character conversion functions . . . . . . . 321
195 7.20.8 Multibyte/wide string conversion functions . . . . . . . . 323
196 7.21 String handling <string.h> . . . . . . . . . . . . . . . . . 325
197 7.21.1 String function conventions . . . . . . . . . . . . . . . 325
198 7.21.2 Copying functions . . . . . . . . . . . . . . . . . . 325
199 7.21.3 Concatenation functions . . . . . . . . . . . . . . . . 327
200 7.21.4 Comparison functions . . . . . . . . . . . . . . . . . 328
201 7.21.5 Search functions . . . . . . . . . . . . . . . . . . . 330
202 7.21.6 Miscellaneous functions . . . . . . . . . . . . . . . . 333
203 7.22 Type-generic math <tgmath.h> . . . . . . . . . . . . . . . 335
204 7.23 Date and time <time.h> . . . . . . . . . . . . . . . . . . 338
205 7.23.1 Components of time . . . . . . . . . . . . . . . . . 338
206 7.23.2 Time manipulation functions . . . . . . . . . . . . . . 339
207 7.23.3 Time conversion functions . . . . . . . . . . . . . . . 341
208 7.24 Extended multibyte and wide character utilities <wchar.h> . . . . . 348
209 7.24.1 Introduction . . . . . . . . . . . . . . . . . . . . . 348
210 7.24.2 Formatted wide character input/output functions . . . . . . 349
211 7.24.3 Wide character input/output functions . . . . . . . . . . 367
212 7.24.4 General wide string utilities . . . . . . . . . . . . . . 371
213 7.24.5 Wide character time conversion functions . . . . . . . . . 385
214 7.24.6 Extended multibyte/wide character conversion utilities . . . . 386
215 7.25 Wide character classification and mapping utilities <wctype.h> . . . 393
216 7.25.1 Introduction . . . . . . . . . . . . . . . . . . . . . 393
217 7.25.2 Wide character classification utilities . . . . . . . . . . . 394
218 7.25.3 Wide character case mapping utilities . . . . . . . . . . . 399
219 7.26 Future library directions . . . . . . . . . . . . . . . . . . . 401
220 7.26.1 Complex arithmetic <complex.h> . . . . . . . . . . . 401
221 7.26.2 Character handling <ctype.h> . . . . . . . . . . . . 401
222 7.26.3 Errors <errno.h> . . . . . . . . . . . . . . . . . 401
223 7.26.4 Format conversion of integer types <inttypes.h> . . . . 401
224 7.26.5 Localization <locale.h> . . . . . . . . . . . . . . 401
225 7.26.6 Signal handling <signal.h> . . . . . . . . . . . . . 401
226 7.26.7 Boolean type and values <stdbool.h> . . . . . . . . . 401
227 7.26.8 Integer types <stdint.h> . . . . . . . . . . . . . . 401
228 7.26.9 Input/output <stdio.h> . . . . . . . . . . . . . . . 402
229 <!--page 6 indent 0-->
230 7.26.10 General utilities <stdlib.h> . . . . . . . . . . . . . 402
231 7.26.11 String handling <string.h> . . . . . . . . . . . . . 402
232 7.26.12 Extended multibyte and wide character utilities
233 <wchar.h> . . . . . . . . . . . . . . . . . . . . 402
234 7.26.13 Wide character classification and mapping utilities
235 <wctype.h> . . . . . . . . . . . . . . . . . . . . 402
236 Annex A (informative) Language syntax summary . . . . . . . . . . . . 403
237 A.1 Lexical grammar . . . . . . . . . . . . . . . . . . . . . . 403
238 A.2 Phrase structure grammar . . . . . . . . . . . . . . . . . . . 409
239 A.3 Preprocessing directives . . . . . . . . . . . . . . . . . . . 416
240 Annex B (informative) Library summary . . . . . . . . . . . . . . . . 419
241 B.1 Diagnostics <assert.h> . . . . . . . . . . . . . . . . . . 419
242 B.2 Complex <complex.h> . . . . . . . . . . . . . . . . . . . 419
243 B.3 Character handling <ctype.h> . . . . . . . . . . . . . . . . 421
244 B.4 Errors <errno.h> . . . . . . . . . . . . . . . . . . . . . 421
245 B.5 Floating-point environment <fenv.h> . . . . . . . . . . . . . 421
246 B.6 Characteristics of floating types <float.h> . . . . . . . . . . . 422
247 B.7 Format conversion of integer types <inttypes.h> . . . . . . . . 422
248 B.8 Alternative spellings <iso646.h> . . . . . . . . . . . . . . . 423
249 B.9 Sizes of integer types <limits.h> . . . . . . . . . . . . . . 423
250 B.10 Localization <locale.h> . . . . . . . . . . . . . . . . . . 423
251 B.11 Mathematics <math.h> . . . . . . . . . . . . . . . . . . . 423
252 B.12 Nonlocal jumps <setjmp.h> . . . . . . . . . . . . . . . . 428
253 B.13 Signal handling <signal.h> . . . . . . . . . . . . . . . . . 428
254 B.14 Variable arguments <stdarg.h> . . . . . . . . . . . . . . . 428
255 B.15 Boolean type and values <stdbool.h> . . . . . . . . . . . . 428
256 B.16 Common definitions <stddef.h> . . . . . . . . . . . . . . . 429
257 B.17 Integer types <stdint.h> . . . . . . . . . . . . . . . . . . 429
258 B.18 Input/output <stdio.h> . . . . . . . . . . . . . . . . . . 429
259 B.19 General utilities <stdlib.h> . . . . . . . . . . . . . . . . 431
260 B.20 String handling <string.h> . . . . . . . . . . . . . . . . . 433
261 B.21 Type-generic math <tgmath.h> . . . . . . . . . . . . . . . 434
262 B.22 Date and time <time.h> . . . . . . . . . . . . . . . . . . 434
263 B.23 Extended multibyte/wide character utilities <wchar.h> . . . . . . 435
264 B.24 Wide character classification and mapping utilities <wctype.h> . . . 437
265 Annex C (informative) Sequence points . . . . . . . . . . . . . . . . . 439
266 Annex D (normative) Universal character names for identifiers . . . . . . . 440
267 Annex E (informative) Implementation limits . . . . . . . . . . . . . . 442
268 Annex F (normative) IEC 60559 floating-point arithmetic . . . . . . . . . . 444
269 F.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 444
270 F.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
271 F.3 Operators and functions . . . . . . . . . . . . . . . . . . . 445
272 <!--page 7 indent 0-->
273 F.4 Floating to integer conversion . . . . . . . . . . . . . . . . . 447
274 F.5 Binary-decimal conversion . . . . . . . . . . . . . . . . . . 447
275 F.6 Contracted expressions . . . . . . . . . . . . . . . . . . . . 448
276 F.7 Floating-point environment . . . . . . . . . . . . . . . . . . 448
277 F.8 Optimization . . . . . . . . . . . . . . . . . . . . . . . . 451
278 F.9 Mathematics <math.h> . . . . . . . . . . . . . . . . . . . 454
279 Annex G (informative) IEC 60559-compatible complex arithmetic . . . . . . 467
280 G.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 467
281 G.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
282 G.3 Conventions . . . . . . . . . . . . . . . . . . . . . . . . 467
283 G.4 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 468
284 G.5 Binary operators . . . . . . . . . . . . . . . . . . . . . . 468
285 G.6 Complex arithmetic <complex.h> . . . . . . . . . . . . . . 472
286 G.7 Type-generic math <tgmath.h> . . . . . . . . . . . . . . . 480
287 Annex H (informative) Language independent arithmetic . . . . . . . . . . 481
288 H.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 481
289 H.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
290 H.3 Notification . . . . . . . . . . . . . . . . . . . . . . . . 485
291 Annex I (informative) Common warnings . . . . . . . . . . . . . . . . 487
292 Annex J (informative) Portability issues . . . . . . . . . . . . . . . . . 489
293 J.1 Unspecified behavior . . . . . . . . . . . . . . . . . . . . . 489
294 J.2 Undefined behavior . . . . . . . . . . . . . . . . . . . . . 492
295 J.3 Implementation-defined behavior . . . . . . . . . . . . . . . . 505
296 J.4 Locale-specific behavior . . . . . . . . . . . . . . . . . . . 512
297 J.5 Common extensions . . . . . . . . . . . . . . . . . . . . . 513
298 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
299 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
300 <!--page 8 indent 0-->
301 <!--page 9 indent 4-->
304 <a name="Foreword" href="#Foreword"><h2>Foreword</h2></a>
306 ISO (the International Organization for Standardization) and IEC (the International
307 Electrotechnical Commission) form the specialized system for worldwide
308 standardization. National bodies that are member of ISO or IEC participate in the
309 development of International Standards through technical committees established by the
310 respective organization to deal with particular fields of technical activity. ISO and IEC
311 technical committees collaborate in fields of mutual interest. Other international
312 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
313 take part in the work.
315 International Standards are drafted in accordance with the rules given in the ISO/IEC
318 In the field of information technology, ISO and IEC have established a joint technical
319 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
320 committee are circulated to national bodies for voting. Publication as an International
321 Standard requires approval by at least 75% of the national bodies casting a vote.
323 International Standard ISO/IEC 9899 was prepared by Joint Technical Committee
324 ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages,
325 their environments and system software interfaces. The Working Group responsible for
326 this standard (WG 14) maintains a site on the World Wide Web at
327 http://www.open-std.org/JTC1/SC22/WG14/ containing additional
328 information relevant to this standard such as a Rationale for many of the decisions made
329 during its preparation and a log of Defect Reports and Responses.
331 This second edition cancels and replaces the first edition, ISO/IEC 9899:1990, as
332 amended and corrected by ISO/IEC 9899/COR1:1994, ISO/IEC 9899/AMD1:1995, and
333 ISO/IEC 9899/COR2:1996. Major changes from the previous edition include:
335 <li> restricted character set support via digraphs and <iso646.h> (originally specified
337 <li> wide character library support in <wchar.h> and <wctype.h> (originally
339 <li> more precise aliasing rules via effective type
340 <li> restricted pointers
341 <li> variable length arrays
342 <li> flexible array members
343 <li> static and type qualifiers in parameter array declarators
344 <li> complex (and imaginary) support in <complex.h>
345 <li> type-generic math macros in <tgmath.h>
346 <li> the long long int type and library functions
347 <!--page 10 indent 0-->
348 <li> increased minimum translation limits
349 <li> additional floating-point characteristics in <float.h>
350 <li> remove implicit int
351 <li> reliable integer division
352 <li> universal character names (\u and \U)
353 <li> extended identifiers
354 <li> hexadecimal floating-point constants and %a and %A printf/scanf conversion
356 <li> compound literals
357 <li> designated initializers
359 <li> extended integer types and library functions in <inttypes.h> and <stdint.h>
360 <li> remove implicit function declaration
361 <li> preprocessor arithmetic done in intmax_t/uintmax_t
362 <li> mixed declarations and code
363 <li> new block scopes for selection and iteration statements
364 <li> integer constant type rules
365 <li> integer promotion rules
366 <li> macros with a variable number of arguments
367 <li> the vscanf family of functions in <stdio.h> and <wchar.h>
368 <li> additional math library functions in <math.h>
369 <li> treatment of error conditions by math library functions (math_errhandling)
370 <li> floating-point environment access in <fenv.h>
371 <li> IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
372 <li> trailing comma allowed in enum declaration
373 <li> %lf conversion specifier allowed in printf
374 <li> inline functions
375 <li> the snprintf family of functions in <stdio.h>
376 <li> boolean type in <stdbool.h>
377 <li> idempotent type qualifiers
378 <li> empty macro arguments
379 <!--page 11 indent 4-->
380 <li> new structure type compatibility rules (tag compatibility)
381 <li> additional predefined macro names
382 <li> _Pragma preprocessing operator
383 <li> standard pragmas
384 <li> __func__ predefined identifier
386 <li> additional strftime conversion specifiers
387 <li> LIA compatibility annex
388 <li> deprecate ungetc at the beginning of a binary file
389 <li> remove deprecation of aliased array parameters
390 <li> conversion of array to pointer not limited to lvalues
391 <li> relaxed constraints on aggregate and union initialization
392 <li> relaxed restrictions on portable header names
393 <li> return without expression not permitted in function that returns a value (and vice
397 Annexes D and F form a normative part of this standard; annexes A, B, C, E, G, H, I, J,
398 the bibliography, and the index are for information only. In accordance with Part 3 of the
399 ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples are
400 also for information only.
401 <!--page 12 indent 4-->
403 <a name="Introduction" href="#Introduction"><h2>Introduction</h2></a>
405 With the introduction of new devices and extended character sets, new features may be
406 added to this International Standard. Subclauses in the language and library clauses warn
407 implementors and programmers of usages which, though valid in themselves, may
408 conflict with future additions.
410 Certain features are obsolescent, which means that they may be considered for
411 withdrawal in future revisions of this International Standard. They are retained because
412 of their widespread use, but their use in new implementations (for implementation
413 features) or new programs (for language [<a href="#6.11">6.11</a>] or library features [<a href="#7.26">7.26</a>]) is discouraged.
415 This International Standard is divided into four major subdivisions:
417 <li> preliminary elements (clauses 1-4);
418 <li> the characteristics of environments that translate and execute C programs (clause 5);
419 <li> the language syntax, constraints, and semantics (clause 6);
420 <li> the library facilities (clause 7).
423 Examples are provided to illustrate possible forms of the constructions described.
424 Footnotes are provided to emphasize consequences of the rules described in that
425 subclause or elsewhere in this International Standard. References are used to refer to
426 other related subclauses. Recommendations are provided to give advice or guidance to
427 implementors. Annexes provide additional information and summarize the information
428 contained in this International Standard. A bibliography lists documents that were
429 referred to during the preparation of the standard.
431 The language clause (clause 6) is derived from ''The C Reference Manual''.
433 The library clause (clause 7) is based on the 1984 /usr/group Standard.
434 <!--page 13 indent 4-->
436 <h1>Programming languages -- C</h1>
442 <a name="1" href="#1"><h2>1. Scope</h2></a>
444 This International Standard specifies the form and establishes the interpretation of
445 programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
447 <li> the representation of C programs;
448 <li> the syntax and constraints of the C language;
449 <li> the semantic rules for interpreting C programs;
450 <li> the representation of input data to be processed by C programs;
451 <li> the representation of output data produced by C programs;
452 <li> the restrictions and limits imposed by a conforming implementation of C.
455 This International Standard does not specify
457 <li> the mechanism by which C programs are transformed for use by a data-processing
459 <li> the mechanism by which C programs are invoked for use by a data-processing
461 <li> the mechanism by which input data are transformed for use by a C program;
462 <li> the mechanism by which output data are transformed after being produced by a C
464 <li> the size or complexity of a program and its data that will exceed the capacity of any
465 specific data-processing system or the capacity of a particular processor;
468 <!--page 14 indent 4-->
469 <li> all minimal requirements of a data-processing system that is capable of supporting a
470 conforming implementation.
475 <p><a name="note1">1)</a> This International Standard is designed to promote the portability of C programs among a variety of
476 data-processing systems. It is intended for use by implementors and programmers.
479 <a name="2" href="#2"><h2>2. Normative references</h2></a>
481 The following normative documents contain provisions which, through reference in this
482 text, constitute provisions of this International Standard. For dated references,
483 subsequent amendments to, or revisions of, any of these publications do not apply.
484 However, parties to agreements based on this International Standard are encouraged to
485 investigate the possibility of applying the most recent editions of the normative
486 documents indicated below. For undated references, the latest edition of the normative
487 document referred to applies. Members of ISO and IEC maintain registers of currently
488 valid International Standards.
490 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
491 use in the physical sciences and technology.
493 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
496 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
499 ISO 4217, Codes for the representation of currencies and funds.
501 ISO 8601, Data elements and interchange formats -- Information interchange --
502 Representation of dates and times.
504 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
507 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
508 designated IEC 559:1989).
509 <!--page 15 indent 4-->
511 <a name="3" href="#3"><h2>3. Terms, definitions, and symbols</h2></a>
513 For the purposes of this International Standard, the following definitions apply. Other
514 terms are defined where they appear in italic type or on the left side of a syntax rule.
515 Terms explicitly defined in this International Standard are not to be presumed to refer
516 implicitly to similar terms defined elsewhere. Terms not defined in this International
517 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
518 defined in this International Standard are to be interpreted according to ISO 31-11.
520 <a name="3.1" href="#3.1"><h3>3.1</h3></a>
523 <execution-time action> to read or modify the value of an object
525 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
528 NOTE 2 "Modify'' includes the case where the new value being stored is the same as the previous value.
531 NOTE 3 Expressions that are not evaluated do not access objects.
534 <a name="3.2" href="#3.2"><h3>3.2</h3></a>
537 requirement that objects of a particular type be located on storage boundaries with
538 addresses that are particular multiples of a byte address
540 <a name="3.3" href="#3.3"><h3>3.3</h3></a>
544 actual parameter (deprecated)
545 expression in the comma-separated list bounded by the parentheses in a function call
546 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
547 by the parentheses in a function-like macro invocation
549 <a name="3.4" href="#3.4"><h3>3.4</h3></a>
552 external appearance or action
554 <a name="3.4.1" href="#3.4.1"><h4>3.4.1</h4></a>
556 implementation-defined behavior
557 unspecified behavior where each implementation documents how the choice is made
559 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
560 when a signed integer is shifted right.
563 <a name="3.4.2" href="#3.4.2"><h4>3.4.2</h4></a>
565 locale-specific behavior
566 behavior that depends on local conventions of nationality, culture, and language that each
567 implementation documents
568 <!--page 16 indent 4-->
570 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
571 characters other than the 26 lowercase Latin letters.
574 <a name="3.4.3" href="#3.4.3"><h4>3.4.3</h4></a>
577 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
578 for which this International Standard imposes no requirements
580 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
581 results, to behaving during translation or program execution in a documented manner characteristic of the
582 environment (with or without the issuance of a diagnostic message), to terminating a translation or
583 execution (with the issuance of a diagnostic message).
586 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
589 <a name="3.4.4" href="#3.4.4"><h4>3.4.4</h4></a>
592 use of an unspecified value, or other behavior where this International Standard provides
593 two or more possibilities and imposes no further requirements on which is chosen in any
596 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
600 <a name="3.5" href="#3.5"><h3>3.5</h3></a>
603 unit of data storage in the execution environment large enough to hold an object that may
604 have one of two values
606 NOTE It need not be possible to express the address of each individual bit of an object.
609 <a name="3.6" href="#3.6"><h3>3.6</h3></a>
612 addressable unit of data storage large enough to hold any member of the basic character
613 set of the execution environment
615 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
618 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
619 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
623 <a name="3.7" href="#3.7"><h3>3.7</h3></a>
626 <abstract> member of a set of elements used for the organization, control, or
627 representation of data
629 <a name="3.7.1" href="#3.7.1"><h4>3.7.1</h4></a>
632 single-byte character
633 <C> bit representation that fits in a byte
634 <!--page 17 indent 4-->
636 <a name="3.7.2" href="#3.7.2"><h4>3.7.2</h4></a>
639 sequence of one or more bytes representing a member of the extended character set of
640 either the source or the execution environment
642 NOTE The extended character set is a superset of the basic character set.
645 <a name="3.7.3" href="#3.7.3"><h4>3.7.3</h4></a>
648 bit representation that fits in an object of type wchar_t, capable of representing any
649 character in the current locale
651 <a name="3.8" href="#3.8"><h3>3.8</h3></a>
654 restriction, either syntactic or semantic, by which the exposition of language elements is
657 <a name="3.9" href="#3.9"><h3>3.9</h3></a>
659 correctly rounded result
660 representation in the result format that is nearest in value, subject to the current rounding
661 mode, to what the result would be given unlimited range and precision
663 <a name="3.10" href="#3.10"><h3>3.10</h3></a>
666 message belonging to an implementation-defined subset of the implementation's message
669 <a name="3.11" href="#3.11"><h3>3.11</h3></a>
672 reference to a later subclause of this International Standard that contains additional
673 information relevant to this subclause
675 <a name="3.12" href="#3.12"><h3>3.12</h3></a>
678 particular set of software, running in a particular translation environment under particular
679 control options, that performs translation of programs for, and supports execution of
680 functions in, a particular execution environment
682 <a name="3.13" href="#3.13"><h3>3.13</h3></a>
685 restriction imposed upon programs by the implementation
687 <a name="3.14" href="#3.14"><h3>3.14</h3></a>
690 region of data storage in the execution environment, the contents of which can represent
692 <!--page 18 indent 4-->
694 NOTE When referenced, an object may be interpreted as having a particular type; see <a href="#6.3.2.1">6.3.2.1</a>.
697 <a name="3.15" href="#3.15"><h3>3.15</h3></a>
701 formal argument (deprecated)
702 object declared as part of a function declaration or definition that acquires a value on
703 entry to the function, or an identifier from the comma-separated list bounded by the
704 parentheses immediately following the macro name in a function-like macro definition
706 <a name="3.16" href="#3.16"><h3>3.16</h3></a>
709 specification that is strongly recommended as being in keeping with the intent of the
710 standard, but that may be impractical for some implementations
712 <a name="3.17" href="#3.17"><h3>3.17</h3></a>
715 precise meaning of the contents of an object when interpreted as having a specific type
717 <a name="3.17.1" href="#3.17.1"><h4>3.17.1</h4></a>
719 implementation-defined value
720 unspecified value where each implementation documents how the choice is made
722 <a name="3.17.2" href="#3.17.2"><h4>3.17.2</h4></a>
725 either an unspecified value or a trap representation
727 <a name="3.17.3" href="#3.17.3"><h4>3.17.3</h4></a>
730 valid value of the relevant type where this International Standard imposes no
731 requirements on which value is chosen in any instance
733 NOTE An unspecified value cannot be a trap representation.
736 <a name="3.18" href="#3.18"><h3>3.18</h3></a>
739 ceiling of x: the least integer greater than or equal to x
741 EXAMPLE ???2.4??? is 3, ???-2.4??? is -2.
744 <a name="3.19" href="#3.19"><h3>3.19</h3></a>
747 floor of x: the greatest integer less than or equal to x
749 EXAMPLE ???2.4??? is 2, ???-2.4??? is -3.
750 <!--page 19 indent 4-->
752 <a name="4" href="#4"><h2>4. Conformance</h2></a>
754 In this International Standard, ''shall'' is to be interpreted as a requirement on an
755 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
758 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated, the
759 behavior is undefined. Undefined behavior is otherwise indicated in this International
760 Standard by the words ''undefined behavior'' or by the omission of any explicit definition
761 of behavior. There is no difference in emphasis among these three; they all describe
762 ''behavior that is undefined''.
764 A program that is correct in all other aspects, operating on correct data, containing
765 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
767 The implementation shall not successfully translate a preprocessing translation unit
768 containing a #error preprocessing directive unless it is part of a group skipped by
769 conditional inclusion.
771 A strictly conforming program shall use only those features of the language and library
772 specified in this International Standard.<sup><a href="#note2"><b>2)</b></a></sup> It shall not produce output dependent on any
773 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
774 minimum implementation limit.
776 The two forms of conforming implementation are hosted and freestanding. A conforming
777 hosted implementation shall accept any strictly conforming program. A conforming
778 freestanding implementation shall accept any strictly conforming program that does not
779 use complex types and in which the use of the features specified in the library clause
780 (clause 7) is confined to the contents of the standard headers <float.h>,
781 <iso646.h>, <limits.h>, <stdarg.h>, <stdbool.h>, <stddef.h>, and
782 <stdint.h>. A conforming implementation may have extensions (including additional
783 library functions), provided they do not alter the behavior of any strictly conforming
784 program.<sup><a href="#note3"><b>3)</b></a></sup>
788 <!--page 20 indent 4-->
790 A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note4"><b>4)</b></a></sup>
792 An implementation shall be accompanied by a document that defines all implementation-
793 defined and locale-specific characteristics and all extensions.
794 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
795 characteristics of floating types <float.h> (<a href="#7.7">7.7</a>), alternative spellings <iso646.h>
796 (<a href="#7.9">7.9</a>), sizes of integer types <limits.h> (<a href="#7.10">7.10</a>), variable arguments <stdarg.h>
797 (<a href="#7.15">7.15</a>), boolean type and values <stdbool.h> (<a href="#7.16">7.16</a>), common definitions
798 <stddef.h> (<a href="#7.17">7.17</a>), integer types <stdint.h> (<a href="#7.18">7.18</a>).
803 <!--page 21 indent 4-->
806 <p><a name="note2">2)</a> A strictly conforming program can use conditional features (such as those in <a href="#F">annex F</a>) provided the
807 use is guarded by a #ifdef directive with the appropriate macro. For example:
810 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
812 fesetround(FE_UPWARD);
817 <p><a name="note3">3)</a> This implies that a conforming implementation reserves no identifiers other than those explicitly
818 reserved in this International Standard.
820 <p><a name="note4">4)</a> Strictly conforming programs are intended to be maximally portable among conforming
821 implementations. Conforming programs may depend upon nonportable features of a conforming
825 <a name="5" href="#5"><h2>5. Environment</h2></a>
827 An implementation translates C source files and executes C programs in two data-
828 processing-system environments, which will be called the translation environment and
829 the execution environment in this International Standard. Their characteristics define and
830 constrain the results of executing conforming C programs constructed according to the
831 syntactic and semantic rules for conforming implementations.
832 Forward references: In this clause, only a few of many possible forward references
835 <a name="5.1" href="#5.1"><h3>5.1 Conceptual models</h3></a>
837 <a name="5.1.1" href="#5.1.1"><h4>5.1.1 Translation environment</h4></a>
839 <a name="5.1.1.1" href="#5.1.1.1"><h5>5.1.1.1 Program structure</h5></a>
841 A C program need not all be translated at the same time. The text of the program is kept
842 in units called source files, (or preprocessing files) in this International Standard. A
843 source file together with all the headers and source files included via the preprocessing
844 directive #include is known as a preprocessing translation unit. After preprocessing, a
845 preprocessing translation unit is called a translation unit. Previously translated translation
846 units may be preserved individually or in libraries. The separate translation units of a
847 program communicate by (for example) calls to functions whose identifiers have external
848 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
849 of data files. Translation units may be separately translated and then later linked to
850 produce an executable program.
851 Forward references: linkages of identifiers (<a href="#6.2.2">6.2.2</a>), external definitions (<a href="#6.9">6.9</a>),
852 preprocessing directives (<a href="#6.10">6.10</a>).
854 <a name="5.1.1.2" href="#5.1.1.2"><h5>5.1.1.2 Translation phases</h5></a>
856 The precedence among the syntax rules of translation is specified by the following
857 phases.<sup><a href="#note5"><b>5)</b></a></sup>
859 <li> Physical source file multibyte characters are mapped, in an implementation-
860 defined manner, to the source character set (introducing new-line characters for
861 end-of-line indicators) if necessary. Trigraph sequences are replaced by
862 corresponding single-character internal representations.
866 <!--page 22 indent 0-->
867 <li> Each instance of a backslash character (\) immediately followed by a new-line
868 character is deleted, splicing physical source lines to form logical source lines.
869 Only the last backslash on any physical source line shall be eligible for being part
870 of such a splice. A source file that is not empty shall end in a new-line character,
871 which shall not be immediately preceded by a backslash character before any such
872 splicing takes place.
873 <li> The source file is decomposed into preprocessing tokens<sup><a href="#note6"><b>6)</b></a></sup> and sequences of
874 white-space characters (including comments). A source file shall not end in a
875 partial preprocessing token or in a partial comment. Each comment is replaced by
876 one space character. New-line characters are retained. Whether each nonempty
877 sequence of white-space characters other than new-line is retained or replaced by
878 one space character is implementation-defined.
879 <li> Preprocessing directives are executed, macro invocations are expanded, and
880 _Pragma unary operator expressions are executed. If a character sequence that
881 matches the syntax of a universal character name is produced by token
882 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
883 directive causes the named header or source file to be processed from phase 1
884 through phase 4, recursively. All preprocessing directives are then deleted.
885 <li> Each source character set member and escape sequence in character constants and
886 string literals is converted to the corresponding member of the execution character
887 set; if there is no corresponding member, it is converted to an implementation-
888 defined member other than the null (wide) character.<sup><a href="#note7"><b>7)</b></a></sup>
889 <li> Adjacent string literal tokens are concatenated.
890 <li> White-space characters separating tokens are no longer significant. Each
891 preprocessing token is converted into a token. The resulting tokens are
892 syntactically and semantically analyzed and translated as a translation unit.
893 <li> All external object and function references are resolved. Library components are
894 linked to satisfy external references to functions and objects not defined in the
895 current translation. All such translator output is collected into a program image
896 which contains information needed for execution in its execution environment.
898 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), lexical elements (<a href="#6.4">6.4</a>),
899 preprocessing directives (<a href="#6.10">6.10</a>), trigraph sequences (<a href="#5.2.1.1">5.2.1.1</a>), external definitions (<a href="#6.9">6.9</a>).
903 <!--page 23 indent 4-->
906 <p><a name="note5">5)</a> Implementations shall behave as if these separate phases occur, even though many are typically folded
907 together in practice. Source files, translation units, and translated translation units need not
908 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
909 and any external representation. The description is conceptual only, and does not specify any
910 particular implementation.
912 <p><a name="note6">6)</a> As described in <a href="#6.4">6.4</a>, the process of dividing a source file's characters into preprocessing tokens is
913 context-dependent. For example, see the handling of < within a #include preprocessing directive.
915 <p><a name="note7">7)</a> An implementation need not convert all non-corresponding source characters to the same execution
919 <a name="5.1.1.3" href="#5.1.1.3"><h5>5.1.1.3 Diagnostics</h5></a>
921 A conforming implementation shall produce at least one diagnostic message (identified in
922 an implementation-defined manner) if a preprocessing translation unit or translation unit
923 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
924 specified as undefined or implementation-defined. Diagnostic messages need not be
925 produced in other circumstances.<sup><a href="#note8"><b>8)</b></a></sup>
927 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
931 because in those cases where wording in this International Standard describes the behavior for a construct
932 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
936 <p><a name="note8">8)</a> The intent is that an implementation should identify the nature of, and where possible localize, each
937 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
938 valid program is still correctly translated. It may also successfully translate an invalid program.
941 <a name="5.1.2" href="#5.1.2"><h4>5.1.2 Execution environments</h4></a>
943 Two execution environments are defined: freestanding and hosted. In both cases,
944 program startup occurs when a designated C function is called by the execution
945 environment. All objects with static storage duration shall be initialized (set to their
946 initial values) before program startup. The manner and timing of such initialization are
947 otherwise unspecified. Program termination returns control to the execution
949 Forward references: storage durations of objects (<a href="#6.2.4">6.2.4</a>), initialization (<a href="#6.7.8">6.7.8</a>).
951 <a name="5.1.2.1" href="#5.1.2.1"><h5>5.1.2.1 Freestanding environment</h5></a>
953 In a freestanding environment (in which C program execution may take place without any
954 benefit of an operating system), the name and type of the function called at program
955 startup are implementation-defined. Any library facilities available to a freestanding
956 program, other than the minimal set required by clause 4, are implementation-defined.
958 The effect of program termination in a freestanding environment is implementation-
961 <a name="5.1.2.2" href="#5.1.2.2"><h5>5.1.2.2 Hosted environment</h5></a>
963 A hosted environment need not be provided, but shall conform to the following
964 specifications if present.
969 <!--page 24 indent 4-->
971 <a name="5.1.2.2.1" href="#5.1.2.2.1"><h5>5.1.2.2.1 Program startup</h5></a>
973 The function called at program startup is named main. The implementation declares no
974 prototype for this function. It shall be defined with a return type of int and with no
977 int main(void) { /* ... */ }</pre>
978 or with two parameters (referred to here as argc and argv, though any names may be
979 used, as they are local to the function in which they are declared):
981 int main(int argc, char *argv[]) { /* ... */ }</pre>
982 or equivalent;<sup><a href="#note9"><b>9)</b></a></sup> or in some other implementation-defined manner.
984 If they are declared, the parameters to the main function shall obey the following
987 <li> The value of argc shall be nonnegative.
988 <li> argv[argc] shall be a null pointer.
989 <li> If the value of argc is greater than zero, the array members argv[0] through
990 argv[argc-1] inclusive shall contain pointers to strings, which are given
991 implementation-defined values by the host environment prior to program startup. The
992 intent is to supply to the program information determined prior to program startup
993 from elsewhere in the hosted environment. If the host environment is not capable of
994 supplying strings with letters in both uppercase and lowercase, the implementation
995 shall ensure that the strings are received in lowercase.
996 <li> If the value of argc is greater than zero, the string pointed to by argv[0]
997 represents the program name; argv[0][0] shall be the null character if the
998 program name is not available from the host environment. If the value of argc is
999 greater than one, the strings pointed to by argv[1] through argv[argc-1]
1000 represent the program parameters.
1001 <li> The parameters argc and argv and the strings pointed to by the argv array shall
1002 be modifiable by the program, and retain their last-stored values between program
1003 startup and program termination.
1007 <p><a name="note9">9)</a> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
1008 char ** argv, and so on.
1011 <a name="5.1.2.2.2" href="#5.1.2.2.2"><h5>5.1.2.2.2 Program execution</h5></a>
1013 In a hosted environment, a program may use all the functions, macros, type definitions,
1014 and objects described in the library clause (clause 7).
1018 <!--page 25 indent 4-->
1020 <a name="5.1.2.2.3" href="#5.1.2.2.3"><h5>5.1.2.2.3 Program termination</h5></a>
1022 If the return type of the main function is a type compatible with int, a return from the
1023 initial call to the main function is equivalent to calling the exit function with the value
1024 returned by the main function as its argument;<sup><a href="#note10"><b>10)</b></a></sup> reaching the } that terminates the
1025 main function returns a value of 0. If the return type is not compatible with int, the
1026 termination status returned to the host environment is unspecified.
1027 Forward references: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
1030 <p><a name="note10">10)</a> In accordance with <a href="#6.2.4">6.2.4</a>, the lifetimes of objects with automatic storage duration declared in main
1031 will have ended in the former case, even where they would not have in the latter.
1034 <a name="5.1.2.3" href="#5.1.2.3"><h5>5.1.2.3 Program execution</h5></a>
1036 The semantic descriptions in this International Standard describe the behavior of an
1037 abstract machine in which issues of optimization are irrelevant.
1039 Accessing a volatile object, modifying an object, modifying a file, or calling a function
1040 that does any of those operations are all side effects,<sup><a href="#note11"><b>11)</b></a></sup> which are changes in the state of
1041 the execution environment. Evaluation of an expression may produce side effects. At
1042 certain specified points in the execution sequence called sequence points, all side effects
1043 of previous evaluations shall be complete and no side effects of subsequent evaluations
1044 shall have taken place. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
1046 In the abstract machine, all expressions are evaluated as specified by the semantics. An
1047 actual implementation need not evaluate part of an expression if it can deduce that its
1048 value is not used and that no needed side effects are produced (including any caused by
1049 calling a function or accessing a volatile object).
1051 When the processing of the abstract machine is interrupted by receipt of a signal, only the
1052 values of objects as of the previous sequence point may be relied on. Objects that may be
1053 modified between the previous sequence point and the next sequence point need not have
1054 received their correct values yet.
1056 The least requirements on a conforming implementation are:
1058 <li> At sequence points, volatile objects are stable in the sense that previous accesses are
1059 complete and subsequent accesses have not yet occurred.
1064 <!--page 26 indent 5-->
1065 <li> At program termination, all data written into files shall be identical to the result that
1066 execution of the program according to the abstract semantics would have produced.
1067 <li> The input and output dynamics of interactive devices shall take place as specified in
1068 <a href="#7.19.3">7.19.3</a>. The intent of these requirements is that unbuffered or line-buffered output
1069 appear as soon as possible, to ensure that prompting messages actually appear prior to
1070 a program waiting for input.
1073 What constitutes an interactive device is implementation-defined.
1075 More stringent correspondences between abstract and actual semantics may be defined by
1076 each implementation.
1078 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
1079 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
1080 abstract semantics. The keyword volatile would then be redundant.
1082 Alternatively, an implementation might perform various optimizations within each translation unit, such
1083 that the actual semantics would agree with the abstract semantics only when making function calls across
1084 translation unit boundaries. In such an implementation, at the time of each function entry and function
1085 return where the calling function and the called function are in different translation units, the values of all
1086 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
1087 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
1088 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
1089 type of implementation, objects referred to by interrupt service routines activated by the signal function
1090 would require explicit specification of volatile storage, as well as other implementation-defined
1094 EXAMPLE 2 In executing the fragment
1099 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
1100 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
1101 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
1102 produce the same result, possibly omitting the promotions.
1105 EXAMPLE 3 Similarly, in the fragment
1111 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
1112 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
1113 were replaced by the constant 2.0, which has type double).
1114 <!--page 27 indent 5-->
1116 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1117 semantics. Values are independent of whether they are represented in a register or in memory. For
1118 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1119 is required to round to the precision of the storage type. In particular, casts and assignments are required to
1120 perform their specified conversion. For the fragment
1124 d1 = f = expression;
1125 d2 = (float) expression;</pre>
1126 the values assigned to d1 and d2 are required to have been converted to float.
1129 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1130 precision as well as range. The implementation cannot generally apply the mathematical associative rules
1131 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1132 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1133 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1134 numbers are often not valid (see <a href="#F.8">F.8</a>).
1138 x = (x * y) * z; // not equivalent to x *= y * z;
1139 z = (x - y) + y ; // not equivalent to z = x;
1140 z = x + x * y; // not equivalent to z = x * (1.0 + y);
1141 y = x / 5.0; // not equivalent to y = x * 0.2;</pre>
1144 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1148 a = a + 32760 + b + 5;</pre>
1149 the expression statement behaves exactly the same as
1151 a = (((a + 32760) + b) + 5);</pre>
1152 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1153 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1154 which overflows produce an explicit trap and in which the range of values representable by an int is
1155 [-32768, +32767], the implementation cannot rewrite this expression as
1157 a = ((a + b) + 32765);</pre>
1158 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1159 while the original expression would not; nor can the expression be rewritten either as
1161 a = ((a + 32765) + b);</pre>
1164 a = (a + (b + 32765));</pre>
1165 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1166 in which overflow silently generates some value and where positive and negative overflows cancel, the
1167 above expression statement can be rewritten by the implementation in any of the above ways because the
1168 same result will occur.
1169 <!--page 28 indent 5-->
1171 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1174 #include <stdio.h>
1178 sum = sum * 10 - '0' + (*p++ = getchar());</pre>
1179 the expression statement is grouped as if it were written as
1181 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));</pre>
1182 but the actual increment of p can occur at any time between the previous sequence point and the next
1183 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1186 Forward references: expressions (<a href="#6.5">6.5</a>), type qualifiers (<a href="#6.7.3">6.7.3</a>), statements (<a href="#6.8">6.8</a>), the
1187 signal function (<a href="#7.14">7.14</a>), files (<a href="#7.19.3">7.19.3</a>).
1188 <!--page 29 indent 4-->
1191 <p><a name="note11">11)</a> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
1192 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
1193 values of floating-point operations. Implementations that support such floating-point state are
1194 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
1195 environment library <fenv.h> provides a programming facility for indicating when these side
1196 effects matter, freeing the implementations in other cases.
1199 <a name="5.2" href="#5.2"><h3>5.2 Environmental considerations</h3></a>
1201 <a name="5.2.1" href="#5.2.1"><h4>5.2.1 Character sets</h4></a>
1203 Two sets of characters and their associated collating sequences shall be defined: the set in
1204 which source files are written (the source character set), and the set interpreted in the
1205 execution environment (the execution character set). Each set is further divided into a
1206 basic character set, whose contents are given by this subclause, and a set of zero or more
1207 locale-specific members (which are not members of the basic character set) called
1208 extended characters. The combined set is also called the extended character set. The
1209 values of the members of the execution character set are implementation-defined.
1211 In a character constant or string literal, members of the execution character set shall be
1212 represented by corresponding members of the source character set or by escape
1213 sequences consisting of the backslash \ followed by one or more characters. A byte with
1214 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1215 is used to terminate a character string.
1217 Both the basic source and basic execution character sets shall have the following
1218 members: the 26 uppercase letters of the Latin alphabet
1220 A B C D E F G H I J K L M
1221 N O P Q R S T U V W X Y Z</pre>
1222 the 26 lowercase letters of the Latin alphabet
1224 a b c d e f g h i j k l m
1225 n o p q r s t u v w x y z</pre>
1226 the 10 decimal digits
1228 0 1 2 3 4 5 6 7 8 9</pre>
1229 the following 29 graphic characters
1231 ! " # % & ' ( ) * + , - . / :
1232 ; < = > ? [ \ ] ^ _ { | } ~</pre>
1233 the space character, and control characters representing horizontal tab, vertical tab, and
1234 form feed. The representation of each member of the source and execution basic
1235 character sets shall fit in a byte. In both the source and execution basic character sets, the
1236 value of each character after 0 in the above list of decimal digits shall be one greater than
1237 the value of the previous. In source files, there shall be some way of indicating the end of
1238 each line of text; this International Standard treats such an end-of-line indicator as if it
1239 were a single new-line character. In the basic execution character set, there shall be
1240 control characters representing alert, backspace, carriage return, and new line. If any
1241 other characters are encountered in a source file (except in an identifier, a character
1242 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1243 <!--page 30 indent 4-->
1244 converted to a token), the behavior is undefined.
1246 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1247 Standard the term does not include other characters that are letters in other alphabets.
1249 The universal character name construct provides a way to name other characters.
1250 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), character constants (<a href="#6.4.4.4">6.4.4.4</a>),
1251 preprocessing directives (<a href="#6.10">6.10</a>), string literals (<a href="#6.4.5">6.4.5</a>), comments (<a href="#6.4.9">6.4.9</a>), string (<a href="#7.1.1">7.1.1</a>).
1253 <a name="5.2.1.1" href="#5.2.1.1"><h5>5.2.1.1 Trigraph sequences</h5></a>
1255 Before any other processing takes place, each occurrence of one of the following
1256 sequences of three characters (called trigraph sequences<sup><a href="#note12"><b>12)</b></a></sup>) is replaced with the
1257 corresponding single character.
1260 ??( [ ??' ^ ??> }
1261 ??/ \ ??< { ??- ~</pre>
1262 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1263 above is not changed.
1267 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)</pre>
1270 #define arraycheck(a, b) a[b] || b[a]</pre>
1273 EXAMPLE 2 The following source line
1275 printf("Eh???/n");</pre>
1276 becomes (after replacement of the trigraph sequence ??/)
1278 printf("Eh?\n");</pre>
1282 <p><a name="note12">12)</a> The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1283 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1286 <a name="5.2.1.2" href="#5.2.1.2"><h5>5.2.1.2 Multibyte characters</h5></a>
1288 The source character set may contain multibyte characters, used to represent members of
1289 the extended character set. The execution character set may also contain multibyte
1290 characters, which need not have the same encoding as for the source character set. For
1291 both character sets, the following shall hold:
1293 <li> The basic character set shall be present and each character shall be encoded as a
1295 <li> The presence, meaning, and representation of any additional members is locale-
1298 <!--page 31 indent 4-->
1299 <li> A multibyte character set may have a state-dependent encoding, wherein each
1300 sequence of multibyte characters begins in an initial shift state and enters other
1301 locale-specific shift states when specific multibyte characters are encountered in the
1302 sequence. While in the initial shift state, all single-byte characters retain their usual
1303 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1304 in the sequence is a function of the current shift state.
1305 <li> A byte with all bits zero shall be interpreted as a null character independent of shift
1306 state. Such a byte shall not occur as part of any other multibyte character.
1309 For source files, the following shall hold:
1311 <li> An identifier, comment, string literal, character constant, or header name shall begin
1312 and end in the initial shift state.
1313 <li> An identifier, comment, string literal, character constant, or header name shall consist
1314 of a sequence of valid multibyte characters.
1317 <a name="5.2.2" href="#5.2.2"><h4>5.2.2 Character display semantics</h4></a>
1319 The active position is that location on a display device where the next character output by
1320 the fputc function would appear. The intent of writing a printing character (as defined
1321 by the isprint function) to a display device is to display a graphic representation of
1322 that character at the active position and then advance the active position to the next
1323 position on the current line. The direction of writing is locale-specific. If the active
1324 position is at the final position of a line (if there is one), the behavior of the display device
1327 Alphabetic escape sequences representing nongraphic characters in the execution
1328 character set are intended to produce actions on display devices as follows:
1329 \a (alert) Produces an audible or visible alert without changing the active position.
1330 \b (backspace) Moves the active position to the previous position on the current line. If
1332 the active position is at the initial position of a line, the behavior of the display
1333 device is unspecified.</pre>
1334 \f ( form feed) Moves the active position to the initial position at the start of the next
1337 \n (new line) Moves the active position to the initial position of the next line.
1338 \r (carriage return) Moves the active position to the initial position of the current line.
1339 \t (horizontal tab) Moves the active position to the next horizontal tabulation position
1341 on the current line. If the active position is at or past the last defined horizontal
1342 tabulation position, the behavior of the display device is unspecified.</pre>
1343 \v (vertical tab) Moves the active position to the initial position of the next vertical
1344 <!--page 32 indent 4-->
1347 tabulation position. If the active position is at or past the last defined vertical
1348 tabulation position, the behavior of the display device is unspecified.</pre>
1349 Each of these escape sequences shall produce a unique implementation-defined value
1350 which can be stored in a single char object. The external representations in a text file
1351 need not be identical to the internal representations, and are outside the scope of this
1352 International Standard.
1353 Forward references: the isprint function (<a href="#7.4.1.8">7.4.1.8</a>), the fputc function (<a href="#7.19.7.3">7.19.7.3</a>).
1355 <a name="5.2.3" href="#5.2.3"><h4>5.2.3 Signals and interrupts</h4></a>
1357 Functions shall be implemented such that they may be interrupted at any time by a signal,
1358 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1359 invocations' control flow (after the interruption), function return values, or objects with
1360 automatic storage duration. All such objects shall be maintained outside the function
1361 image (the instructions that compose the executable representation of a function) on a
1362 per-invocation basis.
1364 <a name="5.2.4" href="#5.2.4"><h4>5.2.4 Environmental limits</h4></a>
1366 Both the translation and execution environments constrain the implementation of
1367 language translators and libraries. The following summarizes the language-related
1368 environmental limits on a conforming implementation; the library-related limits are
1369 discussed in clause 7.
1371 <a name="5.2.4.1" href="#5.2.4.1"><h5>5.2.4.1 Translation limits</h5></a>
1373 The implementation shall be able to translate and execute at least one program that
1374 contains at least one instance of every one of the following limits:<sup><a href="#note13"><b>13)</b></a></sup>
1376 <li> 127 nesting levels of blocks
1377 <li> 63 nesting levels of conditional inclusion
1378 <li> 12 pointer, array, and function declarators (in any combinations) modifying an
1379 arithmetic, structure, union, or incomplete type in a declaration
1380 <li> 63 nesting levels of parenthesized declarators within a full declarator
1381 <li> 63 nesting levels of parenthesized expressions within a full expression
1382 <li> 63 significant initial characters in an internal identifier or a macro name (each
1383 universal character name or extended source character is considered a single
1385 <li> 31 significant initial characters in an external identifier (each universal character name
1386 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1389 <!--page 33 indent 4-->
1390 universal character name specifying a short identifier of 00010000 or more is
1391 considered 10 characters, and each extended source character is considered the same
1392 number of characters as the corresponding universal character name, if any)<sup><a href="#note14"><b>14)</b></a></sup>
1393 <li> 4095 external identifiers in one translation unit
1394 <li> 511 identifiers with block scope declared in one block
1395 <li> 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1396 <li> 127 parameters in one function definition
1397 <li> 127 arguments in one function call
1398 <li> 127 parameters in one macro definition
1399 <li> 127 arguments in one macro invocation
1400 <li> 4095 characters in a logical source line
1401 <li> 4095 characters in a character string literal or wide string literal (after concatenation)
1402 <li> 65535 bytes in an object (in a hosted environment only)
1403 <li> 15 nesting levels for #included files
1404 <li> 1023 case labels for a switch statement (excluding those for any nested switch
1406 <li> 1023 members in a single structure or union
1407 <li> 1023 enumeration constants in a single enumeration
1408 <li> 63 levels of nested structure or union definitions in a single struct-declaration-list
1412 <p><a name="note13">13)</a> Implementations should avoid imposing fixed translation limits whenever possible.
1414 <p><a name="note14">14)</a> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
1417 <a name="5.2.4.2" href="#5.2.4.2"><h5>5.2.4.2 Numerical limits</h5></a>
1419 An implementation is required to document all the limits specified in this subclause,
1420 which are specified in the headers <limits.h> and <float.h>. Additional limits are
1421 specified in <stdint.h>.
1422 Forward references: integer types <stdint.h> (<a href="#7.18">7.18</a>).
1424 <a name="5.2.4.2.1" href="#5.2.4.2.1"><h5>5.2.4.2.1 Sizes of integer types <limits.h></h5></a>
1426 The values given below shall be replaced by constant expressions suitable for use in #if
1427 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
1428 following shall be replaced by expressions that have the same type as would an
1429 expression that is an object of the corresponding type converted according to the integer
1430 promotions. Their implementation-defined values shall be equal or greater in magnitude
1433 <!--page 34 indent 0-->
1434 (absolute value) to those shown, with the same sign.
1436 <li> number of bits for smallest object that is not a bit-field (byte)
1438 <li> minimum value for an object of type signed char
1439 SCHAR_MIN -127 // -(27 - 1)
1440 <li> maximum value for an object of type signed char
1441 SCHAR_MAX +127 // 27 - 1
1442 <li> maximum value for an object of type unsigned char
1443 UCHAR_MAX 255 // 28 - 1
1444 <li> minimum value for an object of type char
1446 <li> maximum value for an object of type char
1448 <li> maximum number of bytes in a multibyte character, for any supported locale
1450 <li> minimum value for an object of type short int
1451 SHRT_MIN -32767 // -(215 - 1)
1452 <li> maximum value for an object of type short int
1453 SHRT_MAX +32767 // 215 - 1
1454 <li> maximum value for an object of type unsigned short int
1455 USHRT_MAX 65535 // 216 - 1
1456 <li> minimum value for an object of type int
1457 INT_MIN -32767 // -(215 - 1)
1458 <li> maximum value for an object of type int
1459 INT_MAX +32767 // 215 - 1
1460 <li> maximum value for an object of type unsigned int
1461 UINT_MAX 65535 // 216 - 1
1462 <li> minimum value for an object of type long int
1463 LONG_MIN -2147483647 // -(231 - 1)
1464 <li> maximum value for an object of type long int
1465 LONG_MAX +2147483647 // 231 - 1
1466 <li> maximum value for an object of type unsigned long int
1467 ULONG_MAX 4294967295 // 232 - 1
1468 <!--page 35 indent 4-->
1469 <li> minimum value for an object of type long long int
1470 LLONG_MIN -9223372036854775807 // -(263 - 1)
1471 <li> maximum value for an object of type long long int
1472 LLONG_MAX +9223372036854775807 // 263 - 1
1473 <li> maximum value for an object of type unsigned long long int
1474 ULLONG_MAX 18446744073709551615 // 264 - 1
1477 If the value of an object of type char is treated as a signed integer when used in an
1478 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
1479 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
1480 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
1481 UCHAR_MAX.<sup><a href="#note15"><b>15)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
1482 Forward references: representations of types (<a href="#6.2.6">6.2.6</a>), conditional inclusion (<a href="#6.10.1">6.10.1</a>).
1485 <p><a name="note15">15)</a> See <a href="#6.2.5">6.2.5</a>.
1488 <a name="5.2.4.2.2" href="#5.2.4.2.2"><h5>5.2.4.2.2 Characteristics of floating types <float.h></h5></a>
1490 The characteristics of floating types are defined in terms of a model that describes a
1491 representation of floating-point numbers and values that provide information about an
1492 implementation's floating-point arithmetic.<sup><a href="#note16"><b>16)</b></a></sup> The following parameters are used to
1493 define the model for each floating-point type:
1497 b base or radix of exponent representation (an integer > 1)
1498 e exponent (an integer between a minimum emin and a maximum emax )
1499 p precision (the number of base-b digits in the significand)
1500 fk nonnegative integers less than b (the significand digits)</pre>
1501 A floating-point number (x) is defined by the following model:
1504 x = sb e (Sum) f k b-k ,
1506 emin <= e <= emax</pre>
1509 In addition to normalized floating-point numbers ( f 1 > 0 if x != 0), floating types may be
1510 able to contain other kinds of floating-point numbers, such as subnormal floating-point
1511 numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
1512 e > emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
1513 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
1514 through almost every arithmetic operation without raising a floating-point exception; a
1515 signaling NaN generally raises a floating-point exception when occurring as an
1518 <!--page 36 indent 4-->
1519 arithmetic operand.<sup><a href="#note17"><b>17)</b></a></sup>
1521 An implementation may give zero and non-numeric values (such as infinities and NaNs) a
1522 sign or may leave them unsigned. Wherever such values are unsigned, any requirement
1523 in this International Standard to retrieve the sign shall produce an unspecified sign, and
1524 any requirement to set the sign shall be ignored.
1526 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
1527 <math.h> and <complex.h> that return floating-point results is implementation-
1528 defined, as is the accuracy of the conversion between floating-point internal
1529 representations and string representations performed by the library functions in
1530 <stdio.h>, <stdlib.h>, and <wchar.h>. The implementation may state that the
1531 accuracy is unknown.
1533 All integer values in the <float.h> header, except FLT_ROUNDS, shall be constant
1534 expressions suitable for use in #if preprocessing directives; all floating values shall be
1535 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
1536 and FLT_ROUNDS have separate names for all three floating-point types. The floating-
1537 point model representation is provided for all values except FLT_EVAL_METHOD and
1540 The rounding mode for floating-point addition is characterized by the implementation-
1541 defined value of FLT_ROUNDS:<sup><a href="#note18"><b>18)</b></a></sup>
1546 2 toward positive infinity
1547 3 toward negative infinity</pre>
1548 All other values for FLT_ROUNDS characterize implementation-defined rounding
1551 Except for assignment and cast (which remove all extra range and precision), the values
1552 of operations with floating operands and values subject to the usual arithmetic
1553 conversions and of floating constants are evaluated to a format whose range and precision
1554 may be greater than required by the type. The use of evaluation formats is characterized
1555 by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note19"><b>19)</b></a></sup>
1559 <!--page 37 indent 4-->
1562 0 evaluate all operations and constants just to the range and precision of the
1564 1 evaluate operations and constants of type float and double to the
1565 range and precision of the double type, evaluate long double
1566 operations and constants to the range and precision of the long double
1568 2 evaluate all operations and constants to the range and precision of the
1569 long double type.</pre>
1570 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
1573 The values given in the following list shall be replaced by constant expressions with
1574 implementation-defined values that are greater or equal in magnitude (absolute value) to
1575 those shown, with the same sign:
1577 <li> radix of exponent representation, b
1579 <li> number of base-FLT_RADIX digits in the floating-point significand, p
1583 <li> number of decimal digits, n, such that any floating-point number in the widest
1584 supported floating type with pmax radix b digits can be rounded to a floating-point
1585 number with n decimal digits and back again without change to the value,
1587 ??? pmax log10 b if b is a power of 10
1589 ??? ???1 + pmax log10 b??? otherwise</pre>
1591 <li> number of decimal digits, q, such that any floating-point number with q decimal digits
1592 can be rounded into a floating-point number with p radix b digits and back again
1593 without change to the q decimal digits,
1598 <!--page 38 indent 5-->
1600 ??? p log10 b if b is a power of 10
1602 ??? ???( p - 1) log10 b??? otherwise</pre>
1606 <li> minimum negative integer such that FLT_RADIX raised to one less than that power is
1607 a normalized floating-point number, emin
1611 <li> minimum negative integer such that 10 raised to that power is in the range of
1612 normalized floating-point numbers, ???log10 b emin -1 ???
1618 <li> maximum integer such that FLT_RADIX raised to one less than that power is a
1619 representable finite floating-point number, emax
1623 <li> maximum integer such that 10 raised to that power is in the range of representable
1624 finite floating-point numbers, ???log10 ((1 - b- p )b emax )???
1630 The values given in the following list shall be replaced by constant expressions with
1631 implementation-defined values that are greater than or equal to those shown:
1633 <li> maximum representable finite floating-point number, (1 - b- p )b emax
1639 The values given in the following list shall be replaced by constant expressions with
1640 implementation-defined (positive) values that are less than or equal to those shown:
1642 <li> the difference between 1 and the least value greater than 1 that is representable in the
1643 given floating point type, b1- p
1644 <!--page 39 indent 5-->
1648 <li> minimum normalized positive floating-point number, b emin -1
1653 Recommended practice
1655 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
1656 should be the identity function.
1658 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
1659 requirements of this International Standard, and the appropriate values in a <float.h> header for type
1663 x = s16e (Sum) f k 16-k ,
1665 -31 <= e <= +32</pre>
1670 FLT_EPSILON 9.53674316E-07F
1673 FLT_MIN 2.93873588E-39F
1676 FLT_MAX 3.40282347E+38F
1677 FLT_MAX_10_EXP +38</pre>
1680 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
1681 single-precision and double-precision normalized numbers in IEC 60559,<sup><a href="#note20"><b>20)</b></a></sup> and the appropriate values in a
1682 <float.h> header for types float and double:
1685 x f = s2e (Sum) f k 2-k ,
1687 -125 <= e <= +128</pre>
1691 x d = s2e (Sum) f k 2-k ,
1693 -1021 <= e <= +1024</pre>
1699 FLT_EPSILON 1.19209290E-07F // decimal constant
1700 FLT_EPSILON 0X1P-23F // hex constant</pre>
1703 <!--page 40 indent 0-->
1707 FLT_MIN 1.17549435E-38F // decimal constant
1708 FLT_MIN 0X1P-126F // hex constant
1711 FLT_MAX 3.40282347E+38F // decimal constant
1712 FLT_MAX 0X1.fffffeP127F // hex constant
1715 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
1716 DBL_EPSILON 0X1P-52 // hex constant
1719 DBL_MIN 2.2250738585072014E-308 // decimal constant
1720 DBL_MIN 0X1P-1022 // hex constant
1723 DBL_MAX 1.7976931348623157E+308 // decimal constant
1724 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
1725 DBL_MAX_10_EXP +308</pre>
1726 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
1727 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
1728 precision), then DECIMAL_DIG would be 21.
1730 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
1731 <complex.h> (<a href="#7.3">7.3</a>), extended multibyte and wide character utilities <wchar.h>
1732 (<a href="#7.24">7.24</a>), floating-point environment <fenv.h> (<a href="#7.6">7.6</a>), general utilities <stdlib.h>
1733 (<a href="#7.20">7.20</a>), input/output <stdio.h> (<a href="#7.19">7.19</a>), mathematics <math.h> (<a href="#7.12">7.12</a>).
1734 <!--page 41 indent 4-->
1737 <p><a name="note16">16)</a> The floating-point model is intended to clarify the description of each floating-point characteristic and
1738 does not require the floating-point arithmetic of the implementation to be identical.
1740 <p><a name="note17">17)</a> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
1741 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
1744 <p><a name="note18">18)</a> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
1745 the function fesetround in <fenv.h>.
1747 <p><a name="note19">19)</a> The evaluation method determines evaluation formats of expressions involving all floating types, not
1748 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
1749 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
1752 <p><a name="note20">20)</a> The floating-point model in that standard sums powers of b from zero, so the values of the exponent
1753 limits are one less than shown here.
1756 <a name="6" href="#6"><h2>6. Language</h2></a>
1758 <a name="6.1" href="#6.1"><h3>6.1 Notation</h3></a>
1760 In the syntax notation used in this clause, syntactic categories (nonterminals) are
1761 indicated by italic type, and literal words and character set members (terminals) by bold
1762 type. A colon (:) following a nonterminal introduces its definition. Alternative
1763 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
1764 optional symbol is indicated by the subscript ''opt'', so that
1766 { expressionopt }</pre>
1767 indicates an optional expression enclosed in braces.
1769 When syntactic categories are referred to in the main text, they are not italicized and
1770 words are separated by spaces instead of hyphens.
1772 A summary of the language syntax is given in <a href="#A">annex A</a>.
1774 <a name="6.2" href="#6.2"><h3>6.2 Concepts</h3></a>
1776 <a name="6.2.1" href="#6.2.1"><h4>6.2.1 Scopes of identifiers</h4></a>
1778 An identifier can denote an object; a function; a tag or a member of a structure, union, or
1779 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
1780 same identifier can denote different entities at different points in the program. A member
1781 of an enumeration is called an enumeration constant. Macro names and macro
1782 parameters are not considered further here, because prior to the semantic phase of
1783 program translation any occurrences of macro names in the source file are replaced by the
1784 preprocessing token sequences that constitute their macro definitions.
1786 For each different entity that an identifier designates, the identifier is visible (i.e., can be
1787 used) only within a region of program text called its scope. Different entities designated
1788 by the same identifier either have different scopes, or are in different name spaces. There
1789 are four kinds of scopes: function, file, block, and function prototype. (A function
1790 prototype is a declaration of a function that declares the types of its parameters.)
1792 A label name is the only kind of identifier that has function scope. It can be used (in a
1793 goto statement) anywhere in the function in which it appears, and is declared implicitly
1794 by its syntactic appearance (followed by a : and a statement).
1796 Every other identifier has scope determined by the placement of its declaration (in a
1797 declarator or type specifier). If the declarator or type specifier that declares the identifier
1798 appears outside of any block or list of parameters, the identifier has file scope, which
1799 terminates at the end of the translation unit. If the declarator or type specifier that
1800 declares the identifier appears inside a block or within the list of parameter declarations in
1801 a function definition, the identifier has block scope, which terminates at the end of the
1802 associated block. If the declarator or type specifier that declares the identifier appears
1803 <!--page 42 indent 4-->
1804 within the list of parameter declarations in a function prototype (not part of a function
1805 definition), the identifier has function prototype scope, which terminates at the end of the
1806 function declarator. If an identifier designates two different entities in the same name
1807 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will be a
1808 strict subset of the scope of the other entity (the outer scope). Within the inner scope, the
1809 identifier designates the entity declared in the inner scope; the entity declared in the outer
1810 scope is hidden (and not visible) within the inner scope.
1812 Unless explicitly stated otherwise, where this International Standard uses the term
1813 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
1814 entity in the relevant name space whose declaration is visible at the point the identifier
1817 Two identifiers have the same scope if and only if their scopes terminate at the same
1820 Structure, union, and enumeration tags have scope that begins just after the appearance of
1821 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
1822 begins just after the appearance of its defining enumerator in an enumerator list. Any
1823 other identifier has scope that begins just after the completion of its declarator.
1824 Forward references: declarations (<a href="#6.7">6.7</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), function definitions
1825 (<a href="#6.9.1">6.9.1</a>), identifiers (<a href="#6.4.2">6.4.2</a>), name spaces of identifiers (<a href="#6.2.3">6.2.3</a>), macro replacement (<a href="#6.10.3">6.10.3</a>),
1826 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
1828 <a name="6.2.2" href="#6.2.2"><h4>6.2.2 Linkages of identifiers</h4></a>
1830 An identifier declared in different scopes or in the same scope more than once can be
1831 made to refer to the same object or function by a process called linkage.<sup><a href="#note21"><b>21)</b></a></sup> There are
1832 three kinds of linkage: external, internal, and none.
1834 In the set of translation units and libraries that constitutes an entire program, each
1835 declaration of a particular identifier with external linkage denotes the same object or
1836 function. Within one translation unit, each declaration of an identifier with internal
1837 linkage denotes the same object or function. Each declaration of an identifier with no
1838 linkage denotes a unique entity.
1840 If the declaration of a file scope identifier for an object or a function contains the storage-
1841 class specifier static, the identifier has internal linkage.<sup><a href="#note22"><b>22)</b></a></sup>
1843 For an identifier declared with the storage-class specifier extern in a scope in which a
1847 <!--page 43 indent 4-->
1848 prior declaration of that identifier is visible,<sup><a href="#note23"><b>23)</b></a></sup> if the prior declaration specifies internal or
1849 external linkage, the linkage of the identifier at the later declaration is the same as the
1850 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
1851 declaration specifies no linkage, then the identifier has external linkage.
1853 If the declaration of an identifier for a function has no storage-class specifier, its linkage
1854 is determined exactly as if it were declared with the storage-class specifier extern. If
1855 the declaration of an identifier for an object has file scope and no storage-class specifier,
1856 its linkage is external.
1858 The following identifiers have no linkage: an identifier declared to be anything other than
1859 an object or a function; an identifier declared to be a function parameter; a block scope
1860 identifier for an object declared without the storage-class specifier extern.
1862 If, within a translation unit, the same identifier appears with both internal and external
1863 linkage, the behavior is undefined.
1864 Forward references: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), external definitions (<a href="#6.9">6.9</a>),
1865 statements (<a href="#6.8">6.8</a>).
1868 <p><a name="note21">21)</a> There is no linkage between different identifiers.
1870 <p><a name="note22">22)</a> A function declaration can contain the storage-class specifier static only if it is at file scope; see
1871 <a href="#6.7.1">6.7.1</a>.
1873 <p><a name="note23">23)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
1876 <a name="6.2.3" href="#6.2.3"><h4>6.2.3 Name spaces of identifiers</h4></a>
1878 If more than one declaration of a particular identifier is visible at any point in a
1879 translation unit, the syntactic context disambiguates uses that refer to different entities.
1880 Thus, there are separate name spaces for various categories of identifiers, as follows:
1882 <li> label names (disambiguated by the syntax of the label declaration and use);
1883 <li> the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note24"><b>24)</b></a></sup>
1884 of the keywords struct, union, or enum);
1885 <li> the members of structures or unions; each structure or union has a separate name
1886 space for its members (disambiguated by the type of the expression used to access the
1887 member via the . or -> operator);
1888 <li> all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
1889 enumeration constants).
1891 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), labeled statements (<a href="#6.8.1">6.8.1</a>),
1892 structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), structure and union members (<a href="#6.5.2.3">6.5.2.3</a>), tags
1893 (<a href="#6.7.2.3">6.7.2.3</a>), the goto statement (<a href="#6.8.6.1">6.8.6.1</a>).
1898 <!--page 44 indent 4-->
1901 <p><a name="note24">24)</a> There is only one name space for tags even though three are possible.
1904 <a name="6.2.4" href="#6.2.4"><h4>6.2.4 Storage durations of objects</h4></a>
1906 An object has a storage duration that determines its lifetime. There are three storage
1907 durations: static, automatic, and allocated. Allocated storage is described in <a href="#7.20.3">7.20.3</a>.
1909 The lifetime of an object is the portion of program execution during which storage is
1910 guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note25"><b>25)</b></a></sup> and retains
1911 its last-stored value throughout its lifetime.<sup><a href="#note26"><b>26)</b></a></sup> If an object is referred to outside of its
1912 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
1913 the object it points to reaches the end of its lifetime.
1915 An object whose identifier is declared with external or internal linkage, or with the
1916 storage-class specifier static has static storage duration. Its lifetime is the entire
1917 execution of the program and its stored value is initialized only once, prior to program
1920 An object whose identifier is declared with no linkage and without the storage-class
1921 specifier static has automatic storage duration.
1923 For such an object that does not have a variable length array type, its lifetime extends
1924 from entry into the block with which it is associated until execution of that block ends in
1925 any way. (Entering an enclosed block or calling a function suspends, but does not end,
1926 execution of the current block.) If the block is entered recursively, a new instance of the
1927 object is created each time. The initial value of the object is indeterminate. If an
1928 initialization is specified for the object, it is performed each time the declaration is
1929 reached in the execution of the block; otherwise, the value becomes indeterminate each
1930 time the declaration is reached.
1932 For such an object that does have a variable length array type, its lifetime extends from
1933 the declaration of the object until execution of the program leaves the scope of the
1934 declaration.<sup><a href="#note27"><b>27)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
1935 each time. The initial value of the object is indeterminate.
1936 Forward references: statements (<a href="#6.8">6.8</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), declarators (<a href="#6.7.5">6.7.5</a>), array
1937 declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
1942 <!--page 45 indent 4-->
1945 <p><a name="note25">25)</a> The term ''constant address'' means that two pointers to the object constructed at possibly different
1946 times will compare equal. The address may be different during two different executions of the same
1949 <p><a name="note26">26)</a> In the case of a volatile object, the last store need not be explicit in the program.
1951 <p><a name="note27">27)</a> Leaving the innermost block containing the declaration, or jumping to a point in that block or an
1952 embedded block prior to the declaration, leaves the scope of the declaration.
1955 <a name="6.2.5" href="#6.2.5"><h4>6.2.5 Types</h4></a>
1957 The meaning of a value stored in an object or returned by a function is determined by the
1958 type of the expression used to access it. (An identifier declared to be an object is the
1959 simplest such expression; the type is specified in the declaration of the identifier.) Types
1960 are partitioned into object types (types that fully describe objects), function types (types
1961 that describe functions), and incomplete types (types that describe objects but lack
1962 information needed to determine their sizes).
1964 An object declared as type _Bool is large enough to store the values 0 and 1.
1966 An object declared as type char is large enough to store any member of the basic
1967 execution character set. If a member of the basic execution character set is stored in a
1968 char object, its value is guaranteed to be nonnegative. If any other character is stored in
1969 a char object, the resulting value is implementation-defined but shall be within the range
1970 of values that can be represented in that type.
1972 There are five standard signed integer types, designated as signed char, short
1973 int, int, long int, and long long int. (These and other types may be
1974 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
1975 implementation-defined extended signed integer types.<sup><a href="#note28"><b>28)</b></a></sup> The standard and extended
1976 signed integer types are collectively called signed integer types.<sup><a href="#note29"><b>29)</b></a></sup>
1978 An object declared as type signed char occupies the same amount of storage as a
1979 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
1980 architecture of the execution environment (large enough to contain any value in the range
1981 INT_MIN to INT_MAX as defined in the header <limits.h>).
1983 For each of the signed integer types, there is a corresponding (but different) unsigned
1984 integer type (designated with the keyword unsigned) that uses the same amount of
1985 storage (including sign information) and has the same alignment requirements. The type
1986 _Bool and the unsigned integer types that correspond to the standard signed integer
1987 types are the standard unsigned integer types. The unsigned integer types that
1988 correspond to the extended signed integer types are the extended unsigned integer types.
1989 The standard and extended unsigned integer types are collectively called unsigned integer
1990 types.<sup><a href="#note30"><b>30)</b></a></sup>
1994 <!--page 46 indent 5-->
1996 The standard signed integer types and standard unsigned integer types are collectively
1997 called the standard integer types, the extended signed integer types and extended
1998 unsigned integer types are collectively called the extended integer types.
2000 For any two integer types with the same signedness and different integer conversion rank
2001 (see <a href="#6.3.1.1">6.3.1.1</a>), the range of values of the type with smaller integer conversion rank is a
2002 subrange of the values of the other type.
2004 The range of nonnegative values of a signed integer type is a subrange of the
2005 corresponding unsigned integer type, and the representation of the same value in each
2006 type is the same.<sup><a href="#note31"><b>31)</b></a></sup> A computation involving unsigned operands can never overflow,
2007 because a result that cannot be represented by the resulting unsigned integer type is
2008 reduced modulo the number that is one greater than the largest value that can be
2009 represented by the resulting type.
2011 There are three real floating types, designated as float, double, and long
2012 double.<sup><a href="#note32"><b>32)</b></a></sup> The set of values of the type float is a subset of the set of values of the
2013 type double; the set of values of the type double is a subset of the set of values of the
2016 There are three complex types, designated as float _Complex, double
2017 _Complex, and long double _Complex.<sup><a href="#note33"><b>33)</b></a></sup> The real floating and complex types
2018 are collectively called the floating types.
2020 For each floating type there is a corresponding real type, which is always a real floating
2021 type. For real floating types, it is the same type. For complex types, it is the type given
2022 by deleting the keyword _Complex from the type name.
2024 Each complex type has the same representation and alignment requirements as an array
2025 type containing exactly two elements of the corresponding real type; the first element is
2026 equal to the real part, and the second element to the imaginary part, of the complex
2029 The type char, the signed and unsigned integer types, and the floating types are
2030 collectively called the basic types. Even if the implementation defines two or more basic
2031 types to have the same representation, they are nevertheless different types.<sup><a href="#note34"><b>34)</b></a></sup>
2033 <!--page 47 indent 5-->
2035 The three types char, signed char, and unsigned char are collectively called
2036 the character types. The implementation shall define char to have the same range,
2037 representation, and behavior as either signed char or unsigned char.<sup><a href="#note35"><b>35)</b></a></sup>
2039 An enumeration comprises a set of named integer constant values. Each distinct
2040 enumeration constitutes a different enumerated type.
2042 The type char, the signed and unsigned integer types, and the enumerated types are
2043 collectively called integer types. The integer and real floating types are collectively called
2046 Integer and floating types are collectively called arithmetic types. Each arithmetic type
2047 belongs to one type domain: the real type domain comprises the real types, the complex
2048 type domain comprises the complex types.
2050 The void type comprises an empty set of values; it is an incomplete type that cannot be
2053 Any number of derived types can be constructed from the object, function, and
2054 incomplete types, as follows:
2056 <li> An array type describes a contiguously allocated nonempty set of objects with a
2057 particular member object type, called the element type.<sup><a href="#note36"><b>36)</b></a></sup> Array types are
2058 characterized by their element type and by the number of elements in the array. An
2059 array type is said to be derived from its element type, and if its element type is T , the
2060 array type is sometimes called ''array of T ''. The construction of an array type from
2061 an element type is called ''array type derivation''.
2062 <li> A structure type describes a sequentially allocated nonempty set of member objects
2063 (and, in certain circumstances, an incomplete array), each of which has an optionally
2064 specified name and possibly distinct type.
2065 <li> A union type describes an overlapping nonempty set of member objects, each of
2066 which has an optionally specified name and possibly distinct type.
2067 <li> A function type describes a function with specified return type. A function type is
2068 characterized by its return type and the number and types of its parameters. A
2069 function type is said to be derived from its return type, and if its return type is T , the
2070 function type is sometimes called ''function returning T ''. The construction of a
2071 function type from a return type is called ''function type derivation''.
2075 <!--page 48 indent 5-->
2076 <li> A pointer type may be derived from a function type, an object type, or an incomplete
2077 type, called the referenced type. A pointer type describes an object whose value
2078 provides a reference to an entity of the referenced type. A pointer type derived from
2079 the referenced type T is sometimes called ''pointer to T ''. The construction of a
2080 pointer type from a referenced type is called ''pointer type derivation''.
2082 These methods of constructing derived types can be applied recursively.
2084 Arithmetic types and pointer types are collectively called scalar types. Array and
2085 structure types are collectively called aggregate types.<sup><a href="#note37"><b>37)</b></a></sup>
2087 An array type of unknown size is an incomplete type. It is completed, for an identifier of
2088 that type, by specifying the size in a later declaration (with internal or external linkage).
2089 A structure or union type of unknown content (as described in <a href="#6.7.2.3">6.7.2.3</a>) is an incomplete
2090 type. It is completed, for all declarations of that type, by declaring the same structure or
2091 union tag with its defining content later in the same scope.
2093 A type has known constant size if the type is not incomplete and is not a variable length
2096 Array, function, and pointer types are collectively called derived declarator types. A
2097 declarator type derivation from a type T is the construction of a derived declarator type
2098 from T by the application of an array-type, a function-type, or a pointer-type derivation to
2101 A type is characterized by its type category, which is either the outermost derivation of a
2102 derived type (as noted above in the construction of derived types), or the type itself if the
2103 type consists of no derived types.
2105 Any type so far mentioned is an unqualified type. Each unqualified type has several
2106 qualified versions of its type,<sup><a href="#note38"><b>38)</b></a></sup> corresponding to the combinations of one, two, or all
2107 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
2108 versions of a type are distinct types that belong to the same type category and have the
2109 same representation and alignment requirements.<sup><a href="#note39"><b>39)</b></a></sup> A derived type is not qualified by the
2110 qualifiers (if any) of the type from which it is derived.
2112 A pointer to void shall have the same representation and alignment requirements as a
2113 pointer to a character type.39) Similarly, pointers to qualified or unqualified versions of
2114 compatible types shall have the same representation and alignment requirements. All
2117 <!--page 49 indent 5-->
2118 pointers to structure types shall have the same representation and alignment requirements
2119 as each other. All pointers to union types shall have the same representation and
2120 alignment requirements as each other. Pointers to other types need not have the same
2121 representation or alignment requirements.
2123 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
2124 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
2125 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
2126 qualified float'' and is a pointer to a qualified type.
2129 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
2130 function returning struct tag''. The array has length five and the function has a single parameter of type
2131 float. Its type category is array.
2133 Forward references: compatible type and composite type (<a href="#6.2.7">6.2.7</a>), declarations (<a href="#6.7">6.7</a>).
2136 <p><a name="note28">28)</a> Implementation-defined keywords shall have the form of an identifier reserved for any use as
2137 described in <a href="#7.1.3">7.1.3</a>.
2139 <p><a name="note29">29)</a> Therefore, any statement in this Standard about signed integer types also applies to the extended
2140 signed integer types.
2142 <p><a name="note30">30)</a> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
2143 unsigned integer types.
2145 <p><a name="note31">31)</a> The same representation and alignment requirements are meant to imply interchangeability as
2146 arguments to functions, return values from functions, and members of unions.
2148 <p><a name="note32">32)</a> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
2150 <p><a name="note33">33)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
2152 <p><a name="note34">34)</a> An implementation may define new keywords that provide alternative ways to designate a basic (or
2153 any other) type; this does not violate the requirement that all basic types be different.
2154 Implementation-defined keywords shall have the form of an identifier reserved for any use as
2155 described in <a href="#7.1.3">7.1.3</a>.
2157 <p><a name="note35">35)</a> CHAR_MIN, defined in <limits.h>, will have one of the values 0 or SCHAR_MIN, and this can be
2158 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
2159 other two and is not compatible with either.
2161 <p><a name="note36">36)</a> Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
2163 <p><a name="note37">37)</a> Note that aggregate type does not include union type because an object with union type can only
2164 contain one member at a time.
2166 <p><a name="note38">38)</a> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
2168 <p><a name="note39">39)</a> The same representation and alignment requirements are meant to imply interchangeability as
2169 arguments to functions, return values from functions, and members of unions.
2172 <a name="6.2.6" href="#6.2.6"><h4>6.2.6 Representations of types</h4></a>
2174 <a name="6.2.6.1" href="#6.2.6.1"><h5>6.2.6.1 General</h5></a>
2176 The representations of all types are unspecified except as stated in this subclause.
2178 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
2179 the number, order, and encoding of which are either explicitly specified or
2180 implementation-defined.
2182 Values stored in unsigned bit-fields and objects of type unsigned char shall be
2183 represented using a pure binary notation.<sup><a href="#note40"><b>40)</b></a></sup>
2185 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
2186 bits, where n is the size of an object of that type, in bytes. The value may be copied into
2187 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
2188 called the object representation of the value. Values stored in bit-fields consist of m bits,
2189 where m is the size specified for the bit-field. The object representation is the set of m
2190 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
2191 than NaNs) with the same object representation compare equal, but values that compare
2192 equal may have different object representations.
2194 Certain object representations need not represent a value of the object type. If the stored
2195 value of an object has such a representation and is read by an lvalue expression that does
2196 not have character type, the behavior is undefined. If such a representation is produced
2197 by a side effect that modifies all or any part of the object by an lvalue expression that
2198 does not have character type, the behavior is undefined.<sup><a href="#note41"><b>41)</b></a></sup> Such a representation is called
2200 <!--page 50 indent 4-->
2201 a trap representation.
2203 When a value is stored in an object of structure or union type, including in a member
2204 object, the bytes of the object representation that correspond to any padding bytes take
2205 unspecified values.<sup><a href="#note42"><b>42)</b></a></sup> The value of a structure or union object is never a trap
2206 representation, even though the value of a member of the structure or union object may be
2207 a trap representation.
2209 When a value is stored in a member of an object of union type, the bytes of the object
2210 representation that do not correspond to that member but do correspond to other members
2211 take unspecified values.
2213 Where an operator is applied to a value that has more than one object representation,
2214 which object representation is used shall not affect the value of the result.<sup><a href="#note43"><b>43)</b></a></sup> Where a
2215 value is stored in an object using a type that has more than one object representation for
2216 that value, it is unspecified which representation is used, but a trap representation shall
2218 Forward references: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), lvalues, arrays, and function
2219 designators (<a href="#6.3.2.1">6.3.2.1</a>).
2222 <p><a name="note40">40)</a> A positional representation for integers that uses the binary digits 0 and 1, in which the values
2223 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
2224 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
2225 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
2226 type unsigned char range from 0 to 2
2232 <p><a name="note41">41)</a> Thus, an automatic variable can be initialized to a trap representation without causing undefined
2233 behavior, but the value of the variable cannot be used until a proper value is stored in it.
2235 <p><a name="note42">42)</a> Thus, for example, structure assignment need not copy any padding bits.
2237 <p><a name="note43">43)</a> It is possible for objects x and y with the same effective type T to have the same value when they are
2238 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
2239 defined for type T, then x == y does not imply that memcmp(&x, &y, sizeof (T)) == 0.
2240 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
2241 on values of type T may distinguish between them.
2244 <a name="6.2.6.2" href="#6.2.6.2"><h5>6.2.6.2 Integer types</h5></a>
2246 For unsigned integer types other than unsigned char, the bits of the object
2247 representation shall be divided into two groups: value bits and padding bits (there need
2248 not be any of the latter). If there are N value bits, each bit shall represent a different
2249 power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
2250 representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
2251 known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note44"><b>44)</b></a></sup>
2253 For signed integer types, the bits of the object representation shall be divided into three
2254 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
2256 <!--page 51 indent 4-->
2257 there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as
2258 the same bit in the object representation of the corresponding unsigned type (if there are
2259 M value bits in the signed type and N in the unsigned type, then M <= N ). If the sign bit
2260 is zero, it shall not affect the resulting value. If the sign bit is one, the value shall be
2261 modified in one of the following ways:
2263 <li> the corresponding value with sign bit 0 is negated (sign and magnitude);
2264 <li> the sign bit has the value -(2 N ) (two's complement);
2265 <li> the sign bit has the value -(2 N - 1) (ones' complement ).
2267 Which of these applies is implementation-defined, as is whether the value with sign bit 1
2268 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
2269 complement), is a trap representation or a normal value. In the case of sign and
2270 magnitude and ones' complement, if this representation is a normal value it is called a
2273 If the implementation supports negative zeros, they shall be generated only by:
2275 <li> the &, |, ^, ~, <<, and >> operators with arguments that produce such a value;
2276 <li> the +, -, *, /, and % operators where one argument is a negative zero and the result is
2278 <li> compound assignment operators based on the above cases.
2280 It is unspecified whether these cases actually generate a negative zero or a normal zero,
2281 and whether a negative zero becomes a normal zero when stored in an object.
2283 If the implementation does not support negative zeros, the behavior of the &, |, ^, ~, <<,
2284 and >> operators with arguments that would produce such a value is undefined.
2286 The values of any padding bits are unspecified.<sup><a href="#note45"><b>45)</b></a></sup> A valid (non-trap) object representation
2287 of a signed integer type where the sign bit is zero is a valid object representation of the
2288 corresponding unsigned type, and shall represent the same value. For any integer type,
2289 the object representation where all the bits are zero shall be a representation of the value
2292 The precision of an integer type is the number of bits it uses to represent values,
2293 excluding any sign and padding bits. The width of an integer type is the same but
2294 including any sign bit; thus for unsigned integer types the two values are the same, while
2297 <!--page 52 indent 4-->
2298 for signed integer types the width is one greater than the precision.
2301 <p><a name="note44">44)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2302 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2303 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
2304 with unsigned types. All other combinations of padding bits are alternative object representations of
2305 the value specified by the value bits.
2307 <p><a name="note45">45)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2308 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2309 representation other than as part of an exceptional condition such as an overflow. All other
2310 combinations of padding bits are alternative object representations of the value specified by the value
2314 <a name="6.2.7" href="#6.2.7"><h4>6.2.7 Compatible type and composite type</h4></a>
2316 Two types have compatible type if their types are the same. Additional rules for
2317 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
2318 in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.5">6.7.5</a> for declarators.<sup><a href="#note46"><b>46)</b></a></sup> Moreover, two structure,
2319 union, or enumerated types declared in separate translation units are compatible if their
2320 tags and members satisfy the following requirements: If one is declared with a tag, the
2321 other shall be declared with the same tag. If both are complete types, then the following
2322 additional requirements apply: there shall be a one-to-one correspondence between their
2323 members such that each pair of corresponding members are declared with compatible
2324 types, and such that if one member of a corresponding pair is declared with a name, the
2325 other member is declared with the same name. For two structures, corresponding
2326 members shall be declared in the same order. For two structures or unions, corresponding
2327 bit-fields shall have the same widths. For two enumerations, corresponding members
2328 shall have the same values.
2330 All declarations that refer to the same object or function shall have compatible type;
2331 otherwise, the behavior is undefined.
2333 A composite type can be constructed from two types that are compatible; it is a type that
2334 is compatible with both of the two types and satisfies the following conditions:
2336 <li> If one type is an array of known constant size, the composite type is an array of that
2337 size; otherwise, if one type is a variable length array, the composite type is that type.
2338 <li> If only one type is a function type with a parameter type list (a function prototype),
2339 the composite type is a function prototype with the parameter type list.
2340 <li> If both types are function types with parameter type lists, the type of each parameter
2341 in the composite parameter type list is the composite type of the corresponding
2344 These rules apply recursively to the types from which the two types are derived.
2346 For an identifier with internal or external linkage declared in a scope in which a prior
2347 declaration of that identifier is visible,<sup><a href="#note47"><b>47)</b></a></sup> if the prior declaration specifies internal or
2348 external linkage, the type of the identifier at the later declaration becomes the composite
2354 <!--page 53 indent 4-->
2356 EXAMPLE Given the following two file scope declarations:
2358 int f(int (*)(), double (*)[3]);
2359 int f(int (*)(char *), double (*)[]);</pre>
2360 The resulting composite type for the function is:
2361 <!--page 54 indent 4-->
2363 int f(int (*)(char *), double (*)[3]);</pre>
2366 <p><a name="note46">46)</a> Two types need not be identical to be compatible.
2368 <p><a name="note47">47)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2371 <a name="6.3" href="#6.3"><h3>6.3 Conversions</h3></a>
2373 Several operators convert operand values from one type to another automatically. This
2374 subclause specifies the result required from such an implicit conversion, as well as those
2375 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
2376 the conversions performed by most ordinary operators; it is supplemented as required by
2377 the discussion of each operator in <a href="#6.5">6.5</a>.
2379 Conversion of an operand value to a compatible type causes no change to the value or the
2381 Forward references: cast operators (<a href="#6.5.4">6.5.4</a>).
2383 <a name="6.3.1" href="#6.3.1"><h4>6.3.1 Arithmetic operands</h4></a>
2385 <a name="6.3.1.1" href="#6.3.1.1"><h5>6.3.1.1 Boolean, characters, and integers</h5></a>
2387 Every integer type has an integer conversion rank defined as follows:
2389 <li> No two signed integer types shall have the same rank, even if they have the same
2391 <li> The rank of a signed integer type shall be greater than the rank of any signed integer
2392 type with less precision.
2393 <li> The rank of long long int shall be greater than the rank of long int, which
2394 shall be greater than the rank of int, which shall be greater than the rank of short
2395 int, which shall be greater than the rank of signed char.
2396 <li> The rank of any unsigned integer type shall equal the rank of the corresponding
2397 signed integer type, if any.
2398 <li> The rank of any standard integer type shall be greater than the rank of any extended
2399 integer type with the same width.
2400 <li> The rank of char shall equal the rank of signed char and unsigned char.
2401 <li> The rank of _Bool shall be less than the rank of all other standard integer types.
2402 <li> The rank of any enumerated type shall equal the rank of the compatible integer type
2403 (see <a href="#6.7.2.2">6.7.2.2</a>).
2404 <li> The rank of any extended signed integer type relative to another extended signed
2405 integer type with the same precision is implementation-defined, but still subject to the
2406 other rules for determining the integer conversion rank.
2407 <li> For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
2408 greater rank than T3, then T1 has greater rank than T3.
2411 The following may be used in an expression wherever an int or unsigned int may
2413 <!--page 55 indent 4-->
2415 <li> An object or expression with an integer type whose integer conversion rank is less
2416 than or equal to the rank of int and unsigned int.
2417 <li> A bit-field of type _Bool, int, signed int, or unsigned int.
2419 If an int can represent all values of the original type, the value is converted to an int;
2420 otherwise, it is converted to an unsigned int. These are called the integer
2421 promotions.<sup><a href="#note48"><b>48)</b></a></sup> All other types are unchanged by the integer promotions.
2423 The integer promotions preserve value including sign. As discussed earlier, whether a
2424 ''plain'' char is treated as signed is implementation-defined.
2425 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
2426 (<a href="#6.7.2.1">6.7.2.1</a>).
2429 <p><a name="note48">48)</a> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
2430 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
2431 shift operators, as specified by their respective subclauses.
2434 <a name="6.3.1.2" href="#6.3.1.2"><h5>6.3.1.2 Boolean type</h5></a>
2436 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
2437 to 0; otherwise, the result is 1.
2439 <a name="6.3.1.3" href="#6.3.1.3"><h5>6.3.1.3 Signed and unsigned integers</h5></a>
2441 When a value with integer type is converted to another integer type other than _Bool, if
2442 the value can be represented by the new type, it is unchanged.
2444 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
2445 subtracting one more than the maximum value that can be represented in the new type
2446 until the value is in the range of the new type.<sup><a href="#note49"><b>49)</b></a></sup>
2448 Otherwise, the new type is signed and the value cannot be represented in it; either the
2449 result is implementation-defined or an implementation-defined signal is raised.
2452 <p><a name="note49">49)</a> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
2455 <a name="6.3.1.4" href="#6.3.1.4"><h5>6.3.1.4 Real floating and integer</h5></a>
2457 When a finite value of real floating type is converted to an integer type other than _Bool,
2458 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
2459 the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup>
2461 When a value of integer type is converted to a real floating type, if the value being
2462 converted can be represented exactly in the new type, it is unchanged. If the value being
2463 converted is in the range of values that can be represented but cannot be represented
2465 <!--page 56 indent 4-->
2466 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2467 in an implementation-defined manner. If the value being converted is outside the range of
2468 values that can be represented, the behavior is undefined.
2471 <p><a name="note50">50)</a> The remaindering operation performed when a value of integer type is converted to unsigned type
2472 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
2473 range of portable real floating values is (-1, Utype_MAX+1).
2476 <a name="6.3.1.5" href="#6.3.1.5"><h5>6.3.1.5 Real floating types</h5></a>
2478 When a float is promoted to double or long double, or a double is promoted
2479 to long double, its value is unchanged (if the source value is represented in the
2480 precision and range of its type).
2482 When a double is demoted to float, a long double is demoted to double or
2483 float, or a value being represented in greater precision and range than required by its
2484 semantic type (see <a href="#6.3.1.8">6.3.1.8</a>) is explicitly converted (including to its own type), if the value
2485 being converted can be represented exactly in the new type, it is unchanged. If the value
2486 being converted is in the range of values that can be represented but cannot be
2487 represented exactly, the result is either the nearest higher or nearest lower representable
2488 value, chosen in an implementation-defined manner. If the value being converted is
2489 outside the range of values that can be represented, the behavior is undefined.
2491 <a name="6.3.1.6" href="#6.3.1.6"><h5>6.3.1.6 Complex types</h5></a>
2493 When a value of complex type is converted to another complex type, both the real and
2494 imaginary parts follow the conversion rules for the corresponding real types.
2496 <a name="6.3.1.7" href="#6.3.1.7"><h5>6.3.1.7 Real and complex</h5></a>
2498 When a value of real type is converted to a complex type, the real part of the complex
2499 result value is determined by the rules of conversion to the corresponding real type and
2500 the imaginary part of the complex result value is a positive zero or an unsigned zero.
2502 When a value of complex type is converted to a real type, the imaginary part of the
2503 complex value is discarded and the value of the real part is converted according to the
2504 conversion rules for the corresponding real type.
2506 <a name="6.3.1.8" href="#6.3.1.8"><h5>6.3.1.8 Usual arithmetic conversions</h5></a>
2508 Many operators that expect operands of arithmetic type cause conversions and yield result
2509 types in a similar way. The purpose is to determine a common real type for the operands
2510 and result. For the specified operands, each operand is converted, without change of type
2511 domain, to a type whose corresponding real type is the common real type. Unless
2512 explicitly stated otherwise, the common real type is also the corresponding real type of
2513 the result, whose type domain is the type domain of the operands if they are the same,
2514 and complex otherwise. This pattern is called the usual arithmetic conversions:
2515 <!--page 57 indent 4-->
2518 First, if the corresponding real type of either operand is long double, the other
2519 operand is converted, without change of type domain, to a type whose
2520 corresponding real type is long double.
2521 Otherwise, if the corresponding real type of either operand is double, the other
2522 operand is converted, without change of type domain, to a type whose
2523 corresponding real type is double.
2524 Otherwise, if the corresponding real type of either operand is float, the other
2525 operand is converted, without change of type domain, to a type whose
2526 corresponding real type is float.<sup><a href="#note51"><b>51)</b></a></sup>
2527 Otherwise, the integer promotions are performed on both operands. Then the
2528 following rules are applied to the promoted operands:
2529 If both operands have the same type, then no further conversion is needed.
2530 Otherwise, if both operands have signed integer types or both have unsigned
2531 integer types, the operand with the type of lesser integer conversion rank is
2532 converted to the type of the operand with greater rank.
2533 Otherwise, if the operand that has unsigned integer type has rank greater or
2534 equal to the rank of the type of the other operand, then the operand with
2535 signed integer type is converted to the type of the operand with unsigned
2537 Otherwise, if the type of the operand with signed integer type can represent
2538 all of the values of the type of the operand with unsigned integer type, then
2539 the operand with unsigned integer type is converted to the type of the
2540 operand with signed integer type.
2541 Otherwise, both operands are converted to the unsigned integer type
2542 corresponding to the type of the operand with signed integer type.</pre>
2543 The values of floating operands and of the results of floating expressions may be
2544 represented in greater precision and range than that required by the type; the types are not
2545 changed thereby.<sup><a href="#note52"><b>52)</b></a></sup>
2550 <!--page 58 indent 4-->
2553 <p><a name="note51">51)</a> For example, addition of a double _Complex and a float entails just the conversion of the
2554 float operand to double (and yields a double _Complex result).
2556 <p><a name="note52">52)</a> The cast and assignment operators are still required to perform their specified conversions as
2557 described in <a href="#6.3.1.4">6.3.1.4</a> and <a href="#6.3.1.5">6.3.1.5</a>.
2560 <a name="6.3.2" href="#6.3.2"><h4>6.3.2 Other operands</h4></a>
2562 <a name="6.3.2.1" href="#6.3.2.1"><h5>6.3.2.1 Lvalues, arrays, and function designators</h5></a>
2564 An lvalue is an expression with an object type or an incomplete type other than void;<sup><a href="#note53"><b>53)</b></a></sup>
2565 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
2566 When an object is said to have a particular type, the type is specified by the lvalue used to
2567 designate the object. A modifiable lvalue is an lvalue that does not have array type, does
2568 not have an incomplete type, does not have a const-qualified type, and if it is a structure
2569 or union, does not have any member (including, recursively, any member or element of
2570 all contained aggregates or unions) with a const-qualified type.
2572 Except when it is the operand of the sizeof operator, the unary & operator, the ++
2573 operator, the -- operator, or the left operand of the . operator or an assignment operator,
2574 an lvalue that does not have array type is converted to the value stored in the designated
2575 object (and is no longer an lvalue). If the lvalue has qualified type, the value has the
2576 unqualified version of the type of the lvalue; otherwise, the value has the type of the
2577 lvalue. If the lvalue has an incomplete type and does not have array type, the behavior is
2580 Except when it is the operand of the sizeof operator or the unary & operator, or is a
2581 string literal used to initialize an array, an expression that has type ''array of type'' is
2582 converted to an expression with type ''pointer to type'' that points to the initial element of
2583 the array object and is not an lvalue. If the array object has register storage class, the
2584 behavior is undefined.
2586 A function designator is an expression that has function type. Except when it is the
2587 operand of the sizeof operator<sup><a href="#note54"><b>54)</b></a></sup> or the unary & operator, a function designator with
2588 type ''function returning type'' is converted to an expression that has type ''pointer to
2589 function returning type''.
2590 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
2591 (<a href="#6.5.16">6.5.16</a>), common definitions <stddef.h> (<a href="#7.17">7.17</a>), initialization (<a href="#6.7.8">6.7.8</a>), postfix
2592 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2593 (<a href="#6.5.3.1">6.5.3.1</a>), the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>), structure and union members (<a href="#6.5.2.3">6.5.2.3</a>).
2596 <!--page 59 indent 4-->
2599 <p><a name="note53">53)</a> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
2600 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
2601 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
2602 as the ''value of an expression''.
2603 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
2604 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
2606 <p><a name="note54">54)</a> Because this conversion does not occur, the operand of the sizeof operator remains a function
2607 designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
2610 <a name="6.3.2.2" href="#6.3.2.2"><h5>6.3.2.2 void</h5></a>
2612 The (nonexistent) value of a void expression (an expression that has type void) shall not
2613 be used in any way, and implicit or explicit conversions (except to void) shall not be
2614 applied to such an expression. If an expression of any other type is evaluated as a void
2615 expression, its value or designator is discarded. (A void expression is evaluated for its
2618 <a name="6.3.2.3" href="#6.3.2.3"><h5>6.3.2.3 Pointers</h5></a>
2620 A pointer to void may be converted to or from a pointer to any incomplete or object
2621 type. A pointer to any incomplete or object type may be converted to a pointer to void
2622 and back again; the result shall compare equal to the original pointer.
2624 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
2625 the q-qualified version of the type; the values stored in the original and converted pointers
2626 shall compare equal.
2628 An integer constant expression with the value 0, or such an expression cast to type
2629 void *, is called a null pointer constant.<sup><a href="#note55"><b>55)</b></a></sup> If a null pointer constant is converted to a
2630 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
2631 to a pointer to any object or function.
2633 Conversion of a null pointer to another pointer type yields a null pointer of that type.
2634 Any two null pointers shall compare equal.
2636 An integer may be converted to any pointer type. Except as previously specified, the
2637 result is implementation-defined, might not be correctly aligned, might not point to an
2638 entity of the referenced type, and might be a trap representation.<sup><a href="#note56"><b>56)</b></a></sup>
2640 Any pointer type may be converted to an integer type. Except as previously specified, the
2641 result is implementation-defined. If the result cannot be represented in the integer type,
2642 the behavior is undefined. The result need not be in the range of values of any integer
2645 A pointer to an object or incomplete type may be converted to a pointer to a different
2646 object or incomplete type. If the resulting pointer is not correctly aligned<sup><a href="#note57"><b>57)</b></a></sup> for the
2647 pointed-to type, the behavior is undefined. Otherwise, when converted back again, the
2648 result shall compare equal to the original pointer. When a pointer to an object is
2651 <!--page 60 indent 4-->
2652 converted to a pointer to a character type, the result points to the lowest addressed byte of
2653 the object. Successive increments of the result, up to the size of the object, yield pointers
2654 to the remaining bytes of the object.
2656 A pointer to a function of one type may be converted to a pointer to a function of another
2657 type and back again; the result shall compare equal to the original pointer. If a converted
2658 pointer is used to call a function whose type is not compatible with the pointed-to type,
2659 the behavior is undefined.
2660 Forward references: cast operators (<a href="#6.5.4">6.5.4</a>), equality operators (<a href="#6.5.9">6.5.9</a>), integer types
2661 capable of holding object pointers (<a href="#7.18.1.4">7.18.1.4</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>).
2662 <!--page 61 indent 4-->
2665 <p><a name="note55">55)</a> The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see <a href="#7.17">7.17</a>.
2667 <p><a name="note56">56)</a> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
2668 be consistent with the addressing structure of the execution environment.
2670 <p><a name="note57">57)</a> In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
2671 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
2672 correctly aligned for a pointer to type C.
2675 <a name="6.4" href="#6.4"><h3>6.4 Lexical elements</h3></a>
2685 preprocessing-token:
2692 each non-white-space character that cannot be one of the above</pre>
2693 <h6>Constraints</h6>
2695 Each preprocessing token that is converted to a token shall have the lexical form of a
2696 keyword, an identifier, a constant, a string literal, or a punctuator.
2699 A token is the minimal lexical element of the language in translation phases 7 and 8. The
2700 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
2701 A preprocessing token is the minimal lexical element of the language in translation
2702 phases 3 through 6. The categories of preprocessing tokens are: header names,
2703 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
2704 single non-white-space characters that do not lexically match the other preprocessing
2705 token categories.<sup><a href="#note58"><b>58)</b></a></sup> If a ' or a " character matches the last category, the behavior is
2706 undefined. Preprocessing tokens can be separated by white space; this consists of
2707 comments (described later), or white-space characters (space, horizontal tab, new-line,
2708 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
2709 during translation phase 4, white space (or the absence thereof) serves as more than
2710 preprocessing token separation. White space may appear within a preprocessing token
2711 only as part of a header name or between the quotation characters in a character constant
2716 <!--page 62 indent 4-->
2718 If the input stream has been parsed into preprocessing tokens up to a given character, the
2719 next preprocessing token is the longest sequence of characters that could constitute a
2720 preprocessing token. There is one exception to this rule: header name preprocessing
2721 tokens are recognized only within #include preprocessing directives and in
2722 implementation-defined locations within #pragma directives. In such contexts, a
2723 sequence of characters that could be either a header name or a string literal is recognized
2726 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
2727 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
2728 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
2729 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
2730 not E is a macro name.
2733 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
2734 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
2736 Forward references: character constants (<a href="#6.4.4.4">6.4.4.4</a>), comments (<a href="#6.4.9">6.4.9</a>), expressions (<a href="#6.5">6.5</a>),
2737 floating constants (<a href="#6.4.4.2">6.4.4.2</a>), header names (<a href="#6.4.7">6.4.7</a>), macro replacement (<a href="#6.10.3">6.10.3</a>), postfix
2738 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2739 (<a href="#6.5.3.1">6.5.3.1</a>), preprocessing directives (<a href="#6.10">6.10</a>), preprocessing numbers (<a href="#6.4.8">6.4.8</a>), string literals
2740 (<a href="#6.4.5">6.4.5</a>).
2743 <p><a name="note58">58)</a> An additional category, placemarkers, is used internally in translation phase 4 (see <a href="#6.10.3.3">6.10.3.3</a>); it cannot
2744 occur in source files.
2747 <a name="6.4.1" href="#6.4.1"><h4>6.4.1 Keywords</h4></a>
2752 auto enum restrict unsigned
2753 break extern return void
2754 case float short volatile
2755 char for signed while
2756 const goto sizeof _Bool
2757 continue if static _Complex
2758 default inline struct _Imaginary
2761 else register union</pre>
2764 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
2765 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
2766 specifying imaginary types.<sup><a href="#note59"><b>59)</b></a></sup>
2770 <!--page 63 indent 4-->
2773 <p><a name="note59">59)</a> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
2776 <a name="6.4.2" href="#6.4.2"><h4>6.4.2 Identifiers</h4></a>
2778 <a name="6.4.2.1" href="#6.4.2.1"><h5>6.4.2.1 General</h5></a>
2784 identifier identifier-nondigit
2786 identifier-nondigit:
2788 universal-character-name
2789 other implementation-defined characters
2791 _ a b c d e f g h i j k l m
2792 n o p q r s t u v w x y z
2793 A B C D E F G H I J K L M
2794 N O P Q R S T U V W X Y Z
2796 0 1 2 3 4 5 6 7 8 9</pre>
2799 An identifier is a sequence of nondigit characters (including the underscore _, the
2800 lowercase and uppercase Latin letters, and other characters) and digits, which designates
2801 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
2802 There is no specific limit on the maximum length of an identifier.
2804 Each universal character name in an identifier shall designate a character whose encoding
2805 in ISO/IEC 10646 falls into one of the ranges specified in <a href="#D">annex D</a>.<sup><a href="#note60"><b>60)</b></a></sup> The initial
2806 character shall not be a universal character name designating a digit. An implementation
2807 may allow multibyte characters that are not part of the basic source character set to
2808 appear in identifiers; which characters and their correspondence to universal character
2809 names is implementation-defined.
2811 When preprocessing tokens are converted to tokens during translation phase 7, if a
2812 preprocessing token could be converted to either a keyword or an identifier, it is converted
2816 <!--page 64 indent 4-->
2817 Implementation limits
2819 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
2820 characters in an identifier; the limit for an external name (an identifier that has external
2821 linkage) may be more restrictive than that for an internal name (a macro name or an
2822 identifier that does not have external linkage). The number of significant characters in an
2823 identifier is implementation-defined.
2825 Any identifiers that differ in a significant character are different identifiers. If two
2826 identifiers differ only in nonsignificant characters, the behavior is undefined.
2827 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), macro replacement (<a href="#6.10.3">6.10.3</a>).
2830 <p><a name="note60">60)</a> On systems in which linkers cannot accept extended characters, an encoding of the universal character
2831 name may be used in forming valid external identifiers. For example, some otherwise unused
2832 character or sequence of characters may be used to encode the \u in a universal character name.
2833 Extended characters may produce a long external identifier.
2836 <a name="6.4.2.2" href="#6.4.2.2"><h5>6.4.2.2 Predefined identifiers</h5></a>
2839 The identifier __func__ shall be implicitly declared by the translator as if,
2840 immediately following the opening brace of each function definition, the declaration
2842 static const char __func__[] = "function-name";</pre>
2843 appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note61"><b>61)</b></a></sup>
2845 This name is encoded as if the implicit declaration had been written in the source
2846 character set and then translated into the execution character set as indicated in translation
2849 EXAMPLE Consider the code fragment:
2851 #include <stdio.h>
2854 printf("%s\n", __func__);
2857 Each time the function is called, it will print to the standard output stream:
2861 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
2866 <!--page 65 indent 4-->
2869 <p><a name="note61">61)</a> Since the name __func__ is reserved for any use by the implementation (<a href="#7.1.3">7.1.3</a>), if any other
2870 identifier is explicitly declared using the name __func__, the behavior is undefined.
2873 <a name="6.4.3" href="#6.4.3"><h4>6.4.3 Universal character names</h4></a>
2877 universal-character-name:
2879 \U hex-quad hex-quad
2881 hexadecimal-digit hexadecimal-digit
2882 hexadecimal-digit hexadecimal-digit</pre>
2883 <h6>Constraints</h6>
2885 A universal character name shall not specify a character whose short identifier is less than
2886 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
2887 DFFF inclusive.<sup><a href="#note62"><b>62)</b></a></sup>
2888 <h6>Description</h6>
2890 Universal character names may be used in identifiers, character constants, and string
2891 literals to designate characters that are not in the basic character set.
2894 The universal character name \Unnnnnnnn designates the character whose eight-digit
2895 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note63"><b>63)</b></a></sup> Similarly, the universal
2896 character name \unnnn designates the character whose four-digit short identifier is nnnn
2897 (and whose eight-digit short identifier is 0000nnnn).
2902 <!--page 66 indent 4-->
2905 <p><a name="note62">62)</a> The disallowed characters are the characters in the basic character set and the code positions reserved
2906 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
2909 <p><a name="note63">63)</a> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
2912 <a name="6.4.4" href="#6.4.4"><h4>6.4.4 Constants</h4></a>
2919 enumeration-constant
2920 character-constant</pre>
2921 <h6>Constraints</h6>
2923 Each constant shall have a type and the value of a constant shall be in the range of
2924 representable values for its type.
2927 Each constant has a type, determined by its form and value, as detailed later.
2929 <a name="6.4.4.1" href="#6.4.4.1"><h5>6.4.4.1 Integer constants</h5></a>
2932 <!--page 67 indent 4-->
2935 decimal-constant integer-suffixopt
2936 octal-constant integer-suffixopt
2937 hexadecimal-constant integer-suffixopt
2940 decimal-constant digit
2943 octal-constant octal-digit
2944 hexadecimal-constant:
2945 hexadecimal-prefix hexadecimal-digit
2946 hexadecimal-constant hexadecimal-digit
2947 hexadecimal-prefix: one of
2949 nonzero-digit: one of
2953 hexadecimal-digit: one of
2958 unsigned-suffix long-suffixopt
2959 unsigned-suffix long-long-suffix
2960 long-suffix unsigned-suffixopt
2961 long-long-suffix unsigned-suffixopt
2962 unsigned-suffix: one of
2966 long-long-suffix: one of
2968 <h6>Description</h6>
2970 An integer constant begins with a digit, but has no period or exponent part. It may have a
2971 prefix that specifies its base and a suffix that specifies its type.
2973 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
2974 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
2975 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
2976 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
2977 10 through 15 respectively.
2980 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
2981 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
2983 The type of an integer constant is the first of the corresponding list in which its value can
2985 <!--page 68 indent 4-->
2987 Octal or Hexadecimal</pre>
2988 Suffix Decimal Constant Constant
2992 long int unsigned int
2993 long long int long int
2996 unsigned long long int</pre>
2998 u or U unsigned int unsigned int
3000 unsigned long int unsigned long int
3001 unsigned long long int unsigned long long int</pre>
3003 l or L long int long int
3005 long long int unsigned long int
3007 unsigned long long int</pre>
3009 Both u or U unsigned long int unsigned long int
3010 and l or L unsigned long long int unsigned long long int
3012 ll or LL long long int long long int
3014 unsigned long long int</pre>
3016 Both u or U unsigned long long int unsigned long long int
3019 If an integer constant cannot be represented by any type in its list, it may have an
3020 extended integer type, if the extended integer type can represent its value. If all of the
3021 types in the list for the constant are signed, the extended integer type shall be signed. If
3022 all of the types in the list for the constant are unsigned, the extended integer type shall be
3023 unsigned. If the list contains both signed and unsigned types, the extended integer type
3024 may be signed or unsigned. If an integer constant cannot be represented by any type in
3025 its list and has no extended integer type, then the integer constant has no type.
3026 <!--page 69 indent 4-->
3028 <a name="6.4.4.2" href="#6.4.4.2"><h5>6.4.4.2 Floating constants</h5></a>
3031 <!--page 70 indent 4-->
3034 decimal-floating-constant
3035 hexadecimal-floating-constant
3036 decimal-floating-constant:
3037 fractional-constant exponent-partopt floating-suffixopt
3038 digit-sequence exponent-part floating-suffixopt
3039 hexadecimal-floating-constant:
3040 hexadecimal-prefix hexadecimal-fractional-constant
3041 binary-exponent-part floating-suffixopt
3042 hexadecimal-prefix hexadecimal-digit-sequence
3043 binary-exponent-part floating-suffixopt
3044 fractional-constant:
3045 digit-sequenceopt . digit-sequence
3048 e signopt digit-sequence
3049 E signopt digit-sequence
3054 digit-sequence digit
3055 hexadecimal-fractional-constant:
3056 hexadecimal-digit-sequenceopt .
3057 hexadecimal-digit-sequence
3058 hexadecimal-digit-sequence .
3059 binary-exponent-part:
3060 p signopt digit-sequence
3061 P signopt digit-sequence
3062 hexadecimal-digit-sequence:
3064 hexadecimal-digit-sequence hexadecimal-digit
3065 floating-suffix: one of
3067 <h6>Description</h6>
3069 A floating constant has a significand part that may be followed by an exponent part and a
3070 suffix that specifies its type. The components of the significand part may include a digit
3071 sequence representing the whole-number part, followed by a period (.), followed by a
3072 digit sequence representing the fraction part. The components of the exponent part are an
3073 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
3074 Either the whole-number part or the fraction part has to be present; for decimal floating
3075 constants, either the period or the exponent part has to be present.
3078 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
3079 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
3080 floating constants, the exponent indicates the power of 10 by which the significand part is
3081 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
3082 by which the significand part is to be scaled. For decimal floating constants, and also for
3083 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
3084 the nearest representable value, or the larger or smaller representable value immediately
3085 adjacent to the nearest representable value, chosen in an implementation-defined manner.
3086 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
3089 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
3090 type float. If suffixed by the letter l or L, it has type long double.
3092 Floating constants are converted to internal format as if at translation-time. The
3093 conversion of a floating constant shall not raise an exceptional condition or a floating-
3094 point exception at execution time.
3095 Recommended practice
3097 The implementation should produce a diagnostic message if a hexadecimal constant
3098 cannot be represented exactly in its evaluation format; the implementation should then
3099 proceed with the translation of the program.
3101 The translation-time conversion of floating constants should match the execution-time
3102 conversion of character strings by library functions, such as strtod, given matching
3103 inputs suitable for both conversions, the same result format, and default execution-time
3104 rounding.<sup><a href="#note64"><b>64)</b></a></sup>
3109 <!--page 71 indent 4-->
3112 <p><a name="note64">64)</a> The specification for the library functions recommends more accurate conversion than required for
3113 floating constants (see <a href="#7.20.1.3">7.20.1.3</a>).
3116 <a name="6.4.4.3" href="#6.4.4.3"><h5>6.4.4.3 Enumeration constants</h5></a>
3120 enumeration-constant:
3124 An identifier declared as an enumeration constant has type int.
3125 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
3127 <a name="6.4.4.4" href="#6.4.4.4"><h5>6.4.4.4 Character constants</h5></a>
3130 <!--page 72 indent 4-->
3134 L' c-char-sequence '
3137 c-char-sequence c-char
3139 any member of the source character set except
3140 the single-quote ', backslash \, or new-line character
3143 simple-escape-sequence
3144 octal-escape-sequence
3145 hexadecimal-escape-sequence
3146 universal-character-name
3147 simple-escape-sequence: one of
3149 \a \b \f \n \r \t \v
3150 octal-escape-sequence:
3152 \ octal-digit octal-digit
3153 \ octal-digit octal-digit octal-digit
3154 hexadecimal-escape-sequence:
3155 \x hexadecimal-digit
3156 hexadecimal-escape-sequence hexadecimal-digit</pre>
3157 <h6>Description</h6>
3159 An integer character constant is a sequence of one or more multibyte characters enclosed
3160 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
3161 letter L. With a few exceptions detailed later, the elements of the sequence are any
3162 members of the source character set; they are mapped in an implementation-defined
3163 manner to members of the execution character set.
3165 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
3166 arbitrary integer values are representable according to the following table of escape
3174 octal character \octal digits
3175 hexadecimal character \x hexadecimal digits</pre>
3176 The double-quote " and question-mark ? are representable either by themselves or by the
3177 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
3178 shall be represented, respectively, by the escape sequences \' and \\.
3180 The octal digits that follow the backslash in an octal escape sequence are taken to be part
3181 of the construction of a single character for an integer character constant or of a single
3182 wide character for a wide character constant. The numerical value of the octal integer so
3183 formed specifies the value of the desired character or wide character.
3185 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
3186 sequence are taken to be part of the construction of a single character for an integer
3187 character constant or of a single wide character for a wide character constant. The
3188 numerical value of the hexadecimal integer so formed specifies the value of the desired
3189 character or wide character.
3191 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
3192 constitute the escape sequence.
3194 In addition, characters not in the basic character set are representable by universal
3195 character names and certain nongraphic characters are representable by escape sequences
3196 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
3197 and \v.<sup><a href="#note65"><b>65)</b></a></sup>
3202 <!--page 73 indent 5-->
3203 <h6>Constraints</h6>
3205 The value of an octal or hexadecimal escape sequence shall be in the range of
3206 representable values for the type unsigned char for an integer character constant, or
3207 the unsigned type corresponding to wchar_t for a wide character constant.
3210 An integer character constant has type int. The value of an integer character constant
3211 containing a single character that maps to a single-byte execution character is the
3212 numerical value of the representation of the mapped character interpreted as an integer.
3213 The value of an integer character constant containing more than one character (e.g.,
3214 'ab'), or containing a character or escape sequence that does not map to a single-byte
3215 execution character, is implementation-defined. If an integer character constant contains
3216 a single character or escape sequence, its value is the one that results when an object with
3217 type char whose value is that of the single character or escape sequence is converted to
3220 A wide character constant has type wchar_t, an integer type defined in the
3221 <stddef.h> header. The value of a wide character constant containing a single
3222 multibyte character that maps to a member of the extended execution character set is the
3223 wide character corresponding to that multibyte character, as defined by the mbtowc
3224 function, with an implementation-defined current locale. The value of a wide character
3225 constant containing more than one multibyte character, or containing a multibyte
3226 character or escape sequence not represented in the extended execution character set, is
3227 implementation-defined.
3229 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
3232 EXAMPLE 2 Consider implementations that use two's-complement representation for integers and eight
3233 bits for objects that have type char. In an implementation in which type char has the same range of
3234 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
3235 same range of values as unsigned char, the character constant '\xFF' has the value +255.
3238 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
3239 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
3240 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
3241 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
3242 escape sequence is terminated after three octal digits. (The value of this two-character integer character
3243 constant is implementation-defined.)
3246 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
3247 L'\1234' specifies the implementation-defined value that results from the combination of the values
3250 Forward references: common definitions <stddef.h> (<a href="#7.17">7.17</a>), the mbtowc function
3251 (<a href="#7.20.7.2">7.20.7.2</a>).
3252 <!--page 74 indent 4-->
3255 <p><a name="note65">65)</a> The semantics of these characters were discussed in <a href="#5.2.2">5.2.2</a>. If any other character follows a backslash,
3256 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
3259 <a name="6.4.5" href="#6.4.5"><h4>6.4.5 String literals</h4></a>
3264 " s-char-sequenceopt "
3265 L" s-char-sequenceopt "
3268 s-char-sequence s-char
3270 any member of the source character set except
3271 the double-quote ", backslash \, or new-line character
3272 escape-sequence</pre>
3273 <h6>Description</h6>
3275 A character string literal is a sequence of zero or more multibyte characters enclosed in
3276 double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the
3279 The same considerations apply to each element of the sequence in a character string
3280 literal or a wide string literal as if it were in an integer character constant or a wide
3281 character constant, except that the single-quote ' is representable either by itself or by the
3282 escape sequence \', but the double-quote " shall be represented by the escape sequence
3286 In translation phase 6, the multibyte character sequences specified by any sequence of
3287 adjacent character and wide string literal tokens are concatenated into a single multibyte
3288 character sequence. If any of the tokens are wide string literal tokens, the resulting
3289 multibyte character sequence is treated as a wide string literal; otherwise, it is treated as a
3290 character string literal.
3292 In translation phase 7, a byte or code of value zero is appended to each multibyte
3293 character sequence that results from a string literal or literals.<sup><a href="#note66"><b>66)</b></a></sup> The multibyte character
3294 sequence is then used to initialize an array of static storage duration and length just
3295 sufficient to contain the sequence. For character string literals, the array elements have
3296 type char, and are initialized with the individual bytes of the multibyte character
3297 sequence; for wide string literals, the array elements have type wchar_t, and are
3298 initialized with the sequence of wide characters corresponding to the multibyte character
3300 <!--page 75 indent 4-->
3301 sequence, as defined by the mbstowcs function with an implementation-defined current
3302 locale. The value of a string literal containing a multibyte character or escape sequence
3303 not represented in the execution character set is implementation-defined.
3305 It is unspecified whether these arrays are distinct provided their elements have the
3306 appropriate values. If the program attempts to modify such an array, the behavior is
3309 EXAMPLE This pair of adjacent character string literals
3312 produces a single character string literal containing the two characters whose values are '\x12' and '3',
3313 because escape sequences are converted into single members of the execution character set just prior to
3314 adjacent string literal concatenation.
3316 Forward references: common definitions <stddef.h> (<a href="#7.17">7.17</a>), the mbstowcs
3317 function (<a href="#7.20.8.1">7.20.8.1</a>).
3320 <p><a name="note66">66)</a> A character string literal need not be a string (see <a href="#7.1.1">7.1.1</a>), because a null character may be embedded in
3321 it by a \0 escape sequence.
3324 <a name="6.4.6" href="#6.4.6"><h4>6.4.6 Punctuators</h4></a>
3330 ++ -- & * + - ~ !
3331 / % << >> < > <= >= == != ^ | && ||
3333 = *= /= %= += -= <<= >>= &= ^= |=
3335 <: :> <% %> %: %:%:</pre>
3338 A punctuator is a symbol that has independent syntactic and semantic significance.
3339 Depending on context, it may specify an operation to be performed (which in turn may
3340 yield a value or a function designator, produce a side effect, or some combination thereof)
3341 in which case it is known as an operator (other forms of operator also exist in some
3342 contexts). An operand is an entity on which an operator acts.
3343 <!--page 76 indent 4-->
3345 In all aspects of the language, the six tokens<sup><a href="#note67"><b>67)</b></a></sup>
3347 <: :> <% %> %: %:%:</pre>
3348 behave, respectively, the same as the six tokens
3351 except for their spelling.<sup><a href="#note68"><b>68)</b></a></sup>
3352 Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
3353 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
3356 <p><a name="note67">67)</a> These tokens are sometimes called ''digraphs''.
3358 <p><a name="note68">68)</a> Thus [ and <: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
3362 <a name="6.4.7" href="#6.4.7"><h4>6.4.7 Header names</h4></a>
3367 < h-char-sequence >
3371 h-char-sequence h-char
3373 any member of the source character set except
3374 the new-line character and >
3377 q-char-sequence q-char
3379 any member of the source character set except
3380 the new-line character and "</pre>
3383 The sequences in both forms of header names are mapped in an implementation-defined
3384 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
3386 If the characters ', \, ", //, or /* occur in the sequence between the < and > delimiters,
3387 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
3392 <!--page 77 indent 4-->
3393 sequence between the " delimiters, the behavior is undefined.<sup><a href="#note69"><b>69)</b></a></sup> Header name
3394 preprocessing tokens are recognized only within #include preprocessing directives and
3395 in implementation-defined locations within #pragma directives.<sup><a href="#note70"><b>70)</b></a></sup>
3397 EXAMPLE The following sequence of characters:
3400 #include <1/a.h>
3401 #define const.member@$</pre>
3402 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
3403 by a { on the left and a } on the right).
3405 {0x3}{<}{1}{/}{a}{.}{h}{>}{1e2}
3406 {#}{include} {<1/a.h>}
3407 {#}{define} {const}{.}{member}{@}{$}</pre>
3409 Forward references: source file inclusion (<a href="#6.10.2">6.10.2</a>).
3412 <p><a name="note69">69)</a> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
3414 <p><a name="note70">70)</a> For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
3417 <a name="6.4.8" href="#6.4.8"><h4>6.4.8 Preprocessing numbers</h4></a>
3425 pp-number identifier-nondigit
3431 <h6>Description</h6>
3433 A preprocessing number begins with a digit optionally preceded by a period (.) and may
3434 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
3437 Preprocessing number tokens lexically include all floating and integer constant tokens.
3440 A preprocessing number does not have type or a value; it acquires both after a successful
3441 conversion (as part of translation phase 7) to a floating constant token or an integer
3445 <!--page 78 indent 4-->
3447 <a name="6.4.9" href="#6.4.9"><h4>6.4.9 Comments</h4></a>
3449 Except within a character constant, a string literal, or a comment, the characters /*
3450 introduce a comment. The contents of such a comment are examined only to identify
3451 multibyte characters and to find the characters */ that terminate it.<sup><a href="#note71"><b>71)</b></a></sup>
3453 Except within a character constant, a string literal, or a comment, the characters //
3454 introduce a comment that includes all multibyte characters up to, but not including, the
3455 next new-line character. The contents of such a comment are examined only to identify
3456 multibyte characters and to find the terminating new-line character.
3460 "a//b" // four-character string literal
3461 #include "//e" // undefined behavior
3462 // */ // comment, not syntax error
3463 f = g/**//h; // equivalent to f = g / h;
3465 i(); // part of a two-line comment
3467 / j(); // part of a two-line comment
3468 #define glue(x,y) x##y
3469 glue(/,/) k(); // syntax error, not comment
3470 /*//*/ l(); // equivalent to l();
3472 + p; // equivalent to m = n + p;</pre>
3477 <!--page 79 indent 4-->
3480 <p><a name="note71">71)</a> Thus, /* ... */ comments do not nest.
3483 <a name="6.5" href="#6.5"><h3>6.5 Expressions</h3></a>
3485 An expression is a sequence of operators and operands that specifies computation of a
3486 value, or that designates an object or a function, or that generates side effects, or that
3487 performs a combination thereof.
3489 Between the previous and next sequence point an object shall have its stored value
3490 modified at most once by the evaluation of an expression.<sup><a href="#note72"><b>72)</b></a></sup> Furthermore, the prior value
3491 shall be read only to determine the value to be stored.<sup><a href="#note73"><b>73)</b></a></sup>
3493 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note74"><b>74)</b></a></sup> Except as specified
3494 later (for the function-call (), &&, ||, ?:, and comma operators), the order of evaluation
3495 of subexpressions and the order in which side effects take place are both unspecified.
3497 Some operators (the unary operator ~, and the binary operators <<, >>, &, ^, and |,
3498 collectively described as bitwise operators) are required to have operands that have
3499 integer type. These operators yield values that depend on the internal representations of
3500 integers, and have implementation-defined and undefined aspects for signed types.
3502 If an exceptional condition occurs during the evaluation of an expression (that is, if the
3503 result is not mathematically defined or not in the range of representable values for its
3504 type), the behavior is undefined.
3506 The effective type of an object for an access to its stored value is the declared type of the
3507 object, if any.<sup><a href="#note75"><b>75)</b></a></sup> If a value is stored into an object having no declared type through an
3508 lvalue having a type that is not a character type, then the type of the lvalue becomes the
3511 <!--page 80 indent 4-->
3512 effective type of the object for that access and for subsequent accesses that do not modify
3513 the stored value. If a value is copied into an object having no declared type using
3514 memcpy or memmove, or is copied as an array of character type, then the effective type
3515 of the modified object for that access and for subsequent accesses that do not modify the
3516 value is the effective type of the object from which the value is copied, if it has one. For
3517 all other accesses to an object having no declared type, the effective type of the object is
3518 simply the type of the lvalue used for the access.
3520 An object shall have its stored value accessed only by an lvalue expression that has one of
3521 the following types:<sup><a href="#note76"><b>76)</b></a></sup>
3523 <li> a type compatible with the effective type of the object,
3524 <li> a qualified version of a type compatible with the effective type of the object,
3525 <li> a type that is the signed or unsigned type corresponding to the effective type of the
3527 <li> a type that is the signed or unsigned type corresponding to a qualified version of the
3528 effective type of the object,
3529 <li> an aggregate or union type that includes one of the aforementioned types among its
3530 members (including, recursively, a member of a subaggregate or contained union), or
3531 <li> a character type.
3534 A floating expression may be contracted, that is, evaluated as though it were an atomic
3535 operation, thereby omitting rounding errors implied by the source code and the
3536 expression evaluation method.<sup><a href="#note77"><b>77)</b></a></sup> The FP_CONTRACT pragma in <math.h> provides a
3537 way to disallow contracted expressions. Otherwise, whether and how expressions are
3538 contracted is implementation-defined.<sup><a href="#note78"><b>78)</b></a></sup>
3539 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.21.2">7.21.2</a>).
3544 <!--page 81 indent 4-->
3547 <p><a name="note72">72)</a> A floating-point status flag is not an object and can be set more than once within an expression.
3549 <p><a name="note73">73)</a> This paragraph renders undefined statement expressions such as
3559 <p><a name="note74">74)</a> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
3560 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
3561 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
3562 <a href="#6.5.1">6.5.1</a> through <a href="#6.5.6">6.5.6</a>. The exceptions are cast expressions (<a href="#6.5.4">6.5.4</a>) as operands of unary operators
3563 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
3564 parentheses () (<a href="#6.5.1">6.5.1</a>), subscripting brackets [] (<a href="#6.5.2.1">6.5.2.1</a>), function-call parentheses () (<a href="#6.5.2.2">6.5.2.2</a>), and
3565 the conditional operator ?: (<a href="#6.5.15">6.5.15</a>).
3568 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
3569 indicated in each subclause by the syntax for the expressions discussed therein.</pre>
3571 <p><a name="note75">75)</a> Allocated objects have no declared type.
3573 <p><a name="note76">76)</a> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
3575 <p><a name="note77">77)</a> A contracted expression might also omit the raising of floating-point exceptions.
3577 <p><a name="note78">78)</a> This license is specifically intended to allow implementations to exploit fast machine instructions that
3578 combine multiple C operators. As contractions potentially undermine predictability, and can even
3579 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
3583 <a name="6.5.1" href="#6.5.1"><h4>6.5.1 Primary expressions</h4></a>
3591 ( expression )</pre>
3594 An identifier is a primary expression, provided it has been declared as designating an
3595 object (in which case it is an lvalue) or a function (in which case it is a function
3596 designator).<sup><a href="#note79"><b>79)</b></a></sup>
3598 A constant is a primary expression. Its type depends on its form and value, as detailed in
3599 <a href="#6.4.4">6.4.4</a>.
3601 A string literal is a primary expression. It is an lvalue with type as detailed in <a href="#6.4.5">6.4.5</a>.
3603 A parenthesized expression is a primary expression. Its type and value are identical to
3604 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
3605 expression if the unparenthesized expression is, respectively, an lvalue, a function
3606 designator, or a void expression.
3607 Forward references: declarations (<a href="#6.7">6.7</a>).
3610 <p><a name="note79">79)</a> Thus, an undeclared identifier is a violation of the syntax.
3613 <a name="6.5.2" href="#6.5.2"><h4>6.5.2 Postfix operators</h4></a>
3619 postfix-expression [ expression ]
3620 postfix-expression ( argument-expression-listopt )
3621 postfix-expression . identifier
3622 postfix-expression -> identifier
3623 postfix-expression ++
3624 postfix-expression --
3625 ( type-name ) { initializer-list }
3626 ( type-name ) { initializer-list , }</pre>
3631 <!--page 82 indent 4-->
3633 argument-expression-list:
3634 assignment-expression
3635 argument-expression-list , assignment-expression</pre>
3637 <a name="6.5.2.1" href="#6.5.2.1"><h5>6.5.2.1 Array subscripting</h5></a>
3638 <h6>Constraints</h6>
3640 One of the expressions shall have type ''pointer to object type'', the other expression shall
3641 have integer type, and the result has type ''type''.
3644 A postfix expression followed by an expression in square brackets [] is a subscripted
3645 designation of an element of an array object. The definition of the subscript operator []
3646 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
3647 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
3648 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
3649 element of E1 (counting from zero).
3651 Successive subscript operators designate an element of a multidimensional array object.
3652 If E is an n-dimensional array (n >= 2) with dimensions i x j x . . . x k, then E (used as
3653 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
3654 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
3655 implicitly as a result of subscripting, the result is the pointed-to (n - 1)-dimensional array,
3656 which itself is converted into a pointer if used as other than an lvalue. It follows from this
3657 that arrays are stored in row-major order (last subscript varies fastest).
3659 EXAMPLE Consider the array object defined by the declaration
3662 Here x is a 3 x 5 array of ints; more precisely, x is an array of three element objects, each of which is an
3663 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
3664 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
3665 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
3666 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
3667 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
3670 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
3671 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
3672 <!--page 83 indent 4-->
3674 <a name="6.5.2.2" href="#6.5.2.2"><h5>6.5.2.2 Function calls</h5></a>
3675 <h6>Constraints</h6>
3677 The expression that denotes the called function<sup><a href="#note80"><b>80)</b></a></sup> shall have type pointer to function
3678 returning void or returning an object type other than an array type.
3680 If the expression that denotes the called function has a type that includes a prototype, the
3681 number of arguments shall agree with the number of parameters. Each argument shall
3682 have a type such that its value may be assigned to an object with the unqualified version
3683 of the type of its corresponding parameter.
3686 A postfix expression followed by parentheses () containing a possibly empty, comma-
3687 separated list of expressions is a function call. The postfix expression denotes the called
3688 function. The list of expressions specifies the arguments to the function.
3690 An argument may be an expression of any object type. In preparing for the call to a
3691 function, the arguments are evaluated, and each parameter is assigned the value of the
3692 corresponding argument.<sup><a href="#note81"><b>81)</b></a></sup>
3694 If the expression that denotes the called function has type pointer to function returning an
3695 object type, the function call expression has the same type as that object type, and has the
3696 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. If
3697 an attempt is made to modify the result of a function call or to access it after the next
3698 sequence point, the behavior is undefined.
3700 If the expression that denotes the called function has a type that does not include a
3701 prototype, the integer promotions are performed on each argument, and arguments that
3702 have type float are promoted to double. These are called the default argument
3703 promotions. If the number of arguments does not equal the number of parameters, the
3704 behavior is undefined. If the function is defined with a type that includes a prototype, and
3705 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
3706 promotion are not compatible with the types of the parameters, the behavior is undefined.
3707 If the function is defined with a type that does not include a prototype, and the types of
3708 the arguments after promotion are not compatible with those of the parameters after
3709 promotion, the behavior is undefined, except for the following cases:
3714 <!--page 84 indent 5-->
3716 <li> one promoted type is a signed integer type, the other promoted type is the
3717 corresponding unsigned integer type, and the value is representable in both types;
3718 <li> both types are pointers to qualified or unqualified versions of a character type or
3722 If the expression that denotes the called function has a type that does include a prototype,
3723 the arguments are implicitly converted, as if by assignment, to the types of the
3724 corresponding parameters, taking the type of each parameter to be the unqualified version
3725 of its declared type. The ellipsis notation in a function prototype declarator causes
3726 argument type conversion to stop after the last declared parameter. The default argument
3727 promotions are performed on trailing arguments.
3729 No other conversions are performed implicitly; in particular, the number and types of
3730 arguments are not compared with those of the parameters in a function definition that
3731 does not include a function prototype declarator.
3733 If the function is defined with a type that is not compatible with the type (of the
3734 expression) pointed to by the expression that denotes the called function, the behavior is
3737 The order of evaluation of the function designator, the actual arguments, and
3738 subexpressions within the actual arguments is unspecified, but there is a sequence point
3739 before the actual call.
3741 Recursive function calls shall be permitted, both directly and indirectly through any chain
3744 EXAMPLE In the function call
3746 (*pf[f1()]) (f2(), f3() + f4())</pre>
3747 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
3748 the function pointed to by pf[f1()] is called.
3750 Forward references: function declarators (including prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), function
3751 definitions (<a href="#6.9.1">6.9.1</a>), the return statement (<a href="#6.8.6.4">6.8.6.4</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>).
3754 <p><a name="note80">80)</a> Most often, this is the result of converting an identifier that is a function designator.
3756 <p><a name="note81">81)</a> A function may change the values of its parameters, but these changes cannot affect the values of the
3757 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
3758 change the value of the object pointed to. A parameter declared to have array or function type is
3759 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
3762 <a name="6.5.2.3" href="#6.5.2.3"><h5>6.5.2.3 Structure and union members</h5></a>
3763 <h6>Constraints</h6>
3765 The first operand of the . operator shall have a qualified or unqualified structure or union
3766 type, and the second operand shall name a member of that type.
3768 The first operand of the -> operator shall have type ''pointer to qualified or unqualified
3769 structure'' or ''pointer to qualified or unqualified union'', and the second operand shall
3770 name a member of the type pointed to.
3771 <!--page 85 indent 4-->
3774 A postfix expression followed by the . operator and an identifier designates a member of
3775 a structure or union object. The value is that of the named member,<sup><a href="#note82"><b>82)</b></a></sup> and is an lvalue if
3776 the first expression is an lvalue. If the first expression has qualified type, the result has
3777 the so-qualified version of the type of the designated member.
3779 A postfix expression followed by the -> operator and an identifier designates a member
3780 of a structure or union object. The value is that of the named member of the object to
3781 which the first expression points, and is an lvalue.<sup><a href="#note83"><b>83)</b></a></sup> If the first expression is a pointer to
3782 a qualified type, the result has the so-qualified version of the type of the designated
3785 One special guarantee is made in order to simplify the use of unions: if a union contains
3786 several structures that share a common initial sequence (see below), and if the union
3787 object currently contains one of these structures, it is permitted to inspect the common
3788 initial part of any of them anywhere that a declaration of the complete type of the union is
3789 visible. Two structures share a common initial sequence if corresponding members have
3790 compatible types (and, for bit-fields, the same widths) for a sequence of one or more
3793 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
3794 union, f().x is a valid postfix expression but is not an lvalue.
3799 struct s { int i; const int ci; };
3802 volatile struct s vs;</pre>
3803 the various members have the types:
3810 vs.ci volatile const int</pre>
3815 <!--page 86 indent 4-->
3817 EXAMPLE 3 The following is a valid fragment:
3833 u.nf.doublenode = <a href="#3.14">3.14</a>;
3835 if (u.n.alltypes == 1)
3836 if (sin(u.nf.doublenode) == 0.0)
3838 The following is not a valid fragment (because the union type is not visible within function f):
3840 struct t1 { int m; };
3841 struct t2 { int m; };
3842 int f(struct t1 *p1, struct t2 *p2)
3844 if (p1->m < 0)
3845 p2->m = -p2->m;
3855 return f(&u.s1, &u.s2);
3858 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
3859 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
3860 <!--page 87 indent 4-->
3863 <p><a name="note82">82)</a> If the member used to access the contents of a union object is not the same as the member last used to
3864 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
3865 as an object representation in the new type as described in <a href="#6.2.6">6.2.6</a> (a process sometimes called "type
3866 punning"). This might be a trap representation.
3868 <p><a name="note83">83)</a> If &E is a valid pointer expression (where & is the ''address-of '' operator, which generates a pointer to
3869 its operand), the expression (&E)->MOS is the same as E.MOS.
3872 <a name="6.5.2.4" href="#6.5.2.4"><h5>6.5.2.4 Postfix increment and decrement operators</h5></a>
3873 <h6>Constraints</h6>
3875 The operand of the postfix increment or decrement operator shall have qualified or
3876 unqualified real or pointer type and shall be a modifiable lvalue.
3879 The result of the postfix ++ operator is the value of the operand. After the result is
3880 obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate
3881 type is added to it.) See the discussions of additive operators and compound assignment
3882 for information on constraints, types, and conversions and the effects of operations on
3883 pointers. The side effect of updating the stored value of the operand shall occur between
3884 the previous and the next sequence point.
3886 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
3887 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
3889 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), compound assignment (<a href="#6.5.16.2">6.5.16.2</a>).
3891 <a name="6.5.2.5" href="#6.5.2.5"><h5>6.5.2.5 Compound literals</h5></a>
3892 <h6>Constraints</h6>
3894 The type name shall specify an object type or an array of unknown size, but not a variable
3897 No initializer shall attempt to provide a value for an object not contained within the entire
3898 unnamed object specified by the compound literal.
3900 If the compound literal occurs outside the body of a function, the initializer list shall
3901 consist of constant expressions.
3904 A postfix expression that consists of a parenthesized type name followed by a brace-
3905 enclosed list of initializers is a compound literal. It provides an unnamed object whose
3906 value is given by the initializer list.<sup><a href="#note84"><b>84)</b></a></sup>
3908 If the type name specifies an array of unknown size, the size is determined by the
3909 initializer list as specified in <a href="#6.7.8">6.7.8</a>, and the type of the compound literal is that of the
3910 completed array type. Otherwise (when the type name specifies an object type), the type
3911 of the compound literal is that specified by the type name. In either case, the result is an
3915 <!--page 88 indent 5-->
3917 The value of the compound literal is that of an unnamed object initialized by the
3918 initializer list. If the compound literal occurs outside the body of a function, the object
3919 has static storage duration; otherwise, it has automatic storage duration associated with
3920 the enclosing block.
3922 All the semantic rules and constraints for initializer lists in <a href="#6.7.8">6.7.8</a> are applicable to
3923 compound literals.<sup><a href="#note85"><b>85)</b></a></sup>
3925 String literals, and compound literals with const-qualified types, need not designate
3926 distinct objects.<sup><a href="#note86"><b>86)</b></a></sup>
3928 EXAMPLE 1 The file scope definition
3930 int *p = (int []){2, 4};</pre>
3931 initializes p to point to the first element of an array of two ints, the first having the value two and the
3932 second, four. The expressions in this compound literal are required to be constant. The unnamed object
3933 has static storage duration.
3936 EXAMPLE 2 In contrast, in
3945 p is assigned the address of the first element of an array of two ints, the first having the value previously
3946 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
3947 unnamed object has automatic storage duration.
3950 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
3951 created using compound literals can be passed to functions without depending on member order:
3953 drawline((struct point){.x=1, .y=1},
3954 (struct point){.x=3, .y=4});</pre>
3955 Or, if drawline instead expected pointers to struct point:
3957 drawline(&(struct point){.x=1, .y=1},
3958 &(struct point){.x=3, .y=4});</pre>
3961 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
3963 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}</pre>
3968 <!--page 89 indent 5-->
3970 EXAMPLE 5 The following three expressions have different meanings:
3973 (char []){"/tmp/fileXXXXXX"}
3974 (const char []){"/tmp/fileXXXXXX"}</pre>
3975 The first always has static storage duration and has type array of char, but need not be modifiable; the last
3976 two have automatic storage duration when they occur within the body of a function, and the first of these
3980 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
3981 and can even be shared. For example,
3983 (const char []){"abc"} == "abc"</pre>
3984 might yield 1 if the literals' storage is shared.
3987 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
3988 linked object. For example, there is no way to write a self-referential compound literal that could be used
3989 as the function argument in place of the named object endless_zeros below:
3991 struct int_list { int car; struct int_list *cdr; };
3992 struct int_list endless_zeros = {0, &endless_zeros};
3993 eval(endless_zeros);</pre>
3996 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
3998 struct s { int i; };
4001 struct s *p = 0, *q;
4004 q = p, p = &((struct s){ j++ });
4005 if (j < 2) goto again;
4006 return p == q && q->i == 1;
4008 The function f() always returns the value 1.
4010 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
4011 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
4012 have an indeterminate value, which would result in undefined behavior.
4014 Forward references: type names (<a href="#6.7.6">6.7.6</a>), initialization (<a href="#6.7.8">6.7.8</a>).
4015 <!--page 90 indent 4-->
4018 <p><a name="note84">84)</a> Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
4019 or void only, and the result of a cast expression is not an lvalue.
4021 <p><a name="note85">85)</a> For example, subobjects without explicit initializers are initialized to zero.
4023 <p><a name="note86">86)</a> This allows implementations to share storage for string literals and constant compound literals with
4024 the same or overlapping representations.
4027 <a name="6.5.3" href="#6.5.3"><h4>6.5.3 Unary operators</h4></a>
4035 unary-operator cast-expression
4036 sizeof unary-expression
4037 sizeof ( type-name )
4038 unary-operator: one of
4039 & * + - ~ !</pre>
4041 <a name="6.5.3.1" href="#6.5.3.1"><h5>6.5.3.1 Prefix increment and decrement operators</h5></a>
4042 <h6>Constraints</h6>
4044 The operand of the prefix increment or decrement operator shall have qualified or
4045 unqualified real or pointer type and shall be a modifiable lvalue.
4048 The value of the operand of the prefix ++ operator is incremented. The result is the new
4049 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
4050 See the discussions of additive operators and compound assignment for information on
4051 constraints, types, side effects, and conversions and the effects of operations on pointers.
4053 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
4054 operand is decremented.
4055 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), compound assignment (<a href="#6.5.16.2">6.5.16.2</a>).
4057 <a name="6.5.3.2" href="#6.5.3.2"><h5>6.5.3.2 Address and indirection operators</h5></a>
4058 <h6>Constraints</h6>
4060 The operand of the unary & operator shall be either a function designator, the result of a
4061 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
4062 not declared with the register storage-class specifier.
4064 The operand of the unary * operator shall have pointer type.
4067 The unary & operator yields the address of its operand. If the operand has type ''type'',
4068 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
4069 neither that operator nor the & operator is evaluated and the result is as if both were
4070 omitted, except that the constraints on the operators still apply and the result is not an
4071 lvalue. Similarly, if the operand is the result of a [] operator, neither the & operator nor
4072 <!--page 91 indent 4-->
4073 the unary * that is implied by the [] is evaluated and the result is as if the & operator
4074 were removed and the [] operator were changed to a + operator. Otherwise, the result is
4075 a pointer to the object or function designated by its operand.
4077 The unary * operator denotes indirection. If the operand points to a function, the result is
4078 a function designator; if it points to an object, the result is an lvalue designating the
4079 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
4080 invalid value has been assigned to the pointer, the behavior of the unary * operator is
4081 undefined.<sup><a href="#note87"><b>87)</b></a></sup>
4082 Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
4083 (<a href="#6.7.2.1">6.7.2.1</a>).
4086 <p><a name="note87">87)</a> Thus, &*E is equivalent to E (even if E is a null pointer), and &(E1[E2]) to ((E1)+(E2)). It is
4087 always true that if E is a function designator or an lvalue that is a valid operand of the unary &
4088 operator, *&E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
4089 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
4090 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
4091 address inappropriately aligned for the type of object pointed to, and the address of an object after the
4092 end of its lifetime.
4095 <a name="6.5.3.3" href="#6.5.3.3"><h5>6.5.3.3 Unary arithmetic operators</h5></a>
4096 <h6>Constraints</h6>
4098 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
4099 integer type; of the ! operator, scalar type.
4102 The result of the unary + operator is the value of its (promoted) operand. The integer
4103 promotions are performed on the operand, and the result has the promoted type.
4105 The result of the unary - operator is the negative of its (promoted) operand. The integer
4106 promotions are performed on the operand, and the result has the promoted type.
4108 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
4109 each bit in the result is set if and only if the corresponding bit in the converted operand is
4110 not set). The integer promotions are performed on the operand, and the result has the
4111 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
4112 to the maximum value representable in that type minus E.
4114 The result of the logical negation operator ! is 0 if the value of its operand compares
4115 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
4116 The expression !E is equivalent to (0==E).
4121 <!--page 92 indent 4-->
4123 <a name="6.5.3.4" href="#6.5.3.4"><h5>6.5.3.4 The sizeof operator</h5></a>
4124 <h6>Constraints</h6>
4126 The sizeof operator shall not be applied to an expression that has function type or an
4127 incomplete type, to the parenthesized name of such a type, or to an expression that
4128 designates a bit-field member.
4131 The sizeof operator yields the size (in bytes) of its operand, which may be an
4132 expression or the parenthesized name of a type. The size is determined from the type of
4133 the operand. The result is an integer. If the type of the operand is a variable length array
4134 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
4137 When applied to an operand that has type char, unsigned char, or signed char,
4138 (or a qualified version thereof) the result is 1. When applied to an operand that has array
4139 type, the result is the total number of bytes in the array.<sup><a href="#note88"><b>88)</b></a></sup> When applied to an operand
4140 that has structure or union type, the result is the total number of bytes in such an object,
4141 including internal and trailing padding.
4143 The value of the result is implementation-defined, and its type (an unsigned integer type)
4144 is size_t, defined in <stddef.h> (and other headers).
4146 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
4147 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
4148 allocate and return a pointer to void. For example:
4150 extern void *alloc(size_t);
4151 double *dp = alloc(sizeof *dp);</pre>
4152 The implementation of the alloc function should ensure that its return value is aligned suitably for
4153 conversion to a pointer to double.
4156 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
4158 sizeof array / sizeof array[0]</pre>
4161 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
4164 #include <stddef.h>
4165 size_t fsize3(int n)
4167 char b[n+3]; // variable length array
4168 return sizeof b; // execution time sizeof
4173 <!--page 93 indent 4-->
4178 size = fsize3(10); // fsize3 returns 13
4182 Forward references: common definitions <stddef.h> (<a href="#7.17">7.17</a>), declarations (<a href="#6.7">6.7</a>),
4183 structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), type names (<a href="#6.7.6">6.7.6</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
4186 <p><a name="note88">88)</a> When applied to a parameter declared to have array or function type, the sizeof operator yields the
4187 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
4190 <a name="6.5.4" href="#6.5.4"><h4>6.5.4 Cast operators</h4></a>
4196 ( type-name ) cast-expression</pre>
4197 <h6>Constraints</h6>
4199 Unless the type name specifies a void type, the type name shall specify qualified or
4200 unqualified scalar type and the operand shall have scalar type.
4202 Conversions that involve pointers, other than where permitted by the constraints of
4203 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
4206 Preceding an expression by a parenthesized type name converts the value of the
4207 expression to the named type. This construction is called a cast.<sup><a href="#note89"><b>89)</b></a></sup> A cast that specifies
4208 no conversion has no effect on the type or value of an expression.
4210 If the value of the expression is represented with greater precision or range than required
4211 by the type named by the cast (<a href="#6.3.1.8">6.3.1.8</a>), then the cast specifies a conversion even if the
4212 type of the expression is the same as the named type.
4213 Forward references: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
4214 prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
4219 <!--page 94 indent 4-->
4222 <p><a name="note89">89)</a> A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
4223 unqualified version of the type.
4226 <a name="6.5.5" href="#6.5.5"><h4>6.5.5 Multiplicative operators</h4></a>
4230 multiplicative-expression:
4232 multiplicative-expression * cast-expression
4233 multiplicative-expression / cast-expression
4234 multiplicative-expression % cast-expression</pre>
4235 <h6>Constraints</h6>
4237 Each of the operands shall have arithmetic type. The operands of the % operator shall
4241 The usual arithmetic conversions are performed on the operands.
4243 The result of the binary * operator is the product of the operands.
4245 The result of the / operator is the quotient from the division of the first operand by the
4246 second; the result of the % operator is the remainder. In both operations, if the value of
4247 the second operand is zero, the behavior is undefined.
4249 When integers are divided, the result of the / operator is the algebraic quotient with any
4250 fractional part discarded.<sup><a href="#note90"><b>90)</b></a></sup> If the quotient a/b is representable, the expression
4251 (a/b)*b + a%b shall equal a.
4254 <p><a name="note90">90)</a> This is often called ''truncation toward zero''.
4257 <a name="6.5.6" href="#6.5.6"><h4>6.5.6 Additive operators</h4></a>
4261 additive-expression:
4262 multiplicative-expression
4263 additive-expression + multiplicative-expression
4264 additive-expression - multiplicative-expression</pre>
4265 <h6>Constraints</h6>
4267 For addition, either both operands shall have arithmetic type, or one operand shall be a
4268 pointer to an object type and the other shall have integer type. (Incrementing is
4269 equivalent to adding 1.)
4271 For subtraction, one of the following shall hold:
4273 <li> both operands have arithmetic type;
4277 <!--page 95 indent 4-->
4278 <li> both operands are pointers to qualified or unqualified versions of compatible object
4280 <li> the left operand is a pointer to an object type and the right operand has integer type.
4282 (Decrementing is equivalent to subtracting 1.)
4285 If both operands have arithmetic type, the usual arithmetic conversions are performed on
4288 The result of the binary + operator is the sum of the operands.
4290 The result of the binary - operator is the difference resulting from the subtraction of the
4291 second operand from the first.
4293 For the purposes of these operators, a pointer to an object that is not an element of an
4294 array behaves the same as a pointer to the first element of an array of length one with the
4295 type of the object as its element type.
4297 When an expression that has integer type is added to or subtracted from a pointer, the
4298 result has the type of the pointer operand. If the pointer operand points to an element of
4299 an array object, and the array is large enough, the result points to an element offset from
4300 the original element such that the difference of the subscripts of the resulting and original
4301 array elements equals the integer expression. In other words, if the expression P points to
4302 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
4303 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
4304 the array object, provided they exist. Moreover, if the expression P points to the last
4305 element of an array object, the expression (P)+1 points one past the last element of the
4306 array object, and if the expression Q points one past the last element of an array object,
4307 the expression (Q)-1 points to the last element of the array object. If both the pointer
4308 operand and the result point to elements of the same array object, or one past the last
4309 element of the array object, the evaluation shall not produce an overflow; otherwise, the
4310 behavior is undefined. If the result points one past the last element of the array object, it
4311 shall not be used as the operand of a unary * operator that is evaluated.
4313 When two pointers are subtracted, both shall point to elements of the same array object,
4314 or one past the last element of the array object; the result is the difference of the
4315 subscripts of the two array elements. The size of the result is implementation-defined,
4316 and its type (a signed integer type) is ptrdiff_t defined in the <stddef.h> header.
4317 If the result is not representable in an object of that type, the behavior is undefined. In
4318 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
4319 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
4320 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
4321 an array object or one past the last element of an array object, and the expression Q points
4322 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
4323 <!--page 96 indent 5-->
4324 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
4325 expression P points one past the last element of the array object, even though the
4326 expression (Q)+1 does not point to an element of the array object.<sup><a href="#note91"><b>91)</b></a></sup>
4328 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
4334 int (*p)[m] = a; // p == &a[0]
4335 p += 1; // p == &a[1]
4336 (*p)[2] = 99; // a[1][2] == 99
4337 n = p - a; // n == 1
4339 If array a in the above example were declared to be an array of known constant size, and pointer p were
4340 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
4343 Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), common definitions <stddef.h>
4344 (<a href="#7.17">7.17</a>).
4347 <p><a name="note91">91)</a> Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
4348 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
4349 by the size of the object originally pointed to, and the resulting pointer is converted back to the
4350 original type. For pointer subtraction, the result of the difference between the character pointers is
4351 similarly divided by the size of the object originally pointed to.
4352 When viewed in this way, an implementation need only provide one extra byte (which may overlap
4353 another object in the program) just after the end of the object in order to satisfy the ''one past the last
4354 element'' requirements.
4357 <a name="6.5.7" href="#6.5.7"><h4>6.5.7 Bitwise shift operators</h4></a>
4363 shift-expression << additive-expression
4364 shift-expression >> additive-expression</pre>
4365 <h6>Constraints</h6>
4367 Each of the operands shall have integer type.
4370 The integer promotions are performed on each of the operands. The type of the result is
4371 that of the promoted left operand. If the value of the right operand is negative or is
4372 greater than or equal to the width of the promoted left operand, the behavior is undefined.
4377 <!--page 97 indent 4-->
4379 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
4380 zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
4381 one more than the maximum value representable in the result type. If E1 has a signed
4382 type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
4383 the resulting value; otherwise, the behavior is undefined.
4385 The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
4386 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
4387 part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
4388 resulting value is implementation-defined.
4390 <a name="6.5.8" href="#6.5.8"><h4>6.5.8 Relational operators</h4></a>
4394 relational-expression:
4396 relational-expression < shift-expression
4397 relational-expression > shift-expression
4398 relational-expression <= shift-expression
4399 relational-expression >= shift-expression</pre>
4400 <h6>Constraints</h6>
4402 One of the following shall hold:
4404 <li> both operands have real type;
4405 <li> both operands are pointers to qualified or unqualified versions of compatible object
4407 <li> both operands are pointers to qualified or unqualified versions of compatible
4412 If both of the operands have arithmetic type, the usual arithmetic conversions are
4415 For the purposes of these operators, a pointer to an object that is not an element of an
4416 array behaves the same as a pointer to the first element of an array of length one with the
4417 type of the object as its element type.
4419 When two pointers are compared, the result depends on the relative locations in the
4420 address space of the objects pointed to. If two pointers to object or incomplete types both
4421 point to the same object, or both point one past the last element of the same array object,
4422 they compare equal. If the objects pointed to are members of the same aggregate object,
4423 pointers to structure members declared later compare greater than pointers to members
4424 declared earlier in the structure, and pointers to array elements with larger subscript
4425 <!--page 98 indent 4-->
4426 values compare greater than pointers to elements of the same array with lower subscript
4427 values. All pointers to members of the same union object compare equal. If the
4428 expression P points to an element of an array object and the expression Q points to the
4429 last element of the same array object, the pointer expression Q+1 compares greater than
4430 P. In all other cases, the behavior is undefined.
4432 Each of the operators < (less than), > (greater than), <= (less than or equal to), and >=
4433 (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.<sup><a href="#note92"><b>92)</b></a></sup>
4434 The result has type int.
4437 <p><a name="note92">92)</a> The expression a<b<c is not interpreted as in ordinary mathematics. As the syntax indicates, it
4438 means (a<b)<c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
4441 <a name="6.5.9" href="#6.5.9"><h4>6.5.9 Equality operators</h4></a>
4445 equality-expression:
4446 relational-expression
4447 equality-expression == relational-expression
4448 equality-expression != relational-expression</pre>
4449 <h6>Constraints</h6>
4451 One of the following shall hold:
4453 <li> both operands have arithmetic type;
4454 <li> both operands are pointers to qualified or unqualified versions of compatible types;
4455 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4456 qualified or unqualified version of void; or
4457 <li> one operand is a pointer and the other is a null pointer constant.
4461 The == (equal to) and != (not equal to) operators are analogous to the relational
4462 operators except for their lower precedence.<sup><a href="#note93"><b>93)</b></a></sup> Each of the operators yields 1 if the
4463 specified relation is true and 0 if it is false. The result has type int. For any pair of
4464 operands, exactly one of the relations is true.
4466 If both of the operands have arithmetic type, the usual arithmetic conversions are
4467 performed. Values of complex types are equal if and only if both their real parts are equal
4468 and also their imaginary parts are equal. Any two values of arithmetic types from
4469 different type domains are equal if and only if the results of their conversions to the
4470 (complex) result type determined by the usual arithmetic conversions are equal.
4473 <!--page 99 indent 4-->
4475 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
4476 null pointer constant, the null pointer constant is converted to the type of the pointer. If
4477 one operand is a pointer to an object or incomplete type and the other is a pointer to a
4478 qualified or unqualified version of void, the former is converted to the type of the latter.
4480 Two pointers compare equal if and only if both are null pointers, both are pointers to the
4481 same object (including a pointer to an object and a subobject at its beginning) or function,
4482 both are pointers to one past the last element of the same array object, or one is a pointer
4483 to one past the end of one array object and the other is a pointer to the start of a different
4484 array object that happens to immediately follow the first array object in the address
4485 space.<sup><a href="#note94"><b>94)</b></a></sup>
4487 For the purposes of these operators, a pointer to an object that is not an element of an
4488 array behaves the same as a pointer to the first element of an array of length one with the
4489 type of the object as its element type.
4492 <p><a name="note93">93)</a> Because of the precedences, a<b == c<d is 1 whenever a<b and c<d have the same truth-value.
4494 <p><a name="note94">94)</a> Two objects may be adjacent in memory because they are adjacent elements of a larger array or
4495 adjacent members of a structure with no padding between them, or because the implementation chose
4496 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
4497 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
4501 <a name="6.5.10" href="#6.5.10"><h4>6.5.10 Bitwise AND operator</h4></a>
4507 AND-expression & equality-expression</pre>
4508 <h6>Constraints</h6>
4510 Each of the operands shall have integer type.
4513 The usual arithmetic conversions are performed on the operands.
4515 The result of the binary & operator is the bitwise AND of the operands (that is, each bit in
4516 the result is set if and only if each of the corresponding bits in the converted operands is
4522 <!--page 100 indent 4-->
4524 <a name="6.5.11" href="#6.5.11"><h4>6.5.11 Bitwise exclusive OR operator</h4></a>
4528 exclusive-OR-expression:
4530 exclusive-OR-expression ^ AND-expression</pre>
4531 <h6>Constraints</h6>
4533 Each of the operands shall have integer type.
4536 The usual arithmetic conversions are performed on the operands.
4538 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
4539 in the result is set if and only if exactly one of the corresponding bits in the converted
4542 <a name="6.5.12" href="#6.5.12"><h4>6.5.12 Bitwise inclusive OR operator</h4></a>
4546 inclusive-OR-expression:
4547 exclusive-OR-expression
4548 inclusive-OR-expression | exclusive-OR-expression</pre>
4549 <h6>Constraints</h6>
4551 Each of the operands shall have integer type.
4554 The usual arithmetic conversions are performed on the operands.
4556 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
4557 the result is set if and only if at least one of the corresponding bits in the converted
4559 <!--page 101 indent 4-->
4561 <a name="6.5.13" href="#6.5.13"><h4>6.5.13 Logical AND operator</h4></a>
4565 logical-AND-expression:
4566 inclusive-OR-expression
4567 logical-AND-expression && inclusive-OR-expression</pre>
4568 <h6>Constraints</h6>
4570 Each of the operands shall have scalar type.
4573 The && operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
4574 yields 0. The result has type int.
4576 Unlike the bitwise binary & operator, the && operator guarantees left-to-right evaluation;
4577 there is a sequence point after the evaluation of the first operand. If the first operand
4578 compares equal to 0, the second operand is not evaluated.
4580 <a name="6.5.14" href="#6.5.14"><h4>6.5.14 Logical OR operator</h4></a>
4584 logical-OR-expression:
4585 logical-AND-expression
4586 logical-OR-expression || logical-AND-expression</pre>
4587 <h6>Constraints</h6>
4589 Each of the operands shall have scalar type.
4592 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
4593 yields 0. The result has type int.
4595 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is
4596 a sequence point after the evaluation of the first operand. If the first operand compares
4597 unequal to 0, the second operand is not evaluated.
4598 <!--page 102 indent 4-->
4600 <a name="6.5.15" href="#6.5.15"><h4>6.5.15 Conditional operator</h4></a>
4604 conditional-expression:
4605 logical-OR-expression
4606 logical-OR-expression ? expression : conditional-expression</pre>
4607 <h6>Constraints</h6>
4609 The first operand shall have scalar type.
4611 One of the following shall hold for the second and third operands:
4613 <li> both operands have arithmetic type;
4614 <li> both operands have the same structure or union type;
4615 <li> both operands have void type;
4616 <li> both operands are pointers to qualified or unqualified versions of compatible types;
4617 <li> one operand is a pointer and the other is a null pointer constant; or
4618 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4619 qualified or unqualified version of void.
4623 The first operand is evaluated; there is a sequence point after its evaluation. The second
4624 operand is evaluated only if the first compares unequal to 0; the third operand is evaluated
4625 only if the first compares equal to 0; the result is the value of the second or third operand
4626 (whichever is evaluated), converted to the type described below.<sup><a href="#note95"><b>95)</b></a></sup> If an attempt is made
4627 to modify the result of a conditional operator or to access it after the next sequence point,
4628 the behavior is undefined.
4630 If both the second and third operands have arithmetic type, the result type that would be
4631 determined by the usual arithmetic conversions, were they applied to those two operands,
4632 is the type of the result. If both the operands have structure or union type, the result has
4633 that type. If both operands have void type, the result has void type.
4635 If both the second and third operands are pointers or one is a null pointer constant and the
4636 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
4637 of the types pointed-to by both operands. Furthermore, if both operands are pointers to
4638 compatible types or to differently qualified versions of compatible types, the result type is
4639 a pointer to an appropriately qualified version of the composite type; if one operand is a
4640 null pointer constant, the result has the type of the other operand; otherwise, one operand
4641 is a pointer to void or a qualified version of void, in which case the result type is a
4643 <!--page 103 indent 4-->
4644 pointer to an appropriately qualified version of void.
4646 EXAMPLE The common type that results when the second and third operands are pointers is determined
4647 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
4648 pointers have compatible types.
4650 Given the declarations
4657 const char *c_cp;</pre>
4658 the third column in the following table is the common type that is the result of a conditional expression in
4659 which the first two columns are the second and third operands (in either order):
4661 c_vp c_ip const void *
4662 v_ip 0 volatile int *
4663 c_ip v_ip const volatile int *
4664 vp c_cp const void *
4670 <p><a name="note95">95)</a> A conditional expression does not yield an lvalue.
4673 <a name="6.5.16" href="#6.5.16"><h4>6.5.16 Assignment operators</h4></a>
4677 assignment-expression:
4678 conditional-expression
4679 unary-expression assignment-operator assignment-expression
4680 assignment-operator: one of
4681 = *= /= %= += -= <<= >>= &= ^= |=</pre>
4682 <h6>Constraints</h6>
4684 An assignment operator shall have a modifiable lvalue as its left operand.
4687 An assignment operator stores a value in the object designated by the left operand. An
4688 assignment expression has the value of the left operand after the assignment, but is not an
4689 lvalue. The type of an assignment expression is the type of the left operand unless the
4690 left operand has qualified type, in which case it is the unqualified version of the type of
4691 the left operand. The side effect of updating the stored value of the left operand shall
4692 occur between the previous and the next sequence point.
4694 The order of evaluation of the operands is unspecified. If an attempt is made to modify
4695 the result of an assignment operator or to access it after the next sequence point, the
4696 behavior is undefined.
4697 <!--page 104 indent 4-->
4699 <a name="6.5.16.1" href="#6.5.16.1"><h5>6.5.16.1 Simple assignment</h5></a>
4700 <h6>Constraints</h6>
4702 One of the following shall hold:<sup><a href="#note96"><b>96)</b></a></sup>
4704 <li> the left operand has qualified or unqualified arithmetic type and the right has
4706 <li> the left operand has a qualified or unqualified version of a structure or union type
4707 compatible with the type of the right;
4708 <li> both operands are pointers to qualified or unqualified versions of compatible types,
4709 and the type pointed to by the left has all the qualifiers of the type pointed to by the
4711 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4712 qualified or unqualified version of void, and the type pointed to by the left has all
4713 the qualifiers of the type pointed to by the right;
4714 <li> the left operand is a pointer and the right is a null pointer constant; or
4715 <li> the left operand has type _Bool and the right is a pointer.
4719 In simple assignment (=), the value of the right operand is converted to the type of the
4720 assignment expression and replaces the value stored in the object designated by the left
4723 If the value being stored in an object is read from another object that overlaps in any way
4724 the storage of the first object, then the overlap shall be exact and the two objects shall
4725 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
4728 EXAMPLE 1 In the program fragment
4733 if ((c = f()) == -1)
4735 the int value returned by the function may be truncated when stored in the char, and then converted back
4736 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
4737 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
4741 <!--page 105 indent 4-->
4742 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
4743 variable c should be declared as int.
4746 EXAMPLE 2 In the fragment:
4752 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
4753 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
4754 that is, long int type.
4757 EXAMPLE 3 Consider the fragment:
4762 cpp = &p; // constraint violation
4763 *cpp = &c; // valid
4764 *p = 0; // valid</pre>
4765 The first assignment is unsafe because it would allow the following valid code to attempt to change the
4766 value of the const object c.
4770 <p><a name="note96">96)</a> The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
4771 (specified in <a href="#6.3.2.1">6.3.2.1</a>) that changes lvalues to ''the value of the expression'' and thus removes any type
4772 qualifiers that were applied to the type category of the expression (for example, it removes const but
4773 not volatile from the type int volatile * const).
4776 <a name="6.5.16.2" href="#6.5.16.2"><h5>6.5.16.2 Compound assignment</h5></a>
4777 <h6>Constraints</h6>
4779 For the operators += and -= only, either the left operand shall be a pointer to an object
4780 type and the right shall have integer type, or the left operand shall have qualified or
4781 unqualified arithmetic type and the right shall have arithmetic type.
4783 For the other operators, each operand shall have arithmetic type consistent with those
4784 allowed by the corresponding binary operator.
4787 A compound assignment of the form E1 op = E2 differs from the simple assignment
4788 expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
4789 <!--page 106 indent 4-->
4791 <a name="6.5.17" href="#6.5.17"><h4>6.5.17 Comma operator</h4></a>
4796 assignment-expression
4797 expression , assignment-expression</pre>
4800 The left operand of a comma operator is evaluated as a void expression; there is a
4801 sequence point after its evaluation. Then the right operand is evaluated; the result has its
4802 type and value.<sup><a href="#note97"><b>97)</b></a></sup> If an attempt is made to modify the result of a comma operator or to
4803 access it after the next sequence point, the behavior is undefined.
4805 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
4806 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
4807 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
4808 expression of a conditional operator in such contexts. In the function call
4810 f(a, (t=3, t+2), c)</pre>
4811 the function has three arguments, the second of which has the value 5.
4813 Forward references: initialization (<a href="#6.7.8">6.7.8</a>).
4818 <!--page 107 indent 4-->
4821 <p><a name="note97">97)</a> A comma operator does not yield an lvalue.
4824 <a name="6.6" href="#6.6"><h3>6.6 Constant expressions</h3></a>
4828 constant-expression:
4829 conditional-expression</pre>
4830 <h6>Description</h6>
4832 A constant expression can be evaluated during translation rather than runtime, and
4833 accordingly may be used in any place that a constant may be.
4834 <h6>Constraints</h6>
4836 Constant expressions shall not contain assignment, increment, decrement, function-call,
4837 or comma operators, except when they are contained within a subexpression that is not
4838 evaluated.<sup><a href="#note98"><b>98)</b></a></sup>
4840 Each constant expression shall evaluate to a constant that is in the range of representable
4841 values for its type.
4844 An expression that evaluates to a constant is required in several contexts. If a floating
4845 expression is evaluated in the translation environment, the arithmetic precision and range
4846 shall be at least as great as if the expression were being evaluated in the execution
4849 An integer constant expression<sup><a href="#note99"><b>99)</b></a></sup> shall have integer type and shall only have operands
4850 that are integer constants, enumeration constants, character constants, sizeof
4851 expressions whose results are integer constants, and floating constants that are the
4852 immediate operands of casts. Cast operators in an integer constant expression shall only
4853 convert arithmetic types to integer types, except as part of an operand to the sizeof
4856 More latitude is permitted for constant expressions in initializers. Such a constant
4857 expression shall be, or evaluate to, one of the following:
4859 <li> an arithmetic constant expression,
4860 <li> a null pointer constant,
4865 <!--page 108 indent 5-->
4866 <li> an address constant, or
4867 <li> an address constant for an object type plus or minus an integer constant expression.
4870 An arithmetic constant expression shall have arithmetic type and shall only have
4871 operands that are integer constants, floating constants, enumeration constants, character
4872 constants, and sizeof expressions. Cast operators in an arithmetic constant expression
4873 shall only convert arithmetic types to arithmetic types, except as part of an operand to a
4874 sizeof operator whose result is an integer constant.
4876 An address constant is a null pointer, a pointer to an lvalue designating an object of static
4877 storage duration, or a pointer to a function designator; it shall be created explicitly using
4878 the unary & operator or an integer constant cast to pointer type, or implicitly by the use of
4879 an expression of array or function type. The array-subscript [] and member-access .
4880 and -> operators, the address & and indirection * unary operators, and pointer casts may
4881 be used in the creation of an address constant, but the value of an object shall not be
4882 accessed by use of these operators.
4884 An implementation may accept other forms of constant expressions.
4886 The semantic rules for the evaluation of a constant expression are the same as for
4887 nonconstant expressions.<sup><a href="#note100"><b>100)</b></a></sup>
4888 Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
4893 <!--page 109 indent 4-->
4896 <p><a name="note98">98)</a> The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
4898 <p><a name="note99">99)</a> An integer constant expression is used to specify the size of a bit-field member of a structure, the
4899 value of an enumeration constant, the size of an array, or the value of a case constant. Further
4900 constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing
4901 directives are discussed in <a href="#6.10.1">6.10.1</a>.
4903 <p><a name="note100">100)</a> Thus, in the following initialization,
4906 static int i = 2 || 1 / 0;</pre>
4907 the expression is a valid integer constant expression with value one.
4910 <a name="6.7" href="#6.7"><h3>6.7 Declarations</h3></a>
4915 declaration-specifiers init-declarator-listopt ;
4916 declaration-specifiers:
4917 storage-class-specifier declaration-specifiersopt
4918 type-specifier declaration-specifiersopt
4919 type-qualifier declaration-specifiersopt
4920 function-specifier declaration-specifiersopt
4921 init-declarator-list:
4923 init-declarator-list , init-declarator
4926 declarator = initializer</pre>
4927 <h6>Constraints</h6>
4929 A declaration shall declare at least a declarator (other than the parameters of a function or
4930 the members of a structure or union), a tag, or the members of an enumeration.
4932 If an identifier has no linkage, there shall be no more than one declaration of the identifier
4933 (in a declarator or type specifier) with the same scope and in the same name space, except
4934 for tags as specified in <a href="#6.7.2.3">6.7.2.3</a>.
4936 All declarations in the same scope that refer to the same object or function shall specify
4940 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
4941 of an identifier is a declaration for that identifier that:
4943 <li> for an object, causes storage to be reserved for that object;
4944 <li> for a function, includes the function body;<sup><a href="#note101"><b>101)</b></a></sup>
4945 <li> for an enumeration constant or typedef name, is the (only) declaration of the
4949 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
4950 storage duration, and part of the type of the entities that the declarators denote. The init-
4951 declarator-list is a comma-separated sequence of declarators, each of which may have
4953 <!--page 110 indent 4-->
4954 additional type information, or an initializer, or both. The declarators contain the
4955 identifiers (if any) being declared.
4957 If an identifier for an object is declared with no linkage, the type for the object shall be
4958 complete by the end of its declarator, or by the end of its init-declarator if it has an
4959 initializer; in the case of function parameters (including in prototypes), it is the adjusted
4960 type (see <a href="#6.7.5.3">6.7.5.3</a>) that is required to be complete.
4961 Forward references: declarators (<a href="#6.7.5">6.7.5</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
4962 (<a href="#6.7.8">6.7.8</a>).
4965 <p><a name="note101">101)</a> Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
4968 <a name="6.7.1" href="#6.7.1"><h4>6.7.1 Storage-class specifiers</h4></a>
4972 storage-class-specifier:
4978 <h6>Constraints</h6>
4980 At most, one storage-class specifier may be given in the declaration specifiers in a
4981 declaration.<sup><a href="#note102"><b>102)</b></a></sup>
4984 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
4985 only; it is discussed in <a href="#6.7.7">6.7.7</a>. The meanings of the various linkages and storage durations
4986 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
4988 A declaration of an identifier for an object with storage-class specifier register
4989 suggests that access to the object be as fast as possible. The extent to which such
4990 suggestions are effective is implementation-defined.<sup><a href="#note103"><b>103)</b></a></sup>
4992 The declaration of an identifier for a function that has block scope shall have no explicit
4993 storage-class specifier other than extern.
4997 <!--page 111 indent 4-->
4999 If an aggregate or union object is declared with a storage-class specifier other than
5000 typedef, the properties resulting from the storage-class specifier, except with respect to
5001 linkage, also apply to the members of the object, and so on recursively for any aggregate
5002 or union member objects.
5003 Forward references: type definitions (<a href="#6.7.7">6.7.7</a>).
5006 <p><a name="note102">102)</a> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
5008 <p><a name="note103">103)</a> The implementation may treat any register declaration simply as an auto declaration. However,
5009 whether or not addressable storage is actually used, the address of any part of an object declared with
5010 storage-class specifier register cannot be computed, either explicitly (by use of the unary &
5011 operator as discussed in <a href="#6.5.3.2">6.5.3.2</a>) or implicitly (by converting an array name to a pointer as discussed in
5012 <a href="#6.3.2.1">6.3.2.1</a>). Thus, the only operator that can be applied to an array declared with storage-class specifier
5016 <a name="6.7.2" href="#6.7.2"><h4>6.7.2 Type specifiers</h4></a>
5032 struct-or-union-specifier *
5035 <h6>Constraints</h6>
5037 At least one type specifier shall be given in the declaration specifiers in each declaration,
5038 and in the specifier-qualifier list in each struct declaration and type name. Each list of
5039 type specifiers shall be one of the following sets (delimited by commas, when there is
5040 more than one set on a line); the type specifiers may occur in any order, possibly
5041 intermixed with the other declaration specifiers.
5047 <li> short, signed short, short int, or signed short int
5048 <li> unsigned short, or unsigned short int
5049 <li> int, signed, or signed int
5050 <!--page 112 indent 4-->
5051 <li> unsigned, or unsigned int
5052 <li> long, signed long, long int, or signed long int
5053 <li> unsigned long, or unsigned long int
5054 <li> long long, signed long long, long long int, or
5055 signed long long int
5056 <li> unsigned long long, or unsigned long long int
5062 <li> double _Complex
5063 <li> long double _Complex
5064 <li> struct or union specifier *
5069 The type specifier _Complex shall not be used if the implementation does not provide
5070 complex types.<sup><a href="#note104"><b>104)</b></a></sup>
5073 Specifiers for structures, unions, and enumerations are discussed in <a href="#6.7.2.1">6.7.2.1</a> through
5074 <a href="#6.7.2.3">6.7.2.3</a>. Declarations of typedef names are discussed in <a href="#6.7.7">6.7.7</a>. The characteristics of the
5075 other types are discussed in <a href="#6.2.5">6.2.5</a>.
5077 Each of the comma-separated sets designates the same type, except that for bit-fields, it is
5078 implementation-defined whether the specifier int designates the same type as signed
5079 int or the same type as unsigned int.
5080 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
5081 (<a href="#6.7.2.1">6.7.2.1</a>), tags (<a href="#6.7.2.3">6.7.2.3</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
5086 <!--page 113 indent 4-->
5089 <p><a name="note104">104)</a> Freestanding implementations are not required to provide complex types. *
5092 <a name="6.7.2.1" href="#6.7.2.1"><h5>6.7.2.1 Structure and union specifiers</h5></a>
5096 struct-or-union-specifier:
5097 struct-or-union identifieropt { struct-declaration-list }
5098 struct-or-union identifier
5102 struct-declaration-list:
5104 struct-declaration-list struct-declaration
5106 specifier-qualifier-list struct-declarator-list ;
5107 specifier-qualifier-list:
5108 type-specifier specifier-qualifier-listopt
5109 type-qualifier specifier-qualifier-listopt
5110 struct-declarator-list:
5112 struct-declarator-list , struct-declarator
5115 declaratoropt : constant-expression</pre>
5116 <h6>Constraints</h6>
5118 A structure or union shall not contain a member with incomplete or function type (hence,
5119 a structure shall not contain an instance of itself, but may contain a pointer to an instance
5120 of itself), except that the last member of a structure with more than one named member
5121 may have incomplete array type; such a structure (and any union containing, possibly
5122 recursively, a member that is such a structure) shall not be a member of a structure or an
5123 element of an array.
5125 The expression that specifies the width of a bit-field shall be an integer constant
5126 expression with a nonnegative value that does not exceed the width of an object of the
5127 type that would be specified were the colon and expression omitted. If the value is zero,
5128 the declaration shall have no declarator.
5130 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
5131 int, unsigned int, or some other implementation-defined type.
5132 <!--page 114 indent 5-->
5135 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
5136 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
5137 of members whose storage overlap.
5139 Structure and union specifiers have the same form. The keywords struct and union
5140 indicate that the type being specified is, respectively, a structure type or a union type.
5142 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
5143 within a translation unit. The struct-declaration-list is a sequence of declarations for the
5144 members of the structure or union. If the struct-declaration-list contains no named
5145 members, the behavior is undefined. The type is incomplete until after the } that
5146 terminates the list.
5148 A member of a structure or union may have any object type other than a variably
5149 modified type.<sup><a href="#note105"><b>105)</b></a></sup> In addition, a member may be declared to consist of a specified
5150 number of bits (including a sign bit, if any). Such a member is called a bit-field;<sup><a href="#note106"><b>106)</b></a></sup> its
5151 width is preceded by a colon.
5153 A bit-field is interpreted as a signed or unsigned integer type consisting of the specified
5154 number of bits.<sup><a href="#note107"><b>107)</b></a></sup> If the value 0 or 1 is stored into a nonzero-width bit-field of type
5155 _Bool, the value of the bit-field shall compare equal to the value stored.
5157 An implementation may allocate any addressable storage unit large enough to hold a bit-
5158 field. If enough space remains, a bit-field that immediately follows another bit-field in a
5159 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
5160 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
5161 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
5162 low-order or low-order to high-order) is implementation-defined. The alignment of the
5163 addressable storage unit is unspecified.
5165 A bit-field declaration with no declarator, but only a colon and a width, indicates an
5166 unnamed bit-field.<sup><a href="#note108"><b>108)</b></a></sup> As a special case, a bit-field structure member with a width of 0
5167 indicates that no further bit-field is to be packed into the unit in which the previous bit-
5168 field, if any, was placed.
5171 <!--page 115 indent 5-->
5173 Each non-bit-field member of a structure or union object is aligned in an implementation-
5174 defined manner appropriate to its type.
5176 Within a structure object, the non-bit-field members and the units in which bit-fields
5177 reside have addresses that increase in the order in which they are declared. A pointer to a
5178 structure object, suitably converted, points to its initial member (or if that member is a
5179 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
5180 padding within a structure object, but not at its beginning.
5182 The size of a union is sufficient to contain the largest of its members. The value of at
5183 most one of the members can be stored in a union object at any time. A pointer to a
5184 union object, suitably converted, points to each of its members (or if a member is a bit-
5185 field, then to the unit in which it resides), and vice versa.
5187 There may be unnamed padding at the end of a structure or union.
5189 As a special case, the last element of a structure with more than one named member may
5190 have an incomplete array type; this is called a flexible array member. In most situations,
5191 the flexible array member is ignored. In particular, the size of the structure is as if the
5192 flexible array member were omitted except that it may have more trailing padding than
5193 the omission would imply. However, when a . (or ->) operator has a left operand that is
5194 (a pointer to) a structure with a flexible array member and the right operand names that
5195 member, it behaves as if that member were replaced with the longest array (with the same
5196 element type) that would not make the structure larger than the object being accessed; the
5197 offset of the array shall remain that of the flexible array member, even if this would differ
5198 from that of the replacement array. If this array would have no elements, it behaves as if
5199 it had one element but the behavior is undefined if any attempt is made to access that
5200 element or to generate a pointer one past it.
5202 EXAMPLE After the declaration:
5204 struct s { int n; double d[]; };</pre>
5205 the structure struct s has a flexible array member d. A typical way to use this is:
5207 int m = /* some value */;
5208 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));</pre>
5209 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
5210 p had been declared as:
5212 struct { int n; double d[m]; } *p;</pre>
5213 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
5216 Following the above declaration:
5217 <!--page 116 indent 5-->
5219 struct s t1 = { 0 }; // valid
5220 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
5222 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior</pre>
5223 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
5224 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
5226 sizeof (struct s) >= offsetof(struct s, d) + sizeof (double)</pre>
5227 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
5230 After the further declaration:
5232 struct ss { int n; };</pre>
5235 sizeof (struct s) >= sizeof (struct ss)
5236 sizeof (struct s) >= offsetof(struct s, d)</pre>
5237 are always equal to 1.
5239 If sizeof (double) is 8, then after the following code is executed:
5243 s1 = malloc(sizeof (struct s) + 64);
5244 s2 = malloc(sizeof (struct s) + 46);</pre>
5245 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
5246 purposes, as if the identifiers had been declared as:
5249 struct { int n; double d[8]; } *s1;
5250 struct { int n; double d[5]; } *s2;</pre>
5251 Following the further successful assignments:
5253 s1 = malloc(sizeof (struct s) + 10);
5254 s2 = malloc(sizeof (struct s) + 6);</pre>
5255 they then behave as if the declarations were:
5257 struct { int n; double d[1]; } *s1, *s2;</pre>
5262 dp = &(s1->d[0]); // valid
5264 dp = &(s2->d[0]); // valid
5265 *dp = 42; // undefined behavior</pre>
5269 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
5270 of the structure, they might be copied or simply overwritten with indeterminate values.
5272 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5273 <!--page 117 indent 4-->
5276 <p><a name="note105">105)</a> A structure or union can not contain a member with a variably modified type because member names
5277 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
5279 <p><a name="note106">106)</a> The unary & (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
5280 or arrays of bit-field objects.
5282 <p><a name="note107">107)</a> As specified in <a href="#6.7.2">6.7.2</a> above, if the actual type specifier used is int or a typedef-name defined as int,
5283 then it is implementation-defined whether the bit-field is signed or unsigned.
5285 <p><a name="note108">108)</a> An unnamed bit-field structure member is useful for padding to conform to externally imposed
5289 <a name="6.7.2.2" href="#6.7.2.2"><h5>6.7.2.2 Enumeration specifiers</h5></a>
5294 enum identifieropt { enumerator-list }
5295 enum identifieropt { enumerator-list , }
5299 enumerator-list , enumerator
5301 enumeration-constant
5302 enumeration-constant = constant-expression</pre>
5303 <h6>Constraints</h6>
5305 The expression that defines the value of an enumeration constant shall be an integer
5306 constant expression that has a value representable as an int.
5309 The identifiers in an enumerator list are declared as constants that have type int and
5310 may appear wherever such are permitted.<sup><a href="#note109"><b>109)</b></a></sup> An enumerator with = defines its
5311 enumeration constant as the value of the constant expression. If the first enumerator has
5312 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
5313 defines its enumeration constant as the value of the constant expression obtained by
5314 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
5315 = may produce enumeration constants with values that duplicate other values in the same
5316 enumeration.) The enumerators of an enumeration are also known as its members.
5318 Each enumerated type shall be compatible with char, a signed integer type, or an
5319 unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note110"><b>110)</b></a></sup> but shall be
5320 capable of representing the values of all the members of the enumeration. The
5321 enumerated type is incomplete until after the } that terminates the list of enumerator
5327 <!--page 118 indent 4-->
5329 EXAMPLE The following fragment:
5331 enum hue { chartreuse, burgundy, claret=20, winedark };
5335 if (*cp != burgundy)
5337 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
5338 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
5340 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5343 <p><a name="note109">109)</a> Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
5344 each other and from other identifiers declared in ordinary declarators.
5346 <p><a name="note110">110)</a> An implementation may delay the choice of which integer type until all enumeration constants have
5350 <a name="6.7.2.3" href="#6.7.2.3"><h5>6.7.2.3 Tags</h5></a>
5351 <h6>Constraints</h6>
5353 A specific type shall have its content defined at most once.
5355 Where two declarations that use the same tag declare the same type, they shall both use
5356 the same choice of struct, union, or enum.
5358 A type specifier of the form
5360 enum identifier</pre>
5361 without an enumerator list shall only appear after the type it specifies is complete.
5364 All declarations of structure, union, or enumerated types that have the same scope and
5365 use the same tag declare the same type. The type is incomplete<sup><a href="#note111"><b>111)</b></a></sup> until the closing brace
5366 of the list defining the content, and complete thereafter.
5368 Two declarations of structure, union, or enumerated types which are in different scopes or
5369 use different tags declare distinct types. Each declaration of a structure, union, or
5370 enumerated type which does not include a tag declares a distinct type.
5372 A type specifier of the form
5374 struct-or-union identifieropt { struct-declaration-list }</pre>
5377 enum identifier { enumerator-list }</pre>
5380 enum identifier { enumerator-list , }</pre>
5381 declares a structure, union, or enumerated type. The list defines the structure content,
5383 <!--page 119 indent 5-->
5384 union content, or enumeration content. If an identifier is provided,<sup><a href="#note112"><b>112)</b></a></sup> the type specifier
5385 also declares the identifier to be the tag of that type.
5387 A declaration of the form
5389 struct-or-union identifier ;</pre>
5390 specifies a structure or union type and declares the identifier as a tag of that type.<sup><a href="#note113"><b>113)</b></a></sup>
5392 If a type specifier of the form
5394 struct-or-union identifier</pre>
5395 occurs other than as part of one of the above forms, and no other declaration of the
5396 identifier as a tag is visible, then it declares an incomplete structure or union type, and
5397 declares the identifier as the tag of that type.113)
5399 If a type specifier of the form
5401 struct-or-union identifier</pre>
5404 enum identifier</pre>
5405 occurs other than as part of one of the above forms, and a declaration of the identifier as a
5406 tag is visible, then it specifies the same type as that other declaration, and does not
5409 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
5413 struct tnode *left, *right;
5415 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
5416 declaration has been given, the declaration
5418 struct tnode s, *sp;</pre>
5419 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
5420 these declarations, the expression sp->left refers to the left struct tnode pointer of the object to
5421 which sp points; the expression s.right->count designates the count member of the right struct
5422 tnode pointed to from s.
5424 The following alternative formulation uses the typedef mechanism:
5429 <!--page 120 indent 5-->
5431 typedef struct tnode TNODE;
5434 TNODE *left, *right;
5439 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
5440 structures, the declarations
5442 struct s1 { struct s2 *s2p; /* ... */ }; // D1
5443 struct s2 { struct s1 *s1p; /* ... */ }; // D2</pre>
5444 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
5445 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
5446 D2. To eliminate this context sensitivity, the declaration
5449 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
5450 completes the specification of the new type.
5452 Forward references: declarators (<a href="#6.7.5">6.7.5</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions
5453 (<a href="#6.7.7">6.7.7</a>).
5456 <p><a name="note111">111)</a> An incomplete type may only by used when the size of an object of that type is not needed. It is not
5457 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
5458 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
5459 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
5461 <p><a name="note112">112)</a> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
5462 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
5463 can make use of that typedef name to declare objects having the specified structure, union, or
5466 <p><a name="note113">113)</a> A similar construction with enum does not exist.
5469 <a name="6.7.3" href="#6.7.3"><h4>6.7.3 Type qualifiers</h4></a>
5477 <h6>Constraints</h6>
5479 Types other than pointer types derived from object or incomplete types shall not be
5483 The properties associated with qualified types are meaningful only for expressions that
5484 are lvalues.<sup><a href="#note114"><b>114)</b></a></sup>
5486 If the same qualifier appears more than once in the same specifier-qualifier-list, either
5487 directly or via one or more typedefs, the behavior is the same as if it appeared only
5493 <!--page 121 indent 5-->
5495 If an attempt is made to modify an object defined with a const-qualified type through use
5496 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
5497 made to refer to an object defined with a volatile-qualified type through use of an lvalue
5498 with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note115"><b>115)</b></a></sup>
5500 An object that has volatile-qualified type may be modified in ways unknown to the
5501 implementation or have other unknown side effects. Therefore any expression referring
5502 to such an object shall be evaluated strictly according to the rules of the abstract machine,
5503 as described in <a href="#5.1.2.3">5.1.2.3</a>. Furthermore, at every sequence point the value last stored in the
5504 object shall agree with that prescribed by the abstract machine, except as modified by the
5505 unknown factors mentioned previously.<sup><a href="#note116"><b>116)</b></a></sup> What constitutes an access to an object that
5506 has volatile-qualified type is implementation-defined.
5508 An object that is accessed through a restrict-qualified pointer has a special association
5509 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
5510 that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note117"><b>117)</b></a></sup> The intended
5511 use of the restrict qualifier (like the register storage class) is to promote
5512 optimization, and deleting all instances of the qualifier from all preprocessing translation
5513 units composing a conforming program does not change its meaning (i.e., observable
5516 If the specification of an array type includes any type qualifiers, the element type is so-
5517 qualified, not the array type. If the specification of a function type includes any type
5518 qualifiers, the behavior is undefined.<sup><a href="#note118"><b>118)</b></a></sup>
5520 For two qualified types to be compatible, both shall have the identically qualified version
5521 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
5522 does not affect the specified type.
5524 EXAMPLE 1 An object declared
5526 extern const volatile int real_time_clock;</pre>
5527 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
5532 <!--page 122 indent 5-->
5534 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
5535 modify an aggregate type:
5537 const struct s { int mem; } cs = { 1 };
5538 struct s ncs; // the object ncs is modifiable
5539 typedef int A[2][3];
5540 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
5544 cs = ncs; // violates modifiable lvalue constraint for =
5545 pi = &ncs.mem; // valid
5546 pi = &cs.mem; // violates type constraints for =
5547 pci = &cs.mem; // valid
5548 pi = a[0]; // invalid: a[0] has type ''const int *''</pre>
5552 <p><a name="note114">114)</a> The implementation may place a const object that is not volatile in a read-only region of
5553 storage. Moreover, the implementation need not allocate storage for such an object if its address is
5556 <p><a name="note115">115)</a> This applies to those objects that behave as if they were defined with qualified types, even if they are
5557 never actually defined as objects in the program (such as an object at a memory-mapped input/output
5560 <p><a name="note116">116)</a> A volatile declaration may be used to describe an object corresponding to a memory-mapped
5561 input/output port or an object accessed by an asynchronously interrupting function. Actions on
5562 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
5563 permitted by the rules for evaluating expressions.
5565 <p><a name="note117">117)</a> For example, a statement that assigns a value returned by malloc to a single pointer establishes this
5566 association between the allocated object and the pointer.
5568 <p><a name="note118">118)</a> Both of these can occur through the use of typedefs.
5571 <a name="6.7.3.1" href="#6.7.3.1"><h5>6.7.3.1 Formal definition of restrict</h5></a>
5573 Let D be a declaration of an ordinary identifier that provides a means of designating an
5574 object P as a restrict-qualified pointer to type T.
5576 If D appears inside a block and does not have storage class extern, let B denote the
5577 block. If D appears in the list of parameter declarations of a function definition, let B
5578 denote the associated block. Otherwise, let B denote the block of main (or the block of
5579 whatever function is called at program startup in a freestanding environment).
5581 In what follows, a pointer expression E is said to be based on object P if (at some
5582 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
5583 a copy of the array object into which it formerly pointed would change the value of E.<sup><a href="#note119"><b>119)</b></a></sup>
5584 Note that ''based'' is defined only for expressions with pointer types.
5586 During each execution of B, let L be any lvalue that has &L based on P. If L is used to
5587 access the value of the object X that it designates, and X is also modified (by any means),
5588 then the following requirements apply: T shall not be const-qualified. Every other lvalue
5589 used to access the value of X shall also have its address based on P. Every access that
5590 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
5591 is assigned the value of a pointer expression E that is based on another restricted pointer
5592 object P2, associated with block B2, then either the execution of B2 shall begin before
5593 the execution of B, or the execution of B2 shall end prior to the assignment. If these
5594 requirements are not met, then the behavior is undefined.
5596 Here an execution of B means that portion of the execution of the program that would
5597 correspond to the lifetime of an object with scalar type and automatic storage duration
5599 <!--page 123 indent 5-->
5602 A translator is free to ignore any or all aliasing implications of uses of restrict.
5604 EXAMPLE 1 The file scope declarations
5608 extern int c[];</pre>
5609 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
5610 program, then it is never accessed using either of the other two.
5613 EXAMPLE 2 The function parameter declarations in the following example
5615 void f(int n, int * restrict p, int * restrict q)
5620 assert that, during each execution of the function, if an object is accessed through one of the pointer
5621 parameters, then it is not also accessed through the other.
5623 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
5624 analysis of function f without examining any of the calls of f in the program. The cost is that the
5625 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
5626 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
5632 f(50, d + 50, d); // valid
5633 f(50, d + 1, d); // undefined behavior
5637 EXAMPLE 3 The function parameter declarations
5639 void h(int n, int * restrict p, int * restrict q, int * restrict r)
5642 for (i = 0; i < n; i++)
5645 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
5646 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
5647 modified within function h.
5650 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
5651 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
5652 between restricted pointers declared in nested blocks have defined behavior.
5653 <!--page 124 indent 5-->
5659 p1 = q1; // undefined behavior
5661 int * restrict p2 = p1; // valid
5662 int * restrict q2 = q1; // valid
5663 p1 = q2; // undefined behavior
5664 p2 = q2; // undefined behavior
5667 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
5668 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
5669 example, this permits new_vector to return a vector.
5671 typedef struct { int n; float * restrict v; } vector;
5672 vector new_vector(int n)
5676 t.v = malloc(n * sizeof (float));
5682 <p><a name="note119">119)</a> In other words, E depends on the value of P itself rather than on the value of an object referenced
5683 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
5684 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
5685 expressions *p and p[1] are not.
5688 <a name="6.7.4" href="#6.7.4"><h4>6.7.4 Function specifiers</h4></a>
5694 <h6>Constraints</h6>
5696 Function specifiers shall be used only in the declaration of an identifier for a function.
5698 An inline definition of a function with external linkage shall not contain a definition of a
5699 modifiable object with static storage duration, and shall not contain a reference to an
5700 identifier with internal linkage.
5702 In a hosted environment, the inline function specifier shall not appear in a declaration
5706 A function declared with an inline function specifier is an inline function. The
5707 function specifier may appear more than once; the behavior is the same as if it appeared
5708 only once. Making a function an inline function suggests that calls to the function be as
5709 fast as possible.<sup><a href="#note120"><b>120)</b></a></sup> The extent to which such suggestions are effective is
5710 implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
5712 Any function with internal linkage can be an inline function. For a function with external
5713 linkage, the following restrictions apply: If a function is declared with an inline
5714 <!--page 125 indent 4-->
5715 function specifier, then it shall also be defined in the same translation unit. If all of the
5716 file scope declarations for a function in a translation unit include the inline function
5717 specifier without extern, then the definition in that translation unit is an inline
5718 definition. An inline definition does not provide an external definition for the function,
5719 and does not forbid an external definition in another translation unit. An inline definition
5720 provides an alternative to an external definition, which a translator may use to implement
5721 any call to the function in the same translation unit. It is unspecified whether a call to the
5722 function uses the inline definition or the external definition.<sup><a href="#note122"><b>122)</b></a></sup>
5724 EXAMPLE The declaration of an inline function with external linkage can result in either an external
5725 definition, or a definition available for use only within the translation unit. A file scope declaration with
5726 extern creates an external definition. The following example shows an entire translation unit.
5729 inline double fahr(double t)
5731 return (9.0 * t) / 5.0 + 32.0;
5733 inline double cels(double t)
5735 return (5.0 * (t - 32.0)) / 9.0;
5737 extern double fahr(double); // creates an external definition
5738 double convert(int is_fahr, double temp)
5740 /* A translator may perform inline substitutions */
5741 return is_fahr ? cels(temp) : fahr(temp);
5743 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
5744 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
5745 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
5746 definition are distinct and either may be used for the call.
5748 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
5751 <!--page 126 indent 4-->
5754 <p><a name="note120">120)</a> By using, for example, an alternative to the usual function call mechanism, such as ''inline
5755 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
5756 Therefore, for example, the expansion of a macro used within the body of the function uses the
5757 definition it had at the point the function body appears, and not where the function is called; and
5758 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
5759 single address, regardless of the number of inline definitions that occur in addition to the external
5762 <p><a name="note121">121)</a> For example, an implementation might never perform inline substitution, or might only perform inline
5763 substitutions to calls in the scope of an inline declaration.
5765 <p><a name="note122">122)</a> Since an inline definition is distinct from the corresponding external definition and from any other
5766 corresponding inline definitions in other translation units, all corresponding objects with static storage
5767 duration are also distinct in each of the definitions.
5770 <a name="6.7.5" href="#6.7.5"><h4>6.7.5 Declarators</h4></a>
5775 pointeropt direct-declarator
5779 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
5780 direct-declarator [ static type-qualifier-listopt assignment-expression ]
5781 direct-declarator [ type-qualifier-list static assignment-expression ]
5782 direct-declarator [ type-qualifier-listopt * ]
5783 direct-declarator ( parameter-type-list )
5784 direct-declarator ( identifier-listopt )
5786 * type-qualifier-listopt
5787 * type-qualifier-listopt pointer
5788 type-qualifier-list:
5790 type-qualifier-list type-qualifier
5791 parameter-type-list:
5793 parameter-list , ...
5795 parameter-declaration
5796 parameter-list , parameter-declaration
5797 parameter-declaration:
5798 declaration-specifiers declarator
5799 declaration-specifiers abstract-declaratoropt
5802 identifier-list , identifier</pre>
5805 Each declarator declares one identifier, and asserts that when an operand of the same
5806 form as the declarator appears in an expression, it designates a function or object with the
5807 scope, storage duration, and type indicated by the declaration specifiers.
5809 A full declarator is a declarator that is not part of another declarator. The end of a full
5810 declarator is a sequence point. If, in the nested sequence of declarators in a full
5811 <!--page 127 indent 4-->
5812 declarator, there is a declarator specifying a variable length array type, the type specified
5813 by the full declarator is said to be variably modified. Furthermore, any type derived by
5814 declarator type derivation from a variably modified type is itself variably modified.
5816 In the following subclauses, consider a declaration
5819 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
5820 a declarator that contains an identifier ident. The type specified for the identifier ident in
5821 the various forms of declarator is described inductively using this notation.
5823 If, in the declaration ''T D1'', D1 has the form
5826 then the type specified for ident is T .
5828 If, in the declaration ''T D1'', D1 has the form
5831 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
5832 parentheses is identical to the unparenthesized declarator, but the binding of complicated
5833 declarators may be altered by parentheses.
5834 Implementation limits
5836 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
5837 function declarators that modify an arithmetic, structure, union, or incomplete type, either
5838 directly or via one or more typedefs.
5839 Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
5841 <a name="6.7.5.1" href="#6.7.5.1"><h5>6.7.5.1 Pointer declarators</h5></a>
5844 If, in the declaration ''T D1'', D1 has the form
5846 * type-qualifier-listopt D</pre>
5847 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5848 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
5849 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
5851 For two pointer types to be compatible, both shall be identically qualified and both shall
5852 be pointers to compatible types.
5854 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
5855 to a constant value'' and a ''constant pointer to a variable value''.
5856 <!--page 128 indent 4-->
5858 const int *ptr_to_constant;
5859 int *const constant_ptr;</pre>
5860 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
5861 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
5862 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
5865 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
5866 type ''pointer to int''.
5868 typedef int *int_ptr;
5869 const int_ptr constant_ptr;</pre>
5870 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
5873 <a name="6.7.5.2" href="#6.7.5.2"><h5>6.7.5.2 Array declarators</h5></a>
5874 <h6>Constraints</h6>
5876 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
5877 an expression or *. If they delimit an expression (which specifies the size of an array), the
5878 expression shall have an integer type. If the expression is a constant expression, it shall
5879 have a value greater than zero. The element type shall not be an incomplete or function
5880 type. The optional type qualifiers and the keyword static shall appear only in a
5881 declaration of a function parameter with an array type, and then only in the outermost
5882 array type derivation.
5884 An ordinary identifier (as defined in <a href="#6.2.3">6.2.3</a>) that has a variably modified type shall have
5885 either block scope and no linkage or function prototype scope. If an identifier is declared
5886 to be an object with static storage duration, it shall not have a variable length array type.
5889 If, in the declaration ''T D1'', D1 has one of the forms:
5891 D[ type-qualifier-listopt assignment-expressionopt ]
5892 D[ static type-qualifier-listopt assignment-expression ]
5893 D[ type-qualifier-list static assignment-expression ]
5894 D[ type-qualifier-listopt * ]</pre>
5895 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5896 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note123"><b>123)</b></a></sup>
5897 (See <a href="#6.7.5.3">6.7.5.3</a> for the meaning of the optional type qualifiers and the keyword static.)
5899 If the size is not present, the array type is an incomplete type. If the size is * instead of
5900 being an expression, the array type is a variable length array type of unspecified size,
5901 which can only be used in declarations with function prototype scope;<sup><a href="#note124"><b>124)</b></a></sup> such arrays are
5902 nonetheless complete types. If the size is an integer constant expression and the element
5904 <!--page 129 indent 4-->
5905 type has a known constant size, the array type is not a variable length array type;
5906 otherwise, the array type is a variable length array type.
5908 If the size is an expression that is not an integer constant expression: if it occurs in a
5909 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
5910 each time it is evaluated it shall have a value greater than zero. The size of each instance
5911 of a variable length array type does not change during its lifetime. Where a size
5912 expression is part of the operand of a sizeof operator and changing the value of the
5913 size expression would not affect the result of the operator, it is unspecified whether or not
5914 the size expression is evaluated.
5916 For two array types to be compatible, both shall have compatible element types, and if
5917 both size specifiers are present, and are integer constant expressions, then both size
5918 specifiers shall have the same constant value. If the two array types are used in a context
5919 which requires them to be compatible, it is undefined behavior if the two size specifiers
5920 evaluate to unequal values.
5924 float fa[11], *afp[17];</pre>
5925 declares an array of float numbers and an array of pointers to float numbers.
5928 EXAMPLE 2 Note the distinction between the declarations
5931 extern int y[];</pre>
5932 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
5933 (an incomplete type), the storage for which is defined elsewhere.
5936 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
5945 int (*r)[n][n][n+1];
5946 p = a; // invalid: not compatible because 4 != 6
5947 r = c; // compatible, but defined behavior only if
5948 // n == 6 and m == n+1
5954 <!--page 130 indent 5-->
5956 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
5957 function prototype scope. Array objects declared with the static or extern storage-class specifier
5958 cannot have a variable length array (VLA) type. However, an object declared with the static storage-
5959 class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all identifiers declared with a
5960 VM type have to be ordinary identifiers and cannot, therefore, be members of structures or unions.
5963 int A[n]; // invalid: file scope VLA
5964 extern int (*p2)[n]; // invalid: file scope VM
5965 int B[100]; // valid: file scope but not VM
5966 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
5967 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
5969 typedef int VLA[m][m]; // valid: block scope typedef VLA
5971 int (*y)[n]; // invalid: y not ordinary identifier
5972 int z[n]; // invalid: z not ordinary identifier
5974 int D[m]; // valid: auto VLA
5975 static int E[m]; // invalid: static block scope VLA
5976 extern int F[m]; // invalid: F has linkage and is VLA
5977 int (*s)[m]; // valid: auto pointer to VLA
5978 extern int (*r)[m]; // invalid: r has linkage and points to VLA
5979 static int (*q)[m] = &B; // valid: q is a static block pointer to VLA
5982 Forward references: function declarators (<a href="#6.7.5.3">6.7.5.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
5983 initialization (<a href="#6.7.8">6.7.8</a>).
5986 <p><a name="note123">123)</a> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
5988 <p><a name="note124">124)</a> Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.5.3">6.7.5.3</a>).
5991 <a name="6.7.5.3" href="#6.7.5.3"><h5>6.7.5.3 Function declarators (including prototypes)</h5></a>
5992 <h6>Constraints</h6>
5994 A function declarator shall not specify a return type that is a function type or an array
5997 The only storage-class specifier that shall occur in a parameter declaration is register.
5999 An identifier list in a function declarator that is not part of a definition of that function
6002 After adjustment, the parameters in a parameter type list in a function declarator that is
6003 part of a definition of that function shall not have incomplete type.
6006 If, in the declaration ''T D1'', D1 has the form
6008 D( parameter-type-list )</pre>
6010 <!--page 131 indent 5-->
6012 D( identifier-listopt )</pre>
6013 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6014 T '', then the type specified for ident is ''derived-declarator-type-list function returning
6017 A parameter type list specifies the types of, and may declare identifiers for, the
6018 parameters of the function.
6020 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
6021 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
6022 array type derivation. If the keyword static also appears within the [ and ] of the
6023 array type derivation, then for each call to the function, the value of the corresponding
6024 actual argument shall provide access to the first element of an array with at least as many
6025 elements as specified by the size expression.
6027 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
6028 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
6030 If the list terminates with an ellipsis (, ...), no information about the number or types
6031 of the parameters after the comma is supplied.<sup><a href="#note125"><b>125)</b></a></sup>
6033 The special case of an unnamed parameter of type void as the only item in the list
6034 specifies that the function has no parameters.
6036 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
6037 parameter name, it shall be taken as a typedef name.
6039 If the function declarator is not part of a definition of that function, parameters may have
6040 incomplete type and may use the [*] notation in their sequences of declarator specifiers
6041 to specify variable length array types.
6043 The storage-class specifier in the declaration specifiers for a parameter declaration, if
6044 present, is ignored unless the declared parameter is one of the members of the parameter
6045 type list for a function definition.
6047 An identifier list declares only the identifiers of the parameters of the function. An empty
6048 list in a function declarator that is part of a definition of that function specifies that the
6049 function has no parameters. The empty list in a function declarator that is not part of a
6050 definition of that function specifies that no information about the number or types of the
6051 parameters is supplied.<sup><a href="#note126"><b>126)</b></a></sup>
6053 For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note127"><b>127)</b></a></sup>
6056 <!--page 132 indent 5-->
6057 Moreover, the parameter type lists, if both are present, shall agree in the number of
6058 parameters and in use of the ellipsis terminator; corresponding parameters shall have
6059 compatible types. If one type has a parameter type list and the other type is specified by a
6060 function declarator that is not part of a function definition and that contains an empty
6061 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
6062 parameter shall be compatible with the type that results from the application of the
6063 default argument promotions. If one type has a parameter type list and the other type is
6064 specified by a function definition that contains a (possibly empty) identifier list, both shall
6065 agree in the number of parameters, and the type of each prototype parameter shall be
6066 compatible with the type that results from the application of the default argument
6067 promotions to the type of the corresponding identifier. (In the determination of type
6068 compatibility and of a composite type, each parameter declared with function or array
6069 type is taken as having the adjusted type and each parameter declared with qualified type
6070 is taken as having the unqualified version of its declared type.)
6072 EXAMPLE 1 The declaration
6074 int f(void), *fip(), (*pfi)();</pre>
6075 declares a function f with no parameters returning an int, a function fip with no parameter specification
6076 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
6077 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
6078 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
6079 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
6080 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
6081 designator, which is then used to call the function; it returns an int.
6083 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
6084 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
6085 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
6086 the identifier of the pointer pfi has block scope and no linkage.
6089 EXAMPLE 2 The declaration
6091 int (*apfi[3])(int *x, int *y);</pre>
6092 declares an array apfi of three pointers to functions returning int. Each of these functions has two
6093 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
6094 go out of scope at the end of the declaration of apfi.
6097 EXAMPLE 3 The declaration
6099 int (*fpfi(int (*)(long), int))(int, ...);</pre>
6100 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
6101 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
6102 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
6103 additional arguments of any type.
6104 <!--page 133 indent 5-->
6106 EXAMPLE 4 The following prototype has a variably modified parameter.
6108 void addscalar(int n, int m,
6109 double a[n][n*m+300], double x);
6113 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
6116 void addscalar(int n, int m,
6117 double a[n][n*m+300], double x)
6119 for (int i = 0; i < n; i++)
6120 for (int j = 0, k = n*m+300; j < k; j++)
6121 // a is a pointer to a VLA with n*m+300 elements
6126 EXAMPLE 5 The following are all compatible function prototype declarators.
6128 double maximum(int n, int m, double a[n][m]);
6129 double maximum(int n, int m, double a[*][*]);
6130 double maximum(int n, int m, double a[ ][*]);
6131 double maximum(int n, int m, double a[ ][m]);</pre>
6134 void f(double (* restrict a)[5]);
6135 void f(double a[restrict][5]);
6136 void f(double a[restrict 3][5]);
6137 void f(double a[restrict static 3][5]);</pre>
6138 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
6139 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
6141 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
6142 <!--page 134 indent 4-->
6145 <p><a name="note125">125)</a> The macros defined in the <stdarg.h> header (<a href="#7.15">7.15</a>) may be used to access arguments that
6146 correspond to the ellipsis.
6148 <p><a name="note126">126)</a> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
6150 <p><a name="note127">127)</a> If both function types are ''old style'', parameter types are not compared.
6153 <a name="6.7.6" href="#6.7.6"><h4>6.7.6 Type names</h4></a>
6158 specifier-qualifier-list abstract-declaratoropt
6159 abstract-declarator:
6161 pointeropt direct-abstract-declarator
6162 direct-abstract-declarator:
6163 ( abstract-declarator )
6164 direct-abstract-declaratoropt [ type-qualifier-listopt
6165 assignment-expressionopt ]
6166 direct-abstract-declaratoropt [ static type-qualifier-listopt
6167 assignment-expression ]
6168 direct-abstract-declaratoropt [ type-qualifier-list static
6169 assignment-expression ]
6170 direct-abstract-declaratoropt [ * ]
6171 direct-abstract-declaratoropt ( parameter-type-listopt )</pre>
6174 In several contexts, it is necessary to specify a type. This is accomplished using a type
6175 name, which is syntactically a declaration for a function or an object of that type that
6176 omits the identifier.<sup><a href="#note128"><b>128)</b></a></sup>
6178 EXAMPLE The constructions
6187 (h) int (*const [])(unsigned int, ...)</pre>
6188 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
6189 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
6190 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
6191 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
6192 parameter that has type unsigned int and an unspecified number of other parameters, returning an
6198 <!--page 135 indent 4-->
6201 <p><a name="note128">128)</a> As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
6202 parameter specification'', rather than redundant parentheses around the omitted identifier.
6205 <a name="6.7.7" href="#6.7.7"><h4>6.7.7 Type definitions</h4></a>
6211 <h6>Constraints</h6>
6213 If a typedef name specifies a variably modified type then it shall have block scope.
6216 In a declaration whose storage-class specifier is typedef, each declarator defines an
6217 identifier to be a typedef name that denotes the type specified for the identifier in the way
6218 described in <a href="#6.7.5">6.7.5</a>. Any array size expressions associated with variable length array
6219 declarators are evaluated each time the declaration of the typedef name is reached in the
6220 order of execution. A typedef declaration does not introduce a new type, only a
6221 synonym for the type so specified. That is, in the following declarations:
6223 typedef T type_ident;
6225 type_ident is defined as a typedef name with the type specified by the declaration
6226 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
6227 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
6228 typedef name shares the same name space as other identifiers declared in ordinary
6233 typedef int MILES, KLICKSP();
6234 typedef struct { double hi, lo; } range;</pre>
6238 extern KLICKSP *metricp;
6241 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
6242 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
6243 such a structure. The object distance has a type compatible with any other int object.
6246 EXAMPLE 2 After the declarations
6248 typedef struct s1 { int x; } t1, *tp1;
6249 typedef struct s2 { int x; } t2, *tp2;</pre>
6250 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
6251 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
6252 <!--page 136 indent 4-->
6254 EXAMPLE 3 The following obscure constructions
6256 typedef signed int t;
6263 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
6264 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
6265 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
6266 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
6267 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
6268 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
6269 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
6270 in an inner scope by
6274 then a function f is declared with type ''function returning signed int with one unnamed parameter
6275 with type pointer to function returning signed int with one unnamed parameter with type signed
6276 int'', and an identifier t with type long int.
6279 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
6280 following declarations of the signal function specify exactly the same type, the first without making use
6281 of any typedef names.
6283 typedef void fv(int), (*pfv)(int);
6284 void (*signal(int, void (*)(int)))(int);
6285 fv *signal(int, fv *);
6286 pfv signal(int, pfv);</pre>
6289 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
6290 time the typedef name is defined, not each time it is used:
6291 <!--page 137 indent 4-->
6295 typedef int B[n]; // B is n ints, n evaluated now
6297 B a; // a is n ints, n without += 1
6298 int b[n]; // a and b are different sizes
6299 for (int i = 1; i < n; i++)
6303 <a name="6.7.8" href="#6.7.8"><h4>6.7.8 Initialization</h4></a>
6308 assignment-expression
6309 { initializer-list }
6310 { initializer-list , }
6312 designationopt initializer
6313 initializer-list , designationopt initializer
6318 designator-list designator
6320 [ constant-expression ]
6322 <h6>Constraints</h6>
6324 No initializer shall attempt to provide a value for an object not contained within the entity
6327 The type of the entity to be initialized shall be an array of unknown size or an object type
6328 that is not a variable length array type.
6330 All the expressions in an initializer for an object that has static storage duration shall be
6331 constant expressions or string literals.
6333 If the declaration of an identifier has block scope, and the identifier has external or
6334 internal linkage, the declaration shall have no initializer for the identifier.
6336 If a designator has the form
6338 [ constant-expression ]</pre>
6339 then the current object (defined below) shall have array type and the expression shall be
6340 an integer constant expression. If the array is of unknown size, any nonnegative value is
6343 If a designator has the form
6346 then the current object (defined below) shall have structure or union type and the
6347 identifier shall be the name of a member of that type.
6348 <!--page 138 indent 5-->
6351 An initializer specifies the initial value stored in an object.
6353 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
6354 members of objects of structure and union type do not participate in initialization.
6355 Unnamed members of structure objects have indeterminate value even after initialization.
6357 If an object that has automatic storage duration is not initialized explicitly, its value is
6358 indeterminate. If an object that has static storage duration is not initialized explicitly,
6361 <li> if it has pointer type, it is initialized to a null pointer;
6362 <li> if it has arithmetic type, it is initialized to (positive or unsigned) zero;
6363 <li> if it is an aggregate, every member is initialized (recursively) according to these rules;
6364 <li> if it is a union, the first named member is initialized (recursively) according to these
6368 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
6369 initial value of the object is that of the expression (after conversion); the same type
6370 constraints and conversions as for simple assignment apply, taking the type of the scalar
6371 to be the unqualified version of its declared type.
6373 The rest of this subclause deals with initializers for objects that have aggregate or union
6376 The initializer for a structure or union object that has automatic storage duration shall be
6377 either an initializer list as described below, or a single expression that has compatible
6378 structure or union type. In the latter case, the initial value of the object, including
6379 unnamed members, is that of the expression.
6381 An array of character type may be initialized by a character string literal, optionally
6382 enclosed in braces. Successive characters of the character string literal (including the
6383 terminating null character if there is room or if the array is of unknown size) initialize the
6384 elements of the array.
6386 An array with element type compatible with wchar_t may be initialized by a wide
6387 string literal, optionally enclosed in braces. Successive wide characters of the wide string
6388 literal (including the terminating null wide character if there is room or if the array is of
6389 unknown size) initialize the elements of the array.
6391 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
6392 enclosed list of initializers for the elements or named members.
6394 Each brace-enclosed initializer list has an associated current object. When no
6395 designations are present, subobjects of the current object are initialized in order according
6396 to the type of the current object: array elements in increasing subscript order, structure
6397 <!--page 139 indent 5-->
6398 members in declaration order, and the first named member of a union.<sup><a href="#note129"><b>129)</b></a></sup> In contrast, a
6399 designation causes the following initializer to begin initialization of the subobject
6400 described by the designator. Initialization then continues forward in order, beginning
6401 with the next subobject after that described by the designator.<sup><a href="#note130"><b>130)</b></a></sup>
6403 Each designator list begins its description with the current object associated with the
6404 closest surrounding brace pair. Each item in the designator list (in order) specifies a
6405 particular member of its current object and changes the current object for the next
6406 designator (if any) to be that member.<sup><a href="#note131"><b>131)</b></a></sup> The current object that results at the end of the
6407 designator list is the subobject to be initialized by the following initializer.
6409 The initialization shall occur in initializer list order, each initializer provided for a
6410 particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note132"><b>132)</b></a></sup>
6411 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
6412 objects that have static storage duration.
6414 If the aggregate or union contains elements or members that are aggregates or unions,
6415 these rules apply recursively to the subaggregates or contained unions. If the initializer of
6416 a subaggregate or contained union begins with a left brace, the initializers enclosed by
6417 that brace and its matching right brace initialize the elements or members of the
6418 subaggregate or the contained union. Otherwise, only enough initializers from the list are
6419 taken to account for the elements or members of the subaggregate or the first member of
6420 the contained union; any remaining initializers are left to initialize the next element or
6421 member of the aggregate of which the current subaggregate or contained union is a part.
6423 If there are fewer initializers in a brace-enclosed list than there are elements or members
6424 of an aggregate, or fewer characters in a string literal used to initialize an array of known
6425 size than there are elements in the array, the remainder of the aggregate shall be
6426 initialized implicitly the same as objects that have static storage duration.
6428 If an array of unknown size is initialized, its size is determined by the largest indexed
6429 element with an explicit initializer. At the end of its initializer list, the array no longer
6430 has incomplete type.
6434 <!--page 140 indent 5-->
6436 The order in which any side effects occur among the initialization list expressions is
6437 unspecified.<sup><a href="#note133"><b>133)</b></a></sup>
6439 EXAMPLE 1 Provided that <complex.h> has been #included, the declarations
6441 int i = <a href="#3.5">3.5</a>;
6442 double complex c = 5 + 3 * I;</pre>
6443 define and initialize i with the value 3 and c with the value 5.0 + i3.0.
6446 EXAMPLE 2 The declaration
6448 int x[] = { 1, 3, 5 };</pre>
6449 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
6450 and there are three initializers.
6453 EXAMPLE 3 The declaration
6460 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
6461 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
6462 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
6466 1, 3, 5, 2, 4, 6, 3, 5, 7
6468 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
6469 next three are taken successively for y[1] and y[2].
6472 EXAMPLE 4 The declaration
6475 { 1 }, { 2 }, { 3 }, { 4 }
6477 initializes the first column of z as specified and initializes the rest with zeros.
6480 EXAMPLE 5 The declaration
6482 struct { int a[3], b; } w[] = { { 1 }, 2 };</pre>
6483 is a definition with an inconsistently bracketed initialization. It defines an array with two element
6484 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
6489 <!--page 141 indent 5-->
6491 EXAMPLE 6 The declaration
6493 short q[4][3][2] = {
6498 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
6499 object: q[0][0][0] is 1, q[1][0][0] is 2, q[1][0][1] is 3, and 4, 5, and 6 initialize
6500 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
6501 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
6502 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
6503 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
6504 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
6505 diagnostic message would have been issued. The same initialization result could have been achieved by:
6507 short q[4][3][2] = {
6514 short q[4][3][2] = {
6526 in a fully bracketed form.
6528 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
6532 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
6535 typedef int A[]; // OK - declared with block scope</pre>
6538 A a = { 1, 2 }, b = { 3, 4, 5 };</pre>
6541 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };</pre>
6542 due to the rules for incomplete types.
6543 <!--page 142 indent 5-->
6545 EXAMPLE 8 The declaration
6547 char s[] = "abc", t[3] = "abc";</pre>
6548 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
6549 This declaration is identical to
6551 char s[] = { 'a', 'b', 'c', '\0' },
6552 t[] = { 'a', 'b', 'c' };</pre>
6553 The contents of the arrays are modifiable. On the other hand, the declaration
6555 char *p = "abc";</pre>
6556 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
6557 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
6558 modify the contents of the array, the behavior is undefined.
6561 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
6564 enum { member_one, member_two };
6565 const char *nm[] = {
6566 [member_two] = "member two",
6567 [member_one] = "member one",
6571 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
6573 div_t answer = { .quot = 2, .rem = -1 };</pre>
6576 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
6577 might be misunderstood:
6579 struct { int a[3], b; } w[] =
6580 { [0].a = {1}, [1].a[0] = 2 };</pre>
6583 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
6587 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
6589 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
6590 than ten, some of the values provided by the first five initializers will be overridden by the second five.
6593 EXAMPLE 13 Any member of a union can be initialized:
6595 union { /* ... */ } u = { .any_member = 42 };</pre>
6597 Forward references: common definitions <stddef.h> (<a href="#7.17">7.17</a>).
6598 <!--page 143 indent 4-->
6601 <p><a name="note129">129)</a> If the initializer list for a subaggregate or contained union does not begin with a left brace, its
6602 subobjects are initialized as usual, but the subaggregate or contained union does not become the
6603 current object: current objects are associated only with brace-enclosed initializer lists.
6605 <p><a name="note130">130)</a> After a union member is initialized, the next object is not the next member of the union; instead, it is
6606 the next subobject of an object containing the union.
6608 <p><a name="note131">131)</a> Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
6609 the surrounding brace pair. Note, too, that each separate designator list is independent.
6611 <p><a name="note132">132)</a> Any initializer for the subobject which is overridden and so not used to initialize that subobject might
6612 not be evaluated at all.
6614 <p><a name="note133">133)</a> In particular, the evaluation order need not be the same as the order of subobject initialization.
6617 <a name="6.8" href="#6.8"><h3>6.8 Statements and blocks</h3></a>
6624 expression-statement
6627 jump-statement</pre>
6630 A statement specifies an action to be performed. Except as indicated, statements are
6631 executed in sequence.
6633 A block allows a set of declarations and statements to be grouped into one syntactic unit.
6634 The initializers of objects that have automatic storage duration, and the variable length
6635 array declarators of ordinary identifiers with block scope, are evaluated and the values are
6636 stored in the objects (including storing an indeterminate value in objects without an
6637 initializer) each time the declaration is reached in the order of execution, as if it were a
6638 statement, and within each declaration in the order that declarators appear.
6640 A full expression is an expression that is not part of another expression or of a declarator.
6641 Each of the following is a full expression: an initializer; the expression in an expression
6642 statement; the controlling expression of a selection statement (if or switch); the
6643 controlling expression of a while or do statement; each of the (optional) expressions of
6644 a for statement; the (optional) expression in a return statement. The end of a full
6645 expression is a sequence point.
6646 Forward references: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
6647 (<a href="#6.8.4">6.8.4</a>), iteration statements (<a href="#6.8.5">6.8.5</a>), the return statement (<a href="#6.8.6.4">6.8.6.4</a>).
6649 <a name="6.8.1" href="#6.8.1"><h4>6.8.1 Labeled statements</h4></a>
6654 identifier : statement
6655 case constant-expression : statement
6656 default : statement</pre>
6657 <h6>Constraints</h6>
6659 A case or default label shall appear only in a switch statement. Further
6660 constraints on such labels are discussed under the switch statement.
6661 <!--page 144 indent 4-->
6663 Label names shall be unique within a function.
6666 Any statement may be preceded by a prefix that declares an identifier as a label name.
6667 Labels in themselves do not alter the flow of control, which continues unimpeded across
6669 Forward references: the goto statement (<a href="#6.8.6.1">6.8.6.1</a>), the switch statement (<a href="#6.8.4.2">6.8.4.2</a>).
6671 <a name="6.8.2" href="#6.8.2"><h4>6.8.2 Compound statement</h4></a>
6676 { block-item-listopt }
6679 block-item-list block-item
6685 A compound statement is a block.
6687 <a name="6.8.3" href="#6.8.3"><h4>6.8.3 Expression and null statements</h4></a>
6691 expression-statement:
6692 expressionopt ;</pre>
6695 The expression in an expression statement is evaluated as a void expression for its side
6696 effects.<sup><a href="#note134"><b>134)</b></a></sup>
6698 A null statement (consisting of just a semicolon) performs no operations.
6700 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
6701 discarding of its value may be made explicit by converting the expression to a void expression by means of
6710 <!--page 145 indent 4-->
6712 EXAMPLE 2 In the program fragment
6716 while (*s++ != '\0')
6718 a null statement is used to supply an empty loop body to the iteration statement.
6721 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
6736 Forward references: iteration statements (<a href="#6.8.5">6.8.5</a>).
6739 <p><a name="note134">134)</a> Such as assignments, and function calls which have side effects.
6742 <a name="6.8.4" href="#6.8.4"><h4>6.8.4 Selection statements</h4></a>
6746 selection-statement:
6747 if ( expression ) statement
6748 if ( expression ) statement else statement
6749 switch ( expression ) statement</pre>
6752 A selection statement selects among a set of statements depending on the value of a
6753 controlling expression.
6755 A selection statement is a block whose scope is a strict subset of the scope of its
6756 enclosing block. Each associated substatement is also a block whose scope is a strict
6757 subset of the scope of the selection statement.
6759 <a name="6.8.4.1" href="#6.8.4.1"><h5>6.8.4.1 The if statement</h5></a>
6760 <h6>Constraints</h6>
6762 The controlling expression of an if statement shall have scalar type.
6765 In both forms, the first substatement is executed if the expression compares unequal to 0.
6766 In the else form, the second substatement is executed if the expression compares equal
6767 <!--page 146 indent 4-->
6768 to 0. If the first substatement is reached via a label, the second substatement is not
6771 An else is associated with the lexically nearest preceding if that is allowed by the
6774 <a name="6.8.4.2" href="#6.8.4.2"><h5>6.8.4.2 The switch statement</h5></a>
6775 <h6>Constraints</h6>
6777 The controlling expression of a switch statement shall have integer type.
6779 If a switch statement has an associated case or default label within the scope of an
6780 identifier with a variably modified type, the entire switch statement shall be within the
6781 scope of that identifier.<sup><a href="#note135"><b>135)</b></a></sup>
6783 The expression of each case label shall be an integer constant expression and no two of
6784 the case constant expressions in the same switch statement shall have the same value
6785 after conversion. There may be at most one default label in a switch statement.
6786 (Any enclosed switch statement may have a default label or case constant
6787 expressions with values that duplicate case constant expressions in the enclosing
6791 A switch statement causes control to jump to, into, or past the statement that is the
6792 switch body, depending on the value of a controlling expression, and on the presence of a
6793 default label and the values of any case labels on or in the switch body. A case or
6794 default label is accessible only within the closest enclosing switch statement.
6796 The integer promotions are performed on the controlling expression. The constant
6797 expression in each case label is converted to the promoted type of the controlling
6798 expression. If a converted value matches that of the promoted controlling expression,
6799 control jumps to the statement following the matched case label. Otherwise, if there is
6800 a default label, control jumps to the labeled statement. If no converted case constant
6801 expression matches and there is no default label, no part of the switch body is
6803 Implementation limits
6805 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, the implementation may limit the number of case values in a
6811 <!--page 147 indent 4-->
6813 EXAMPLE In the artificial program fragment
6821 /* falls through into default code */
6825 the object whose identifier is i exists with automatic storage duration (within the block) but is never
6826 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
6827 access an indeterminate value. Similarly, the call to the function f cannot be reached.
6831 <p><a name="note135">135)</a> That is, the declaration either precedes the switch statement, or it follows the last case or
6832 default label associated with the switch that is in the block containing the declaration.
6835 <a name="6.8.5" href="#6.8.5"><h4>6.8.5 Iteration statements</h4></a>
6839 iteration-statement:
6840 while ( expression ) statement
6841 do statement while ( expression ) ;
6842 for ( expressionopt ; expressionopt ; expressionopt ) statement
6843 for ( declaration expressionopt ; expressionopt ) statement</pre>
6844 <h6>Constraints</h6>
6846 The controlling expression of an iteration statement shall have scalar type.
6848 The declaration part of a for statement shall only declare identifiers for objects having
6849 storage class auto or register.
6852 An iteration statement causes a statement called the loop body to be executed repeatedly
6853 until the controlling expression compares equal to 0. The repetition occurs regardless of
6854 whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note136"><b>136)</b></a></sup>
6856 An iteration statement is a block whose scope is a strict subset of the scope of its
6857 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
6858 of the iteration statement.
6863 <!--page 148 indent 4-->
6866 <p><a name="note136">136)</a> Code jumped over is not executed. In particular, the controlling expression of a for or while
6867 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
6870 <a name="6.8.5.1" href="#6.8.5.1"><h5>6.8.5.1 The while statement</h5></a>
6872 The evaluation of the controlling expression takes place before each execution of the loop
6875 <a name="6.8.5.2" href="#6.8.5.2"><h5>6.8.5.2 The do statement</h5></a>
6877 The evaluation of the controlling expression takes place after each execution of the loop
6880 <a name="6.8.5.3" href="#6.8.5.3"><h5>6.8.5.3 The for statement</h5></a>
6884 for ( clause-1 ; expression-2 ; expression-3 ) statement</pre>
6885 behaves as follows: The expression expression-2 is the controlling expression that is
6886 evaluated before each execution of the loop body. The expression expression-3 is
6887 evaluated as a void expression after each execution of the loop body. If clause-1 is a
6888 declaration, the scope of any identifiers it declares is the remainder of the declaration and
6889 the entire loop, including the other two expressions; it is reached in the order of execution
6890 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
6891 evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note137"><b>137)</b></a></sup>
6893 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
6897 <p><a name="note137">137)</a> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
6898 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
6899 such that execution of the loop continues until the expression compares equal to 0; and expression-3
6900 specifies an operation (such as incrementing) that is performed after each iteration.
6903 <a name="6.8.6" href="#6.8.6"><h4>6.8.6 Jump statements</h4></a>
6911 return expressionopt ;</pre>
6914 A jump statement causes an unconditional jump to another place.
6919 <!--page 149 indent 4-->
6921 <a name="6.8.6.1" href="#6.8.6.1"><h5>6.8.6.1 The goto statement</h5></a>
6922 <h6>Constraints</h6>
6924 The identifier in a goto statement shall name a label located somewhere in the enclosing
6925 function. A goto statement shall not jump from outside the scope of an identifier having
6926 a variably modified type to inside the scope of that identifier.
6929 A goto statement causes an unconditional jump to the statement prefixed by the named
6930 label in the enclosing function.
6932 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
6933 following outline presents one possible approach to a problem based on these three assumptions:
6935 <li> The general initialization code accesses objects only visible to the current function.
6936 <li> The general initialization code is too large to warrant duplication.
6937 <li> The code to determine the next operation is at the head of the loop. (To allow it to be reached by
6938 continue statements, for example.)
6943 // determine next operation
6945 if (need to reinitialize) {
6946 // reinitialize-only code
6949 // general initialization code
6953 // handle other operations
6956 <!--page 150 indent 4-->
6959 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
6960 modified types. A jump within the scope, however, is permitted.
6962 goto lab3; // invalid: going INTO scope of VLA.
6965 a[j] = <a href="#4.4">4.4</a>;
6967 a[j] = <a href="#3.3">3.3</a>;
6968 goto lab4; // valid: going WITHIN scope of VLA.
6969 a[j] = <a href="#5.5">5.5</a>;
6971 a[j] = <a href="#6.6">6.6</a>;
6973 goto lab4; // invalid: going INTO scope of VLA.</pre>
6976 <a name="6.8.6.2" href="#6.8.6.2"><h5>6.8.6.2 The continue statement</h5></a>
6977 <h6>Constraints</h6>
6979 A continue statement shall appear only in or as a loop body.
6982 A continue statement causes a jump to the loop-continuation portion of the smallest
6983 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
6985 while (/* ... */) { do { for (/* ... */) {
6987 /* ... */ /* ... */ /* ... */
6988 continue; continue; continue;
6989 /* ... */ /* ... */ /* ... */</pre>
6990 contin: ; contin: ; contin: ;
6991 } } while (/* ... */); }
6992 unless the continue statement shown is in an enclosed iteration statement (in which
6993 case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note138"><b>138)</b></a></sup>
6996 <p><a name="note138">138)</a> Following the contin: label is a null statement.
6999 <a name="6.8.6.3" href="#6.8.6.3"><h5>6.8.6.3 The break statement</h5></a>
7000 <h6>Constraints</h6>
7002 A break statement shall appear only in or as a switch body or loop body.
7005 A break statement terminates execution of the smallest enclosing switch or iteration
7010 <!--page 151 indent 4-->
7012 <a name="6.8.6.4" href="#6.8.6.4"><h5>6.8.6.4 The return statement</h5></a>
7013 <h6>Constraints</h6>
7015 A return statement with an expression shall not appear in a function whose return type
7016 is void. A return statement without an expression shall only appear in a function
7017 whose return type is void.
7020 A return statement terminates execution of the current function and returns control to
7021 its caller. A function may have any number of return statements.
7023 If a return statement with an expression is executed, the value of the expression is
7024 returned to the caller as the value of the function call expression. If the expression has a
7025 type different from the return type of the function in which it appears, the value is
7026 converted as if by assignment to an object having the return type of the function.<sup><a href="#note139"><b>139)</b></a></sup>
7030 struct s { double i; } f(void);
7046 g.u2.f3 = f();</pre>
7047 there is no undefined behavior, although there would be if the assignment were done directly (without using
7048 a function call to fetch the value).
7053 <!--page 152 indent 4-->
7056 <p><a name="note139">139)</a> The return statement is not an assignment. The overlap restriction of subclause <a href="#6.5.16.1">6.5.16.1</a> does not
7057 apply to the case of function return. The representation of floating-point values may have wider range
7058 or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
7059 range and precision.
7062 <a name="6.9" href="#6.9"><h3>6.9 External definitions</h3></a>
7067 external-declaration
7068 translation-unit external-declaration
7069 external-declaration:
7072 <h6>Constraints</h6>
7074 The storage-class specifiers auto and register shall not appear in the declaration
7075 specifiers in an external declaration.
7077 There shall be no more than one external definition for each identifier declared with
7078 internal linkage in a translation unit. Moreover, if an identifier declared with internal
7079 linkage is used in an expression (other than as a part of the operand of a sizeof
7080 operator whose result is an integer constant), there shall be exactly one external definition
7081 for the identifier in the translation unit.
7084 As discussed in <a href="#5.1.1.1">5.1.1.1</a>, the unit of program text after preprocessing is a translation unit,
7085 which consists of a sequence of external declarations. These are described as ''external''
7086 because they appear outside any function (and hence have file scope). As discussed in
7087 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
7088 by the identifier is a definition.
7090 An external definition is an external declaration that is also a definition of a function
7091 (other than an inline definition) or an object. If an identifier declared with external
7092 linkage is used in an expression (other than as part of the operand of a sizeof operator
7093 whose result is an integer constant), somewhere in the entire program there shall be
7094 exactly one external definition for the identifier; otherwise, there shall be no more than
7095 one.<sup><a href="#note140"><b>140)</b></a></sup>
7100 <!--page 153 indent 4-->
7103 <p><a name="note140">140)</a> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
7104 external definition for it.
7107 <a name="6.9.1" href="#6.9.1"><h4>6.9.1 Function definitions</h4></a>
7111 function-definition:
7112 declaration-specifiers declarator declaration-listopt compound-statement
7115 declaration-list declaration</pre>
7116 <h6>Constraints</h6>
7118 The identifier declared in a function definition (which is the name of the function) shall
7119 have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note141"><b>141)</b></a></sup>
7121 The return type of a function shall be void or an object type other than array type.
7123 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
7126 If the declarator includes a parameter type list, the declaration of each parameter shall
7127 include an identifier, except for the special case of a parameter list consisting of a single
7128 parameter of type void, in which case there shall not be an identifier. No declaration list
7131 If the declarator includes an identifier list, each declaration in the declaration list shall
7132 have at least one declarator, those declarators shall declare only identifiers from the
7133 identifier list, and every identifier in the identifier list shall be declared. An identifier
7134 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
7135 declaration list shall contain no storage-class specifier other than register and no
7141 <!--page 154 indent 5-->
7144 The declarator in a function definition specifies the name of the function being defined
7145 and the identifiers of its parameters. If the declarator includes a parameter type list, the
7146 list also specifies the types of all the parameters; such a declarator also serves as a
7147 function prototype for later calls to the same function in the same translation unit. If the
7148 declarator includes an identifier list,<sup><a href="#note142"><b>142)</b></a></sup> the types of the parameters shall be declared in a
7149 following declaration list. In either case, the type of each parameter is adjusted as
7150 described in <a href="#6.7.5.3">6.7.5.3</a> for a parameter type list; the resulting type shall be an object type.
7152 If a function that accepts a variable number of arguments is defined without a parameter
7153 type list that ends with the ellipsis notation, the behavior is undefined.
7155 Each parameter has automatic storage duration. Its identifier is an lvalue, which is in
7156 effect declared at the head of the compound statement that constitutes the function body
7157 (and therefore cannot be redeclared in the function body except in an enclosed block).
7158 The layout of the storage for parameters is unspecified.
7160 On entry to the function, the size expressions of each variably modified parameter are
7161 evaluated and the value of each argument expression is converted to the type of the
7162 corresponding parameter as if by assignment. (Array expressions and function
7163 designators as arguments were converted to pointers before the call.)
7165 After all parameters have been assigned, the compound statement that constitutes the
7166 body of the function definition is executed.
7168 If the } that terminates a function is reached, and the value of the function call is used by
7169 the caller, the behavior is undefined.
7171 EXAMPLE 1 In the following:
7173 extern int max(int a, int b)
7175 return a > b ? a : b;
7177 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
7178 function declarator; and
7180 { return a > b ? a : b; }</pre>
7181 is the function body. The following similar definition uses the identifier-list form for the parameter
7187 <!--page 155 indent 5-->
7189 extern int max(a, b)
7192 return a > b ? a : b;
7194 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
7195 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
7196 to the function, whereas the second form does not.
7199 EXAMPLE 2 To pass one function to another, one might say
7204 Then the definition of g might read
7206 void g(int (*funcp)(void))
7209 (*funcp)(); /* or funcp(); ... */
7213 void g(int func(void))
7216 func(); /* or (*func)(); ... */
7221 <p><a name="note141">141)</a> The intent is that the type category in a function definition cannot be inherited from a typedef:
7224 typedef int F(void); // type F is ''function with no parameters
7226 F f, g; // f and g both have type compatible with F
7227 F f { /* ... */ } // WRONG: syntax/constraint error
7228 F g() { /* ... */ } // WRONG: declares that g returns a function
7229 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
7230 int g() { /* ... */ } // RIGHT: g has type compatible with F
7231 F *e(void) { /* ... */ } // e returns a pointer to a function
7232 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
7233 int (*fp)(void); // fp points to a function that has type F
7234 F *Fp; // Fp points to a function that has type F</pre>
7236 <p><a name="note142">142)</a> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
7239 <a name="6.9.2" href="#6.9.2"><h4>6.9.2 External object definitions</h4></a>
7242 If the declaration of an identifier for an object has file scope and an initializer, the
7243 declaration is an external definition for the identifier.
7245 A declaration of an identifier for an object that has file scope without an initializer, and
7246 without a storage-class specifier or with the storage-class specifier static, constitutes a
7247 tentative definition. If a translation unit contains one or more tentative definitions for an
7248 identifier, and the translation unit contains no external definition for that identifier, then
7249 the behavior is exactly as if the translation unit contains a file scope declaration of that
7250 identifier, with the composite type as of the end of the translation unit, with an initializer
7253 If the declaration of an identifier for an object is a tentative definition and has internal
7254 linkage, the declared type shall not be an incomplete type.
7255 <!--page 156 indent 4-->
7259 int i1 = 1; // definition, external linkage
7260 static int i2 = 2; // definition, internal linkage
7261 extern int i3 = 3; // definition, external linkage
7262 int i4; // tentative definition, external linkage
7263 static int i5; // tentative definition, internal linkage
7264 int i1; // valid tentative definition, refers to previous
7265 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
7266 int i3; // valid tentative definition, refers to previous
7267 int i4; // valid tentative definition, refers to previous
7268 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
7269 extern int i1; // refers to previous, whose linkage is external
7270 extern int i2; // refers to previous, whose linkage is internal
7271 extern int i3; // refers to previous, whose linkage is external
7272 extern int i4; // refers to previous, whose linkage is external
7273 extern int i5; // refers to previous, whose linkage is internal</pre>
7276 EXAMPLE 2 If at the end of the translation unit containing
7279 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
7280 zero on program startup.
7281 <!--page 157 indent 4-->
7283 <a name="6.10" href="#6.10"><h3>6.10 Preprocessing directives</h3></a>
7286 <!--page 158 indent 4-->
7299 if-group elif-groupsopt else-groupopt endif-line
7301 # if constant-expression new-line groupopt
7302 # ifdef identifier new-line groupopt
7303 # ifndef identifier new-line groupopt
7306 elif-groups elif-group
7308 # elif constant-expression new-line groupopt
7310 # else new-line groupopt
7314 # include pp-tokens new-line
7315 # define identifier replacement-list new-line
7316 # define identifier lparen identifier-listopt )
7317 replacement-list new-line
7318 # define identifier lparen ... ) replacement-list new-line
7319 # define identifier lparen identifier-list , ... )
7320 replacement-list new-line
7321 # undef identifier new-line
7322 # line pp-tokens new-line
7323 # error pp-tokensopt new-line
7324 # pragma pp-tokensopt new-line
7327 pp-tokensopt new-line
7331 a ( character not immediately preceded by white-space
7336 pp-tokens preprocessing-token
7338 the new-line character</pre>
7339 <h6>Description</h6>
7341 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
7342 following constraints: The first token in the sequence is a # preprocessing token that (at
7343 the start of translation phase 4) is either the first character in the source file (optionally
7344 after white space containing no new-line characters) or that follows white space
7345 containing at least one new-line character. The last token in the sequence is the first new-
7346 line character that follows the first token in the sequence.<sup><a href="#note143"><b>143)</b></a></sup> A new-line character ends
7347 the preprocessing directive even if it occurs within what would otherwise be an
7349 <!--page 159 indent 4-->
7350 invocation of a function-like macro.
7352 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
7353 with any of the directive names appearing in the syntax.
7355 When in a group that is skipped (<a href="#6.10.1">6.10.1</a>), the directive syntax is relaxed to allow any
7356 sequence of preprocessing tokens to occur between the directive name and the following
7358 <h6>Constraints</h6>
7360 The only white-space characters that shall appear between preprocessing tokens within a
7361 preprocessing directive (from just after the introducing # preprocessing token through
7362 just before the terminating new-line character) are space and horizontal-tab (including
7363 spaces that have replaced comments or possibly other white-space characters in
7364 translation phase 3).
7367 The implementation can process and skip sections of source files conditionally, include
7368 other source files, and replace macros. These capabilities are called preprocessing,
7369 because conceptually they occur before translation of the resulting translation unit.
7371 The preprocessing tokens within a preprocessing directive are not subject to macro
7372 expansion unless otherwise stated.
7377 EMPTY # include <file.h></pre>
7378 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
7379 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
7384 <p><a name="note143">143)</a> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
7385 significance, as all white space is equivalent except in certain situations during preprocessing (see the
7386 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
7389 <a name="6.10.1" href="#6.10.1"><h4>6.10.1 Conditional inclusion</h4></a>
7390 <h6>Constraints</h6>
7392 The expression that controls conditional inclusion shall be an integer constant expression
7393 except that: it shall not contain a cast; identifiers (including those lexically identical to
7394 keywords) are interpreted as described below;<sup><a href="#note144"><b>144)</b></a></sup> and it may contain unary operator
7395 expressions of the form
7400 <!--page 160 indent 4-->
7402 defined identifier</pre>
7405 defined ( identifier )</pre>
7406 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
7407 predefined or if it has been the subject of a #define preprocessing directive without an
7408 intervening #undef directive with the same subject identifier), 0 if it is not.
7410 Each preprocessing token that remains (in the list of preprocessing tokens that will
7411 become the controlling expression) after all macro replacements have occurred shall be in
7412 the lexical form of a token (<a href="#6.4">6.4</a>).
7415 Preprocessing directives of the forms
7417 # if constant-expression new-line groupopt
7418 # elif constant-expression new-line groupopt</pre>
7419 check whether the controlling constant expression evaluates to nonzero.
7421 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
7422 the controlling constant expression are replaced (except for those macro names modified
7423 by the defined unary operator), just as in normal text. If the token defined is
7424 generated as a result of this replacement process or use of the defined unary operator
7425 does not match one of the two specified forms prior to macro replacement, the behavior is
7426 undefined. After all replacements due to macro expansion and the defined unary
7427 operator have been performed, all remaining identifiers (including those lexically
7428 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
7429 token is converted into a token. The resulting tokens compose the controlling constant
7430 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
7431 token conversion and evaluation, all signed integer types and all unsigned integer types
7432 act as if they have the same representation as, respectively, the types intmax_t and
7433 uintmax_t defined in the header <stdint.h>.<sup><a href="#note145"><b>145)</b></a></sup> This includes interpreting
7434 character constants, which may involve converting escape sequences into execution
7435 character set members. Whether the numeric value for these character constants matches
7436 the value obtained when an identical character constant occurs in an expression (other
7437 than within a #if or #elif directive) is implementation-defined.<sup><a href="#note146"><b>146)</b></a></sup> Also, whether a
7438 single-character character constant may have a negative value is implementation-defined.
7440 Preprocessing directives of the forms
7444 <!--page 161 indent 4-->
7446 # ifdef identifier new-line groupopt
7447 # ifndef identifier new-line groupopt</pre>
7448 check whether the identifier is or is not currently defined as a macro name. Their
7449 conditions are equivalent to #if defined identifier and #if !defined identifier
7452 Each directive's condition is checked in order. If it evaluates to false (zero), the group
7453 that it controls is skipped: directives are processed only through the name that determines
7454 the directive in order to keep track of the level of nested conditionals; the rest of the
7455 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
7456 group. Only the first group whose control condition evaluates to true (nonzero) is
7457 processed. If none of the conditions evaluates to true, and there is a #else directive, the
7458 group controlled by the #else is processed; lacking a #else directive, all the groups
7459 until the #endif are skipped.<sup><a href="#note147"><b>147)</b></a></sup>
7460 Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>), source file inclusion (<a href="#6.10.2">6.10.2</a>), largest
7461 integer types (<a href="#7.18.1.5">7.18.1.5</a>).
7464 <p><a name="note144">144)</a> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
7465 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
7467 <p><a name="note145">145)</a> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
7468 0x8000 is signed and positive within a #if expression even though it would be unsigned in
7469 translation phase 7.
7471 <p><a name="note146">146)</a> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
7472 evaluate to the same value in these two contexts.
7474 if ('z' - 'a' == 25)
7477 <p><a name="note147">147)</a> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
7478 before the terminating new-line character. However, comments may appear anywhere in a source file,
7479 including within a preprocessing directive.
7482 <a name="6.10.2" href="#6.10.2"><h4>6.10.2 Source file inclusion</h4></a>
7483 <h6>Constraints</h6>
7485 A #include directive shall identify a header or source file that can be processed by the
7489 A preprocessing directive of the form
7491 # include <h-char-sequence> new-line</pre>
7492 searches a sequence of implementation-defined places for a header identified uniquely by
7493 the specified sequence between the < and > delimiters, and causes the replacement of that
7494 directive by the entire contents of the header. How the places are specified or the header
7495 identified is implementation-defined.
7497 A preprocessing directive of the form
7501 <!--page 162 indent 4-->
7503 # include "q-char-sequence" new-line</pre>
7504 causes the replacement of that directive by the entire contents of the source file identified
7505 by the specified sequence between the " delimiters. The named source file is searched
7506 for in an implementation-defined manner. If this search is not supported, or if the search
7507 fails, the directive is reprocessed as if it read
7509 # include <h-char-sequence> new-line</pre>
7510 with the identical contained sequence (including > characters, if any) from the original
7513 A preprocessing directive of the form
7515 # include pp-tokens new-line</pre>
7516 (that does not match one of the two previous forms) is permitted. The preprocessing
7517 tokens after include in the directive are processed just as in normal text. (Each
7518 identifier currently defined as a macro name is replaced by its replacement list of
7519 preprocessing tokens.) The directive resulting after all replacements shall match one of
7520 the two previous forms.<sup><a href="#note148"><b>148)</b></a></sup> The method by which a sequence of preprocessing tokens
7521 between a < and a > preprocessing token pair or a pair of " characters is combined into a
7522 single header name preprocessing token is implementation-defined.
7524 The implementation shall provide unique mappings for sequences consisting of one or
7525 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
7526 first character shall not be a digit. The implementation may ignore distinctions of
7527 alphabetical case and restrict the mapping to eight significant characters before the
7530 A #include preprocessing directive may appear in a source file that has been read
7531 because of a #include directive in another file, up to an implementation-defined
7532 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
7534 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
7536 #include <stdio.h>
7537 #include "myprog.h"</pre>
7540 EXAMPLE 2 This illustrates macro-replaced #include directives:
7545 <!--page 163 indent 4-->
7548 #define INCFILE "vers1.h"
7550 #define INCFILE "vers2.h" // and so on
7552 #define INCFILE "versN.h"
7554 #include INCFILE</pre>
7556 Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>).
7559 <p><a name="note148">148)</a> Note that adjacent string literals are not concatenated into a single string literal (see the translation
7560 phases in <a href="#5.1.1.2">5.1.1.2</a>); thus, an expansion that results in two string literals is an invalid directive.
7563 <a name="6.10.3" href="#6.10.3"><h4>6.10.3 Macro replacement</h4></a>
7564 <h6>Constraints</h6>
7566 Two replacement lists are identical if and only if the preprocessing tokens in both have
7567 the same number, ordering, spelling, and white-space separation, where all white-space
7568 separations are considered identical.
7570 An identifier currently defined as an object-like macro shall not be redefined by another
7571 #define preprocessing directive unless the second definition is an object-like macro
7572 definition and the two replacement lists are identical. Likewise, an identifier currently
7573 defined as a function-like macro shall not be redefined by another #define
7574 preprocessing directive unless the second definition is a function-like macro definition
7575 that has the same number and spelling of parameters, and the two replacement lists are
7578 There shall be white-space between the identifier and the replacement list in the definition
7579 of an object-like macro.
7581 If the identifier-list in the macro definition does not end with an ellipsis, the number of
7582 arguments (including those arguments consisting of no preprocessing tokens) in an
7583 invocation of a function-like macro shall equal the number of parameters in the macro
7584 definition. Otherwise, there shall be more arguments in the invocation than there are
7585 parameters in the macro definition (excluding the ...). There shall exist a )
7586 preprocessing token that terminates the invocation.
7588 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
7589 macro that uses the ellipsis notation in the parameters.
7591 A parameter identifier in a function-like macro shall be uniquely declared within its
7595 The identifier immediately following the define is called the macro name. There is one
7596 name space for macro names. Any white-space characters preceding or following the
7597 replacement list of preprocessing tokens are not considered part of the replacement list
7598 for either form of macro.
7599 <!--page 164 indent 5-->
7601 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
7602 a preprocessing directive could begin, the identifier is not subject to macro replacement.
7604 A preprocessing directive of the form
7606 # define identifier replacement-list new-line</pre>
7607 defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note149"><b>149)</b></a></sup>
7608 to be replaced by the replacement list of preprocessing tokens that constitute the
7609 remainder of the directive. The replacement list is then rescanned for more macro names
7612 A preprocessing directive of the form
7614 # define identifier lparen identifier-listopt ) replacement-list new-line
7615 # define identifier lparen ... ) replacement-list new-line
7616 # define identifier lparen identifier-list , ... ) replacement-list new-line</pre>
7617 defines a function-like macro with parameters, whose use is similar syntactically to a
7618 function call. The parameters are specified by the optional list of identifiers, whose scope
7619 extends from their declaration in the identifier list until the new-line character that
7620 terminates the #define preprocessing directive. Each subsequent instance of the
7621 function-like macro name followed by a ( as the next preprocessing token introduces the
7622 sequence of preprocessing tokens that is replaced by the replacement list in the definition
7623 (an invocation of the macro). The replaced sequence of preprocessing tokens is
7624 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
7625 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
7626 tokens making up an invocation of a function-like macro, new-line is considered a normal
7627 white-space character.
7629 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
7630 forms the list of arguments for the function-like macro. The individual arguments within
7631 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
7632 between matching inner parentheses do not separate arguments. If there are sequences of
7633 preprocessing tokens within the list of arguments that would otherwise act as
7634 preprocessing directives,<sup><a href="#note150"><b>150)</b></a></sup> the behavior is undefined.
7636 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
7637 including any separating comma preprocessing tokens, are merged to form a single item:
7638 the variable arguments. The number of arguments so combined is such that, following
7641 <!--page 165 indent 4-->
7642 merger, the number of arguments is one more than the number of parameters in the macro
7643 definition (excluding the ...).
7646 <p><a name="note149">149)</a> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
7647 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
7648 are never scanned for macro names or parameters.
7650 <p><a name="note150">150)</a> Despite the name, a non-directive is a preprocessing directive.
7653 <a name="6.10.3.1" href="#6.10.3.1"><h5>6.10.3.1 Argument substitution</h5></a>
7655 After the arguments for the invocation of a function-like macro have been identified,
7656 argument substitution takes place. A parameter in the replacement list, unless preceded
7657 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
7658 replaced by the corresponding argument after all macros contained therein have been
7659 expanded. Before being substituted, each argument's preprocessing tokens are
7660 completely macro replaced as if they formed the rest of the preprocessing file; no other
7661 preprocessing tokens are available.
7663 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
7664 were a parameter, and the variable arguments shall form the preprocessing tokens used to
7667 <a name="6.10.3.2" href="#6.10.3.2"><h5>6.10.3.2 The # operator</h5></a>
7668 <h6>Constraints</h6>
7670 Each # preprocessing token in the replacement list for a function-like macro shall be
7671 followed by a parameter as the next preprocessing token in the replacement list.
7674 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
7675 token, both are replaced by a single character string literal preprocessing token that
7676 contains the spelling of the preprocessing token sequence for the corresponding
7677 argument. Each occurrence of white space between the argument's preprocessing tokens
7678 becomes a single space character in the character string literal. White space before the
7679 first preprocessing token and after the last preprocessing token composing the argument
7680 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
7681 is retained in the character string literal, except for special handling for producing the
7682 spelling of string literals and character constants: a \ character is inserted before each "
7683 and \ character of a character constant or string literal (including the delimiting "
7684 characters), except that it is implementation-defined whether a \ character is inserted
7685 before the \ character beginning a universal character name. If the replacement that
7686 results is not a valid character string literal, the behavior is undefined. The character
7687 string literal corresponding to an empty argument is "". The order of evaluation of # and
7688 ## operators is unspecified.
7689 <!--page 166 indent 4-->
7691 <a name="6.10.3.3" href="#6.10.3.3"><h5>6.10.3.3 The ## operator</h5></a>
7692 <h6>Constraints</h6>
7694 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
7695 list for either form of macro definition.
7698 If, in the replacement list of a function-like macro, a parameter is immediately preceded
7699 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
7700 argument's preprocessing token sequence; however, if an argument consists of no
7701 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
7702 instead.<sup><a href="#note151"><b>151)</b></a></sup>
7704 For both object-like and function-like macro invocations, before the replacement list is
7705 reexamined for more macro names to replace, each instance of a ## preprocessing token
7706 in the replacement list (not from an argument) is deleted and the preceding preprocessing
7707 token is concatenated with the following preprocessing token. Placemarker
7708 preprocessing tokens are handled specially: concatenation of two placemarkers results in
7709 a single placemarker preprocessing token, and concatenation of a placemarker with a
7710 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
7711 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
7712 token is available for further macro replacement. The order of evaluation of ## operators
7715 EXAMPLE In the following fragment:
7717 #define hash_hash # ## #
7718 #define mkstr(a) # a
7719 #define in_between(a) mkstr(a)
7720 #define join(c, d) in_between(c hash_hash d)
7721 char p[] = join(x, y); // equivalent to
7722 // char p[] = "x ## y";</pre>
7723 The expansion produces, at various stages:
7726 in_between(x hash_hash y)
7730 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
7731 this new token is not the ## operator.
7734 <!--page 167 indent 4-->
7737 <p><a name="note151">151)</a> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
7738 exist only within translation phase 4.
7741 <a name="6.10.3.4" href="#6.10.3.4"><h5>6.10.3.4 Rescanning and further replacement</h5></a>
7743 After all parameters in the replacement list have been substituted and # and ##
7744 processing has taken place, all placemarker preprocessing tokens are removed. Then, the
7745 resulting preprocessing token sequence is rescanned, along with all subsequent
7746 preprocessing tokens of the source file, for more macro names to replace.
7748 If the name of the macro being replaced is found during this scan of the replacement list
7749 (not including the rest of the source file's preprocessing tokens), it is not replaced.
7750 Furthermore, if any nested replacements encounter the name of the macro being replaced,
7751 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
7752 available for further replacement even if they are later (re)examined in contexts in which
7753 that macro name preprocessing token would otherwise have been replaced.
7755 The resulting completely macro-replaced preprocessing token sequence is not processed
7756 as a preprocessing directive even if it resembles one, but all pragma unary operator
7757 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
7759 <a name="6.10.3.5" href="#6.10.3.5"><h5>6.10.3.5 Scope of macro definitions</h5></a>
7761 A macro definition lasts (independent of block structure) until a corresponding #undef
7762 directive is encountered or (if none is encountered) until the end of the preprocessing
7763 translation unit. Macro definitions have no significance after translation phase 4.
7765 A preprocessing directive of the form
7767 # undef identifier new-line</pre>
7768 causes the specified identifier no longer to be defined as a macro name. It is ignored if
7769 the specified identifier is not currently defined as a macro name.
7771 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
7774 int table[TABSIZE];</pre>
7777 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
7778 It has the advantages of working for any compatible types of the arguments and of generating in-line code
7779 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
7780 arguments a second time (including side effects) and generating more code than a function if invoked
7781 several times. It also cannot have its address taken, as it has none.
7783 #define max(a, b) ((a) > (b) ? (a) : (b))</pre>
7784 The parentheses ensure that the arguments and the resulting expression are bound properly.
7785 <!--page 168 indent 4-->
7787 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
7790 #define f(a) f(x * (a))
7801 #define r(x,y) x ## y
7803 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
7804 g(x+(3,4)-w) | h 5) & m
7806 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
7807 char c[2][6] = { str(hello), str() };</pre>
7810 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
7811 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
7812 int i[] = { 1, 23, 4, 5, };
7813 char c[2][6] = { "hello", "" };</pre>
7816 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
7820 #define xstr(s) str(s)
7821 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
7823 #define INCFILE(n) vers ## n
7824 #define glue(a, b) a ## b
7825 #define xglue(a, b) glue(a, b)
7826 #define HIGHLOW "hello"
7827 #define LOW LOW ", world"
7829 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
7830 == 0) str(: @\n), s);
7831 #include xstr(INCFILE(2).h)
7833 xglue(HIGH, LOW)</pre>
7835 <!--page 169 indent 4-->
7837 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
7839 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
7841 #include "vers2.h" (after macro replacement, before file access)
7843 "hello" ", world"</pre>
7844 or, after concatenation of the character string literals,
7846 printf("x1= %d, x2= %s", x1, x2);
7848 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
7850 #include "vers2.h" (after macro replacement, before file access)
7852 "hello, world"</pre>
7853 Space around the # and ## tokens in the macro definition is optional.
7856 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
7858 #define t(x,y,z) x ## y ## z
7859 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
7860 t(10,,), t(,11,), t(,,12), t(,,) };</pre>
7863 int j[] = { 123, 45, 67, 89,
7864 10, 11, 12, };</pre>
7867 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
7869 #define OBJ_LIKE (1-1)
7870 #define OBJ_LIKE /* white space */ (1-1) /* other */
7871 #define FUNC_LIKE(a) ( a )
7872 #define FUNC_LIKE( a )( /* note the white space */ \
7873 a /* other stuff on this line
7875 But the following redefinitions are invalid:
7877 #define OBJ_LIKE (0) // different token sequence
7878 #define OBJ_LIKE (1 - 1) // different white space
7879 #define FUNC_LIKE(b) ( a ) // different parameter usage
7880 #define FUNC_LIKE(b) ( b ) // different parameter spelling</pre>
7883 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
7884 <!--page 170 indent 4-->
7886 #define debug(...) fprintf(stderr, __VA_ARGS__)
7887 #define showlist(...) puts(#__VA_ARGS__)
7888 #define report(test, ...) ((test)?puts(#test):\
7889 printf(__VA_ARGS__))
7891 debug("X = %d\n", x);
7892 showlist(The first, second, and third items.);
7893 report(x>y, "x is %d but y is %d", x, y);</pre>
7896 fprintf(stderr, "Flag" );
7897 fprintf(stderr, "X = %d\n", x );
7898 puts( "The first, second, and third items." );
7899 ((x>y)?puts("x>y"):
7900 printf("x is %d but y is %d", x, y));</pre>
7903 <a name="6.10.4" href="#6.10.4"><h4>6.10.4 Line control</h4></a>
7904 <h6>Constraints</h6>
7906 The string literal of a #line directive, if present, shall be a character string literal.
7909 The line number of the current source line is one greater than the number of new-line
7910 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
7911 file to the current token.
7913 A preprocessing directive of the form
7915 # line digit-sequence new-line</pre>
7916 causes the implementation to behave as if the following sequence of source lines begins
7917 with a source line that has a line number as specified by the digit sequence (interpreted as
7918 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
7921 A preprocessing directive of the form
7923 # line digit-sequence "s-char-sequenceopt" new-line</pre>
7924 sets the presumed line number similarly and changes the presumed name of the source
7925 file to be the contents of the character string literal.
7927 A preprocessing directive of the form
7929 # line pp-tokens new-line</pre>
7930 (that does not match one of the two previous forms) is permitted. The preprocessing
7931 tokens after line on the directive are processed just as in normal text (each identifier
7932 currently defined as a macro name is replaced by its replacement list of preprocessing
7933 tokens). The directive resulting after all replacements shall match one of the two
7934 previous forms and is then processed as appropriate.
7935 <!--page 171 indent 4-->
7937 <a name="6.10.5" href="#6.10.5"><h4>6.10.5 Error directive</h4></a>
7940 A preprocessing directive of the form
7942 # error pp-tokensopt new-line</pre>
7943 causes the implementation to produce a diagnostic message that includes the specified
7944 sequence of preprocessing tokens.
7946 <a name="6.10.6" href="#6.10.6"><h4>6.10.6 Pragma directive</h4></a>
7949 A preprocessing directive of the form
7951 # pragma pp-tokensopt new-line</pre>
7952 where the preprocessing token STDC does not immediately follow pragma in the
7953 directive (prior to any macro replacement)<sup><a href="#note152"><b>152)</b></a></sup> causes the implementation to behave in an
7954 implementation-defined manner. The behavior might cause translation to fail or cause the
7955 translator or the resulting program to behave in a non-conforming manner. Any such
7956 pragma that is not recognized by the implementation is ignored.
7958 If the preprocessing token STDC does immediately follow pragma in the directive (prior
7959 to any macro replacement), then no macro replacement is performed on the directive, and
7960 the directive shall have one of the following forms<sup><a href="#note153"><b>153)</b></a></sup> whose meanings are described
7963 #pragma STDC FP_CONTRACT on-off-switch
7964 #pragma STDC FENV_ACCESS on-off-switch
7965 #pragma STDC CX_LIMITED_RANGE on-off-switch
7966 on-off-switch: one of
7967 ON OFF DEFAULT</pre>
7968 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
7969 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
7974 <!--page 172 indent 4-->
7977 <p><a name="note152">152)</a> An implementation is not required to perform macro replacement in pragmas, but it is permitted
7978 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
7979 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
7980 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
7981 but is not required to.
7983 <p><a name="note153">153)</a> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
7986 <a name="6.10.7" href="#6.10.7"><h4>6.10.7 Null directive</h4></a>
7989 A preprocessing directive of the form
7994 <a name="6.10.8" href="#6.10.8"><h4>6.10.8 Predefined macro names</h4></a>
7996 The following macro names<sup><a href="#note154"><b>154)</b></a></sup> shall be defined by the implementation:
7997 __DATE__ The date of translation of the preprocessing translation unit: a character
7999 string literal of the form "Mmm dd yyyy", where the names of the
8000 months are the same as those generated by the asctime function, and the
8001 first character of dd is a space character if the value is less than 10. If the
8002 date of translation is not available, an implementation-defined valid date
8003 shall be supplied.</pre>
8004 __FILE__ The presumed name of the current source file (a character string literal).<sup><a href="#note155"><b>155)</b></a></sup>
8005 __LINE__ The presumed line number (within the current source file) of the current
8007 source line (an integer constant).155)</pre>
8008 __STDC__ The integer constant 1, intended to indicate a conforming implementation.
8009 __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
8011 implementation or the integer constant 0 if it is not.</pre>
8012 __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
8014 the encoding for wchar_t, a member of the basic character set need not
8015 have a code value equal to its value when used as the lone character in an
8016 integer character constant.</pre>
8017 __STDC_VERSION__ The integer constant 199901L.<sup><a href="#note156"><b>156)</b></a></sup>
8018 __TIME__ The time of translation of the preprocessing translation unit: a character
8020 string literal of the form "hh:mm:ss" as in the time generated by the
8021 asctime function. If the time of translation is not available, an
8022 implementation-defined valid time shall be supplied.</pre>
8026 <!--page 173 indent 4-->
8028 The following macro names are conditionally defined by the implementation:
8029 __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
8031 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).</pre>
8032 __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
8034 adherence to the specifications in informative <a href="#G">annex G</a> (IEC 60559
8035 compatible complex arithmetic).</pre>
8036 __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
8039 199712L). If this symbol is defined, then every character in the Unicode
8040 required set, when stored in an object of type wchar_t, has the same
8041 value as the short identifier of that character. The Unicode required set
8042 consists of all the characters that are defined by ISO/IEC 10646, along with
8043 all amendments and technical corrigenda, as of the specified year and
8045 The values of the predefined macros (except for __FILE__ and __LINE__) remain
8046 constant throughout the translation unit.
8048 None of these macro names, nor the identifier defined, shall be the subject of a
8049 #define or a #undef preprocessing directive. Any other predefined macro names
8050 shall begin with a leading underscore followed by an uppercase letter or a second
8053 The implementation shall not predefine the macro __cplusplus, nor shall it define it
8054 in any standard header.
8055 Forward references: the asctime function (<a href="#7.23.3.1">7.23.3.1</a>), standard headers (<a href="#7.1.2">7.1.2</a>).
8058 <p><a name="note154">154)</a> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
8060 <p><a name="note155">155)</a> The presumed source file name and line number can be changed by the #line directive.
8062 <p><a name="note156">156)</a> This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
8063 ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
8064 int that is increased with each revision of this International Standard.
8067 <a name="6.10.9" href="#6.10.9"><h4>6.10.9 Pragma operator</h4></a>
8070 A unary operator expression of the form:
8072 _Pragma ( string-literal )</pre>
8073 is processed as follows: The string literal is destringized by deleting the L prefix, if
8074 present, deleting the leading and trailing double-quotes, replacing each escape sequence
8075 \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The
8076 resulting sequence of characters is processed through translation phase 3 to produce
8077 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
8078 directive. The original four preprocessing tokens in the unary operator expression are
8081 EXAMPLE A directive of the form:
8083 #pragma listing on "..\listing.dir"</pre>
8084 can also be expressed as:
8085 <!--page 174 indent 0-->
8087 _Pragma ( "listing on \"..\\listing.dir\"" )</pre>
8088 The latter form is processed in the same way whether it appears literally as shown, or results from macro
8090 <!--page 175 indent 4-->
8092 #define LISTING(x) PRAGMA(listing on #x)
8093 #define PRAGMA(x) _Pragma(#x)
8094 LISTING ( ..\listing.dir )</pre>
8096 <a name="6.11" href="#6.11"><h3>6.11 Future language directions</h3></a>
8098 <a name="6.11.1" href="#6.11.1"><h4>6.11.1 Floating types</h4></a>
8100 Future standardization may include additional floating-point types, including those with
8101 greater range, precision, or both than long double.
8103 <a name="6.11.2" href="#6.11.2"><h4>6.11.2 Linkages of identifiers</h4></a>
8105 Declaring an identifier with internal linkage at file scope without the static storage-
8106 class specifier is an obsolescent feature.
8108 <a name="6.11.3" href="#6.11.3"><h4>6.11.3 External names</h4></a>
8110 Restriction of the significance of an external name to fewer than 255 characters
8111 (considering each universal character name or extended source character as a single
8112 character) is an obsolescent feature that is a concession to existing implementations.
8114 <a name="6.11.4" href="#6.11.4"><h4>6.11.4 Character escape sequences</h4></a>
8116 Lowercase letters as escape sequences are reserved for future standardization. Other
8117 characters may be used in extensions.
8119 <a name="6.11.5" href="#6.11.5"><h4>6.11.5 Storage-class specifiers</h4></a>
8121 The placement of a storage-class specifier other than at the beginning of the declaration
8122 specifiers in a declaration is an obsolescent feature.
8124 <a name="6.11.6" href="#6.11.6"><h4>6.11.6 Function declarators</h4></a>
8126 The use of function declarators with empty parentheses (not prototype-format parameter
8127 type declarators) is an obsolescent feature.
8129 <a name="6.11.7" href="#6.11.7"><h4>6.11.7 Function definitions</h4></a>
8131 The use of function definitions with separate parameter identifier and declaration lists
8132 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
8134 <a name="6.11.8" href="#6.11.8"><h4>6.11.8 Pragma directives</h4></a>
8136 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
8138 <a name="6.11.9" href="#6.11.9"><h4>6.11.9 Predefined macro names</h4></a>
8140 Macro names beginning with __STDC_ are reserved for future standardization.
8141 <!--page 176 indent 4-->
8143 <a name="7" href="#7"><h2>7. Library</h2></a>
8146 <a name="7.1" href="#7.1"><h3>7.1 Introduction</h3></a>
8148 <a name="7.1.1" href="#7.1.1"><h4>7.1.1 Definitions of terms</h4></a>
8150 A string is a contiguous sequence of characters terminated by and including the first null
8151 character. The term multibyte string is sometimes used instead to emphasize special
8152 processing given to multibyte characters contained in the string or to avoid confusion
8153 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
8154 character. The length of a string is the number of bytes preceding the null character and
8155 the value of a string is the sequence of the values of the contained characters, in order.
8157 The decimal-point character is the character used by functions that convert floating-point
8158 numbers to or from character sequences to denote the beginning of the fractional part of
8159 such character sequences.<sup><a href="#note157"><b>157)</b></a></sup> It is represented in the text and examples by a period, but
8160 may be changed by the setlocale function.
8162 A null wide character is a wide character with code value zero.
8164 A wide string is a contiguous sequence of wide characters terminated by and including
8165 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
8166 addressed) wide character. The length of a wide string is the number of wide characters
8167 preceding the null wide character and the value of a wide string is the sequence of code
8168 values of the contained wide characters, in order.
8170 A shift sequence is a contiguous sequence of bytes within a multibyte string that
8171 (potentially) causes a change in shift state (see <a href="#5.2.1.2">5.2.1.2</a>). A shift sequence shall not have a
8172 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
8173 character.<sup><a href="#note158"><b>158)</b></a></sup>
8174 Forward references: character handling (<a href="#7.4">7.4</a>), the setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
8179 <!--page 177 indent 4-->
8182 <p><a name="note157">157)</a> The functions that make use of the decimal-point character are the numeric conversion functions
8183 (<a href="#7.20.1">7.20.1</a>, <a href="#7.24.4.1">7.24.4.1</a>) and the formatted input/output functions (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
8185 <p><a name="note158">158)</a> For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
8186 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
8187 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
8188 implementation's choice.
8191 <a name="7.1.2" href="#7.1.2"><h4>7.1.2 Standard headers</h4></a>
8193 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note159"><b>159)</b></a></sup>
8194 whose contents are made available by the #include preprocessing directive. The
8195 header declares a set of related functions, plus any necessary types and additional macros
8196 needed to facilitate their use. Declarations of types described in this clause shall not
8197 include type qualifiers, unless explicitly stated otherwise.
8199 The standard headers are
8202 <assert.h> <inttypes.h> <signal.h> <stdlib.h>
8203 <complex.h> <iso646.h> <stdarg.h> <string.h>
8204 <ctype.h> <limits.h> <stdbool.h> <tgmath.h>
8205 <errno.h> <locale.h> <stddef.h> <time.h>
8206 <fenv.h> <math.h> <stdint.h> <wchar.h>
8207 <float.h> <setjmp.h> <stdio.h> <wctype.h></pre>
8208 If a file with the same name as one of the above < and > delimited sequences, not
8209 provided as part of the implementation, is placed in any of the standard places that are
8210 searched for included source files, the behavior is undefined.
8212 Standard headers may be included in any order; each may be included more than once in
8213 a given scope, with no effect different from being included only once, except that the
8214 effect of including <assert.h> depends on the definition of NDEBUG (see <a href="#7.2">7.2</a>). If
8215 used, a header shall be included outside of any external declaration or definition, and it
8216 shall first be included before the first reference to any of the functions or objects it
8217 declares, or to any of the types or macros it defines. However, if an identifier is declared
8218 or defined in more than one header, the second and subsequent associated headers may be
8219 included after the initial reference to the identifier. The program shall not have any
8220 macros with names lexically identical to keywords currently defined prior to the
8223 Any definition of an object-like macro described in this clause shall expand to code that is
8224 fully protected by parentheses where necessary, so that it groups in an arbitrary
8225 expression as if it were a single identifier.
8227 Any declaration of a library function shall have external linkage.
8229 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
8230 Forward references: diagnostics (<a href="#7.2">7.2</a>).
8235 <!--page 178 indent 4-->
8238 <p><a name="note159">159)</a> A header is not necessarily a source file, nor are the < and > delimited sequences in header names
8239 necessarily valid source file names.
8242 <a name="7.1.3" href="#7.1.3"><h4>7.1.3 Reserved identifiers</h4></a>
8244 Each header declares or defines all identifiers listed in its associated subclause, and
8245 optionally declares or defines identifiers listed in its associated future library directions
8246 subclause and identifiers which are always reserved either for any use or for use as file
8249 <li> All identifiers that begin with an underscore and either an uppercase letter or another
8250 underscore are always reserved for any use.
8251 <li> All identifiers that begin with an underscore are always reserved for use as identifiers
8252 with file scope in both the ordinary and tag name spaces.
8253 <li> Each macro name in any of the following subclauses (including the future library
8254 directions) is reserved for use as specified if any of its associated headers is included;
8255 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
8256 <li> All identifiers with external linkage in any of the following subclauses (including the
8257 future library directions) are always reserved for use as identifiers with external
8258 linkage.<sup><a href="#note160"><b>160)</b></a></sup>
8259 <li> Each identifier with file scope listed in any of the following subclauses (including the
8260 future library directions) is reserved for use as a macro name and as an identifier with
8261 file scope in the same name space if any of its associated headers is included.
8264 No other identifiers are reserved. If the program declares or defines an identifier in a
8265 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
8266 identifier as a macro name, the behavior is undefined.
8268 If the program removes (with #undef) any macro definition of an identifier in the first
8269 group listed above, the behavior is undefined.
8272 <p><a name="note160">160)</a> The list of reserved identifiers with external linkage includes errno, math_errhandling,
8276 <a name="7.1.4" href="#7.1.4"><h4>7.1.4 Use of library functions</h4></a>
8278 Each of the following statements applies unless explicitly stated otherwise in the detailed
8279 descriptions that follow: If an argument to a function has an invalid value (such as a value
8280 outside the domain of the function, or a pointer outside the address space of the program,
8281 or a null pointer, or a pointer to non-modifiable storage when the corresponding
8282 parameter is not const-qualified) or a type (after promotion) not expected by a function
8283 with variable number of arguments, the behavior is undefined. If a function argument is
8284 described as being an array, the pointer actually passed to the function shall have a value
8285 such that all address computations and accesses to objects (that would be valid if the
8286 pointer did point to the first element of such an array) are in fact valid. Any function
8287 declared in a header may be additionally implemented as a function-like macro defined in
8289 <!--page 179 indent 4-->
8290 the header, so if a library function is declared explicitly when its header is included, one
8291 of the techniques shown below can be used to ensure the declaration is not affected by
8292 such a macro. Any macro definition of a function can be suppressed locally by enclosing
8293 the name of the function in parentheses, because the name is then not followed by the left
8294 parenthesis that indicates expansion of a macro function name. For the same syntactic
8295 reason, it is permitted to take the address of a library function even if it is also defined as
8296 a macro.<sup><a href="#note161"><b>161)</b></a></sup> The use of #undef to remove any macro definition will also ensure that an
8297 actual function is referred to. Any invocation of a library function that is implemented as
8298 a macro shall expand to code that evaluates each of its arguments exactly once, fully
8299 protected by parentheses where necessary, so it is generally safe to use arbitrary
8300 expressions as arguments.<sup><a href="#note162"><b>162)</b></a></sup> Likewise, those function-like macros described in the
8301 following subclauses may be invoked in an expression anywhere a function with a
8302 compatible return type could be called.<sup><a href="#note163"><b>163)</b></a></sup> All object-like macros listed as expanding to
8303 integer constant expressions shall additionally be suitable for use in #if preprocessing
8306 Provided that a library function can be declared without reference to any type defined in a
8307 header, it is also permissible to declare the function and use it without including its
8310 There is a sequence point immediately before a library function returns.
8312 The functions in the standard library are not guaranteed to be reentrant and may modify
8313 objects with static storage duration.<sup><a href="#note164"><b>164)</b></a></sup>
8317 <!--page 180 indent 4-->
8319 EXAMPLE The function atoi may be used in any of several ways:
8321 <li> by use of its associated header (possibly generating a macro expansion)
8323 #include <stdlib.h>
8326 i = atoi(str);</pre>
8327 <li> by use of its associated header (assuredly generating a true function reference)
8329 #include <stdlib.h>
8333 i = atoi(str);</pre>
8336 #include <stdlib.h>
8339 i = (atoi)(str);</pre>
8340 <li> by explicit declaration
8341 <!--page 181 indent 4-->
8343 extern int atoi(const char *);
8346 i = atoi(str);</pre>
8350 <p><a name="note161">161)</a> This means that an implementation shall provide an actual function for each library function, even if it
8351 also provides a macro for that function.
8353 <p><a name="note162">162)</a> Such macros might not contain the sequence points that the corresponding function calls do.
8355 <p><a name="note163">163)</a> Because external identifiers and some macro names beginning with an underscore are reserved,
8356 implementations may provide special semantics for such names. For example, the identifier
8357 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
8358 appropriate header could specify
8361 #define abs(x) _BUILTIN_abs(x)</pre>
8362 for a compiler whose code generator will accept it.
8363 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
8368 whether the implementation's header provides a macro implementation of abs or a built-in
8369 implementation. The prototype for the function, which precedes and is hidden by any macro
8370 definition, is thereby revealed also.
8372 <p><a name="note164">164)</a> Thus, a signal handler cannot, in general, call standard library functions.
8375 <a name="7.2" href="#7.2"><h3>7.2 Diagnostics <assert.h></h3></a>
8377 The header <assert.h> defines the assert macro and refers to another macro,
8380 which is not defined by <assert.h>. If NDEBUG is defined as a macro name at the
8381 point in the source file where <assert.h> is included, the assert macro is defined
8384 #define assert(ignore) ((void)0)</pre>
8385 The assert macro is redefined according to the current state of NDEBUG each time that
8386 <assert.h> is included.
8388 The assert macro shall be implemented as a macro, not as an actual function. If the
8389 macro definition is suppressed in order to access an actual function, the behavior is
8392 <a name="7.2.1" href="#7.2.1"><h4>7.2.1 Program diagnostics</h4></a>
8394 <a name="7.2.1.1" href="#7.2.1.1"><h5>7.2.1.1 The assert macro</h5></a>
8398 #include <assert.h>
8399 void assert(scalar expression);</pre>
8400 <h6>Description</h6>
8402 The assert macro puts diagnostic tests into programs; it expands to a void expression.
8403 When it is executed, if expression (which shall have a scalar type) is false (that is,
8404 compares equal to 0), the assert macro writes information about the particular call that
8405 failed (including the text of the argument, the name of the source file, the source line
8406 number, and the name of the enclosing function -- the latter are respectively the values of
8407 the preprocessing macros __FILE__ and __LINE__ and of the identifier
8408 __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note165"><b>165)</b></a></sup> It
8409 then calls the abort function.
8412 The assert macro returns no value.
8413 Forward references: the abort function (<a href="#7.20.4.1">7.20.4.1</a>).
8418 <!--page 182 indent 4-->
8421 <p><a name="note165">165)</a> The message written might be of the form:
8422 Assertion failed: expression, function abc, file xyz, line nnn.
8425 <a name="7.3" href="#7.3"><h3>7.3 Complex arithmetic <complex.h></h3></a>
8427 <a name="7.3.1" href="#7.3.1"><h4>7.3.1 Introduction</h4></a>
8429 The header <complex.h> defines macros and declares functions that support complex
8430 arithmetic.<sup><a href="#note166"><b>166)</b></a></sup> Each synopsis specifies a family of functions consisting of a principal
8431 function with one or more double complex parameters and a double complex or
8432 double return value; and other functions with the same name but with f and l suffixes
8433 which are corresponding functions with float and long double parameters and
8439 expands to _Complex; the macro
8442 expands to a constant expression of type const float _Complex, with the value of
8443 the imaginary unit.<sup><a href="#note167"><b>167)</b></a></sup>
8451 are defined if and only if the implementation supports imaginary types;<sup><a href="#note168"><b>168)</b></a></sup> if defined,
8452 they expand to _Imaginary and a constant expression of type const float
8453 _Imaginary with the value of the imaginary unit.
8458 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
8459 defined, I shall expand to _Complex_I.
8461 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
8462 redefine the macros complex, imaginary, and I.
8463 Forward references: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
8467 <!--page 183 indent 4-->
8470 <p><a name="note166">166)</a> See ''future library directions'' (<a href="#7.26.1">7.26.1</a>).
8472 <p><a name="note167">167)</a> The imaginary unit is a number i such that i 2 = -1.
8474 <p><a name="note168">168)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
8477 <a name="7.3.2" href="#7.3.2"><h4>7.3.2 Conventions</h4></a>
8479 Values are interpreted as radians, not degrees. An implementation may set errno but is
8482 <a name="7.3.3" href="#7.3.3"><h4>7.3.3 Branch cuts</h4></a>
8484 Some of the functions below have branch cuts, across which the function is
8485 discontinuous. For implementations with a signed zero (including all IEC 60559
8486 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
8487 one side of a cut from another so the function is continuous (except for format
8488 limitations) as the cut is approached from either side. For example, for the square root
8489 function, which has a branch cut along the negative real axis, the top of the cut, with
8490 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
8491 imaginary part -0, maps to the negative imaginary axis.
8493 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
8494 sides of branch cuts. These implementations shall map a cut so the function is continuous
8495 as the cut is approached coming around the finite endpoint of the cut in a counter
8496 clockwise direction. (Branch cuts for the functions specified here have just one finite
8497 endpoint.) For example, for the square root function, coming counter clockwise around
8498 the finite endpoint of the cut along the negative real axis approaches the cut from above,
8499 so the cut maps to the positive imaginary axis.
8501 <a name="7.3.4" href="#7.3.4"><h4>7.3.4 The CX_LIMITED_RANGE pragma</h4></a>
8505 #include <complex.h>
8506 #pragma STDC CX_LIMITED_RANGE on-off-switch</pre>
8507 <h6>Description</h6>
8509 The usual mathematical formulas for complex multiply, divide, and absolute value are
8510 problematic because of their treatment of infinities and because of undue overflow and
8511 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
8512 implementation that (where the state is ''on'') the usual mathematical formulas are
8513 acceptable.<sup><a href="#note169"><b>169)</b></a></sup> The pragma can occur either outside external declarations or preceding all
8514 explicit declarations and statements inside a compound statement. When outside external
8516 <!--page 184 indent 4-->
8517 declarations, the pragma takes effect from its occurrence until another
8518 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
8519 When inside a compound statement, the pragma takes effect from its occurrence until
8520 another CX_LIMITED_RANGE pragma is encountered (including within a nested
8521 compound statement), or until the end of the compound statement; at the end of a
8522 compound statement the state for the pragma is restored to its condition just before the
8523 compound statement. If this pragma is used in any other context, the behavior is
8524 undefined. The default state for the pragma is ''off''.
8527 <p><a name="note169">169)</a> The purpose of the pragma is to allow the implementation to use the formulas:
8530 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
8531 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
8532 | x + iy | = (sqrt) x 2 + y 2
8533 ???????????????</pre>
8534 where the programmer can determine they are safe.
8537 <a name="7.3.5" href="#7.3.5"><h4>7.3.5 Trigonometric functions</h4></a>
8539 <a name="7.3.5.1" href="#7.3.5.1"><h5>7.3.5.1 The cacos functions</h5></a>
8543 #include <complex.h>
8544 double complex cacos(double complex z);
8545 float complex cacosf(float complex z);
8546 long double complex cacosl(long double complex z);</pre>
8547 <h6>Description</h6>
8549 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
8550 interval [-1, +1] along the real axis.
8553 The cacos functions return the complex arc cosine value, in the range of a strip
8554 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
8557 <a name="7.3.5.2" href="#7.3.5.2"><h5>7.3.5.2 The casin functions</h5></a>
8561 #include <complex.h>
8562 double complex casin(double complex z);
8563 float complex casinf(float complex z);
8564 long double complex casinl(long double complex z);</pre>
8565 <h6>Description</h6>
8567 The casin functions compute the complex arc sine of z, with branch cuts outside the
8568 interval [-1, +1] along the real axis.
8571 The casin functions return the complex arc sine value, in the range of a strip
8572 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
8573 along the real axis.
8574 <!--page 185 indent 4-->
8576 <a name="7.3.5.3" href="#7.3.5.3"><h5>7.3.5.3 The catan functions</h5></a>
8580 #include <complex.h>
8581 double complex catan(double complex z);
8582 float complex catanf(float complex z);
8583 long double complex catanl(long double complex z);</pre>
8584 <h6>Description</h6>
8586 The catan functions compute the complex arc tangent of z, with branch cuts outside the
8587 interval [-i, +i] along the imaginary axis.
8590 The catan functions return the complex arc tangent value, in the range of a strip
8591 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
8592 along the real axis.
8594 <a name="7.3.5.4" href="#7.3.5.4"><h5>7.3.5.4 The ccos functions</h5></a>
8598 #include <complex.h>
8599 double complex ccos(double complex z);
8600 float complex ccosf(float complex z);
8601 long double complex ccosl(long double complex z);</pre>
8602 <h6>Description</h6>
8604 The ccos functions compute the complex cosine of z.
8607 The ccos functions return the complex cosine value.
8609 <a name="7.3.5.5" href="#7.3.5.5"><h5>7.3.5.5 The csin functions</h5></a>
8613 #include <complex.h>
8614 double complex csin(double complex z);
8615 float complex csinf(float complex z);
8616 long double complex csinl(long double complex z);</pre>
8617 <h6>Description</h6>
8619 The csin functions compute the complex sine of z.
8622 The csin functions return the complex sine value.
8623 <!--page 186 indent 4-->
8625 <a name="7.3.5.6" href="#7.3.5.6"><h5>7.3.5.6 The ctan functions</h5></a>
8629 #include <complex.h>
8630 double complex ctan(double complex z);
8631 float complex ctanf(float complex z);
8632 long double complex ctanl(long double complex z);</pre>
8633 <h6>Description</h6>
8635 The ctan functions compute the complex tangent of z.
8638 The ctan functions return the complex tangent value.
8640 <a name="7.3.6" href="#7.3.6"><h4>7.3.6 Hyperbolic functions</h4></a>
8642 <a name="7.3.6.1" href="#7.3.6.1"><h5>7.3.6.1 The cacosh functions</h5></a>
8646 #include <complex.h>
8647 double complex cacosh(double complex z);
8648 float complex cacoshf(float complex z);
8649 long double complex cacoshl(long double complex z);</pre>
8650 <h6>Description</h6>
8652 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
8653 cut at values less than 1 along the real axis.
8656 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
8657 half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along
8660 <a name="7.3.6.2" href="#7.3.6.2"><h5>7.3.6.2 The casinh functions</h5></a>
8664 #include <complex.h>
8665 double complex casinh(double complex z);
8666 float complex casinhf(float complex z);
8667 long double complex casinhl(long double complex z);</pre>
8668 <h6>Description</h6>
8670 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
8671 outside the interval [-i, +i] along the imaginary axis.
8672 <!--page 187 indent 4-->
8675 The casinh functions return the complex arc hyperbolic sine value, in the range of a
8676 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
8677 along the imaginary axis.
8679 <a name="7.3.6.3" href="#7.3.6.3"><h5>7.3.6.3 The catanh functions</h5></a>
8683 #include <complex.h>
8684 double complex catanh(double complex z);
8685 float complex catanhf(float complex z);
8686 long double complex catanhl(long double complex z);</pre>
8687 <h6>Description</h6>
8689 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
8690 cuts outside the interval [-1, +1] along the real axis.
8693 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
8694 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
8695 along the imaginary axis.
8697 <a name="7.3.6.4" href="#7.3.6.4"><h5>7.3.6.4 The ccosh functions</h5></a>
8701 #include <complex.h>
8702 double complex ccosh(double complex z);
8703 float complex ccoshf(float complex z);
8704 long double complex ccoshl(long double complex z);</pre>
8705 <h6>Description</h6>
8707 The ccosh functions compute the complex hyperbolic cosine of z.
8710 The ccosh functions return the complex hyperbolic cosine value.
8712 <a name="7.3.6.5" href="#7.3.6.5"><h5>7.3.6.5 The csinh functions</h5></a>
8715 <!--page 188 indent 4-->
8717 #include <complex.h>
8718 double complex csinh(double complex z);
8719 float complex csinhf(float complex z);
8720 long double complex csinhl(long double complex z);</pre>
8721 <h6>Description</h6>
8723 The csinh functions compute the complex hyperbolic sine of z.
8726 The csinh functions return the complex hyperbolic sine value.
8728 <a name="7.3.6.6" href="#7.3.6.6"><h5>7.3.6.6 The ctanh functions</h5></a>
8732 #include <complex.h>
8733 double complex ctanh(double complex z);
8734 float complex ctanhf(float complex z);
8735 long double complex ctanhl(long double complex z);</pre>
8736 <h6>Description</h6>
8738 The ctanh functions compute the complex hyperbolic tangent of z.
8741 The ctanh functions return the complex hyperbolic tangent value.
8743 <a name="7.3.7" href="#7.3.7"><h4>7.3.7 Exponential and logarithmic functions</h4></a>
8745 <a name="7.3.7.1" href="#7.3.7.1"><h5>7.3.7.1 The cexp functions</h5></a>
8749 #include <complex.h>
8750 double complex cexp(double complex z);
8751 float complex cexpf(float complex z);
8752 long double complex cexpl(long double complex z);</pre>
8753 <h6>Description</h6>
8755 The cexp functions compute the complex base-e exponential of z.
8758 The cexp functions return the complex base-e exponential value.
8760 <a name="7.3.7.2" href="#7.3.7.2"><h5>7.3.7.2 The clog functions</h5></a>
8763 <!--page 189 indent 4-->
8765 #include <complex.h>
8766 double complex clog(double complex z);
8767 float complex clogf(float complex z);
8768 long double complex clogl(long double complex z);</pre>
8769 <h6>Description</h6>
8771 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
8772 cut along the negative real axis.
8775 The clog functions return the complex natural logarithm value, in the range of a strip
8776 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
8779 <a name="7.3.8" href="#7.3.8"><h4>7.3.8 Power and absolute-value functions</h4></a>
8781 <a name="7.3.8.1" href="#7.3.8.1"><h5>7.3.8.1 The cabs functions</h5></a>
8785 #include <complex.h>
8786 double cabs(double complex z);
8787 float cabsf(float complex z);
8788 long double cabsl(long double complex z);</pre>
8789 <h6>Description</h6>
8791 The cabs functions compute the complex absolute value (also called norm, modulus, or
8795 The cabs functions return the complex absolute value.
8797 <a name="7.3.8.2" href="#7.3.8.2"><h5>7.3.8.2 The cpow functions</h5></a>
8801 #include <complex.h>
8802 double complex cpow(double complex x, double complex y);
8803 float complex cpowf(float complex x, float complex y);
8804 long double complex cpowl(long double complex x,
8805 long double complex y);</pre>
8806 <h6>Description</h6>
8808 The cpow functions compute the complex power function xy , with a branch cut for the
8809 first parameter along the negative real axis.
8812 The cpow functions return the complex power function value.
8813 <!--page 190 indent 4-->
8815 <a name="7.3.8.3" href="#7.3.8.3"><h5>7.3.8.3 The csqrt functions</h5></a>
8819 #include <complex.h>
8820 double complex csqrt(double complex z);
8821 float complex csqrtf(float complex z);
8822 long double complex csqrtl(long double complex z);</pre>
8823 <h6>Description</h6>
8825 The csqrt functions compute the complex square root of z, with a branch cut along the
8829 The csqrt functions return the complex square root value, in the range of the right half-
8830 plane (including the imaginary axis).
8832 <a name="7.3.9" href="#7.3.9"><h4>7.3.9 Manipulation functions</h4></a>
8834 <a name="7.3.9.1" href="#7.3.9.1"><h5>7.3.9.1 The carg functions</h5></a>
8838 #include <complex.h>
8839 double carg(double complex z);
8840 float cargf(float complex z);
8841 long double cargl(long double complex z);</pre>
8842 <h6>Description</h6>
8844 The carg functions compute the argument (also called phase angle) of z, with a branch
8845 cut along the negative real axis.
8848 The carg functions return the value of the argument in the interval [-pi , +pi ].
8850 <a name="7.3.9.2" href="#7.3.9.2"><h5>7.3.9.2 The cimag functions</h5></a>
8853 <!--page 191 indent 4-->
8855 #include <complex.h>
8856 double cimag(double complex z);
8857 float cimagf(float complex z);
8858 long double cimagl(long double complex z);</pre>
8859 <h6>Description</h6>
8861 The cimag functions compute the imaginary part of z.<sup><a href="#note170"><b>170)</b></a></sup>
8864 The cimag functions return the imaginary part value (as a real).
8867 <p><a name="note170">170)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
8870 <a name="7.3.9.3" href="#7.3.9.3"><h5>7.3.9.3 The conj functions</h5></a>
8874 #include <complex.h>
8875 double complex conj(double complex z);
8876 float complex conjf(float complex z);
8877 long double complex conjl(long double complex z);</pre>
8878 <h6>Description</h6>
8880 The conj functions compute the complex conjugate of z, by reversing the sign of its
8884 The conj functions return the complex conjugate value.
8886 <a name="7.3.9.4" href="#7.3.9.4"><h5>7.3.9.4 The cproj functions</h5></a>
8890 #include <complex.h>
8891 double complex cproj(double complex z);
8892 float complex cprojf(float complex z);
8893 long double complex cprojl(long double complex z);</pre>
8894 <h6>Description</h6>
8896 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
8897 z except that all complex infinities (even those with one infinite part and one NaN part)
8898 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
8901 INFINITY + I * copysign(0.0, cimag(z))</pre>
8904 The cproj functions return the value of the projection onto the Riemann sphere.
8909 <!--page 192 indent 4-->
8911 <a name="7.3.9.5" href="#7.3.9.5"><h5>7.3.9.5 The creal functions</h5></a>
8915 #include <complex.h>
8916 double creal(double complex z);
8917 float crealf(float complex z);
8918 long double creall(long double complex z);</pre>
8919 <h6>Description</h6>
8921 The creal functions compute the real part of z.<sup><a href="#note171"><b>171)</b></a></sup>
8924 The creal functions return the real part value.
8929 <!--page 193 indent 4-->
8932 <p><a name="note171">171)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
8935 <a name="7.4" href="#7.4"><h3>7.4 Character handling <ctype.h></h3></a>
8937 The header <ctype.h> declares several functions useful for classifying and mapping
8938 characters.<sup><a href="#note172"><b>172)</b></a></sup> In all cases the argument is an int, the value of which shall be
8939 representable as an unsigned char or shall equal the value of the macro EOF. If the
8940 argument has any other value, the behavior is undefined.
8942 The behavior of these functions is affected by the current locale. Those functions that
8943 have locale-specific aspects only when not in the "C" locale are noted below.
8945 The term printing character refers to a member of a locale-specific set of characters, each
8946 of which occupies one printing position on a display device; the term control character
8947 refers to a member of a locale-specific set of characters that are not printing
8948 characters.<sup><a href="#note173"><b>173)</b></a></sup> All letters and digits are printing characters.
8949 Forward references: EOF (<a href="#7.19.1">7.19.1</a>), localization (<a href="#7.11">7.11</a>).
8952 <p><a name="note172">172)</a> See ''future library directions'' (<a href="#7.26.2">7.26.2</a>).
8954 <p><a name="note173">173)</a> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
8955 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
8956 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
8959 <a name="7.4.1" href="#7.4.1"><h4>7.4.1 Character classification functions</h4></a>
8961 The functions in this subclause return nonzero (true) if and only if the value of the
8962 argument c conforms to that in the description of the function.
8964 <a name="7.4.1.1" href="#7.4.1.1"><h5>7.4.1.1 The isalnum function</h5></a>
8968 #include <ctype.h>
8969 int isalnum(int c);</pre>
8970 <h6>Description</h6>
8972 The isalnum function tests for any character for which isalpha or isdigit is true.
8974 <a name="7.4.1.2" href="#7.4.1.2"><h5>7.4.1.2 The isalpha function</h5></a>
8978 #include <ctype.h>
8979 int isalpha(int c);</pre>
8980 <h6>Description</h6>
8982 The isalpha function tests for any character for which isupper or islower is true,
8983 or any character that is one of a locale-specific set of alphabetic characters for which
8987 <!--page 194 indent 4-->
8988 none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note174"><b>174)</b></a></sup> In the "C" locale,
8989 isalpha returns true only for the characters for which isupper or islower is true.
8992 <p><a name="note174">174)</a> The functions islower and isupper test true or false separately for each of these additional
8993 characters; all four combinations are possible.
8996 <a name="7.4.1.3" href="#7.4.1.3"><h5>7.4.1.3 The isblank function</h5></a>
9000 #include <ctype.h>
9001 int isblank(int c);</pre>
9002 <h6>Description</h6>
9004 The isblank function tests for any character that is a standard blank character or is one
9005 of a locale-specific set of characters for which isspace is true and that is used to
9006 separate words within a line of text. The standard blank characters are the following:
9007 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
9008 for the standard blank characters.
9010 <a name="7.4.1.4" href="#7.4.1.4"><h5>7.4.1.4 The iscntrl function</h5></a>
9014 #include <ctype.h>
9015 int iscntrl(int c);</pre>
9016 <h6>Description</h6>
9018 The iscntrl function tests for any control character.
9020 <a name="7.4.1.5" href="#7.4.1.5"><h5>7.4.1.5 The isdigit function</h5></a>
9024 #include <ctype.h>
9025 int isdigit(int c);</pre>
9026 <h6>Description</h6>
9028 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
9030 <a name="7.4.1.6" href="#7.4.1.6"><h5>7.4.1.6 The isgraph function</h5></a>
9034 #include <ctype.h>
9035 int isgraph(int c);</pre>
9040 <!--page 195 indent 4-->
9041 <h6>Description</h6>
9043 The isgraph function tests for any printing character except space (' ').
9045 <a name="7.4.1.7" href="#7.4.1.7"><h5>7.4.1.7 The islower function</h5></a>
9049 #include <ctype.h>
9050 int islower(int c);</pre>
9051 <h6>Description</h6>
9053 The islower function tests for any character that is a lowercase letter or is one of a
9054 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
9055 isspace is true. In the "C" locale, islower returns true only for the lowercase
9056 letters (as defined in <a href="#5.2.1">5.2.1</a>).
9058 <a name="7.4.1.8" href="#7.4.1.8"><h5>7.4.1.8 The isprint function</h5></a>
9062 #include <ctype.h>
9063 int isprint(int c);</pre>
9064 <h6>Description</h6>
9066 The isprint function tests for any printing character including space (' ').
9068 <a name="7.4.1.9" href="#7.4.1.9"><h5>7.4.1.9 The ispunct function</h5></a>
9072 #include <ctype.h>
9073 int ispunct(int c);</pre>
9074 <h6>Description</h6>
9076 The ispunct function tests for any printing character that is one of a locale-specific set
9077 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
9078 locale, ispunct returns true for every printing character for which neither isspace
9079 nor isalnum is true.
9081 <a name="7.4.1.10" href="#7.4.1.10"><h5>7.4.1.10 The isspace function</h5></a>
9085 #include <ctype.h>
9086 int isspace(int c);</pre>
9087 <h6>Description</h6>
9089 The isspace function tests for any character that is a standard white-space character or
9090 is one of a locale-specific set of characters for which isalnum is false. The standard
9091 <!--page 196 indent 4-->
9092 white-space characters are the following: space (' '), form feed ('\f'), new-line
9093 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
9094 "C" locale, isspace returns true only for the standard white-space characters.
9096 <a name="7.4.1.11" href="#7.4.1.11"><h5>7.4.1.11 The isupper function</h5></a>
9100 #include <ctype.h>
9101 int isupper(int c);</pre>
9102 <h6>Description</h6>
9104 The isupper function tests for any character that is an uppercase letter or is one of a
9105 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
9106 isspace is true. In the "C" locale, isupper returns true only for the uppercase
9107 letters (as defined in <a href="#5.2.1">5.2.1</a>).
9109 <a name="7.4.1.12" href="#7.4.1.12"><h5>7.4.1.12 The isxdigit function</h5></a>
9113 #include <ctype.h>
9114 int isxdigit(int c);</pre>
9115 <h6>Description</h6>
9117 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
9119 <a name="7.4.2" href="#7.4.2"><h4>7.4.2 Character case mapping functions</h4></a>
9121 <a name="7.4.2.1" href="#7.4.2.1"><h5>7.4.2.1 The tolower function</h5></a>
9125 #include <ctype.h>
9126 int tolower(int c);</pre>
9127 <h6>Description</h6>
9129 The tolower function converts an uppercase letter to a corresponding lowercase letter.
9132 If the argument is a character for which isupper is true and there are one or more
9133 corresponding characters, as specified by the current locale, for which islower is true,
9134 the tolower function returns one of the corresponding characters (always the same one
9135 for any given locale); otherwise, the argument is returned unchanged.
9136 <!--page 197 indent 4-->
9138 <a name="7.4.2.2" href="#7.4.2.2"><h5>7.4.2.2 The toupper function</h5></a>
9142 #include <ctype.h>
9143 int toupper(int c);</pre>
9144 <h6>Description</h6>
9146 The toupper function converts a lowercase letter to a corresponding uppercase letter.
9149 If the argument is a character for which islower is true and there are one or more
9150 corresponding characters, as specified by the current locale, for which isupper is true,
9151 the toupper function returns one of the corresponding characters (always the same one
9152 for any given locale); otherwise, the argument is returned unchanged.
9153 <!--page 198 indent 4-->
9155 <a name="7.5" href="#7.5"><h3>7.5 Errors <errno.h></h3></a>
9157 The header <errno.h> defines several macros, all relating to the reporting of error
9165 which expand to integer constant expressions with type int, distinct positive values, and
9166 which are suitable for use in #if preprocessing directives; and
9169 which expands to a modifiable lvalue<sup><a href="#note175"><b>175)</b></a></sup> that has type int, the value of which is set to a
9170 positive error number by several library functions. It is unspecified whether errno is a
9171 macro or an identifier declared with external linkage. If a macro definition is suppressed
9172 in order to access an actual object, or a program defines an identifier with the name
9173 errno, the behavior is undefined.
9175 The value of errno is zero at program startup, but is never set to zero by any library
9176 function.<sup><a href="#note176"><b>176)</b></a></sup> The value of errno may be set to nonzero by a library function call
9177 whether or not there is an error, provided the use of errno is not documented in the
9178 description of the function in this International Standard.
9180 Additional macro definitions, beginning with E and a digit or E and an uppercase
9181 letter,<sup><a href="#note177"><b>177)</b></a></sup> may also be specified by the implementation.
9186 <!--page 199 indent 4-->
9189 <p><a name="note175">175)</a> The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
9190 resulting from a function call (for example, *errno()).
9192 <p><a name="note176">176)</a> Thus, a program that uses errno for error checking should set it to zero before a library function call,
9193 then inspect it before a subsequent library function call. Of course, a library function can save the
9194 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
9195 value is still zero just before the return.
9197 <p><a name="note177">177)</a> See ''future library directions'' (<a href="#7.26.3">7.26.3</a>).
9200 <a name="7.6" href="#7.6"><h3>7.6 Floating-point environment <fenv.h></h3></a>
9202 The header <fenv.h> declares two types and several macros and functions to provide
9203 access to the floating-point environment. The floating-point environment refers
9204 collectively to any floating-point status flags and control modes supported by the
9205 implementation.<sup><a href="#note178"><b>178)</b></a></sup> A floating-point status flag is a system variable whose value is set
9206 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
9207 of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note179"><b>179)</b></a></sup> A floating-
9208 point control mode is a system variable whose value may be set by the user to affect the
9209 subsequent behavior of floating-point arithmetic.
9211 Certain programming conventions support the intended model of use for the floating-
9212 point environment:<sup><a href="#note180"><b>180)</b></a></sup>
9214 <li> a function call does not alter its caller's floating-point control modes, clear its caller's
9215 floating-point status flags, nor depend on the state of its caller's floating-point status
9216 flags unless the function is so documented;
9217 <li> a function call is assumed to require default floating-point control modes, unless its
9218 documentation promises otherwise;
9219 <li> a function call is assumed to have the potential for raising floating-point exceptions,
9220 unless its documentation promises otherwise.
9226 represents the entire floating-point environment.
9231 represents the floating-point status flags collectively, including any status the
9232 implementation associates with the flags.
9237 <!--page 200 indent 4-->
9246 is defined if and only if the implementation supports the floating-point exception by
9247 means of the functions in 7.6.2.<sup><a href="#note181"><b>181)</b></a></sup> Additional implementation-defined floating-point
9248 exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
9249 be specified by the implementation. The defined macros expand to integer constant
9250 expressions with values such that bitwise ORs of all combinations of the macros result in
9251 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
9252 zero.<sup><a href="#note182"><b>182)</b></a></sup>
9257 is simply the bitwise OR of all floating-point exception macros defined by the
9258 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
9266 is defined if and only if the implementation supports getting and setting the represented
9267 rounding direction by means of the fegetround and fesetround functions.
9268 Additional implementation-defined rounding directions, with macro definitions beginning
9269 with FE_ and an uppercase letter, may also be specified by the implementation. The
9270 defined macros expand to integer constant expressions whose values are distinct
9271 nonnegative values.<sup><a href="#note183"><b>183)</b></a></sup>
9277 <!--page 201 indent 4-->
9280 represents the default floating-point environment -- the one installed at program startup
9282 <li> and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
9284 <fenv.h> functions that manage the floating-point environment.
9286 Additional implementation-defined environments, with macro definitions beginning with
9287 FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
9288 also be specified by the implementation.
9291 <p><a name="note178">178)</a> This header is designed to support the floating-point exception status flags and directed-rounding
9292 control modes required by IEC 60559, and other similar floating-point state information. Also it is
9293 designed to facilitate code portability among all systems.
9295 <p><a name="note179">179)</a> A floating-point status flag is not an object and can be set more than once within an expression.
9297 <p><a name="note180">180)</a> With these conventions, a programmer can safely assume default floating-point control modes (or be
9298 unaware of them). The responsibilities associated with accessing the floating-point environment fall
9299 on the programmer or program that does so explicitly.
9301 <p><a name="note181">181)</a> The implementation supports an exception if there are circumstances where a call to at least one of the
9302 functions in <a href="#7.6.2">7.6.2</a>, using the macro as the appropriate argument, will succeed. It is not necessary for
9303 all the functions to succeed all the time.
9305 <p><a name="note182">182)</a> The macros should be distinct powers of two.
9307 <p><a name="note183">183)</a> Even though the rounding direction macros may expand to constants corresponding to the values of
9308 FLT_ROUNDS, they are not required to do so.
9311 <a name="7.6.1" href="#7.6.1"><h4>7.6.1 The FENV_ACCESS pragma</h4></a>
9315 #include <fenv.h>
9316 #pragma STDC FENV_ACCESS on-off-switch</pre>
9317 <h6>Description</h6>
9319 The FENV_ACCESS pragma provides a means to inform the implementation when a
9320 program might access the floating-point environment to test floating-point status flags or
9321 run under non-default floating-point control modes.<sup><a href="#note184"><b>184)</b></a></sup> The pragma shall occur either
9322 outside external declarations or preceding all explicit declarations and statements inside a
9323 compound statement. When outside external declarations, the pragma takes effect from
9324 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
9325 the translation unit. When inside a compound statement, the pragma takes effect from its
9326 occurrence until another FENV_ACCESS pragma is encountered (including within a
9327 nested compound statement), or until the end of the compound statement; at the end of a
9328 compound statement the state for the pragma is restored to its condition just before the
9329 compound statement. If this pragma is used in any other context, the behavior is
9330 undefined. If part of a program tests floating-point status flags, sets floating-point control
9331 modes, or runs under non-default mode settings, but was translated with the state for the
9332 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
9333 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
9334 the program translated with FENV_ACCESS ''off'' to a part translated with
9335 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
9336 floating-point control modes have their default settings.)
9341 <!--page 202 indent 4-->
9346 #include <fenv.h>
9349 #pragma STDC FENV_ACCESS ON
9357 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
9358 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
9359 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note185"><b>185)</b></a></sup>
9363 <p><a name="note184">184)</a> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
9364 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
9365 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
9366 modes are in effect and the flags are not tested.
9368 <p><a name="note185">185)</a> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
9369 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
9370 ''off'', just one evaluation of x + 1 would suffice.
9373 <a name="7.6.2" href="#7.6.2"><h4>7.6.2 Floating-point exceptions</h4></a>
9375 The following functions provide access to the floating-point status flags.<sup><a href="#note186"><b>186)</b></a></sup> The int
9376 input argument for the functions represents a subset of floating-point exceptions, and can
9377 be zero or the bitwise OR of one or more floating-point exception macros, for example
9378 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
9379 functions is undefined.
9382 <p><a name="note186">186)</a> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
9383 abstraction of flags that are either set or clear. An implementation may endow floating-point status
9384 flags with more information -- for example, the address of the code which first raised the floating-
9385 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
9389 <a name="7.6.2.1" href="#7.6.2.1"><h5>7.6.2.1 The feclearexcept function</h5></a>
9393 #include <fenv.h>
9394 int feclearexcept(int excepts);</pre>
9395 <h6>Description</h6>
9397 The feclearexcept function attempts to clear the supported floating-point exceptions
9398 represented by its argument.
9401 The feclearexcept function returns zero if the excepts argument is zero or if all
9402 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
9405 <!--page 203 indent 4-->
9407 <a name="7.6.2.2" href="#7.6.2.2"><h5>7.6.2.2 The fegetexceptflag function</h5></a>
9411 #include <fenv.h>
9412 int fegetexceptflag(fexcept_t *flagp,
9414 <h6>Description</h6>
9416 The fegetexceptflag function attempts to store an implementation-defined
9417 representation of the states of the floating-point status flags indicated by the argument
9418 excepts in the object pointed to by the argument flagp.
9421 The fegetexceptflag function returns zero if the representation was successfully
9422 stored. Otherwise, it returns a nonzero value.
9424 <a name="7.6.2.3" href="#7.6.2.3"><h5>7.6.2.3 The feraiseexcept function</h5></a>
9428 #include <fenv.h>
9429 int feraiseexcept(int excepts);</pre>
9430 <h6>Description</h6>
9432 The feraiseexcept function attempts to raise the supported floating-point exceptions
9433 represented by its argument.<sup><a href="#note187"><b>187)</b></a></sup> The order in which these floating-point exceptions are
9434 raised is unspecified, except as stated in <a href="#F.7.6">F.7.6</a>. Whether the feraiseexcept function
9435 additionally raises the ''inexact'' floating-point exception whenever it raises the
9436 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
9439 The feraiseexcept function returns zero if the excepts argument is zero or if all
9440 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
9445 <!--page 204 indent 4-->
9448 <p><a name="note187">187)</a> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
9449 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
9450 in <a href="#F.7.6">F.7.6</a> is in the same spirit.
9453 <a name="7.6.2.4" href="#7.6.2.4"><h5>7.6.2.4 The fesetexceptflag function</h5></a>
9457 #include <fenv.h>
9458 int fesetexceptflag(const fexcept_t *flagp,
9460 <h6>Description</h6>
9462 The fesetexceptflag function attempts to set the floating-point status flags
9463 indicated by the argument excepts to the states stored in the object pointed to by
9464 flagp. The value of *flagp shall have been set by a previous call to
9465 fegetexceptflag whose second argument represented at least those floating-point
9466 exceptions represented by the argument excepts. This function does not raise floating-
9467 point exceptions, but only sets the state of the flags.
9470 The fesetexceptflag function returns zero if the excepts argument is zero or if
9471 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
9474 <a name="7.6.2.5" href="#7.6.2.5"><h5>7.6.2.5 The fetestexcept function</h5></a>
9478 #include <fenv.h>
9479 int fetestexcept(int excepts);</pre>
9480 <h6>Description</h6>
9482 The fetestexcept function determines which of a specified subset of the floating-
9483 point exception flags are currently set. The excepts argument specifies the floating-
9484 point status flags to be queried.<sup><a href="#note188"><b>188)</b></a></sup>
9487 The fetestexcept function returns the value of the bitwise OR of the floating-point
9488 exception macros corresponding to the currently set floating-point exceptions included in
9491 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
9496 <!--page 205 indent 4-->
9498 #include <fenv.h>
9501 #pragma STDC FENV_ACCESS ON
9503 feclearexcept(FE_INVALID | FE_OVERFLOW);
9504 // maybe raise exceptions
9505 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
9506 if (set_excepts & FE_INVALID) f();
9507 if (set_excepts & FE_OVERFLOW) g();
9513 <p><a name="note188">188)</a> This mechanism allows testing several floating-point exceptions with just one function call.
9516 <a name="7.6.3" href="#7.6.3"><h4>7.6.3 Rounding</h4></a>
9518 The fegetround and fesetround functions provide control of rounding direction
9521 <a name="7.6.3.1" href="#7.6.3.1"><h5>7.6.3.1 The fegetround function</h5></a>
9525 #include <fenv.h>
9526 int fegetround(void);</pre>
9527 <h6>Description</h6>
9529 The fegetround function gets the current rounding direction.
9532 The fegetround function returns the value of the rounding direction macro
9533 representing the current rounding direction or a negative value if there is no such
9534 rounding direction macro or the current rounding direction is not determinable.
9536 <a name="7.6.3.2" href="#7.6.3.2"><h5>7.6.3.2 The fesetround function</h5></a>
9540 #include <fenv.h>
9541 int fesetround(int round);</pre>
9542 <h6>Description</h6>
9544 The fesetround function establishes the rounding direction represented by its
9545 argument round. If the argument is not equal to the value of a rounding direction macro,
9546 the rounding direction is not changed.
9549 The fesetround function returns zero if and only if the requested rounding direction
9551 <!--page 206 indent 4-->
9553 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
9554 rounding direction fails.
9556 #include <fenv.h>
9557 #include <assert.h>
9558 void f(int round_dir)
9560 #pragma STDC FENV_ACCESS ON
9563 save_round = fegetround();
9564 setround_ok = fesetround(round_dir);
9565 assert(setround_ok == 0);
9567 fesetround(save_round);
9572 <a name="7.6.4" href="#7.6.4"><h4>7.6.4 Environment</h4></a>
9574 The functions in this section manage the floating-point environment -- status flags and
9575 control modes -- as one entity.
9577 <a name="7.6.4.1" href="#7.6.4.1"><h5>7.6.4.1 The fegetenv function</h5></a>
9581 #include <fenv.h>
9582 int fegetenv(fenv_t *envp);</pre>
9583 <h6>Description</h6>
9585 The fegetenv function attempts to store the current floating-point environment in the
9586 object pointed to by envp.
9589 The fegetenv function returns zero if the environment was successfully stored.
9590 Otherwise, it returns a nonzero value.
9592 <a name="7.6.4.2" href="#7.6.4.2"><h5>7.6.4.2 The feholdexcept function</h5></a>
9596 #include <fenv.h>
9597 int feholdexcept(fenv_t *envp);</pre>
9598 <h6>Description</h6>
9600 The feholdexcept function saves the current floating-point environment in the object
9601 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
9602 (continue on floating-point exceptions) mode, if available, for all floating-point
9603 exceptions.<sup><a href="#note189"><b>189)</b></a></sup>
9604 <!--page 207 indent 4-->
9607 The feholdexcept function returns zero if and only if non-stop floating-point
9608 exception handling was successfully installed.
9611 <p><a name="note189">189)</a> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
9612 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
9613 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
9614 function to write routines that hide spurious floating-point exceptions from their callers.
9617 <a name="7.6.4.3" href="#7.6.4.3"><h5>7.6.4.3 The fesetenv function</h5></a>
9621 #include <fenv.h>
9622 int fesetenv(const fenv_t *envp);</pre>
9623 <h6>Description</h6>
9625 The fesetenv function attempts to establish the floating-point environment represented
9626 by the object pointed to by envp. The argument envp shall point to an object set by a
9627 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
9628 Note that fesetenv merely installs the state of the floating-point status flags
9629 represented through its argument, and does not raise these floating-point exceptions.
9632 The fesetenv function returns zero if the environment was successfully established.
9633 Otherwise, it returns a nonzero value.
9635 <a name="7.6.4.4" href="#7.6.4.4"><h5>7.6.4.4 The feupdateenv function</h5></a>
9639 #include <fenv.h>
9640 int feupdateenv(const fenv_t *envp);</pre>
9641 <h6>Description</h6>
9643 The feupdateenv function attempts to save the currently raised floating-point
9644 exceptions in its automatic storage, install the floating-point environment represented by
9645 the object pointed to by envp, and then raise the saved floating-point exceptions. The
9646 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
9647 or equal a floating-point environment macro.
9650 The feupdateenv function returns zero if all the actions were successfully carried out.
9651 Otherwise, it returns a nonzero value.
9656 <!--page 208 indent 4-->
9658 EXAMPLE Hide spurious underflow floating-point exceptions:
9659 <!--page 209 indent 4-->
9661 #include <fenv.h>
9664 #pragma STDC FENV_ACCESS ON
9667 if (feholdexcept(&save_env))
9668 return /* indication of an environmental problem */;
9670 if (/* test spurious underflow */)
9671 if (feclearexcept(FE_UNDERFLOW))
9672 return /* indication of an environmental problem */;
9673 if (feupdateenv(&save_env))
9674 return /* indication of an environmental problem */;
9678 <a name="7.7" href="#7.7"><h3>7.7 Characteristics of floating types <float.h></h3></a>
9680 The header <float.h> defines several macros that expand to various limits and
9681 parameters of the standard floating-point types.
9683 The macros, their meanings, and the constraints (or restrictions) on their values are listed
9684 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
9685 <!--page 210 indent 4-->
9687 <a name="7.8" href="#7.8"><h3>7.8 Format conversion of integer types <inttypes.h></h3></a>
9689 The header <inttypes.h> includes the header <stdint.h> and extends it with
9690 additional facilities provided by hosted implementations.
9692 It declares functions for manipulating greatest-width integers and converting numeric
9693 character strings to greatest-width integers, and it declares the type
9696 which is a structure type that is the type of the value returned by the imaxdiv function.
9697 For each type declared in <stdint.h>, it defines corresponding macros for conversion
9698 specifiers for use with the formatted input/output functions.<sup><a href="#note190"><b>190)</b></a></sup>
9699 Forward references: integer types <stdint.h> (<a href="#7.18">7.18</a>), formatted input/output
9700 functions (<a href="#7.19.6">7.19.6</a>), formatted wide character input/output functions (<a href="#7.24.2">7.24.2</a>).
9703 <p><a name="note190">190)</a> See ''future library directions'' (<a href="#7.26.4">7.26.4</a>).
9706 <a name="7.8.1" href="#7.8.1"><h4>7.8.1 Macros for format specifiers</h4></a>
9708 Each of the following object-like macros<sup><a href="#note191"><b>191)</b></a></sup> expands to a character string literal
9709 containing a conversion specifier, possibly modified by a length modifier, suitable for use
9710 within the format argument of a formatted input/output function when converting the
9711 corresponding integer type. These macro names have the general form of PRI (character
9712 string literals for the fprintf and fwprintf family) or SCN (character string literals
9713 for the fscanf and fwscanf family),<sup><a href="#note192"><b>192)</b></a></sup> followed by the conversion specifier,
9714 followed by a name corresponding to a similar type name in <a href="#7.18.1">7.18.1</a>. In these names, N
9715 represents the width of the type as described in <a href="#7.18.1">7.18.1</a>. For example, PRIdFAST32 can
9716 be used in a format string to print the value of an integer of type int_fast32_t.
9718 The fprintf macros for signed integers are:
9720 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
9721 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR</pre>
9726 <!--page 211 indent 4-->
9728 The fprintf macros for unsigned integers are:
9731 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
9732 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
9733 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
9734 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR</pre>
9735 The fscanf macros for signed integers are:
9738 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
9739 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR</pre>
9740 The fscanf macros for unsigned integers are:
9743 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
9744 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
9745 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR</pre>
9746 For each type that the implementation provides in <stdint.h>, the corresponding
9747 fprintf macros shall be defined and the corresponding fscanf macros shall be
9748 defined unless the implementation does not have a suitable fscanf length modifier for
9753 #include <inttypes.h>
9754 #include <wchar.h>
9757 uintmax_t i = UINTMAX_MAX; // this type always exists
9758 wprintf(L"The largest integer value is %020"
9765 <p><a name="note191">191)</a> C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined
9766 before <inttypes.h> is included.
9768 <p><a name="note192">192)</a> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
9769 different format specifiers may be required for fprintf and fscanf, even when the type is the
9773 <a name="7.8.2" href="#7.8.2"><h4>7.8.2 Functions for greatest-width integer types</h4></a>
9775 <a name="7.8.2.1" href="#7.8.2.1"><h5>7.8.2.1 The imaxabs function</h5></a>
9779 #include <inttypes.h>
9780 intmax_t imaxabs(intmax_t j);</pre>
9781 <h6>Description</h6>
9783 The imaxabs function computes the absolute value of an integer j. If the result cannot
9784 be represented, the behavior is undefined.<sup><a href="#note193"><b>193)</b></a></sup>
9788 <!--page 212 indent 4-->
9791 The imaxabs function returns the absolute value.
9794 <p><a name="note193">193)</a> The absolute value of the most negative number cannot be represented in two's complement.
9797 <a name="7.8.2.2" href="#7.8.2.2"><h5>7.8.2.2 The imaxdiv function</h5></a>
9801 #include <inttypes.h>
9802 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);</pre>
9803 <h6>Description</h6>
9805 The imaxdiv function computes numer / denom and numer % denom in a single
9809 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
9810 quotient and the remainder. The structure shall contain (in either order) the members
9811 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
9812 either part of the result cannot be represented, the behavior is undefined.
9814 <a name="7.8.2.3" href="#7.8.2.3"><h5>7.8.2.3 The strtoimax and strtoumax functions</h5></a>
9818 #include <inttypes.h>
9819 intmax_t strtoimax(const char * restrict nptr,
9820 char ** restrict endptr, int base);
9821 uintmax_t strtoumax(const char * restrict nptr,
9822 char ** restrict endptr, int base);</pre>
9823 <h6>Description</h6>
9825 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
9826 strtoul, and strtoull functions, except that the initial portion of the string is
9827 converted to intmax_t and uintmax_t representation, respectively.
9830 The strtoimax and strtoumax functions return the converted value, if any. If no
9831 conversion could be performed, zero is returned. If the correct value is outside the range
9832 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
9833 (according to the return type and sign of the value, if any), and the value of the macro
9834 ERANGE is stored in errno.
9835 Forward references: the strtol, strtoll, strtoul, and strtoull functions
9836 (<a href="#7.20.1.4">7.20.1.4</a>).
9837 <!--page 213 indent 4-->
9839 <a name="7.8.2.4" href="#7.8.2.4"><h5>7.8.2.4 The wcstoimax and wcstoumax functions</h5></a>
9843 #include <stddef.h> // for wchar_t
9844 #include <inttypes.h>
9845 intmax_t wcstoimax(const wchar_t * restrict nptr,
9846 wchar_t ** restrict endptr, int base);
9847 uintmax_t wcstoumax(const wchar_t * restrict nptr,
9848 wchar_t ** restrict endptr, int base);</pre>
9849 <h6>Description</h6>
9851 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
9852 wcstoul, and wcstoull functions except that the initial portion of the wide string is
9853 converted to intmax_t and uintmax_t representation, respectively.
9856 The wcstoimax function returns the converted value, if any. If no conversion could be
9857 performed, zero is returned. If the correct value is outside the range of representable
9858 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
9859 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
9861 Forward references: the wcstol, wcstoll, wcstoul, and wcstoull functions
9862 (<a href="#7.24.4.1.2">7.24.4.1.2</a>).
9863 <!--page 214 indent 4-->
9865 <a name="7.9" href="#7.9"><h3>7.9 Alternative spellings <iso646.h></h3></a>
9867 The header <iso646.h> defines the following eleven macros (on the left) that expand
9868 to the corresponding tokens (on the right):
9869 <!--page 215 indent 4-->
9883 <a name="7.10" href="#7.10"><h3>7.10 Sizes of integer types <limits.h></h3></a>
9885 The header <limits.h> defines several macros that expand to various limits and
9886 parameters of the standard integer types.
9888 The macros, their meanings, and the constraints (or restrictions) on their values are listed
9889 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
9890 <!--page 216 indent 4-->
9892 <a name="7.11" href="#7.11"><h3>7.11 Localization <locale.h></h3></a>
9894 The header <locale.h> declares two functions, one type, and defines several macros.
9899 which contains members related to the formatting of numeric values. The structure shall
9900 contain at least the following members, in any order. The semantics of the members and
9901 their normal ranges are explained in <a href="#7.11.2.1">7.11.2.1</a>. In the "C" locale, the members shall have
9902 the values specified in the comments.
9903 <!--page 217 indent 4-->
9906 char *decimal_point; // "."
9907 char *thousands_sep; // ""
9908 char *grouping; // ""
9909 char *mon_decimal_point; // ""
9910 char *mon_thousands_sep; // ""
9911 char *mon_grouping; // ""
9912 char *positive_sign; // ""
9913 char *negative_sign; // ""
9914 char *currency_symbol; // ""
9915 char frac_digits; // CHAR_MAX
9916 char p_cs_precedes; // CHAR_MAX
9917 char n_cs_precedes; // CHAR_MAX
9918 char p_sep_by_space; // CHAR_MAX
9919 char n_sep_by_space; // CHAR_MAX
9920 char p_sign_posn; // CHAR_MAX
9921 char n_sign_posn; // CHAR_MAX
9922 char *int_curr_symbol; // ""
9923 char int_frac_digits; // CHAR_MAX
9924 char int_p_cs_precedes; // CHAR_MAX
9925 char int_n_cs_precedes; // CHAR_MAX
9926 char int_p_sep_by_space; // CHAR_MAX
9927 char int_n_sep_by_space; // CHAR_MAX
9928 char int_p_sign_posn; // CHAR_MAX
9929 char int_n_sign_posn; // CHAR_MAX</pre>
9930 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
9938 which expand to integer constant expressions with distinct values, suitable for use as the
9939 first argument to the setlocale function.<sup><a href="#note194"><b>194)</b></a></sup> Additional macro definitions, beginning
9940 with the characters LC_ and an uppercase letter,<sup><a href="#note195"><b>195)</b></a></sup> may also be specified by the
9944 <p><a name="note194">194)</a> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
9946 <p><a name="note195">195)</a> See ''future library directions'' (<a href="#7.26.5">7.26.5</a>).
9949 <a name="7.11.1" href="#7.11.1"><h4>7.11.1 Locale control</h4></a>
9951 <a name="7.11.1.1" href="#7.11.1.1"><h5>7.11.1.1 The setlocale function</h5></a>
9955 #include <locale.h>
9956 char *setlocale(int category, const char *locale);</pre>
9957 <h6>Description</h6>
9959 The setlocale function selects the appropriate portion of the program's locale as
9960 specified by the category and locale arguments. The setlocale function may be
9961 used to change or query the program's entire current locale or portions thereof. The value
9962 LC_ALL for category names the program's entire locale; the other values for
9963 category name only a portion of the program's locale. LC_COLLATE affects the
9964 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
9965 the character handling functions<sup><a href="#note196"><b>196)</b></a></sup> and the multibyte and wide character functions.
9966 LC_MONETARY affects the monetary formatting information returned by the
9967 localeconv function. LC_NUMERIC affects the decimal-point character for the
9968 formatted input/output functions and the string conversion functions, as well as the
9969 nonmonetary formatting information returned by the localeconv function. LC_TIME
9970 affects the behavior of the strftime and wcsftime functions.
9972 A value of "C" for locale specifies the minimal environment for C translation; a value
9973 of "" for locale specifies the locale-specific native environment. Other
9974 implementation-defined strings may be passed as the second argument to setlocale.
9976 <!--page 218 indent 4-->
9978 At program startup, the equivalent of
9980 setlocale(LC_ALL, "C");</pre>
9983 The implementation shall behave as if no library function calls the setlocale function.
9986 If a pointer to a string is given for locale and the selection can be honored, the
9987 setlocale function returns a pointer to the string associated with the specified
9988 category for the new locale. If the selection cannot be honored, the setlocale
9989 function returns a null pointer and the program's locale is not changed.
9991 A null pointer for locale causes the setlocale function to return a pointer to the
9992 string associated with the category for the program's current locale; the program's
9993 locale is not changed.<sup><a href="#note197"><b>197)</b></a></sup>
9995 The pointer to string returned by the setlocale function is such that a subsequent call
9996 with that string value and its associated category will restore that part of the program's
9997 locale. The string pointed to shall not be modified by the program, but may be
9998 overwritten by a subsequent call to the setlocale function.
9999 Forward references: formatted input/output functions (<a href="#7.19.6">7.19.6</a>), multibyte/wide
10000 character conversion functions (<a href="#7.20.7">7.20.7</a>), multibyte/wide string conversion functions
10001 (<a href="#7.20.8">7.20.8</a>), numeric conversion functions (<a href="#7.20.1">7.20.1</a>), the strcoll function (<a href="#7.21.4.3">7.21.4.3</a>), the
10002 strftime function (<a href="#7.23.3.5">7.23.3.5</a>), the strxfrm function (<a href="#7.21.4.5">7.21.4.5</a>).
10005 <p><a name="note196">196)</a> The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
10008 <p><a name="note197">197)</a> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
10009 locale when category has the value LC_ALL.
10012 <a name="7.11.2" href="#7.11.2"><h4>7.11.2 Numeric formatting convention inquiry</h4></a>
10014 <a name="7.11.2.1" href="#7.11.2.1"><h5>7.11.2.1 The localeconv function</h5></a>
10018 #include <locale.h>
10019 struct lconv *localeconv(void);</pre>
10020 <h6>Description</h6>
10022 The localeconv function sets the components of an object with type struct lconv
10023 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
10024 according to the rules of the current locale.
10026 The members of the structure with type char * are pointers to strings, any of which
10027 (except decimal_point) can point to "", to indicate that the value is not available in
10028 the current locale or is of zero length. Apart from grouping and mon_grouping, the
10030 <!--page 219 indent 0-->
10031 strings shall start and end in the initial shift state. The members with type char are
10032 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
10033 available in the current locale. The members include the following:
10034 char *decimal_point
10036 The decimal-point character used to format nonmonetary quantities.</pre>
10037 char *thousands_sep
10039 The character used to separate groups of digits before the decimal-point
10040 character in formatted nonmonetary quantities.</pre>
10043 A string whose elements indicate the size of each group of digits in
10044 formatted nonmonetary quantities.</pre>
10045 char *mon_decimal_point
10047 The decimal-point used to format monetary quantities.</pre>
10048 char *mon_thousands_sep
10050 The separator for groups of digits before the decimal-point in formatted
10051 monetary quantities.</pre>
10054 A string whose elements indicate the size of each group of digits in
10055 formatted monetary quantities.</pre>
10056 char *positive_sign
10058 The string used to indicate a nonnegative-valued formatted monetary
10060 char *negative_sign
10062 The string used to indicate a negative-valued formatted monetary quantity.</pre>
10063 char *currency_symbol
10065 The local currency symbol applicable to the current locale.</pre>
10068 The number of fractional digits (those after the decimal-point) to be
10069 displayed in a locally formatted monetary quantity.</pre>
10072 Set to 1 or 0 if the currency_symbol respectively precedes or
10073 succeeds the value for a nonnegative locally formatted monetary quantity.</pre>
10075 <!--page 220 indent 0-->
10077 Set to 1 or 0 if the currency_symbol respectively precedes or
10078 succeeds the value for a negative locally formatted monetary quantity.</pre>
10079 char p_sep_by_space
10081 Set to a value indicating the separation of the currency_symbol, the
10082 sign string, and the value for a nonnegative locally formatted monetary
10084 char n_sep_by_space
10086 Set to a value indicating the separation of the currency_symbol, the
10087 sign string, and the value for a negative locally formatted monetary
10091 Set to a value indicating the positioning of the positive_sign for a
10092 nonnegative locally formatted monetary quantity.</pre>
10095 Set to a value indicating the positioning of the negative_sign for a
10096 negative locally formatted monetary quantity.</pre>
10097 char *int_curr_symbol
10099 The international currency symbol applicable to the current locale. The
10100 first three characters contain the alphabetic international currency symbol
10101 in accordance with those specified in ISO 4217. The fourth character
10102 (immediately preceding the null character) is the character used to separate
10103 the international currency symbol from the monetary quantity.</pre>
10104 char int_frac_digits
10106 The number of fractional digits (those after the decimal-point) to be
10107 displayed in an internationally formatted monetary quantity.</pre>
10108 char int_p_cs_precedes
10110 Set to 1 or 0 if the int_curr_symbol respectively precedes or
10111 succeeds the value for a nonnegative internationally formatted monetary
10113 char int_n_cs_precedes
10115 Set to 1 or 0 if the int_curr_symbol respectively precedes or
10116 succeeds the value for a negative internationally formatted monetary
10118 char int_p_sep_by_space
10119 <!--page 221 indent 4-->
10121 Set to a value indicating the separation of the int_curr_symbol, the
10122 sign string, and the value for a nonnegative internationally formatted
10123 monetary quantity.</pre>
10124 char int_n_sep_by_space
10126 Set to a value indicating the separation of the int_curr_symbol, the
10127 sign string, and the value for a negative internationally formatted monetary
10129 char int_p_sign_posn
10131 Set to a value indicating the positioning of the positive_sign for a
10132 nonnegative internationally formatted monetary quantity.</pre>
10133 char int_n_sign_posn
10136 Set to a value indicating the positioning of the negative_sign for a
10137 negative internationally formatted monetary quantity.</pre>
10138 The elements of grouping and mon_grouping are interpreted according to the
10140 CHAR_MAX No further grouping is to be performed.
10141 0 The previous element is to be repeatedly used for the remainder of the
10144 other The integer value is the number of digits that compose the current group.
10147 The next element is examined to determine the size of the next group of
10148 digits before the current group.</pre>
10149 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
10150 and int_n_sep_by_space are interpreted according to the following:
10151 0 No space separates the currency symbol and value.
10152 1 If the currency symbol and sign string are adjacent, a space separates them from the
10154 value; otherwise, a space separates the currency symbol from the value.</pre>
10155 2 If the currency symbol and sign string are adjacent, a space separates them;
10157 otherwise, a space separates the sign string from the value.</pre>
10158 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
10159 int_curr_symbol is used instead of a space.
10161 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
10162 int_n_sign_posn are interpreted according to the following:
10163 0 Parentheses surround the quantity and currency symbol.
10164 1 The sign string precedes the quantity and currency symbol.
10165 2 The sign string succeeds the quantity and currency symbol.
10166 3 The sign string immediately precedes the currency symbol.
10167 4 The sign string immediately succeeds the currency symbol.
10168 <!--page 222 indent 5-->
10170 The implementation shall behave as if no library function calls the localeconv
10174 The localeconv function returns a pointer to the filled-in object. The structure
10175 pointed to by the return value shall not be modified by the program, but may be
10176 overwritten by a subsequent call to the localeconv function. In addition, calls to the
10177 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
10178 overwrite the contents of the structure.
10180 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
10181 monetary quantities.
10183 Local format International format</pre>
10185 Country Positive Negative Positive Negative
10187 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
10188 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
10189 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
10190 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
10192 For these four countries, the respective values for the monetary members of the structure returned by
10193 localeconv could be:
10195 Country1 Country2 Country3 Country4</pre>
10197 mon_decimal_point "," "" "," "."
10198 mon_thousands_sep "." "." "." ","
10199 mon_grouping "\3" "\3" "\3" "\3"
10200 positive_sign "" "" "" ""
10201 negative_sign "-" "-" "-" "C"
10202 currency_symbol "mk" "L." "\u0192" "SFrs."
10203 frac_digits 2 0 2 2
10204 p_cs_precedes 0 1 1 1
10205 n_cs_precedes 0 1 1 1
10206 p_sep_by_space 1 0 1 0
10207 n_sep_by_space 1 0 2 0
10208 p_sign_posn 1 1 1 1
10209 n_sign_posn 1 1 4 2
10210 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
10211 int_frac_digits 2 0 2 2
10212 int_p_cs_precedes 1 1 1 1
10213 int_n_cs_precedes 1 1 1 1
10214 int_p_sep_by_space 1 1 1 1
10215 int_n_sep_by_space 2 1 2 1
10216 int_p_sign_posn 1 1 1 1
10217 int_n_sign_posn 4 1 4 2
10218 <!--page 223 indent 5-->
10220 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
10221 affect the formatted value.
10223 p_sep_by_space</pre>
10225 p_cs_precedes p_sign_posn 0 1 2
10228 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
10229 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
10230 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
10231 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
10232 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +</pre>
10234 <!--page 224 indent 4-->
10236 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
10237 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
10238 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
10239 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
10240 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25</pre>
10242 <a name="7.12" href="#7.12"><h3>7.12 Mathematics <math.h></h3></a>
10244 The header <math.h> declares two types and many mathematical functions and defines
10245 several macros. Most synopses specify a family of functions consisting of a principal
10246 function with one or more double parameters, a double return value, or both; and
10247 other functions with the same name but with f and l suffixes, which are corresponding
10248 functions with float and long double parameters, return values, or both.<sup><a href="#note198"><b>198)</b></a></sup>
10249 Integer arithmetic functions and conversion functions are discussed later.
10255 are floating types at least as wide as float and double, respectively, and such that
10256 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
10257 float_t and double_t are float and double, respectively; if
10258 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
10259 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
10260 otherwise implementation-defined.<sup><a href="#note199"><b>199)</b></a></sup>
10265 expands to a positive double constant expression, not necessarily representable as a
10270 are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note200"><b>200)</b></a></sup>
10275 expands to a constant expression of type float representing positive or unsigned
10276 infinity, if available; else to a positive constant of type float that overflows at
10280 <!--page 225 indent 4-->
10281 translation time.<sup><a href="#note201"><b>201)</b></a></sup>
10286 is defined if and only if the implementation supports quiet NaNs for the float type. It
10287 expands to a constant expression of type float representing a quiet NaN.
10289 The number classification macros
10296 represent the mutually exclusive kinds of floating-point values. They expand to integer
10297 constant expressions with distinct values. Additional implementation-defined floating-
10298 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
10299 may also be specified by the implementation.
10304 is optionally defined. If defined, it indicates that the fma function generally executes
10305 about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note202"><b>202)</b></a></sup> The
10310 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
10311 these macros expand to the integer constant 1.
10317 expand to integer constant expressions whose values are returned by ilogb(x) if x is
10318 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
10319 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
10322 <!--page 226 indent 4-->
10327 MATH_ERREXCEPT</pre>
10328 expand to the integer constants 1 and 2, respectively; the macro
10330 math_errhandling</pre>
10331 expands to an expression that has type int and the value MATH_ERRNO,
10332 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
10333 constant for the duration of the program. It is unspecified whether
10334 math_errhandling is a macro or an identifier with external linkage. If a macro
10335 definition is suppressed or a program defines an identifier with the name
10336 math_errhandling, the behavior is undefined. If the expression
10337 math_errhandling & MATH_ERREXCEPT can be nonzero, the implementation
10338 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
10342 <p><a name="note198">198)</a> Particularly on systems with wide expression evaluation, a <math.h> function might pass arguments
10343 and return values in wider format than the synopsis prototype indicates.
10345 <p><a name="note199">199)</a> The types float_t and double_t are intended to be the implementation's most efficient types at
10346 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
10347 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
10349 <p><a name="note200">200)</a> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
10350 supports infinities.
10352 <p><a name="note201">201)</a> In this case, using INFINITY will violate the constraint in <a href="#6.4.4">6.4.4</a> and thus require a diagnostic.
10354 <p><a name="note202">202)</a> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
10355 directly with a hardware multiply-add instruction. Software implementations are expected to be
10356 substantially slower.
10359 <a name="7.12.1" href="#7.12.1"><h4>7.12.1 Treatment of error conditions</h4></a>
10361 The behavior of each of the functions in <math.h> is specified for all representable
10362 values of its input arguments, except where stated otherwise. Each function shall execute
10363 as if it were a single operation without generating any externally visible exceptional
10366 For all functions, a domain error occurs if an input argument is outside the domain over
10367 which the mathematical function is defined. The description of each function lists any
10368 required domain errors; an implementation may define additional domain errors, provided
10369 that such errors are consistent with the mathematical definition of the function.<sup><a href="#note203"><b>203)</b></a></sup> On a
10370 domain error, the function returns an implementation-defined value; if the integer
10371 expression math_errhandling & MATH_ERRNO is nonzero, the integer expression
10372 errno acquires the value EDOM; if the integer expression math_errhandling &
10373 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
10375 Similarly, a range error occurs if the mathematical result of the function cannot be
10376 represented in an object of the specified type, due to extreme magnitude.
10378 A floating result overflows if the magnitude of the mathematical result is finite but so
10379 large that the mathematical result cannot be represented without extraordinary roundoff
10380 error in an object of the specified type. If a floating result overflows and default rounding
10381 is in effect, or if the mathematical result is an exact infinity from finite arguments (for
10382 example log(0.0)), then the function returns the value of the macro HUGE_VAL,
10385 <!--page 227 indent 4-->
10386 HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the
10387 correct value of the function; if the integer expression math_errhandling &
10388 MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if
10389 the integer expression math_errhandling & MATH_ERREXCEPT is nonzero, the
10390 ''divide-by-zero'' floating-point exception is raised if the mathematical result is an exact
10391 infinity and the ''overflow'' floating-point exception is raised otherwise.
10393 The result underflows if the magnitude of the mathematical result is so small that the
10394 mathematical result cannot be represented, without extraordinary roundoff error, in an
10395 object of the specified type.<sup><a href="#note204"><b>204)</b></a></sup> If the result underflows, the function returns an
10396 implementation-defined value whose magnitude is no greater than the smallest
10397 normalized positive number in the specified type; if the integer expression
10398 math_errhandling & MATH_ERRNO is nonzero, whether errno acquires the
10399 value ERANGE is implementation-defined; if the integer expression
10400 math_errhandling & MATH_ERREXCEPT is nonzero, whether the ''underflow''
10401 floating-point exception is raised is implementation-defined.
10404 <p><a name="note203">203)</a> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
10405 error if the mathematical domain of the function does not include the infinity.
10407 <p><a name="note204">204)</a> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
10408 also ''flush-to-zero'' underflow.
10411 <a name="7.12.2" href="#7.12.2"><h4>7.12.2 The FP_CONTRACT pragma</h4></a>
10415 #include <math.h>
10416 #pragma STDC FP_CONTRACT on-off-switch</pre>
10417 <h6>Description</h6>
10419 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
10420 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
10421 either outside external declarations or preceding all explicit declarations and statements
10422 inside a compound statement. When outside external declarations, the pragma takes
10423 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
10424 the end of the translation unit. When inside a compound statement, the pragma takes
10425 effect from its occurrence until another FP_CONTRACT pragma is encountered
10426 (including within a nested compound statement), or until the end of the compound
10427 statement; at the end of a compound statement the state for the pragma is restored to its
10428 condition just before the compound statement. If this pragma is used in any other
10429 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
10430 implementation-defined.
10435 <!--page 228 indent 4-->
10437 <a name="7.12.3" href="#7.12.3"><h4>7.12.3 Classification macros</h4></a>
10439 In the synopses in this subclause, real-floating indicates that the argument shall be an
10440 expression of real floating type.
10442 <a name="7.12.3.1" href="#7.12.3.1"><h5>7.12.3.1 The fpclassify macro</h5></a>
10446 #include <math.h>
10447 int fpclassify(real-floating x);</pre>
10448 <h6>Description</h6>
10450 The fpclassify macro classifies its argument value as NaN, infinite, normal,
10451 subnormal, zero, or into another implementation-defined category. First, an argument
10452 represented in a format wider than its semantic type is converted to its semantic type.
10453 Then classification is based on the type of the argument.<sup><a href="#note205"><b>205)</b></a></sup>
10456 The fpclassify macro returns the value of the number classification macro
10457 appropriate to the value of its argument.
10459 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
10461 #define fpclassify(x) \
10462 ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : \
10463 (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) : \
10464 __fpclassifyl(x))</pre>
10468 <p><a name="note205">205)</a> Since an expression can be evaluated with more range and precision than its type has, it is important to
10469 know the type that classification is based on. For example, a normal long double value might
10470 become subnormal when converted to double, and zero when converted to float.
10473 <a name="7.12.3.2" href="#7.12.3.2"><h5>7.12.3.2 The isfinite macro</h5></a>
10477 #include <math.h>
10478 int isfinite(real-floating x);</pre>
10479 <h6>Description</h6>
10481 The isfinite macro determines whether its argument has a finite value (zero,
10482 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
10483 format wider than its semantic type is converted to its semantic type. Then determination
10484 is based on the type of the argument.
10489 <!--page 229 indent 4-->
10492 The isfinite macro returns a nonzero value if and only if its argument has a finite
10495 <a name="7.12.3.3" href="#7.12.3.3"><h5>7.12.3.3 The isinf macro</h5></a>
10499 #include <math.h>
10500 int isinf(real-floating x);</pre>
10501 <h6>Description</h6>
10503 The isinf macro determines whether its argument value is an infinity (positive or
10504 negative). First, an argument represented in a format wider than its semantic type is
10505 converted to its semantic type. Then determination is based on the type of the argument.
10508 The isinf macro returns a nonzero value if and only if its argument has an infinite
10511 <a name="7.12.3.4" href="#7.12.3.4"><h5>7.12.3.4 The isnan macro</h5></a>
10515 #include <math.h>
10516 int isnan(real-floating x);</pre>
10517 <h6>Description</h6>
10519 The isnan macro determines whether its argument value is a NaN. First, an argument
10520 represented in a format wider than its semantic type is converted to its semantic type.
10521 Then determination is based on the type of the argument.<sup><a href="#note206"><b>206)</b></a></sup>
10524 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
10527 <p><a name="note206">206)</a> For the isnan macro, the type for determination does not matter unless the implementation supports
10528 NaNs in the evaluation type but not in the semantic type.
10531 <a name="7.12.3.5" href="#7.12.3.5"><h5>7.12.3.5 The isnormal macro</h5></a>
10535 #include <math.h>
10536 int isnormal(real-floating x);</pre>
10541 <!--page 230 indent 4-->
10542 <h6>Description</h6>
10544 The isnormal macro determines whether its argument value is normal (neither zero,
10545 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
10546 semantic type is converted to its semantic type. Then determination is based on the type
10550 The isnormal macro returns a nonzero value if and only if its argument has a normal
10553 <a name="7.12.3.6" href="#7.12.3.6"><h5>7.12.3.6 The signbit macro</h5></a>
10557 #include <math.h>
10558 int signbit(real-floating x);</pre>
10559 <h6>Description</h6>
10561 The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note207"><b>207)</b></a></sup>
10564 The signbit macro returns a nonzero value if and only if the sign of its argument value
10568 <p><a name="note207">207)</a> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
10569 unsigned, it is treated as positive.
10572 <a name="7.12.4" href="#7.12.4"><h4>7.12.4 Trigonometric functions</h4></a>
10574 <a name="7.12.4.1" href="#7.12.4.1"><h5>7.12.4.1 The acos functions</h5></a>
10578 #include <math.h>
10579 double acos(double x);
10580 float acosf(float x);
10581 long double acosl(long double x);</pre>
10582 <h6>Description</h6>
10584 The acos functions compute the principal value of the arc cosine of x. A domain error
10585 occurs for arguments not in the interval [-1, +1].
10588 The acos functions return arccos x in the interval [0, pi ] radians.
10593 <!--page 231 indent 4-->
10595 <a name="7.12.4.2" href="#7.12.4.2"><h5>7.12.4.2 The asin functions</h5></a>
10599 #include <math.h>
10600 double asin(double x);
10601 float asinf(float x);
10602 long double asinl(long double x);</pre>
10603 <h6>Description</h6>
10605 The asin functions compute the principal value of the arc sine of x. A domain error
10606 occurs for arguments not in the interval [-1, +1].
10609 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
10611 <a name="7.12.4.3" href="#7.12.4.3"><h5>7.12.4.3 The atan functions</h5></a>
10615 #include <math.h>
10616 double atan(double x);
10617 float atanf(float x);
10618 long double atanl(long double x);</pre>
10619 <h6>Description</h6>
10621 The atan functions compute the principal value of the arc tangent of x.
10624 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
10626 <a name="7.12.4.4" href="#7.12.4.4"><h5>7.12.4.4 The atan2 functions</h5></a>
10630 #include <math.h>
10631 double atan2(double y, double x);
10632 float atan2f(float y, float x);
10633 long double atan2l(long double y, long double x);</pre>
10634 <h6>Description</h6>
10636 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
10637 arguments to determine the quadrant of the return value. A domain error may occur if
10638 both arguments are zero.
10641 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
10642 <!--page 232 indent 4-->
10644 <a name="7.12.4.5" href="#7.12.4.5"><h5>7.12.4.5 The cos functions</h5></a>
10648 #include <math.h>
10649 double cos(double x);
10650 float cosf(float x);
10651 long double cosl(long double x);</pre>
10652 <h6>Description</h6>
10654 The cos functions compute the cosine of x (measured in radians).
10657 The cos functions return cos x.
10659 <a name="7.12.4.6" href="#7.12.4.6"><h5>7.12.4.6 The sin functions</h5></a>
10663 #include <math.h>
10664 double sin(double x);
10665 float sinf(float x);
10666 long double sinl(long double x);</pre>
10667 <h6>Description</h6>
10669 The sin functions compute the sine of x (measured in radians).
10672 The sin functions return sin x.
10674 <a name="7.12.4.7" href="#7.12.4.7"><h5>7.12.4.7 The tan functions</h5></a>
10678 #include <math.h>
10679 double tan(double x);
10680 float tanf(float x);
10681 long double tanl(long double x);</pre>
10682 <h6>Description</h6>
10684 The tan functions return the tangent of x (measured in radians).
10687 The tan functions return tan x.
10688 <!--page 233 indent 4-->
10690 <a name="7.12.5" href="#7.12.5"><h4>7.12.5 Hyperbolic functions</h4></a>
10692 <a name="7.12.5.1" href="#7.12.5.1"><h5>7.12.5.1 The acosh functions</h5></a>
10696 #include <math.h>
10697 double acosh(double x);
10698 float acoshf(float x);
10699 long double acoshl(long double x);</pre>
10700 <h6>Description</h6>
10702 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
10703 error occurs for arguments less than 1.
10706 The acosh functions return arcosh x in the interval [0, +(inf)].
10708 <a name="7.12.5.2" href="#7.12.5.2"><h5>7.12.5.2 The asinh functions</h5></a>
10712 #include <math.h>
10713 double asinh(double x);
10714 float asinhf(float x);
10715 long double asinhl(long double x);</pre>
10716 <h6>Description</h6>
10718 The asinh functions compute the arc hyperbolic sine of x.
10721 The asinh functions return arsinh x.
10723 <a name="7.12.5.3" href="#7.12.5.3"><h5>7.12.5.3 The atanh functions</h5></a>
10727 #include <math.h>
10728 double atanh(double x);
10729 float atanhf(float x);
10730 long double atanhl(long double x);</pre>
10731 <h6>Description</h6>
10733 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
10734 for arguments not in the interval [-1, +1]. A range error may occur if the argument
10736 <!--page 234 indent 4-->
10739 The atanh functions return artanh x.
10741 <a name="7.12.5.4" href="#7.12.5.4"><h5>7.12.5.4 The cosh functions</h5></a>
10745 #include <math.h>
10746 double cosh(double x);
10747 float coshf(float x);
10748 long double coshl(long double x);</pre>
10749 <h6>Description</h6>
10751 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
10752 magnitude of x is too large.
10755 The cosh functions return cosh x.
10757 <a name="7.12.5.5" href="#7.12.5.5"><h5>7.12.5.5 The sinh functions</h5></a>
10761 #include <math.h>
10762 double sinh(double x);
10763 float sinhf(float x);
10764 long double sinhl(long double x);</pre>
10765 <h6>Description</h6>
10767 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
10768 magnitude of x is too large.
10771 The sinh functions return sinh x.
10773 <a name="7.12.5.6" href="#7.12.5.6"><h5>7.12.5.6 The tanh functions</h5></a>
10777 #include <math.h>
10778 double tanh(double x);
10779 float tanhf(float x);
10780 long double tanhl(long double x);</pre>
10781 <h6>Description</h6>
10783 The tanh functions compute the hyperbolic tangent of x.
10784 <!--page 235 indent 4-->
10787 The tanh functions return tanh x.
10789 <a name="7.12.6" href="#7.12.6"><h4>7.12.6 Exponential and logarithmic functions</h4></a>
10791 <a name="7.12.6.1" href="#7.12.6.1"><h5>7.12.6.1 The exp functions</h5></a>
10795 #include <math.h>
10796 double exp(double x);
10797 float expf(float x);
10798 long double expl(long double x);</pre>
10799 <h6>Description</h6>
10801 The exp functions compute the base-e exponential of x. A range error occurs if the
10802 magnitude of x is too large.
10805 The exp functions return ex .
10807 <a name="7.12.6.2" href="#7.12.6.2"><h5>7.12.6.2 The exp2 functions</h5></a>
10811 #include <math.h>
10812 double exp2(double x);
10813 float exp2f(float x);
10814 long double exp2l(long double x);</pre>
10815 <h6>Description</h6>
10817 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
10818 magnitude of x is too large.
10821 The exp2 functions return 2x .
10823 <a name="7.12.6.3" href="#7.12.6.3"><h5>7.12.6.3 The expm1 functions</h5></a>
10826 <!--page 236 indent 4-->
10828 #include <math.h>
10829 double expm1(double x);
10830 float expm1f(float x);
10831 long double expm1l(long double x);</pre>
10832 <h6>Description</h6>
10834 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
10835 error occurs if x is too large.<sup><a href="#note208"><b>208)</b></a></sup>
10838 The expm1 functions return ex - 1.
10841 <p><a name="note208">208)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
10844 <a name="7.12.6.4" href="#7.12.6.4"><h5>7.12.6.4 The frexp functions</h5></a>
10848 #include <math.h>
10849 double frexp(double value, int *exp);
10850 float frexpf(float value, int *exp);
10851 long double frexpl(long double value, int *exp);</pre>
10852 <h6>Description</h6>
10854 The frexp functions break a floating-point number into a normalized fraction and an
10855 integral power of 2. They store the integer in the int object pointed to by exp.
10858 If value is not a floating-point number, the results are unspecified. Otherwise, the
10859 frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or
10860 zero, and value equals x x 2*exp . If value is zero, both parts of the result are zero.
10862 <a name="7.12.6.5" href="#7.12.6.5"><h5>7.12.6.5 The ilogb functions</h5></a>
10866 #include <math.h>
10867 int ilogb(double x);
10868 int ilogbf(float x);
10869 int ilogbl(long double x);</pre>
10870 <h6>Description</h6>
10872 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
10873 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
10874 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
10875 the corresponding logb function and casting the returned value to type int. A domain
10876 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
10877 the range of the return type, the numeric result is unspecified.
10882 <!--page 237 indent 4-->
10885 The ilogb functions return the exponent of x as a signed int value.
10886 Forward references: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
10888 <a name="7.12.6.6" href="#7.12.6.6"><h5>7.12.6.6 The ldexp functions</h5></a>
10892 #include <math.h>
10893 double ldexp(double x, int exp);
10894 float ldexpf(float x, int exp);
10895 long double ldexpl(long double x, int exp);</pre>
10896 <h6>Description</h6>
10898 The ldexp functions multiply a floating-point number by an integral power of 2. A
10899 range error may occur.
10902 The ldexp functions return x x 2exp .
10904 <a name="7.12.6.7" href="#7.12.6.7"><h5>7.12.6.7 The log functions</h5></a>
10908 #include <math.h>
10909 double log(double x);
10910 float logf(float x);
10911 long double logl(long double x);</pre>
10912 <h6>Description</h6>
10914 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
10915 the argument is negative. A range error may occur if the argument is zero.
10918 The log functions return loge x.
10920 <a name="7.12.6.8" href="#7.12.6.8"><h5>7.12.6.8 The log10 functions</h5></a>
10923 <!--page 238 indent 4-->
10925 #include <math.h>
10926 double log10(double x);
10927 float log10f(float x);
10928 long double log10l(long double x);</pre>
10929 <h6>Description</h6>
10931 The log10 functions compute the base-10 (common) logarithm of x. A domain error
10932 occurs if the argument is negative. A range error may occur if the argument is zero.
10935 The log10 functions return log10 x.
10937 <a name="7.12.6.9" href="#7.12.6.9"><h5>7.12.6.9 The log1p functions</h5></a>
10941 #include <math.h>
10942 double log1p(double x);
10943 float log1pf(float x);
10944 long double log1pl(long double x);</pre>
10945 <h6>Description</h6>
10947 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note209"><b>209)</b></a></sup>
10948 A domain error occurs if the argument is less than -1. A range error may occur if the
10949 argument equals -1.
10952 The log1p functions return loge (1 + x).
10955 <p><a name="note209">209)</a> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
10958 <a name="7.12.6.10" href="#7.12.6.10"><h5>7.12.6.10 The log2 functions</h5></a>
10962 #include <math.h>
10963 double log2(double x);
10964 float log2f(float x);
10965 long double log2l(long double x);</pre>
10966 <h6>Description</h6>
10968 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
10969 argument is less than zero. A range error may occur if the argument is zero.
10972 The log2 functions return log2 x.
10977 <!--page 239 indent 4-->
10979 <a name="7.12.6.11" href="#7.12.6.11"><h5>7.12.6.11 The logb functions</h5></a>
10983 #include <math.h>
10984 double logb(double x);
10985 float logbf(float x);
10986 long double logbl(long double x);</pre>
10987 <h6>Description</h6>
10989 The logb functions extract the exponent of x, as a signed integer value in floating-point
10990 format. If x is subnormal it is treated as though it were normalized; thus, for positive
10993 1 <= x x FLT_RADIX-logb(x) < FLT_RADIX</pre>
10994 A domain error or range error may occur if the argument is zero.
10997 The logb functions return the signed exponent of x.
10999 <a name="7.12.6.12" href="#7.12.6.12"><h5>7.12.6.12 The modf functions</h5></a>
11003 #include <math.h>
11004 double modf(double value, double *iptr);
11005 float modff(float value, float *iptr);
11006 long double modfl(long double value, long double *iptr);</pre>
11007 <h6>Description</h6>
11009 The modf functions break the argument value into integral and fractional parts, each of
11010 which has the same type and sign as the argument. They store the integral part (in
11011 floating-point format) in the object pointed to by iptr.
11014 The modf functions return the signed fractional part of value.
11015 <!--page 240 indent 4-->
11017 <a name="7.12.6.13" href="#7.12.6.13"><h5>7.12.6.13 The scalbn and scalbln functions</h5></a>
11021 #include <math.h>
11022 double scalbn(double x, int n);
11023 float scalbnf(float x, int n);
11024 long double scalbnl(long double x, int n);
11025 double scalbln(double x, long int n);
11026 float scalblnf(float x, long int n);
11027 long double scalblnl(long double x, long int n);</pre>
11028 <h6>Description</h6>
11030 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
11031 normally by computing FLT_RADIXn explicitly. A range error may occur.
11034 The scalbn and scalbln functions return x x FLT_RADIXn .
11036 <a name="7.12.7" href="#7.12.7"><h4>7.12.7 Power and absolute-value functions</h4></a>
11038 <a name="7.12.7.1" href="#7.12.7.1"><h5>7.12.7.1 The cbrt functions</h5></a>
11042 #include <math.h>
11043 double cbrt(double x);
11044 float cbrtf(float x);
11045 long double cbrtl(long double x);</pre>
11046 <h6>Description</h6>
11048 The cbrt functions compute the real cube root of x.
11051 The cbrt functions return x1/3 .
11053 <a name="7.12.7.2" href="#7.12.7.2"><h5>7.12.7.2 The fabs functions</h5></a>
11057 #include <math.h>
11058 double fabs(double x);
11059 float fabsf(float x);
11060 long double fabsl(long double x);</pre>
11061 <h6>Description</h6>
11063 The fabs functions compute the absolute value of a floating-point number x.
11064 <!--page 241 indent 4-->
11067 The fabs functions return | x |.
11069 <a name="7.12.7.3" href="#7.12.7.3"><h5>7.12.7.3 The hypot functions</h5></a>
11073 #include <math.h>
11074 double hypot(double x, double y);
11075 float hypotf(float x, float y);
11076 long double hypotl(long double x, long double y);</pre>
11077 <h6>Description</h6>
11079 The hypot functions compute the square root of the sum of the squares of x and y,
11080 without undue overflow or underflow. A range error may occur.
11084 The hypot functions return (sqrt)x2 + y2 .
11087 ???????????????</pre>
11089 <a name="7.12.7.4" href="#7.12.7.4"><h5>7.12.7.4 The pow functions</h5></a>
11093 #include <math.h>
11094 double pow(double x, double y);
11095 float powf(float x, float y);
11096 long double powl(long double x, long double y);</pre>
11097 <h6>Description</h6>
11099 The pow functions compute x raised to the power y. A domain error occurs if x is finite
11100 and negative and y is finite and not an integer value. A range error may occur. A domain
11101 error may occur if x is zero and y is zero. A domain error or range error may occur if x
11102 is zero and y is less than zero.
11105 The pow functions return xy .
11107 <a name="7.12.7.5" href="#7.12.7.5"><h5>7.12.7.5 The sqrt functions</h5></a>
11110 <!--page 242 indent 4-->
11112 #include <math.h>
11113 double sqrt(double x);
11114 float sqrtf(float x);
11115 long double sqrtl(long double x);</pre>
11116 <h6>Description</h6>
11118 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
11119 the argument is less than zero.
11122 The sqrt functions return (sqrt)x.
11127 <a name="7.12.8" href="#7.12.8"><h4>7.12.8 Error and gamma functions</h4></a>
11129 <a name="7.12.8.1" href="#7.12.8.1"><h5>7.12.8.1 The erf functions</h5></a>
11133 #include <math.h>
11134 double erf(double x);
11135 float erff(float x);
11136 long double erfl(long double x);</pre>
11137 <h6>Description</h6>
11139 The erf functions compute the error function of x.
11145 The erf functions return erf x = e-t dt.
11156 <a name="7.12.8.2" href="#7.12.8.2"><h5>7.12.8.2 The erfc functions</h5></a>
11160 #include <math.h>
11161 double erfc(double x);
11162 float erfcf(float x);
11163 long double erfcl(long double x);</pre>
11164 <h6>Description</h6>
11166 The erfc functions compute the complementary error function of x. A range error
11167 occurs if x is too large.
11173 The erfc functions return erfc x = 1 - erf x = e-t dt.
11178 <!--page 243 indent 4-->
11184 <a name="7.12.8.3" href="#7.12.8.3"><h5>7.12.8.3 The lgamma functions</h5></a>
11188 #include <math.h>
11189 double lgamma(double x);
11190 float lgammaf(float x);
11191 long double lgammal(long double x);</pre>
11192 <h6>Description</h6>
11194 The lgamma functions compute the natural logarithm of the absolute value of gamma of
11195 x. A range error occurs if x is too large. A range error may occur if x is a negative
11199 The lgamma functions return loge | (Gamma)(x) |.
11201 <a name="7.12.8.4" href="#7.12.8.4"><h5>7.12.8.4 The tgamma functions</h5></a>
11205 #include <math.h>
11206 double tgamma(double x);
11207 float tgammaf(float x);
11208 long double tgammal(long double x);</pre>
11209 <h6>Description</h6>
11211 The tgamma functions compute the gamma function of x. A domain error or range error
11212 may occur if x is a negative integer or zero. A range error may occur if the magnitude of
11213 x is too large or too small.
11216 The tgamma functions return (Gamma)(x).
11218 <a name="7.12.9" href="#7.12.9"><h4>7.12.9 Nearest integer functions</h4></a>
11220 <a name="7.12.9.1" href="#7.12.9.1"><h5>7.12.9.1 The ceil functions</h5></a>
11224 #include <math.h>
11225 double ceil(double x);
11226 float ceilf(float x);
11227 long double ceill(long double x);</pre>
11228 <h6>Description</h6>
11230 The ceil functions compute the smallest integer value not less than x.
11231 <!--page 244 indent 4-->
11234 The ceil functions return ???x???, expressed as a floating-point number.
11236 <a name="7.12.9.2" href="#7.12.9.2"><h5>7.12.9.2 The floor functions</h5></a>
11240 #include <math.h>
11241 double floor(double x);
11242 float floorf(float x);
11243 long double floorl(long double x);</pre>
11244 <h6>Description</h6>
11246 The floor functions compute the largest integer value not greater than x.
11249 The floor functions return ???x???, expressed as a floating-point number.
11251 <a name="7.12.9.3" href="#7.12.9.3"><h5>7.12.9.3 The nearbyint functions</h5></a>
11255 #include <math.h>
11256 double nearbyint(double x);
11257 float nearbyintf(float x);
11258 long double nearbyintl(long double x);</pre>
11259 <h6>Description</h6>
11261 The nearbyint functions round their argument to an integer value in floating-point
11262 format, using the current rounding direction and without raising the ''inexact'' floating-
11266 The nearbyint functions return the rounded integer value.
11268 <a name="7.12.9.4" href="#7.12.9.4"><h5>7.12.9.4 The rint functions</h5></a>
11272 #include <math.h>
11273 double rint(double x);
11274 float rintf(float x);
11275 long double rintl(long double x);</pre>
11276 <h6>Description</h6>
11278 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
11279 rint functions may raise the ''inexact'' floating-point exception if the result differs in
11280 value from the argument.
11281 <!--page 245 indent 4-->
11284 The rint functions return the rounded integer value.
11286 <a name="7.12.9.5" href="#7.12.9.5"><h5>7.12.9.5 The lrint and llrint functions</h5></a>
11290 #include <math.h>
11291 long int lrint(double x);
11292 long int lrintf(float x);
11293 long int lrintl(long double x);
11294 long long int llrint(double x);
11295 long long int llrintf(float x);
11296 long long int llrintl(long double x);</pre>
11297 <h6>Description</h6>
11299 The lrint and llrint functions round their argument to the nearest integer value,
11300 rounding according to the current rounding direction. If the rounded value is outside the
11301 range of the return type, the numeric result is unspecified and a domain error or range
11305 The lrint and llrint functions return the rounded integer value.
11307 <a name="7.12.9.6" href="#7.12.9.6"><h5>7.12.9.6 The round functions</h5></a>
11311 #include <math.h>
11312 double round(double x);
11313 float roundf(float x);
11314 long double roundl(long double x);</pre>
11315 <h6>Description</h6>
11317 The round functions round their argument to the nearest integer value in floating-point
11318 format, rounding halfway cases away from zero, regardless of the current rounding
11322 The round functions return the rounded integer value.
11323 <!--page 246 indent 4-->
11325 <a name="7.12.9.7" href="#7.12.9.7"><h5>7.12.9.7 The lround and llround functions</h5></a>
11329 #include <math.h>
11330 long int lround(double x);
11331 long int lroundf(float x);
11332 long int lroundl(long double x);
11333 long long int llround(double x);
11334 long long int llroundf(float x);
11335 long long int llroundl(long double x);</pre>
11336 <h6>Description</h6>
11338 The lround and llround functions round their argument to the nearest integer value,
11339 rounding halfway cases away from zero, regardless of the current rounding direction. If
11340 the rounded value is outside the range of the return type, the numeric result is unspecified
11341 and a domain error or range error may occur.
11344 The lround and llround functions return the rounded integer value.
11346 <a name="7.12.9.8" href="#7.12.9.8"><h5>7.12.9.8 The trunc functions</h5></a>
11350 #include <math.h>
11351 double trunc(double x);
11352 float truncf(float x);
11353 long double truncl(long double x);</pre>
11354 <h6>Description</h6>
11356 The trunc functions round their argument to the integer value, in floating format,
11357 nearest to but no larger in magnitude than the argument.
11360 The trunc functions return the truncated integer value.
11361 <!--page 247 indent 4-->
11363 <a name="7.12.10" href="#7.12.10"><h4>7.12.10 Remainder functions</h4></a>
11365 <a name="7.12.10.1" href="#7.12.10.1"><h5>7.12.10.1 The fmod functions</h5></a>
11369 #include <math.h>
11370 double fmod(double x, double y);
11371 float fmodf(float x, float y);
11372 long double fmodl(long double x, long double y);</pre>
11373 <h6>Description</h6>
11375 The fmod functions compute the floating-point remainder of x/y.
11378 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
11379 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
11380 whether a domain error occurs or the fmod functions return zero is implementation-
11383 <a name="7.12.10.2" href="#7.12.10.2"><h5>7.12.10.2 The remainder functions</h5></a>
11387 #include <math.h>
11388 double remainder(double x, double y);
11389 float remainderf(float x, float y);
11390 long double remainderl(long double x, long double y);</pre>
11391 <h6>Description</h6>
11393 The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note210"><b>210)</b></a></sup>
11396 The remainder functions return x REM y. If y is zero, whether a domain error occurs
11397 or the functions return zero is implementation defined.
11402 <!--page 248 indent 4-->
11405 <p><a name="note210">210)</a> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
11406 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
11407 | n - x/y | = 1/2, then n is even. Thus, the remainder is always exact. If r = 0, its sign shall be that of
11408 x.'' This definition is applicable for all implementations.
11411 <a name="7.12.10.3" href="#7.12.10.3"><h5>7.12.10.3 The remquo functions</h5></a>
11415 #include <math.h>
11416 double remquo(double x, double y, int *quo);
11417 float remquof(float x, float y, int *quo);
11418 long double remquol(long double x, long double y,
11420 <h6>Description</h6>
11422 The remquo functions compute the same remainder as the remainder functions. In
11423 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
11424 magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
11425 n is an implementation-defined integer greater than or equal to 3.
11428 The remquo functions return x REM y. If y is zero, the value stored in the object
11429 pointed to by quo is unspecified and whether a domain error occurs or the functions
11430 return zero is implementation defined.
11432 <a name="7.12.11" href="#7.12.11"><h4>7.12.11 Manipulation functions</h4></a>
11434 <a name="7.12.11.1" href="#7.12.11.1"><h5>7.12.11.1 The copysign functions</h5></a>
11438 #include <math.h>
11439 double copysign(double x, double y);
11440 float copysignf(float x, float y);
11441 long double copysignl(long double x, long double y);</pre>
11442 <h6>Description</h6>
11444 The copysign functions produce a value with the magnitude of x and the sign of y.
11445 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
11446 represent a signed zero but do not treat negative zero consistently in arithmetic
11447 operations, the copysign functions regard the sign of zero as positive.
11450 The copysign functions return a value with the magnitude of x and the sign of y.
11451 <!--page 249 indent 4-->
11453 <a name="7.12.11.2" href="#7.12.11.2"><h5>7.12.11.2 The nan functions</h5></a>
11457 #include <math.h>
11458 double nan(const char *tagp);
11459 float nanf(const char *tagp);
11460 long double nanl(const char *tagp);</pre>
11461 <h6>Description</h6>
11463 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
11464 sequence)", (char**) NULL); the call nan("") is equivalent to
11465 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
11466 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
11467 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
11471 The nan functions return a quiet NaN, if available, with content indicated through tagp.
11472 If the implementation does not support quiet NaNs, the functions return zero.
11473 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
11475 <a name="7.12.11.3" href="#7.12.11.3"><h5>7.12.11.3 The nextafter functions</h5></a>
11479 #include <math.h>
11480 double nextafter(double x, double y);
11481 float nextafterf(float x, float y);
11482 long double nextafterl(long double x, long double y);</pre>
11483 <h6>Description</h6>
11485 The nextafter functions determine the next representable value, in the type of the
11486 function, after x in the direction of y, where x and y are first converted to the type of the
11487 function.<sup><a href="#note211"><b>211)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
11488 if the magnitude of x is the largest finite value representable in the type and the result is
11489 infinite or not representable in the type.
11492 The nextafter functions return the next representable value in the specified format
11493 after x in the direction of y.
11496 <!--page 250 indent 4-->
11499 <p><a name="note211">211)</a> The argument values are converted to the type of the function, even by a macro implementation of the
11503 <a name="7.12.11.4" href="#7.12.11.4"><h5>7.12.11.4 The nexttoward functions</h5></a>
11507 #include <math.h>
11508 double nexttoward(double x, long double y);
11509 float nexttowardf(float x, long double y);
11510 long double nexttowardl(long double x, long double y);</pre>
11511 <h6>Description</h6>
11513 The nexttoward functions are equivalent to the nextafter functions except that the
11514 second parameter has type long double and the functions return y converted to the
11515 type of the function if x equals y.<sup><a href="#note212"><b>212)</b></a></sup>
11518 <p><a name="note212">212)</a> The result of the nexttoward functions is determined in the type of the function, without loss of
11519 range or precision in a floating second argument.
11522 <a name="7.12.12" href="#7.12.12"><h4>7.12.12 Maximum, minimum, and positive difference functions</h4></a>
11524 <a name="7.12.12.1" href="#7.12.12.1"><h5>7.12.12.1 The fdim functions</h5></a>
11528 #include <math.h>
11529 double fdim(double x, double y);
11530 float fdimf(float x, float y);
11531 long double fdiml(long double x, long double y);</pre>
11532 <h6>Description</h6>
11534 The fdim functions determine the positive difference between their arguments:
11536 ???x - y if x > y
11538 ???+0 if x <= y</pre>
11539 A range error may occur.
11542 The fdim functions return the positive difference value.
11544 <a name="7.12.12.2" href="#7.12.12.2"><h5>7.12.12.2 The fmax functions</h5></a>
11548 #include <math.h>
11549 double fmax(double x, double y);
11550 float fmaxf(float x, float y);
11551 long double fmaxl(long double x, long double y);</pre>
11555 <!--page 251 indent 4-->
11556 <h6>Description</h6>
11558 The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note213"><b>213)</b></a></sup>
11561 The fmax functions return the maximum numeric value of their arguments.
11564 <p><a name="note213">213)</a> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
11565 fmax functions choose the numeric value. See <a href="#F.9.9.2">F.9.9.2</a>.
11568 <a name="7.12.12.3" href="#7.12.12.3"><h5>7.12.12.3 The fmin functions</h5></a>
11572 #include <math.h>
11573 double fmin(double x, double y);
11574 float fminf(float x, float y);
11575 long double fminl(long double x, long double y);</pre>
11576 <h6>Description</h6>
11578 The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note214"><b>214)</b></a></sup>
11581 The fmin functions return the minimum numeric value of their arguments.
11584 <p><a name="note214">214)</a> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
11587 <a name="7.12.13" href="#7.12.13"><h4>7.12.13 Floating multiply-add</h4></a>
11589 <a name="7.12.13.1" href="#7.12.13.1"><h5>7.12.13.1 The fma functions</h5></a>
11593 #include <math.h>
11594 double fma(double x, double y, double z);
11595 float fmaf(float x, float y, float z);
11596 long double fmal(long double x, long double y,
11597 long double z);</pre>
11598 <h6>Description</h6>
11600 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
11601 the value (as if) to infinite precision and round once to the result format, according to the
11602 current rounding mode. A range error may occur.
11605 The fma functions return (x x y) + z, rounded as one ternary operation.
11610 <!--page 252 indent 4-->
11612 <a name="7.12.14" href="#7.12.14"><h4>7.12.14 Comparison macros</h4></a>
11614 The relational and equality operators support the usual mathematical relationships
11615 between numeric values. For any ordered pair of numeric values exactly one of the
11616 relationships -- less, greater, and equal -- is true. Relational operators may raise the
11617 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
11618 numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note215"><b>215)</b></a></sup> The following
11619 subclauses provide macros that are quiet (non floating-point exception raising) versions
11620 of the relational operators, and other comparison macros that facilitate writing efficient
11621 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
11622 the synopses in this subclause, real-floating indicates that the argument shall be an
11623 expression of real floating type.
11626 <p><a name="note215">215)</a> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
11627 the operands compare unordered, as an error indicator for programs written without consideration of
11628 NaNs; the result in these cases is false.
11631 <a name="7.12.14.1" href="#7.12.14.1"><h5>7.12.14.1 The isgreater macro</h5></a>
11635 #include <math.h>
11636 int isgreater(real-floating x, real-floating y);</pre>
11637 <h6>Description</h6>
11639 The isgreater macro determines whether its first argument is greater than its second
11640 argument. The value of isgreater(x, y) is always equal to (x) > (y); however,
11641 unlike (x) > (y), isgreater(x, y) does not raise the ''invalid'' floating-point
11642 exception when x and y are unordered.
11645 The isgreater macro returns the value of (x) > (y).
11647 <a name="7.12.14.2" href="#7.12.14.2"><h5>7.12.14.2 The isgreaterequal macro</h5></a>
11651 #include <math.h>
11652 int isgreaterequal(real-floating x, real-floating y);</pre>
11653 <h6>Description</h6>
11655 The isgreaterequal macro determines whether its first argument is greater than or
11656 equal to its second argument. The value of isgreaterequal(x, y) is always equal
11657 to (x) >= (y); however, unlike (x) >= (y), isgreaterequal(x, y) does
11658 not raise the ''invalid'' floating-point exception when x and y are unordered.
11662 <!--page 253 indent 4-->
11665 The isgreaterequal macro returns the value of (x) >= (y).
11667 <a name="7.12.14.3" href="#7.12.14.3"><h5>7.12.14.3 The isless macro</h5></a>
11671 #include <math.h>
11672 int isless(real-floating x, real-floating y);</pre>
11673 <h6>Description</h6>
11675 The isless macro determines whether its first argument is less than its second
11676 argument. The value of isless(x, y) is always equal to (x) < (y); however,
11677 unlike (x) < (y), isless(x, y) does not raise the ''invalid'' floating-point
11678 exception when x and y are unordered.
11681 The isless macro returns the value of (x) < (y).
11683 <a name="7.12.14.4" href="#7.12.14.4"><h5>7.12.14.4 The islessequal macro</h5></a>
11687 #include <math.h>
11688 int islessequal(real-floating x, real-floating y);</pre>
11689 <h6>Description</h6>
11691 The islessequal macro determines whether its first argument is less than or equal to
11692 its second argument. The value of islessequal(x, y) is always equal to
11693 (x) <= (y); however, unlike (x) <= (y), islessequal(x, y) does not raise
11694 the ''invalid'' floating-point exception when x and y are unordered.
11697 The islessequal macro returns the value of (x) <= (y).
11699 <a name="7.12.14.5" href="#7.12.14.5"><h5>7.12.14.5 The islessgreater macro</h5></a>
11703 #include <math.h>
11704 int islessgreater(real-floating x, real-floating y);</pre>
11705 <h6>Description</h6>
11707 The islessgreater macro determines whether its first argument is less than or
11708 greater than its second argument. The islessgreater(x, y) macro is similar to
11709 (x) < (y) || (x) > (y); however, islessgreater(x, y) does not raise
11710 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
11712 <!--page 254 indent 4-->
11715 The islessgreater macro returns the value of (x) < (y) || (x) > (y).
11717 <a name="7.12.14.6" href="#7.12.14.6"><h5>7.12.14.6 The isunordered macro</h5></a>
11721 #include <math.h>
11722 int isunordered(real-floating x, real-floating y);</pre>
11723 <h6>Description</h6>
11725 The isunordered macro determines whether its arguments are unordered.
11728 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
11729 <!--page 255 indent 4-->
11731 <a name="7.13" href="#7.13"><h3>7.13 Nonlocal jumps <setjmp.h></h3></a>
11733 The header <setjmp.h> defines the macro setjmp, and declares one function and
11734 one type, for bypassing the normal function call and return discipline.<sup><a href="#note216"><b>216)</b></a></sup>
11736 The type declared is
11739 which is an array type suitable for holding the information needed to restore a calling
11740 environment. The environment of a call to the setjmp macro consists of information
11741 sufficient for a call to the longjmp function to return execution to the correct block and
11742 invocation of that block, were it called recursively. It does not include the state of the
11743 floating-point status flags, of open files, or of any other component of the abstract
11746 It is unspecified whether setjmp is a macro or an identifier declared with external
11747 linkage. If a macro definition is suppressed in order to access an actual function, or a
11748 program defines an external identifier with the name setjmp, the behavior is undefined.
11751 <p><a name="note216">216)</a> These functions are useful for dealing with unusual conditions encountered in a low-level function of
11755 <a name="7.13.1" href="#7.13.1"><h4>7.13.1 Save calling environment</h4></a>
11757 <a name="7.13.1.1" href="#7.13.1.1"><h5>7.13.1.1 The setjmp macro</h5></a>
11761 #include <setjmp.h>
11762 int setjmp(jmp_buf env);</pre>
11763 <h6>Description</h6>
11765 The setjmp macro saves its calling environment in its jmp_buf argument for later use
11766 by the longjmp function.
11769 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
11770 return is from a call to the longjmp function, the setjmp macro returns a nonzero
11772 Environmental limits
11774 An invocation of the setjmp macro shall appear only in one of the following contexts:
11776 <li> the entire controlling expression of a selection or iteration statement;
11777 <li> one operand of a relational or equality operator with the other operand an integer
11778 constant expression, with the resulting expression being the entire controlling
11781 <!--page 256 indent 4-->
11782 expression of a selection or iteration statement;
11783 <li> the operand of a unary ! operator with the resulting expression being the entire
11784 controlling expression of a selection or iteration statement; or
11785 <li> the entire expression of an expression statement (possibly cast to void).
11788 If the invocation appears in any other context, the behavior is undefined.
11790 <a name="7.13.2" href="#7.13.2"><h4>7.13.2 Restore calling environment</h4></a>
11792 <a name="7.13.2.1" href="#7.13.2.1"><h5>7.13.2.1 The longjmp function</h5></a>
11796 #include <setjmp.h>
11797 void longjmp(jmp_buf env, int val);</pre>
11798 <h6>Description</h6>
11800 The longjmp function restores the environment saved by the most recent invocation of
11801 the setjmp macro in the same invocation of the program with the corresponding
11802 jmp_buf argument. If there has been no such invocation, or if the function containing
11803 the invocation of the setjmp macro has terminated execution<sup><a href="#note217"><b>217)</b></a></sup> in the interim, or if the
11804 invocation of the setjmp macro was within the scope of an identifier with variably
11805 modified type and execution has left that scope in the interim, the behavior is undefined.
11807 All accessible objects have values, and all other components of the abstract machine<sup><a href="#note218"><b>218)</b></a></sup>
11808 have state, as of the time the longjmp function was called, except that the values of
11809 objects of automatic storage duration that are local to the function containing the
11810 invocation of the corresponding setjmp macro that do not have volatile-qualified type
11811 and have been changed between the setjmp invocation and longjmp call are
11815 After longjmp is completed, program execution continues as if the corresponding
11816 invocation of the setjmp macro had just returned the value specified by val. The
11817 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
11818 the setjmp macro returns the value 1.
11820 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
11821 might cause memory associated with a variable length array object to be squandered.
11826 <!--page 257 indent -1-->
11827 <!--page 258 indent 4-->
11829 #include <setjmp.h>
11836 int x[n]; // valid: f is not terminated
11842 int a[n]; // a may remain allocated
11847 int b[n]; // b may remain allocated
11848 longjmp(buf, 2); // might cause memory loss
11852 <p><a name="note217">217)</a> For example, by executing a return statement or because another longjmp call has caused a
11853 transfer to a setjmp invocation in a function earlier in the set of nested calls.
11855 <p><a name="note218">218)</a> This includes, but is not limited to, the floating-point status flags and the state of open files.
11858 <a name="7.14" href="#7.14"><h3>7.14 Signal handling <signal.h></h3></a>
11860 The header <signal.h> declares a type and two functions and defines several macros,
11861 for handling various signals (conditions that may be reported during program execution).
11863 The type defined is
11866 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
11867 an atomic entity, even in the presence of asynchronous interrupts.
11869 The macros defined are
11874 which expand to constant expressions with distinct values that have type compatible with
11875 the second argument to, and the return value of, the signal function, and whose values
11876 compare unequal to the address of any declarable function; and the following, which
11877 expand to positive integer constant expressions with type int and distinct values that are
11878 the signal numbers, each corresponding to the specified condition:
11881 SIGABRT abnormal termination, such as is initiated by the abort function
11882 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
11883 resulting in overflow
11884 SIGILL detection of an invalid function image, such as an invalid instruction
11885 SIGINT receipt of an interactive attention signal
11886 SIGSEGV an invalid access to storage
11887 SIGTERM a termination request sent to the program</pre>
11888 An implementation need not generate any of these signals, except as a result of explicit
11889 calls to the raise function. Additional signals and pointers to undeclarable functions,
11890 with macro definitions beginning, respectively, with the letters SIG and an uppercase
11891 letter or with SIG_ and an uppercase letter,<sup><a href="#note219"><b>219)</b></a></sup> may also be specified by the
11892 implementation. The complete set of signals, their semantics, and their default handling
11893 is implementation-defined; all signal numbers shall be positive.
11898 <!--page 259 indent 4-->
11901 <p><a name="note219">219)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>). The names of the signal numbers reflect the following terms
11902 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
11906 <a name="7.14.1" href="#7.14.1"><h4>7.14.1 Specify signal handling</h4></a>
11908 <a name="7.14.1.1" href="#7.14.1.1"><h5>7.14.1.1 The signal function</h5></a>
11912 #include <signal.h>
11913 void (*signal(int sig, void (*func)(int)))(int);</pre>
11914 <h6>Description</h6>
11916 The signal function chooses one of three ways in which receipt of the signal number
11917 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
11918 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
11919 Otherwise, func shall point to a function to be called when that signal occurs. An
11920 invocation of such a function because of a signal, or (recursively) of any further functions
11921 called by that invocation (other than functions in the standard library), is called a signal
11924 When a signal occurs and func points to a function, it is implementation-defined
11925 whether the equivalent of signal(sig, SIG_DFL); is executed or the
11926 implementation prevents some implementation-defined set of signals (at least including
11927 sig) from occurring until the current signal handling has completed; in the case of
11928 SIGILL, the implementation may alternatively define that no action is taken. Then the
11929 equivalent of (*func)(sig); is executed. If and when the function returns, if the
11930 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
11931 value corresponding to a computational exception, the behavior is undefined; otherwise
11932 the program will resume execution at the point it was interrupted.
11934 If the signal occurs as the result of calling the abort or raise function, the signal
11935 handler shall not call the raise function.
11937 If the signal occurs other than as the result of calling the abort or raise function, the
11938 behavior is undefined if the signal handler refers to any object with static storage duration
11939 other than by assigning a value to an object declared as volatile sig_atomic_t, or
11940 the signal handler calls any function in the standard library other than the abort
11941 function, the _Exit function, or the signal function with the first argument equal to
11942 the signal number corresponding to the signal that caused the invocation of the handler.
11943 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
11944 value of errno is indeterminate.<sup><a href="#note220"><b>220)</b></a></sup>
11946 At program startup, the equivalent of
11948 signal(sig, SIG_IGN);</pre>
11951 <!--page 260 indent 4-->
11952 may be executed for some signals selected in an implementation-defined manner; the
11955 signal(sig, SIG_DFL);</pre>
11956 is executed for all other signals defined by the implementation.
11958 The implementation shall behave as if no library function calls the signal function.
11961 If the request can be honored, the signal function returns the value of func for the
11962 most recent successful call to signal for the specified signal sig. Otherwise, a value of
11963 SIG_ERR is returned and a positive value is stored in errno.
11964 Forward references: the abort function (<a href="#7.20.4.1">7.20.4.1</a>), the exit function (<a href="#7.20.4.3">7.20.4.3</a>), the
11965 _Exit function (<a href="#7.20.4.4">7.20.4.4</a>).
11968 <p><a name="note220">220)</a> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
11971 <a name="7.14.2" href="#7.14.2"><h4>7.14.2 Send signal</h4></a>
11973 <a name="7.14.2.1" href="#7.14.2.1"><h5>7.14.2.1 The raise function</h5></a>
11977 #include <signal.h>
11978 int raise(int sig);</pre>
11979 <h6>Description</h6>
11981 The raise function carries out the actions described in <a href="#7.14.1.1">7.14.1.1</a> for the signal sig. If a
11982 signal handler is called, the raise function shall not return until after the signal handler
11986 The raise function returns zero if successful, nonzero if unsuccessful.
11987 <!--page 261 indent 4-->
11989 <a name="7.15" href="#7.15"><h3>7.15 Variable arguments <stdarg.h></h3></a>
11991 The header <stdarg.h> declares a type and defines four macros, for advancing
11992 through a list of arguments whose number and types are not known to the called function
11993 when it is translated.
11995 A function may be called with a variable number of arguments of varying types. As
11996 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
11997 parameter plays a special role in the access mechanism, and will be designated parmN in
12000 The type declared is
12003 which is an object type suitable for holding information needed by the macros
12004 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
12005 desired, the called function shall declare an object (generally referred to as ap in this
12006 subclause) having type va_list. The object ap may be passed as an argument to
12007 another function; if that function invokes the va_arg macro with parameter ap, the
12008 value of ap in the calling function is indeterminate and shall be passed to the va_end
12009 macro prior to any further reference to ap.<sup><a href="#note221"><b>221)</b></a></sup>
12012 <p><a name="note221">221)</a> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
12013 case the original function may make further use of the original list after the other function returns.
12016 <a name="7.15.1" href="#7.15.1"><h4>7.15.1 Variable argument list access macros</h4></a>
12018 The va_start and va_arg macros described in this subclause shall be implemented
12019 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
12020 identifiers declared with external linkage. If a macro definition is suppressed in order to
12021 access an actual function, or a program defines an external identifier with the same name,
12022 the behavior is undefined. Each invocation of the va_start and va_copy macros
12023 shall be matched by a corresponding invocation of the va_end macro in the same
12026 <a name="7.15.1.1" href="#7.15.1.1"><h5>7.15.1.1 The va_arg macro</h5></a>
12030 #include <stdarg.h>
12031 type va_arg(va_list ap, type);</pre>
12032 <h6>Description</h6>
12034 The va_arg macro expands to an expression that has the specified type and the value of
12035 the next argument in the call. The parameter ap shall have been initialized by the
12036 va_start or va_copy macro (without an intervening invocation of the va_end
12038 <!--page 262 indent 4-->
12039 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
12040 values of successive arguments are returned in turn. The parameter type shall be a type
12041 name specified such that the type of a pointer to an object that has the specified type can
12042 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
12043 type is not compatible with the type of the actual next argument (as promoted according
12044 to the default argument promotions), the behavior is undefined, except for the following
12047 <li> one type is a signed integer type, the other type is the corresponding unsigned integer
12048 type, and the value is representable in both types;
12049 <li> one type is pointer to void and the other is a pointer to a character type.
12053 The first invocation of the va_arg macro after that of the va_start macro returns the
12054 value of the argument after that specified by parmN . Successive invocations return the
12055 values of the remaining arguments in succession.
12057 <a name="7.15.1.2" href="#7.15.1.2"><h5>7.15.1.2 The va_copy macro</h5></a>
12061 #include <stdarg.h>
12062 void va_copy(va_list dest, va_list src);</pre>
12063 <h6>Description</h6>
12065 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
12066 been applied to dest followed by the same sequence of uses of the va_arg macro as
12067 had previously been used to reach the present state of src. Neither the va_copy nor
12068 va_start macro shall be invoked to reinitialize dest without an intervening
12069 invocation of the va_end macro for the same dest.
12072 The va_copy macro returns no value.
12074 <a name="7.15.1.3" href="#7.15.1.3"><h5>7.15.1.3 The va_end macro</h5></a>
12078 #include <stdarg.h>
12079 void va_end(va_list ap);</pre>
12080 <h6>Description</h6>
12082 The va_end macro facilitates a normal return from the function whose variable
12083 argument list was referred to by the expansion of the va_start macro, or the function
12084 containing the expansion of the va_copy macro, that initialized the va_list ap. The
12085 va_end macro may modify ap so that it is no longer usable (without being reinitialized
12086 <!--page 263 indent 4-->
12087 by the va_start or va_copy macro). If there is no corresponding invocation of the
12088 va_start or va_copy macro, or if the va_end macro is not invoked before the
12089 return, the behavior is undefined.
12092 The va_end macro returns no value.
12094 <a name="7.15.1.4" href="#7.15.1.4"><h5>7.15.1.4 The va_start macro</h5></a>
12098 #include <stdarg.h>
12099 void va_start(va_list ap, parmN);</pre>
12100 <h6>Description</h6>
12102 The va_start macro shall be invoked before any access to the unnamed arguments.
12104 The va_start macro initializes ap for subsequent use by the va_arg and va_end
12105 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
12106 without an intervening invocation of the va_end macro for the same ap.
12108 The parameter parmN is the identifier of the rightmost parameter in the variable
12109 parameter list in the function definition (the one just before the , ...). If the parameter
12110 parmN is declared with the register storage class, with a function or array type, or
12111 with a type that is not compatible with the type that results after application of the default
12112 argument promotions, the behavior is undefined.
12115 The va_start macro returns no value.
12117 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
12118 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
12119 pointers is specified by the first argument to f1.
12120 <!--page 264 indent 4-->
12122 #include <stdarg.h>
12124 void f1(int n_ptrs, ...)
12127 char *array[MAXARGS];
12129 if (n_ptrs > MAXARGS)
12131 va_start(ap, n_ptrs);
12132 while (ptr_no < n_ptrs)
12133 array[ptr_no++] = va_arg(ap, char *);
12137 Each call to f1 is required to have visible the definition of the function or a declaration such as
12139 void f1(int, ...);</pre>
12142 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
12143 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
12144 is gathered again and passed to function f4.
12145 <!--page 265 indent 4-->
12147 #include <stdarg.h>
12149 void f3(int n_ptrs, int f4_after, ...)
12151 va_list ap, ap_save;
12152 char *array[MAXARGS];
12154 if (n_ptrs > MAXARGS)
12156 va_start(ap, f4_after);
12157 while (ptr_no < n_ptrs) {
12158 array[ptr_no++] = va_arg(ap, char *);
12159 if (ptr_no == f4_after)
12160 va_copy(ap_save, ap);
12164 // Now process the saved copy.
12165 n_ptrs -= f4_after;
12167 while (ptr_no < n_ptrs)
12168 array[ptr_no++] = va_arg(ap_save, char *);
12173 <a name="7.16" href="#7.16"><h3>7.16 Boolean type and values <stdbool.h></h3></a>
12175 The header <stdbool.h> defines four macros.
12182 The remaining three macros are suitable for use in #if preprocessing directives. They
12186 which expands to the integer constant 1,
12189 which expands to the integer constant 0, and
12191 __bool_true_false_are_defined</pre>
12192 which expands to the integer constant 1.
12194 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
12195 redefine the macros bool, true, and false.<sup><a href="#note222"><b>222)</b></a></sup>
12200 <!--page 266 indent 4-->
12203 <p><a name="note222">222)</a> See ''future library directions'' (<a href="#7.26.7">7.26.7</a>).
12206 <a name="7.17" href="#7.17"><h3>7.17 Common definitions <stddef.h></h3></a>
12208 The following types and macros are defined in the standard header <stddef.h>. Some
12209 are also defined in other headers, as noted in their respective subclauses.
12214 which is the signed integer type of the result of subtracting two pointers;
12217 which is the unsigned integer type of the result of the sizeof operator; and
12220 which is an integer type whose range of values can represent distinct codes for all
12221 members of the largest extended character set specified among the supported locales; the
12222 null character shall have the code value zero. Each member of the basic character set
12223 shall have a code value equal to its value when used as the lone character in an integer
12224 character constant if an implementation does not define
12225 __STDC_MB_MIGHT_NEQ_WC__.
12230 which expands to an implementation-defined null pointer constant; and
12232 offsetof(type, member-designator)</pre>
12233 which expands to an integer constant expression that has type size_t, the value of
12234 which is the offset in bytes, to the structure member (designated by member-designator),
12235 from the beginning of its structure (designated by type). The type and member designator
12236 shall be such that given
12238 static type t;</pre>
12239 then the expression &(t.member-designator) evaluates to an address constant. (If the
12240 specified member is a bit-field, the behavior is undefined.)
12241 Recommended practice
12243 The types used for size_t and ptrdiff_t should not have an integer conversion rank
12244 greater than that of signed long int unless the implementation supports objects
12245 large enough to make this necessary.
12246 Forward references: localization (<a href="#7.11">7.11</a>).
12247 <!--page 267 indent 4-->
12249 <a name="7.18" href="#7.18"><h3>7.18 Integer types <stdint.h></h3></a>
12251 The header <stdint.h> declares sets of integer types having specified widths, and
12252 defines corresponding sets of macros.<sup><a href="#note223"><b>223)</b></a></sup> It also defines macros that specify limits of
12253 integer types corresponding to types defined in other standard headers.
12255 Types are defined in the following categories:
12257 <li> integer types having certain exact widths;
12258 <li> integer types having at least certain specified widths;
12259 <li> fastest integer types having at least certain specified widths;
12260 <li> integer types wide enough to hold pointers to objects;
12261 <li> integer types having greatest width.
12263 (Some of these types may denote the same type.)
12265 Corresponding macros specify limits of the declared types and construct suitable
12268 For each type described herein that the implementation provides,<sup><a href="#note224"><b>224)</b></a></sup> <stdint.h> shall
12269 declare that typedef name and define the associated macros. Conversely, for each type
12270 described herein that the implementation does not provide, <stdint.h> shall not
12271 declare that typedef name nor shall it define the associated macros. An implementation
12272 shall provide those types described as ''required'', but need not provide any of the others
12273 (described as ''optional'').
12276 <p><a name="note223">223)</a> See ''future library directions'' (<a href="#7.26.8">7.26.8</a>).
12278 <p><a name="note224">224)</a> Some of these types may denote implementation-defined extended integer types.
12281 <a name="7.18.1" href="#7.18.1"><h4>7.18.1 Integer types</h4></a>
12283 When typedef names differing only in the absence or presence of the initial u are defined,
12284 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
12285 implementation providing one of these corresponding types shall also provide the other.
12287 In the following descriptions, the symbol N represents an unsigned decimal integer with
12288 no leading zeros (e.g., 8 or 24, but not 04 or 048).
12293 <!--page 268 indent 4-->
12295 <a name="7.18.1.1" href="#7.18.1.1"><h5>7.18.1.1 Exact-width integer types</h5></a>
12297 The typedef name intN_t designates a signed integer type with width N , no padding
12298 bits, and a two's complement representation. Thus, int8_t denotes a signed integer
12299 type with a width of exactly 8 bits.
12301 The typedef name uintN_t designates an unsigned integer type with width N . Thus,
12302 uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
12304 These types are optional. However, if an implementation provides integer types with
12305 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
12306 two's complement representation, it shall define the corresponding typedef names.
12308 <a name="7.18.1.2" href="#7.18.1.2"><h5>7.18.1.2 Minimum-width integer types</h5></a>
12310 The typedef name int_leastN_t designates a signed integer type with a width of at
12311 least N , such that no signed integer type with lesser size has at least the specified width.
12312 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
12314 The typedef name uint_leastN_t designates an unsigned integer type with a width
12315 of at least N , such that no unsigned integer type with lesser size has at least the specified
12316 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
12319 The following types are required:
12321 int_least8_t uint_least8_t
12322 int_least16_t uint_least16_t
12323 int_least32_t uint_least32_t
12324 int_least64_t uint_least64_t</pre>
12325 All other types of this form are optional.
12327 <a name="7.18.1.3" href="#7.18.1.3"><h5>7.18.1.3 Fastest minimum-width integer types</h5></a>
12329 Each of the following types designates an integer type that is usually fastest<sup><a href="#note225"><b>225)</b></a></sup> to operate
12330 with among all integer types that have at least the specified width.
12332 The typedef name int_fastN_t designates the fastest signed integer type with a width
12333 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
12334 type with a width of at least N .
12339 <!--page 269 indent 4-->
12341 The following types are required:
12343 int_fast8_t uint_fast8_t
12344 int_fast16_t uint_fast16_t
12345 int_fast32_t uint_fast32_t
12346 int_fast64_t uint_fast64_t</pre>
12347 All other types of this form are optional.
12350 <p><a name="note225">225)</a> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
12351 grounds for choosing one type over another, it will simply pick some integer type satisfying the
12352 signedness and width requirements.
12355 <a name="7.18.1.4" href="#7.18.1.4"><h5>7.18.1.4 Integer types capable of holding object pointers</h5></a>
12357 The following type designates a signed integer type with the property that any valid
12358 pointer to void can be converted to this type, then converted back to pointer to void,
12359 and the result will compare equal to the original pointer:
12362 The following type designates an unsigned integer type with the property that any valid
12363 pointer to void can be converted to this type, then converted back to pointer to void,
12364 and the result will compare equal to the original pointer:
12367 These types are optional.
12369 <a name="7.18.1.5" href="#7.18.1.5"><h5>7.18.1.5 Greatest-width integer types</h5></a>
12371 The following type designates a signed integer type capable of representing any value of
12372 any signed integer type:
12375 The following type designates an unsigned integer type capable of representing any value
12376 of any unsigned integer type:
12379 These types are required.
12381 <a name="7.18.2" href="#7.18.2"><h4>7.18.2 Limits of specified-width integer types</h4></a>
12383 The following object-like macros<sup><a href="#note226"><b>226)</b></a></sup> specify the minimum and maximum limits of the
12384 types declared in <stdint.h>. Each macro name corresponds to a similar type name in
12385 <a href="#7.18.1">7.18.1</a>.
12387 Each instance of any defined macro shall be replaced by a constant expression suitable
12388 for use in #if preprocessing directives, and this expression shall have the same type as
12389 would an expression that is an object of the corresponding type converted according to
12391 <!--page 270 indent 4-->
12392 the integer promotions. Its implementation-defined value shall be equal to or greater in
12393 magnitude (absolute value) than the corresponding value given below, with the same sign,
12394 except where stated to be exactly the given value.
12397 <p><a name="note226">226)</a> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
12398 before <stdint.h> is included.
12401 <a name="7.18.2.1" href="#7.18.2.1"><h5>7.18.2.1 Limits of exact-width integer types</h5></a>
12404 <li> minimum values of exact-width signed integer types
12405 INTN_MIN exactly -(2 N -1 )
12406 <li> maximum values of exact-width signed integer types
12407 INTN_MAX exactly 2 N -1 - 1
12408 <li> maximum values of exact-width unsigned integer types
12409 UINTN_MAX exactly 2 N - 1
12412 <a name="7.18.2.2" href="#7.18.2.2"><h5>7.18.2.2 Limits of minimum-width integer types</h5></a>
12415 <li> minimum values of minimum-width signed integer types
12416 INT_LEASTN_MIN -(2 N -1 - 1)
12417 <li> maximum values of minimum-width signed integer types
12418 INT_LEASTN_MAX 2 N -1 - 1
12419 <li> maximum values of minimum-width unsigned integer types
12420 UINT_LEASTN_MAX 2N - 1
12423 <a name="7.18.2.3" href="#7.18.2.3"><h5>7.18.2.3 Limits of fastest minimum-width integer types</h5></a>
12426 <li> minimum values of fastest minimum-width signed integer types
12427 INT_FASTN_MIN -(2 N -1 - 1)
12428 <li> maximum values of fastest minimum-width signed integer types
12429 INT_FASTN_MAX 2 N -1 - 1
12430 <li> maximum values of fastest minimum-width unsigned integer types
12431 UINT_FASTN_MAX 2N - 1
12434 <a name="7.18.2.4" href="#7.18.2.4"><h5>7.18.2.4 Limits of integer types capable of holding object pointers</h5></a>
12437 <li> minimum value of pointer-holding signed integer type
12439 INTPTR_MIN -(215 - 1)</pre>
12440 <li> maximum value of pointer-holding signed integer type
12441 <!--page 271 indent 4-->
12443 INTPTR_MAX 215 - 1</pre>
12444 <li> maximum value of pointer-holding unsigned integer type
12445 UINTPTR_MAX 216 - 1
12448 <a name="7.18.2.5" href="#7.18.2.5"><h5>7.18.2.5 Limits of greatest-width integer types</h5></a>
12451 <li> minimum value of greatest-width signed integer type
12452 INTMAX_MIN -(263 - 1)
12453 <li> maximum value of greatest-width signed integer type
12455 <li> maximum value of greatest-width unsigned integer type
12456 UINTMAX_MAX 264 - 1
12459 <a name="7.18.3" href="#7.18.3"><h4>7.18.3 Limits of other integer types</h4></a>
12461 The following object-like macros<sup><a href="#note227"><b>227)</b></a></sup> specify the minimum and maximum limits of
12462 integer types corresponding to types defined in other standard headers.
12464 Each instance of these macros shall be replaced by a constant expression suitable for use
12465 in #if preprocessing directives, and this expression shall have the same type as would an
12466 expression that is an object of the corresponding type converted according to the integer
12467 promotions. Its implementation-defined value shall be equal to or greater in magnitude
12468 (absolute value) than the corresponding value given below, with the same sign. An
12469 implementation shall define only the macros corresponding to those typedef names it
12470 actually provides.<sup><a href="#note228"><b>228)</b></a></sup>
12472 <li> limits of ptrdiff_t
12475 <li> limits of sig_atomic_t
12476 SIG_ATOMIC_MIN see below
12477 SIG_ATOMIC_MAX see below
12478 <li> limit of size_t
12480 <li> limits of wchar_t
12484 <!--page 272 indent 4-->
12485 WCHAR_MIN see below
12486 WCHAR_MAX see below
12487 <li> limits of wint_t
12492 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
12493 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
12494 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
12495 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
12496 SIG_ATOMIC_MAX shall be no less than 255.
12498 If wchar_t (see <a href="#7.17">7.17</a>) is defined as a signed integer type, the value of WCHAR_MIN
12499 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
12500 otherwise, wchar_t is defined as an unsigned integer type, and the value of
12501 WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.<sup><a href="#note229"><b>229)</b></a></sup>
12503 If wint_t (see <a href="#7.24">7.24</a>) is defined as a signed integer type, the value of WINT_MIN shall
12504 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
12505 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
12506 shall be 0 and the value of WINT_MAX shall be no less than 65535.
12509 <p><a name="note227">227)</a> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
12510 before <stdint.h> is included.
12512 <p><a name="note228">228)</a> A freestanding implementation need not provide all of these types.
12514 <p><a name="note229">229)</a> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
12518 <a name="7.18.4" href="#7.18.4"><h4>7.18.4 Macros for integer constants</h4></a>
12520 The following function-like macros<sup><a href="#note230"><b>230)</b></a></sup> expand to integer constants suitable for
12521 initializing objects that have integer types corresponding to types defined in
12522 <stdint.h>. Each macro name corresponds to a similar type name in <a href="#7.18.1.2">7.18.1.2</a> or
12523 <a href="#7.18.1.5">7.18.1.5</a>.
12525 The argument in any instance of these macros shall be an unsuffixed integer constant (as
12526 defined in <a href="#6.4.4.1">6.4.4.1</a>) with a value that does not exceed the limits for the corresponding type.
12528 Each invocation of one of these macros shall expand to an integer constant expression
12529 suitable for use in #if preprocessing directives. The type of the expression shall have
12530 the same type as would an expression of the corresponding type converted according to
12531 the integer promotions. The value of the expression shall be that of the argument.
12536 <!--page 273 indent 4-->
12539 <p><a name="note230">230)</a> C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
12540 defined before <stdint.h> is included.
12543 <a name="7.18.4.1" href="#7.18.4.1"><h5>7.18.4.1 Macros for minimum-width integer constants</h5></a>
12545 The macro INTN_C(value) shall expand to an integer constant expression
12546 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
12547 to an integer constant expression corresponding to the type uint_leastN_t. For
12548 example, if uint_least64_t is a name for the type unsigned long long int,
12549 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
12551 <a name="7.18.4.2" href="#7.18.4.2"><h5>7.18.4.2 Macros for greatest-width integer constants</h5></a>
12553 The following macro expands to an integer constant expression having the value specified
12554 by its argument and the type intmax_t:
12556 INTMAX_C(value)</pre>
12557 The following macro expands to an integer constant expression having the value specified
12558 by its argument and the type uintmax_t:
12559 <!--page 274 indent 4-->
12561 UINTMAX_C(value)</pre>
12563 <a name="7.19" href="#7.19"><h3>7.19 Input/output <stdio.h></h3></a>
12565 <a name="7.19.1" href="#7.19.1"><h4>7.19.1 Introduction</h4></a>
12567 The header <stdio.h> declares three types, several macros, and many functions for
12568 performing input and output.
12570 The types declared are size_t (described in <a href="#7.17">7.17</a>);
12573 which is an object type capable of recording all the information needed to control a
12574 stream, including its file position indicator, a pointer to its associated buffer (if any), an
12575 error indicator that records whether a read/write error has occurred, and an end-of-file
12576 indicator that records whether the end of the file has been reached; and
12579 which is an object type other than an array type capable of recording all the information
12580 needed to specify uniquely every position within a file.
12582 The macros are NULL (described in <a href="#7.17">7.17</a>);
12587 which expand to integer constant expressions with distinct values, suitable for use as the
12588 third argument to the setvbuf function;
12591 which expands to an integer constant expression that is the size of the buffer used by the
12595 which expands to an integer constant expression, with type int and a negative value, that
12596 is returned by several functions to indicate end-of-file, that is, no more input from a
12600 which expands to an integer constant expression that is the minimum number of files that
12601 the implementation guarantees can be open simultaneously;
12604 which expands to an integer constant expression that is the size needed for an array of
12605 char large enough to hold the longest file name string that the implementation
12606 <!--page 275 indent 4-->
12607 guarantees can be opened;<sup><a href="#note231"><b>231)</b></a></sup>
12610 which expands to an integer constant expression that is the size needed for an array of
12611 char large enough to hold a temporary file name string generated by the tmpnam
12617 which expand to integer constant expressions with distinct values, suitable for use as the
12618 third argument to the fseek function;
12621 which expands to an integer constant expression that is the maximum number of unique
12622 file names that can be generated by the tmpnam function;
12627 which are expressions of type ''pointer to FILE'' that point to the FILE objects
12628 associated, respectively, with the standard error, input, and output streams.
12630 The header <wchar.h> declares a number of functions useful for wide character input
12631 and output. The wide character input/output functions described in that subclause
12632 provide operations analogous to most of those described here, except that the
12633 fundamental units internal to the program are wide characters. The external
12634 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
12635 described further in <a href="#7.19.3">7.19.3</a>.
12637 The input/output functions are given the following collective terms:
12639 <li> The wide character input functions -- those functions described in <a href="#7.24">7.24</a> that perform
12640 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
12641 fwscanf, wscanf, vfwscanf, and vwscanf.
12642 <li> The wide character output functions -- those functions described in <a href="#7.24">7.24</a> that perform
12643 output from wide characters and wide strings: fputwc, fputws, putwc,
12644 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
12647 <!--page 276 indent 4-->
12648 <li> The wide character input/output functions -- the union of the ungetwc function, the
12649 wide character input functions, and the wide character output functions.
12650 <li> The byte input/output functions -- those functions described in this subclause that
12651 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
12652 fscanf, fwrite, getc, getchar, gets, printf, putc, putchar, puts,
12653 scanf, ungetc, vfprintf, vfscanf, vprintf, and vscanf.
12655 Forward references: files (<a href="#7.19.3">7.19.3</a>), the fseek function (<a href="#7.19.9.2">7.19.9.2</a>), streams (<a href="#7.19.2">7.19.2</a>), the
12656 tmpnam function (<a href="#7.19.4.4">7.19.4.4</a>), <wchar.h> (<a href="#7.24">7.24</a>).
12659 <p><a name="note231">231)</a> If the implementation imposes no practical limit on the length of file name strings, the value of
12660 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
12661 string. Of course, file name string contents are subject to other system-specific constraints; therefore
12662 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
12665 <a name="7.19.2" href="#7.19.2"><h4>7.19.2 Streams</h4></a>
12667 Input and output, whether to or from physical devices such as terminals and tape drives,
12668 or whether to or from files supported on structured storage devices, are mapped into
12669 logical data streams, whose properties are more uniform than their various inputs and
12670 outputs. Two forms of mapping are supported, for text streams and for binary
12671 streams.<sup><a href="#note232"><b>232)</b></a></sup>
12673 A text stream is an ordered sequence of characters composed into lines, each line
12674 consisting of zero or more characters plus a terminating new-line character. Whether the
12675 last line requires a terminating new-line character is implementation-defined. Characters
12676 may have to be added, altered, or deleted on input and output to conform to differing
12677 conventions for representing text in the host environment. Thus, there need not be a one-
12678 to-one correspondence between the characters in a stream and those in the external
12679 representation. Data read in from a text stream will necessarily compare equal to the data
12680 that were earlier written out to that stream only if: the data consist only of printing
12681 characters and the control characters horizontal tab and new-line; no new-line character is
12682 immediately preceded by space characters; and the last character is a new-line character.
12683 Whether space characters that are written out immediately before a new-line character
12684 appear when read in is implementation-defined.
12686 A binary stream is an ordered sequence of characters that can transparently record
12687 internal data. Data read in from a binary stream shall compare equal to the data that were
12688 earlier written out to that stream, under the same implementation. Such a stream may,
12689 however, have an implementation-defined number of null characters appended to the end
12692 Each stream has an orientation. After a stream is associated with an external file, but
12693 before any operations are performed on it, the stream is without orientation. Once a wide
12694 character input/output function has been applied to a stream without orientation, the
12697 <!--page 277 indent 4-->
12698 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
12699 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
12700 Only a call to the freopen function or the fwide function can otherwise alter the
12701 orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note233"><b>233)</b></a></sup>
12703 Byte input/output functions shall not be applied to a wide-oriented stream and wide
12704 character input/output functions shall not be applied to a byte-oriented stream. The
12705 remaining stream operations do not affect, and are not affected by, a stream's orientation,
12706 except for the following additional restrictions:
12708 <li> Binary wide-oriented streams have the file-positioning restrictions ascribed to both
12709 text and binary streams.
12710 <li> For wide-oriented streams, after a successful call to a file-positioning function that
12711 leaves the file position indicator prior to the end-of-file, a wide character output
12712 function can overwrite a partial multibyte character; any file contents beyond the
12713 byte(s) written are henceforth indeterminate.
12716 Each wide-oriented stream has an associated mbstate_t object that stores the current
12717 parse state of the stream. A successful call to fgetpos stores a representation of the
12718 value of this mbstate_t object as part of the value of the fpos_t object. A later
12719 successful call to fsetpos using the same stored fpos_t value restores the value of
12720 the associated mbstate_t object as well as the position within the controlled stream.
12721 Environmental limits
12723 An implementation shall support text files with lines containing at least 254 characters,
12724 including the terminating new-line character. The value of the macro BUFSIZ shall be at
12726 Forward references: the freopen function (<a href="#7.19.5.4">7.19.5.4</a>), the fwide function (<a href="#7.24.3.5">7.24.3.5</a>),
12727 mbstate_t (<a href="#7.25.1">7.25.1</a>), the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>), the fsetpos function
12728 (<a href="#7.19.9.3">7.19.9.3</a>).
12733 <!--page 278 indent 4-->
12736 <p><a name="note232">232)</a> An implementation need not distinguish between text streams and binary streams. In such an
12737 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
12740 <p><a name="note233">233)</a> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
12743 <a name="7.19.3" href="#7.19.3"><h4>7.19.3 Files</h4></a>
12745 A stream is associated with an external file (which may be a physical device) by opening
12746 a file, which may involve creating a new file. Creating an existing file causes its former
12747 contents to be discarded, if necessary. If a file can support positioning requests (such as a
12748 disk file, as opposed to a terminal), then a file position indicator associated with the
12749 stream is positioned at the start (character number zero) of the file, unless the file is
12750 opened with append mode in which case it is implementation-defined whether the file
12751 position indicator is initially positioned at the beginning or the end of the file. The file
12752 position indicator is maintained by subsequent reads, writes, and positioning requests, to
12753 facilitate an orderly progression through the file.
12755 Binary files are not truncated, except as defined in <a href="#7.19.5.3">7.19.5.3</a>. Whether a write on a text
12756 stream causes the associated file to be truncated beyond that point is implementation-
12759 When a stream is unbuffered, characters are intended to appear from the source or at the
12760 destination as soon as possible. Otherwise characters may be accumulated and
12761 transmitted to or from the host environment as a block. When a stream is fully buffered,
12762 characters are intended to be transmitted to or from the host environment as a block when
12763 a buffer is filled. When a stream is line buffered, characters are intended to be
12764 transmitted to or from the host environment as a block when a new-line character is
12765 encountered. Furthermore, characters are intended to be transmitted as a block to the host
12766 environment when a buffer is filled, when input is requested on an unbuffered stream, or
12767 when input is requested on a line buffered stream that requires the transmission of
12768 characters from the host environment. Support for these characteristics is
12769 implementation-defined, and may be affected via the setbuf and setvbuf functions.
12771 A file may be disassociated from a controlling stream by closing the file. Output streams
12772 are flushed (any unwritten buffer contents are transmitted to the host environment) before
12773 the stream is disassociated from the file. The value of a pointer to a FILE object is
12774 indeterminate after the associated file is closed (including the standard text streams).
12775 Whether a file of zero length (on which no characters have been written by an output
12776 stream) actually exists is implementation-defined.
12778 The file may be subsequently reopened, by the same or another program execution, and
12779 its contents reclaimed or modified (if it can be repositioned at its start). If the main
12780 function returns to its original caller, or if the exit function is called, all open files are
12781 closed (hence all output streams are flushed) before program termination. Other paths to
12782 program termination, such as calling the abort function, need not close all files
12785 The address of the FILE object used to control a stream may be significant; a copy of a
12786 FILE object need not serve in place of the original.
12787 <!--page 279 indent 5-->
12789 At program startup, three text streams are predefined and need not be opened explicitly
12791 <li> standard input (for reading conventional input), standard output (for writing
12793 conventional output), and standard error (for writing diagnostic output). As initially
12794 opened, the standard error stream is not fully buffered; the standard input and standard
12795 output streams are fully buffered if and only if the stream can be determined not to refer
12796 to an interactive device.
12798 Functions that open additional (nontemporary) files require a file name, which is a string.
12799 The rules for composing valid file names are implementation-defined. Whether the same
12800 file can be simultaneously open multiple times is also implementation-defined.
12802 Although both text and binary wide-oriented streams are conceptually sequences of wide
12803 characters, the external file associated with a wide-oriented stream is a sequence of
12804 multibyte characters, generalized as follows:
12806 <li> Multibyte encodings within files may contain embedded null bytes (unlike multibyte
12807 encodings valid for use internal to the program).
12808 <li> A file need not begin nor end in the initial shift state.<sup><a href="#note234"><b>234)</b></a></sup>
12811 Moreover, the encodings used for multibyte characters may differ among files. Both the
12812 nature and choice of such encodings are implementation-defined.
12814 The wide character input functions read multibyte characters from the stream and convert
12815 them to wide characters as if they were read by successive calls to the fgetwc function.
12816 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
12817 described by the stream's own mbstate_t object. The byte input functions read
12818 characters from the stream as if by successive calls to the fgetc function.
12820 The wide character output functions convert wide characters to multibyte characters and
12821 write them to the stream as if they were written by successive calls to the fputwc
12822 function. Each conversion occurs as if by a call to the wcrtomb function, with the
12823 conversion state described by the stream's own mbstate_t object. The byte output
12824 functions write characters to the stream as if by successive calls to the fputc function.
12826 In some cases, some of the byte input/output functions also perform conversions between
12827 multibyte characters and wide characters. These conversions also occur as if by calls to
12828 the mbrtowc and wcrtomb functions.
12830 An encoding error occurs if the character sequence presented to the underlying
12831 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
12832 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
12835 <!--page 280 indent 5-->
12836 multibyte character. The wide character input/output functions and the byte input/output
12837 functions store the value of the macro EILSEQ in errno if and only if an encoding error
12839 Environmental limits
12841 The value of FOPEN_MAX shall be at least eight, including the three standard text
12843 Forward references: the exit function (<a href="#7.20.4.3">7.20.4.3</a>), the fgetc function (<a href="#7.19.7.1">7.19.7.1</a>), the
12844 fopen function (<a href="#7.19.5.3">7.19.5.3</a>), the fputc function (<a href="#7.19.7.3">7.19.7.3</a>), the setbuf function
12845 (<a href="#7.19.5.5">7.19.5.5</a>), the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>), the fgetwc function (<a href="#7.24.3.1">7.24.3.1</a>), the
12846 fputwc function (<a href="#7.24.3.3">7.24.3.3</a>), conversion state (<a href="#7.24.6">7.24.6</a>), the mbrtowc function
12847 (<a href="#7.24.6.3.2">7.24.6.3.2</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
12850 <p><a name="note234">234)</a> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
12851 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
12852 with state-dependent encoding that does not assuredly end in the initial shift state.
12855 <a name="7.19.4" href="#7.19.4"><h4>7.19.4 Operations on files</h4></a>
12857 <a name="7.19.4.1" href="#7.19.4.1"><h5>7.19.4.1 The remove function</h5></a>
12861 #include <stdio.h>
12862 int remove(const char *filename);</pre>
12863 <h6>Description</h6>
12865 The remove function causes the file whose name is the string pointed to by filename
12866 to be no longer accessible by that name. A subsequent attempt to open that file using that
12867 name will fail, unless it is created anew. If the file is open, the behavior of the remove
12868 function is implementation-defined.
12871 The remove function returns zero if the operation succeeds, nonzero if it fails.
12873 <a name="7.19.4.2" href="#7.19.4.2"><h5>7.19.4.2 The rename function</h5></a>
12877 #include <stdio.h>
12878 int rename(const char *old, const char *new);</pre>
12879 <h6>Description</h6>
12881 The rename function causes the file whose name is the string pointed to by old to be
12882 henceforth known by the name given by the string pointed to by new. The file named
12883 old is no longer accessible by that name. If a file named by the string pointed to by new
12884 exists prior to the call to the rename function, the behavior is implementation-defined.
12885 <!--page 281 indent 4-->
12888 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note235"><b>235)</b></a></sup> in
12889 which case if the file existed previously it is still known by its original name.
12892 <p><a name="note235">235)</a> Among the reasons the implementation may cause the rename function to fail are that the file is open
12893 or that it is necessary to copy its contents to effectuate its renaming.
12896 <a name="7.19.4.3" href="#7.19.4.3"><h5>7.19.4.3 The tmpfile function</h5></a>
12900 #include <stdio.h>
12901 FILE *tmpfile(void);</pre>
12902 <h6>Description</h6>
12904 The tmpfile function creates a temporary binary file that is different from any other
12905 existing file and that will automatically be removed when it is closed or at program
12906 termination. If the program terminates abnormally, whether an open temporary file is
12907 removed is implementation-defined. The file is opened for update with "wb+" mode.
12908 Recommended practice
12910 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
12911 program (this limit may be shared with tmpnam) and there should be no limit on the
12912 number simultaneously open other than this limit and any limit on the number of open
12916 The tmpfile function returns a pointer to the stream of the file that it created. If the file
12917 cannot be created, the tmpfile function returns a null pointer.
12918 Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
12920 <a name="7.19.4.4" href="#7.19.4.4"><h5>7.19.4.4 The tmpnam function</h5></a>
12924 #include <stdio.h>
12925 char *tmpnam(char *s);</pre>
12926 <h6>Description</h6>
12928 The tmpnam function generates a string that is a valid file name and that is not the same
12929 as the name of an existing file.<sup><a href="#note236"><b>236)</b></a></sup> The function is potentially capable of generating
12932 <!--page 282 indent 4-->
12933 TMP_MAX different strings, but any or all of them may already be in use by existing files
12934 and thus not be suitable return values.
12936 The tmpnam function generates a different string each time it is called.
12938 The implementation shall behave as if no library function calls the tmpnam function.
12941 If no suitable string can be generated, the tmpnam function returns a null pointer.
12942 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
12943 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
12944 function may modify the same object). If the argument is not a null pointer, it is assumed
12945 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
12946 in that array and returns the argument as its value.
12947 Environmental limits
12949 The value of the macro TMP_MAX shall be at least 25.
12952 <p><a name="note236">236)</a> Files created using strings generated by the tmpnam function are temporary only in the sense that
12953 their names should not collide with those generated by conventional naming rules for the
12954 implementation. It is still necessary to use the remove function to remove such files when their use
12955 is ended, and before program termination.
12958 <a name="7.19.5" href="#7.19.5"><h4>7.19.5 File access functions</h4></a>
12960 <a name="7.19.5.1" href="#7.19.5.1"><h5>7.19.5.1 The fclose function</h5></a>
12964 #include <stdio.h>
12965 int fclose(FILE *stream);</pre>
12966 <h6>Description</h6>
12968 A successful call to the fclose function causes the stream pointed to by stream to be
12969 flushed and the associated file to be closed. Any unwritten buffered data for the stream
12970 are delivered to the host environment to be written to the file; any unread buffered data
12971 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
12972 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
12973 (and deallocated if it was automatically allocated).
12976 The fclose function returns zero if the stream was successfully closed, or EOF if any
12977 errors were detected.
12979 <a name="7.19.5.2" href="#7.19.5.2"><h5>7.19.5.2 The fflush function</h5></a>
12982 <!--page 283 indent 4-->
12984 #include <stdio.h>
12985 int fflush(FILE *stream);</pre>
12986 <h6>Description</h6>
12988 If stream points to an output stream or an update stream in which the most recent
12989 operation was not input, the fflush function causes any unwritten data for that stream
12990 to be delivered to the host environment to be written to the file; otherwise, the behavior is
12993 If stream is a null pointer, the fflush function performs this flushing action on all
12994 streams for which the behavior is defined above.
12997 The fflush function sets the error indicator for the stream and returns EOF if a write
12998 error occurs, otherwise it returns zero.
12999 Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
13001 <a name="7.19.5.3" href="#7.19.5.3"><h5>7.19.5.3 The fopen function</h5></a>
13005 #include <stdio.h>
13006 FILE *fopen(const char * restrict filename,
13007 const char * restrict mode);</pre>
13008 <h6>Description</h6>
13010 The fopen function opens the file whose name is the string pointed to by filename,
13011 and associates a stream with it.
13013 The argument mode points to a string. If the string is one of the following, the file is
13014 open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note237"><b>237)</b></a></sup>
13015 r open text file for reading
13016 w truncate to zero length or create text file for writing
13017 a append; open or create text file for writing at end-of-file
13018 rb open binary file for reading
13019 wb truncate to zero length or create binary file for writing
13020 ab append; open or create binary file for writing at end-of-file
13021 r+ open text file for update (reading and writing)
13022 w+ truncate to zero length or create text file for update
13023 a+ append; open or create text file for update, writing at end-of-file
13028 <!--page 284 indent 4-->
13029 r+b or rb+ open binary file for update (reading and writing)
13030 w+b or wb+ truncate to zero length or create binary file for update
13031 a+b or ab+ append; open or create binary file for update, writing at end-of-file
13033 Opening a file with read mode ('r' as the first character in the mode argument) fails if
13034 the file does not exist or cannot be read.
13036 Opening a file with append mode ('a' as the first character in the mode argument)
13037 causes all subsequent writes to the file to be forced to the then current end-of-file,
13038 regardless of intervening calls to the fseek function. In some implementations, opening
13039 a binary file with append mode ('b' as the second or third character in the above list of
13040 mode argument values) may initially position the file position indicator for the stream
13041 beyond the last data written, because of null character padding.
13043 When a file is opened with update mode ('+' as the second or third character in the
13044 above list of mode argument values), both input and output may be performed on the
13045 associated stream. However, output shall not be directly followed by input without an
13046 intervening call to the fflush function or to a file positioning function (fseek,
13047 fsetpos, or rewind), and input shall not be directly followed by output without an
13048 intervening call to a file positioning function, unless the input operation encounters end-
13049 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
13050 binary stream in some implementations.
13052 When opened, a stream is fully buffered if and only if it can be determined not to refer to
13053 an interactive device. The error and end-of-file indicators for the stream are cleared.
13056 The fopen function returns a pointer to the object controlling the stream. If the open
13057 operation fails, fopen returns a null pointer.
13058 Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
13061 <p><a name="note237">237)</a> If the string begins with one of the above sequences, the implementation might choose to ignore the
13062 remaining characters, or it might use them to select different kinds of a file (some of which might not
13063 conform to the properties in <a href="#7.19.2">7.19.2</a>).
13066 <a name="7.19.5.4" href="#7.19.5.4"><h5>7.19.5.4 The freopen function</h5></a>
13070 #include <stdio.h>
13071 FILE *freopen(const char * restrict filename,
13072 const char * restrict mode,
13073 FILE * restrict stream);</pre>
13074 <h6>Description</h6>
13076 The freopen function opens the file whose name is the string pointed to by filename
13077 and associates the stream pointed to by stream with it. The mode argument is used just
13078 <!--page 285 indent 4-->
13079 as in the fopen function.<sup><a href="#note238"><b>238)</b></a></sup>
13081 If filename is a null pointer, the freopen function attempts to change the mode of
13082 the stream to that specified by mode, as if the name of the file currently associated with
13083 the stream had been used. It is implementation-defined which changes of mode are
13084 permitted (if any), and under what circumstances.
13086 The freopen function first attempts to close any file that is associated with the specified
13087 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
13088 stream are cleared.
13091 The freopen function returns a null pointer if the open operation fails. Otherwise,
13092 freopen returns the value of stream.
13095 <p><a name="note238">238)</a> The primary use of the freopen function is to change the file associated with a standard text stream
13096 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
13097 returned by the fopen function may be assigned.
13100 <a name="7.19.5.5" href="#7.19.5.5"><h5>7.19.5.5 The setbuf function</h5></a>
13104 #include <stdio.h>
13105 void setbuf(FILE * restrict stream,
13106 char * restrict buf);</pre>
13107 <h6>Description</h6>
13109 Except that it returns no value, the setbuf function is equivalent to the setvbuf
13110 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
13111 is a null pointer), with the value _IONBF for mode.
13114 The setbuf function returns no value.
13115 Forward references: the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
13117 <a name="7.19.5.6" href="#7.19.5.6"><h5>7.19.5.6 The setvbuf function</h5></a>
13121 #include <stdio.h>
13122 int setvbuf(FILE * restrict stream,
13123 char * restrict buf,
13124 int mode, size_t size);</pre>
13129 <!--page 286 indent 4-->
13130 <h6>Description</h6>
13132 The setvbuf function may be used only after the stream pointed to by stream has
13133 been associated with an open file and before any other operation (other than an
13134 unsuccessful call to setvbuf) is performed on the stream. The argument mode
13135 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
13136 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
13137 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
13138 used instead of a buffer allocated by the setvbuf function<sup><a href="#note239"><b>239)</b></a></sup> and the argument size
13139 specifies the size of the array; otherwise, size may determine the size of a buffer
13140 allocated by the setvbuf function. The contents of the array at any time are
13144 The setvbuf function returns zero on success, or nonzero if an invalid value is given
13145 for mode or if the request cannot be honored.
13148 <p><a name="note239">239)</a> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
13149 before a buffer that has automatic storage duration is deallocated upon block exit.
13152 <a name="7.19.6" href="#7.19.6"><h4>7.19.6 Formatted input/output functions</h4></a>
13154 The formatted input/output functions shall behave as if there is a sequence point after the
13155 actions associated with each specifier.<sup><a href="#note240"><b>240)</b></a></sup>
13158 <p><a name="note240">240)</a> The fprintf functions perform writes to memory for the %n specifier.
13161 <a name="7.19.6.1" href="#7.19.6.1"><h5>7.19.6.1 The fprintf function</h5></a>
13165 #include <stdio.h>
13166 int fprintf(FILE * restrict stream,
13167 const char * restrict format, ...);</pre>
13168 <h6>Description</h6>
13170 The fprintf function writes output to the stream pointed to by stream, under control
13171 of the string pointed to by format that specifies how subsequent arguments are
13172 converted for output. If there are insufficient arguments for the format, the behavior is
13173 undefined. If the format is exhausted while arguments remain, the excess arguments are
13174 evaluated (as always) but are otherwise ignored. The fprintf function returns when
13175 the end of the format string is encountered.
13177 The format shall be a multibyte character sequence, beginning and ending in its initial
13178 shift state. The format is composed of zero or more directives: ordinary multibyte
13179 characters (not %), which are copied unchanged to the output stream; and conversion
13182 <!--page 287 indent 4-->
13183 specifications, each of which results in fetching zero or more subsequent arguments,
13184 converting them, if applicable, according to the corresponding conversion specifier, and
13185 then writing the result to the output stream.
13187 Each conversion specification is introduced by the character %. After the %, the following
13188 appear in sequence:
13190 <li> Zero or more flags (in any order) that modify the meaning of the conversion
13192 <li> An optional minimum field width. If the converted value has fewer characters than the
13193 field width, it is padded with spaces (by default) on the left (or right, if the left
13194 adjustment flag, described later, has been given) to the field width. The field width
13195 takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note241"><b>241)</b></a></sup>
13196 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
13197 o, u, x, and X conversions, the number of digits to appear after the decimal-point
13198 character for a, A, e, E, f, and F conversions, the maximum number of significant
13199 digits for the g and G conversions, or the maximum number of bytes to be written for
13200 s conversions. The precision takes the form of a period (.) followed either by an
13201 asterisk * (described later) or by an optional decimal integer; if only the period is
13202 specified, the precision is taken as zero. If a precision appears with any other
13203 conversion specifier, the behavior is undefined.
13204 <li> An optional length modifier that specifies the size of the argument.
13205 <li> A conversion specifier character that specifies the type of conversion to be applied.
13208 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
13209 this case, an int argument supplies the field width or precision. The arguments
13210 specifying field width, or precision, or both, shall appear (in that order) before the
13211 argument (if any) to be converted. A negative field width argument is taken as a - flag
13212 followed by a positive field width. A negative precision argument is taken as if the
13213 precision were omitted.
13215 The flag characters and their meanings are:
13216 - The result of the conversion is left-justified within the field. (It is right-justified if
13218 this flag is not specified.)</pre>
13219 + The result of a signed conversion always begins with a plus or minus sign. (It
13221 begins with a sign only when a negative value is converted if this flag is not</pre>
13226 <!--page 288 indent 4-->
13228 specified.)<sup><a href="#note242"><b>242)</b></a></sup></pre>
13229 space If the first character of a signed conversion is not a sign, or if a signed conversion
13231 results in no characters, a space is prefixed to the result. If the space and + flags
13232 both appear, the space flag is ignored.</pre>
13233 # The result is converted to an ''alternative form''. For o conversion, it increases
13235 the precision, if and only if necessary, to force the first digit of the result to be a
13236 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
13237 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
13238 and G conversions, the result of converting a floating-point number always
13239 contains a decimal-point character, even if no digits follow it. (Normally, a
13240 decimal-point character appears in the result of these conversions only if a digit
13241 follows it.) For g and G conversions, trailing zeros are not removed from the
13242 result. For other conversions, the behavior is undefined.</pre>
13243 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
13246 (following any indication of sign or base) are used to pad to the field width rather
13247 than performing space padding, except when converting an infinity or NaN. If the
13248 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
13249 conversions, if a precision is specified, the 0 flag is ignored. For other
13250 conversions, the behavior is undefined.</pre>
13251 The length modifiers and their meanings are:
13252 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13254 signed char or unsigned char argument (the argument will have
13255 been promoted according to the integer promotions, but its value shall be
13256 converted to signed char or unsigned char before printing); or that
13257 a following n conversion specifier applies to a pointer to a signed char
13259 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13261 short int or unsigned short int argument (the argument will
13262 have been promoted according to the integer promotions, but its value shall
13263 be converted to short int or unsigned short int before printing);
13264 or that a following n conversion specifier applies to a pointer to a short
13265 int argument.</pre>
13266 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13268 long int or unsigned long int argument; that a following n
13269 conversion specifier applies to a pointer to a long int argument; that a</pre>
13271 <!--page 289 indent 4-->
13273 following c conversion specifier applies to a wint_t argument; that a
13274 following s conversion specifier applies to a pointer to a wchar_t
13275 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
13277 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13279 long long int or unsigned long long int argument; or that a
13280 following n conversion specifier applies to a pointer to a long long int
13282 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
13284 an intmax_t or uintmax_t argument; or that a following n conversion
13285 specifier applies to a pointer to an intmax_t argument.</pre>
13286 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13288 size_t or the corresponding signed integer type argument; or that a
13289 following n conversion specifier applies to a pointer to a signed integer type
13290 corresponding to size_t argument.</pre>
13291 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13293 ptrdiff_t or the corresponding unsigned integer type argument; or that a
13294 following n conversion specifier applies to a pointer to a ptrdiff_t
13296 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
13298 applies to a long double argument.</pre>
13299 If a length modifier appears with any conversion specifier other than as specified above,
13300 the behavior is undefined.
13302 The conversion specifiers and their meanings are:
13303 d,i The int argument is converted to signed decimal in the style [-]dddd. The
13305 precision specifies the minimum number of digits to appear; if the value
13306 being converted can be represented in fewer digits, it is expanded with
13307 leading zeros. The default precision is 1. The result of converting a zero
13308 value with a precision of zero is no characters.</pre>
13309 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
13310 <!--page 290 indent 0-->
13312 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
13313 letters abcdef are used for x conversion and the letters ABCDEF for X
13314 conversion. The precision specifies the minimum number of digits to appear;
13315 if the value being converted can be represented in fewer digits, it is expanded
13316 with leading zeros. The default precision is 1. The result of converting a
13317 zero value with a precision of zero is no characters.</pre>
13318 f,F A double argument representing a floating-point number is converted to
13320 decimal notation in the style [-]ddd.ddd, where the number of digits after
13321 the decimal-point character is equal to the precision specification. If the
13322 precision is missing, it is taken as 6; if the precision is zero and the # flag is
13323 not specified, no decimal-point character appears. If a decimal-point
13324 character appears, at least one digit appears before it. The value is rounded to
13325 the appropriate number of digits.
13326 A double argument representing an infinity is converted in one of the styles
13327 [-]inf or [-]infinity -- which style is implementation-defined. A
13328 double argument representing a NaN is converted in one of the styles
13329 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
13330 any n-char-sequence, is implementation-defined. The F conversion specifier
13331 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
13332 respectively.<sup><a href="#note243"><b>243)</b></a></sup></pre>
13333 e,E A double argument representing a floating-point number is converted in the
13335 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
13336 argument is nonzero) before the decimal-point character and the number of
13337 digits after it is equal to the precision; if the precision is missing, it is taken as
13338 6; if the precision is zero and the # flag is not specified, no decimal-point
13339 character appears. The value is rounded to the appropriate number of digits.
13340 The E conversion specifier produces a number with E instead of e
13341 introducing the exponent. The exponent always contains at least two digits,
13342 and only as many more digits as necessary to represent the exponent. If the
13343 value is zero, the exponent is zero.
13344 A double argument representing an infinity or NaN is converted in the style
13345 of an f or F conversion specifier.</pre>
13346 g,G A double argument representing a floating-point number is converted in
13348 style f or e (or in style F or E in the case of a G conversion specifier),
13349 depending on the value converted and the precision. Let P equal the
13350 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
13351 Then, if a conversion with style E would have an exponent of X :
13352 -- if P > X >= -4, the conversion is with style f (or F) and precision
13354 -- otherwise, the conversion is with style e (or E) and precision P - 1.
13355 Finally, unless the # flag is used, any trailing zeros are removed from the</pre>
13357 <!--page 291 indent 0-->
13359 fractional portion of the result and the decimal-point character is removed if
13360 there is no fractional portion remaining.
13361 A double argument representing an infinity or NaN is converted in the style
13362 of an f or F conversion specifier.</pre>
13363 a,A A double argument representing a floating-point number is converted in the
13365 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
13366 nonzero if the argument is a normalized floating-point number and is
13367 otherwise unspecified) before the decimal-point character<sup><a href="#note244"><b>244)</b></a></sup> and the number
13368 of hexadecimal digits after it is equal to the precision; if the precision is
13369 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
13370 an exact representation of the value; if the precision is missing and
13371 FLT_RADIX is not a power of 2, then the precision is sufficient to
13372 distinguish<sup><a href="#note245"><b>245)</b></a></sup> values of type double, except that trailing zeros may be
13373 omitted; if the precision is zero and the # flag is not specified, no decimal-
13374 point character appears. The letters abcdef are used for a conversion and
13375 the letters ABCDEF for A conversion. The A conversion specifier produces a
13376 number with X and P instead of x and p. The exponent always contains at
13377 least one digit, and only as many more digits as necessary to represent the
13378 decimal exponent of 2. If the value is zero, the exponent is zero.
13379 A double argument representing an infinity or NaN is converted in the style
13380 of an f or F conversion specifier.</pre>
13381 c If no l length modifier is present, the int argument is converted to an
13383 unsigned char, and the resulting character is written.
13384 If an l length modifier is present, the wint_t argument is converted as if by
13385 an ls conversion specification with no precision and an argument that points
13386 to the initial element of a two-element array of wchar_t, the first element
13387 containing the wint_t argument to the lc conversion specification and the
13388 second a null wide character.</pre>
13389 s If no l length modifier is present, the argument shall be a pointer to the initial
13391 element of an array of character type.<sup><a href="#note246"><b>246)</b></a></sup> Characters from the array are</pre>
13394 <!--page 292 indent 5-->
13396 written up to (but not including) the terminating null character. If the
13397 precision is specified, no more than that many bytes are written. If the
13398 precision is not specified or is greater than the size of the array, the array shall
13399 contain a null character.
13400 If an l length modifier is present, the argument shall be a pointer to the initial
13401 element of an array of wchar_t type. Wide characters from the array are
13402 converted to multibyte characters (each as if by a call to the wcrtomb
13403 function, with the conversion state described by an mbstate_t object
13404 initialized to zero before the first wide character is converted) up to and
13405 including a terminating null wide character. The resulting multibyte
13406 characters are written up to (but not including) the terminating null character
13407 (byte). If no precision is specified, the array shall contain a null wide
13408 character. If a precision is specified, no more than that many bytes are
13409 written (including shift sequences, if any), and the array shall contain a null
13410 wide character if, to equal the multibyte character sequence length given by
13411 the precision, the function would need to access a wide character one past the
13412 end of the array. In no case is a partial multibyte character written.<sup><a href="#note247"><b>247)</b></a></sup></pre>
13413 p The argument shall be a pointer to void. The value of the pointer is
13415 converted to a sequence of printing characters, in an implementation-defined
13417 n The argument shall be a pointer to signed integer into which is written the
13419 number of characters written to the output stream so far by this call to
13420 fprintf. No argument is converted, but one is consumed. If the conversion
13421 specification includes any flags, a field width, or a precision, the behavior is
13423 % A % character is written. No argument is converted. The complete
13426 conversion specification shall be %%.</pre>
13427 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note248"><b>248)</b></a></sup> If any argument is
13428 not the correct type for the corresponding conversion specification, the behavior is
13431 In no case does a nonexistent or small field width cause truncation of a field; if the result
13432 of a conversion is wider than the field width, the field is expanded to contain the
13438 <!--page 293 indent 5-->
13440 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
13441 to a hexadecimal floating number with the given precision.
13442 Recommended practice
13444 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
13445 representable in the given precision, the result should be one of the two adjacent numbers
13446 in hexadecimal floating style with the given precision, with the extra stipulation that the
13447 error should have a correct sign for the current rounding direction.
13449 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
13450 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note249"><b>249)</b></a></sup> If the number of
13451 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
13452 representable with DECIMAL_DIG digits, then the result should be an exact
13453 representation with trailing zeros. Otherwise, the source value is bounded by two
13454 adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value
13455 of the resultant decimal string D should satisfy L <= D <= U, with the extra stipulation that
13456 the error should have a correct sign for the current rounding direction.
13459 The fprintf function returns the number of characters transmitted, or a negative value
13460 if an output or encoding error occurred.
13461 Environmental limits
13463 The number of characters that can be produced by any single conversion shall be at least
13466 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
13469 #include <math.h>
13470 #include <stdio.h>
13472 char *weekday, *month; // pointers to strings
13473 int day, hour, min;
13474 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
13475 weekday, month, day, hour, min);
13476 fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));</pre>
13479 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
13480 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
13481 the first of which is denoted here by a and the second by an uppercase letter.
13486 <!--page 294 indent 5-->
13488 Given the following wide string with length seven,
13490 static wchar_t wstr[] = L" X Yabc Z W";</pre>
13493 fprintf(stdout, "|1234567890123|\n");
13494 fprintf(stdout, "|%13ls|\n", wstr);
13495 fprintf(stdout, "|%-13.9ls|\n", wstr);
13496 fprintf(stdout, "|%13.10ls|\n", wstr);
13497 fprintf(stdout, "|%13.11ls|\n", wstr);
13498 fprintf(stdout, "|%13.15ls|\n", &wstr[2]);
13499 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);</pre>
13500 will print the following seven lines:
13510 Forward references: conversion state (<a href="#7.24.6">7.24.6</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
13513 <p><a name="note241">241)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
13515 <p><a name="note242">242)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
13516 include a minus sign.
13518 <p><a name="note243">243)</a> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
13519 the # and 0 flag characters have no effect.
13521 <p><a name="note244">244)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
13522 that subsequent digits align to nibble (4-bit) boundaries.
13524 <p><a name="note245">245)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is
13525 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
13526 might suffice depending on the implementation's scheme for determining the digit to the left of the
13527 decimal-point character.
13529 <p><a name="note246">246)</a> No special provisions are made for multibyte characters.
13531 <p><a name="note247">247)</a> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
13533 <p><a name="note248">248)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
13535 <p><a name="note249">249)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
13536 given format specifier. The number of significant digits is determined by the format specifier, and in
13537 the case of fixed-point conversion by the source value as well.
13540 <a name="7.19.6.2" href="#7.19.6.2"><h5>7.19.6.2 The fscanf function</h5></a>
13544 #include <stdio.h>
13545 int fscanf(FILE * restrict stream,
13546 const char * restrict format, ...);</pre>
13547 <h6>Description</h6>
13549 The fscanf function reads input from the stream pointed to by stream, under control
13550 of the string pointed to by format that specifies the admissible input sequences and how
13551 they are to be converted for assignment, using subsequent arguments as pointers to the
13552 objects to receive the converted input. If there are insufficient arguments for the format,
13553 the behavior is undefined. If the format is exhausted while arguments remain, the excess
13554 arguments are evaluated (as always) but are otherwise ignored.
13556 The format shall be a multibyte character sequence, beginning and ending in its initial
13557 shift state. The format is composed of zero or more directives: one or more white-space
13558 characters, an ordinary multibyte character (neither % nor a white-space character), or a
13559 conversion specification. Each conversion specification is introduced by the character %.
13560 After the %, the following appear in sequence:
13562 <li> An optional assignment-suppressing character *.
13563 <li> An optional decimal integer greater than zero that specifies the maximum field width
13565 <!--page 295 indent 5-->
13566 <li> An optional length modifier that specifies the size of the receiving object.
13567 <li> A conversion specifier character that specifies the type of conversion to be applied.
13570 The fscanf function executes each directive of the format in turn. If a directive fails, as
13571 detailed below, the function returns. Failures are described as input failures (due to the
13572 occurrence of an encoding error or the unavailability of input characters), or matching
13573 failures (due to inappropriate input).
13575 A directive composed of white-space character(s) is executed by reading input up to the
13576 first non-white-space character (which remains unread), or until no more characters can
13579 A directive that is an ordinary multibyte character is executed by reading the next
13580 characters of the stream. If any of those characters differ from the ones composing the
13581 directive, the directive fails and the differing and subsequent characters remain unread.
13582 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
13583 read, the directive fails.
13585 A directive that is a conversion specification defines a set of matching input sequences, as
13586 described below for each specifier. A conversion specification is executed in the
13589 Input white-space characters (as specified by the isspace function) are skipped, unless
13590 the specification includes a [, c, or n specifier.<sup><a href="#note250"><b>250)</b></a></sup>
13592 An input item is read from the stream, unless the specification includes an n specifier. An
13593 input item is defined as the longest sequence of input characters which does not exceed
13594 any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note251"><b>251)</b></a></sup>
13595 The first character, if any, after the input item remains unread. If the length of the input
13596 item is zero, the execution of the directive fails; this condition is a matching failure unless
13597 end-of-file, an encoding error, or a read error prevented input from the stream, in which
13598 case it is an input failure.
13600 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
13601 count of input characters) is converted to a type appropriate to the conversion specifier. If
13602 the input item is not a matching sequence, the execution of the directive fails: this
13603 condition is a matching failure. Unless assignment suppression was indicated by a *, the
13604 result of the conversion is placed in the object pointed to by the first argument following
13605 the format argument that has not already received a conversion result. If this object
13606 does not have an appropriate type, or if the result of the conversion cannot be represented
13609 <!--page 296 indent 5-->
13610 in the object, the behavior is undefined.
13612 The length modifiers and their meanings are:
13613 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13615 to an argument with type pointer to signed char or unsigned char.</pre>
13616 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13618 to an argument with type pointer to short int or unsigned short
13620 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13622 to an argument with type pointer to long int or unsigned long
13623 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
13624 an argument with type pointer to double; or that a following c, s, or [
13625 conversion specifier applies to an argument with type pointer to wchar_t.</pre>
13626 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13628 to an argument with type pointer to long long int or unsigned
13629 long long int.</pre>
13630 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13632 to an argument with type pointer to intmax_t or uintmax_t.</pre>
13633 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13635 to an argument with type pointer to size_t or the corresponding signed
13636 integer type.</pre>
13637 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13639 to an argument with type pointer to ptrdiff_t or the corresponding
13640 unsigned integer type.</pre>
13641 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
13643 applies to an argument with type pointer to long double.</pre>
13644 If a length modifier appears with any conversion specifier other than as specified above,
13645 the behavior is undefined.
13647 The conversion specifiers and their meanings are:
13648 d Matches an optionally signed decimal integer, whose format is the same as
13650 expected for the subject sequence of the strtol function with the value 10
13651 for the base argument. The corresponding argument shall be a pointer to
13652 signed integer.</pre>
13653 i Matches an optionally signed integer, whose format is the same as expected
13654 <!--page 297 indent 0-->
13656 for the subject sequence of the strtol function with the value 0 for the
13657 base argument. The corresponding argument shall be a pointer to signed
13659 o Matches an optionally signed octal integer, whose format is the same as
13661 expected for the subject sequence of the strtoul function with the value 8
13662 for the base argument. The corresponding argument shall be a pointer to
13663 unsigned integer.</pre>
13664 u Matches an optionally signed decimal integer, whose format is the same as
13666 expected for the subject sequence of the strtoul function with the value 10
13667 for the base argument. The corresponding argument shall be a pointer to
13668 unsigned integer.</pre>
13669 x Matches an optionally signed hexadecimal integer, whose format is the same
13671 as expected for the subject sequence of the strtoul function with the value
13672 16 for the base argument. The corresponding argument shall be a pointer to
13673 unsigned integer.</pre>
13674 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
13676 format is the same as expected for the subject sequence of the strtod
13677 function. The corresponding argument shall be a pointer to floating.</pre>
13678 c Matches a sequence of characters of exactly the number specified by the field
13680 width (1 if no field width is present in the directive).<sup><a href="#note252"><b>252)</b></a></sup>
13681 If no l length modifier is present, the corresponding argument shall be a
13682 pointer to the initial element of a character array large enough to accept the
13683 sequence. No null character is added.
13684 If an l length modifier is present, the input shall be a sequence of multibyte
13685 characters that begins in the initial shift state. Each multibyte character in the
13686 sequence is converted to a wide character as if by a call to the mbrtowc
13687 function, with the conversion state described by an mbstate_t object
13688 initialized to zero before the first multibyte character is converted. The
13689 corresponding argument shall be a pointer to the initial element of an array of
13690 wchar_t large enough to accept the resulting sequence of wide characters.
13691 No null wide character is added.</pre>
13692 s Matches a sequence of non-white-space characters.252)
13694 If no l length modifier is present, the corresponding argument shall be a
13695 pointer to the initial element of a character array large enough to accept the
13696 sequence and a terminating null character, which will be added automatically.
13697 If an l length modifier is present, the input shall be a sequence of multibyte</pre>
13700 <!--page 298 indent 0-->
13702 characters that begins in the initial shift state. Each multibyte character is
13703 converted to a wide character as if by a call to the mbrtowc function, with
13704 the conversion state described by an mbstate_t object initialized to zero
13705 before the first multibyte character is converted. The corresponding argument
13706 shall be a pointer to the initial element of an array of wchar_t large enough
13707 to accept the sequence and the terminating null wide character, which will be
13708 added automatically.</pre>
13709 [ Matches a nonempty sequence of characters from a set of expected characters
13712 If no l length modifier is present, the corresponding argument shall be a
13713 pointer to the initial element of a character array large enough to accept the
13714 sequence and a terminating null character, which will be added automatically.
13715 If an l length modifier is present, the input shall be a sequence of multibyte
13716 characters that begins in the initial shift state. Each multibyte character is
13717 converted to a wide character as if by a call to the mbrtowc function, with
13718 the conversion state described by an mbstate_t object initialized to zero
13719 before the first multibyte character is converted. The corresponding argument
13720 shall be a pointer to the initial element of an array of wchar_t large enough
13721 to accept the sequence and the terminating null wide character, which will be
13722 added automatically.
13723 The conversion specifier includes all subsequent characters in the format
13724 string, up to and including the matching right bracket (]). The characters
13725 between the brackets (the scanlist) compose the scanset, unless the character
13726 after the left bracket is a circumflex (^), in which case the scanset contains all
13727 characters that do not appear in the scanlist between the circumflex and the
13728 right bracket. If the conversion specifier begins with [] or [^], the right
13729 bracket character is in the scanlist and the next following right bracket
13730 character is the matching right bracket that ends the specification; otherwise
13731 the first following right bracket character is the one that ends the
13732 specification. If a - character is in the scanlist and is not the first, nor the
13733 second where the first character is a ^, nor the last character, the behavior is
13734 implementation-defined.</pre>
13735 p Matches an implementation-defined set of sequences, which should be the
13736 <!--page 299 indent 5-->
13738 same as the set of sequences that may be produced by the %p conversion of
13739 the fprintf function. The corresponding argument shall be a pointer to a
13740 pointer to void. The input item is converted to a pointer value in an
13741 implementation-defined manner. If the input item is a value converted earlier
13742 during the same program execution, the pointer that results shall compare
13743 equal to that value; otherwise the behavior of the %p conversion is undefined.</pre>
13744 n No input is consumed. The corresponding argument shall be a pointer to
13746 signed integer into which is to be written the number of characters read from
13747 the input stream so far by this call to the fscanf function. Execution of a
13748 %n directive does not increment the assignment count returned at the
13749 completion of execution of the fscanf function. No argument is converted,
13750 but one is consumed. If the conversion specification includes an assignment-
13751 suppressing character or a field width, the behavior is undefined.</pre>
13752 % Matches a single % character; no conversion or assignment occurs. The
13755 complete conversion specification shall be %%.</pre>
13756 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note253"><b>253)</b></a></sup>
13758 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
13759 respectively, a, e, f, g, and x.
13761 Trailing white space (including new-line characters) is left unread unless matched by a
13762 directive. The success of literal matches and suppressed assignments is not directly
13763 determinable other than via the %n directive.
13766 The fscanf function returns the value of the macro EOF if an input failure occurs
13767 before any conversion. Otherwise, the function returns the number of input items
13768 assigned, which can be fewer than provided for, or even zero, in the event of an early
13771 EXAMPLE 1 The call:
13773 #include <stdio.h>
13775 int n, i; float x; char name[50];
13776 n = fscanf(stdin, "%d%f%s", &i, &x, name);</pre>
13777 with the input line:
13779 25 54.32E-1 thompson</pre>
13780 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
13784 EXAMPLE 2 The call:
13786 #include <stdio.h>
13788 int i; float x; char name[50];
13789 fscanf(stdin, "%2d%f%*d %[0123456789]", &i, &x, name);</pre>
13794 <!--page 300 indent 5-->
13796 56789 0123 56a72</pre>
13797 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
13798 sequence 56\0. The next character read from the input stream will be a.
13801 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
13804 #include <stdio.h>
13806 int count; float quant; char units[21], item[21];
13808 count = fscanf(stdin, "%f%20s of %20s", &quant, units, item);
13809 fscanf(stdin,"%*[^\n]");
13810 } while (!feof(stdin) && !ferror(stdin));</pre>
13811 If the stdin stream contains the following lines:
13814 -12.8degrees Celsius
13818 100ergs of energy</pre>
13819 the execution of the above example will be analogous to the following assignments:
13821 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
13823 quant = -12.8; strcpy(units, "degrees");
13824 count = 2; // "C" fails to match "o"
13825 count = 0; // "l" fails to match "%f"
13826 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
13828 count = 0; // "100e" fails to match "%f"
13834 #include <stdio.h>
13836 int d1, d2, n1, n2, i;
13837 i = sscanf("123", "%d%n%n%d", &d1, &n1, &n2, &d2);</pre>
13838 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure the value
13839 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
13842 EXAMPLE 5 In these examples, multibyte characters do have a state-dependent encoding, and the
13843 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
13844 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
13845 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
13846 entry into the alternate shift state.
13849 <!--page 301 indent 5-->
13851 #include <stdio.h>
13854 fscanf(stdin, "a%s", str);</pre>
13855 with the input line:
13857 a(uparrow) X Y(downarrow) bc</pre>
13858 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
13859 characters, in the more general case) appears to be a single-byte white-space character.
13861 In contrast, after the call:
13863 #include <stdio.h>
13864 #include <stddef.h>
13867 fscanf(stdin, "a%ls", wstr);</pre>
13868 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
13869 terminating null wide character.
13873 #include <stdio.h>
13874 #include <stddef.h>
13877 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);</pre>
13878 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
13881 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
13882 character Y, after the call:
13884 #include <stdio.h>
13885 #include <stddef.h>
13888 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);</pre>
13889 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
13890 multibyte character.
13892 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>), the
13893 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.20.1.4">7.20.1.4</a>), conversion state
13894 (<a href="#7.24.6">7.24.6</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
13895 <!--page 302 indent 4-->
13898 <p><a name="note250">250)</a> These white-space characters are not counted against a specified field width.
13900 <p><a name="note251">251)</a> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
13901 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
13903 <p><a name="note252">252)</a> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
13904 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
13905 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
13907 <p><a name="note253">253)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
13910 <a name="7.19.6.3" href="#7.19.6.3"><h5>7.19.6.3 The printf function</h5></a>
13914 #include <stdio.h>
13915 int printf(const char * restrict format, ...);</pre>
13916 <h6>Description</h6>
13918 The printf function is equivalent to fprintf with the argument stdout interposed
13919 before the arguments to printf.
13922 The printf function returns the number of characters transmitted, or a negative value if
13923 an output or encoding error occurred.
13925 <a name="7.19.6.4" href="#7.19.6.4"><h5>7.19.6.4 The scanf function</h5></a>
13929 #include <stdio.h>
13930 int scanf(const char * restrict format, ...);</pre>
13931 <h6>Description</h6>
13933 The scanf function is equivalent to fscanf with the argument stdin interposed
13934 before the arguments to scanf.
13937 The scanf function returns the value of the macro EOF if an input failure occurs before
13938 any conversion. Otherwise, the scanf function returns the number of input items
13939 assigned, which can be fewer than provided for, or even zero, in the event of an early
13942 <a name="7.19.6.5" href="#7.19.6.5"><h5>7.19.6.5 The snprintf function</h5></a>
13946 #include <stdio.h>
13947 int snprintf(char * restrict s, size_t n,
13948 const char * restrict format, ...);</pre>
13949 <h6>Description</h6>
13951 The snprintf function is equivalent to fprintf, except that the output is written into
13952 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
13953 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
13954 discarded rather than being written to the array, and a null character is written at the end
13955 of the characters actually written into the array. If copying takes place between objects
13956 that overlap, the behavior is undefined.
13957 <!--page 303 indent 4-->
13960 The snprintf function returns the number of characters that would have been written
13961 had n been sufficiently large, not counting the terminating null character, or a negative
13962 value if an encoding error occurred. Thus, the null-terminated output has been
13963 completely written if and only if the returned value is nonnegative and less than n.
13965 <a name="7.19.6.6" href="#7.19.6.6"><h5>7.19.6.6 The sprintf function</h5></a>
13969 #include <stdio.h>
13970 int sprintf(char * restrict s,
13971 const char * restrict format, ...);</pre>
13972 <h6>Description</h6>
13974 The sprintf function is equivalent to fprintf, except that the output is written into
13975 an array (specified by the argument s) rather than to a stream. A null character is written
13976 at the end of the characters written; it is not counted as part of the returned value. If
13977 copying takes place between objects that overlap, the behavior is undefined.
13980 The sprintf function returns the number of characters written in the array, not
13981 counting the terminating null character, or a negative value if an encoding error occurred.
13983 <a name="7.19.6.7" href="#7.19.6.7"><h5>7.19.6.7 The sscanf function</h5></a>
13987 #include <stdio.h>
13988 int sscanf(const char * restrict s,
13989 const char * restrict format, ...);</pre>
13990 <h6>Description</h6>
13992 The sscanf function is equivalent to fscanf, except that input is obtained from a
13993 string (specified by the argument s) rather than from a stream. Reaching the end of the
13994 string is equivalent to encountering end-of-file for the fscanf function. If copying
13995 takes place between objects that overlap, the behavior is undefined.
13998 The sscanf function returns the value of the macro EOF if an input failure occurs
13999 before any conversion. Otherwise, the sscanf function returns the number of input
14000 items assigned, which can be fewer than provided for, or even zero, in the event of an
14001 early matching failure.
14002 <!--page 304 indent 4-->
14004 <a name="7.19.6.8" href="#7.19.6.8"><h5>7.19.6.8 The vfprintf function</h5></a>
14008 #include <stdarg.h>
14009 #include <stdio.h>
14010 int vfprintf(FILE * restrict stream,
14011 const char * restrict format,
14012 va_list arg);</pre>
14013 <h6>Description</h6>
14015 The vfprintf function is equivalent to fprintf, with the variable argument list
14016 replaced by arg, which shall have been initialized by the va_start macro (and
14017 possibly subsequent va_arg calls). The vfprintf function does not invoke the
14018 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
14021 The vfprintf function returns the number of characters transmitted, or a negative
14022 value if an output or encoding error occurred.
14024 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
14026 #include <stdarg.h>
14027 #include <stdio.h>
14028 void error(char *function_name, char *format, ...)
14031 va_start(args, format);
14032 // print out name of function causing error
14033 fprintf(stderr, "ERROR in %s: ", function_name);
14034 // print out remainder of message
14035 vfprintf(stderr, format, args);
14042 <!--page 305 indent 4-->
14045 <p><a name="note254">254)</a> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
14046 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
14049 <a name="7.19.6.9" href="#7.19.6.9"><h5>7.19.6.9 The vfscanf function</h5></a>
14053 #include <stdarg.h>
14054 #include <stdio.h>
14055 int vfscanf(FILE * restrict stream,
14056 const char * restrict format,
14057 va_list arg);</pre>
14058 <h6>Description</h6>
14060 The vfscanf function is equivalent to fscanf, with the variable argument list
14061 replaced by arg, which shall have been initialized by the va_start macro (and
14062 possibly subsequent va_arg calls). The vfscanf function does not invoke the
14066 The vfscanf function returns the value of the macro EOF if an input failure occurs
14067 before any conversion. Otherwise, the vfscanf function returns the number of input
14068 items assigned, which can be fewer than provided for, or even zero, in the event of an
14069 early matching failure.
14071 <a name="7.19.6.10" href="#7.19.6.10"><h5>7.19.6.10 The vprintf function</h5></a>
14075 #include <stdarg.h>
14076 #include <stdio.h>
14077 int vprintf(const char * restrict format,
14078 va_list arg);</pre>
14079 <h6>Description</h6>
14081 The vprintf function is equivalent to printf, with the variable argument list
14082 replaced by arg, which shall have been initialized by the va_start macro (and
14083 possibly subsequent va_arg calls). The vprintf function does not invoke the
14087 The vprintf function returns the number of characters transmitted, or a negative value
14088 if an output or encoding error occurred.
14089 <!--page 306 indent 4-->
14091 <a name="7.19.6.11" href="#7.19.6.11"><h5>7.19.6.11 The vscanf function</h5></a>
14095 #include <stdarg.h>
14096 #include <stdio.h>
14097 int vscanf(const char * restrict format,
14098 va_list arg);</pre>
14099 <h6>Description</h6>
14101 The vscanf function is equivalent to scanf, with the variable argument list replaced
14102 by arg, which shall have been initialized by the va_start macro (and possibly
14103 subsequent va_arg calls). The vscanf function does not invoke the va_end
14107 The vscanf function returns the value of the macro EOF if an input failure occurs
14108 before any conversion. Otherwise, the vscanf function returns the number of input
14109 items assigned, which can be fewer than provided for, or even zero, in the event of an
14110 early matching failure.
14112 <a name="7.19.6.12" href="#7.19.6.12"><h5>7.19.6.12 The vsnprintf function</h5></a>
14116 #include <stdarg.h>
14117 #include <stdio.h>
14118 int vsnprintf(char * restrict s, size_t n,
14119 const char * restrict format,
14120 va_list arg);</pre>
14121 <h6>Description</h6>
14123 The vsnprintf function is equivalent to snprintf, with the variable argument list
14124 replaced by arg, which shall have been initialized by the va_start macro (and
14125 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
14126 va_end macro.254) If copying takes place between objects that overlap, the behavior is
14130 The vsnprintf function returns the number of characters that would have been written
14131 had n been sufficiently large, not counting the terminating null character, or a negative
14132 value if an encoding error occurred. Thus, the null-terminated output has been
14133 completely written if and only if the returned value is nonnegative and less than n.
14134 <!--page 307 indent 4-->
14136 <a name="7.19.6.13" href="#7.19.6.13"><h5>7.19.6.13 The vsprintf function</h5></a>
14140 #include <stdarg.h>
14141 #include <stdio.h>
14142 int vsprintf(char * restrict s,
14143 const char * restrict format,
14144 va_list arg);</pre>
14145 <h6>Description</h6>
14147 The vsprintf function is equivalent to sprintf, with the variable argument list
14148 replaced by arg, which shall have been initialized by the va_start macro (and
14149 possibly subsequent va_arg calls). The vsprintf function does not invoke the
14150 va_end macro.254) If copying takes place between objects that overlap, the behavior is
14154 The vsprintf function returns the number of characters written in the array, not
14155 counting the terminating null character, or a negative value if an encoding error occurred.
14157 <a name="7.19.6.14" href="#7.19.6.14"><h5>7.19.6.14 The vsscanf function</h5></a>
14161 #include <stdarg.h>
14162 #include <stdio.h>
14163 int vsscanf(const char * restrict s,
14164 const char * restrict format,
14165 va_list arg);</pre>
14166 <h6>Description</h6>
14168 The vsscanf function is equivalent to sscanf, with the variable argument list
14169 replaced by arg, which shall have been initialized by the va_start macro (and
14170 possibly subsequent va_arg calls). The vsscanf function does not invoke the
14174 The vsscanf function returns the value of the macro EOF if an input failure occurs
14175 before any conversion. Otherwise, the vsscanf function returns the number of input
14176 items assigned, which can be fewer than provided for, or even zero, in the event of an
14177 early matching failure.
14178 <!--page 308 indent 4-->
14180 <a name="7.19.7" href="#7.19.7"><h4>7.19.7 Character input/output functions</h4></a>
14182 <a name="7.19.7.1" href="#7.19.7.1"><h5>7.19.7.1 The fgetc function</h5></a>
14186 #include <stdio.h>
14187 int fgetc(FILE *stream);</pre>
14188 <h6>Description</h6>
14190 If the end-of-file indicator for the input stream pointed to by stream is not set and a
14191 next character is present, the fgetc function obtains that character as an unsigned
14192 char converted to an int and advances the associated file position indicator for the
14193 stream (if defined).
14196 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
14197 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
14198 fgetc function returns the next character from the input stream pointed to by stream.
14199 If a read error occurs, the error indicator for the stream is set and the fgetc function
14200 returns EOF.<sup><a href="#note255"><b>255)</b></a></sup>
14203 <p><a name="note255">255)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
14206 <a name="7.19.7.2" href="#7.19.7.2"><h5>7.19.7.2 The fgets function</h5></a>
14210 #include <stdio.h>
14211 char *fgets(char * restrict s, int n,
14212 FILE * restrict stream);</pre>
14213 <h6>Description</h6>
14215 The fgets function reads at most one less than the number of characters specified by n
14216 from the stream pointed to by stream into the array pointed to by s. No additional
14217 characters are read after a new-line character (which is retained) or after end-of-file. A
14218 null character is written immediately after the last character read into the array.
14221 The fgets function returns s if successful. If end-of-file is encountered and no
14222 characters have been read into the array, the contents of the array remain unchanged and a
14223 null pointer is returned. If a read error occurs during the operation, the array contents are
14224 indeterminate and a null pointer is returned.
14229 <!--page 309 indent 4-->
14231 <a name="7.19.7.3" href="#7.19.7.3"><h5>7.19.7.3 The fputc function</h5></a>
14235 #include <stdio.h>
14236 int fputc(int c, FILE *stream);</pre>
14237 <h6>Description</h6>
14239 The fputc function writes the character specified by c (converted to an unsigned
14240 char) to the output stream pointed to by stream, at the position indicated by the
14241 associated file position indicator for the stream (if defined), and advances the indicator
14242 appropriately. If the file cannot support positioning requests, or if the stream was opened
14243 with append mode, the character is appended to the output stream.
14246 The fputc function returns the character written. If a write error occurs, the error
14247 indicator for the stream is set and fputc returns EOF.
14249 <a name="7.19.7.4" href="#7.19.7.4"><h5>7.19.7.4 The fputs function</h5></a>
14253 #include <stdio.h>
14254 int fputs(const char * restrict s,
14255 FILE * restrict stream);</pre>
14256 <h6>Description</h6>
14258 The fputs function writes the string pointed to by s to the stream pointed to by
14259 stream. The terminating null character is not written.
14262 The fputs function returns EOF if a write error occurs; otherwise it returns a
14265 <a name="7.19.7.5" href="#7.19.7.5"><h5>7.19.7.5 The getc function</h5></a>
14269 #include <stdio.h>
14270 int getc(FILE *stream);</pre>
14271 <h6>Description</h6>
14273 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
14274 may evaluate stream more than once, so the argument should never be an expression
14276 <!--page 310 indent 4-->
14279 The getc function returns the next character from the input stream pointed to by
14280 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
14281 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
14284 <a name="7.19.7.6" href="#7.19.7.6"><h5>7.19.7.6 The getchar function</h5></a>
14288 #include <stdio.h>
14289 int getchar(void);</pre>
14290 <h6>Description</h6>
14292 The getchar function is equivalent to getc with the argument stdin.
14295 The getchar function returns the next character from the input stream pointed to by
14296 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
14297 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
14298 getchar returns EOF.
14300 <a name="7.19.7.7" href="#7.19.7.7"><h5>7.19.7.7 The gets function</h5></a>
14304 #include <stdio.h>
14305 char *gets(char *s);</pre>
14306 <h6>Description</h6>
14308 The gets function reads characters from the input stream pointed to by stdin, into the
14309 array pointed to by s, until end-of-file is encountered or a new-line character is read.
14310 Any new-line character is discarded, and a null character is written immediately after the
14311 last character read into the array.
14314 The gets function returns s if successful. If end-of-file is encountered and no
14315 characters have been read into the array, the contents of the array remain unchanged and a
14316 null pointer is returned. If a read error occurs during the operation, the array contents are
14317 indeterminate and a null pointer is returned.
14318 Forward references: future library directions (<a href="#7.26.9">7.26.9</a>).
14319 <!--page 311 indent 4-->
14321 <a name="7.19.7.8" href="#7.19.7.8"><h5>7.19.7.8 The putc function</h5></a>
14325 #include <stdio.h>
14326 int putc(int c, FILE *stream);</pre>
14327 <h6>Description</h6>
14329 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
14330 may evaluate stream more than once, so that argument should never be an expression
14334 The putc function returns the character written. If a write error occurs, the error
14335 indicator for the stream is set and putc returns EOF.
14337 <a name="7.19.7.9" href="#7.19.7.9"><h5>7.19.7.9 The putchar function</h5></a>
14341 #include <stdio.h>
14342 int putchar(int c);</pre>
14343 <h6>Description</h6>
14345 The putchar function is equivalent to putc with the second argument stdout.
14348 The putchar function returns the character written. If a write error occurs, the error
14349 indicator for the stream is set and putchar returns EOF.
14351 <a name="7.19.7.10" href="#7.19.7.10"><h5>7.19.7.10 The puts function</h5></a>
14355 #include <stdio.h>
14356 int puts(const char *s);</pre>
14357 <h6>Description</h6>
14359 The puts function writes the string pointed to by s to the stream pointed to by stdout,
14360 and appends a new-line character to the output. The terminating null character is not
14364 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
14366 <!--page 312 indent 4-->
14368 <a name="7.19.7.11" href="#7.19.7.11"><h5>7.19.7.11 The ungetc function</h5></a>
14372 #include <stdio.h>
14373 int ungetc(int c, FILE *stream);</pre>
14374 <h6>Description</h6>
14376 The ungetc function pushes the character specified by c (converted to an unsigned
14377 char) back onto the input stream pointed to by stream. Pushed-back characters will be
14378 returned by subsequent reads on that stream in the reverse order of their pushing. A
14379 successful intervening call (with the stream pointed to by stream) to a file positioning
14380 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
14381 stream. The external storage corresponding to the stream is unchanged.
14383 One character of pushback is guaranteed. If the ungetc function is called too many
14384 times on the same stream without an intervening read or file positioning operation on that
14385 stream, the operation may fail.
14387 If the value of c equals that of the macro EOF, the operation fails and the input stream is
14390 A successful call to the ungetc function clears the end-of-file indicator for the stream.
14391 The value of the file position indicator for the stream after reading or discarding all
14392 pushed-back characters shall be the same as it was before the characters were pushed
14393 back. For a text stream, the value of its file position indicator after a successful call to the
14394 ungetc function is unspecified until all pushed-back characters are read or discarded.
14395 For a binary stream, its file position indicator is decremented by each successful call to
14396 the ungetc function; if its value was zero before a call, it is indeterminate after the
14397 call.<sup><a href="#note256"><b>256)</b></a></sup>
14400 The ungetc function returns the character pushed back after conversion, or EOF if the
14402 Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
14407 <!--page 313 indent 4-->
14410 <p><a name="note256">256)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
14413 <a name="7.19.8" href="#7.19.8"><h4>7.19.8 Direct input/output functions</h4></a>
14415 <a name="7.19.8.1" href="#7.19.8.1"><h5>7.19.8.1 The fread function</h5></a>
14419 #include <stdio.h>
14420 size_t fread(void * restrict ptr,
14421 size_t size, size_t nmemb,
14422 FILE * restrict stream);</pre>
14423 <h6>Description</h6>
14425 The fread function reads, into the array pointed to by ptr, up to nmemb elements
14426 whose size is specified by size, from the stream pointed to by stream. For each
14427 object, size calls are made to the fgetc function and the results stored, in the order
14428 read, in an array of unsigned char exactly overlaying the object. The file position
14429 indicator for the stream (if defined) is advanced by the number of characters successfully
14430 read. If an error occurs, the resulting value of the file position indicator for the stream is
14431 indeterminate. If a partial element is read, its value is indeterminate.
14434 The fread function returns the number of elements successfully read, which may be
14435 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
14436 fread returns zero and the contents of the array and the state of the stream remain
14439 <a name="7.19.8.2" href="#7.19.8.2"><h5>7.19.8.2 The fwrite function</h5></a>
14443 #include <stdio.h>
14444 size_t fwrite(const void * restrict ptr,
14445 size_t size, size_t nmemb,
14446 FILE * restrict stream);</pre>
14447 <h6>Description</h6>
14449 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
14450 whose size is specified by size, to the stream pointed to by stream. For each object,
14451 size calls are made to the fputc function, taking the values (in order) from an array of
14452 unsigned char exactly overlaying the object. The file position indicator for the
14453 stream (if defined) is advanced by the number of characters successfully written. If an
14454 error occurs, the resulting value of the file position indicator for the stream is
14456 <!--page 314 indent 4-->
14459 The fwrite function returns the number of elements successfully written, which will be
14460 less than nmemb only if a write error is encountered. If size or nmemb is zero,
14461 fwrite returns zero and the state of the stream remains unchanged.
14463 <a name="7.19.9" href="#7.19.9"><h4>7.19.9 File positioning functions</h4></a>
14465 <a name="7.19.9.1" href="#7.19.9.1"><h5>7.19.9.1 The fgetpos function</h5></a>
14469 #include <stdio.h>
14470 int fgetpos(FILE * restrict stream,
14471 fpos_t * restrict pos);</pre>
14472 <h6>Description</h6>
14474 The fgetpos function stores the current values of the parse state (if any) and file
14475 position indicator for the stream pointed to by stream in the object pointed to by pos.
14476 The values stored contain unspecified information usable by the fsetpos function for
14477 repositioning the stream to its position at the time of the call to the fgetpos function.
14480 If successful, the fgetpos function returns zero; on failure, the fgetpos function
14481 returns nonzero and stores an implementation-defined positive value in errno.
14482 Forward references: the fsetpos function (<a href="#7.19.9.3">7.19.9.3</a>).
14484 <a name="7.19.9.2" href="#7.19.9.2"><h5>7.19.9.2 The fseek function</h5></a>
14488 #include <stdio.h>
14489 int fseek(FILE *stream, long int offset, int whence);</pre>
14490 <h6>Description</h6>
14492 The fseek function sets the file position indicator for the stream pointed to by stream.
14493 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
14495 For a binary stream, the new position, measured in characters from the beginning of the
14496 file, is obtained by adding offset to the position specified by whence. The specified
14497 position is the beginning of the file if whence is SEEK_SET, the current value of the file
14498 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
14499 meaningfully support fseek calls with a whence value of SEEK_END.
14501 For a text stream, either offset shall be zero, or offset shall be a value returned by
14502 an earlier successful call to the ftell function on a stream associated with the same file
14503 and whence shall be SEEK_SET.
14504 <!--page 315 indent 4-->
14506 After determining the new position, a successful call to the fseek function undoes any
14507 effects of the ungetc function on the stream, clears the end-of-file indicator for the
14508 stream, and then establishes the new position. After a successful fseek call, the next
14509 operation on an update stream may be either input or output.
14512 The fseek function returns nonzero only for a request that cannot be satisfied.
14513 Forward references: the ftell function (<a href="#7.19.9.4">7.19.9.4</a>).
14515 <a name="7.19.9.3" href="#7.19.9.3"><h5>7.19.9.3 The fsetpos function</h5></a>
14519 #include <stdio.h>
14520 int fsetpos(FILE *stream, const fpos_t *pos);</pre>
14521 <h6>Description</h6>
14523 The fsetpos function sets the mbstate_t object (if any) and file position indicator
14524 for the stream pointed to by stream according to the value of the object pointed to by
14525 pos, which shall be a value obtained from an earlier successful call to the fgetpos
14526 function on a stream associated with the same file. If a read or write error occurs, the
14527 error indicator for the stream is set and fsetpos fails.
14529 A successful call to the fsetpos function undoes any effects of the ungetc function
14530 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
14531 parse state and position. After a successful fsetpos call, the next operation on an
14532 update stream may be either input or output.
14535 If successful, the fsetpos function returns zero; on failure, the fsetpos function
14536 returns nonzero and stores an implementation-defined positive value in errno.
14538 <a name="7.19.9.4" href="#7.19.9.4"><h5>7.19.9.4 The ftell function</h5></a>
14542 #include <stdio.h>
14543 long int ftell(FILE *stream);</pre>
14544 <h6>Description</h6>
14546 The ftell function obtains the current value of the file position indicator for the stream
14547 pointed to by stream. For a binary stream, the value is the number of characters from
14548 the beginning of the file. For a text stream, its file position indicator contains unspecified
14549 information, usable by the fseek function for returning the file position indicator for the
14550 stream to its position at the time of the ftell call; the difference between two such
14551 return values is not necessarily a meaningful measure of the number of characters written
14552 <!--page 316 indent 4-->
14556 If successful, the ftell function returns the current value of the file position indicator
14557 for the stream. On failure, the ftell function returns -1L and stores an
14558 implementation-defined positive value in errno.
14560 <a name="7.19.9.5" href="#7.19.9.5"><h5>7.19.9.5 The rewind function</h5></a>
14564 #include <stdio.h>
14565 void rewind(FILE *stream);</pre>
14566 <h6>Description</h6>
14568 The rewind function sets the file position indicator for the stream pointed to by
14569 stream to the beginning of the file. It is equivalent to
14571 (void)fseek(stream, 0L, SEEK_SET)</pre>
14572 except that the error indicator for the stream is also cleared.
14575 The rewind function returns no value.
14577 <a name="7.19.10" href="#7.19.10"><h4>7.19.10 Error-handling functions</h4></a>
14579 <a name="7.19.10.1" href="#7.19.10.1"><h5>7.19.10.1 The clearerr function</h5></a>
14583 #include <stdio.h>
14584 void clearerr(FILE *stream);</pre>
14585 <h6>Description</h6>
14587 The clearerr function clears the end-of-file and error indicators for the stream pointed
14591 The clearerr function returns no value.
14592 <!--page 317 indent 4-->
14594 <a name="7.19.10.2" href="#7.19.10.2"><h5>7.19.10.2 The feof function</h5></a>
14598 #include <stdio.h>
14599 int feof(FILE *stream);</pre>
14600 <h6>Description</h6>
14602 The feof function tests the end-of-file indicator for the stream pointed to by stream.
14605 The feof function returns nonzero if and only if the end-of-file indicator is set for
14608 <a name="7.19.10.3" href="#7.19.10.3"><h5>7.19.10.3 The ferror function</h5></a>
14612 #include <stdio.h>
14613 int ferror(FILE *stream);</pre>
14614 <h6>Description</h6>
14616 The ferror function tests the error indicator for the stream pointed to by stream.
14619 The ferror function returns nonzero if and only if the error indicator is set for
14622 <a name="7.19.10.4" href="#7.19.10.4"><h5>7.19.10.4 The perror function</h5></a>
14626 #include <stdio.h>
14627 void perror(const char *s);</pre>
14628 <h6>Description</h6>
14630 The perror function maps the error number in the integer expression errno to an
14631 error message. It writes a sequence of characters to the standard error stream thus: first
14632 (if s is not a null pointer and the character pointed to by s is not the null character), the
14633 string pointed to by s followed by a colon (:) and a space; then an appropriate error
14634 message string followed by a new-line character. The contents of the error message
14635 strings are the same as those returned by the strerror function with argument errno.
14638 The perror function returns no value.
14639 Forward references: the strerror function (<a href="#7.21.6.2">7.21.6.2</a>).
14640 <!--page 318 indent 4-->
14642 <a name="7.20" href="#7.20"><h3>7.20 General utilities <stdlib.h></h3></a>
14644 The header <stdlib.h> declares five types and several functions of general utility, and
14645 defines several macros.<sup><a href="#note257"><b>257)</b></a></sup>
14647 The types declared are size_t and wchar_t (both described in <a href="#7.17">7.17</a>),
14650 which is a structure type that is the type of the value returned by the div function,
14653 which is a structure type that is the type of the value returned by the ldiv function, and
14656 which is a structure type that is the type of the value returned by the lldiv function.
14658 The macros defined are NULL (described in <a href="#7.17">7.17</a>);
14664 which expand to integer constant expressions that can be used as the argument to the
14665 exit function to return unsuccessful or successful termination status, respectively, to the
14669 which expands to an integer constant expression that is the maximum value returned by
14670 the rand function; and
14673 which expands to a positive integer expression with type size_t that is the maximum
14674 number of bytes in a multibyte character for the extended character set specified by the
14675 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
14680 <!--page 319 indent 4-->
14683 <p><a name="note257">257)</a> See ''future library directions'' (<a href="#7.26.10">7.26.10</a>).
14686 <a name="7.20.1" href="#7.20.1"><h4>7.20.1 Numeric conversion functions</h4></a>
14688 The functions atof, atoi, atol, and atoll need not affect the value of the integer
14689 expression errno on an error. If the value of the result cannot be represented, the
14690 behavior is undefined.
14692 <a name="7.20.1.1" href="#7.20.1.1"><h5>7.20.1.1 The atof function</h5></a>
14696 #include <stdlib.h>
14697 double atof(const char *nptr);</pre>
14698 <h6>Description</h6>
14700 The atof function converts the initial portion of the string pointed to by nptr to
14701 double representation. Except for the behavior on error, it is equivalent to
14703 strtod(nptr, (char **)NULL)</pre>
14706 The atof function returns the converted value.
14707 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
14709 <a name="7.20.1.2" href="#7.20.1.2"><h5>7.20.1.2 The atoi, atol, and atoll functions</h5></a>
14713 #include <stdlib.h>
14714 int atoi(const char *nptr);
14715 long int atol(const char *nptr);
14716 long long int atoll(const char *nptr);</pre>
14717 <h6>Description</h6>
14719 The atoi, atol, and atoll functions convert the initial portion of the string pointed
14720 to by nptr to int, long int, and long long int representation, respectively.
14721 Except for the behavior on error, they are equivalent to
14723 atoi: (int)strtol(nptr, (char **)NULL, 10)
14724 atol: strtol(nptr, (char **)NULL, 10)
14725 atoll: strtoll(nptr, (char **)NULL, 10)</pre>
14728 The atoi, atol, and atoll functions return the converted value.
14729 Forward references: the strtol, strtoll, strtoul, and strtoull functions
14730 (<a href="#7.20.1.4">7.20.1.4</a>).
14731 <!--page 320 indent 4-->
14733 <a name="7.20.1.3" href="#7.20.1.3"><h5>7.20.1.3 The strtod, strtof, and strtold functions</h5></a>
14737 #include <stdlib.h>
14738 double strtod(const char * restrict nptr,
14739 char ** restrict endptr);
14740 float strtof(const char * restrict nptr,
14741 char ** restrict endptr);
14742 long double strtold(const char * restrict nptr,
14743 char ** restrict endptr);</pre>
14744 <h6>Description</h6>
14746 The strtod, strtof, and strtold functions convert the initial portion of the string
14747 pointed to by nptr to double, float, and long double representation,
14748 respectively. First, they decompose the input string into three parts: an initial, possibly
14749 empty, sequence of white-space characters (as specified by the isspace function), a
14750 subject sequence resembling a floating-point constant or representing an infinity or NaN;
14751 and a final string of one or more unrecognized characters, including the terminating null
14752 character of the input string. Then, they attempt to convert the subject sequence to a
14753 floating-point number, and return the result.
14755 The expected form of the subject sequence is an optional plus or minus sign, then one of
14758 <li> a nonempty sequence of decimal digits optionally containing a decimal-point
14759 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
14760 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
14761 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
14762 <li> INF or INFINITY, ignoring case
14763 <li> NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part, where:
14768 n-char-sequence digit
14769 n-char-sequence nondigit</pre>
14771 The subject sequence is defined as the longest initial subsequence of the input string,
14772 starting with the first non-white-space character, that is of the expected form. The subject
14773 sequence contains no characters if the input string is not of the expected form.
14775 If the subject sequence has the expected form for a floating-point number, the sequence of
14776 characters starting with the first digit or the decimal-point character (whichever occurs
14777 first) is interpreted as a floating constant according to the rules of <a href="#6.4.4.2">6.4.4.2</a>, except that the
14778 <!--page 321 indent 4-->
14779 decimal-point character is used in place of a period, and that if neither an exponent part
14780 nor a decimal-point character appears in a decimal floating point number, or if a binary
14781 exponent part does not appear in a hexadecimal floating point number, an exponent part
14782 of the appropriate type with value zero is assumed to follow the last digit in the string. If
14783 the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note258"><b>258)</b></a></sup>
14784 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
14785 the return type, else like a floating constant that is too large for the range of the return
14786 type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
14787 NaN, if supported in the return type, else like a subject sequence part that does not have
14788 the expected form; the meaning of the n-char sequences is implementation-defined.<sup><a href="#note259"><b>259)</b></a></sup> A
14789 pointer to the final string is stored in the object pointed to by endptr, provided that
14790 endptr is not a null pointer.
14792 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
14793 value resulting from the conversion is correctly rounded.
14795 In other than the "C" locale, additional locale-specific subject sequence forms may be
14798 If the subject sequence is empty or does not have the expected form, no conversion is
14799 performed; the value of nptr is stored in the object pointed to by endptr, provided
14800 that endptr is not a null pointer.
14801 Recommended practice
14803 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
14804 the result is not exactly representable, the result should be one of the two numbers in the
14805 appropriate internal format that are adjacent to the hexadecimal floating source value,
14806 with the extra stipulation that the error should have a correct sign for the current rounding
14809 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
14810 <float.h>) significant digits, the result should be correctly rounded. If the subject
14811 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
14812 consider the two bounding, adjacent decimal strings L and U, both having
14813 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L <= D <= U.
14814 The result should be one of the (equal or adjacent) values that would be obtained by
14815 correctly rounding L and U according to the current rounding direction, with the extra
14817 <!--page 322 indent 5-->
14818 stipulation that the error with respect to D should have a correct sign for the current
14819 rounding direction.<sup><a href="#note260"><b>260)</b></a></sup>
14822 The functions return the converted value, if any. If no conversion could be performed,
14823 zero is returned. If the correct value is outside the range of representable values, plus or
14824 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
14825 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
14826 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
14827 than the smallest normalized positive number in the return type; whether errno acquires
14828 the value ERANGE is implementation-defined.
14831 <p><a name="note258">258)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
14832 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
14833 methods may yield different results if rounding is toward positive or negative infinity. In either case,
14834 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
14836 <p><a name="note259">259)</a> An implementation may use the n-char sequence to determine extra information to be represented in
14837 the NaN's significand.
14839 <p><a name="note260">260)</a> DECIMAL_DIG, defined in <float.h>, should be sufficiently large that L and U will usually round
14840 to the same internal floating value, but if not will round to adjacent values.
14843 <a name="7.20.1.4" href="#7.20.1.4"><h5>7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions</h5></a>
14847 #include <stdlib.h>
14849 const char * restrict nptr,
14850 char ** restrict endptr,
14852 long long int strtoll(
14853 const char * restrict nptr,
14854 char ** restrict endptr,
14856 unsigned long int strtoul(
14857 const char * restrict nptr,
14858 char ** restrict endptr,
14860 unsigned long long int strtoull(
14861 const char * restrict nptr,
14862 char ** restrict endptr,
14864 <h6>Description</h6>
14866 The strtol, strtoll, strtoul, and strtoull functions convert the initial
14867 portion of the string pointed to by nptr to long int, long long int, unsigned
14868 long int, and unsigned long long int representation, respectively. First,
14869 they decompose the input string into three parts: an initial, possibly empty, sequence of
14870 white-space characters (as specified by the isspace function), a subject sequence
14873 <!--page 323 indent 4-->
14874 resembling an integer represented in some radix determined by the value of base, and a
14875 final string of one or more unrecognized characters, including the terminating null
14876 character of the input string. Then, they attempt to convert the subject sequence to an
14877 integer, and return the result.
14879 If the value of base is zero, the expected form of the subject sequence is that of an
14880 integer constant as described in <a href="#6.4.4.1">6.4.4.1</a>, optionally preceded by a plus or minus sign, but
14881 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
14882 expected form of the subject sequence is a sequence of letters and digits representing an
14883 integer with the radix specified by base, optionally preceded by a plus or minus sign,
14884 but not including an integer suffix. The letters from a (or A) through z (or Z) are
14885 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
14886 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
14887 optionally precede the sequence of letters and digits, following the sign if present.
14889 The subject sequence is defined as the longest initial subsequence of the input string,
14890 starting with the first non-white-space character, that is of the expected form. The subject
14891 sequence contains no characters if the input string is empty or consists entirely of white
14892 space, or if the first non-white-space character is other than a sign or a permissible letter
14895 If the subject sequence has the expected form and the value of base is zero, the sequence
14896 of characters starting with the first digit is interpreted as an integer constant according to
14897 the rules of <a href="#6.4.4.1">6.4.4.1</a>. If the subject sequence has the expected form and the value of base
14898 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
14899 as given above. If the subject sequence begins with a minus sign, the value resulting from
14900 the conversion is negated (in the return type). A pointer to the final string is stored in the
14901 object pointed to by endptr, provided that endptr is not a null pointer.
14903 In other than the "C" locale, additional locale-specific subject sequence forms may be
14906 If the subject sequence is empty or does not have the expected form, no conversion is
14907 performed; the value of nptr is stored in the object pointed to by endptr, provided
14908 that endptr is not a null pointer.
14911 The strtol, strtoll, strtoul, and strtoull functions return the converted
14912 value, if any. If no conversion could be performed, zero is returned. If the correct value
14913 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
14914 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
14915 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
14916 <!--page 324 indent 4-->
14918 <a name="7.20.2" href="#7.20.2"><h4>7.20.2 Pseudo-random sequence generation functions</h4></a>
14920 <a name="7.20.2.1" href="#7.20.2.1"><h5>7.20.2.1 The rand function</h5></a>
14924 #include <stdlib.h>
14925 int rand(void);</pre>
14926 <h6>Description</h6>
14928 The rand function computes a sequence of pseudo-random integers in the range 0 to
14931 The implementation shall behave as if no library function calls the rand function.
14934 The rand function returns a pseudo-random integer.
14935 Environmental limits
14937 The value of the RAND_MAX macro shall be at least 32767.
14939 <a name="7.20.2.2" href="#7.20.2.2"><h5>7.20.2.2 The srand function</h5></a>
14943 #include <stdlib.h>
14944 void srand(unsigned int seed);</pre>
14945 <h6>Description</h6>
14947 The srand function uses the argument as a seed for a new sequence of pseudo-random
14948 numbers to be returned by subsequent calls to rand. If srand is then called with the
14949 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
14950 called before any calls to srand have been made, the same sequence shall be generated
14951 as when srand is first called with a seed value of 1.
14953 The implementation shall behave as if no library function calls the srand function.
14956 The srand function returns no value.
14958 EXAMPLE The following functions define a portable implementation of rand and srand.
14959 <!--page 325 indent 4-->
14961 static unsigned long int next = 1;
14962 int rand(void) // RAND_MAX assumed to be 32767
14964 next = next * 1103515245 + 12345;
14965 return (unsigned int)(next/65536) % 32768;
14967 void srand(unsigned int seed)
14973 <a name="7.20.3" href="#7.20.3"><h4>7.20.3 Memory management functions</h4></a>
14975 The order and contiguity of storage allocated by successive calls to the calloc,
14976 malloc, and realloc functions is unspecified. The pointer returned if the allocation
14977 succeeds is suitably aligned so that it may be assigned to a pointer to any type of object
14978 and then used to access such an object or an array of such objects in the space allocated
14979 (until the space is explicitly deallocated). The lifetime of an allocated object extends
14980 from the allocation until the deallocation. Each such allocation shall yield a pointer to an
14981 object disjoint from any other object. The pointer returned points to the start (lowest byte
14982 address) of the allocated space. If the space cannot be allocated, a null pointer is
14983 returned. If the size of the space requested is zero, the behavior is implementation-
14984 defined: either a null pointer is returned, or the behavior is as if the size were some
14985 nonzero value, except that the returned pointer shall not be used to access an object.
14987 <a name="7.20.3.1" href="#7.20.3.1"><h5>7.20.3.1 The calloc function</h5></a>
14991 #include <stdlib.h>
14992 void *calloc(size_t nmemb, size_t size);</pre>
14993 <h6>Description</h6>
14995 The calloc function allocates space for an array of nmemb objects, each of whose size
14996 is size. The space is initialized to all bits zero.<sup><a href="#note261"><b>261)</b></a></sup>
14999 The calloc function returns either a null pointer or a pointer to the allocated space.
15002 <p><a name="note261">261)</a> Note that this need not be the same as the representation of floating-point zero or a null pointer
15006 <a name="7.20.3.2" href="#7.20.3.2"><h5>7.20.3.2 The free function</h5></a>
15010 #include <stdlib.h>
15011 void free(void *ptr);</pre>
15012 <h6>Description</h6>
15014 The free function causes the space pointed to by ptr to be deallocated, that is, made
15015 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
15016 the argument does not match a pointer earlier returned by the calloc, malloc, or
15019 <!--page 326 indent 4-->
15020 realloc function, or if the space has been deallocated by a call to free or realloc,
15021 the behavior is undefined.
15024 The free function returns no value.
15026 <a name="7.20.3.3" href="#7.20.3.3"><h5>7.20.3.3 The malloc function</h5></a>
15030 #include <stdlib.h>
15031 void *malloc(size_t size);</pre>
15032 <h6>Description</h6>
15034 The malloc function allocates space for an object whose size is specified by size and
15035 whose value is indeterminate.
15038 The malloc function returns either a null pointer or a pointer to the allocated space.
15040 <a name="7.20.3.4" href="#7.20.3.4"><h5>7.20.3.4 The realloc function</h5></a>
15044 #include <stdlib.h>
15045 void *realloc(void *ptr, size_t size);</pre>
15046 <h6>Description</h6>
15048 The realloc function deallocates the old object pointed to by ptr and returns a
15049 pointer to a new object that has the size specified by size. The contents of the new
15050 object shall be the same as that of the old object prior to deallocation, up to the lesser of
15051 the new and old sizes. Any bytes in the new object beyond the size of the old object have
15052 indeterminate values.
15054 If ptr is a null pointer, the realloc function behaves like the malloc function for the
15055 specified size. Otherwise, if ptr does not match a pointer earlier returned by the
15056 calloc, malloc, or realloc function, or if the space has been deallocated by a call
15057 to the free or realloc function, the behavior is undefined. If memory for the new
15058 object cannot be allocated, the old object is not deallocated and its value is unchanged.
15061 The realloc function returns a pointer to the new object (which may have the same
15062 value as a pointer to the old object), or a null pointer if the new object could not be
15064 <!--page 327 indent 4-->
15066 <a name="7.20.4" href="#7.20.4"><h4>7.20.4 Communication with the environment</h4></a>
15068 <a name="7.20.4.1" href="#7.20.4.1"><h5>7.20.4.1 The abort function</h5></a>
15072 #include <stdlib.h>
15073 void abort(void);</pre>
15074 <h6>Description</h6>
15076 The abort function causes abnormal program termination to occur, unless the signal
15077 SIGABRT is being caught and the signal handler does not return. Whether open streams
15078 with unwritten buffered data are flushed, open streams are closed, or temporary files are
15079 removed is implementation-defined. An implementation-defined form of the status
15080 unsuccessful termination is returned to the host environment by means of the function
15081 call raise(SIGABRT).
15084 The abort function does not return to its caller.
15086 <a name="7.20.4.2" href="#7.20.4.2"><h5>7.20.4.2 The atexit function</h5></a>
15090 #include <stdlib.h>
15091 int atexit(void (*func)(void));</pre>
15092 <h6>Description</h6>
15094 The atexit function registers the function pointed to by func, to be called without
15095 arguments at normal program termination.
15096 Environmental limits
15098 The implementation shall support the registration of at least 32 functions.
15101 The atexit function returns zero if the registration succeeds, nonzero if it fails.
15102 Forward references: the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
15104 <a name="7.20.4.3" href="#7.20.4.3"><h5>7.20.4.3 The exit function</h5></a>
15108 #include <stdlib.h>
15109 void exit(int status);</pre>
15110 <h6>Description</h6>
15112 The exit function causes normal program termination to occur. If more than one call to
15113 the exit function is executed by a program, the behavior is undefined.
15114 <!--page 328 indent 4-->
15116 First, all functions registered by the atexit function are called, in the reverse order of
15117 their registration,<sup><a href="#note262"><b>262)</b></a></sup> except that a function is called after any previously registered
15118 functions that had already been called at the time it was registered. If, during the call to
15119 any such function, a call to the longjmp function is made that would terminate the call
15120 to the registered function, the behavior is undefined.
15122 Next, all open streams with unwritten buffered data are flushed, all open streams are
15123 closed, and all files created by the tmpfile function are removed.
15125 Finally, control is returned to the host environment. If the value of status is zero or
15126 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
15127 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
15128 of the status unsuccessful termination is returned. Otherwise the status returned is
15129 implementation-defined.
15132 The exit function cannot return to its caller.
15135 <p><a name="note262">262)</a> Each function is called as many times as it was registered, and in the correct order with respect to
15136 other registered functions.
15139 <a name="7.20.4.4" href="#7.20.4.4"><h5>7.20.4.4 The _Exit function</h5></a>
15143 #include <stdlib.h>
15144 void _Exit(int status);</pre>
15145 <h6>Description</h6>
15147 The _Exit function causes normal program termination to occur and control to be
15148 returned to the host environment. No functions registered by the atexit function or
15149 signal handlers registered by the signal function are called. The status returned to the
15150 host environment is determined in the same way as for the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
15151 Whether open streams with unwritten buffered data are flushed, open streams are closed,
15152 or temporary files are removed is implementation-defined.
15155 The _Exit function cannot return to its caller.
15160 <!--page 329 indent 4-->
15162 <a name="7.20.4.5" href="#7.20.4.5"><h5>7.20.4.5 The getenv function</h5></a>
15166 #include <stdlib.h>
15167 char *getenv(const char *name);</pre>
15168 <h6>Description</h6>
15170 The getenv function searches an environment list, provided by the host environment,
15171 for a string that matches the string pointed to by name. The set of environment names
15172 and the method for altering the environment list are implementation-defined.
15174 The implementation shall behave as if no library function calls the getenv function.
15177 The getenv function returns a pointer to a string associated with the matched list
15178 member. The string pointed to shall not be modified by the program, but may be
15179 overwritten by a subsequent call to the getenv function. If the specified name cannot
15180 be found, a null pointer is returned.
15182 <a name="7.20.4.6" href="#7.20.4.6"><h5>7.20.4.6 The system function</h5></a>
15186 #include <stdlib.h>
15187 int system(const char *string);</pre>
15188 <h6>Description</h6>
15190 If string is a null pointer, the system function determines whether the host
15191 environment has a command processor. If string is not a null pointer, the system
15192 function passes the string pointed to by string to that command processor to be
15193 executed in a manner which the implementation shall document; this might then cause the
15194 program calling system to behave in a non-conforming manner or to terminate.
15197 If the argument is a null pointer, the system function returns nonzero only if a
15198 command processor is available. If the argument is not a null pointer, and the system
15199 function does return, it returns an implementation-defined value.
15200 <!--page 330 indent 4-->
15202 <a name="7.20.5" href="#7.20.5"><h4>7.20.5 Searching and sorting utilities</h4></a>
15204 These utilities make use of a comparison function to search or sort arrays of unspecified
15205 type. Where an argument declared as size_t nmemb specifies the length of the array
15206 for a function, nmemb can have the value zero on a call to that function; the comparison
15207 function is not called, a search finds no matching element, and sorting performs no
15208 rearrangement. Pointer arguments on such a call shall still have valid values, as described
15209 in <a href="#7.1.4">7.1.4</a>.
15211 The implementation shall ensure that the second argument of the comparison function
15212 (when called from bsearch), or both arguments (when called from qsort), are
15213 pointers to elements of the array.<sup><a href="#note263"><b>263)</b></a></sup> The first argument when called from bsearch
15216 The comparison function shall not alter the contents of the array. The implementation
15217 may reorder elements of the array between calls to the comparison function, but shall not
15218 alter the contents of any individual element.
15220 When the same objects (consisting of size bytes, irrespective of their current positions
15221 in the array) are passed more than once to the comparison function, the results shall be
15222 consistent with one another. That is, for qsort they shall define a total ordering on the
15223 array, and for bsearch the same object shall always compare the same way with the
15226 A sequence point occurs immediately before and immediately after each call to the
15227 comparison function, and also between any call to the comparison function and any
15228 movement of the objects passed as arguments to that call.
15231 <p><a name="note263">263)</a> That is, if the value passed is p, then the following expressions are always nonzero:
15234 ((char *)p - (char *)base) % size == 0
15235 (char *)p >= (char *)base
15236 (char *)p < (char *)base + nmemb * size</pre>
15239 <a name="7.20.5.1" href="#7.20.5.1"><h5>7.20.5.1 The bsearch function</h5></a>
15243 #include <stdlib.h>
15244 void *bsearch(const void *key, const void *base,
15245 size_t nmemb, size_t size,
15246 int (*compar)(const void *, const void *));</pre>
15247 <h6>Description</h6>
15249 The bsearch function searches an array of nmemb objects, the initial element of which
15250 is pointed to by base, for an element that matches the object pointed to by key. The
15253 <!--page 331 indent 4-->
15254 size of each element of the array is specified by size.
15256 The comparison function pointed to by compar is called with two arguments that point
15257 to the key object and to an array element, in that order. The function shall return an
15258 integer less than, equal to, or greater than zero if the key object is considered,
15259 respectively, to be less than, to match, or to be greater than the array element. The array
15260 shall consist of: all the elements that compare less than, all the elements that compare
15261 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note264"><b>264)</b></a></sup>
15264 The bsearch function returns a pointer to a matching element of the array, or a null
15265 pointer if no match is found. If two elements compare as equal, which element is
15266 matched is unspecified.
15269 <p><a name="note264">264)</a> In practice, the entire array is sorted according to the comparison function.
15272 <a name="7.20.5.2" href="#7.20.5.2"><h5>7.20.5.2 The qsort function</h5></a>
15276 #include <stdlib.h>
15277 void qsort(void *base, size_t nmemb, size_t size,
15278 int (*compar)(const void *, const void *));</pre>
15279 <h6>Description</h6>
15281 The qsort function sorts an array of nmemb objects, the initial element of which is
15282 pointed to by base. The size of each object is specified by size.
15284 The contents of the array are sorted into ascending order according to a comparison
15285 function pointed to by compar, which is called with two arguments that point to the
15286 objects being compared. The function shall return an integer less than, equal to, or
15287 greater than zero if the first argument is considered to be respectively less than, equal to,
15288 or greater than the second.
15290 If two elements compare as equal, their order in the resulting sorted array is unspecified.
15293 The qsort function returns no value.
15298 <!--page 332 indent 4-->
15300 <a name="7.20.6" href="#7.20.6"><h4>7.20.6 Integer arithmetic functions</h4></a>
15302 <a name="7.20.6.1" href="#7.20.6.1"><h5>7.20.6.1 The abs, labs and llabs functions</h5></a>
15306 #include <stdlib.h>
15308 long int labs(long int j);
15309 long long int llabs(long long int j);</pre>
15310 <h6>Description</h6>
15312 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
15313 result cannot be represented, the behavior is undefined.<sup><a href="#note265"><b>265)</b></a></sup>
15316 The abs, labs, and llabs, functions return the absolute value.
15319 <p><a name="note265">265)</a> The absolute value of the most negative number cannot be represented in two's complement.
15322 <a name="7.20.6.2" href="#7.20.6.2"><h5>7.20.6.2 The div, ldiv, and lldiv functions</h5></a>
15326 #include <stdlib.h>
15327 div_t div(int numer, int denom);
15328 ldiv_t ldiv(long int numer, long int denom);
15329 lldiv_t lldiv(long long int numer, long long int denom);</pre>
15330 <h6>Description</h6>
15332 The div, ldiv, and lldiv, functions compute numer / denom and numer %
15333 denom in a single operation.
15336 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
15337 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
15338 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
15339 each of which has the same type as the arguments numer and denom. If either part of
15340 the result cannot be represented, the behavior is undefined.
15345 <!--page 333 indent 4-->
15347 <a name="7.20.7" href="#7.20.7"><h4>7.20.7 Multibyte/wide character conversion functions</h4></a>
15349 The behavior of the multibyte character functions is affected by the LC_CTYPE category
15350 of the current locale. For a state-dependent encoding, each function is placed into its
15351 initial conversion state by a call for which its character pointer argument, s, is a null
15352 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
15353 state of the function to be altered as necessary. A call with s as a null pointer causes
15354 these functions to return a nonzero value if encodings have state dependency, and zero
15355 otherwise.<sup><a href="#note266"><b>266)</b></a></sup> Changing the LC_CTYPE category causes the conversion state of these
15356 functions to be indeterminate.
15359 <p><a name="note266">266)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
15360 character codes, but are grouped with an adjacent multibyte character.
15363 <a name="7.20.7.1" href="#7.20.7.1"><h5>7.20.7.1 The mblen function</h5></a>
15367 #include <stdlib.h>
15368 int mblen(const char *s, size_t n);</pre>
15369 <h6>Description</h6>
15371 If s is not a null pointer, the mblen function determines the number of bytes contained
15372 in the multibyte character pointed to by s. Except that the conversion state of the
15373 mbtowc function is not affected, it is equivalent to
15376 mbtowc((wchar_t *)0, s, n);</pre>
15377 The implementation shall behave as if no library function calls the mblen function.
15380 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
15381 character encodings, respectively, do or do not have state-dependent encodings. If s is
15382 not a null pointer, the mblen function either returns 0 (if s points to the null character),
15383 or returns the number of bytes that are contained in the multibyte character (if the next n
15384 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
15385 multibyte character).
15386 Forward references: the mbtowc function (<a href="#7.20.7.2">7.20.7.2</a>).
15391 <!--page 334 indent 4-->
15393 <a name="7.20.7.2" href="#7.20.7.2"><h5>7.20.7.2 The mbtowc function</h5></a>
15397 #include <stdlib.h>
15398 int mbtowc(wchar_t * restrict pwc,
15399 const char * restrict s,
15401 <h6>Description</h6>
15403 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
15404 the byte pointed to by s to determine the number of bytes needed to complete the next
15405 multibyte character (including any shift sequences). If the function determines that the
15406 next multibyte character is complete and valid, it determines the value of the
15407 corresponding wide character and then, if pwc is not a null pointer, stores that value in
15408 the object pointed to by pwc. If the corresponding wide character is the null wide
15409 character, the function is left in the initial conversion state.
15411 The implementation shall behave as if no library function calls the mbtowc function.
15414 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
15415 character encodings, respectively, do or do not have state-dependent encodings. If s is
15416 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
15417 or returns the number of bytes that are contained in the converted multibyte character (if
15418 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
15419 form a valid multibyte character).
15421 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
15424 <a name="7.20.7.3" href="#7.20.7.3"><h5>7.20.7.3 The wctomb function</h5></a>
15428 #include <stdlib.h>
15429 int wctomb(char *s, wchar_t wc);</pre>
15430 <h6>Description</h6>
15432 The wctomb function determines the number of bytes needed to represent the multibyte
15433 character corresponding to the wide character given by wc (including any shift
15434 sequences), and stores the multibyte character representation in the array whose first
15435 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
15436 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
15437 sequence needed to restore the initial shift state, and the function is left in the initial
15439 <!--page 335 indent 4-->
15441 The implementation shall behave as if no library function calls the wctomb function.
15444 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
15445 character encodings, respectively, do or do not have state-dependent encodings. If s is
15446 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
15447 to a valid multibyte character, or returns the number of bytes that are contained in the
15448 multibyte character corresponding to the value of wc.
15450 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
15452 <a name="7.20.8" href="#7.20.8"><h4>7.20.8 Multibyte/wide string conversion functions</h4></a>
15454 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
15455 the current locale.
15457 <a name="7.20.8.1" href="#7.20.8.1"><h5>7.20.8.1 The mbstowcs function</h5></a>
15461 #include <stdlib.h>
15462 size_t mbstowcs(wchar_t * restrict pwcs,
15463 const char * restrict s,
15465 <h6>Description</h6>
15467 The mbstowcs function converts a sequence of multibyte characters that begins in the
15468 initial shift state from the array pointed to by s into a sequence of corresponding wide
15469 characters and stores not more than n wide characters into the array pointed to by pwcs.
15470 No multibyte characters that follow a null character (which is converted into a null wide
15471 character) will be examined or converted. Each multibyte character is converted as if by
15472 a call to the mbtowc function, except that the conversion state of the mbtowc function is
15475 No more than n elements will be modified in the array pointed to by pwcs. If copying
15476 takes place between objects that overlap, the behavior is undefined.
15479 If an invalid multibyte character is encountered, the mbstowcs function returns
15480 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
15481 elements modified, not including a terminating null wide character, if any.<sup><a href="#note267"><b>267)</b></a></sup>
15486 <!--page 336 indent 4-->
15489 <p><a name="note267">267)</a> The array will not be null-terminated if the value returned is n.
15492 <a name="7.20.8.2" href="#7.20.8.2"><h5>7.20.8.2 The wcstombs function</h5></a>
15496 #include <stdlib.h>
15497 size_t wcstombs(char * restrict s,
15498 const wchar_t * restrict pwcs,
15500 <h6>Description</h6>
15502 The wcstombs function converts a sequence of wide characters from the array pointed
15503 to by pwcs into a sequence of corresponding multibyte characters that begins in the
15504 initial shift state, and stores these multibyte characters into the array pointed to by s,
15505 stopping if a multibyte character would exceed the limit of n total bytes or if a null
15506 character is stored. Each wide character is converted as if by a call to the wctomb
15507 function, except that the conversion state of the wctomb function is not affected.
15509 No more than n bytes will be modified in the array pointed to by s. If copying takes place
15510 between objects that overlap, the behavior is undefined.
15513 If a wide character is encountered that does not correspond to a valid multibyte character,
15514 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
15515 returns the number of bytes modified, not including a terminating null character, if
15517 <!--page 337 indent 4-->
15519 <a name="7.21" href="#7.21"><h3>7.21 String handling <string.h></h3></a>
15521 <a name="7.21.1" href="#7.21.1"><h4>7.21.1 String function conventions</h4></a>
15523 The header <string.h> declares one type and several functions, and defines one
15524 macro useful for manipulating arrays of character type and other objects treated as arrays
15525 of character type.<sup><a href="#note268"><b>268)</b></a></sup> The type is size_t and the macro is NULL (both described in
15526 <a href="#7.17">7.17</a>). Various methods are used for determining the lengths of the arrays, but in all cases
15527 a char * or void * argument points to the initial (lowest addressed) character of the
15528 array. If an array is accessed beyond the end of an object, the behavior is undefined.
15530 Where an argument declared as size_t n specifies the length of the array for a
15531 function, n can have the value zero on a call to that function. Unless explicitly stated
15532 otherwise in the description of a particular function in this subclause, pointer arguments
15533 on such a call shall still have valid values, as described in <a href="#7.1.4">7.1.4</a>. On such a call, a
15534 function that locates a character finds no occurrence, a function that compares two
15535 character sequences returns zero, and a function that copies characters copies zero
15538 For all functions in this subclause, each character shall be interpreted as if it had the type
15539 unsigned char (and therefore every possible object representation is valid and has a
15543 <p><a name="note268">268)</a> See ''future library directions'' (<a href="#7.26.11">7.26.11</a>).
15546 <a name="7.21.2" href="#7.21.2"><h4>7.21.2 Copying functions</h4></a>
15548 <a name="7.21.2.1" href="#7.21.2.1"><h5>7.21.2.1 The memcpy function</h5></a>
15552 #include <string.h>
15553 void *memcpy(void * restrict s1,
15554 const void * restrict s2,
15556 <h6>Description</h6>
15558 The memcpy function copies n characters from the object pointed to by s2 into the
15559 object pointed to by s1. If copying takes place between objects that overlap, the behavior
15563 The memcpy function returns the value of s1.
15568 <!--page 338 indent 4-->
15570 <a name="7.21.2.2" href="#7.21.2.2"><h5>7.21.2.2 The memmove function</h5></a>
15574 #include <string.h>
15575 void *memmove(void *s1, const void *s2, size_t n);</pre>
15576 <h6>Description</h6>
15578 The memmove function copies n characters from the object pointed to by s2 into the
15579 object pointed to by s1. Copying takes place as if the n characters from the object
15580 pointed to by s2 are first copied into a temporary array of n characters that does not
15581 overlap the objects pointed to by s1 and s2, and then the n characters from the
15582 temporary array are copied into the object pointed to by s1.
15585 The memmove function returns the value of s1.
15587 <a name="7.21.2.3" href="#7.21.2.3"><h5>7.21.2.3 The strcpy function</h5></a>
15591 #include <string.h>
15592 char *strcpy(char * restrict s1,
15593 const char * restrict s2);</pre>
15594 <h6>Description</h6>
15596 The strcpy function copies the string pointed to by s2 (including the terminating null
15597 character) into the array pointed to by s1. If copying takes place between objects that
15598 overlap, the behavior is undefined.
15601 The strcpy function returns the value of s1.
15603 <a name="7.21.2.4" href="#7.21.2.4"><h5>7.21.2.4 The strncpy function</h5></a>
15607 #include <string.h>
15608 char *strncpy(char * restrict s1,
15609 const char * restrict s2,
15611 <h6>Description</h6>
15613 The strncpy function copies not more than n characters (characters that follow a null
15614 character are not copied) from the array pointed to by s2 to the array pointed to by
15615 <!--page 339 indent 4-->
15616 s1.<sup><a href="#note269"><b>269)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
15618 If the array pointed to by s2 is a string that is shorter than n characters, null characters
15619 are appended to the copy in the array pointed to by s1, until n characters in all have been
15623 The strncpy function returns the value of s1.
15626 <p><a name="note269">269)</a> Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
15627 not be null-terminated.
15630 <a name="7.21.3" href="#7.21.3"><h4>7.21.3 Concatenation functions</h4></a>
15632 <a name="7.21.3.1" href="#7.21.3.1"><h5>7.21.3.1 The strcat function</h5></a>
15636 #include <string.h>
15637 char *strcat(char * restrict s1,
15638 const char * restrict s2);</pre>
15639 <h6>Description</h6>
15641 The strcat function appends a copy of the string pointed to by s2 (including the
15642 terminating null character) to the end of the string pointed to by s1. The initial character
15643 of s2 overwrites the null character at the end of s1. If copying takes place between
15644 objects that overlap, the behavior is undefined.
15647 The strcat function returns the value of s1.
15649 <a name="7.21.3.2" href="#7.21.3.2"><h5>7.21.3.2 The strncat function</h5></a>
15653 #include <string.h>
15654 char *strncat(char * restrict s1,
15655 const char * restrict s2,
15657 <h6>Description</h6>
15659 The strncat function appends not more than n characters (a null character and
15660 characters that follow it are not appended) from the array pointed to by s2 to the end of
15661 the string pointed to by s1. The initial character of s2 overwrites the null character at the
15662 end of s1. A terminating null character is always appended to the result.<sup><a href="#note270"><b>270)</b></a></sup> If copying
15664 <!--page 340 indent 4-->
15665 takes place between objects that overlap, the behavior is undefined.
15668 The strncat function returns the value of s1.
15669 Forward references: the strlen function (<a href="#7.21.6.3">7.21.6.3</a>).
15672 <p><a name="note270">270)</a> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
15676 <a name="7.21.4" href="#7.21.4"><h4>7.21.4 Comparison functions</h4></a>
15678 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
15679 and strncmp is determined by the sign of the difference between the values of the first
15680 pair of characters (both interpreted as unsigned char) that differ in the objects being
15683 <a name="7.21.4.1" href="#7.21.4.1"><h5>7.21.4.1 The memcmp function</h5></a>
15687 #include <string.h>
15688 int memcmp(const void *s1, const void *s2, size_t n);</pre>
15689 <h6>Description</h6>
15691 The memcmp function compares the first n characters of the object pointed to by s1 to
15692 the first n characters of the object pointed to by s2.<sup><a href="#note271"><b>271)</b></a></sup>
15695 The memcmp function returns an integer greater than, equal to, or less than zero,
15696 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
15700 <p><a name="note271">271)</a> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
15701 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
15705 <a name="7.21.4.2" href="#7.21.4.2"><h5>7.21.4.2 The strcmp function</h5></a>
15709 #include <string.h>
15710 int strcmp(const char *s1, const char *s2);</pre>
15711 <h6>Description</h6>
15713 The strcmp function compares the string pointed to by s1 to the string pointed to by
15717 The strcmp function returns an integer greater than, equal to, or less than zero,
15718 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
15720 <!--page 341 indent 4-->
15723 <a name="7.21.4.3" href="#7.21.4.3"><h5>7.21.4.3 The strcoll function</h5></a>
15727 #include <string.h>
15728 int strcoll(const char *s1, const char *s2);</pre>
15729 <h6>Description</h6>
15731 The strcoll function compares the string pointed to by s1 to the string pointed to by
15732 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
15735 The strcoll function returns an integer greater than, equal to, or less than zero,
15736 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
15737 pointed to by s2 when both are interpreted as appropriate to the current locale.
15739 <a name="7.21.4.4" href="#7.21.4.4"><h5>7.21.4.4 The strncmp function</h5></a>
15743 #include <string.h>
15744 int strncmp(const char *s1, const char *s2, size_t n);</pre>
15745 <h6>Description</h6>
15747 The strncmp function compares not more than n characters (characters that follow a
15748 null character are not compared) from the array pointed to by s1 to the array pointed to
15752 The strncmp function returns an integer greater than, equal to, or less than zero,
15753 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
15754 to, or less than the possibly null-terminated array pointed to by s2.
15756 <a name="7.21.4.5" href="#7.21.4.5"><h5>7.21.4.5 The strxfrm function</h5></a>
15760 #include <string.h>
15761 size_t strxfrm(char * restrict s1,
15762 const char * restrict s2,
15764 <h6>Description</h6>
15766 The strxfrm function transforms the string pointed to by s2 and places the resulting
15767 string into the array pointed to by s1. The transformation is such that if the strcmp
15768 function is applied to two transformed strings, it returns a value greater than, equal to, or
15769 <!--page 342 indent 4-->
15770 less than zero, corresponding to the result of the strcoll function applied to the same
15771 two original strings. No more than n characters are placed into the resulting array
15772 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
15773 be a null pointer. If copying takes place between objects that overlap, the behavior is
15777 The strxfrm function returns the length of the transformed string (not including the
15778 terminating null character). If the value returned is n or more, the contents of the array
15779 pointed to by s1 are indeterminate.
15781 EXAMPLE The value of the following expression is the size of the array needed to hold the
15782 transformation of the string pointed to by s.
15784 1 + strxfrm(NULL, s, 0)</pre>
15787 <a name="7.21.5" href="#7.21.5"><h4>7.21.5 Search functions</h4></a>
15789 <a name="7.21.5.1" href="#7.21.5.1"><h5>7.21.5.1 The memchr function</h5></a>
15793 #include <string.h>
15794 void *memchr(const void *s, int c, size_t n);</pre>
15795 <h6>Description</h6>
15797 The memchr function locates the first occurrence of c (converted to an unsigned
15798 char) in the initial n characters (each interpreted as unsigned char) of the object
15802 The memchr function returns a pointer to the located character, or a null pointer if the
15803 character does not occur in the object.
15805 <a name="7.21.5.2" href="#7.21.5.2"><h5>7.21.5.2 The strchr function</h5></a>
15809 #include <string.h>
15810 char *strchr(const char *s, int c);</pre>
15811 <h6>Description</h6>
15813 The strchr function locates the first occurrence of c (converted to a char) in the
15814 string pointed to by s. The terminating null character is considered to be part of the
15818 The strchr function returns a pointer to the located character, or a null pointer if the
15819 character does not occur in the string.
15820 <!--page 343 indent 4-->
15822 <a name="7.21.5.3" href="#7.21.5.3"><h5>7.21.5.3 The strcspn function</h5></a>
15826 #include <string.h>
15827 size_t strcspn(const char *s1, const char *s2);</pre>
15828 <h6>Description</h6>
15830 The strcspn function computes the length of the maximum initial segment of the string
15831 pointed to by s1 which consists entirely of characters not from the string pointed to by
15835 The strcspn function returns the length of the segment.
15837 <a name="7.21.5.4" href="#7.21.5.4"><h5>7.21.5.4 The strpbrk function</h5></a>
15841 #include <string.h>
15842 char *strpbrk(const char *s1, const char *s2);</pre>
15843 <h6>Description</h6>
15845 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
15846 character from the string pointed to by s2.
15849 The strpbrk function returns a pointer to the character, or a null pointer if no character
15850 from s2 occurs in s1.
15852 <a name="7.21.5.5" href="#7.21.5.5"><h5>7.21.5.5 The strrchr function</h5></a>
15856 #include <string.h>
15857 char *strrchr(const char *s, int c);</pre>
15858 <h6>Description</h6>
15860 The strrchr function locates the last occurrence of c (converted to a char) in the
15861 string pointed to by s. The terminating null character is considered to be part of the
15865 The strrchr function returns a pointer to the character, or a null pointer if c does not
15866 occur in the string.
15867 <!--page 344 indent 4-->
15869 <a name="7.21.5.6" href="#7.21.5.6"><h5>7.21.5.6 The strspn function</h5></a>
15873 #include <string.h>
15874 size_t strspn(const char *s1, const char *s2);</pre>
15875 <h6>Description</h6>
15877 The strspn function computes the length of the maximum initial segment of the string
15878 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
15881 The strspn function returns the length of the segment.
15883 <a name="7.21.5.7" href="#7.21.5.7"><h5>7.21.5.7 The strstr function</h5></a>
15887 #include <string.h>
15888 char *strstr(const char *s1, const char *s2);</pre>
15889 <h6>Description</h6>
15891 The strstr function locates the first occurrence in the string pointed to by s1 of the
15892 sequence of characters (excluding the terminating null character) in the string pointed to
15896 The strstr function returns a pointer to the located string, or a null pointer if the string
15897 is not found. If s2 points to a string with zero length, the function returns s1.
15899 <a name="7.21.5.8" href="#7.21.5.8"><h5>7.21.5.8 The strtok function</h5></a>
15903 #include <string.h>
15904 char *strtok(char * restrict s1,
15905 const char * restrict s2);</pre>
15906 <h6>Description</h6>
15908 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
15909 sequence of tokens, each of which is delimited by a character from the string pointed to
15910 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
15911 sequence have a null first argument. The separator string pointed to by s2 may be
15912 different from call to call.
15914 The first call in the sequence searches the string pointed to by s1 for the first character
15915 that is not contained in the current separator string pointed to by s2. If no such character
15916 is found, then there are no tokens in the string pointed to by s1 and the strtok function
15917 <!--page 345 indent 4-->
15918 returns a null pointer. If such a character is found, it is the start of the first token.
15920 The strtok function then searches from there for a character that is contained in the
15921 current separator string. If no such character is found, the current token extends to the
15922 end of the string pointed to by s1, and subsequent searches for a token will return a null
15923 pointer. If such a character is found, it is overwritten by a null character, which
15924 terminates the current token. The strtok function saves a pointer to the following
15925 character, from which the next search for a token will start.
15927 Each subsequent call, with a null pointer as the value of the first argument, starts
15928 searching from the saved pointer and behaves as described above.
15930 The implementation shall behave as if no library function calls the strtok function.
15933 The strtok function returns a pointer to the first character of a token, or a null pointer
15934 if there is no token.
15938 #include <string.h>
15939 static char str[] = "?a???b,,,#c";
15941 t = strtok(str, "?"); // t points to the token "a"
15942 t = strtok(NULL, ","); // t points to the token "??b"
15943 t = strtok(NULL, "#,"); // t points to the token "c"
15944 t = strtok(NULL, "?"); // t is a null pointer</pre>
15947 <a name="7.21.6" href="#7.21.6"><h4>7.21.6 Miscellaneous functions</h4></a>
15949 <a name="7.21.6.1" href="#7.21.6.1"><h5>7.21.6.1 The memset function</h5></a>
15953 #include <string.h>
15954 void *memset(void *s, int c, size_t n);</pre>
15955 <h6>Description</h6>
15957 The memset function copies the value of c (converted to an unsigned char) into
15958 each of the first n characters of the object pointed to by s.
15961 The memset function returns the value of s.
15962 <!--page 346 indent 4-->
15964 <a name="7.21.6.2" href="#7.21.6.2"><h5>7.21.6.2 The strerror function</h5></a>
15968 #include <string.h>
15969 char *strerror(int errnum);</pre>
15970 <h6>Description</h6>
15972 The strerror function maps the number in errnum to a message string. Typically,
15973 the values for errnum come from errno, but strerror shall map any value of type
15976 The implementation shall behave as if no library function calls the strerror function.
15979 The strerror function returns a pointer to the string, the contents of which are locale-
15980 specific. The array pointed to shall not be modified by the program, but may be
15981 overwritten by a subsequent call to the strerror function.
15983 <a name="7.21.6.3" href="#7.21.6.3"><h5>7.21.6.3 The strlen function</h5></a>
15987 #include <string.h>
15988 size_t strlen(const char *s);</pre>
15989 <h6>Description</h6>
15991 The strlen function computes the length of the string pointed to by s.
15994 The strlen function returns the number of characters that precede the terminating null
15996 <!--page 347 indent 4-->
15998 <a name="7.22" href="#7.22"><h3>7.22 Type-generic math <tgmath.h></h3></a>
16000 The header <tgmath.h> includes the headers <math.h> and <complex.h> and
16001 defines several type-generic macros.
16003 Of the <math.h> and <complex.h> functions without an f (float) or l (long
16004 double) suffix, several have one or more parameters whose corresponding real type is
16005 double. For each such function, except modf, there is a corresponding type-generic
16006 macro.<sup><a href="#note272"><b>272)</b></a></sup> The parameters whose corresponding real type is double in the function
16007 synopsis are generic parameters. Use of the macro invokes a function whose
16008 corresponding real type and type domain are determined by the arguments for the generic
16009 parameters.<sup><a href="#note273"><b>273)</b></a></sup>
16011 Use of the macro invokes a function whose generic parameters have the corresponding
16012 real type determined as follows:
16014 <li> First, if any argument for generic parameters has type long double, the type
16015 determined is long double.
16016 <li> Otherwise, if any argument for generic parameters has type double or is of integer
16017 type, the type determined is double.
16018 <li> Otherwise, the type determined is float.
16021 For each unsuffixed function in <math.h> for which there is a function in
16022 <complex.h> with the same name except for a c prefix, the corresponding type-
16023 generic macro (for both functions) has the same name as the function in <math.h>. The
16024 corresponding type-generic macro for fabs and cabs is fabs.
16029 <!--page 348 indent 4-->
16031 <math.h> <complex.h> type-generic
16032 function function macro
16049 fabs cabs fabs</pre>
16050 If at least one argument for a generic parameter is complex, then use of the macro invokes
16051 a complex function; otherwise, use of the macro invokes a real function.
16053 For each unsuffixed function in <math.h> without a c-prefixed counterpart in
16054 <complex.h> (except modf), the corresponding type-generic macro has the same
16055 name as the function. These type-generic macros are:
16057 atan2 fma llround remainder
16058 cbrt fmax log10 remquo
16059 ceil fmin log1p rint
16060 copysign fmod log2 round
16061 erf frexp logb scalbn
16062 erfc hypot lrint scalbln
16063 exp2 ilogb lround tgamma
16064 expm1 ldexp nearbyint trunc
16065 fdim lgamma nextafter
16066 floor llrint nexttoward</pre>
16067 If all arguments for generic parameters are real, then use of the macro invokes a real
16068 function; otherwise, use of the macro results in undefined behavior.
16070 For each unsuffixed function in <complex.h> that is not a c-prefixed counterpart to a
16071 function in <math.h>, the corresponding type-generic macro has the same name as the
16072 function. These type-generic macros are:
16073 <!--page 349 indent 4-->
16077 Use of the macro with any real or complex argument invokes a complex function.
16079 EXAMPLE With the declarations
16081 #include <tgmath.h>
16088 long double complex ldc;</pre>
16089 functions invoked by use of type-generic macros are shown in the following table:
16090 <!--page 350 indent 4-->
16093 exp(n) exp(n), the function
16095 sin(d) sin(d), the function
16099 pow(ldc, f) cpowl(ldc, f)
16100 remainder(n, n) remainder(n, n), the function
16101 nextafter(d, f) nextafter(d, f), the function
16102 nexttoward(f, ld) nexttowardf(f, ld)
16103 copysign(n, ld) copysignl(n, ld)
16104 ceil(fc) undefined behavior
16105 rint(dc) undefined behavior
16106 fmax(ldc, ld) undefined behavior
16107 carg(n) carg(n), the function
16109 creal(d) creal(d), the function
16110 cimag(ld) cimagl(ld)
16112 carg(dc) carg(dc), the function
16113 cproj(ldc) cprojl(ldc)</pre>
16116 <p><a name="note272">272)</a> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
16117 make available the corresponding ordinary function.
16119 <p><a name="note273">273)</a> If the type of the argument is not compatible with the type of the parameter for the selected function,
16120 the behavior is undefined.
16123 <a name="7.23" href="#7.23"><h3>7.23 Date and time <time.h></h3></a>
16125 <a name="7.23.1" href="#7.23.1"><h4>7.23.1 Components of time</h4></a>
16127 The header <time.h> defines two macros, and declares several types and functions for
16128 manipulating time. Many functions deal with a calendar time that represents the current
16129 date (according to the Gregorian calendar) and time. Some functions deal with local
16130 time, which is the calendar time expressed for some specific time zone, and with Daylight
16131 Saving Time, which is a temporary change in the algorithm for determining local time.
16132 The local time zone and Daylight Saving Time are implementation-defined.
16134 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
16136 CLOCKS_PER_SEC</pre>
16137 which expands to an expression with type clock_t (described below) that is the
16138 number per second of the value returned by the clock function.
16140 The types declared are size_t (described in <a href="#7.17">7.17</a>);
16146 which are arithmetic types capable of representing times; and
16149 which holds the components of a calendar time, called the broken-down time.
16151 The range and precision of times representable in clock_t and time_t are
16152 implementation-defined. The tm structure shall contain at least the following members,
16153 in any order. The semantics of the members and their normal ranges are expressed in the
16154 comments.<sup><a href="#note274"><b>274)</b></a></sup>
16156 int tm_sec; // seconds after the minute -- [0, 60]
16157 int tm_min; // minutes after the hour -- [0, 59]
16158 int tm_hour; // hours since midnight -- [0, 23]
16159 int tm_mday; // day of the month -- [1, 31]
16160 int tm_mon; // months since January -- [0, 11]
16161 int tm_year; // years since 1900
16162 int tm_wday; // days since Sunday -- [0, 6]
16163 int tm_yday; // days since January 1 -- [0, 365]
16164 int tm_isdst; // Daylight Saving Time flag</pre>
16168 <!--page 351 indent 4-->
16169 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
16170 Saving Time is not in effect, and negative if the information is not available.
16173 <p><a name="note274">274)</a> The range [0, 60] for tm_sec allows for a positive leap second.
16176 <a name="7.23.2" href="#7.23.2"><h4>7.23.2 Time manipulation functions</h4></a>
16178 <a name="7.23.2.1" href="#7.23.2.1"><h5>7.23.2.1 The clock function</h5></a>
16182 #include <time.h>
16183 clock_t clock(void);</pre>
16184 <h6>Description</h6>
16186 The clock function determines the processor time used.
16189 The clock function returns the implementation's best approximation to the processor
16190 time used by the program since the beginning of an implementation-defined era related
16191 only to the program invocation. To determine the time in seconds, the value returned by
16192 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
16193 the processor time used is not available or its value cannot be represented, the function
16194 returns the value (clock_t)(-1).<sup><a href="#note275"><b>275)</b></a></sup>
16197 <p><a name="note275">275)</a> In order to measure the time spent in a program, the clock function should be called at the start of
16198 the program and its return value subtracted from the value returned by subsequent calls.
16201 <a name="7.23.2.2" href="#7.23.2.2"><h5>7.23.2.2 The difftime function</h5></a>
16205 #include <time.h>
16206 double difftime(time_t time1, time_t time0);</pre>
16207 <h6>Description</h6>
16209 The difftime function computes the difference between two calendar times: time1 -
16213 The difftime function returns the difference expressed in seconds as a double.
16218 <!--page 352 indent 4-->
16220 <a name="7.23.2.3" href="#7.23.2.3"><h5>7.23.2.3 The mktime function</h5></a>
16224 #include <time.h>
16225 time_t mktime(struct tm *timeptr);</pre>
16226 <h6>Description</h6>
16228 The mktime function converts the broken-down time, expressed as local time, in the
16229 structure pointed to by timeptr into a calendar time value with the same encoding as
16230 that of the values returned by the time function. The original values of the tm_wday
16231 and tm_yday components of the structure are ignored, and the original values of the
16232 other components are not restricted to the ranges indicated above.<sup><a href="#note276"><b>276)</b></a></sup> On successful
16233 completion, the values of the tm_wday and tm_yday components of the structure are
16234 set appropriately, and the other components are set to represent the specified calendar
16235 time, but with their values forced to the ranges indicated above; the final value of
16236 tm_mday is not set until tm_mon and tm_year are determined.
16239 The mktime function returns the specified calendar time encoded as a value of type
16240 time_t. If the calendar time cannot be represented, the function returns the value
16243 EXAMPLE What day of the week is July 4, 2001?
16245 #include <stdio.h>
16246 #include <time.h>
16247 static const char *const wday[] = {
16248 "Sunday", "Monday", "Tuesday", "Wednesday",
16249 "Thursday", "Friday", "Saturday", "-unknown-"
16251 struct tm time_str;
16257 <!--page 353 indent 4-->
16259 time_str.tm_year = 2001 - 1900;
16260 time_str.tm_mon = 7 - 1;
16261 time_str.tm_mday = 4;
16262 time_str.tm_hour = 0;
16263 time_str.tm_min = 0;
16264 time_str.tm_sec = 1;
16265 time_str.tm_isdst = -1;
16266 if (mktime(&time_str) == (time_t)(-1))
16267 time_str.tm_wday = 7;
16268 printf("%s\n", wday[time_str.tm_wday]);</pre>
16272 <p><a name="note276">276)</a> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
16273 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
16274 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
16277 <a name="7.23.2.4" href="#7.23.2.4"><h5>7.23.2.4 The time function</h5></a>
16281 #include <time.h>
16282 time_t time(time_t *timer);</pre>
16283 <h6>Description</h6>
16285 The time function determines the current calendar time. The encoding of the value is
16289 The time function returns the implementation's best approximation to the current
16290 calendar time. The value (time_t)(-1) is returned if the calendar time is not
16291 available. If timer is not a null pointer, the return value is also assigned to the object it
16294 <a name="7.23.3" href="#7.23.3"><h4>7.23.3 Time conversion functions</h4></a>
16296 Except for the strftime function, these functions each return a pointer to one of two
16297 types of static objects: a broken-down time structure or an array of char. Execution of
16298 any of the functions that return a pointer to one of these object types may overwrite the
16299 information in any object of the same type pointed to by the value returned from any
16300 previous call to any of them. The implementation shall behave as if no other library
16301 functions call these functions.
16303 <a name="7.23.3.1" href="#7.23.3.1"><h5>7.23.3.1 The asctime function</h5></a>
16307 #include <time.h>
16308 char *asctime(const struct tm *timeptr);</pre>
16309 <h6>Description</h6>
16311 The asctime function converts the broken-down time in the structure pointed to by
16312 timeptr into a string in the form
16313 <!--page 354 indent 4-->
16315 Sun Sep 16 01:03:52 1973\n\0</pre>
16316 using the equivalent of the following algorithm.
16317 char *asctime(const struct tm *timeptr)
16320 static const char wday_name[7][3] = {
16321 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
16323 static const char mon_name[12][3] = {
16324 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
16325 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
16327 static char result[26];
16328 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
16329 wday_name[timeptr->tm_wday],
16330 mon_name[timeptr->tm_mon],
16331 timeptr->tm_mday, timeptr->tm_hour,
16332 timeptr->tm_min, timeptr->tm_sec,
16333 1900 + timeptr->tm_year);
16334 return result;</pre>
16338 The asctime function returns a pointer to the string.
16340 <a name="7.23.3.2" href="#7.23.3.2"><h5>7.23.3.2 The ctime function</h5></a>
16344 #include <time.h>
16345 char *ctime(const time_t *timer);</pre>
16346 <h6>Description</h6>
16348 The ctime function converts the calendar time pointed to by timer to local time in the
16349 form of a string. It is equivalent to
16351 asctime(localtime(timer))</pre>
16354 The ctime function returns the pointer returned by the asctime function with that
16355 broken-down time as argument.
16356 Forward references: the localtime function (<a href="#7.23.3.4">7.23.3.4</a>).
16357 <!--page 355 indent 4-->
16359 <a name="7.23.3.3" href="#7.23.3.3"><h5>7.23.3.3 The gmtime function</h5></a>
16363 #include <time.h>
16364 struct tm *gmtime(const time_t *timer);</pre>
16365 <h6>Description</h6>
16367 The gmtime function converts the calendar time pointed to by timer into a broken-
16368 down time, expressed as UTC.
16371 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
16372 specified time cannot be converted to UTC.
16374 <a name="7.23.3.4" href="#7.23.3.4"><h5>7.23.3.4 The localtime function</h5></a>
16378 #include <time.h>
16379 struct tm *localtime(const time_t *timer);</pre>
16380 <h6>Description</h6>
16382 The localtime function converts the calendar time pointed to by timer into a
16383 broken-down time, expressed as local time.
16386 The localtime function returns a pointer to the broken-down time, or a null pointer if
16387 the specified time cannot be converted to local time.
16389 <a name="7.23.3.5" href="#7.23.3.5"><h5>7.23.3.5 The strftime function</h5></a>
16393 #include <time.h>
16394 size_t strftime(char * restrict s,
16396 const char * restrict format,
16397 const struct tm * restrict timeptr);</pre>
16398 <h6>Description</h6>
16400 The strftime function places characters into the array pointed to by s as controlled by
16401 the string pointed to by format. The format shall be a multibyte character sequence,
16402 beginning and ending in its initial shift state. The format string consists of zero or
16403 more conversion specifiers and ordinary multibyte characters. A conversion specifier
16404 consists of a % character, possibly followed by an E or O modifier character (described
16405 below), followed by a character that determines the behavior of the conversion specifier.
16406 All ordinary multibyte characters (including the terminating null character) are copied
16407 <!--page 356 indent 4-->
16408 unchanged into the array. If copying takes place between objects that overlap, the
16409 behavior is undefined. No more than maxsize characters are placed into the array.
16411 Each conversion specifier is replaced by appropriate characters as described in the
16412 following list. The appropriate characters are determined using the LC_TIME category
16413 of the current locale and by the values of zero or more members of the broken-down time
16414 structure pointed to by timeptr, as specified in brackets in the description. If any of
16415 the specified values is outside the normal range, the characters stored are unspecified.
16416 %a is replaced by the locale's abbreviated weekday name. [tm_wday]
16417 %A is replaced by the locale's full weekday name. [tm_wday]
16418 %b is replaced by the locale's abbreviated month name. [tm_mon]
16419 %B is replaced by the locale's full month name. [tm_mon]
16420 %c is replaced by the locale's appropriate date and time representation. [all specified
16422 in <a href="#7.23.1">7.23.1</a>]</pre>
16423 %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
16425 number (00-99). [tm_year]</pre>
16426 %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
16427 %D is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
16428 %e is replaced by the day of the month as a decimal number (1-31); a single digit is
16430 preceded by a space. [tm_mday]</pre>
16431 %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
16434 %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
16436 number (00-99). [tm_year, tm_wday, tm_yday]</pre>
16437 %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
16439 [tm_year, tm_wday, tm_yday]</pre>
16440 %h is equivalent to ''%b''. [tm_mon]
16441 %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
16442 %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
16443 %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]
16444 %m is replaced by the month as a decimal number (01-12). [tm_mon]
16445 %M is replaced by the minute as a decimal number (00-59). [tm_min]
16446 %n is replaced by a new-line character.
16447 %p is replaced by the locale's equivalent of the AM/PM designations associated with a
16449 12-hour clock. [tm_hour]</pre>
16450 %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
16451 %R is equivalent to ''%H:%M''. [tm_hour, tm_min]
16452 %S is replaced by the second as a decimal number (00-60). [tm_sec]
16453 %t is replaced by a horizontal-tab character.
16454 %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
16455 <!--page 357 indent 4-->
16458 %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
16460 is 1. [tm_wday]</pre>
16461 %U is replaced by the week number of the year (the first Sunday as the first day of week
16463 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]</pre>
16464 %V is replaced by the ISO 8601 week number (see below) as a decimal number
16466 (01-53). [tm_year, tm_wday, tm_yday]</pre>
16467 %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
16470 %W is replaced by the week number of the year (the first Monday as the first day of
16472 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]</pre>
16473 %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
16474 %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
16475 %y is replaced by the last 2 digits of the year as a decimal number (00-99).
16478 %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
16479 %z is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
16481 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
16482 zone is determinable. [tm_isdst]</pre>
16483 %Z is replaced by the locale's time zone name or abbreviation, or by no characters if no
16485 time zone is determinable. [tm_isdst]</pre>
16486 %% is replaced by %.
16488 Some conversion specifiers can be modified by the inclusion of an E or O modifier
16489 character to indicate an alternative format or specification. If the alternative format or
16490 specification does not exist for the current locale, the modifier is ignored.
16491 %Ec is replaced by the locale's alternative date and time representation.
16492 %EC is replaced by the name of the base year (period) in the locale's alternative
16494 representation.</pre>
16495 %Ex is replaced by the locale's alternative date representation.
16496 %EX is replaced by the locale's alternative time representation.
16497 %Ey is replaced by the offset from %EC (year only) in the locale's alternative
16499 representation.</pre>
16500 %EY is replaced by the locale's full alternative year representation.
16501 %Od is replaced by the day of the month, using the locale's alternative numeric symbols
16503 (filled as needed with leading zeros, or with leading spaces if there is no alternative
16504 symbol for zero).</pre>
16505 %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
16507 (filled as needed with leading spaces).</pre>
16508 %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
16509 <!--page 358 indent 4-->
16512 %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
16515 %Om is replaced by the month, using the locale's alternative numeric symbols.
16516 %OM is replaced by the minutes, using the locale's alternative numeric symbols.
16517 %OS is replaced by the seconds, using the locale's alternative numeric symbols.
16518 %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
16520 representation, where Monday is 1.</pre>
16521 %OU is replaced by the week number, using the locale's alternative numeric symbols.
16522 %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
16525 %Ow is replaced by the weekday as a number, using the locale's alternative numeric
16528 %OW is replaced by the week number of the year, using the locale's alternative numeric
16531 %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
16535 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
16536 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
16537 which is also the week that includes the first Thursday of the year, and is also the first
16538 week that contains at least four days in the year. If the first Monday of January is the
16539 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
16540 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
16541 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
16542 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
16543 %V is replaced by 01.
16545 If a conversion specifier is not one of the above, the behavior is undefined.
16547 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
16548 following specifiers are:
16549 %a the first three characters of %A.
16550 %A one of ''Sunday'', ''Monday'', ... , ''Saturday''.
16551 %b the first three characters of %B.
16552 %B one of ''January'', ''February'', ... , ''December''.
16553 %c equivalent to ''%a %b %e %T %Y''.
16554 %p one of ''AM'' or ''PM''.
16555 %r equivalent to ''%I:%M:%S %p''.
16556 %x equivalent to ''%m/%d/%y''.
16557 %X equivalent to %T.
16558 %Z implementation-defined.
16559 <!--page 359 indent 4-->
16562 If the total number of resulting characters including the terminating null character is not
16563 more than maxsize, the strftime function returns the number of characters placed
16564 into the array pointed to by s not including the terminating null character. Otherwise,
16565 zero is returned and the contents of the array are indeterminate.
16566 <!--page 360 indent 4-->
16568 <a name="7.24" href="#7.24"><h3>7.24 Extended multibyte and wide character utilities <wchar.h></h3></a>
16570 <a name="7.24.1" href="#7.24.1"><h4>7.24.1 Introduction</h4></a>
16572 The header <wchar.h> declares four data types, one tag, four macros, and many
16573 functions.<sup><a href="#note277"><b>277)</b></a></sup>
16575 The types declared are wchar_t and size_t (both described in <a href="#7.17">7.17</a>);
16578 which is an object type other than an array type that can hold the conversion state
16579 information necessary to convert between sequences of multibyte characters and wide
16583 which is an integer type unchanged by default argument promotions that can hold any
16584 value corresponding to members of the extended character set, as well as at least one
16585 value that does not correspond to any member of the extended character set (see WEOF
16586 below);<sup><a href="#note278"><b>278)</b></a></sup> and
16589 which is declared as an incomplete structure type (the contents are described in <a href="#7.23.1">7.23.1</a>).
16591 The macros defined are NULL (described in <a href="#7.17">7.17</a>); WCHAR_MIN and WCHAR_MAX
16592 (described in <a href="#7.18.3">7.18.3</a>); and
16595 which expands to a constant expression of type wint_t whose value does not
16596 correspond to any member of the extended character set.<sup><a href="#note279"><b>279)</b></a></sup> It is accepted (and returned)
16597 by several functions in this subclause to indicate end-of-file, that is, no more input from a
16598 stream. It is also used as a wide character value that does not correspond to any member
16599 of the extended character set.
16601 The functions declared are grouped as follows:
16603 <li> Functions that perform input and output of wide characters, or multibyte characters,
16605 <li> Functions that provide wide string numeric conversion;
16606 <li> Functions that perform general wide string manipulation;
16609 <!--page 361 indent 4-->
16610 <li> Functions for wide string date and time conversion; and
16611 <li> Functions that provide extended capabilities for conversion between multibyte and
16612 wide character sequences.
16615 Unless explicitly stated otherwise, if the execution of a function described in this
16616 subclause causes copying to take place between objects that overlap, the behavior is
16620 <p><a name="note277">277)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
16622 <p><a name="note278">278)</a> wchar_t and wint_t can be the same integer type.
16624 <p><a name="note279">279)</a> The value of the macro WEOF may differ from that of EOF and need not be negative.
16627 <a name="7.24.2" href="#7.24.2"><h4>7.24.2 Formatted wide character input/output functions</h4></a>
16629 The formatted wide character input/output functions shall behave as if there is a sequence
16630 point after the actions associated with each specifier.<sup><a href="#note280"><b>280)</b></a></sup>
16633 <p><a name="note280">280)</a> The fwprintf functions perform writes to memory for the %n specifier.
16636 <a name="7.24.2.1" href="#7.24.2.1"><h5>7.24.2.1 The fwprintf function</h5></a>
16640 #include <stdio.h>
16641 #include <wchar.h>
16642 int fwprintf(FILE * restrict stream,
16643 const wchar_t * restrict format, ...);</pre>
16644 <h6>Description</h6>
16646 The fwprintf function writes output to the stream pointed to by stream, under
16647 control of the wide string pointed to by format that specifies how subsequent arguments
16648 are converted for output. If there are insufficient arguments for the format, the behavior
16649 is undefined. If the format is exhausted while arguments remain, the excess arguments
16650 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
16651 when the end of the format string is encountered.
16653 The format is composed of zero or more directives: ordinary wide characters (not %),
16654 which are copied unchanged to the output stream; and conversion specifications, each of
16655 which results in fetching zero or more subsequent arguments, converting them, if
16656 applicable, according to the corresponding conversion specifier, and then writing the
16657 result to the output stream.
16659 Each conversion specification is introduced by the wide character %. After the %, the
16660 following appear in sequence:
16662 <li> Zero or more flags (in any order) that modify the meaning of the conversion
16664 <li> An optional minimum field width. If the converted value has fewer wide characters
16665 than the field width, it is padded with spaces (by default) on the left (or right, if the
16668 <!--page 362 indent 4-->
16669 left adjustment flag, described later, has been given) to the field width. The field
16670 width takes the form of an asterisk * (described later) or a nonnegative decimal
16671 integer.<sup><a href="#note281"><b>281)</b></a></sup>
16672 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
16673 o, u, x, and X conversions, the number of digits to appear after the decimal-point
16674 wide character for a, A, e, E, f, and F conversions, the maximum number of
16675 significant digits for the g and G conversions, or the maximum number of wide
16676 characters to be written for s conversions. The precision takes the form of a period
16677 (.) followed either by an asterisk * (described later) or by an optional decimal
16678 integer; if only the period is specified, the precision is taken as zero. If a precision
16679 appears with any other conversion specifier, the behavior is undefined.
16680 <li> An optional length modifier that specifies the size of the argument.
16681 <li> A conversion specifier wide character that specifies the type of conversion to be
16685 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
16686 this case, an int argument supplies the field width or precision. The arguments
16687 specifying field width, or precision, or both, shall appear (in that order) before the
16688 argument (if any) to be converted. A negative field width argument is taken as a - flag
16689 followed by a positive field width. A negative precision argument is taken as if the
16690 precision were omitted.
16692 The flag wide characters and their meanings are:
16693 - The result of the conversion is left-justified within the field. (It is right-justified if
16695 this flag is not specified.)</pre>
16696 + The result of a signed conversion always begins with a plus or minus sign. (It
16698 begins with a sign only when a negative value is converted if this flag is not
16699 specified.)<sup><a href="#note282"><b>282)</b></a></sup></pre>
16700 space If the first wide character of a signed conversion is not a sign, or if a signed
16702 conversion results in no wide characters, a space is prefixed to the result. If the
16703 space and + flags both appear, the space flag is ignored.</pre>
16704 # The result is converted to an ''alternative form''. For o conversion, it increases
16706 the precision, if and only if necessary, to force the first digit of the result to be a
16707 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
16708 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,</pre>
16710 <!--page 363 indent 4-->
16712 and G conversions, the result of converting a floating-point number always
16713 contains a decimal-point wide character, even if no digits follow it. (Normally, a
16714 decimal-point wide character appears in the result of these conversions only if a
16715 digit follows it.) For g and G conversions, trailing zeros are not removed from the
16716 result. For other conversions, the behavior is undefined.</pre>
16717 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
16720 (following any indication of sign or base) are used to pad to the field width rather
16721 than performing space padding, except when converting an infinity or NaN. If the
16722 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
16723 conversions, if a precision is specified, the 0 flag is ignored. For other
16724 conversions, the behavior is undefined.</pre>
16725 The length modifiers and their meanings are:
16726 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16728 signed char or unsigned char argument (the argument will have
16729 been promoted according to the integer promotions, but its value shall be
16730 converted to signed char or unsigned char before printing); or that
16731 a following n conversion specifier applies to a pointer to a signed char
16733 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16735 short int or unsigned short int argument (the argument will
16736 have been promoted according to the integer promotions, but its value shall
16737 be converted to short int or unsigned short int before printing);
16738 or that a following n conversion specifier applies to a pointer to a short
16739 int argument.</pre>
16740 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16742 long int or unsigned long int argument; that a following n
16743 conversion specifier applies to a pointer to a long int argument; that a
16744 following c conversion specifier applies to a wint_t argument; that a
16745 following s conversion specifier applies to a pointer to a wchar_t
16746 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
16748 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16750 long long int or unsigned long long int argument; or that a
16751 following n conversion specifier applies to a pointer to a long long int
16753 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
16754 <!--page 364 indent 4-->
16756 an intmax_t or uintmax_t argument; or that a following n conversion
16757 specifier applies to a pointer to an intmax_t argument.</pre>
16758 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16760 size_t or the corresponding signed integer type argument; or that a
16761 following n conversion specifier applies to a pointer to a signed integer type
16762 corresponding to size_t argument.</pre>
16763 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16765 ptrdiff_t or the corresponding unsigned integer type argument; or that a
16766 following n conversion specifier applies to a pointer to a ptrdiff_t
16768 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
16770 applies to a long double argument.</pre>
16771 If a length modifier appears with any conversion specifier other than as specified above,
16772 the behavior is undefined.
16774 The conversion specifiers and their meanings are:
16775 d,i The int argument is converted to signed decimal in the style [-]dddd. The
16777 precision specifies the minimum number of digits to appear; if the value
16778 being converted can be represented in fewer digits, it is expanded with
16779 leading zeros. The default precision is 1. The result of converting a zero
16780 value with a precision of zero is no wide characters.</pre>
16781 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
16783 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
16784 letters abcdef are used for x conversion and the letters ABCDEF for X
16785 conversion. The precision specifies the minimum number of digits to appear;
16786 if the value being converted can be represented in fewer digits, it is expanded
16787 with leading zeros. The default precision is 1. The result of converting a
16788 zero value with a precision of zero is no wide characters.</pre>
16789 f,F A double argument representing a floating-point number is converted to
16790 <!--page 365 indent 0-->
16792 decimal notation in the style [-]ddd.ddd, where the number of digits after
16793 the decimal-point wide character is equal to the precision specification. If the
16794 precision is missing, it is taken as 6; if the precision is zero and the # flag is
16795 not specified, no decimal-point wide character appears. If a decimal-point
16796 wide character appears, at least one digit appears before it. The value is
16797 rounded to the appropriate number of digits.
16798 A double argument representing an infinity is converted in one of the styles
16799 [-]inf or [-]infinity -- which style is implementation-defined. A
16800 double argument representing a NaN is converted in one of the styles
16801 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
16802 any n-wchar-sequence, is implementation-defined. The F conversion
16803 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
16804 nan, respectively.<sup><a href="#note283"><b>283)</b></a></sup></pre>
16805 e,E A double argument representing a floating-point number is converted in the
16807 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
16808 argument is nonzero) before the decimal-point wide character and the number
16809 of digits after it is equal to the precision; if the precision is missing, it is taken
16810 as 6; if the precision is zero and the # flag is not specified, no decimal-point
16811 wide character appears. The value is rounded to the appropriate number of
16812 digits. The E conversion specifier produces a number with E instead of e
16813 introducing the exponent. The exponent always contains at least two digits,
16814 and only as many more digits as necessary to represent the exponent. If the
16815 value is zero, the exponent is zero.
16816 A double argument representing an infinity or NaN is converted in the style
16817 of an f or F conversion specifier.</pre>
16818 g,G A double argument representing a floating-point number is converted in
16820 style f or e (or in style F or E in the case of a G conversion specifier),
16821 depending on the value converted and the precision. Let P equal the
16822 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
16823 Then, if a conversion with style E would have an exponent of X :
16824 -- if P > X >= -4, the conversion is with style f (or F) and precision
16826 -- otherwise, the conversion is with style e (or E) and precision P - 1.
16827 Finally, unless the # flag is used, any trailing zeros are removed from the
16828 fractional portion of the result and the decimal-point wide character is
16829 removed if there is no fractional portion remaining.
16830 A double argument representing an infinity or NaN is converted in the style
16831 of an f or F conversion specifier.</pre>
16832 a,A A double argument representing a floating-point number is converted in the
16834 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
16835 nonzero if the argument is a normalized floating-point number and is
16836 otherwise unspecified) before the decimal-point wide character<sup><a href="#note284"><b>284)</b></a></sup> and the
16837 number of hexadecimal digits after it is equal to the precision; if the precision
16838 is missing and FLT_RADIX is a power of 2, then the precision is sufficient</pre>
16841 <!--page 366 indent 0-->
16843 for an exact representation of the value; if the precision is missing and
16844 FLT_RADIX is not a power of 2, then the precision is sufficient to
16845 distinguish<sup><a href="#note285"><b>285)</b></a></sup> values of type double, except that trailing zeros may be
16846 omitted; if the precision is zero and the # flag is not specified, no decimal-
16847 point wide character appears. The letters abcdef are used for a conversion
16848 and the letters ABCDEF for A conversion. The A conversion specifier
16849 produces a number with X and P instead of x and p. The exponent always
16850 contains at least one digit, and only as many more digits as necessary to
16851 represent the decimal exponent of 2. If the value is zero, the exponent is
16853 A double argument representing an infinity or NaN is converted in the style
16854 of an f or F conversion specifier.</pre>
16855 c If no l length modifier is present, the int argument is converted to a wide
16857 character as if by calling btowc and the resulting wide character is written.
16858 If an l length modifier is present, the wint_t argument is converted to
16859 wchar_t and written.</pre>
16860 s If no l length modifier is present, the argument shall be a pointer to the initial
16862 element of a character array containing a multibyte character sequence
16863 beginning in the initial shift state. Characters from the array are converted as
16864 if by repeated calls to the mbrtowc function, with the conversion state
16865 described by an mbstate_t object initialized to zero before the first
16866 multibyte character is converted, and written up to (but not including) the
16867 terminating null wide character. If the precision is specified, no more than
16868 that many wide characters are written. If the precision is not specified or is
16869 greater than the size of the converted array, the converted array shall contain a
16870 null wide character.
16871 If an l length modifier is present, the argument shall be a pointer to the initial
16872 element of an array of wchar_t type. Wide characters from the array are
16873 written up to (but not including) a terminating null wide character. If the
16874 precision is specified, no more than that many wide characters are written. If
16875 the precision is not specified or is greater than the size of the array, the array
16876 shall contain a null wide character.</pre>
16877 p The argument shall be a pointer to void. The value of the pointer is
16879 converted to a sequence of printing wide characters, in an implementation-</pre>
16881 <!--page 367 indent 5-->
16883 defined manner.</pre>
16884 n The argument shall be a pointer to signed integer into which is written the
16886 number of wide characters written to the output stream so far by this call to
16887 fwprintf. No argument is converted, but one is consumed. If the
16888 conversion specification includes any flags, a field width, or a precision, the
16889 behavior is undefined.</pre>
16890 % A % wide character is written. No argument is converted. The complete
16893 conversion specification shall be %%.</pre>
16894 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note286"><b>286)</b></a></sup> If any argument is
16895 not the correct type for the corresponding conversion specification, the behavior is
16898 In no case does a nonexistent or small field width cause truncation of a field; if the result
16899 of a conversion is wider than the field width, the field is expanded to contain the
16902 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
16903 to a hexadecimal floating number with the given precision.
16904 Recommended practice
16906 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
16907 representable in the given precision, the result should be one of the two adjacent numbers
16908 in hexadecimal floating style with the given precision, with the extra stipulation that the
16909 error should have a correct sign for the current rounding direction.
16911 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
16912 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note287"><b>287)</b></a></sup> If the number of
16913 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
16914 representable with DECIMAL_DIG digits, then the result should be an exact
16915 representation with trailing zeros. Otherwise, the source value is bounded by two
16916 adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value
16917 of the resultant decimal string D should satisfy L <= D <= U, with the extra stipulation that
16918 the error should have a correct sign for the current rounding direction.
16921 The fwprintf function returns the number of wide characters transmitted, or a negative
16922 value if an output or encoding error occurred.
16924 <!--page 368 indent 5-->
16925 Environmental limits
16927 The number of wide characters that can be produced by any single conversion shall be at
16930 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
16933 #include <math.h>
16934 #include <stdio.h>
16935 #include <wchar.h>
16937 wchar_t *weekday, *month; // pointers to wide strings
16938 int day, hour, min;
16939 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
16940 weekday, month, day, hour, min);
16941 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));</pre>
16943 Forward references: the btowc function (<a href="#7.24.6.1.1">7.24.6.1.1</a>), the mbrtowc function
16944 (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
16947 <p><a name="note281">281)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
16949 <p><a name="note282">282)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
16950 include a minus sign.
16952 <p><a name="note283">283)</a> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
16953 meaning; the # and 0 flag wide characters have no effect.
16955 <p><a name="note284">284)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
16956 character so that subsequent digits align to nibble (4-bit) boundaries.
16958 <p><a name="note285">285)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is
16959 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
16960 might suffice depending on the implementation's scheme for determining the digit to the left of the
16961 decimal-point wide character.
16963 <p><a name="note286">286)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
16965 <p><a name="note287">287)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
16966 given format specifier. The number of significant digits is determined by the format specifier, and in
16967 the case of fixed-point conversion by the source value as well.
16970 <a name="7.24.2.2" href="#7.24.2.2"><h5>7.24.2.2 The fwscanf function</h5></a>
16974 #include <stdio.h>
16975 #include <wchar.h>
16976 int fwscanf(FILE * restrict stream,
16977 const wchar_t * restrict format, ...);</pre>
16978 <h6>Description</h6>
16980 The fwscanf function reads input from the stream pointed to by stream, under
16981 control of the wide string pointed to by format that specifies the admissible input
16982 sequences and how they are to be converted for assignment, using subsequent arguments
16983 as pointers to the objects to receive the converted input. If there are insufficient
16984 arguments for the format, the behavior is undefined. If the format is exhausted while
16985 arguments remain, the excess arguments are evaluated (as always) but are otherwise
16988 The format is composed of zero or more directives: one or more white-space wide
16989 characters, an ordinary wide character (neither % nor a white-space wide character), or a
16990 conversion specification. Each conversion specification is introduced by the wide
16991 character %. After the %, the following appear in sequence:
16993 <li> An optional assignment-suppressing wide character *.
16994 <li> An optional decimal integer greater than zero that specifies the maximum field width
16995 (in wide characters).
16996 <!--page 369 indent 5-->
16997 <li> An optional length modifier that specifies the size of the receiving object.
16998 <li> A conversion specifier wide character that specifies the type of conversion to be
17002 The fwscanf function executes each directive of the format in turn. If a directive fails,
17003 as detailed below, the function returns. Failures are described as input failures (due to the
17004 occurrence of an encoding error or the unavailability of input characters), or matching
17005 failures (due to inappropriate input).
17007 A directive composed of white-space wide character(s) is executed by reading input up to
17008 the first non-white-space wide character (which remains unread), or until no more wide
17009 characters can be read.
17011 A directive that is an ordinary wide character is executed by reading the next wide
17012 character of the stream. If that wide character differs from the directive, the directive
17013 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
17014 of-file, an encoding error, or a read error prevents a wide character from being read, the
17017 A directive that is a conversion specification defines a set of matching input sequences, as
17018 described below for each specifier. A conversion specification is executed in the
17021 Input white-space wide characters (as specified by the iswspace function) are skipped,
17022 unless the specification includes a [, c, or n specifier.<sup><a href="#note288"><b>288)</b></a></sup>
17024 An input item is read from the stream, unless the specification includes an n specifier. An
17025 input item is defined as the longest sequence of input wide characters which does not
17026 exceed any specified field width and which is, or is a prefix of, a matching input
17027 sequence.<sup><a href="#note289"><b>289)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
17028 length of the input item is zero, the execution of the directive fails; this condition is a
17029 matching failure unless end-of-file, an encoding error, or a read error prevented input
17030 from the stream, in which case it is an input failure.
17032 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
17033 count of input wide characters) is converted to a type appropriate to the conversion
17034 specifier. If the input item is not a matching sequence, the execution of the directive fails:
17035 this condition is a matching failure. Unless assignment suppression was indicated by a *,
17036 the result of the conversion is placed in the object pointed to by the first argument
17037 following the format argument that has not already received a conversion result. If this
17040 <!--page 370 indent 5-->
17041 object does not have an appropriate type, or if the result of the conversion cannot be
17042 represented in the object, the behavior is undefined.
17044 The length modifiers and their meanings are:
17045 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17047 to an argument with type pointer to signed char or unsigned char.</pre>
17048 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17050 to an argument with type pointer to short int or unsigned short
17052 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17054 to an argument with type pointer to long int or unsigned long
17055 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
17056 an argument with type pointer to double; or that a following c, s, or [
17057 conversion specifier applies to an argument with type pointer to wchar_t.</pre>
17058 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17060 to an argument with type pointer to long long int or unsigned
17061 long long int.</pre>
17062 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17064 to an argument with type pointer to intmax_t or uintmax_t.</pre>
17065 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17067 to an argument with type pointer to size_t or the corresponding signed
17068 integer type.</pre>
17069 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17071 to an argument with type pointer to ptrdiff_t or the corresponding
17072 unsigned integer type.</pre>
17073 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
17075 applies to an argument with type pointer to long double.</pre>
17076 If a length modifier appears with any conversion specifier other than as specified above,
17077 the behavior is undefined.
17079 The conversion specifiers and their meanings are:
17080 d Matches an optionally signed decimal integer, whose format is the same as
17082 expected for the subject sequence of the wcstol function with the value 10
17083 for the base argument. The corresponding argument shall be a pointer to
17084 signed integer.</pre>
17085 i Matches an optionally signed integer, whose format is the same as expected
17086 <!--page 371 indent 0-->
17088 for the subject sequence of the wcstol function with the value 0 for the
17089 base argument. The corresponding argument shall be a pointer to signed
17091 o Matches an optionally signed octal integer, whose format is the same as
17093 expected for the subject sequence of the wcstoul function with the value 8
17094 for the base argument. The corresponding argument shall be a pointer to
17095 unsigned integer.</pre>
17096 u Matches an optionally signed decimal integer, whose format is the same as
17098 expected for the subject sequence of the wcstoul function with the value 10
17099 for the base argument. The corresponding argument shall be a pointer to
17100 unsigned integer.</pre>
17101 x Matches an optionally signed hexadecimal integer, whose format is the same
17103 as expected for the subject sequence of the wcstoul function with the value
17104 16 for the base argument. The corresponding argument shall be a pointer to
17105 unsigned integer.</pre>
17106 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
17108 format is the same as expected for the subject sequence of the wcstod
17109 function. The corresponding argument shall be a pointer to floating.</pre>
17110 c Matches a sequence of wide characters of exactly the number specified by the
17112 field width (1 if no field width is present in the directive).
17113 If no l length modifier is present, characters from the input field are
17114 converted as if by repeated calls to the wcrtomb function, with the
17115 conversion state described by an mbstate_t object initialized to zero
17116 before the first wide character is converted. The corresponding argument
17117 shall be a pointer to the initial element of a character array large enough to
17118 accept the sequence. No null character is added.
17119 If an l length modifier is present, the corresponding argument shall be a
17120 pointer to the initial element of an array of wchar_t large enough to accept
17121 the sequence. No null wide character is added.</pre>
17122 s Matches a sequence of non-white-space wide characters.
17123 <!--page 372 indent 0-->
17125 If no l length modifier is present, characters from the input field are
17126 converted as if by repeated calls to the wcrtomb function, with the
17127 conversion state described by an mbstate_t object initialized to zero
17128 before the first wide character is converted. The corresponding argument
17129 shall be a pointer to the initial element of a character array large enough to
17130 accept the sequence and a terminating null character, which will be added
17132 If an l length modifier is present, the corresponding argument shall be a
17133 pointer to the initial element of an array of wchar_t large enough to accept
17134 the sequence and the terminating null wide character, which will be added
17135 automatically.</pre>
17136 [ Matches a nonempty sequence of wide characters from a set of expected
17138 characters (the scanset).
17139 If no l length modifier is present, characters from the input field are
17140 converted as if by repeated calls to the wcrtomb function, with the
17141 conversion state described by an mbstate_t object initialized to zero
17142 before the first wide character is converted. The corresponding argument
17143 shall be a pointer to the initial element of a character array large enough to
17144 accept the sequence and a terminating null character, which will be added
17146 If an l length modifier is present, the corresponding argument shall be a
17147 pointer to the initial element of an array of wchar_t large enough to accept
17148 the sequence and the terminating null wide character, which will be added
17150 The conversion specifier includes all subsequent wide characters in the
17151 format string, up to and including the matching right bracket (]). The wide
17152 characters between the brackets (the scanlist) compose the scanset, unless the
17153 wide character after the left bracket is a circumflex (^), in which case the
17154 scanset contains all wide characters that do not appear in the scanlist between
17155 the circumflex and the right bracket. If the conversion specifier begins with
17156 [] or [^], the right bracket wide character is in the scanlist and the next
17157 following right bracket wide character is the matching right bracket that ends
17158 the specification; otherwise the first following right bracket wide character is
17159 the one that ends the specification. If a - wide character is in the scanlist and
17160 is not the first, nor the second where the first wide character is a ^, nor the
17161 last character, the behavior is implementation-defined.</pre>
17162 p Matches an implementation-defined set of sequences, which should be the
17164 same as the set of sequences that may be produced by the %p conversion of
17165 the fwprintf function. The corresponding argument shall be a pointer to a
17166 pointer to void. The input item is converted to a pointer value in an
17167 implementation-defined manner. If the input item is a value converted earlier
17168 during the same program execution, the pointer that results shall compare
17169 equal to that value; otherwise the behavior of the %p conversion is undefined.</pre>
17170 n No input is consumed. The corresponding argument shall be a pointer to
17171 <!--page 373 indent 5-->
17173 signed integer into which is to be written the number of wide characters read
17174 from the input stream so far by this call to the fwscanf function. Execution
17175 of a %n directive does not increment the assignment count returned at the
17176 completion of execution of the fwscanf function. No argument is
17177 converted, but one is consumed. If the conversion specification includes an
17178 assignment-suppressing wide character or a field width, the behavior is
17180 % Matches a single % wide character; no conversion or assignment occurs. The
17183 complete conversion specification shall be %%.</pre>
17184 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note290"><b>290)</b></a></sup>
17186 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
17187 respectively, a, e, f, g, and x.
17189 Trailing white space (including new-line wide characters) is left unread unless matched
17190 by a directive. The success of literal matches and suppressed assignments is not directly
17191 determinable other than via the %n directive.
17194 The fwscanf function returns the value of the macro EOF if an input failure occurs
17195 before any conversion. Otherwise, the function returns the number of input items
17196 assigned, which can be fewer than provided for, or even zero, in the event of an early
17199 EXAMPLE 1 The call:
17201 #include <stdio.h>
17202 #include <wchar.h>
17204 int n, i; float x; wchar_t name[50];
17205 n = fwscanf(stdin, L"%d%f%ls", &i, &x, name);</pre>
17206 with the input line:
17208 25 54.32E-1 thompson</pre>
17209 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
17213 EXAMPLE 2 The call:
17215 #include <stdio.h>
17216 #include <wchar.h>
17218 int i; float x; double y;
17219 fwscanf(stdin, L"%2d%f%*d %lf", &i, &x, &y);</pre>
17222 56789 0123 56a72</pre>
17223 will assign to i the value 56 and to x the value 789.0, will skip past 0123, and will assign to y the value
17224 56.0. The next wide character read from the input stream will be a.
17227 <!--page 374 indent 4-->
17228 Forward references: the wcstod, wcstof, and wcstold functions (<a href="#7.24.4.1.1">7.24.4.1.1</a>), the
17229 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.24.4.1.2">7.24.4.1.2</a>), the wcrtomb
17230 function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
17233 <p><a name="note288">288)</a> These white-space wide characters are not counted against a specified field width.
17235 <p><a name="note289">289)</a> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
17236 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
17238 <p><a name="note290">290)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
17241 <a name="7.24.2.3" href="#7.24.2.3"><h5>7.24.2.3 The swprintf function</h5></a>
17245 #include <wchar.h>
17246 int swprintf(wchar_t * restrict s,
17248 const wchar_t * restrict format, ...);</pre>
17249 <h6>Description</h6>
17251 The swprintf function is equivalent to fwprintf, except that the argument s
17252 specifies an array of wide characters into which the generated output is to be written,
17253 rather than written to a stream. No more than n wide characters are written, including a
17254 terminating null wide character, which is always added (unless n is zero).
17257 The swprintf function returns the number of wide characters written in the array, not
17258 counting the terminating null wide character, or a negative value if an encoding error
17259 occurred or if n or more wide characters were requested to be written.
17261 <a name="7.24.2.4" href="#7.24.2.4"><h5>7.24.2.4 The swscanf function</h5></a>
17265 #include <wchar.h>
17266 int swscanf(const wchar_t * restrict s,
17267 const wchar_t * restrict format, ...);</pre>
17268 <h6>Description</h6>
17270 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
17271 wide string from which the input is to be obtained, rather than from a stream. Reaching
17272 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
17276 The swscanf function returns the value of the macro EOF if an input failure occurs
17277 before any conversion. Otherwise, the swscanf function returns the number of input
17278 items assigned, which can be fewer than provided for, or even zero, in the event of an
17279 early matching failure.
17280 <!--page 375 indent 4-->
17282 <a name="7.24.2.5" href="#7.24.2.5"><h5>7.24.2.5 The vfwprintf function</h5></a>
17286 #include <stdarg.h>
17287 #include <stdio.h>
17288 #include <wchar.h>
17289 int vfwprintf(FILE * restrict stream,
17290 const wchar_t * restrict format,
17291 va_list arg);</pre>
17292 <h6>Description</h6>
17294 The vfwprintf function is equivalent to fwprintf, with the variable argument list
17295 replaced by arg, which shall have been initialized by the va_start macro (and
17296 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
17297 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
17300 The vfwprintf function returns the number of wide characters transmitted, or a
17301 negative value if an output or encoding error occurred.
17303 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
17306 #include <stdarg.h>
17307 #include <stdio.h>
17308 #include <wchar.h>
17309 void error(char *function_name, wchar_t *format, ...)
17312 va_start(args, format);
17313 // print out name of function causing error
17314 fwprintf(stderr, L"ERROR in %s: ", function_name);
17315 // print out remainder of message
17316 vfwprintf(stderr, format, args);
17323 <!--page 376 indent 4-->
17326 <p><a name="note291">291)</a> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
17327 invoke the va_arg macro, the value of arg after the return is indeterminate.
17330 <a name="7.24.2.6" href="#7.24.2.6"><h5>7.24.2.6 The vfwscanf function</h5></a>
17334 #include <stdarg.h>
17335 #include <stdio.h>
17336 #include <wchar.h>
17337 int vfwscanf(FILE * restrict stream,
17338 const wchar_t * restrict format,
17339 va_list arg);</pre>
17340 <h6>Description</h6>
17342 The vfwscanf function is equivalent to fwscanf, with the variable argument list
17343 replaced by arg, which shall have been initialized by the va_start macro (and
17344 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
17348 The vfwscanf function returns the value of the macro EOF if an input failure occurs
17349 before any conversion. Otherwise, the vfwscanf function returns the number of input
17350 items assigned, which can be fewer than provided for, or even zero, in the event of an
17351 early matching failure.
17353 <a name="7.24.2.7" href="#7.24.2.7"><h5>7.24.2.7 The vswprintf function</h5></a>
17357 #include <stdarg.h>
17358 #include <wchar.h>
17359 int vswprintf(wchar_t * restrict s,
17361 const wchar_t * restrict format,
17362 va_list arg);</pre>
17363 <h6>Description</h6>
17365 The vswprintf function is equivalent to swprintf, with the variable argument list
17366 replaced by arg, which shall have been initialized by the va_start macro (and
17367 possibly subsequent va_arg calls). The vswprintf function does not invoke the
17371 The vswprintf function returns the number of wide characters written in the array, not
17372 counting the terminating null wide character, or a negative value if an encoding error
17373 occurred or if n or more wide characters were requested to be generated.
17374 <!--page 377 indent 4-->
17376 <a name="7.24.2.8" href="#7.24.2.8"><h5>7.24.2.8 The vswscanf function</h5></a>
17380 #include <stdarg.h>
17381 #include <wchar.h>
17382 int vswscanf(const wchar_t * restrict s,
17383 const wchar_t * restrict format,
17384 va_list arg);</pre>
17385 <h6>Description</h6>
17387 The vswscanf function is equivalent to swscanf, with the variable argument list
17388 replaced by arg, which shall have been initialized by the va_start macro (and
17389 possibly subsequent va_arg calls). The vswscanf function does not invoke the
17393 The vswscanf function returns the value of the macro EOF if an input failure occurs
17394 before any conversion. Otherwise, the vswscanf function returns the number of input
17395 items assigned, which can be fewer than provided for, or even zero, in the event of an
17396 early matching failure.
17398 <a name="7.24.2.9" href="#7.24.2.9"><h5>7.24.2.9 The vwprintf function</h5></a>
17402 #include <stdarg.h>
17403 #include <wchar.h>
17404 int vwprintf(const wchar_t * restrict format,
17405 va_list arg);</pre>
17406 <h6>Description</h6>
17408 The vwprintf function is equivalent to wprintf, with the variable argument list
17409 replaced by arg, which shall have been initialized by the va_start macro (and
17410 possibly subsequent va_arg calls). The vwprintf function does not invoke the
17414 The vwprintf function returns the number of wide characters transmitted, or a negative
17415 value if an output or encoding error occurred.
17416 <!--page 378 indent 4-->
17418 <a name="7.24.2.10" href="#7.24.2.10"><h5>7.24.2.10 The vwscanf function</h5></a>
17422 #include <stdarg.h>
17423 #include <wchar.h>
17424 int vwscanf(const wchar_t * restrict format,
17425 va_list arg);</pre>
17426 <h6>Description</h6>
17428 The vwscanf function is equivalent to wscanf, with the variable argument list
17429 replaced by arg, which shall have been initialized by the va_start macro (and
17430 possibly subsequent va_arg calls). The vwscanf function does not invoke the
17434 The vwscanf function returns the value of the macro EOF if an input failure occurs
17435 before any conversion. Otherwise, the vwscanf function returns the number of input
17436 items assigned, which can be fewer than provided for, or even zero, in the event of an
17437 early matching failure.
17439 <a name="7.24.2.11" href="#7.24.2.11"><h5>7.24.2.11 The wprintf function</h5></a>
17443 #include <wchar.h>
17444 int wprintf(const wchar_t * restrict format, ...);</pre>
17445 <h6>Description</h6>
17447 The wprintf function is equivalent to fwprintf with the argument stdout
17448 interposed before the arguments to wprintf.
17451 The wprintf function returns the number of wide characters transmitted, or a negative
17452 value if an output or encoding error occurred.
17454 <a name="7.24.2.12" href="#7.24.2.12"><h5>7.24.2.12 The wscanf function</h5></a>
17458 #include <wchar.h>
17459 int wscanf(const wchar_t * restrict format, ...);</pre>
17460 <h6>Description</h6>
17462 The wscanf function is equivalent to fwscanf with the argument stdin interposed
17463 before the arguments to wscanf.
17464 <!--page 379 indent 4-->
17467 The wscanf function returns the value of the macro EOF if an input failure occurs
17468 before any conversion. Otherwise, the wscanf function returns the number of input
17469 items assigned, which can be fewer than provided for, or even zero, in the event of an
17470 early matching failure.
17472 <a name="7.24.3" href="#7.24.3"><h4>7.24.3 Wide character input/output functions</h4></a>
17474 <a name="7.24.3.1" href="#7.24.3.1"><h5>7.24.3.1 The fgetwc function</h5></a>
17478 #include <stdio.h>
17479 #include <wchar.h>
17480 wint_t fgetwc(FILE *stream);</pre>
17481 <h6>Description</h6>
17483 If the end-of-file indicator for the input stream pointed to by stream is not set and a
17484 next wide character is present, the fgetwc function obtains that wide character as a
17485 wchar_t converted to a wint_t and advances the associated file position indicator for
17486 the stream (if defined).
17489 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
17490 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
17491 the fgetwc function returns the next wide character from the input stream pointed to by
17492 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
17493 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
17494 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note292"><b>292)</b></a></sup>
17497 <p><a name="note292">292)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
17498 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
17501 <a name="7.24.3.2" href="#7.24.3.2"><h5>7.24.3.2 The fgetws function</h5></a>
17505 #include <stdio.h>
17506 #include <wchar.h>
17507 wchar_t *fgetws(wchar_t * restrict s,
17508 int n, FILE * restrict stream);</pre>
17509 <h6>Description</h6>
17511 The fgetws function reads at most one less than the number of wide characters
17512 specified by n from the stream pointed to by stream into the array pointed to by s. No
17515 <!--page 380 indent 4-->
17516 additional wide characters are read after a new-line wide character (which is retained) or
17517 after end-of-file. A null wide character is written immediately after the last wide
17518 character read into the array.
17521 The fgetws function returns s if successful. If end-of-file is encountered and no
17522 characters have been read into the array, the contents of the array remain unchanged and a
17523 null pointer is returned. If a read or encoding error occurs during the operation, the array
17524 contents are indeterminate and a null pointer is returned.
17526 <a name="7.24.3.3" href="#7.24.3.3"><h5>7.24.3.3 The fputwc function</h5></a>
17530 #include <stdio.h>
17531 #include <wchar.h>
17532 wint_t fputwc(wchar_t c, FILE *stream);</pre>
17533 <h6>Description</h6>
17535 The fputwc function writes the wide character specified by c to the output stream
17536 pointed to by stream, at the position indicated by the associated file position indicator
17537 for the stream (if defined), and advances the indicator appropriately. If the file cannot
17538 support positioning requests, or if the stream was opened with append mode, the
17539 character is appended to the output stream.
17542 The fputwc function returns the wide character written. If a write error occurs, the
17543 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
17544 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
17546 <a name="7.24.3.4" href="#7.24.3.4"><h5>7.24.3.4 The fputws function</h5></a>
17550 #include <stdio.h>
17551 #include <wchar.h>
17552 int fputws(const wchar_t * restrict s,
17553 FILE * restrict stream);</pre>
17554 <h6>Description</h6>
17556 The fputws function writes the wide string pointed to by s to the stream pointed to by
17557 stream. The terminating null wide character is not written.
17560 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
17561 returns a nonnegative value.
17562 <!--page 381 indent 4-->
17564 <a name="7.24.3.5" href="#7.24.3.5"><h5>7.24.3.5 The fwide function</h5></a>
17568 #include <stdio.h>
17569 #include <wchar.h>
17570 int fwide(FILE *stream, int mode);</pre>
17571 <h6>Description</h6>
17573 The fwide function determines the orientation of the stream pointed to by stream. If
17574 mode is greater than zero, the function first attempts to make the stream wide oriented. If
17575 mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note293"><b>293)</b></a></sup>
17576 Otherwise, mode is zero and the function does not alter the orientation of the stream.
17579 The fwide function returns a value greater than zero if, after the call, the stream has
17580 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
17581 stream has no orientation.
17584 <p><a name="note293">293)</a> If the orientation of the stream has already been determined, fwide does not change it.
17587 <a name="7.24.3.6" href="#7.24.3.6"><h5>7.24.3.6 The getwc function</h5></a>
17591 #include <stdio.h>
17592 #include <wchar.h>
17593 wint_t getwc(FILE *stream);</pre>
17594 <h6>Description</h6>
17596 The getwc function is equivalent to fgetwc, except that if it is implemented as a
17597 macro, it may evaluate stream more than once, so the argument should never be an
17598 expression with side effects.
17601 The getwc function returns the next wide character from the input stream pointed to by
17604 <a name="7.24.3.7" href="#7.24.3.7"><h5>7.24.3.7 The getwchar function</h5></a>
17608 #include <wchar.h>
17609 wint_t getwchar(void);</pre>
17614 <!--page 382 indent 4-->
17615 <h6>Description</h6>
17617 The getwchar function is equivalent to getwc with the argument stdin.
17620 The getwchar function returns the next wide character from the input stream pointed to
17623 <a name="7.24.3.8" href="#7.24.3.8"><h5>7.24.3.8 The putwc function</h5></a>
17627 #include <stdio.h>
17628 #include <wchar.h>
17629 wint_t putwc(wchar_t c, FILE *stream);</pre>
17630 <h6>Description</h6>
17632 The putwc function is equivalent to fputwc, except that if it is implemented as a
17633 macro, it may evaluate stream more than once, so that argument should never be an
17634 expression with side effects.
17637 The putwc function returns the wide character written, or WEOF.
17639 <a name="7.24.3.9" href="#7.24.3.9"><h5>7.24.3.9 The putwchar function</h5></a>
17643 #include <wchar.h>
17644 wint_t putwchar(wchar_t c);</pre>
17645 <h6>Description</h6>
17647 The putwchar function is equivalent to putwc with the second argument stdout.
17650 The putwchar function returns the character written, or WEOF.
17652 <a name="7.24.3.10" href="#7.24.3.10"><h5>7.24.3.10 The ungetwc function</h5></a>
17656 #include <stdio.h>
17657 #include <wchar.h>
17658 wint_t ungetwc(wint_t c, FILE *stream);</pre>
17659 <h6>Description</h6>
17661 The ungetwc function pushes the wide character specified by c back onto the input
17662 stream pointed to by stream. Pushed-back wide characters will be returned by
17663 subsequent reads on that stream in the reverse order of their pushing. A successful
17664 <!--page 383 indent 4-->
17665 intervening call (with the stream pointed to by stream) to a file positioning function
17666 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
17667 stream. The external storage corresponding to the stream is unchanged.
17669 One wide character of pushback is guaranteed, even if the call to the ungetwc function
17670 follows just after a call to a formatted wide character input function fwscanf,
17671 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
17672 on the same stream without an intervening read or file positioning operation on that
17673 stream, the operation may fail.
17675 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
17678 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
17679 The value of the file position indicator for the stream after reading or discarding all
17680 pushed-back wide characters is the same as it was before the wide characters were pushed
17681 back. For a text or binary stream, the value of its file position indicator after a successful
17682 call to the ungetwc function is unspecified until all pushed-back wide characters are
17686 The ungetwc function returns the wide character pushed back, or WEOF if the operation
17689 <a name="7.24.4" href="#7.24.4"><h4>7.24.4 General wide string utilities</h4></a>
17691 The header <wchar.h> declares a number of functions useful for wide string
17692 manipulation. Various methods are used for determining the lengths of the arrays, but in
17693 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
17694 array. If an array is accessed beyond the end of an object, the behavior is undefined.
17696 Where an argument declared as size_t n determines the length of the array for a
17697 function, n can have the value zero on a call to that function. Unless explicitly stated
17698 otherwise in the description of a particular function in this subclause, pointer arguments
17699 on such a call shall still have valid values, as described in <a href="#7.1.4">7.1.4</a>. On such a call, a
17700 function that locates a wide character finds no occurrence, a function that compares two
17701 wide character sequences returns zero, and a function that copies wide characters copies
17702 zero wide characters.
17703 <!--page 384 indent 4-->
17705 <a name="7.24.4.1" href="#7.24.4.1"><h5>7.24.4.1 Wide string numeric conversion functions</h5></a>
17707 <a name="7.24.4.1.1" href="#7.24.4.1.1"><h5>7.24.4.1.1 The wcstod, wcstof, and wcstold functions</h5></a>
17711 #include <wchar.h>
17712 double wcstod(const wchar_t * restrict nptr,
17713 wchar_t ** restrict endptr);
17714 float wcstof(const wchar_t * restrict nptr,
17715 wchar_t ** restrict endptr);
17716 long double wcstold(const wchar_t * restrict nptr,
17717 wchar_t ** restrict endptr);</pre>
17718 <h6>Description</h6>
17720 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
17721 string pointed to by nptr to double, float, and long double representation,
17722 respectively. First, they decompose the input string into three parts: an initial, possibly
17723 empty, sequence of white-space wide characters (as specified by the iswspace
17724 function), a subject sequence resembling a floating-point constant or representing an
17725 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
17726 including the terminating null wide character of the input wide string. Then, they attempt
17727 to convert the subject sequence to a floating-point number, and return the result.
17729 The expected form of the subject sequence is an optional plus or minus sign, then one of
17732 <li> a nonempty sequence of decimal digits optionally containing a decimal-point wide
17733 character, then an optional exponent part as defined for the corresponding single-byte
17734 characters in <a href="#6.4.4.2">6.4.4.2</a>;
17735 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
17736 decimal-point wide character, then an optional binary exponent part as defined in
17737 <a href="#6.4.4.2">6.4.4.2</a>;
17738 <li> INF or INFINITY, or any other wide string equivalent except for case
17739 <li> NAN or NAN(n-wchar-sequenceopt), or any other wide string equivalent except for
17740 case in the NAN part, where:
17745 n-wchar-sequence digit
17746 n-wchar-sequence nondigit</pre>
17748 The subject sequence is defined as the longest initial subsequence of the input wide
17749 string, starting with the first non-white-space wide character, that is of the expected form.
17750 <!--page 385 indent 4-->
17751 The subject sequence contains no wide characters if the input wide string is not of the
17754 If the subject sequence has the expected form for a floating-point number, the sequence of
17755 wide characters starting with the first digit or the decimal-point wide character
17756 (whichever occurs first) is interpreted as a floating constant according to the rules of
17757 <a href="#6.4.4.2">6.4.4.2</a>, except that the decimal-point wide character is used in place of a period, and that
17758 if neither an exponent part nor a decimal-point wide character appears in a decimal
17759 floating point number, or if a binary exponent part does not appear in a hexadecimal
17760 floating point number, an exponent part of the appropriate type with value zero is
17761 assumed to follow the last digit in the string. If the subject sequence begins with a minus
17762 sign, the sequence is interpreted as negated.<sup><a href="#note294"><b>294)</b></a></sup> A wide character sequence INF or
17763 INFINITY is interpreted as an infinity, if representable in the return type, else like a
17764 floating constant that is too large for the range of the return type. A wide character
17765 sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
17766 in the return type, else like a subject sequence part that does not have the expected form;
17767 the meaning of the n-wchar sequences is implementation-defined.<sup><a href="#note295"><b>295)</b></a></sup> A pointer to the
17768 final wide string is stored in the object pointed to by endptr, provided that endptr is
17769 not a null pointer.
17771 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
17772 value resulting from the conversion is correctly rounded.
17774 In other than the "C" locale, additional locale-specific subject sequence forms may be
17777 If the subject sequence is empty or does not have the expected form, no conversion is
17778 performed; the value of nptr is stored in the object pointed to by endptr, provided
17779 that endptr is not a null pointer.
17780 Recommended practice
17782 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
17783 the result is not exactly representable, the result should be one of the two numbers in the
17784 appropriate internal format that are adjacent to the hexadecimal floating source value,
17785 with the extra stipulation that the error should have a correct sign for the current rounding
17790 <!--page 386 indent 5-->
17792 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
17793 <float.h>) significant digits, the result should be correctly rounded. If the subject
17794 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
17795 consider the two bounding, adjacent decimal strings L and U, both having
17796 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L <= D <= U.
17797 The result should be one of the (equal or adjacent) values that would be obtained by
17798 correctly rounding L and U according to the current rounding direction, with the extra
17799 stipulation that the error with respect to D should have a correct sign for the current
17800 rounding direction.<sup><a href="#note296"><b>296)</b></a></sup>
17803 The functions return the converted value, if any. If no conversion could be performed,
17804 zero is returned. If the correct value is outside the range of representable values, plus or
17805 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
17806 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
17807 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
17808 than the smallest normalized positive number in the return type; whether errno acquires
17809 the value ERANGE is implementation-defined.
17814 <!--page 387 indent 4-->
17817 <p><a name="note294">294)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
17818 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
17819 methods may yield different results if rounding is toward positive or negative infinity. In either case,
17820 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
17822 <p><a name="note295">295)</a> An implementation may use the n-wchar sequence to determine extra information to be represented in
17823 the NaN's significand.
17825 <p><a name="note296">296)</a> DECIMAL_DIG, defined in <float.h>, should be sufficiently large that L and U will usually round
17826 to the same internal floating value, but if not will round to adjacent values.
17829 <a name="7.24.4.1.2" href="#7.24.4.1.2"><h5>7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</h5></a>
17833 #include <wchar.h>
17835 const wchar_t * restrict nptr,
17836 wchar_t ** restrict endptr,
17838 long long int wcstoll(
17839 const wchar_t * restrict nptr,
17840 wchar_t ** restrict endptr,
17842 unsigned long int wcstoul(
17843 const wchar_t * restrict nptr,
17844 wchar_t ** restrict endptr,
17846 unsigned long long int wcstoull(
17847 const wchar_t * restrict nptr,
17848 wchar_t ** restrict endptr,
17850 <h6>Description</h6>
17852 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
17853 portion of the wide string pointed to by nptr to long int, long long int,
17854 unsigned long int, and unsigned long long int representation,
17855 respectively. First, they decompose the input string into three parts: an initial, possibly
17856 empty, sequence of white-space wide characters (as specified by the iswspace
17857 function), a subject sequence resembling an integer represented in some radix determined
17858 by the value of base, and a final wide string of one or more unrecognized wide
17859 characters, including the terminating null wide character of the input wide string. Then,
17860 they attempt to convert the subject sequence to an integer, and return the result.
17862 If the value of base is zero, the expected form of the subject sequence is that of an
17863 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
17864 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
17865 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
17866 is a sequence of letters and digits representing an integer with the radix specified by
17867 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
17868 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
17869 letters and digits whose ascribed values are less than that of base are permitted. If the
17870 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
17871 of letters and digits, following the sign if present.
17872 <!--page 388 indent 4-->
17874 The subject sequence is defined as the longest initial subsequence of the input wide
17875 string, starting with the first non-white-space wide character, that is of the expected form.
17876 The subject sequence contains no wide characters if the input wide string is empty or
17877 consists entirely of white space, or if the first non-white-space wide character is other
17878 than a sign or a permissible letter or digit.
17880 If the subject sequence has the expected form and the value of base is zero, the sequence
17881 of wide characters starting with the first digit is interpreted as an integer constant
17882 according to the rules of <a href="#6.4.4.1">6.4.4.1</a>. If the subject sequence has the expected form and the
17883 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
17884 letter its value as given above. If the subject sequence begins with a minus sign, the value
17885 resulting from the conversion is negated (in the return type). A pointer to the final wide
17886 string is stored in the object pointed to by endptr, provided that endptr is not a null
17889 In other than the "C" locale, additional locale-specific subject sequence forms may be
17892 If the subject sequence is empty or does not have the expected form, no conversion is
17893 performed; the value of nptr is stored in the object pointed to by endptr, provided
17894 that endptr is not a null pointer.
17897 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
17898 value, if any. If no conversion could be performed, zero is returned. If the correct value
17899 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
17900 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
17901 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
17903 <a name="7.24.4.2" href="#7.24.4.2"><h5>7.24.4.2 Wide string copying functions</h5></a>
17905 <a name="7.24.4.2.1" href="#7.24.4.2.1"><h5>7.24.4.2.1 The wcscpy function</h5></a>
17909 #include <wchar.h>
17910 wchar_t *wcscpy(wchar_t * restrict s1,
17911 const wchar_t * restrict s2);</pre>
17912 <h6>Description</h6>
17914 The wcscpy function copies the wide string pointed to by s2 (including the terminating
17915 null wide character) into the array pointed to by s1.
17918 The wcscpy function returns the value of s1.
17919 <!--page 389 indent 4-->
17921 <a name="7.24.4.2.2" href="#7.24.4.2.2"><h5>7.24.4.2.2 The wcsncpy function</h5></a>
17925 #include <wchar.h>
17926 wchar_t *wcsncpy(wchar_t * restrict s1,
17927 const wchar_t * restrict s2,
17929 <h6>Description</h6>
17931 The wcsncpy function copies not more than n wide characters (those that follow a null
17932 wide character are not copied) from the array pointed to by s2 to the array pointed to by
17933 s1.<sup><a href="#note297"><b>297)</b></a></sup>
17935 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
17936 wide characters are appended to the copy in the array pointed to by s1, until n wide
17937 characters in all have been written.
17940 The wcsncpy function returns the value of s1.
17943 <p><a name="note297">297)</a> Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
17944 result will not be null-terminated.
17947 <a name="7.24.4.2.3" href="#7.24.4.2.3"><h5>7.24.4.2.3 The wmemcpy function</h5></a>
17951 #include <wchar.h>
17952 wchar_t *wmemcpy(wchar_t * restrict s1,
17953 const wchar_t * restrict s2,
17955 <h6>Description</h6>
17957 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
17958 object pointed to by s1.
17961 The wmemcpy function returns the value of s1.
17966 <!--page 390 indent 4-->
17968 <a name="7.24.4.2.4" href="#7.24.4.2.4"><h5>7.24.4.2.4 The wmemmove function</h5></a>
17972 #include <wchar.h>
17973 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
17975 <h6>Description</h6>
17977 The wmemmove function copies n wide characters from the object pointed to by s2 to
17978 the object pointed to by s1. Copying takes place as if the n wide characters from the
17979 object pointed to by s2 are first copied into a temporary array of n wide characters that
17980 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
17981 the temporary array are copied into the object pointed to by s1.
17984 The wmemmove function returns the value of s1.
17986 <a name="7.24.4.3" href="#7.24.4.3"><h5>7.24.4.3 Wide string concatenation functions</h5></a>
17988 <a name="7.24.4.3.1" href="#7.24.4.3.1"><h5>7.24.4.3.1 The wcscat function</h5></a>
17992 #include <wchar.h>
17993 wchar_t *wcscat(wchar_t * restrict s1,
17994 const wchar_t * restrict s2);</pre>
17995 <h6>Description</h6>
17997 The wcscat function appends a copy of the wide string pointed to by s2 (including the
17998 terminating null wide character) to the end of the wide string pointed to by s1. The initial
17999 wide character of s2 overwrites the null wide character at the end of s1.
18002 The wcscat function returns the value of s1.
18004 <a name="7.24.4.3.2" href="#7.24.4.3.2"><h5>7.24.4.3.2 The wcsncat function</h5></a>
18008 #include <wchar.h>
18009 wchar_t *wcsncat(wchar_t * restrict s1,
18010 const wchar_t * restrict s2,
18012 <h6>Description</h6>
18014 The wcsncat function appends not more than n wide characters (a null wide character
18015 and those that follow it are not appended) from the array pointed to by s2 to the end of
18016 <!--page 391 indent 4-->
18017 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
18018 wide character at the end of s1. A terminating null wide character is always appended to
18019 the result.<sup><a href="#note298"><b>298)</b></a></sup>
18022 The wcsncat function returns the value of s1.
18025 <p><a name="note298">298)</a> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
18029 <a name="7.24.4.4" href="#7.24.4.4"><h5>7.24.4.4 Wide string comparison functions</h5></a>
18031 Unless explicitly stated otherwise, the functions described in this subclause order two
18032 wide characters the same way as two integers of the underlying integer type designated
18035 <a name="7.24.4.4.1" href="#7.24.4.4.1"><h5>7.24.4.4.1 The wcscmp function</h5></a>
18039 #include <wchar.h>
18040 int wcscmp(const wchar_t *s1, const wchar_t *s2);</pre>
18041 <h6>Description</h6>
18043 The wcscmp function compares the wide string pointed to by s1 to the wide string
18047 The wcscmp function returns an integer greater than, equal to, or less than zero,
18048 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
18049 wide string pointed to by s2.
18051 <a name="7.24.4.4.2" href="#7.24.4.4.2"><h5>7.24.4.4.2 The wcscoll function</h5></a>
18055 #include <wchar.h>
18056 int wcscoll(const wchar_t *s1, const wchar_t *s2);</pre>
18057 <h6>Description</h6>
18059 The wcscoll function compares the wide string pointed to by s1 to the wide string
18060 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
18064 The wcscoll function returns an integer greater than, equal to, or less than zero,
18065 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
18068 <!--page 392 indent 4-->
18069 wide string pointed to by s2 when both are interpreted as appropriate to the current
18072 <a name="7.24.4.4.3" href="#7.24.4.4.3"><h5>7.24.4.4.3 The wcsncmp function</h5></a>
18076 #include <wchar.h>
18077 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
18079 <h6>Description</h6>
18081 The wcsncmp function compares not more than n wide characters (those that follow a
18082 null wide character are not compared) from the array pointed to by s1 to the array
18086 The wcsncmp function returns an integer greater than, equal to, or less than zero,
18087 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
18088 to, or less than the possibly null-terminated array pointed to by s2.
18090 <a name="7.24.4.4.4" href="#7.24.4.4.4"><h5>7.24.4.4.4 The wcsxfrm function</h5></a>
18094 #include <wchar.h>
18095 size_t wcsxfrm(wchar_t * restrict s1,
18096 const wchar_t * restrict s2,
18098 <h6>Description</h6>
18100 The wcsxfrm function transforms the wide string pointed to by s2 and places the
18101 resulting wide string into the array pointed to by s1. The transformation is such that if
18102 the wcscmp function is applied to two transformed wide strings, it returns a value greater
18103 than, equal to, or less than zero, corresponding to the result of the wcscoll function
18104 applied to the same two original wide strings. No more than n wide characters are placed
18105 into the resulting array pointed to by s1, including the terminating null wide character. If
18106 n is zero, s1 is permitted to be a null pointer.
18109 The wcsxfrm function returns the length of the transformed wide string (not including
18110 the terminating null wide character). If the value returned is n or greater, the contents of
18111 the array pointed to by s1 are indeterminate.
18113 EXAMPLE The value of the following expression is the length of the array needed to hold the
18114 transformation of the wide string pointed to by s:
18115 <!--page 393 indent 4-->
18117 1 + wcsxfrm(NULL, s, 0)</pre>
18120 <a name="7.24.4.4.5" href="#7.24.4.4.5"><h5>7.24.4.4.5 The wmemcmp function</h5></a>
18124 #include <wchar.h>
18125 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
18127 <h6>Description</h6>
18129 The wmemcmp function compares the first n wide characters of the object pointed to by
18130 s1 to the first n wide characters of the object pointed to by s2.
18133 The wmemcmp function returns an integer greater than, equal to, or less than zero,
18134 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
18137 <a name="7.24.4.5" href="#7.24.4.5"><h5>7.24.4.5 Wide string search functions</h5></a>
18139 <a name="7.24.4.5.1" href="#7.24.4.5.1"><h5>7.24.4.5.1 The wcschr function</h5></a>
18143 #include <wchar.h>
18144 wchar_t *wcschr(const wchar_t *s, wchar_t c);</pre>
18145 <h6>Description</h6>
18147 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
18148 The terminating null wide character is considered to be part of the wide string.
18151 The wcschr function returns a pointer to the located wide character, or a null pointer if
18152 the wide character does not occur in the wide string.
18154 <a name="7.24.4.5.2" href="#7.24.4.5.2"><h5>7.24.4.5.2 The wcscspn function</h5></a>
18158 #include <wchar.h>
18159 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);</pre>
18160 <h6>Description</h6>
18162 The wcscspn function computes the length of the maximum initial segment of the wide
18163 string pointed to by s1 which consists entirely of wide characters not from the wide
18164 string pointed to by s2.
18165 <!--page 394 indent 4-->
18168 The wcscspn function returns the length of the segment.
18170 <a name="7.24.4.5.3" href="#7.24.4.5.3"><h5>7.24.4.5.3 The wcspbrk function</h5></a>
18174 #include <wchar.h>
18175 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);</pre>
18176 <h6>Description</h6>
18178 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
18179 any wide character from the wide string pointed to by s2.
18182 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
18183 no wide character from s2 occurs in s1.
18185 <a name="7.24.4.5.4" href="#7.24.4.5.4"><h5>7.24.4.5.4 The wcsrchr function</h5></a>
18189 #include <wchar.h>
18190 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);</pre>
18191 <h6>Description</h6>
18193 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
18194 s. The terminating null wide character is considered to be part of the wide string.
18197 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
18198 not occur in the wide string.
18200 <a name="7.24.4.5.5" href="#7.24.4.5.5"><h5>7.24.4.5.5 The wcsspn function</h5></a>
18204 #include <wchar.h>
18205 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);</pre>
18206 <h6>Description</h6>
18208 The wcsspn function computes the length of the maximum initial segment of the wide
18209 string pointed to by s1 which consists entirely of wide characters from the wide string
18213 The wcsspn function returns the length of the segment.
18214 <!--page 395 indent 4-->
18216 <a name="7.24.4.5.6" href="#7.24.4.5.6"><h5>7.24.4.5.6 The wcsstr function</h5></a>
18220 #include <wchar.h>
18221 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);</pre>
18222 <h6>Description</h6>
18224 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
18225 the sequence of wide characters (excluding the terminating null wide character) in the
18226 wide string pointed to by s2.
18229 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
18230 wide string is not found. If s2 points to a wide string with zero length, the function
18233 <a name="7.24.4.5.7" href="#7.24.4.5.7"><h5>7.24.4.5.7 The wcstok function</h5></a>
18237 #include <wchar.h>
18238 wchar_t *wcstok(wchar_t * restrict s1,
18239 const wchar_t * restrict s2,
18240 wchar_t ** restrict ptr);</pre>
18241 <h6>Description</h6>
18243 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
18244 a sequence of tokens, each of which is delimited by a wide character from the wide string
18245 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
18246 which the wcstok function stores information necessary for it to continue scanning the
18249 The first call in a sequence has a non-null first argument and stores an initial value in the
18250 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
18251 the object pointed to by ptr is required to have the value stored by the previous call in
18252 the sequence, which is then updated. The separator wide string pointed to by s2 may be
18253 different from call to call.
18255 The first call in the sequence searches the wide string pointed to by s1 for the first wide
18256 character that is not contained in the current separator wide string pointed to by s2. If no
18257 such wide character is found, then there are no tokens in the wide string pointed to by s1
18258 and the wcstok function returns a null pointer. If such a wide character is found, it is
18259 the start of the first token.
18261 The wcstok function then searches from there for a wide character that is contained in
18262 the current separator wide string. If no such wide character is found, the current token
18263 <!--page 396 indent 4-->
18264 extends to the end of the wide string pointed to by s1, and subsequent searches in the
18265 same wide string for a token return a null pointer. If such a wide character is found, it is
18266 overwritten by a null wide character, which terminates the current token.
18268 In all cases, the wcstok function stores sufficient information in the pointer pointed to
18269 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
18270 value for ptr, shall start searching just past the element overwritten by a null wide
18271 character (if any).
18274 The wcstok function returns a pointer to the first wide character of a token, or a null
18275 pointer if there is no token.
18279 #include <wchar.h>
18280 static wchar_t str1[] = L"?a???b,,,#c";
18281 static wchar_t str2[] = L"\t \t";
18282 wchar_t *t, *ptr1, *ptr2;
18283 t = wcstok(str1, L"?", &ptr1); // t points to the token L"a"
18284 t = wcstok(NULL, L",", &ptr1); // t points to the token L"??b"
18285 t = wcstok(str2, L" \t", &ptr2); // t is a null pointer
18286 t = wcstok(NULL, L"#,", &ptr1); // t points to the token L"c"
18287 t = wcstok(NULL, L"?", &ptr1); // t is a null pointer</pre>
18290 <a name="7.24.4.5.8" href="#7.24.4.5.8"><h5>7.24.4.5.8 The wmemchr function</h5></a>
18294 #include <wchar.h>
18295 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
18297 <h6>Description</h6>
18299 The wmemchr function locates the first occurrence of c in the initial n wide characters of
18300 the object pointed to by s.
18303 The wmemchr function returns a pointer to the located wide character, or a null pointer if
18304 the wide character does not occur in the object.
18305 <!--page 397 indent 4-->
18307 <a name="7.24.4.6" href="#7.24.4.6"><h5>7.24.4.6 Miscellaneous functions</h5></a>
18309 <a name="7.24.4.6.1" href="#7.24.4.6.1"><h5>7.24.4.6.1 The wcslen function</h5></a>
18313 #include <wchar.h>
18314 size_t wcslen(const wchar_t *s);</pre>
18315 <h6>Description</h6>
18317 The wcslen function computes the length of the wide string pointed to by s.
18320 The wcslen function returns the number of wide characters that precede the terminating
18321 null wide character.
18323 <a name="7.24.4.6.2" href="#7.24.4.6.2"><h5>7.24.4.6.2 The wmemset function</h5></a>
18327 #include <wchar.h>
18328 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);</pre>
18329 <h6>Description</h6>
18331 The wmemset function copies the value of c into each of the first n wide characters of
18332 the object pointed to by s.
18335 The wmemset function returns the value of s.
18337 <a name="7.24.5" href="#7.24.5"><h4>7.24.5 Wide character time conversion functions</h4></a>
18339 <a name="7.24.5.1" href="#7.24.5.1"><h5>7.24.5.1 The wcsftime function</h5></a>
18343 #include <time.h>
18344 #include <wchar.h>
18345 size_t wcsftime(wchar_t * restrict s,
18347 const wchar_t * restrict format,
18348 const struct tm * restrict timeptr);</pre>
18349 <h6>Description</h6>
18351 The wcsftime function is equivalent to the strftime function, except that:
18353 <li> The argument s points to the initial element of an array of wide characters into which
18354 the generated output is to be placed.
18355 <!--page 398 indent 4-->
18356 <li> The argument maxsize indicates the limiting number of wide characters.
18357 <li> The argument format is a wide string and the conversion specifiers are replaced by
18358 corresponding sequences of wide characters.
18359 <li> The return value indicates the number of wide characters.
18363 If the total number of resulting wide characters including the terminating null wide
18364 character is not more than maxsize, the wcsftime function returns the number of
18365 wide characters placed into the array pointed to by s not including the terminating null
18366 wide character. Otherwise, zero is returned and the contents of the array are
18369 <a name="7.24.6" href="#7.24.6"><h4>7.24.6 Extended multibyte/wide character conversion utilities</h4></a>
18371 The header <wchar.h> declares an extended set of functions useful for conversion
18372 between multibyte characters and wide characters.
18374 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.24.6.3">7.24.6.3</a> and
18375 <a href="#7.24.6.4">7.24.6.4</a> -- take as a last argument a pointer to an object of type mbstate_t that is used
18376 to describe the current conversion state from a particular multibyte character sequence to
18377 a wide character sequence (or the reverse) under the rules of a particular setting for the
18378 LC_CTYPE category of the current locale.
18380 The initial conversion state corresponds, for a conversion in either direction, to the
18381 beginning of a new multibyte character in the initial shift state. A zero-valued
18382 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
18383 valued mbstate_t object can be used to initiate conversion involving any multibyte
18384 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
18385 been altered by any of the functions described in this subclause, and is then used with a
18386 different multibyte character sequence, or in the other conversion direction, or with a
18387 different LC_CTYPE category setting than on earlier function calls, the behavior is
18388 undefined.<sup><a href="#note299"><b>299)</b></a></sup>
18390 On entry, each function takes the described conversion state (either internal or pointed to
18391 by an argument) as current. The conversion state described by the pointed-to object is
18392 altered as needed to track the shift state, and the position within a multibyte character, for
18393 the associated multibyte character sequence.
18398 <!--page 399 indent 4-->
18401 <p><a name="note299">299)</a> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
18402 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
18406 <a name="7.24.6.1" href="#7.24.6.1"><h5>7.24.6.1 Single-byte/wide character conversion functions</h5></a>
18408 <a name="7.24.6.1.1" href="#7.24.6.1.1"><h5>7.24.6.1.1 The btowc function</h5></a>
18412 #include <stdio.h>
18413 #include <wchar.h>
18414 wint_t btowc(int c);</pre>
18415 <h6>Description</h6>
18417 The btowc function determines whether c constitutes a valid single-byte character in the
18418 initial shift state.
18421 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
18422 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
18423 returns the wide character representation of that character.
18425 <a name="7.24.6.1.2" href="#7.24.6.1.2"><h5>7.24.6.1.2 The wctob function</h5></a>
18429 #include <stdio.h>
18430 #include <wchar.h>
18431 int wctob(wint_t c);</pre>
18432 <h6>Description</h6>
18434 The wctob function determines whether c corresponds to a member of the extended
18435 character set whose multibyte character representation is a single byte when in the initial
18439 The wctob function returns EOF if c does not correspond to a multibyte character with
18440 length one in the initial shift state. Otherwise, it returns the single-byte representation of
18441 that character as an unsigned char converted to an int.
18443 <a name="7.24.6.2" href="#7.24.6.2"><h5>7.24.6.2 Conversion state functions</h5></a>
18445 <a name="7.24.6.2.1" href="#7.24.6.2.1"><h5>7.24.6.2.1 The mbsinit function</h5></a>
18449 #include <wchar.h>
18450 int mbsinit(const mbstate_t *ps);</pre>
18451 <h6>Description</h6>
18453 If ps is not a null pointer, the mbsinit function determines whether the pointed-to
18454 mbstate_t object describes an initial conversion state.
18455 <!--page 400 indent 4-->
18458 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object
18459 describes an initial conversion state; otherwise, it returns zero.
18461 <a name="7.24.6.3" href="#7.24.6.3"><h5>7.24.6.3 Restartable multibyte/wide character conversion functions</h5></a>
18463 These functions differ from the corresponding multibyte character functions of <a href="#7.20.7">7.20.7</a>
18464 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
18465 pointer to mbstate_t that points to an object that can completely describe the current
18466 conversion state of the associated multibyte character sequence. If ps is a null pointer,
18467 each function uses its own internal mbstate_t object instead, which is initialized at
18468 program startup to the initial conversion state. The implementation behaves as if no
18469 library function calls these functions with a null pointer for ps.
18471 Also unlike their corresponding functions, the return value does not represent whether the
18472 encoding is state-dependent.
18474 <a name="7.24.6.3.1" href="#7.24.6.3.1"><h5>7.24.6.3.1 The mbrlen function</h5></a>
18478 #include <wchar.h>
18479 size_t mbrlen(const char * restrict s,
18481 mbstate_t * restrict ps);</pre>
18482 <h6>Description</h6>
18484 The mbrlen function is equivalent to the call:
18486 mbrtowc(NULL, s, n, ps != NULL ? ps : &internal)</pre>
18487 where internal is the mbstate_t object for the mbrlen function, except that the
18488 expression designated by ps is evaluated only once.
18491 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
18493 Forward references: the mbrtowc function (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
18494 <!--page 401 indent 4-->
18496 <a name="7.24.6.3.2" href="#7.24.6.3.2"><h5>7.24.6.3.2 The mbrtowc function</h5></a>
18500 #include <wchar.h>
18501 size_t mbrtowc(wchar_t * restrict pwc,
18502 const char * restrict s,
18504 mbstate_t * restrict ps);</pre>
18505 <h6>Description</h6>
18507 If s is a null pointer, the mbrtowc function is equivalent to the call:
18509 mbrtowc(NULL, "", 1, ps)</pre>
18510 In this case, the values of the parameters pwc and n are ignored.
18512 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
18513 the byte pointed to by s to determine the number of bytes needed to complete the next
18514 multibyte character (including any shift sequences). If the function determines that the
18515 next multibyte character is complete and valid, it determines the value of the
18516 corresponding wide character and then, if pwc is not a null pointer, stores that value in
18517 the object pointed to by pwc. If the corresponding wide character is the null wide
18518 character, the resulting state described is the initial conversion state.
18521 The mbrtowc function returns the first of the following that applies (given the current
18523 0 if the next n or fewer bytes complete the multibyte character that
18525 corresponds to the null wide character (which is the value stored).</pre>
18526 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
18528 character (which is the value stored); the value returned is the number
18529 of bytes that complete the multibyte character.</pre>
18530 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
18532 multibyte character, and all n bytes have been processed (no value is
18533 stored).<sup><a href="#note300"><b>300)</b></a></sup></pre>
18534 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
18536 do not contribute to a complete and valid multibyte character (no
18537 value is stored); the value of the macro EILSEQ is stored in errno,
18538 and the conversion state is unspecified.</pre>
18540 <!--page 402 indent 4-->
18543 <p><a name="note300">300)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
18544 sequence of redundant shift sequences (for implementations with state-dependent encodings).
18547 <a name="7.24.6.3.3" href="#7.24.6.3.3"><h5>7.24.6.3.3 The wcrtomb function</h5></a>
18551 #include <wchar.h>
18552 size_t wcrtomb(char * restrict s,
18554 mbstate_t * restrict ps);</pre>
18555 <h6>Description</h6>
18557 If s is a null pointer, the wcrtomb function is equivalent to the call
18559 wcrtomb(buf, L'\0', ps)</pre>
18560 where buf is an internal buffer.
18562 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
18563 to represent the multibyte character that corresponds to the wide character given by wc
18564 (including any shift sequences), and stores the multibyte character representation in the
18565 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
18566 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
18567 to restore the initial shift state; the resulting state described is the initial conversion state.
18570 The wcrtomb function returns the number of bytes stored in the array object (including
18571 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
18572 the function stores the value of the macro EILSEQ in errno and returns
18573 (size_t)(-1); the conversion state is unspecified.
18575 <a name="7.24.6.4" href="#7.24.6.4"><h5>7.24.6.4 Restartable multibyte/wide string conversion functions</h5></a>
18577 These functions differ from the corresponding multibyte string functions of <a href="#7.20.8">7.20.8</a>
18578 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
18579 mbstate_t that points to an object that can completely describe the current conversion
18580 state of the associated multibyte character sequence. If ps is a null pointer, each function
18581 uses its own internal mbstate_t object instead, which is initialized at program startup
18582 to the initial conversion state. The implementation behaves as if no library function calls
18583 these functions with a null pointer for ps.
18585 Also unlike their corresponding functions, the conversion source parameter, src, has a
18586 pointer-to-pointer type. When the function is storing the results of conversions (that is,
18587 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
18588 to reflect the amount of the source processed by that invocation.
18589 <!--page 403 indent 4-->
18591 <a name="7.24.6.4.1" href="#7.24.6.4.1"><h5>7.24.6.4.1 The mbsrtowcs function</h5></a>
18595 #include <wchar.h>
18596 size_t mbsrtowcs(wchar_t * restrict dst,
18597 const char ** restrict src,
18599 mbstate_t * restrict ps);</pre>
18600 <h6>Description</h6>
18602 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
18603 conversion state described by the object pointed to by ps, from the array indirectly
18604 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
18605 pointer, the converted characters are stored into the array pointed to by dst. Conversion
18606 continues up to and including a terminating null character, which is also stored.
18607 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
18608 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
18609 characters have been stored into the array pointed to by dst.<sup><a href="#note301"><b>301)</b></a></sup> Each conversion takes
18610 place as if by a call to the mbrtowc function.
18612 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
18613 pointer (if conversion stopped due to reaching a terminating null character) or the address
18614 just past the last multibyte character converted (if any). If conversion stopped due to
18615 reaching a terminating null character and if dst is not a null pointer, the resulting state
18616 described is the initial conversion state.
18619 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
18620 character, an encoding error occurs: the mbsrtowcs function stores the value of the
18621 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
18622 unspecified. Otherwise, it returns the number of multibyte characters successfully
18623 converted, not including the terminating null character (if any).
18628 <!--page 404 indent 4-->
18631 <p><a name="note301">301)</a> Thus, the value of len is ignored if dst is a null pointer.
18634 <a name="7.24.6.4.2" href="#7.24.6.4.2"><h5>7.24.6.4.2 The wcsrtombs function</h5></a>
18638 #include <wchar.h>
18639 size_t wcsrtombs(char * restrict dst,
18640 const wchar_t ** restrict src,
18642 mbstate_t * restrict ps);</pre>
18643 <h6>Description</h6>
18645 The wcsrtombs function converts a sequence of wide characters from the array
18646 indirectly pointed to by src into a sequence of corresponding multibyte characters that
18647 begins in the conversion state described by the object pointed to by ps. If dst is not a
18648 null pointer, the converted characters are then stored into the array pointed to by dst.
18649 Conversion continues up to and including a terminating null wide character, which is also
18650 stored. Conversion stops earlier in two cases: when a wide character is reached that does
18651 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
18652 next multibyte character would exceed the limit of len total bytes to be stored into the
18653 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
18654 function.<sup><a href="#note302"><b>302)</b></a></sup>
18656 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
18657 pointer (if conversion stopped due to reaching a terminating null wide character) or the
18658 address just past the last wide character converted (if any). If conversion stopped due to
18659 reaching a terminating null wide character, the resulting state described is the initial
18663 If conversion stops because a wide character is reached that does not correspond to a
18664 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
18665 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
18666 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
18667 character sequence, not including the terminating null character (if any).
18672 <!--page 405 indent 4-->
18675 <p><a name="note302">302)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
18676 include those necessary to reach the initial shift state immediately before the null byte.
18679 <a name="7.25" href="#7.25"><h3>7.25 Wide character classification and mapping utilities <wctype.h></h3></a>
18681 <a name="7.25.1" href="#7.25.1"><h4>7.25.1 Introduction</h4></a>
18683 The header <wctype.h> declares three data types, one macro, and many functions.<sup><a href="#note303"><b>303)</b></a></sup>
18685 The types declared are
18688 described in <a href="#7.24.1">7.24.1</a>;
18691 which is a scalar type that can hold values which represent locale-specific character
18695 which is a scalar type that can hold values which represent locale-specific character
18698 The macro defined is WEOF (described in <a href="#7.24.1">7.24.1</a>).
18700 The functions declared are grouped as follows:
18702 <li> Functions that provide wide character classification;
18703 <li> Extensible functions that provide wide character classification;
18704 <li> Functions that provide wide character case mapping;
18705 <li> Extensible functions that provide wide character mapping.
18708 For all functions described in this subclause that accept an argument of type wint_t, the
18709 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
18710 this argument has any other value, the behavior is undefined.
18712 The behavior of these functions is affected by the LC_CTYPE category of the current
18718 <!--page 406 indent 4-->
18721 <p><a name="note303">303)</a> See ''future library directions'' (<a href="#7.26.13">7.26.13</a>).
18724 <a name="7.25.2" href="#7.25.2"><h4>7.25.2 Wide character classification utilities</h4></a>
18726 The header <wctype.h> declares several functions useful for classifying wide
18729 The term printing wide character refers to a member of a locale-specific set of wide
18730 characters, each of which occupies at least one printing position on a display device. The
18731 term control wide character refers to a member of a locale-specific set of wide characters
18732 that are not printing wide characters.
18734 <a name="7.25.2.1" href="#7.25.2.1"><h5>7.25.2.1 Wide character classification functions</h5></a>
18736 The functions in this subclause return nonzero (true) if and only if the value of the
18737 argument wc conforms to that in the description of the function.
18739 Each of the following functions returns true for each wide character that corresponds (as
18740 if by a call to the wctob function) to a single-byte character for which the corresponding
18741 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
18742 iswpunct functions may differ with respect to wide characters other than L' ' that are
18743 both printing and white-space wide characters.<sup><a href="#note304"><b>304)</b></a></sup>
18744 Forward references: the wctob function (<a href="#7.24.6.1.2">7.24.6.1.2</a>).
18747 <p><a name="note304">304)</a> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
18748 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
18749 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
18750 && iswspace(wc) is true, but not both.
18753 <a name="7.25.2.1.1" href="#7.25.2.1.1"><h5>7.25.2.1.1 The iswalnum function</h5></a>
18757 #include <wctype.h>
18758 int iswalnum(wint_t wc);</pre>
18759 <h6>Description</h6>
18761 The iswalnum function tests for any wide character for which iswalpha or
18764 <a name="7.25.2.1.2" href="#7.25.2.1.2"><h5>7.25.2.1.2 The iswalpha function</h5></a>
18768 #include <wctype.h>
18769 int iswalpha(wint_t wc);</pre>
18770 <h6>Description</h6>
18772 The iswalpha function tests for any wide character for which iswupper or
18773 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
18775 <!--page 407 indent 4-->
18776 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
18777 is true.<sup><a href="#note305"><b>305)</b></a></sup>
18780 <p><a name="note305">305)</a> The functions iswlower and iswupper test true or false separately for each of these additional
18781 wide characters; all four combinations are possible.
18784 <a name="7.25.2.1.3" href="#7.25.2.1.3"><h5>7.25.2.1.3 The iswblank function</h5></a>
18788 #include <wctype.h>
18789 int iswblank(wint_t wc);</pre>
18790 <h6>Description</h6>
18792 The iswblank function tests for any wide character that is a standard blank wide
18793 character or is one of a locale-specific set of wide characters for which iswspace is true
18794 and that is used to separate words within a line of text. The standard blank wide
18795 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
18796 locale, iswblank returns true only for the standard blank characters.
18798 <a name="7.25.2.1.4" href="#7.25.2.1.4"><h5>7.25.2.1.4 The iswcntrl function</h5></a>
18802 #include <wctype.h>
18803 int iswcntrl(wint_t wc);</pre>
18804 <h6>Description</h6>
18806 The iswcntrl function tests for any control wide character.
18808 <a name="7.25.2.1.5" href="#7.25.2.1.5"><h5>7.25.2.1.5 The iswdigit function</h5></a>
18812 #include <wctype.h>
18813 int iswdigit(wint_t wc);</pre>
18814 <h6>Description</h6>
18816 The iswdigit function tests for any wide character that corresponds to a decimal-digit
18817 character (as defined in <a href="#5.2.1">5.2.1</a>).
18819 <a name="7.25.2.1.6" href="#7.25.2.1.6"><h5>7.25.2.1.6 The iswgraph function</h5></a>
18823 #include <wctype.h>
18824 int iswgraph(wint_t wc);</pre>
18829 <!--page 408 indent 4-->
18830 <h6>Description</h6>
18832 The iswgraph function tests for any wide character for which iswprint is true and
18833 iswspace is false.<sup><a href="#note306"><b>306)</b></a></sup>
18836 <p><a name="note306">306)</a> Note that the behavior of the iswgraph and iswpunct functions may differ from their
18837 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
18838 characters other than ' '.
18841 <a name="7.25.2.1.7" href="#7.25.2.1.7"><h5>7.25.2.1.7 The iswlower function</h5></a>
18845 #include <wctype.h>
18846 int iswlower(wint_t wc);</pre>
18847 <h6>Description</h6>
18849 The iswlower function tests for any wide character that corresponds to a lowercase
18850 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
18851 iswdigit, iswpunct, or iswspace is true.
18853 <a name="7.25.2.1.8" href="#7.25.2.1.8"><h5>7.25.2.1.8 The iswprint function</h5></a>
18857 #include <wctype.h>
18858 int iswprint(wint_t wc);</pre>
18859 <h6>Description</h6>
18861 The iswprint function tests for any printing wide character.
18863 <a name="7.25.2.1.9" href="#7.25.2.1.9"><h5>7.25.2.1.9 The iswpunct function</h5></a>
18867 #include <wctype.h>
18868 int iswpunct(wint_t wc);</pre>
18869 <h6>Description</h6>
18871 The iswpunct function tests for any printing wide character that is one of a locale-
18872 specific set of punctuation wide characters for which neither iswspace nor iswalnum
18875 <a name="7.25.2.1.10" href="#7.25.2.1.10"><h5>7.25.2.1.10 The iswspace function</h5></a>
18879 #include <wctype.h>
18880 int iswspace(wint_t wc);</pre>
18884 <!--page 409 indent 4-->
18885 <h6>Description</h6>
18887 The iswspace function tests for any wide character that corresponds to a locale-specific
18888 set of white-space wide characters for which none of iswalnum, iswgraph, or
18891 <a name="7.25.2.1.11" href="#7.25.2.1.11"><h5>7.25.2.1.11 The iswupper function</h5></a>
18895 #include <wctype.h>
18896 int iswupper(wint_t wc);</pre>
18897 <h6>Description</h6>
18899 The iswupper function tests for any wide character that corresponds to an uppercase
18900 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
18901 iswdigit, iswpunct, or iswspace is true.
18903 <a name="7.25.2.1.12" href="#7.25.2.1.12"><h5>7.25.2.1.12 The iswxdigit function</h5></a>
18907 #include <wctype.h>
18908 int iswxdigit(wint_t wc);</pre>
18909 <h6>Description</h6>
18911 The iswxdigit function tests for any wide character that corresponds to a
18912 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
18914 <a name="7.25.2.2" href="#7.25.2.2"><h5>7.25.2.2 Extensible wide character classification functions</h5></a>
18916 The functions wctype and iswctype provide extensible wide character classification
18917 as well as testing equivalent to that performed by the functions described in the previous
18918 subclause (<a href="#7.25.2.1">7.25.2.1</a>).
18920 <a name="7.25.2.2.1" href="#7.25.2.2.1"><h5>7.25.2.2.1 The iswctype function</h5></a>
18924 #include <wctype.h>
18925 int iswctype(wint_t wc, wctype_t desc);</pre>
18926 <h6>Description</h6>
18928 The iswctype function determines whether the wide character wc has the property
18929 described by desc. The current setting of the LC_CTYPE category shall be the same as
18930 during the call to wctype that returned the value desc.
18932 Each of the following expressions has a truth-value equivalent to the call to the wide
18933 character classification function (<a href="#7.25.2.1">7.25.2.1</a>) in the comment that follows the expression:
18934 <!--page 410 indent 4-->
18936 iswctype(wc, wctype("alnum")) // iswalnum(wc)
18937 iswctype(wc, wctype("alpha")) // iswalpha(wc)
18938 iswctype(wc, wctype("blank")) // iswblank(wc)
18939 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
18940 iswctype(wc, wctype("digit")) // iswdigit(wc)
18941 iswctype(wc, wctype("graph")) // iswgraph(wc)
18942 iswctype(wc, wctype("lower")) // iswlower(wc)
18943 iswctype(wc, wctype("print")) // iswprint(wc)
18944 iswctype(wc, wctype("punct")) // iswpunct(wc)
18945 iswctype(wc, wctype("space")) // iswspace(wc)
18946 iswctype(wc, wctype("upper")) // iswupper(wc)
18947 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)</pre>
18950 The iswctype function returns nonzero (true) if and only if the value of the wide
18951 character wc has the property described by desc.
18952 Forward references: the wctype function (<a href="#7.25.2.2.2">7.25.2.2.2</a>).
18954 <a name="7.25.2.2.2" href="#7.25.2.2.2"><h5>7.25.2.2.2 The wctype function</h5></a>
18958 #include <wctype.h>
18959 wctype_t wctype(const char *property);</pre>
18960 <h6>Description</h6>
18962 The wctype function constructs a value with type wctype_t that describes a class of
18963 wide characters identified by the string argument property.
18965 The strings listed in the description of the iswctype function shall be valid in all
18966 locales as property arguments to the wctype function.
18969 If property identifies a valid class of wide characters according to the LC_CTYPE
18970 category of the current locale, the wctype function returns a nonzero value that is valid
18971 as the second argument to the iswctype function; otherwise, it returns zero. *
18972 <!--page 411 indent 4-->
18974 <a name="7.25.3" href="#7.25.3"><h4>7.25.3 Wide character case mapping utilities</h4></a>
18976 The header <wctype.h> declares several functions useful for mapping wide characters.
18978 <a name="7.25.3.1" href="#7.25.3.1"><h5>7.25.3.1 Wide character case mapping functions</h5></a>
18980 <a name="7.25.3.1.1" href="#7.25.3.1.1"><h5>7.25.3.1.1 The towlower function</h5></a>
18984 #include <wctype.h>
18985 wint_t towlower(wint_t wc);</pre>
18986 <h6>Description</h6>
18988 The towlower function converts an uppercase letter to a corresponding lowercase letter.
18991 If the argument is a wide character for which iswupper is true and there are one or
18992 more corresponding wide characters, as specified by the current locale, for which
18993 iswlower is true, the towlower function returns one of the corresponding wide
18994 characters (always the same one for any given locale); otherwise, the argument is
18995 returned unchanged.
18997 <a name="7.25.3.1.2" href="#7.25.3.1.2"><h5>7.25.3.1.2 The towupper function</h5></a>
19001 #include <wctype.h>
19002 wint_t towupper(wint_t wc);</pre>
19003 <h6>Description</h6>
19005 The towupper function converts a lowercase letter to a corresponding uppercase letter.
19008 If the argument is a wide character for which iswlower is true and there are one or
19009 more corresponding wide characters, as specified by the current locale, for which
19010 iswupper is true, the towupper function returns one of the corresponding wide
19011 characters (always the same one for any given locale); otherwise, the argument is
19012 returned unchanged.
19014 <a name="7.25.3.2" href="#7.25.3.2"><h5>7.25.3.2 Extensible wide character case mapping functions</h5></a>
19016 The functions wctrans and towctrans provide extensible wide character mapping as
19017 well as case mapping equivalent to that performed by the functions described in the
19018 previous subclause (<a href="#7.25.3.1">7.25.3.1</a>).
19019 <!--page 412 indent 4-->
19021 <a name="7.25.3.2.1" href="#7.25.3.2.1"><h5>7.25.3.2.1 The towctrans function</h5></a>
19025 #include <wctype.h>
19026 wint_t towctrans(wint_t wc, wctrans_t desc);</pre>
19027 <h6>Description</h6>
19029 The towctrans function maps the wide character wc using the mapping described by
19030 desc. The current setting of the LC_CTYPE category shall be the same as during the call
19031 to wctrans that returned the value desc.
19033 Each of the following expressions behaves the same as the call to the wide character case
19034 mapping function (<a href="#7.25.3.1">7.25.3.1</a>) in the comment that follows the expression:
19036 towctrans(wc, wctrans("tolower")) // towlower(wc)
19037 towctrans(wc, wctrans("toupper")) // towupper(wc)</pre>
19040 The towctrans function returns the mapped value of wc using the mapping described
19043 <a name="7.25.3.2.2" href="#7.25.3.2.2"><h5>7.25.3.2.2 The wctrans function</h5></a>
19047 #include <wctype.h>
19048 wctrans_t wctrans(const char *property);</pre>
19049 <h6>Description</h6>
19051 The wctrans function constructs a value with type wctrans_t that describes a
19052 mapping between wide characters identified by the string argument property.
19054 The strings listed in the description of the towctrans function shall be valid in all
19055 locales as property arguments to the wctrans function.
19058 If property identifies a valid mapping of wide characters according to the LC_CTYPE
19059 category of the current locale, the wctrans function returns a nonzero value that is valid
19060 as the second argument to the towctrans function; otherwise, it returns zero.
19061 <!--page 413 indent 4-->
19063 <a name="7.26" href="#7.26"><h3>7.26 Future library directions</h3></a>
19065 The following names are grouped under individual headers for convenience. All external
19066 names described below are reserved no matter what headers are included by the program.
19068 <a name="7.26.1" href="#7.26.1"><h4>7.26.1 Complex arithmetic <complex.h></h4></a>
19073 cerfc clog10 clgamma
19074 cexp2 clog1p ctgamma</pre>
19075 and the same names suffixed with f or l may be added to the declarations in the
19076 <complex.h> header.
19078 <a name="7.26.2" href="#7.26.2"><h4>7.26.2 Character handling <ctype.h></h4></a>
19080 Function names that begin with either is or to, and a lowercase letter may be added to
19081 the declarations in the <ctype.h> header.
19083 <a name="7.26.3" href="#7.26.3"><h4>7.26.3 Errors <errno.h></h4></a>
19085 Macros that begin with E and a digit or E and an uppercase letter may be added to the
19086 declarations in the <errno.h> header.
19088 <a name="7.26.4" href="#7.26.4"><h4>7.26.4 Format conversion of integer types <inttypes.h></h4></a>
19090 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
19091 added to the macros defined in the <inttypes.h> header.
19093 <a name="7.26.5" href="#7.26.5"><h4>7.26.5 Localization <locale.h></h4></a>
19095 Macros that begin with LC_ and an uppercase letter may be added to the definitions in
19096 the <locale.h> header.
19098 <a name="7.26.6" href="#7.26.6"><h4>7.26.6 Signal handling <signal.h></h4></a>
19100 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
19101 letter may be added to the definitions in the <signal.h> header.
19103 <a name="7.26.7" href="#7.26.7"><h4>7.26.7 Boolean type and values <stdbool.h></h4></a>
19105 The ability to undefine and perhaps then redefine the macros bool, true, and false is
19106 an obsolescent feature.
19108 <a name="7.26.8" href="#7.26.8"><h4>7.26.8 Integer types <stdint.h></h4></a>
19110 Typedef names beginning with int or uint and ending with _t may be added to the
19111 types defined in the <stdint.h> header. Macro names beginning with INT or UINT
19112 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
19113 <stdint.h> header.
19114 <!--page 414 indent 4-->
19116 <a name="7.26.9" href="#7.26.9"><h4>7.26.9 Input/output <stdio.h></h4></a>
19118 Lowercase letters may be added to the conversion specifiers and length modifiers in
19119 fprintf and fscanf. Other characters may be used in extensions.
19121 The gets function is obsolescent, and is deprecated.
19123 The use of ungetc on a binary stream where the file position indicator is zero prior to
19124 the call is an obsolescent feature.
19126 <a name="7.26.10" href="#7.26.10"><h4>7.26.10 General utilities <stdlib.h></h4></a>
19128 Function names that begin with str and a lowercase letter may be added to the
19129 declarations in the <stdlib.h> header.
19131 <a name="7.26.11" href="#7.26.11"><h4>7.26.11 String handling <string.h></h4></a>
19133 Function names that begin with str, mem, or wcs and a lowercase letter may be added
19134 to the declarations in the <string.h> header.
19136 <a name="7.26.12" href="#7.26.12"><h4>7.26.12 Extended multibyte and wide character utilities <wchar.h></h4></a>
19138 Function names that begin with wcs and a lowercase letter may be added to the
19139 declarations in the <wchar.h> header.
19141 Lowercase letters may be added to the conversion specifiers and length modifiers in
19142 fwprintf and fwscanf. Other characters may be used in extensions.
19144 <a name="7.26.13" href="#7.26.13"><h4>7.26.13 Wide character classification and mapping utilities</h4></a>
19147 Function names that begin with is or to and a lowercase letter may be added to the
19148 declarations in the <wctype.h> header.
19149 <!--page 415 indent 4-->
19151 <a name="A" href="#A"><h2>Annex A</h2></a>
19155 Language syntax summary</pre>
19156 NOTE The notation is described in <a href="#6.1">6.1</a>.
19159 <a name="A.1" href="#A.1"><h3>A.1 Lexical grammar</h3></a>
19161 <a name="A.1.1" href="#A.1.1"><h4>A.1.1 Lexical elements</h4></a>
19162 (<a href="#6.4">6.4</a>) token:
19169 (<a href="#6.4">6.4</a>) preprocessing-token:
19177 each non-white-space character that cannot be one of the above</pre>
19179 <a name="A.1.2" href="#A.1.2"><h4>A.1.2 Keywords</h4></a>
19180 (<a href="#6.4.1">6.4.1</a>) keyword: one of
19181 <!--page 416 indent 0-->
19183 auto enum restrict unsigned
19184 break extern return void
19185 case float short volatile
19186 char for signed while
19187 const goto sizeof _Bool
19188 continue if static _Complex
19189 default inline struct _Imaginary
19191 double long typedef
19192 else register union</pre>
19194 <a name="A.1.3" href="#A.1.3"><h4>A.1.3 Identifiers</h4></a>
19195 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
19197 identifier-nondigit
19198 identifier identifier-nondigit
19199 identifier digit</pre>
19200 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
19203 universal-character-name
19204 other implementation-defined characters</pre>
19205 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
19207 _ a b c d e f g h i j k l m
19208 n o p q r s t u v w x y z
19209 A B C D E F G H I J K L M
19210 N O P Q R S T U V W X Y Z</pre>
19211 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
19213 0 1 2 3 4 5 6 7 8 9</pre>
19215 <a name="A.1.4" href="#A.1.4"><h4>A.1.4 Universal character names</h4></a>
19216 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
19219 \U hex-quad hex-quad</pre>
19220 (<a href="#6.4.3">6.4.3</a>) hex-quad:
19222 hexadecimal-digit hexadecimal-digit
19223 hexadecimal-digit hexadecimal-digit</pre>
19225 <a name="A.1.5" href="#A.1.5"><h4>A.1.5 Constants</h4></a>
19226 (<a href="#6.4.4">6.4.4</a>) constant:
19230 enumeration-constant
19231 character-constant</pre>
19232 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
19234 decimal-constant integer-suffixopt
19235 octal-constant integer-suffixopt
19236 hexadecimal-constant integer-suffixopt</pre>
19237 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
19238 <!--page 417 indent 0-->
19241 decimal-constant digit</pre>
19242 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
19245 octal-constant octal-digit</pre>
19246 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
19248 hexadecimal-prefix hexadecimal-digit
19249 hexadecimal-constant hexadecimal-digit</pre>
19250 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
19253 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
19255 1 2 3 4 5 6 7 8 9</pre>
19256 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
19258 0 1 2 3 4 5 6 7</pre>
19259 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
19261 0 1 2 3 4 5 6 7 8 9
19264 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
19266 unsigned-suffix long-suffixopt
19267 unsigned-suffix long-long-suffix
19268 long-suffix unsigned-suffixopt
19269 long-long-suffix unsigned-suffixopt</pre>
19270 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
19273 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
19276 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
19279 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
19281 decimal-floating-constant
19282 hexadecimal-floating-constant</pre>
19283 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
19284 <!--page 418 indent 0-->
19286 fractional-constant exponent-partopt floating-suffixopt
19287 digit-sequence exponent-part floating-suffixopt</pre>
19288 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
19290 hexadecimal-prefix hexadecimal-fractional-constant
19291 binary-exponent-part floating-suffixopt
19292 hexadecimal-prefix hexadecimal-digit-sequence
19293 binary-exponent-part floating-suffixopt</pre>
19294 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
19296 digit-sequenceopt . digit-sequence
19297 digit-sequence .</pre>
19298 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
19300 e signopt digit-sequence
19301 E signopt digit-sequence</pre>
19302 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
19305 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
19308 digit-sequence digit</pre>
19309 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
19311 hexadecimal-digit-sequenceopt .
19312 hexadecimal-digit-sequence
19313 hexadecimal-digit-sequence .</pre>
19314 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
19316 p signopt digit-sequence
19317 P signopt digit-sequence</pre>
19318 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
19321 hexadecimal-digit-sequence hexadecimal-digit</pre>
19322 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
19325 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
19328 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
19329 <!--page 419 indent 0-->
19331 ' c-char-sequence '
19332 L' c-char-sequence '</pre>
19333 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
19336 c-char-sequence c-char</pre>
19337 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
19339 any member of the source character set except
19340 the single-quote ', backslash \, or new-line character
19341 escape-sequence</pre>
19342 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
19344 simple-escape-sequence
19345 octal-escape-sequence
19346 hexadecimal-escape-sequence
19347 universal-character-name</pre>
19348 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
19351 \a \b \f \n \r \t \v</pre>
19352 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
19355 \ octal-digit octal-digit
19356 \ octal-digit octal-digit octal-digit</pre>
19357 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
19359 \x hexadecimal-digit
19360 hexadecimal-escape-sequence hexadecimal-digit</pre>
19362 <a name="A.1.6" href="#A.1.6"><h4>A.1.6 String literals</h4></a>
19363 (<a href="#6.4.5">6.4.5</a>) string-literal:
19365 " s-char-sequenceopt "
19366 L" s-char-sequenceopt "</pre>
19367 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
19370 s-char-sequence s-char</pre>
19371 (<a href="#6.4.5">6.4.5</a>) s-char:
19372 <!--page 420 indent 0-->
19374 any member of the source character set except
19375 the double-quote ", backslash \, or new-line character
19376 escape-sequence</pre>
19378 <a name="A.1.7" href="#A.1.7"><h4>A.1.7 Punctuators</h4></a>
19379 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
19381 [ ] ( ) { } . ->
19382 ++ -- & * + - ~ !
19383 / % << >> < > <= >= == != ^ | && ||
19385 = *= /= %= += -= <<= >>= &= ^= |=
19387 <: :> <% %> %: %:%:</pre>
19389 <a name="A.1.8" href="#A.1.8"><h4>A.1.8 Header names</h4></a>
19390 (<a href="#6.4.7">6.4.7</a>) header-name:
19392 < h-char-sequence >
19393 " q-char-sequence "</pre>
19394 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
19397 h-char-sequence h-char</pre>
19398 (<a href="#6.4.7">6.4.7</a>) h-char:
19400 any member of the source character set except
19401 the new-line character and ></pre>
19402 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
19405 q-char-sequence q-char</pre>
19406 (<a href="#6.4.7">6.4.7</a>) q-char:
19408 any member of the source character set except
19409 the new-line character and "</pre>
19411 <a name="A.1.9" href="#A.1.9"><h4>A.1.9 Preprocessing numbers</h4></a>
19412 (<a href="#6.4.8">6.4.8</a>) pp-number:
19413 <!--page 421 indent 0-->
19418 pp-number identifier-nondigit
19425 <a name="A.2" href="#A.2"><h3>A.2 Phrase structure grammar</h3></a>
19427 <a name="A.2.1" href="#A.2.1"><h4>A.2.1 Expressions</h4></a>
19428 (<a href="#6.5.1">6.5.1</a>) primary-expression:
19433 ( expression )</pre>
19434 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
19437 postfix-expression [ expression ]
19438 postfix-expression ( argument-expression-listopt )
19439 postfix-expression . identifier
19440 postfix-expression -> identifier
19441 postfix-expression ++
19442 postfix-expression --
19443 ( type-name ) { initializer-list }
19444 ( type-name ) { initializer-list , }</pre>
19445 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
19447 assignment-expression
19448 argument-expression-list , assignment-expression</pre>
19449 (<a href="#6.5.3">6.5.3</a>) unary-expression:
19452 ++ unary-expression
19453 -- unary-expression
19454 unary-operator cast-expression
19455 sizeof unary-expression
19456 sizeof ( type-name )</pre>
19457 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
19459 & * + - ~ !</pre>
19460 (<a href="#6.5.4">6.5.4</a>) cast-expression:
19463 ( type-name ) cast-expression</pre>
19464 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
19465 <!--page 422 indent 0-->
19468 multiplicative-expression * cast-expression
19469 multiplicative-expression / cast-expression
19470 multiplicative-expression % cast-expression</pre>
19471 (<a href="#6.5.6">6.5.6</a>) additive-expression:
19473 multiplicative-expression
19474 additive-expression + multiplicative-expression
19475 additive-expression - multiplicative-expression</pre>
19476 (<a href="#6.5.7">6.5.7</a>) shift-expression:
19478 additive-expression
19479 shift-expression << additive-expression
19480 shift-expression >> additive-expression</pre>
19481 (<a href="#6.5.8">6.5.8</a>) relational-expression:
19484 relational-expression < shift-expression
19485 relational-expression > shift-expression
19486 relational-expression <= shift-expression
19487 relational-expression >= shift-expression</pre>
19488 (<a href="#6.5.9">6.5.9</a>) equality-expression:
19490 relational-expression
19491 equality-expression == relational-expression
19492 equality-expression != relational-expression</pre>
19493 (<a href="#6.5.10">6.5.10</a>) AND-expression:
19495 equality-expression
19496 AND-expression & equality-expression</pre>
19497 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
19500 exclusive-OR-expression ^ AND-expression</pre>
19501 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
19503 exclusive-OR-expression
19504 inclusive-OR-expression | exclusive-OR-expression</pre>
19505 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
19507 inclusive-OR-expression
19508 logical-AND-expression && inclusive-OR-expression</pre>
19509 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
19511 logical-AND-expression
19512 logical-OR-expression || logical-AND-expression</pre>
19513 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
19514 <!--page 423 indent 0-->
19516 logical-OR-expression
19517 logical-OR-expression ? expression : conditional-expression</pre>
19518 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
19520 conditional-expression
19521 unary-expression assignment-operator assignment-expression</pre>
19522 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
19524 = *= /= %= += -= <<= >>= &= ^= |=</pre>
19525 (<a href="#6.5.17">6.5.17</a>) expression:
19527 assignment-expression
19528 expression , assignment-expression</pre>
19529 (<a href="#6.6">6.6</a>) constant-expression:
19531 conditional-expression</pre>
19533 <a name="A.2.2" href="#A.2.2"><h4>A.2.2 Declarations</h4></a>
19534 (<a href="#6.7">6.7</a>) declaration:
19536 declaration-specifiers init-declarator-listopt ;</pre>
19537 (<a href="#6.7">6.7</a>) declaration-specifiers:
19539 storage-class-specifier declaration-specifiersopt
19540 type-specifier declaration-specifiersopt
19541 type-qualifier declaration-specifiersopt
19542 function-specifier declaration-specifiersopt</pre>
19543 (<a href="#6.7">6.7</a>) init-declarator-list:
19546 init-declarator-list , init-declarator</pre>
19547 (<a href="#6.7">6.7</a>) init-declarator:
19550 declarator = initializer</pre>
19551 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
19552 <!--page 424 indent 0-->
19559 (<a href="#6.7.2">6.7.2</a>) type-specifier:
19572 struct-or-union-specifier *
19575 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
19577 struct-or-union identifieropt { struct-declaration-list }
19578 struct-or-union identifier</pre>
19579 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
19583 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
19586 struct-declaration-list struct-declaration</pre>
19587 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
19589 specifier-qualifier-list struct-declarator-list ;</pre>
19590 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
19592 type-specifier specifier-qualifier-listopt
19593 type-qualifier specifier-qualifier-listopt</pre>
19594 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
19597 struct-declarator-list , struct-declarator</pre>
19598 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
19599 <!--page 425 indent 0-->
19602 declaratoropt : constant-expression</pre>
19603 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
19605 enum identifieropt { enumerator-list }
19606 enum identifieropt { enumerator-list , }
19607 enum identifier</pre>
19608 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
19611 enumerator-list , enumerator</pre>
19612 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
19614 enumeration-constant
19615 enumeration-constant = constant-expression</pre>
19616 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
19621 (<a href="#6.7.4">6.7.4</a>) function-specifier:
19624 (<a href="#6.7.5">6.7.5</a>) declarator:
19626 pointeropt direct-declarator</pre>
19627 (<a href="#6.7.5">6.7.5</a>) direct-declarator:
19631 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
19632 direct-declarator [ static type-qualifier-listopt assignment-expression ]
19633 direct-declarator [ type-qualifier-list static assignment-expression ]
19634 direct-declarator [ type-qualifier-listopt * ]
19635 direct-declarator ( parameter-type-list )
19636 direct-declarator ( identifier-listopt )</pre>
19637 (<a href="#6.7.5">6.7.5</a>) pointer:
19639 * type-qualifier-listopt
19640 * type-qualifier-listopt pointer</pre>
19641 (<a href="#6.7.5">6.7.5</a>) type-qualifier-list:
19644 type-qualifier-list type-qualifier</pre>
19645 (<a href="#6.7.5">6.7.5</a>) parameter-type-list:
19646 <!--page 426 indent 0-->
19649 parameter-list , ...</pre>
19650 (<a href="#6.7.5">6.7.5</a>) parameter-list:
19652 parameter-declaration
19653 parameter-list , parameter-declaration</pre>
19654 (<a href="#6.7.5">6.7.5</a>) parameter-declaration:
19656 declaration-specifiers declarator
19657 declaration-specifiers abstract-declaratoropt</pre>
19658 (<a href="#6.7.5">6.7.5</a>) identifier-list:
19661 identifier-list , identifier</pre>
19662 (<a href="#6.7.6">6.7.6</a>) type-name:
19664 specifier-qualifier-list abstract-declaratoropt</pre>
19665 (<a href="#6.7.6">6.7.6</a>) abstract-declarator:
19668 pointeropt direct-abstract-declarator</pre>
19669 (<a href="#6.7.6">6.7.6</a>) direct-abstract-declarator:
19671 ( abstract-declarator )
19672 direct-abstract-declaratoropt [ type-qualifier-listopt
19673 assignment-expressionopt ]
19674 direct-abstract-declaratoropt [ static type-qualifier-listopt
19675 assignment-expression ]
19676 direct-abstract-declaratoropt [ type-qualifier-list static
19677 assignment-expression ]
19678 direct-abstract-declaratoropt [ * ]
19679 direct-abstract-declaratoropt ( parameter-type-listopt )</pre>
19680 (<a href="#6.7.7">6.7.7</a>) typedef-name:
19683 (<a href="#6.7.8">6.7.8</a>) initializer:
19685 assignment-expression
19686 { initializer-list }
19687 { initializer-list , }</pre>
19688 (<a href="#6.7.8">6.7.8</a>) initializer-list:
19690 designationopt initializer
19691 initializer-list , designationopt initializer</pre>
19692 (<a href="#6.7.8">6.7.8</a>) designation:
19693 <!--page 427 indent 0-->
19695 designator-list =</pre>
19696 (<a href="#6.7.8">6.7.8</a>) designator-list:
19699 designator-list designator</pre>
19700 (<a href="#6.7.8">6.7.8</a>) designator:
19702 [ constant-expression ]
19705 <a name="A.2.3" href="#A.2.3"><h4>A.2.3 Statements</h4></a>
19706 (<a href="#6.8">6.8</a>) statement:
19710 expression-statement
19711 selection-statement
19712 iteration-statement
19713 jump-statement</pre>
19714 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
19716 identifier : statement
19717 case constant-expression : statement
19718 default : statement</pre>
19719 (<a href="#6.8.2">6.8.2</a>) compound-statement:
19721 { block-item-listopt }</pre>
19722 (<a href="#6.8.2">6.8.2</a>) block-item-list:
19725 block-item-list block-item</pre>
19726 (<a href="#6.8.2">6.8.2</a>) block-item:
19730 (<a href="#6.8.3">6.8.3</a>) expression-statement:
19732 expressionopt ;</pre>
19733 (<a href="#6.8.4">6.8.4</a>) selection-statement:
19734 <!--page 428 indent 0-->
19736 if ( expression ) statement
19737 if ( expression ) statement else statement
19738 switch ( expression ) statement</pre>
19739 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
19741 while ( expression ) statement
19742 do statement while ( expression ) ;
19743 for ( expressionopt ; expressionopt ; expressionopt ) statement
19744 for ( declaration expressionopt ; expressionopt ) statement</pre>
19745 (<a href="#6.8.6">6.8.6</a>) jump-statement:
19750 return expressionopt ;</pre>
19752 <a name="A.2.4" href="#A.2.4"><h4>A.2.4 External definitions</h4></a>
19753 (<a href="#6.9">6.9</a>) translation-unit:
19755 external-declaration
19756 translation-unit external-declaration</pre>
19757 (<a href="#6.9">6.9</a>) external-declaration:
19759 function-definition
19761 (<a href="#6.9.1">6.9.1</a>) function-definition:
19763 declaration-specifiers declarator declaration-listopt compound-statement</pre>
19764 (<a href="#6.9.1">6.9.1</a>) declaration-list:
19767 declaration-list declaration</pre>
19769 <a name="A.3" href="#A.3"><h3>A.3 Preprocessing directives</h3></a>
19770 (<a href="#6.10">6.10</a>) preprocessing-file:
19773 (<a href="#6.10">6.10</a>) group:
19776 group group-part</pre>
19777 (<a href="#6.10">6.10</a>) group-part:
19782 # non-directive</pre>
19783 (<a href="#6.10">6.10</a>) if-section:
19784 <!--page 429 indent 0-->
19786 if-group elif-groupsopt else-groupopt endif-line</pre>
19787 (<a href="#6.10">6.10</a>) if-group:
19789 # if constant-expression new-line groupopt
19790 # ifdef identifier new-line groupopt
19791 # ifndef identifier new-line groupopt</pre>
19792 (<a href="#6.10">6.10</a>) elif-groups:
19795 elif-groups elif-group</pre>
19796 (<a href="#6.10">6.10</a>) elif-group:
19798 # elif constant-expression new-line groupopt</pre>
19799 (<a href="#6.10">6.10</a>) else-group:
19801 # else new-line groupopt</pre>
19802 (<a href="#6.10">6.10</a>) endif-line:
19804 # endif new-line</pre>
19805 (<a href="#6.10">6.10</a>) control-line:
19807 # include pp-tokens new-line
19808 # define identifier replacement-list new-line
19809 # define identifier lparen identifier-listopt )
19810 replacement-list new-line
19811 # define identifier lparen ... ) replacement-list new-line
19812 # define identifier lparen identifier-list , ... )
19813 replacement-list new-line
19814 # undef identifier new-line
19815 # line pp-tokens new-line
19816 # error pp-tokensopt new-line
19817 # pragma pp-tokensopt new-line
19819 (<a href="#6.10">6.10</a>) text-line:
19821 pp-tokensopt new-line</pre>
19822 (<a href="#6.10">6.10</a>) non-directive:
19824 pp-tokens new-line</pre>
19825 (<a href="#6.10">6.10</a>) lparen:
19827 a ( character not immediately preceded by white-space</pre>
19828 (<a href="#6.10">6.10</a>) replacement-list:
19829 <!--page 430 indent 0-->
19832 (<a href="#6.10">6.10</a>) pp-tokens:
19834 preprocessing-token
19835 pp-tokens preprocessing-token</pre>
19836 (<a href="#6.10">6.10</a>) new-line:
19837 <!--page 431 indent 0-->
19839 the new-line character</pre>
19841 <a name="B" href="#B"><h2>Annex B</h2></a>
19844 Library summary</pre>
19846 <a name="B.1" href="#B.1"><h3>B.1 Diagnostics <assert.h></h3></a>
19849 void assert(scalar expression);</pre>
19851 <a name="B.2" href="#B.2"><h3>B.2 Complex <complex.h></h3></a>
19852 <!--page 432 indent -1-->
19853 <!--page 433 indent 0-->
19855 complex imaginary I
19856 _Complex_I _Imaginary_I
19857 #pragma STDC CX_LIMITED_RANGE on-off-switch
19858 double complex cacos(double complex z);
19859 float complex cacosf(float complex z);
19860 long double complex cacosl(long double complex z);
19861 double complex casin(double complex z);
19862 float complex casinf(float complex z);
19863 long double complex casinl(long double complex z);
19864 double complex catan(double complex z);
19865 float complex catanf(float complex z);
19866 long double complex catanl(long double complex z);
19867 double complex ccos(double complex z);
19868 float complex ccosf(float complex z);
19869 long double complex ccosl(long double complex z);
19870 double complex csin(double complex z);
19871 float complex csinf(float complex z);
19872 long double complex csinl(long double complex z);
19873 double complex ctan(double complex z);
19874 float complex ctanf(float complex z);
19875 long double complex ctanl(long double complex z);
19876 double complex cacosh(double complex z);
19877 float complex cacoshf(float complex z);
19878 long double complex cacoshl(long double complex z);
19879 double complex casinh(double complex z);
19880 float complex casinhf(float complex z);
19881 long double complex casinhl(long double complex z);
19882 double complex catanh(double complex z);
19883 float complex catanhf(float complex z);
19884 long double complex catanhl(long double complex z);
19885 double complex ccosh(double complex z);
19886 float complex ccoshf(float complex z);
19887 long double complex ccoshl(long double complex z);
19888 double complex csinh(double complex z);
19889 float complex csinhf(float complex z);
19890 long double complex csinhl(long double complex z);
19891 double complex ctanh(double complex z);
19892 float complex ctanhf(float complex z);
19893 long double complex ctanhl(long double complex z);
19894 double complex cexp(double complex z);
19895 float complex cexpf(float complex z);
19896 long double complex cexpl(long double complex z);
19897 double complex clog(double complex z);
19898 float complex clogf(float complex z);
19899 long double complex clogl(long double complex z);
19900 double cabs(double complex z);
19901 float cabsf(float complex z);
19902 long double cabsl(long double complex z);
19903 double complex cpow(double complex x, double complex y);
19904 float complex cpowf(float complex x, float complex y);
19905 long double complex cpowl(long double complex x,
19906 long double complex y);
19907 double complex csqrt(double complex z);
19908 float complex csqrtf(float complex z);
19909 long double complex csqrtl(long double complex z);
19910 double carg(double complex z);
19911 float cargf(float complex z);
19912 long double cargl(long double complex z);
19913 double cimag(double complex z);
19914 float cimagf(float complex z);
19915 long double cimagl(long double complex z);
19916 double complex conj(double complex z);
19917 float complex conjf(float complex z);
19918 long double complex conjl(long double complex z);
19919 double complex cproj(double complex z);
19920 float complex cprojf(float complex z);
19921 long double complex cprojl(long double complex z);
19922 double creal(double complex z);
19923 float crealf(float complex z);
19924 long double creall(long double complex z);</pre>
19926 <a name="B.3" href="#B.3"><h3>B.3 Character handling <ctype.h></h3></a>
19928 int isalnum(int c);
19929 int isalpha(int c);
19930 int isblank(int c);
19931 int iscntrl(int c);
19932 int isdigit(int c);
19933 int isgraph(int c);
19934 int islower(int c);
19935 int isprint(int c);
19936 int ispunct(int c);
19937 int isspace(int c);
19938 int isupper(int c);
19939 int isxdigit(int c);
19940 int tolower(int c);
19941 int toupper(int c);</pre>
19943 <a name="B.4" href="#B.4"><h3>B.4 Errors <errno.h></h3></a>
19945 EDOM EILSEQ ERANGE errno</pre>
19947 <a name="B.5" href="#B.5"><h3>B.5 Floating-point environment <fenv.h></h3></a>
19948 <!--page 434 indent 0-->
19950 fenv_t FE_OVERFLOW FE_TOWARDZERO
19951 fexcept_t FE_UNDERFLOW FE_UPWARD
19952 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
19953 FE_INEXACT FE_DOWNWARD
19954 FE_INVALID FE_TONEAREST
19955 #pragma STDC FENV_ACCESS on-off-switch
19956 int feclearexcept(int excepts);
19957 int fegetexceptflag(fexcept_t *flagp, int excepts);
19958 int feraiseexcept(int excepts);
19959 int fesetexceptflag(const fexcept_t *flagp,
19961 int fetestexcept(int excepts);
19962 int fegetround(void);
19963 int fesetround(int round);
19964 int fegetenv(fenv_t *envp);
19965 int feholdexcept(fenv_t *envp);
19966 int fesetenv(const fenv_t *envp);
19967 int feupdateenv(const fenv_t *envp);</pre>
19969 <a name="B.6" href="#B.6"><h3>B.6 Characteristics of floating types <float.h></h3></a>
19971 FLT_ROUNDS DBL_MIN_EXP FLT_MAX
19972 FLT_EVAL_METHOD LDBL_MIN_EXP DBL_MAX
19973 FLT_RADIX FLT_MIN_10_EXP LDBL_MAX
19974 FLT_MANT_DIG DBL_MIN_10_EXP FLT_EPSILON
19975 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_EPSILON
19976 LDBL_MANT_DIG FLT_MAX_EXP LDBL_EPSILON
19977 DECIMAL_DIG DBL_MAX_EXP FLT_MIN
19978 FLT_DIG LDBL_MAX_EXP DBL_MIN
19979 DBL_DIG FLT_MAX_10_EXP LDBL_MIN
19980 LDBL_DIG DBL_MAX_10_EXP
19981 FLT_MIN_EXP LDBL_MAX_10_EXP</pre>
19983 <a name="B.7" href="#B.7"><h3>B.7 Format conversion of integer types <inttypes.h></h3></a>
19984 <!--page 435 indent 0-->
19987 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
19988 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
19989 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
19990 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
19991 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
19992 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
19993 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
19994 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
19995 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
19996 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
19997 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
19998 intmax_t imaxabs(intmax_t j);
19999 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
20000 intmax_t strtoimax(const char * restrict nptr,
20001 char ** restrict endptr, int base);
20002 uintmax_t strtoumax(const char * restrict nptr,
20003 char ** restrict endptr, int base);
20004 intmax_t wcstoimax(const wchar_t * restrict nptr,
20005 wchar_t ** restrict endptr, int base);
20006 uintmax_t wcstoumax(const wchar_t * restrict nptr,
20007 wchar_t ** restrict endptr, int base);</pre>
20009 <a name="B.8" href="#B.8"><h3>B.8 Alternative spellings <iso646.h></h3></a>
20011 and bitor not_eq xor
20012 and_eq compl or xor_eq
20013 bitand not or_eq</pre>
20015 <a name="B.9" href="#B.9"><h3>B.9 Sizes of integer types <limits.h></h3></a>
20017 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
20018 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
20019 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
20020 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
20021 CHAR_MIN USHRT_MAX LONG_MAX</pre>
20023 <a name="B.10" href="#B.10"><h3>B.10 Localization <locale.h></h3></a>
20025 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
20026 NULL LC_COLLATE LC_MONETARY LC_TIME
20027 char *setlocale(int category, const char *locale);
20028 struct lconv *localeconv(void);</pre>
20030 <a name="B.11" href="#B.11"><h3>B.11 Mathematics <math.h></h3></a>
20031 <!--page 436 indent -1-->
20032 <!--page 437 indent -1-->
20033 <!--page 438 indent -1-->
20034 <!--page 439 indent -1-->
20035 <!--page 440 indent 0-->
20037 float_t FP_INFINITE FP_FAST_FMAL
20038 double_t FP_NAN FP_ILOGB0
20039 HUGE_VAL FP_NORMAL FP_ILOGBNAN
20040 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
20041 HUGE_VALL FP_ZERO MATH_ERREXCEPT
20042 INFINITY FP_FAST_FMA math_errhandling
20044 #pragma STDC FP_CONTRACT on-off-switch
20045 int fpclassify(real-floating x);
20046 int isfinite(real-floating x);
20047 int isinf(real-floating x);
20048 int isnan(real-floating x);
20049 int isnormal(real-floating x);
20050 int signbit(real-floating x);
20051 double acos(double x);
20052 float acosf(float x);
20053 long double acosl(long double x);
20054 double asin(double x);
20055 float asinf(float x);
20056 long double asinl(long double x);
20057 double atan(double x);
20058 float atanf(float x);
20059 long double atanl(long double x);
20060 double atan2(double y, double x);
20061 float atan2f(float y, float x);
20062 long double atan2l(long double y, long double x);
20063 double cos(double x);
20064 float cosf(float x);
20065 long double cosl(long double x);
20066 double sin(double x);
20067 float sinf(float x);
20068 long double sinl(long double x);
20069 double tan(double x);
20070 float tanf(float x);
20071 long double tanl(long double x);
20072 double acosh(double x);
20073 float acoshf(float x);
20074 long double acoshl(long double x);
20075 double asinh(double x);
20076 float asinhf(float x);
20077 long double asinhl(long double x);
20078 double atanh(double x);
20079 float atanhf(float x);
20080 long double atanhl(long double x);
20081 double cosh(double x);
20082 float coshf(float x);
20083 long double coshl(long double x);
20084 double sinh(double x);
20085 float sinhf(float x);
20086 long double sinhl(long double x);
20087 double tanh(double x);
20088 float tanhf(float x);
20089 long double tanhl(long double x);
20090 double exp(double x);
20091 float expf(float x);
20092 long double expl(long double x);
20093 double exp2(double x);
20094 float exp2f(float x);
20095 long double exp2l(long double x);
20096 double expm1(double x);
20097 float expm1f(float x);
20098 long double expm1l(long double x);
20099 double frexp(double value, int *exp);
20100 float frexpf(float value, int *exp);
20101 long double frexpl(long double value, int *exp);
20102 int ilogb(double x);
20103 int ilogbf(float x);
20104 int ilogbl(long double x);
20105 double ldexp(double x, int exp);
20106 float ldexpf(float x, int exp);
20107 long double ldexpl(long double x, int exp);
20108 double log(double x);
20109 float logf(float x);
20110 long double logl(long double x);
20111 double log10(double x);
20112 float log10f(float x);
20113 long double log10l(long double x);
20114 double log1p(double x);
20115 float log1pf(float x);
20116 long double log1pl(long double x);
20117 double log2(double x);
20118 float log2f(float x);
20119 long double log2l(long double x);
20120 double logb(double x);
20121 float logbf(float x);
20122 long double logbl(long double x);
20123 double modf(double value, double *iptr);
20124 float modff(float value, float *iptr);
20125 long double modfl(long double value, long double *iptr);
20126 double scalbn(double x, int n);
20127 float scalbnf(float x, int n);
20128 long double scalbnl(long double x, int n);
20129 double scalbln(double x, long int n);
20130 float scalblnf(float x, long int n);
20131 long double scalblnl(long double x, long int n);
20132 double cbrt(double x);
20133 float cbrtf(float x);
20134 long double cbrtl(long double x);
20135 double fabs(double x);
20136 float fabsf(float x);
20137 long double fabsl(long double x);
20138 double hypot(double x, double y);
20139 float hypotf(float x, float y);
20140 long double hypotl(long double x, long double y);
20141 double pow(double x, double y);
20142 float powf(float x, float y);
20143 long double powl(long double x, long double y);
20144 double sqrt(double x);
20145 float sqrtf(float x);
20146 long double sqrtl(long double x);
20147 double erf(double x);
20148 float erff(float x);
20149 long double erfl(long double x);
20150 double erfc(double x);
20151 float erfcf(float x);
20152 long double erfcl(long double x);
20153 double lgamma(double x);
20154 float lgammaf(float x);
20155 long double lgammal(long double x);
20156 double tgamma(double x);
20157 float tgammaf(float x);
20158 long double tgammal(long double x);
20159 double ceil(double x);
20160 float ceilf(float x);
20161 long double ceill(long double x);
20162 double floor(double x);
20163 float floorf(float x);
20164 long double floorl(long double x);
20165 double nearbyint(double x);
20166 float nearbyintf(float x);
20167 long double nearbyintl(long double x);
20168 double rint(double x);
20169 float rintf(float x);
20170 long double rintl(long double x);
20171 long int lrint(double x);
20172 long int lrintf(float x);
20173 long int lrintl(long double x);
20174 long long int llrint(double x);
20175 long long int llrintf(float x);
20176 long long int llrintl(long double x);
20177 double round(double x);
20178 float roundf(float x);
20179 long double roundl(long double x);
20180 long int lround(double x);
20181 long int lroundf(float x);
20182 long int lroundl(long double x);
20183 long long int llround(double x);
20184 long long int llroundf(float x);
20185 long long int llroundl(long double x);
20186 double trunc(double x);
20187 float truncf(float x);
20188 long double truncl(long double x);
20189 double fmod(double x, double y);
20190 float fmodf(float x, float y);
20191 long double fmodl(long double x, long double y);
20192 double remainder(double x, double y);
20193 float remainderf(float x, float y);
20194 long double remainderl(long double x, long double y);
20195 double remquo(double x, double y, int *quo);
20196 float remquof(float x, float y, int *quo);
20197 long double remquol(long double x, long double y,
20199 double copysign(double x, double y);
20200 float copysignf(float x, float y);
20201 long double copysignl(long double x, long double y);
20202 double nan(const char *tagp);
20203 float nanf(const char *tagp);
20204 long double nanl(const char *tagp);
20205 double nextafter(double x, double y);
20206 float nextafterf(float x, float y);
20207 long double nextafterl(long double x, long double y);
20208 double nexttoward(double x, long double y);
20209 float nexttowardf(float x, long double y);
20210 long double nexttowardl(long double x, long double y);
20211 double fdim(double x, double y);
20212 float fdimf(float x, float y);
20213 long double fdiml(long double x, long double y);
20214 double fmax(double x, double y);
20215 float fmaxf(float x, float y);
20216 long double fmaxl(long double x, long double y);
20217 double fmin(double x, double y);
20218 float fminf(float x, float y);
20219 long double fminl(long double x, long double y);
20220 double fma(double x, double y, double z);
20221 float fmaf(float x, float y, float z);
20222 long double fmal(long double x, long double y,
20224 int isgreater(real-floating x, real-floating y);
20225 int isgreaterequal(real-floating x, real-floating y);
20226 int isless(real-floating x, real-floating y);
20227 int islessequal(real-floating x, real-floating y);
20228 int islessgreater(real-floating x, real-floating y);
20229 int isunordered(real-floating x, real-floating y);</pre>
20231 <a name="B.12" href="#B.12"><h3>B.12 Nonlocal jumps <setjmp.h></h3></a>
20234 int setjmp(jmp_buf env);
20235 void longjmp(jmp_buf env, int val);</pre>
20237 <a name="B.13" href="#B.13"><h3>B.13 Signal handling <signal.h></h3></a>
20239 sig_atomic_t SIG_IGN SIGILL SIGTERM
20240 SIG_DFL SIGABRT SIGINT
20241 SIG_ERR SIGFPE SIGSEGV
20242 void (*signal(int sig, void (*func)(int)))(int);
20243 int raise(int sig);</pre>
20245 <a name="B.14" href="#B.14"><h3>B.14 Variable arguments <stdarg.h></h3></a>
20248 type va_arg(va_list ap, type);
20249 void va_copy(va_list dest, va_list src);
20250 void va_end(va_list ap);
20251 void va_start(va_list ap, parmN);</pre>
20253 <a name="B.15" href="#B.15"><h3>B.15 Boolean type and values <stdbool.h></h3></a>
20254 <!--page 441 indent 0-->
20259 __bool_true_false_are_defined</pre>
20261 <a name="B.16" href="#B.16"><h3>B.16 Common definitions <stddef.h></h3></a>
20263 ptrdiff_t size_t wchar_t NULL
20264 offsetof(type, member-designator)</pre>
20266 <a name="B.17" href="#B.17"><h3>B.17 Integer types <stdint.h></h3></a>
20268 intN_t INT_LEASTN_MIN PTRDIFF_MAX
20269 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
20270 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
20271 uint_leastN_t INT_FASTN_MIN SIZE_MAX
20272 int_fastN_t INT_FASTN_MAX WCHAR_MIN
20273 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
20274 intptr_t INTPTR_MIN WINT_MIN
20275 uintptr_t INTPTR_MAX WINT_MAX
20276 intmax_t UINTPTR_MAX INTN_C(value)
20277 uintmax_t INTMAX_MIN UINTN_C(value)
20278 INTN_MIN INTMAX_MAX INTMAX_C(value)
20279 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
20280 UINTN_MAX PTRDIFF_MIN</pre>
20282 <a name="B.18" href="#B.18"><h3>B.18 Input/output <stdio.h></h3></a>
20283 <!--page 442 indent -1-->
20284 <!--page 443 indent 0-->
20286 size_t _IOLBF FILENAME_MAX TMP_MAX
20287 FILE _IONBF L_tmpnam stderr
20288 fpos_t BUFSIZ SEEK_CUR stdin
20289 NULL EOF SEEK_END stdout
20290 _IOFBF FOPEN_MAX SEEK_SET
20291 int remove(const char *filename);
20292 int rename(const char *old, const char *new);
20293 FILE *tmpfile(void);
20294 char *tmpnam(char *s);
20295 int fclose(FILE *stream);
20296 int fflush(FILE *stream);
20297 FILE *fopen(const char * restrict filename,
20298 const char * restrict mode);
20299 FILE *freopen(const char * restrict filename,
20300 const char * restrict mode,
20301 FILE * restrict stream);
20302 void setbuf(FILE * restrict stream,
20303 char * restrict buf);
20304 int setvbuf(FILE * restrict stream,
20305 char * restrict buf,
20306 int mode, size_t size);
20307 int fprintf(FILE * restrict stream,
20308 const char * restrict format, ...);
20309 int fscanf(FILE * restrict stream,
20310 const char * restrict format, ...);
20311 int printf(const char * restrict format, ...);
20312 int scanf(const char * restrict format, ...);
20313 int snprintf(char * restrict s, size_t n,
20314 const char * restrict format, ...);
20315 int sprintf(char * restrict s,
20316 const char * restrict format, ...);
20317 int sscanf(const char * restrict s,
20318 const char * restrict format, ...);
20319 int vfprintf(FILE * restrict stream,
20320 const char * restrict format, va_list arg);
20321 int vfscanf(FILE * restrict stream,
20322 const char * restrict format, va_list arg);
20323 int vprintf(const char * restrict format, va_list arg);
20324 int vscanf(const char * restrict format, va_list arg);
20325 int vsnprintf(char * restrict s, size_t n,
20326 const char * restrict format, va_list arg);
20327 int vsprintf(char * restrict s,
20328 const char * restrict format, va_list arg);
20329 int vsscanf(const char * restrict s,
20330 const char * restrict format, va_list arg);
20331 int fgetc(FILE *stream);
20332 char *fgets(char * restrict s, int n,
20333 FILE * restrict stream);
20334 int fputc(int c, FILE *stream);
20335 int fputs(const char * restrict s,
20336 FILE * restrict stream);
20337 int getc(FILE *stream);
20339 char *gets(char *s);
20340 int putc(int c, FILE *stream);
20341 int putchar(int c);
20342 int puts(const char *s);
20343 int ungetc(int c, FILE *stream);
20344 size_t fread(void * restrict ptr,
20345 size_t size, size_t nmemb,
20346 FILE * restrict stream);
20347 size_t fwrite(const void * restrict ptr,
20348 size_t size, size_t nmemb,
20349 FILE * restrict stream);
20350 int fgetpos(FILE * restrict stream,
20351 fpos_t * restrict pos);
20352 int fseek(FILE *stream, long int offset, int whence);
20353 int fsetpos(FILE *stream, const fpos_t *pos);
20354 long int ftell(FILE *stream);
20355 void rewind(FILE *stream);
20356 void clearerr(FILE *stream);
20357 int feof(FILE *stream);
20358 int ferror(FILE *stream);
20359 void perror(const char *s);</pre>
20361 <a name="B.19" href="#B.19"><h3>B.19 General utilities <stdlib.h></h3></a>
20362 <!--page 444 indent -1-->
20363 <!--page 445 indent 0-->
20365 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
20366 wchar_t lldiv_t EXIT_SUCCESS
20367 div_t NULL RAND_MAX
20368 double atof(const char *nptr);
20369 int atoi(const char *nptr);
20370 long int atol(const char *nptr);
20371 long long int atoll(const char *nptr);
20372 double strtod(const char * restrict nptr,
20373 char ** restrict endptr);
20374 float strtof(const char * restrict nptr,
20375 char ** restrict endptr);
20376 long double strtold(const char * restrict nptr,
20377 char ** restrict endptr);
20378 long int strtol(const char * restrict nptr,
20379 char ** restrict endptr, int base);
20380 long long int strtoll(const char * restrict nptr,
20381 char ** restrict endptr, int base);
20382 unsigned long int strtoul(
20383 const char * restrict nptr,
20384 char ** restrict endptr, int base);
20385 unsigned long long int strtoull(
20386 const char * restrict nptr,
20387 char ** restrict endptr, int base);
20389 void srand(unsigned int seed);
20390 void *calloc(size_t nmemb, size_t size);
20391 void free(void *ptr);
20392 void *malloc(size_t size);
20393 void *realloc(void *ptr, size_t size);
20395 int atexit(void (*func)(void));
20396 void exit(int status);
20397 void _Exit(int status);
20398 char *getenv(const char *name);
20399 int system(const char *string);
20400 void *bsearch(const void *key, const void *base,
20401 size_t nmemb, size_t size,
20402 int (*compar)(const void *, const void *));
20403 void qsort(void *base, size_t nmemb, size_t size,
20404 int (*compar)(const void *, const void *));
20406 long int labs(long int j);
20407 long long int llabs(long long int j);
20408 div_t div(int numer, int denom);
20409 ldiv_t ldiv(long int numer, long int denom);
20410 lldiv_t lldiv(long long int numer,
20411 long long int denom);
20412 int mblen(const char *s, size_t n);
20413 int mbtowc(wchar_t * restrict pwc,
20414 const char * restrict s, size_t n);
20415 int wctomb(char *s, wchar_t wchar);
20416 size_t mbstowcs(wchar_t * restrict pwcs,
20417 const char * restrict s, size_t n);
20418 size_t wcstombs(char * restrict s,
20419 const wchar_t * restrict pwcs, size_t n);</pre>
20421 <a name="B.20" href="#B.20"><h3>B.20 String handling <string.h></h3></a>
20422 <!--page 446 indent 0-->
20426 void *memcpy(void * restrict s1,
20427 const void * restrict s2, size_t n);
20428 void *memmove(void *s1, const void *s2, size_t n);
20429 char *strcpy(char * restrict s1,
20430 const char * restrict s2);
20431 char *strncpy(char * restrict s1,
20432 const char * restrict s2, size_t n);
20433 char *strcat(char * restrict s1,
20434 const char * restrict s2);
20435 char *strncat(char * restrict s1,
20436 const char * restrict s2, size_t n);
20437 int memcmp(const void *s1, const void *s2, size_t n);
20438 int strcmp(const char *s1, const char *s2);
20439 int strcoll(const char *s1, const char *s2);
20440 int strncmp(const char *s1, const char *s2, size_t n);
20441 size_t strxfrm(char * restrict s1,
20442 const char * restrict s2, size_t n);
20443 void *memchr(const void *s, int c, size_t n);
20444 char *strchr(const char *s, int c);
20445 size_t strcspn(const char *s1, const char *s2);
20446 char *strpbrk(const char *s1, const char *s2);
20447 char *strrchr(const char *s, int c);
20448 size_t strspn(const char *s1, const char *s2);
20449 char *strstr(const char *s1, const char *s2);
20450 char *strtok(char * restrict s1,
20451 const char * restrict s2);
20452 void *memset(void *s, int c, size_t n);
20453 char *strerror(int errnum);
20454 size_t strlen(const char *s);</pre>
20456 <a name="B.21" href="#B.21"><h3>B.21 Type-generic math <tgmath.h></h3></a>
20458 acos sqrt fmod nextafter
20459 asin fabs frexp nexttoward
20460 atan atan2 hypot remainder
20461 acosh cbrt ilogb remquo
20462 asinh ceil ldexp rint
20463 atanh copysign lgamma round
20464 cos erf llrint scalbn
20465 sin erfc llround scalbln
20466 tan exp2 log10 tgamma
20467 cosh expm1 log1p trunc
20468 sinh fdim log2 carg
20469 tanh floor logb cimag
20471 log fmax lround cproj
20472 pow fmin nearbyint creal</pre>
20474 <a name="B.22" href="#B.22"><h3>B.22 Date and time <time.h></h3></a>
20475 <!--page 447 indent 0-->
20478 CLOCKS_PER_SEC clock_t struct tm
20479 clock_t clock(void);
20480 double difftime(time_t time1, time_t time0);
20481 time_t mktime(struct tm *timeptr);
20482 time_t time(time_t *timer);
20483 char *asctime(const struct tm *timeptr);
20484 char *ctime(const time_t *timer);
20485 struct tm *gmtime(const time_t *timer);
20486 struct tm *localtime(const time_t *timer);
20487 size_t strftime(char * restrict s,
20489 const char * restrict format,
20490 const struct tm * restrict timeptr);</pre>
20492 <a name="B.23" href="#B.23"><h3>B.23 Extended multibyte/wide character utilities <wchar.h></h3></a>
20493 <!--page 448 indent -1-->
20494 <!--page 449 indent 0-->
20496 wchar_t wint_t WCHAR_MAX
20497 size_t struct tm WCHAR_MIN
20498 mbstate_t NULL WEOF
20499 int fwprintf(FILE * restrict stream,
20500 const wchar_t * restrict format, ...);
20501 int fwscanf(FILE * restrict stream,
20502 const wchar_t * restrict format, ...);
20503 int swprintf(wchar_t * restrict s, size_t n,
20504 const wchar_t * restrict format, ...);
20505 int swscanf(const wchar_t * restrict s,
20506 const wchar_t * restrict format, ...);
20507 int vfwprintf(FILE * restrict stream,
20508 const wchar_t * restrict format, va_list arg);
20509 int vfwscanf(FILE * restrict stream,
20510 const wchar_t * restrict format, va_list arg);
20511 int vswprintf(wchar_t * restrict s, size_t n,
20512 const wchar_t * restrict format, va_list arg);
20513 int vswscanf(const wchar_t * restrict s,
20514 const wchar_t * restrict format, va_list arg);
20515 int vwprintf(const wchar_t * restrict format,
20517 int vwscanf(const wchar_t * restrict format,
20519 int wprintf(const wchar_t * restrict format, ...);
20520 int wscanf(const wchar_t * restrict format, ...);
20521 wint_t fgetwc(FILE *stream);
20522 wchar_t *fgetws(wchar_t * restrict s, int n,
20523 FILE * restrict stream);
20524 wint_t fputwc(wchar_t c, FILE *stream);
20525 int fputws(const wchar_t * restrict s,
20526 FILE * restrict stream);
20527 int fwide(FILE *stream, int mode);
20528 wint_t getwc(FILE *stream);
20529 wint_t getwchar(void);
20530 wint_t putwc(wchar_t c, FILE *stream);
20531 wint_t putwchar(wchar_t c);
20532 wint_t ungetwc(wint_t c, FILE *stream);
20533 double wcstod(const wchar_t * restrict nptr,
20534 wchar_t ** restrict endptr);
20535 float wcstof(const wchar_t * restrict nptr,
20536 wchar_t ** restrict endptr);
20537 long double wcstold(const wchar_t * restrict nptr,
20538 wchar_t ** restrict endptr);
20539 long int wcstol(const wchar_t * restrict nptr,
20540 wchar_t ** restrict endptr, int base);
20541 long long int wcstoll(const wchar_t * restrict nptr,
20542 wchar_t ** restrict endptr, int base);
20543 unsigned long int wcstoul(const wchar_t * restrict nptr,
20544 wchar_t ** restrict endptr, int base);
20545 unsigned long long int wcstoull(
20546 const wchar_t * restrict nptr,
20547 wchar_t ** restrict endptr, int base);
20548 wchar_t *wcscpy(wchar_t * restrict s1,
20549 const wchar_t * restrict s2);
20550 wchar_t *wcsncpy(wchar_t * restrict s1,
20551 const wchar_t * restrict s2, size_t n);
20552 wchar_t *wmemcpy(wchar_t * restrict s1,
20553 const wchar_t * restrict s2, size_t n);
20554 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
20556 wchar_t *wcscat(wchar_t * restrict s1,
20557 const wchar_t * restrict s2);
20558 wchar_t *wcsncat(wchar_t * restrict s1,
20559 const wchar_t * restrict s2, size_t n);
20560 int wcscmp(const wchar_t *s1, const wchar_t *s2);
20561 int wcscoll(const wchar_t *s1, const wchar_t *s2);
20562 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
20564 size_t wcsxfrm(wchar_t * restrict s1,
20565 const wchar_t * restrict s2, size_t n);
20566 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
20568 wchar_t *wcschr(const wchar_t *s, wchar_t c);
20569 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
20570 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2); *
20571 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
20572 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
20573 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
20574 wchar_t *wcstok(wchar_t * restrict s1,
20575 const wchar_t * restrict s2,
20576 wchar_t ** restrict ptr);
20577 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
20578 size_t wcslen(const wchar_t *s);
20579 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
20580 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
20581 const wchar_t * restrict format,
20582 const struct tm * restrict timeptr);
20583 wint_t btowc(int c);
20584 int wctob(wint_t c);
20585 int mbsinit(const mbstate_t *ps);
20586 size_t mbrlen(const char * restrict s, size_t n,
20587 mbstate_t * restrict ps);
20588 size_t mbrtowc(wchar_t * restrict pwc,
20589 const char * restrict s, size_t n,
20590 mbstate_t * restrict ps);
20591 size_t wcrtomb(char * restrict s, wchar_t wc,
20592 mbstate_t * restrict ps);
20593 size_t mbsrtowcs(wchar_t * restrict dst,
20594 const char ** restrict src, size_t len,
20595 mbstate_t * restrict ps);
20596 size_t wcsrtombs(char * restrict dst,
20597 const wchar_t ** restrict src, size_t len,
20598 mbstate_t * restrict ps);</pre>
20600 <a name="B.24" href="#B.24"><h3>B.24 Wide character classification and mapping utilities <wctype.h></h3></a>
20601 <!--page 450 indent -1-->
20602 <!--page 451 indent 4-->
20604 wint_t wctrans_t wctype_t WEOF
20605 int iswalnum(wint_t wc);
20606 int iswalpha(wint_t wc);
20607 int iswblank(wint_t wc);
20608 int iswcntrl(wint_t wc);
20609 int iswdigit(wint_t wc);
20610 int iswgraph(wint_t wc);
20611 int iswlower(wint_t wc);
20612 int iswprint(wint_t wc);
20613 int iswpunct(wint_t wc);
20614 int iswspace(wint_t wc);
20615 int iswupper(wint_t wc);
20616 int iswxdigit(wint_t wc);
20617 int iswctype(wint_t wc, wctype_t desc);
20618 wctype_t wctype(const char *property);
20619 wint_t towlower(wint_t wc);
20620 wint_t towupper(wint_t wc);
20621 wint_t towctrans(wint_t wc, wctrans_t desc);
20622 wctrans_t wctrans(const char *property);</pre>
20624 <a name="C" href="#C"><h2>Annex C</h2></a>
20628 Sequence points</pre>
20629 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
20631 <li> The call to a function, after the arguments have been evaluated (<a href="#6.5.2.2">6.5.2.2</a>).
20632 <li> The end of the first operand of the following operators: logical AND && (<a href="#6.5.13">6.5.13</a>);
20633 logical OR || (<a href="#6.5.14">6.5.14</a>); conditional ? (<a href="#6.5.15">6.5.15</a>); comma , (<a href="#6.5.17">6.5.17</a>).
20634 <li> The end of a full declarator: declarators (<a href="#6.7.5">6.7.5</a>);
20635 <li> The end of a full expression: an initializer (<a href="#6.7.8">6.7.8</a>); the expression in an expression
20636 statement (<a href="#6.8.3">6.8.3</a>); the controlling expression of a selection statement (if or switch)
20637 (<a href="#6.8.4">6.8.4</a>); the controlling expression of a while or do statement (<a href="#6.8.5">6.8.5</a>); each of the
20638 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the expression in a return statement
20639 (<a href="#6.8.6.4">6.8.6.4</a>).
20640 <li> Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
20641 <li> After the actions associated with each formatted input/output function conversion
20642 specifier (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
20643 <li> Immediately before and immediately after each call to a comparison function, and
20644 also between any call to a comparison function and any movement of the objects
20645 passed as arguments to that call (<a href="#7.20.5">7.20.5</a>).
20646 <!--page 452 indent 4-->
20649 <a name="D" href="#D"><h2>Annex D</h2></a>
20653 Universal character names for identifiers</pre>
20654 This clause lists the hexadecimal code values that are valid in universal character names
20657 This table is reproduced unchanged from ISO/IEC TR 10176:1998, produced by ISO/IEC
20658 JTC 1/SC 22/WG 20, except for the omission of ranges that are part of the basic character
20660 Latin: 00AA, 00BA, 00C0-00D6, 00D8-00F6, 00F8-01F5, 01FA-0217,
20662 0250-02A8, 1E00-1E9B, 1EA0-1EF9, 207F</pre>
20663 Greek: 0386, 0388-038A, 038C, 038E-03A1, 03A3-03CE, 03D0-03D6,
20665 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 1F00-1F15, 1F18-1F1D,
20666 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D,
20667 1F5F-1F7D, 1F80-1FB4, 1FB6-1FBC, 1FC2-1FC4, 1FC6-1FCC,
20668 1FD0-1FD3, 1FD6-1FDB, 1FE0-1FEC, 1FF2-1FF4, 1FF6-1FFC</pre>
20669 Cyrillic: 0401-040C, 040E-044F, 0451-045C, 045E-0481, 0490-04C4,
20671 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9</pre>
20672 Armenian: 0531-0556, 0561-0587
20673 Hebrew: 05B0-05B9, 05BB-05BD, 05BF, 05C1-05C2, 05D0-05EA,
20676 Arabic: 0621-063A, 0640-0652, 0670-06B7, 06BA-06BE, 06C0-06CE,
20678 06D0-06DC, 06E5-06E8, 06EA-06ED</pre>
20679 Devanagari: 0901-0903, 0905-0939, 093E-094D, 0950-0952, 0958-0963
20680 Bengali: 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0,
20682 09B2, 09B6-09B9, 09BE-09C4, 09C7-09C8, 09CB-09CD,
20683 09DC-09DD, 09DF-09E3, 09F0-09F1</pre>
20684 Gurmukhi: 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30,
20686 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3E-0A42, 0A47-0A48,
20687 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A74</pre>
20688 Gujarati: 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F-0A91, 0A93-0AA8,
20690 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABD-0AC5,
20691 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0</pre>
20692 Oriya: 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30,
20693 <!--page 453 indent 0-->
20695 0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D,
20696 0B5C-0B5D, 0B5F-0B61</pre>
20697 Tamil: 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A,
20699 0B9C, 0B9E-0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5,
20700 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD</pre>
20701 Telugu: 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33,
20703 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C60-0C61</pre>
20704 Kannada: 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3,
20706 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CDE,
20708 Malayalam: 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39,
20710 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D60-0D61</pre>
20711 Thai: 0E01-0E3A, 0E40-0E5B
20712 Lao: 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97,
20714 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB,
20715 0EAD-0EAE, 0EB0-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6,
20716 0EC8-0ECD, 0EDC-0EDD</pre>
20717 Tibetan: 0F00, 0F18-0F19, 0F35, 0F37, 0F39, 0F3E-0F47, 0F49-0F69,
20719 0F71-0F84, 0F86-0F8B, 0F90-0F95, 0F97, 0F99-0FAD,
20720 0FB1-0FB7, 0FB9</pre>
20721 Georgian: 10A0-10C5, 10D0-10F6
20722 Hiragana: 3041-3093, 309B-309C
20723 Katakana: 30A1-30F6, 30FB-30FC
20724 Bopomofo: 3105-312C
20725 CJK Unified Ideographs: 4E00-9FA5
20727 Digits: 0660-0669, 06F0-06F9, 0966-096F, 09E6-09EF, 0A66-0A6F,
20729 0AE6-0AEF, 0B66-0B6F, 0BE7-0BEF, 0C66-0C6F, 0CE6-0CEF,
20730 0D66-0D6F, 0E50-0E59, 0ED0-0ED9, 0F20-0F33</pre>
20731 Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1,
20732 <!--page 454 indent 4-->
20734 02E0-02E4, 037A, 0559, 093D, 0B3D, 1FBE, 203F-2040, 2102,
20735 2107, 210A-2113, 2115, 2118-211D, 2124, 2126, 2128, 212A-2131,
20736 2133-2138, 2160-2182, 3005-3007, 3021-3029</pre>
20738 <a name="E" href="#E"><h2>Annex E</h2></a>
20742 Implementation limits</pre>
20743 The contents of the header <limits.h> are given below, in alphabetical order. The
20744 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
20745 with the same sign. The values shall all be constant expressions suitable for use in #if
20746 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
20750 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
20751 #define CHAR_MIN 0 or SCHAR_MIN
20752 #define INT_MAX +32767
20753 #define INT_MIN -32767
20754 #define LONG_MAX +2147483647
20755 #define LONG_MIN -2147483647
20756 #define LLONG_MAX +9223372036854775807
20757 #define LLONG_MIN -9223372036854775807
20758 #define MB_LEN_MAX 1
20759 #define SCHAR_MAX +127
20760 #define SCHAR_MIN -127
20761 #define SHRT_MAX +32767
20762 #define SHRT_MIN -32767
20763 #define UCHAR_MAX 255
20764 #define USHRT_MAX 65535
20765 #define UINT_MAX 65535
20766 #define ULONG_MAX 4294967295
20767 #define ULLONG_MAX 18446744073709551615</pre>
20768 The contents of the header <float.h> are given below. All integer values, except
20769 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
20770 directives; all floating values shall be constant expressions. The components are
20771 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
20773 The values given in the following list shall be replaced by implementation-defined
20777 #define FLT_EVAL_METHOD
20778 #define FLT_ROUNDS</pre>
20779 The values given in the following list shall be replaced by implementation-defined
20780 constant expressions that are greater or equal in magnitude (absolute value) to those
20781 shown, with the same sign:
20782 <!--page 455 indent 4-->
20786 #define DBL_MANT_DIG
20787 #define DBL_MAX_10_EXP +37
20788 #define DBL_MAX_EXP
20789 #define DBL_MIN_10_EXP -37
20790 #define DBL_MIN_EXP
20791 #define DECIMAL_DIG 10
20793 #define FLT_MANT_DIG
20794 #define FLT_MAX_10_EXP +37
20795 #define FLT_MAX_EXP
20796 #define FLT_MIN_10_EXP -37
20797 #define FLT_MIN_EXP
20798 #define FLT_RADIX 2
20799 #define LDBL_DIG 10
20800 #define LDBL_MANT_DIG
20801 #define LDBL_MAX_10_EXP +37
20802 #define LDBL_MAX_EXP
20803 #define LDBL_MIN_10_EXP -37
20804 #define LDBL_MIN_EXP</pre>
20805 The values given in the following list shall be replaced by implementation-defined
20806 constant expressions with values that are greater than or equal to those shown:
20809 #define DBL_MAX 1E+37
20810 #define FLT_MAX 1E+37
20811 #define LDBL_MAX 1E+37</pre>
20812 The values given in the following list shall be replaced by implementation-defined
20813 constant expressions with (positive) values that are less than or equal to those shown:
20814 <!--page 456 indent 4-->
20816 #define DBL_EPSILON 1E-9
20817 #define DBL_MIN 1E-37
20818 #define FLT_EPSILON 1E-5
20819 #define FLT_MIN 1E-37
20820 #define LDBL_EPSILON 1E-9
20821 #define LDBL_MIN 1E-37</pre>
20823 <a name="F" href="#F"><h2>Annex F</h2></a>
20826 IEC 60559 floating-point arithmetic</pre>
20828 <a name="F.1" href="#F.1"><h3>F.1 Introduction</h3></a>
20830 This annex specifies C language support for the IEC 60559 floating-point standard. The
20831 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
20832 microprocessor systems, second edition (IEC 60559:1989), previously designated
20833 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
20834 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
20835 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
20836 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
20837 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
20838 defines __STDC_IEC_559__ shall conform to the specifications in this annex. Where
20839 a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified
20840 behavior is adopted by reference, unless stated otherwise.
20842 <a name="F.2" href="#F.2"><h3>F.2 Types</h3></a>
20844 The C floating types match the IEC 60559 formats as follows:
20846 <li> The float type matches the IEC 60559 single format.
20847 <li> The double type matches the IEC 60559 double format.
20848 <li> The long double type matches an IEC 60559 extended format,<sup><a href="#note307"><b>307)</b></a></sup> else a
20849 non-IEC 60559 extended format, else the IEC 60559 double format.
20851 Any non-IEC 60559 extended format used for the long double type shall have more
20852 precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note308"><b>308)</b></a></sup>
20853 Recommended practice
20855 The long double type should match an IEC 60559 extended format.
20860 <!--page 457 indent 4-->
20863 <p><a name="note307">307)</a> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
20864 and quadruple 128-bit IEC 60559 formats.
20866 <p><a name="note308">308)</a> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
20870 <a name="F.2.1" href="#F.2.1"><h4>F.2.1 Infinities, signed zeros, and NaNs</h4></a>
20872 This specification does not define the behavior of signaling NaNs.<sup><a href="#note309"><b>309)</b></a></sup> It generally uses
20873 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
20874 functions in <math.h> provide designations for IEC 60559 NaNs and infinities.
20877 <p><a name="note309">309)</a> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
20878 sufficient for closure of the arithmetic.
20881 <a name="F.3" href="#F.3"><h3>F.3 Operators and functions</h3></a>
20883 C operators and functions provide IEC 60559 required and recommended facilities as
20886 <li> The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
20888 <li> The sqrt functions in <math.h> provide the IEC 60559 square root operation.
20889 <li> The remainder functions in <math.h> provide the IEC 60559 remainder
20890 operation. The remquo functions in <math.h> provide the same operation but
20891 with additional information.
20892 <li> The rint functions in <math.h> provide the IEC 60559 operation that rounds a
20893 floating-point number to an integer value (in the same precision). The nearbyint
20894 functions in <math.h> provide the nearbyinteger function recommended in the
20895 Appendix to ANSI/IEEE 854.
20896 <li> The conversions for floating types provide the IEC 60559 conversions between
20897 floating-point precisions.
20898 <li> The conversions from integer to floating types provide the IEC 60559 conversions
20899 from integer to floating point.
20900 <li> The conversions from floating to integer types provide IEC 60559-like conversions
20901 but always round toward zero.
20902 <li> The lrint and llrint functions in <math.h> provide the IEC 60559
20903 conversions, which honor the directed rounding mode, from floating point to the
20904 long int and long long int integer formats. The lrint and llrint
20905 functions can be used to implement IEC 60559 conversions from floating to other
20907 <li> The translation time conversion of floating constants and the strtod, strtof,
20908 strtold, fprintf, fscanf, and related library functions in <stdlib.h>,
20909 <stdio.h>, and <wchar.h> provide IEC 60559 binary-decimal conversions. The
20910 strtold function in <stdlib.h> provides the conv function recommended in the
20911 Appendix to ANSI/IEEE 854.
20913 <!--page 458 indent 0-->
20914 <li> The relational and equality operators provide IEC 60559 comparisons. IEC 60559
20915 identifies a need for additional comparison predicates to facilitate writing code that
20916 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
20917 isless, islessequal, islessgreater, and isunordered) in <math.h>
20918 supplement the language operators to address this need. The islessgreater and
20919 isunordered macros provide respectively a quiet version of the <> predicate and
20920 the unordered predicate recommended in the Appendix to IEC 60559.
20921 <li> The feclearexcept, feraiseexcept, and fetestexcept functions in
20922 <fenv.h> provide the facility to test and alter the IEC 60559 floating-point
20923 exception status flags. The fegetexceptflag and fesetexceptflag
20924 functions in <fenv.h> provide the facility to save and restore all five status flags at
20925 one time. These functions are used in conjunction with the type fexcept_t and the
20926 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
20927 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <fenv.h>.
20928 <li> The fegetround and fesetround functions in <fenv.h> provide the facility
20929 to select among the IEC 60559 directed rounding modes represented by the rounding
20930 direction macros in <fenv.h> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
20931 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
20932 IEC 60559 directed rounding modes.
20933 <li> The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
20934 <fenv.h> provide a facility to manage the floating-point environment, comprising
20935 the IEC 60559 status flags and control modes.
20936 <li> The copysign functions in <math.h> provide the copysign function
20937 recommended in the Appendix to IEC 60559.
20938 <li> The unary minus (-) operator provides the minus (-) operation recommended in the
20939 Appendix to IEC 60559.
20940 <li> The scalbn and scalbln functions in <math.h> provide the scalb function
20941 recommended in the Appendix to IEC 60559.
20942 <li> The logb functions in <math.h> provide the logb function recommended in the
20943 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
20944 <li> The nextafter and nexttoward functions in <math.h> provide the nextafter
20945 function recommended in the Appendix to IEC 60559 (but with a minor change to
20946 better handle signed zeros).
20947 <li> The isfinite macro in <math.h> provides the finite function recommended in
20948 the Appendix to IEC 60559.
20949 <li> The isnan macro in <math.h> provides the isnan function recommended in the
20950 Appendix to IEC 60559.
20951 <!--page 459 indent 4-->
20952 <li> The signbit macro and the fpclassify macro in <math.h>, used in
20953 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
20954 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
20955 function recommended in the Appendix to IEC 60559 (except that the classification
20956 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
20959 <a name="F.4" href="#F.4"><h3>F.4 Floating to integer conversion</h3></a>
20961 If the floating value is infinite or NaN or if the integral part of the floating value exceeds
20962 the range of the integer type, then the ''invalid'' floating-point exception is raised and the
20963 resulting value is unspecified. Whether conversion of non-integer floating values whose
20964 integral part is within the range of the integer type raises the ''inexact'' floating-point
20965 exception is unspecified.<sup><a href="#note310"><b>310)</b></a></sup>
20968 <p><a name="note310">310)</a> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
20969 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
20970 cases where it matters, library functions can be used to effect such conversions with or without raising
20971 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
20975 <a name="F.5" href="#F.5"><h3>F.5 Binary-decimal conversion</h3></a>
20977 Conversion from the widest supported IEC 60559 format to decimal with
20978 DECIMAL_DIG digits and back is the identity function.<sup><a href="#note311"><b>311)</b></a></sup>
20980 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
20981 particular, conversion between any supported IEC 60559 format and decimal with
20982 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
20983 rounding mode), which assures that conversion from the widest supported IEC 60559
20984 format to decimal with DECIMAL_DIG digits and back is the identity function.
20986 Functions such as strtod that convert character sequences to floating types honor the
20987 rounding direction. Hence, if the rounding direction might be upward or downward, the
20988 implementation cannot convert a minus-signed sequence by negating the converted
20994 <!--page 460 indent 4-->
20997 <p><a name="note311">311)</a> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
20998 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
20999 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
21000 DBL_DIG are 18 and 15, respectively, for these formats.)
21003 <a name="F.6" href="#F.6"><h3>F.6 Contracted expressions</h3></a>
21005 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
21006 rounding directions in a manner consistent with the basic arithmetic operations covered
21008 Recommended practice
21010 A contracted expression should raise floating-point exceptions in a manner generally
21011 consistent with the basic arithmetic operations. A contracted expression should deliver
21012 the same value as its uncontracted counterpart, else should be correctly rounded (once).
21014 <a name="F.7" href="#F.7"><h3>F.7 Floating-point environment</h3></a>
21016 The floating-point environment defined in <fenv.h> includes the IEC 60559 floating-
21017 point exception status flags and directed-rounding control modes. It includes also
21018 IEC 60559 dynamic rounding precision and trap enablement modes, if the
21019 implementation supports them.<sup><a href="#note312"><b>312)</b></a></sup>
21022 <p><a name="note312">312)</a> This specification does not require dynamic rounding precision nor trap enablement modes.
21025 <a name="F.7.1" href="#F.7.1"><h4>F.7.1 Environment management</h4></a>
21027 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
21028 status flags, and that rounding control modes can be set explicitly to affect result values of
21029 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
21030 <fenv.h>) is ''on'', these changes to the floating-point state are treated as side effects
21031 which respect sequence points.<sup><a href="#note313"><b>313)</b></a></sup>
21034 <p><a name="note313">313)</a> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
21035 point control modes will be the default ones and the floating-point status flags will not be tested,
21036 which allows certain optimizations (see <a href="#F.8">F.8</a>).
21039 <a name="F.7.2" href="#F.7.2"><h4>F.7.2 Translation</h4></a>
21041 During translation the IEC 60559 default modes are in effect:
21043 <li> The rounding direction mode is rounding to nearest.
21044 <li> The rounding precision mode (if supported) is set so that results are not shortened.
21045 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
21047 Recommended practice
21049 The implementation should produce a diagnostic message for each translation-time
21054 <!--page 461 indent 4-->
21055 floating-point exception, other than ''inexact'';<sup><a href="#note314"><b>314)</b></a></sup> the implementation should then
21056 proceed with the translation of the program.
21059 <p><a name="note314">314)</a> As floating constants are converted to appropriate internal representations at translation time, their
21060 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
21061 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
21062 strtod, provide execution-time conversion of numeric strings.
21065 <a name="F.7.3" href="#F.7.3"><h4>F.7.3 Execution</h4></a>
21067 At program startup the floating-point environment is initialized as prescribed by
21070 <li> All floating-point exception status flags are cleared.
21071 <li> The rounding direction mode is rounding to nearest.
21072 <li> The dynamic rounding precision mode (if supported) is set so that results are not
21074 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
21077 <a name="F.7.4" href="#F.7.4"><h4>F.7.4 Constant expressions</h4></a>
21079 An arithmetic constant expression of floating type, other than one in an initializer for an
21080 object that has static storage duration, is evaluated (as if) during execution; thus, it is
21081 affected by any operative floating-point control modes and raises floating-point
21082 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
21083 is ''on'').<sup><a href="#note315"><b>315)</b></a></sup>
21088 #include <fenv.h>
21089 #pragma STDC FENV_ACCESS ON
21092 float w[] = { 0.0/0.0 }; // raises an exception
21093 static float x = 0.0/0.0; // does not raise an exception
21094 float y = 0.0/0.0; // raises an exception
21095 double z = 0.0/0.0; // raises an exception
21098 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
21099 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
21102 <!--page 462 indent 4-->
21107 <p><a name="note315">315)</a> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
21108 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
21109 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
21110 efficiency of translation-time evaluation through static initialization, such as
21113 const static double one_third = 1.0/3.0;</pre>
21116 <a name="F.7.5" href="#F.7.5"><h4>F.7.5 Initialization</h4></a>
21118 All computation for automatic initialization is done (as if) at execution time; thus, it is
21119 affected by any operative modes and raises floating-point exceptions as required by
21120 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
21121 for initialization of objects that have static storage duration is done (as if) at translation
21127 #include <fenv.h>
21128 #pragma STDC FENV_ACCESS ON
21131 float u[] = { 1.1e75 }; // raises exceptions
21132 static float v = 1.1e75; // does not raise exceptions
21133 float w = 1.1e75; // raises exceptions
21134 double x = 1.1e75; // may raise exceptions
21135 float y = 1.1e75f; // may raise exceptions
21136 long double z = 1.1e75; // does not raise exceptions
21139 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
21140 done at translation time. The automatic initialization of u and w require an execution-time conversion to
21141 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
21142 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
21143 conversions is not to a narrower format, in which case no floating-point exception is raised.<sup><a href="#note316"><b>316)</b></a></sup> The
21144 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
21145 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
21146 their internal representations occur at translation time in all cases.
21151 <!--page 463 indent 4-->
21154 <p><a name="note316">316)</a> Use of float_t and double_t variables increases the likelihood of translation-time computation.
21155 For example, the automatic initialization
21158 double_t x = 1.1e75;</pre>
21159 could be done at translation time, regardless of the expression evaluation method.
21162 <a name="F.7.6" href="#F.7.6"><h4>F.7.6 Changing the environment</h4></a>
21164 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
21165 change floating-point status flags and control modes just as indicated by their
21166 specifications (including conformance to IEC 60559). They do not change flags or modes
21167 (so as to be detectable by the user) in any other cases.
21169 If the argument to the feraiseexcept function in <fenv.h> represents IEC 60559
21170 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
21171 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
21172 before ''inexact''.
21174 <a name="F.8" href="#F.8"><h3>F.8 Optimization</h3></a>
21176 This section identifies code transformations that might subvert IEC 60559-specified
21177 behavior, and others that do not.
21179 <a name="F.8.1" href="#F.8.1"><h4>F.8.1 Global transformations</h4></a>
21181 Floating-point arithmetic operations and external function calls may entail side effects
21182 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
21183 ''on''. The flags and modes in the floating-point environment may be regarded as global
21184 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
21187 Concern about side effects may inhibit code motion and removal of seemingly useless
21188 code. For example, in
21190 #include <fenv.h>
21191 #pragma STDC FENV_ACCESS ON
21195 for (i = 0; i < n; i++) x + 1;
21198 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
21199 body might not execute (maybe 0 >= n), x + 1 cannot be moved out of the loop. (Of
21200 course these optimizations are valid if the implementation can rule out the nettlesome
21203 This specification does not require support for trap handlers that maintain information
21204 about the order or count of floating-point exceptions. Therefore, between function calls,
21205 floating-point exceptions need not be precise: the actual order and number of occurrences
21206 of floating-point exceptions (> 1) may vary from what the source code expresses. Thus,
21207 the preceding loop could be treated as
21208 <!--page 464 indent 4-->
21210 if (0 < n) x + 1;</pre>
21212 <a name="F.8.2" href="#F.8.2"><h4>F.8.2 Expression transformations</h4></a>
21214 x / 2 <-> x * 0.5 Although similar transformations involving inexact
21216 constants generally do not yield numerically equivalent
21217 expressions, if the constants are exact then such
21218 transformations can be made on IEC 60559 machines
21219 and others that round perfectly.</pre>
21220 1 * x and x / 1 -> x The expressions 1 * x, x / 1, and x are equivalent
21222 (on IEC 60559 machines, among others).<sup><a href="#note317"><b>317)</b></a></sup></pre>
21223 x / x -> 1.0 The expressions x / x and 1.0 are not equivalent if x
21225 can be zero, infinite, or NaN.</pre>
21226 x - y <-> x + (-y) The expressions x - y, x + (-y), and (-y) + x
21228 are equivalent (on IEC 60559 machines, among others).</pre>
21229 x - y <-> -(y - x) The expressions x - y and -(y - x) are not
21231 equivalent because 1 - 1 is +0 but -(1 - 1) is -0 (in the
21232 default rounding direction).<sup><a href="#note318"><b>318)</b></a></sup></pre>
21233 x - x -> 0.0 The expressions x - x and 0.0 are not equivalent if
21235 x is a NaN or infinite.</pre>
21236 0 * x -> 0.0 The expressions 0 * x and 0.0 are not equivalent if
21238 x is a NaN, infinite, or -0.</pre>
21239 x + 0->x The expressions x + 0 and x are not equivalent if x is
21241 -0, because (-0) + (+0) yields +0 (in the default
21242 rounding direction), not -0.</pre>
21243 x - 0->x (+0) - (+0) yields -0 when rounding is downward
21245 (toward -(inf)), but +0 otherwise, and (-0) - (+0) always
21246 yields -0; so, if the state of the FENV_ACCESS pragma
21247 is ''off'', promising default rounding, then the
21248 implementation can replace x - 0 by x, even if x</pre>
21251 <!--page 465 indent 4-->
21253 might be zero.</pre>
21254 -x <-> 0 - x The expressions -x and 0 - x are not equivalent if x
21256 is +0, because -(+0) yields -0, but 0 - (+0) yields +0
21257 (unless rounding is downward).</pre>
21260 <p><a name="note317">317)</a> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
21261 other transformations that remove arithmetic operators.
21263 <p><a name="note318">318)</a> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
21267 1/(1/ (+-) (inf)) is (+-) (inf)</pre>
21271 conj(csqrt(z)) is csqrt(conj(z)),</pre>
21275 <a name="F.8.3" href="#F.8.3"><h4>F.8.3 Relational operators</h4></a>
21277 x != x -> false The statement x != x is true if x is a NaN.
21278 x == x -> true The statement x == x is false if x is a NaN.
21279 x < y -> isless(x,y) (and similarly for <=, >, >=) Though numerically
21281 equal, these expressions are not equivalent because of
21282 side effects when x or y is a NaN and the state of the
21283 FENV_ACCESS pragma is ''on''. This transformation,
21284 which would be desirable if extra code were required to
21285 cause the ''invalid'' floating-point exception for
21286 unordered cases, could be performed provided the state
21287 of the FENV_ACCESS pragma is ''off''.</pre>
21288 The sense of relational operators shall be maintained. This includes handling unordered
21289 cases as expressed by the source code.
21293 // calls g and raises ''invalid'' if a and b are unordered
21298 is not equivalent to
21300 // calls f and raises ''invalid'' if a and b are unordered
21307 // calls f without raising ''invalid'' if a and b are unordered
21308 if (isgreaterequal(a,b))
21312 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
21313 <!--page 466 indent 4-->
21315 // calls g without raising ''invalid'' if a and b are unordered
21320 but is equivalent to
21328 <a name="F.8.4" href="#F.8.4"><h4>F.8.4 Constant arithmetic</h4></a>
21330 The implementation shall honor floating-point exceptions raised by execution-time
21331 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.7.4">F.7.4</a>
21332 and <a href="#F.7.5">F.7.5</a>.) An operation on constants that raises no floating-point exception can be
21333 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
21334 further check is required to assure that changing the rounding direction to downward does
21335 not alter the sign of the result,<sup><a href="#note319"><b>319)</b></a></sup> and implementations that support dynamic rounding
21336 precision modes shall assure further that the result of the operation raises no floating-
21337 point exception when converted to the semantic type of the operation.
21340 <p><a name="note319">319)</a> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
21343 <a name="F.9" href="#F.9"><h3>F.9 Mathematics <math.h></h3></a>
21345 This subclause contains specifications of <math.h> facilities that are particularly suited
21346 for IEC 60559 implementations.
21348 The Standard C macro HUGE_VAL and its float and long double analogs,
21349 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
21352 Special cases for functions in <math.h> are covered directly or indirectly by
21353 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
21354 other functions in <math.h> treat infinities, NaNs, signed zeros, subnormals, and
21355 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
21356 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
21358 The expression math_errhandling & MATH_ERREXCEPT shall evaluate to a
21361 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
21362 subsequent subclauses of this annex.
21364 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
21365 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
21368 <!--page 467 indent 5-->
21369 whose magnitude is too large.
21371 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
21372 subnormal or zero) and suffers loss of accuracy.<sup><a href="#note320"><b>320)</b></a></sup>
21374 Whether or when library functions raise the ''inexact'' floating-point exception is
21375 unspecified, unless explicitly specified otherwise.
21377 Whether or when library functions raise an undeserved ''underflow'' floating-point
21378 exception is unspecified.<sup><a href="#note321"><b>321)</b></a></sup> Otherwise, as implied by <a href="#F.7.6">F.7.6</a>, the <math.h> functions do
21379 not raise spurious floating-point exceptions (detectable by the user), other than the
21380 ''inexact'' floating-point exception.
21382 Whether the functions honor the rounding direction mode is implementation-defined,
21383 unless explicitly specified otherwise.
21385 Functions with a NaN argument return a NaN result and raise no floating-point exception,
21386 except where stated otherwise.
21388 The specifications in the following subclauses append to the definitions in <math.h>.
21389 For families of functions, the specifications apply to all of the functions even though only
21390 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
21391 occurs in both an argument and the result, the result has the same sign as the argument.
21392 Recommended practice
21394 If a function with one or more NaN arguments returns a NaN result, the result should be
21395 the same as one of the NaN arguments (after possible type conversion), except perhaps
21399 <p><a name="note320">320)</a> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
21400 when the floating-point exception is raised.
21402 <p><a name="note321">321)</a> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
21403 avoiding them would be too costly.
21406 <a name="F.9.1" href="#F.9.1"><h4>F.9.1 Trigonometric functions</h4></a>
21408 <a name="F.9.1.1" href="#F.9.1.1"><h5>F.9.1.1 The acos functions</h5></a>
21411 <li> acos(1) returns +0.
21412 <li> acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
21418 <!--page 468 indent 4-->
21421 <a name="F.9.1.2" href="#F.9.1.2"><h5>F.9.1.2 The asin functions</h5></a>
21424 <li> asin((+-)0) returns (+-)0.
21425 <li> asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
21429 <a name="F.9.1.3" href="#F.9.1.3"><h5>F.9.1.3 The atan functions</h5></a>
21432 <li> atan((+-)0) returns (+-)0.
21433 <li> atan((+-)(inf)) returns (+-)pi /2.
21436 <a name="F.9.1.4" href="#F.9.1.4"><h5>F.9.1.4 The atan2 functions</h5></a>
21439 <li> atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note322"><b>322)</b></a></sup>
21440 <li> atan2((+-)0, +0) returns (+-)0.
21441 <li> atan2((+-)0, x) returns (+-)pi for x < 0.
21442 <li> atan2((+-)0, x) returns (+-)0 for x > 0.
21443 <li> atan2(y, (+-)0) returns -pi /2 for y < 0.
21444 <li> atan2(y, (+-)0) returns pi /2 for y > 0.
21445 <li> atan2((+-)y, -(inf)) returns (+-)pi for finite y > 0.
21446 <li> atan2((+-)y, +(inf)) returns (+-)0 for finite y > 0.
21447 <li> atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
21448 <li> atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
21449 <li> atan2((+-)(inf), +(inf)) returns (+-)pi /4.
21453 <p><a name="note322">322)</a> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
21454 the ''divide-by-zero'' floating-point exception.
21457 <a name="F.9.1.5" href="#F.9.1.5"><h5>F.9.1.5 The cos functions</h5></a>
21460 <li> cos((+-)0) returns 1.
21461 <li> cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
21464 <a name="F.9.1.6" href="#F.9.1.6"><h5>F.9.1.6 The sin functions</h5></a>
21467 <li> sin((+-)0) returns (+-)0.
21468 <li> sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
21473 <!--page 469 indent 4-->
21476 <a name="F.9.1.7" href="#F.9.1.7"><h5>F.9.1.7 The tan functions</h5></a>
21479 <li> tan((+-)0) returns (+-)0.
21480 <li> tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
21483 <a name="F.9.2" href="#F.9.2"><h4>F.9.2 Hyperbolic functions</h4></a>
21485 <a name="F.9.2.1" href="#F.9.2.1"><h5>F.9.2.1 The acosh functions</h5></a>
21488 <li> acosh(1) returns +0.
21489 <li> acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x < 1.
21490 <li> acosh(+(inf)) returns +(inf).
21493 <a name="F.9.2.2" href="#F.9.2.2"><h5>F.9.2.2 The asinh functions</h5></a>
21496 <li> asinh((+-)0) returns (+-)0.
21497 <li> asinh((+-)(inf)) returns (+-)(inf).
21500 <a name="F.9.2.3" href="#F.9.2.3"><h5>F.9.2.3 The atanh functions</h5></a>
21503 <li> atanh((+-)0) returns (+-)0.
21504 <li> atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
21505 <li> atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
21509 <a name="F.9.2.4" href="#F.9.2.4"><h5>F.9.2.4 The cosh functions</h5></a>
21512 <li> cosh((+-)0) returns 1.
21513 <li> cosh((+-)(inf)) returns +(inf).
21516 <a name="F.9.2.5" href="#F.9.2.5"><h5>F.9.2.5 The sinh functions</h5></a>
21519 <li> sinh((+-)0) returns (+-)0.
21520 <li> sinh((+-)(inf)) returns (+-)(inf).
21523 <a name="F.9.2.6" href="#F.9.2.6"><h5>F.9.2.6 The tanh functions</h5></a>
21526 <li> tanh((+-)0) returns (+-)0.
21527 <li> tanh((+-)(inf)) returns (+-)1.
21528 <!--page 470 indent 4-->
21531 <a name="F.9.3" href="#F.9.3"><h4>F.9.3 Exponential and logarithmic functions</h4></a>
21533 <a name="F.9.3.1" href="#F.9.3.1"><h5>F.9.3.1 The exp functions</h5></a>
21536 <li> exp((+-)0) returns 1.
21537 <li> exp(-(inf)) returns +0.
21538 <li> exp(+(inf)) returns +(inf).
21541 <a name="F.9.3.2" href="#F.9.3.2"><h5>F.9.3.2 The exp2 functions</h5></a>
21544 <li> exp2((+-)0) returns 1.
21545 <li> exp2(-(inf)) returns +0.
21546 <li> exp2(+(inf)) returns +(inf).
21549 <a name="F.9.3.3" href="#F.9.3.3"><h5>F.9.3.3 The expm1 functions</h5></a>
21552 <li> expm1((+-)0) returns (+-)0.
21553 <li> expm1(-(inf)) returns -1.
21554 <li> expm1(+(inf)) returns +(inf).
21557 <a name="F.9.3.4" href="#F.9.3.4"><h5>F.9.3.4 The frexp functions</h5></a>
21560 <li> frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
21561 <li> frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
21563 <li> frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
21564 (and returns a NaN).
21567 frexp raises no floating-point exceptions.
21569 On a binary system, the body of the frexp function might be
21572 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
21573 return scalbn(value, -(*exp));
21576 <a name="F.9.3.5" href="#F.9.3.5"><h5>F.9.3.5 The ilogb functions</h5></a>
21578 If the correct result is outside the range of the return type, the numeric result is
21579 unspecified and the ''invalid'' floating-point exception is raised.
21580 <!--page 471 indent 4-->
21582 <a name="F.9.3.6" href="#F.9.3.6"><h5>F.9.3.6 The ldexp functions</h5></a>
21584 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
21586 <a name="F.9.3.7" href="#F.9.3.7"><h5>F.9.3.7 The log functions</h5></a>
21589 <li> log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
21590 <li> log(1) returns +0.
21591 <li> log(x) returns a NaN and raises the ''invalid'' floating-point exception for x < 0.
21592 <li> log(+(inf)) returns +(inf).
21595 <a name="F.9.3.8" href="#F.9.3.8"><h5>F.9.3.8 The log10 functions</h5></a>
21598 <li> log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
21599 <li> log10(1) returns +0.
21600 <li> log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x < 0.
21601 <li> log10(+(inf)) returns +(inf).
21604 <a name="F.9.3.9" href="#F.9.3.9"><h5>F.9.3.9 The log1p functions</h5></a>
21607 <li> log1p((+-)0) returns (+-)0.
21608 <li> log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
21609 <li> log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
21611 <li> log1p(+(inf)) returns +(inf).
21614 <a name="F.9.3.10" href="#F.9.3.10"><h5>F.9.3.10 The log2 functions</h5></a>
21617 <li> log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
21618 <li> log2(1) returns +0.
21619 <li> log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x < 0.
21620 <li> log2(+(inf)) returns +(inf).
21623 <a name="F.9.3.11" href="#F.9.3.11"><h5>F.9.3.11 The logb functions</h5></a>
21626 <li> logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
21627 <li> logb((+-)(inf)) returns +(inf).
21628 <!--page 472 indent 4-->
21631 <a name="F.9.3.12" href="#F.9.3.12"><h5>F.9.3.12 The modf functions</h5></a>
21634 <li> modf((+-)x, iptr) returns a result with the same sign as x.
21635 <li> modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
21636 <li> modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
21640 modf behaves as though implemented by
21642 #include <math.h>
21643 #include <fenv.h>
21644 #pragma STDC FENV_ACCESS ON
21645 double modf(double value, double *iptr)
21647 int save_round = fegetround();
21648 fesetround(FE_TOWARDZERO);
21649 *iptr = nearbyint(value);
21650 fesetround(save_round);
21652 isinf(value) ? 0.0 :
21653 value - (*iptr), value);
21656 <a name="F.9.3.13" href="#F.9.3.13"><h5>F.9.3.13 The scalbn and scalbln functions</h5></a>
21659 <li> scalbn((+-)0, n) returns (+-)0.
21660 <li> scalbn(x, 0) returns x.
21661 <li> scalbn((+-)(inf), n) returns (+-)(inf).
21664 <a name="F.9.4" href="#F.9.4"><h4>F.9.4 Power and absolute value functions</h4></a>
21666 <a name="F.9.4.1" href="#F.9.4.1"><h5>F.9.4.1 The cbrt functions</h5></a>
21669 <li> cbrt((+-)0) returns (+-)0.
21670 <li> cbrt((+-)(inf)) returns (+-)(inf).
21673 <a name="F.9.4.2" href="#F.9.4.2"><h5>F.9.4.2 The fabs functions</h5></a>
21676 <li> fabs((+-)0) returns +0.
21677 <li> fabs((+-)(inf)) returns +(inf).
21678 <!--page 473 indent 4-->
21681 <a name="F.9.4.3" href="#F.9.4.3"><h5>F.9.4.3 The hypot functions</h5></a>
21684 <li> hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
21685 <li> hypot(x, (+-)0) is equivalent to fabs(x).
21686 <li> hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
21689 <a name="F.9.4.4" href="#F.9.4.4"><h5>F.9.4.4 The pow functions</h5></a>
21692 <li> pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
21693 for y an odd integer < 0.
21694 <li> pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
21695 for y < 0 and not an odd integer.
21696 <li> pow((+-)0, y) returns (+-)0 for y an odd integer > 0.
21697 <li> pow((+-)0, y) returns +0 for y > 0 and not an odd integer.
21698 <li> pow(-1, (+-)(inf)) returns 1.
21699 <li> pow(+1, y) returns 1 for any y, even a NaN.
21700 <li> pow(x, (+-)0) returns 1 for any x, even a NaN.
21701 <li> pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
21702 finite x < 0 and finite non-integer y.
21703 <li> pow(x, -(inf)) returns +(inf) for | x | < 1.
21704 <li> pow(x, -(inf)) returns +0 for | x | > 1.
21705 <li> pow(x, +(inf)) returns +0 for | x | < 1.
21706 <li> pow(x, +(inf)) returns +(inf) for | x | > 1.
21707 <li> pow(-(inf), y) returns -0 for y an odd integer < 0.
21708 <li> pow(-(inf), y) returns +0 for y < 0 and not an odd integer.
21709 <li> pow(-(inf), y) returns -(inf) for y an odd integer > 0.
21710 <li> pow(-(inf), y) returns +(inf) for y > 0 and not an odd integer.
21711 <li> pow(+(inf), y) returns +0 for y < 0.
21712 <li> pow(+(inf), y) returns +(inf) for y > 0.
21713 <!--page 474 indent 4-->
21716 <a name="F.9.4.5" href="#F.9.4.5"><h5>F.9.4.5 The sqrt functions</h5></a>
21718 sqrt is fully specified as a basic arithmetic operation in IEC 60559.
21720 <a name="F.9.5" href="#F.9.5"><h4>F.9.5 Error and gamma functions</h4></a>
21722 <a name="F.9.5.1" href="#F.9.5.1"><h5>F.9.5.1 The erf functions</h5></a>
21725 <li> erf((+-)0) returns (+-)0.
21726 <li> erf((+-)(inf)) returns (+-)1.
21729 <a name="F.9.5.2" href="#F.9.5.2"><h5>F.9.5.2 The erfc functions</h5></a>
21732 <li> erfc(-(inf)) returns 2.
21733 <li> erfc(+(inf)) returns +0.
21736 <a name="F.9.5.3" href="#F.9.5.3"><h5>F.9.5.3 The lgamma functions</h5></a>
21739 <li> lgamma(1) returns +0.
21740 <li> lgamma(2) returns +0.
21741 <li> lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
21742 x a negative integer or zero.
21743 <li> lgamma(-(inf)) returns +(inf).
21744 <li> lgamma(+(inf)) returns +(inf).
21747 <a name="F.9.5.4" href="#F.9.5.4"><h5>F.9.5.4 The tgamma functions</h5></a>
21750 <li> tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
21751 <li> tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
21753 <li> tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
21754 <li> tgamma(+(inf)) returns +(inf).
21757 <a name="F.9.6" href="#F.9.6"><h4>F.9.6 Nearest integer functions</h4></a>
21759 <a name="F.9.6.1" href="#F.9.6.1"><h5>F.9.6.1 The ceil functions</h5></a>
21762 <li> ceil((+-)0) returns (+-)0.
21763 <li> ceil((+-)(inf)) returns (+-)(inf).
21766 The double version of ceil behaves as though implemented by
21767 <!--page 475 indent 4-->
21769 #include <math.h>
21770 #include <fenv.h>
21771 #pragma STDC FENV_ACCESS ON
21772 double ceil(double x)
21775 int save_round = fegetround();
21776 fesetround(FE_UPWARD);
21777 result = rint(x); // or nearbyint instead of rint
21778 fesetround(save_round);
21782 <a name="F.9.6.2" href="#F.9.6.2"><h5>F.9.6.2 The floor functions</h5></a>
21785 <li> floor((+-)0) returns (+-)0.
21786 <li> floor((+-)(inf)) returns (+-)(inf).
21789 See the sample implementation for ceil in <a href="#F.9.6.1">F.9.6.1</a>.
21791 <a name="F.9.6.3" href="#F.9.6.3"><h5>F.9.6.3 The nearbyint functions</h5></a>
21793 The nearbyint functions use IEC 60559 rounding according to the current rounding
21794 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
21795 value from the argument.
21797 <li> nearbyint((+-)0) returns (+-)0 (for all rounding directions).
21798 <li> nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
21801 <a name="F.9.6.4" href="#F.9.6.4"><h5>F.9.6.4 The rint functions</h5></a>
21803 The rint functions differ from the nearbyint functions only in that they do raise the
21804 ''inexact'' floating-point exception if the result differs in value from the argument.
21806 <a name="F.9.6.5" href="#F.9.6.5"><h5>F.9.6.5 The lrint and llrint functions</h5></a>
21808 The lrint and llrint functions provide floating-to-integer conversion as prescribed
21809 by IEC 60559. They round according to the current rounding direction. If the rounded
21810 value is outside the range of the return type, the numeric result is unspecified and the
21811 ''invalid'' floating-point exception is raised. When they raise no other floating-point
21812 exception and the result differs from the argument, they raise the ''inexact'' floating-point
21814 <!--page 476 indent 4-->
21816 <a name="F.9.6.6" href="#F.9.6.6"><h5>F.9.6.6 The round functions</h5></a>
21819 <li> round((+-)0) returns (+-)0.
21820 <li> round((+-)(inf)) returns (+-)(inf).
21823 The double version of round behaves as though implemented by
21825 #include <math.h>
21826 #include <fenv.h>
21827 #pragma STDC FENV_ACCESS ON
21828 double round(double x)
21832 feholdexcept(&save_env);
21834 if (fetestexcept(FE_INEXACT)) {
21835 fesetround(FE_TOWARDZERO);
21836 result = rint(copysign(0.5 + fabs(x), x));
21838 feupdateenv(&save_env);
21841 The round functions may, but are not required to, raise the ''inexact'' floating-point
21842 exception for non-integer numeric arguments, as this implementation does.
21844 <a name="F.9.6.7" href="#F.9.6.7"><h5>F.9.6.7 The lround and llround functions</h5></a>
21846 The lround and llround functions differ from the lrint and llrint functions
21847 with the default rounding direction just in that the lround and llround functions
21848 round halfway cases away from zero and need not raise the ''inexact'' floating-point
21849 exception for non-integer arguments that round to within the range of the return type.
21851 <a name="F.9.6.8" href="#F.9.6.8"><h5>F.9.6.8 The trunc functions</h5></a>
21853 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
21854 rounding direction).
21856 <li> trunc((+-)0) returns (+-)0.
21857 <li> trunc((+-)(inf)) returns (+-)(inf).
21858 <!--page 477 indent 4-->
21861 <a name="F.9.7" href="#F.9.7"><h4>F.9.7 Remainder functions</h4></a>
21863 <a name="F.9.7.1" href="#F.9.7.1"><h5>F.9.7.1 The fmod functions</h5></a>
21866 <li> fmod((+-)0, y) returns (+-)0 for y not zero.
21867 <li> fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
21868 infinite or y zero.
21869 <li> fmod(x, (+-)(inf)) returns x for x not infinite.
21872 The double version of fmod behaves as though implemented by
21874 #include <math.h>
21875 #include <fenv.h>
21876 #pragma STDC FENV_ACCESS ON
21877 double fmod(double x, double y)
21880 result = remainder(fabs(x), (y = fabs(y)));
21881 if (signbit(result)) result += y;
21882 return copysign(result, x);
21885 <a name="F.9.7.2" href="#F.9.7.2"><h5>F.9.7.2 The remainder functions</h5></a>
21887 The remainder functions are fully specified as a basic arithmetic operation in
21890 <a name="F.9.7.3" href="#F.9.7.3"><h5>F.9.7.3 The remquo functions</h5></a>
21892 The remquo functions follow the specifications for the remainder functions. They
21893 have no further specifications special to IEC 60559 implementations.
21895 <a name="F.9.8" href="#F.9.8"><h4>F.9.8 Manipulation functions</h4></a>
21897 <a name="F.9.8.1" href="#F.9.8.1"><h5>F.9.8.1 The copysign functions</h5></a>
21899 copysign is specified in the Appendix to IEC 60559.
21901 <a name="F.9.8.2" href="#F.9.8.2"><h5>F.9.8.2 The nan functions</h5></a>
21903 All IEC 60559 implementations support quiet NaNs, in all floating formats.
21904 <!--page 478 indent 4-->
21906 <a name="F.9.8.3" href="#F.9.8.3"><h5>F.9.8.3 The nextafter functions</h5></a>
21909 <li> nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
21910 for x finite and the function value infinite.
21911 <li> nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
21912 exceptions for the function value subnormal or zero and x != y.
21915 <a name="F.9.8.4" href="#F.9.8.4"><h5>F.9.8.4 The nexttoward functions</h5></a>
21917 No additional requirements beyond those on nextafter.
21919 <a name="F.9.9" href="#F.9.9"><h4>F.9.9 Maximum, minimum, and positive difference functions</h4></a>
21921 <a name="F.9.9.1" href="#F.9.9.1"><h5>F.9.9.1 The fdim functions</h5></a>
21923 No additional requirements.
21925 <a name="F.9.9.2" href="#F.9.9.2"><h5>F.9.9.2 The fmax functions</h5></a>
21927 If just one argument is a NaN, the fmax functions return the other argument (if both
21928 arguments are NaNs, the functions return a NaN).
21930 The body of the fmax function might be<sup><a href="#note323"><b>323)</b></a></sup>
21932 { return (isgreaterequal(x, y) ||
21933 isnan(y)) ? x : y; }</pre>
21936 <p><a name="note323">323)</a> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
21937 return +0; however, implementation in software might be impractical.
21940 <a name="F.9.9.3" href="#F.9.9.3"><h5>F.9.9.3 The fmin functions</h5></a>
21942 The fmin functions are analogous to the fmax functions (see <a href="#F.9.9.2">F.9.9.2</a>).
21944 <a name="F.9.10" href="#F.9.10"><h4>F.9.10 Floating multiply-add</h4></a>
21946 <a name="F.9.10.1" href="#F.9.10.1"><h5>F.9.10.1 The fma functions</h5></a>
21949 <li> fma(x, y, z) computes xy + z, correctly rounded once.
21950 <li> fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
21951 exception if one of x and y is infinite, the other is zero, and z is a NaN.
21952 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
21953 one of x and y is infinite, the other is zero, and z is not a NaN.
21954 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
21955 times y is an exact infinity and z is also an infinity but with the opposite sign.
21960 <!--page 479 indent 4-->
21963 <a name="G" href="#G"><h2>Annex G</h2></a>
21966 IEC 60559-compatible complex arithmetic</pre>
21968 <a name="G.1" href="#G.1"><h3>G.1 Introduction</h3></a>
21970 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
21971 IEC 60559 real floating-point arithmetic. Although these specifications have been
21972 carefully designed, there is little existing practice to validate the design decisions.
21973 Therefore, these specifications are not normative, but should be viewed more as
21974 recommended practice. An implementation that defines
21975 __STDC_IEC_559_COMPLEX__ should conform to the specifications in this annex.
21977 <a name="G.2" href="#G.2"><h3>G.2 Types</h3></a>
21979 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
21980 used as a type specifier within declaration specifiers in the same way as _Complex is
21981 (thus, _Imaginary float is a valid type name).
21983 There are three imaginary types, designated as float _Imaginary, double
21984 _Imaginary, and long double _Imaginary. The imaginary types (along with
21985 the real floating and complex types) are floating types.
21987 For imaginary types, the corresponding real type is given by deleting the keyword
21988 _Imaginary from the type name.
21990 Each imaginary type has the same representation and alignment requirements as the
21991 corresponding real type. The value of an object of imaginary type is the value of the real
21992 representation times the imaginary unit.
21994 The imaginary type domain comprises the imaginary types.
21996 <a name="G.3" href="#G.3"><h3>G.3 Conventions</h3></a>
21998 A complex or imaginary value with at least one infinite part is regarded as an infinity
21999 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
22000 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
22001 a zero if each of its parts is a zero.
22002 <!--page 480 indent 4-->
22004 <a name="G.4" href="#G.4"><h3>G.4 Conversions</h3></a>
22006 <a name="G.4.1" href="#G.4.1"><h4>G.4.1 Imaginary types</h4></a>
22008 Conversions among imaginary types follow rules analogous to those for real floating
22011 <a name="G.4.2" href="#G.4.2"><h4>G.4.2 Real and imaginary</h4></a>
22013 When a value of imaginary type is converted to a real type other than _Bool,<sup><a href="#note324"><b>324)</b></a></sup> the
22014 result is a positive zero.
22016 When a value of real type is converted to an imaginary type, the result is a positive
22020 <p><a name="note324">324)</a> See <a href="#6.3.1.2">6.3.1.2</a>.
22023 <a name="G.4.3" href="#G.4.3"><h4>G.4.3 Imaginary and complex</h4></a>
22025 When a value of imaginary type is converted to a complex type, the real part of the
22026 complex result value is a positive zero and the imaginary part of the complex result value
22027 is determined by the conversion rules for the corresponding real types.
22029 When a value of complex type is converted to an imaginary type, the real part of the
22030 complex value is discarded and the value of the imaginary part is converted according to
22031 the conversion rules for the corresponding real types.
22033 <a name="G.5" href="#G.5"><h3>G.5 Binary operators</h3></a>
22035 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
22036 operation with an imaginary operand.
22038 For most operand types, the value of the result of a binary operator with an imaginary or
22039 complex operand is completely determined, with reference to real arithmetic, by the usual
22040 mathematical formula. For some operand types, the usual mathematical formula is
22041 problematic because of its treatment of infinities and because of undue overflow or
22042 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
22043 not completely determined.
22048 <!--page 481 indent 4-->
22050 <a name="G.5.1" href="#G.5.1"><h4>G.5.1 Multiplicative operators</h4></a>
22053 If one operand has real type and the other operand has imaginary type, then the result has
22054 imaginary type. If both operands have imaginary type, then the result has real type. (If
22055 either operand has complex type, then the result has complex type.)
22057 If the operands are not both complex, then the result and floating-point exception
22058 behavior of the * operator is defined by the usual mathematical formula:
22060 * u iv u + iv</pre>
22063 x xu i(xv) (xu) + i(xv)</pre>
22066 iy i(yu) -yv (-yv) + i(yu)</pre>
22070 x + iy (xu) + i(yu) (-yv) + i(xv)</pre>
22071 If the second operand is not complex, then the result and floating-point exception
22072 behavior of the / operator is defined by the usual mathematical formula:
22077 x x/u i(-x/v)</pre>
22080 iy i(y/u) y/v</pre>
22084 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)</pre>
22085 The * and / operators satisfy the following infinity properties for all real, imaginary, and
22086 complex operands:<sup><a href="#note325"><b>325)</b></a></sup>
22088 <li> if one operand is an infinity and the other operand is a nonzero finite number or an
22089 infinity, then the result of the * operator is an infinity;
22090 <li> if the first operand is an infinity and the second operand is a finite number, then the
22091 result of the / operator is an infinity;
22092 <li> if the first operand is a finite number and the second operand is an infinity, then the
22093 result of the / operator is a zero;
22098 <!--page 482 indent 4-->
22099 <li> if the first operand is a nonzero finite number or an infinity and the second operand is
22100 a zero, then the result of the / operator is an infinity.
22103 If both operands of the * operator are complex or if the second operand of the / operator
22104 is complex, the operator raises floating-point exceptions if appropriate for the calculation
22105 of the parts of the result, and may raise spurious floating-point exceptions.
22107 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
22108 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
22109 <!--page 483 indent 4-->
22112 #include <math.h>
22113 #include <complex.h>
22114 /* Multiply z * w ... */
22115 double complex _Cmultd(double complex z, double complex w)
22117 #pragma STDC FP_CONTRACT OFF
22118 double a, b, c, d, ac, bd, ad, bc, x, y;
22119 a = creal(z); b = cimag(z);
22120 c = creal(w); d = cimag(w);
22121 ac = a * c; bd = b * d;
22122 ad = a * d; bc = b * c;
22123 x = ac - bd; y = ad + bc;
22124 if (isnan(x) && isnan(y)) {
22125 /* Recover infinities that computed as NaN+iNaN ... */
22127 if ( isinf(a) || isinf(b) ) { // z is infinite
22128 /* "Box" the infinity and change NaNs in the other factor to 0 */
22129 a = copysign(isinf(a) ? 1.0 : 0.0, a);
22130 b = copysign(isinf(b) ? 1.0 : 0.0, b);
22131 if (isnan(c)) c = copysign(0.0, c);
22132 if (isnan(d)) d = copysign(0.0, d);
22135 if ( isinf(c) || isinf(d) ) { // w is infinite
22136 /* "Box" the infinity and change NaNs in the other factor to 0 */
22137 c = copysign(isinf(c) ? 1.0 : 0.0, c);
22138 d = copysign(isinf(d) ? 1.0 : 0.0, d);
22139 if (isnan(a)) a = copysign(0.0, a);
22140 if (isnan(b)) b = copysign(0.0, b);
22143 if (!recalc && (isinf(ac) || isinf(bd) ||
22144 isinf(ad) || isinf(bc))) {
22145 /* Recover infinities from overflow by changing NaNs to 0 ... */
22146 if (isnan(a)) a = copysign(0.0, a);
22147 if (isnan(b)) b = copysign(0.0, b);
22148 if (isnan(c)) c = copysign(0.0, c);
22149 if (isnan(d)) d = copysign(0.0, d);
22153 x = INFINITY * ( a * c - b * d );
22154 y = INFINITY * ( a * d + b * c );
22159 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
22160 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
22163 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
22164 <!--page 484 indent 4-->
22167 #include <math.h>
22168 #include <complex.h>
22169 /* Divide z / w ... */
22170 double complex _Cdivd(double complex z, double complex w)
22172 #pragma STDC FP_CONTRACT OFF
22173 double a, b, c, d, logbw, denom, x, y;
22175 a = creal(z); b = cimag(z);
22176 c = creal(w); d = cimag(w);
22177 logbw = logb(fmax(fabs(c), fabs(d)));
22178 if (isfinite(logbw)) {
22179 ilogbw = (int)logbw;
22180 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
22182 denom = c * c + d * d;
22183 x = scalbn((a * c + b * d) / denom, -ilogbw);
22184 y = scalbn((b * c - a * d) / denom, -ilogbw);
22185 /* Recover infinities and zeros that computed as NaN+iNaN; */
22186 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
22187 if (isnan(x) && isnan(y)) {
22188 if ((denom == 0.0) &&
22189 (!isnan(a) || !isnan(b))) {
22190 x = copysign(INFINITY, c) * a;
22191 y = copysign(INFINITY, c) * b;
22193 else if ((isinf(a) || isinf(b)) &&
22194 isfinite(c) && isfinite(d)) {
22195 a = copysign(isinf(a) ? 1.0 : 0.0, a);
22196 b = copysign(isinf(b) ? 1.0 : 0.0, b);
22197 x = INFINITY * ( a * c + b * d );
22198 y = INFINITY * ( b * c - a * d );
22200 else if (isinf(logbw) &&
22201 isfinite(a) && isfinite(b)) {
22202 c = copysign(isinf(c) ? 1.0 : 0.0, c);
22203 d = copysign(isinf(d) ? 1.0 : 0.0, d);
22204 x = 0.0 * ( a * c + b * d );
22205 y = 0.0 * ( b * c - a * d );
22210 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
22211 for multiplication. In the spirit of the multiplication example above, this code does not defend against
22212 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
22213 with division, provides better roundoff characteristics.
22217 <p><a name="note325">325)</a> These properties are already implied for those cases covered in the tables, but are required for all cases
22218 (at least where the state for CX_LIMITED_RANGE is ''off'').
22221 <a name="G.5.2" href="#G.5.2"><h4>G.5.2 Additive operators</h4></a>
22224 If both operands have imaginary type, then the result has imaginary type. (If one operand
22225 has real type and the other operand has imaginary type, or if either operand has complex
22226 type, then the result has complex type.)
22228 In all cases the result and floating-point exception behavior of a + or - operator is defined
22229 by the usual mathematical formula:
22231 + or - u iv u + iv</pre>
22234 x x(+-)u x (+-) iv (x (+-) u) (+-) iv</pre>
22237 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)</pre>
22240 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)</pre>
22242 <a name="G.6" href="#G.6"><h3>G.6 Complex arithmetic <complex.h></h3></a>
22250 are defined, respectively, as _Imaginary and a constant expression of type const
22251 float _Imaginary with the value of the imaginary unit. The macro
22254 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
22255 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
22258 This subclause contains specifications for the <complex.h> functions that are
22259 particularly suited to IEC 60559 implementations. For families of functions, the
22260 specifications apply to all of the functions even though only the principal function is
22261 <!--page 485 indent 4-->
22262 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
22263 and the result, the result has the same sign as the argument.
22265 The functions are continuous onto both sides of their branch cuts, taking into account the
22266 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)2. ???
22268 Since complex and imaginary values are composed of real values, each function may be
22269 regarded as computing real values from real values. Except as noted, the functions treat
22270 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
22271 manner consistent with the specifications for real functions in F.9.<sup><a href="#note326"><b>326)</b></a></sup>
22273 The functions cimag, conj, cproj, and creal are fully specified for all
22274 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
22277 Each of the functions cabs and carg is specified by a formula in terms of a real
22278 function (whose special cases are covered in <a href="#F">annex F</a>):
22281 cabs(x + iy) = hypot(x, y)
22282 carg(x + iy) = atan2(y, x)</pre>
22283 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
22284 a formula in terms of other complex functions (whose special cases are specified below):
22287 casin(z) = -i casinh(iz)
22288 catan(z) = -i catanh(iz)
22289 ccos(z) = ccosh(iz)
22290 csin(z) = -i csinh(iz)
22291 ctan(z) = -i ctanh(iz)</pre>
22292 For the other functions, the following subclauses specify behavior for special cases,
22293 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
22294 families of functions, the specifications apply to all of the functions even though only the
22295 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
22296 specifications for the upper half-plane imply the specifications for the lower half-plane; if
22297 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
22298 specifications for the first quadrant imply the specifications for the other three quadrants.
22300 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
22305 <!--page 486 indent 4-->
22308 <p><a name="note326">326)</a> As noted in <a href="#G.3">G.3</a>, a complex value with at least one infinite part is regarded as an infinity even if its
22309 other part is a NaN.
22312 <a name="G.6.1" href="#G.6.1"><h4>G.6.1 Trigonometric functions</h4></a>
22314 <a name="G.6.1.1" href="#G.6.1.1"><h5>G.6.1.1 The cacos functions</h5></a>
22317 <li> cacos(conj(z)) = conj(cacos(z)).
22318 <li> cacos((+-)0 + i0) returns pi /2 - i0.
22319 <li> cacos((+-)0 + iNaN) returns pi /2 + iNaN.
22320 <li> cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
22321 <li> cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22322 point exception, for nonzero finite x.
22323 <li> cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
22324 <li> cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
22325 <li> cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
22326 <li> cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
22327 <li> cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
22328 result is unspecified).
22329 <li> cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22330 point exception, for finite y.
22331 <li> cacos(NaN + i (inf)) returns NaN - i (inf).
22332 <li> cacos(NaN + iNaN) returns NaN + iNaN.
22335 <a name="G.6.2" href="#G.6.2"><h4>G.6.2 Hyperbolic functions</h4></a>
22337 <a name="G.6.2.1" href="#G.6.2.1"><h5>G.6.2.1 The cacosh functions</h5></a>
22340 <li> cacosh(conj(z)) = conj(cacosh(z)).
22341 <li> cacosh((+-)0 + i0) returns +0 + ipi /2.
22342 <li> cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
22343 <li> cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
22344 floating-point exception, for finite x.
22345 <li> cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
22346 <li> cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
22347 <li> cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
22348 <li> cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
22349 <li> cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
22350 <!--page 487 indent 4-->
22351 <li> cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
22352 floating-point exception, for finite y.
22353 <li> cacosh(NaN + i (inf)) returns +(inf) + iNaN.
22354 <li> cacosh(NaN + iNaN) returns NaN + iNaN.
22357 <a name="G.6.2.2" href="#G.6.2.2"><h5>G.6.2.2 The casinh functions</h5></a>
22360 <li> casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
22361 <li> casinh(+0 + i0) returns 0 + i0.
22362 <li> casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
22363 <li> casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
22364 floating-point exception, for finite x.
22365 <li> casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
22366 <li> casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
22367 <li> casinh(+(inf) + iNaN) returns +(inf) + iNaN.
22368 <li> casinh(NaN + i0) returns NaN + i0.
22369 <li> casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
22370 floating-point exception, for finite nonzero y.
22371 <li> casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
22373 <li> casinh(NaN + iNaN) returns NaN + iNaN.
22376 <a name="G.6.2.3" href="#G.6.2.3"><h5>G.6.2.3 The catanh functions</h5></a>
22379 <li> catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
22380 <li> catanh(+0 + i0) returns +0 + i0.
22381 <li> catanh(+0 + iNaN) returns +0 + iNaN.
22382 <li> catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
22384 <li> catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
22385 <li> catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
22386 floating-point exception, for nonzero finite x.
22387 <li> catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
22388 <li> catanh(+(inf) + i (inf)) returns +0 + ipi /2.
22389 <li> catanh(+(inf) + iNaN) returns +0 + iNaN.
22390 <!--page 488 indent 4-->
22391 <li> catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
22392 floating-point exception, for finite y.
22393 <li> catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
22395 <li> catanh(NaN + iNaN) returns NaN + iNaN.
22398 <a name="G.6.2.4" href="#G.6.2.4"><h5>G.6.2.4 The ccosh functions</h5></a>
22401 <li> ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
22402 <li> ccosh(+0 + i0) returns 1 + i0.
22403 <li> ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
22404 result is unspecified) and raises the ''invalid'' floating-point exception.
22405 <li> ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
22406 result is unspecified).
22407 <li> ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
22408 exception, for finite nonzero x.
22409 <li> ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22410 point exception, for finite nonzero x.
22411 <li> ccosh(+(inf) + i0) returns +(inf) + i0.
22412 <li> ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
22413 <li> ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
22414 unspecified) and raises the ''invalid'' floating-point exception.
22415 <li> ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
22416 <li> ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
22417 result is unspecified).
22418 <li> ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22419 point exception, for all nonzero numbers y.
22420 <li> ccosh(NaN + iNaN) returns NaN + iNaN.
22423 <a name="G.6.2.5" href="#G.6.2.5"><h5>G.6.2.5 The csinh functions</h5></a>
22426 <li> csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
22427 <li> csinh(+0 + i0) returns +0 + i0.
22428 <li> csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
22429 unspecified) and raises the ''invalid'' floating-point exception.
22430 <li> csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
22432 <!--page 489 indent 4-->
22433 <li> csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
22434 exception, for positive finite x.
22435 <li> csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22436 point exception, for finite nonzero x.
22437 <li> csinh(+(inf) + i0) returns +(inf) + i0.
22438 <li> csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
22439 <li> csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
22440 unspecified) and raises the ''invalid'' floating-point exception.
22441 <li> csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
22443 <li> csinh(NaN + i0) returns NaN + i0.
22444 <li> csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22445 point exception, for all nonzero numbers y.
22446 <li> csinh(NaN + iNaN) returns NaN + iNaN.
22449 <a name="G.6.2.6" href="#G.6.2.6"><h5>G.6.2.6 The ctanh functions</h5></a>
22452 <li> ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
22453 <li> ctanh(+0 + i0) returns +0 + i0.
22454 <li> ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
22455 exception, for finite x.
22456 <li> ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22457 point exception, for finite x.
22458 <li> ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
22459 <li> ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
22461 <li> ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
22462 result is unspecified).
22463 <li> ctanh(NaN + i0) returns NaN + i0.
22464 <li> ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22465 point exception, for all nonzero numbers y.
22466 <li> ctanh(NaN + iNaN) returns NaN + iNaN.
22467 <!--page 490 indent 4-->
22470 <a name="G.6.3" href="#G.6.3"><h4>G.6.3 Exponential and logarithmic functions</h4></a>
22472 <a name="G.6.3.1" href="#G.6.3.1"><h5>G.6.3.1 The cexp functions</h5></a>
22475 <li> cexp(conj(z)) = conj(cexp(z)).
22476 <li> cexp((+-)0 + i0) returns 1 + i0.
22477 <li> cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
22478 exception, for finite x.
22479 <li> cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22480 point exception, for finite x.
22481 <li> cexp(+(inf) + i0) returns +(inf) + i0.
22482 <li> cexp(-(inf) + iy) returns +0 cis(y), for finite y.
22483 <li> cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
22484 <li> cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
22485 the result are unspecified).
22486 <li> cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
22487 exception (where the sign of the real part of the result is unspecified).
22488 <li> cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
22489 of the result are unspecified).
22490 <li> cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
22492 <li> cexp(NaN + i0) returns NaN + i0.
22493 <li> cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22494 point exception, for all nonzero numbers y.
22495 <li> cexp(NaN + iNaN) returns NaN + iNaN.
22498 <a name="G.6.3.2" href="#G.6.3.2"><h5>G.6.3.2 The clog functions</h5></a>
22501 <li> clog(conj(z)) = conj(clog(z)).
22502 <li> clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
22504 <li> clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
22506 <li> clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
22507 <li> clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22508 point exception, for finite x.
22509 <!--page 491 indent 4-->
22510 <li> clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
22511 <li> clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
22512 <li> clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
22513 <li> clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
22514 <li> clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
22515 <li> clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22516 point exception, for finite y.
22517 <li> clog(NaN + i (inf)) returns +(inf) + iNaN.
22518 <li> clog(NaN + iNaN) returns NaN + iNaN.
22521 <a name="G.6.4" href="#G.6.4"><h4>G.6.4 Power and absolute-value functions</h4></a>
22523 <a name="G.6.4.1" href="#G.6.4.1"><h5>G.6.4.1 The cpow functions</h5></a>
22525 The cpow functions raise floating-point exceptions if appropriate for the calculation of
22526 the parts of the result, and may raise spurious exceptions.<sup><a href="#note327"><b>327)</b></a></sup>
22529 <p><a name="note327">327)</a> This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
22530 implementations that treat special cases more carefully.
22533 <a name="G.6.4.2" href="#G.6.4.2"><h5>G.6.4.2 The csqrt functions</h5></a>
22536 <li> csqrt(conj(z)) = conj(csqrt(z)).
22537 <li> csqrt((+-)0 + i0) returns +0 + i0.
22538 <li> csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
22539 <li> csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22540 point exception, for finite x.
22541 <li> csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
22542 <li> csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
22543 <li> csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
22544 result is unspecified).
22545 <li> csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
22546 <li> csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
22547 point exception, for finite y.
22548 <li> csqrt(NaN + iNaN) returns NaN + iNaN.
22553 <!--page 492 indent 4-->
22556 <a name="G.7" href="#G.7"><h3>G.7 Type-generic math <tgmath.h></h3></a>
22558 Type-generic macros that accept complex arguments also accept imaginary arguments. If
22559 an argument is imaginary, the macro expands to an expression whose type is real,
22560 imaginary, or complex, as appropriate for the particular function: if the argument is
22561 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
22562 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
22563 the types of the others are complex.
22565 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
22566 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
22568 <!--page 493 indent 4-->
22571 sin(iy) = i sinh(y)
22572 tan(iy) = i tanh(y)
22574 sinh(iy) = i sin(y)
22575 tanh(iy) = i tan(y)
22576 asin(iy) = i asinh(y)
22577 atan(iy) = i atanh(y)
22578 asinh(iy) = i asin(y)
22579 atanh(iy) = i atan(y)</pre>
22581 <a name="H" href="#H"><h2>Annex H</h2></a>
22584 Language independent arithmetic</pre>
22586 <a name="H.1" href="#H.1"><h3>H.1 Introduction</h3></a>
22588 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
22589 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
22590 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
22592 <a name="H.2" href="#H.2"><h3>H.2 Types</h3></a>
22594 The relevant C arithmetic types meet the requirements of LIA-1 types if an
22595 implementation adds notification of exceptional arithmetic operations and meets the 1
22596 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
22598 <a name="H.2.1" href="#H.2.1"><h4>H.2.1 Boolean type</h4></a>
22600 The LIA-1 data type Boolean is implemented by the C data type bool with values of
22601 true and false, all from <stdbool.h>.
22603 <a name="H.2.2" href="#H.2.2"><h4>H.2.2 Integer types</h4></a>
22605 The signed C integer types int, long int, long long int, and the corresponding
22606 unsigned types are compatible with LIA-1. If an implementation adds support for the
22607 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
22608 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
22609 in that overflows or out-of-bounds results silently wrap. An implementation that defines
22610 signed integer types as also being modulo need not detect integer overflow, in which case,
22611 only integer divide-by-zero need be detected.
22613 The parameters for the integer data types can be accessed by the following:
22614 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
22617 minint INT_MIN, LONG_MIN, LLONG_MIN
22619 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
22620 is always 0 for the unsigned types, and is not provided for those types.
22621 <!--page 494 indent 4-->
22623 <a name="H.2.2.1" href="#H.2.2.1"><h5>H.2.2.1 Integer operations</h5></a>
22625 The integer operations on integer types are the following:
22632 absI abs(x), labs(x), llabs(x)
22639 where x and y are expressions of the same integer type.
22641 <a name="H.2.3" href="#H.2.3"><h4>H.2.3 Floating-point types</h4></a>
22643 The C floating-point types float, double, and long double are compatible with
22644 LIA-1. If an implementation adds support for the LIA-1 exceptional values
22645 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
22646 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
22647 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
22650 <a name="H.2.3.1" href="#H.2.3.1"><h5>H.2.3.1 Floating-point parameters</h5></a>
22652 The parameters for a floating point data type can be accessed by the following:
22654 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
22655 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
22656 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
22658 The derived constants for the floating point types are accessed by the following:
22659 <!--page 495 indent 4-->
22660 fmax FLT_MAX, DBL_MAX, LDBL_MAX
22661 fminN FLT_MIN, DBL_MIN, LDBL_MIN
22662 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
22663 rnd_style FLT_ROUNDS
22665 <a name="H.2.3.2" href="#H.2.3.2"><h5>H.2.3.2 Floating-point operations</h5></a>
22667 The floating-point operations on floating-point types are the following:
22673 absF fabsf(x), fabs(x), fabsl(x)
22674 exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
22675 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
22677 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)</pre>
22678 intpartF modff(x, &y), modf(x, &y), modfl(x, &y)
22679 fractpartF modff(x, &y), modf(x, &y), modfl(x, &y)
22686 where x and y are expressions of the same floating point type, n is of type int, and li
22687 is of type long int.
22689 <a name="H.2.3.3" href="#H.2.3.3"><h5>H.2.3.3 Rounding styles</h5></a>
22691 The C Standard requires all floating types to use the same radix and rounding style, so
22692 that only one identifier for each is provided to map to LIA-1.
22694 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
22695 truncate FLT_ROUNDS == 0
22696 <!--page 496 indent 4-->
22697 nearest FLT_ROUNDS == 1
22698 other FLT_ROUNDS != 0 && FLT_ROUNDS != 1
22699 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
22700 in all relevant LIA-1 operations, not just addition as in C.
22702 <a name="H.2.4" href="#H.2.4"><h4>H.2.4 Type conversions</h4></a>
22704 The LIA-1 type conversions are the following type casts:
22705 cvtI' -> I (int)i, (long int)i, (long long int)i,
22707 (unsigned int)i, (unsigned long int)i,
22708 (unsigned long long int)i</pre>
22709 cvtF -> I (int)x, (long int)x, (long long int)x,
22711 (unsigned int)x, (unsigned long int)x,
22712 (unsigned long long int)x</pre>
22713 cvtI -> F (float)i, (double)i, (long double)i
22714 cvtF' -> F (float)x, (double)x, (long double)x
22716 In the above conversions from floating to integer, the use of (cast)x can be replaced with
22717 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
22718 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
22719 conversion functions, lrint(), llrint(), lround(), and llround(), can be
22720 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
22721 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
22723 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
22724 fmod( fabs(rint(x)), 65536.0 ) or (0.0 <= (y = fmod( rint(x),
22725 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
22726 to 65535.0 which can then be cast to unsigned short int. But, the
22727 remainder() function is not useful for doing silent wrapping to signed integer types,
22728 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
22729 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
22732 C's conversions (casts) from floating-point to floating-point can meet LIA-1
22733 requirements if an implementation uses round-to-nearest (IEC 60559 default).
22735 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
22736 implementation uses round-to-nearest.
22737 <!--page 497 indent 4-->
22739 <a name="H.3" href="#H.3"><h3>H.3 Notification</h3></a>
22741 Notification is the process by which a user or program is informed that an exceptional
22742 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
22743 allows an implementation to cause a notification to occur when any arithmetic operation
22744 returns an exceptional value as defined in LIA-1 clause 5.
22746 <a name="H.3.1" href="#H.3.1"><h4>H.3.1 Notification alternatives</h4></a>
22748 LIA-1 requires at least the following two alternatives for handling of notifications:
22749 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
22752 An implementation need only support a given notification alternative for the entire
22753 program. An implementation may support the ability to switch between notification
22754 alternatives during execution, but is not required to do so. An implementation can
22755 provide separate selection for each kind of notification, but this is not required.
22757 C allows an implementation to provide notification. C's SIGFPE (for traps) and
22758 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
22759 can provide LIA-1 notification.
22761 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
22762 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
22763 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
22764 and-resume behavior with the same constraint.
22766 <a name="H.3.1.1" href="#H.3.1.1"><h5>H.3.1.1 Indicators</h5></a>
22768 C's <fenv.h> status flags are compatible with the LIA-1 indicators.
22770 The following mapping is for floating-point types:
22771 undefined FE_INVALID, FE_DIVBYZERO
22772 floating_overflow FE_OVERFLOW
22773 underflow FE_UNDERFLOW
22775 The floating-point indicator interrogation and manipulation operations are:
22776 set_indicators feraiseexcept(i)
22777 clear_indicators feclearexcept(i)
22778 test_indicators fetestexcept(i)
22779 current_indicators fetestexcept(FE_ALL_EXCEPT)
22780 where i is an expression of type int representing a subset of the LIA-1 indicators.
22782 C allows an implementation to provide the following LIA-1 required behavior: at
22783 program termination if any indicator is set the implementation shall send an unambiguous
22784 <!--page 498 indent 4-->
22785 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
22787 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
22788 This documentation makes that distinction because <fenv.h> covers only the floating-
22791 <a name="H.3.1.2" href="#H.3.1.2"><h5>H.3.1.2 Traps</h5></a>
22793 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
22794 math library functions (which are not permitted to generate any externally visible
22795 exceptional conditions). An implementation can provide an alternative of notification
22796 through termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
22798 LIA-1 does not require that traps be precise.
22800 C does require that SIGFPE be the signal corresponding to arithmetic exceptions, if there
22801 is any signal raised for them.
22803 C supports signal handlers for SIGFPE and allows trapping of arithmetic exceptions.
22804 When arithmetic exceptions do trap, C's signal-handler mechanism allows trap-and-
22805 terminate (either default implementation behavior or user replacement for it) or trap-and-
22806 resume, at the programmer's option.
22807 <!--page 499 indent 4-->
22809 <a name="I" href="#I"><h2>Annex I</h2></a>
22813 Common warnings</pre>
22814 An implementation may generate warnings in many situations, none of which are
22815 specified as part of this International Standard. The following are a few of the more
22819 <li> A new struct or union type appears in a function prototype (<a href="#6.2.1">6.2.1</a>, <a href="#6.7.2.3">6.7.2.3</a>).
22820 <li> A block with initialization of an object that has automatic storage duration is jumped
22821 into (<a href="#6.2.4">6.2.4</a>).
22822 <li> An implicit narrowing conversion is encountered, such as the assignment of a long
22823 int or a double to an int, or a pointer to void to a pointer to any type other than
22824 a character type (<a href="#6.3">6.3</a>).
22825 <li> A hexadecimal floating constant cannot be represented exactly in its evaluation format
22826 (<a href="#6.4.4.2">6.4.4.2</a>).
22827 <li> An integer character constant includes more than one character or a wide character
22828 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
22829 <li> The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
22830 <li> An ''unordered'' binary operator (not comma, &&, or ||) contains a side effect to an
22831 lvalue in one operand, and a side effect to, or an access to the value of, the identical
22832 lvalue in the other operand (<a href="#6.5">6.5</a>).
22833 <li> A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
22834 <li> The arguments in a function call do not agree in number and type with those of the
22835 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
22836 <li> An object is defined but not used (<a href="#6.7">6.7</a>).
22837 <li> A value is given to an object of an enumerated type other than by assignment of an
22838 enumeration constant that is a member of that type, or an enumeration object that has
22839 the same type, or the value of a function that returns the same enumerated type
22840 (<a href="#6.7.2.2">6.7.2.2</a>).
22841 <li> An aggregate has a partly bracketed initialization (<a href="#6.7.7">6.7.7</a>).
22842 <li> A statement cannot be reached (<a href="#6.8">6.8</a>).
22843 <li> A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
22844 <li> A constant expression is used as the controlling expression of a selection statement
22845 (<a href="#6.8.4">6.8.4</a>).
22846 <!--page 500 indent 0-->
22847 <li> An incorrectly formed preprocessing group is encountered while skipping a
22848 preprocessing group (<a href="#6.10.1">6.10.1</a>).
22849 <li> An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
22850 <!--page 501 indent 4-->
22853 <a name="J" href="#J"><h2>Annex J</h2></a>
22857 Portability issues</pre>
22858 This annex collects some information about portability that appears in this International
22861 <a name="J.1" href="#J.1"><h3>J.1 Unspecified behavior</h3></a>
22863 The following are unspecified:
22865 <li> The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
22866 <li> The termination status returned to the hosted environment if the return type of main
22867 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
22868 <li> The behavior of the display device if a printing character is written when the active
22869 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
22870 <li> The behavior of the display device if a backspace character is written when the active
22871 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
22872 <li> The behavior of the display device if a horizontal tab character is written when the
22873 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
22874 <li> The behavior of the display device if a vertical tab character is written when the active
22875 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
22876 <li> How an extended source character that does not correspond to a universal character
22877 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
22878 <li> Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
22879 <li> The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
22880 <li> The value of a union member other than the last one stored into (<a href="#6.2.6.1">6.2.6.1</a>).
22881 <li> The representation used when storing a value in an object that has more than one
22882 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
22883 <li> The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
22884 <li> Whether certain operators can generate negative zeros and whether a negative zero
22885 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
22886 <li> Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
22887 <li> The order in which subexpressions are evaluated and the order in which side effects
22888 take place, except as specified for the function-call (), &&, ||, ?:, and comma
22889 operators (<a href="#6.5">6.5</a>).
22890 <!--page 502 indent 0-->
22891 <li> The order in which the function designator, arguments, and subexpressions within the
22892 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
22893 <li> The order of side effects among compound literal initialization list expressions
22894 (<a href="#6.5.2.5">6.5.2.5</a>).
22895 <li> The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
22896 <li> The alignment of the addressable storage unit allocated to hold a bit-field (<a href="#6.7.2.1">6.7.2.1</a>).
22897 <li> Whether a call to an inline function uses the inline definition or the external definition
22898 of the function (<a href="#6.7.4">6.7.4</a>).
22899 <li> Whether or not a size expression is evaluated when it is part of the operand of a
22900 sizeof operator and changing the value of the size expression would not affect the
22901 result of the operator (<a href="#6.7.5.2">6.7.5.2</a>).
22902 <li> The order in which any side effects occur among the initialization list expressions in
22903 an initializer (<a href="#6.7.8">6.7.8</a>).
22904 <li> The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
22905 <li> When a fully expanded macro replacement list contains a function-like macro name
22906 as its last preprocessing token and the next preprocessing token from the source file is
22907 a (, and the fully expanded replacement of that macro ends with the name of the first
22908 macro and the next preprocessing token from the source file is again a (, whether that
22909 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
22910 <li> The order in which # and ## operations are evaluated during macro substitution
22911 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
22912 <li> Whether errno is a macro or an identifier with external linkage (<a href="#7.5">7.5</a>).
22913 <li> The state of the floating-point status flags when execution passes from a part of the
22914 program translated with FENV_ACCESS ''off'' to a part translated with
22915 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
22916 <li> The order in which feraiseexcept raises floating-point exceptions, except as
22917 stated in <a href="#F.7.6">F.7.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
22918 <li> Whether math_errhandling is a macro or an identifier with external linkage
22919 (<a href="#7.12">7.12</a>).
22920 <li> The results of the frexp functions when the specified value is not a floating-point
22921 number (<a href="#7.12.6.4">7.12.6.4</a>).
22922 <li> The numeric result of the ilogb functions when the correct value is outside the
22923 range of the return type (<a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.9.3.5">F.9.3.5</a>).
22924 <li> The result of rounding when the value is out of range (<a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.5">F.9.6.5</a>).
22925 <!--page 503 indent 0-->
22926 <li> The value stored by the remquo functions in the object pointed to by quo when y is
22927 zero (<a href="#7.12.10.3">7.12.10.3</a>).
22928 <li> Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
22929 <li> Whether va_copy and va_end are macros or identifiers with external linkage
22930 (<a href="#7.15.1">7.15.1</a>).
22931 <li> The hexadecimal digit before the decimal point when a non-normalized floating-point
22932 number is printed with an a or A conversion specifier (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
22933 <li> The value of the file position indicator after a successful call to the ungetc function
22934 for a text stream, or the ungetwc function for any stream, until all pushed-back
22935 characters are read or discarded (<a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.24.3.10">7.24.3.10</a>).
22936 <li> The details of the value stored by the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>).
22937 <li> The details of the value returned by the ftell function for a text stream (<a href="#7.19.9.4">7.19.9.4</a>).
22938 <li> Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
22939 functions convert a minus-signed sequence to a negative number directly or by
22940 negating the value resulting from converting the corresponding unsigned sequence
22941 (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
22942 <li> The order and contiguity of storage allocated by successive calls to the calloc,
22943 malloc, and realloc functions (<a href="#7.20.3">7.20.3</a>).
22944 <li> The amount of storage allocated by a successful call to the calloc, malloc, or
22945 realloc function when 0 bytes was requested (<a href="#7.20.3">7.20.3</a>).
22946 <li> Which of two elements that compare as equal is matched by the bsearch function
22947 (<a href="#7.20.5.1">7.20.5.1</a>).
22948 <li> The order of two elements that compare as equal in an array sorted by the qsort
22949 function (<a href="#7.20.5.2">7.20.5.2</a>).
22950 <li> The encoding of the calendar time returned by the time function (<a href="#7.23.2.4">7.23.2.4</a>).
22951 <li> The characters stored by the strftime or wcsftime function if any of the time
22952 values being converted is outside the normal range (<a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.5.1">7.24.5.1</a>).
22953 <li> The conversion state after an encoding error occurs (<a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>,
22954 <a href="#7.24.6.4.2">7.24.6.4.2</a>,
22955 <li> The resulting value when the ''invalid'' floating-point exception is raised during
22956 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
22957 <li> Whether conversion of non-integer IEC 60559 floating values to integer raises the
22958 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
22959 <!--page 504 indent 4-->
22960 <li> Whether or when library functions in <math.h> raise the ''inexact'' floating-point
22961 exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
22962 <li> Whether or when library functions in <math.h> raise an undeserved ''underflow''
22963 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
22964 <li> The exponent value stored by frexp for a NaN or infinity (<a href="#F.9.3.4">F.9.3.4</a>).
22965 <li> The numeric result returned by the lrint, llrint, lround, and llround
22966 functions if the rounded value is outside the range of the return type (<a href="#F.9.6.5">F.9.6.5</a>, <a href="#F.9.6.7">F.9.6.7</a>).
22967 <li> The sign of one part of the complex result of several math functions for certain
22968 exceptional values in IEC 60559 compatible implementations (<a href="#G.6.1.1">G.6.1.1</a>, <a href="#G.6.2.2">G.6.2.2</a>,
22969 <a href="#G.6.2.3">G.6.2.3</a>, <a href="#G.6.2.4">G.6.2.4</a>, <a href="#G.6.2.5">G.6.2.5</a>, <a href="#G.6.2.6">G.6.2.6</a>, <a href="#G.6.3.1">G.6.3.1</a>, <a href="#G.6.4.2">G.6.4.2</a>).
22972 <a name="J.2" href="#J.2"><h3>J.2 Undefined behavior</h3></a>
22974 The behavior is undefined in the following circumstances:
22976 <li> A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
22978 <li> A nonempty source file does not end in a new-line character which is not immediately
22979 preceded by a backslash character or ends in a partial preprocessing token or
22980 comment (<a href="#5.1.1.2">5.1.1.2</a>).
22981 <li> Token concatenation produces a character sequence matching the syntax of a
22982 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
22983 <li> A program in a hosted environment does not define a function named main using one
22984 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
22985 <li> A character not in the basic source character set is encountered in a source file, except
22986 in an identifier, a character constant, a string literal, a header name, a comment, or a
22987 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
22988 <li> An identifier, comment, string literal, character constant, or header name contains an
22989 invalid multibyte character or does not begin and end in the initial shift state (<a href="#5.2.1.2">5.2.1.2</a>).
22990 <li> The same identifier has both internal and external linkage in the same translation unit
22991 (<a href="#6.2.2">6.2.2</a>).
22992 <li> An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
22993 <li> The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
22994 <li> The value of an object with automatic storage duration is used while it is
22995 indeterminate (<a href="#6.2.4">6.2.4</a>, <a href="#6.7.8">6.7.8</a>, <a href="#6.8">6.8</a>).
22996 <li> A trap representation is read by an lvalue expression that does not have character type
22997 (<a href="#6.2.6.1">6.2.6.1</a>).
22998 <!--page 505 indent 0-->
22999 <li> A trap representation is produced by a side effect that modifies any part of the object
23000 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
23001 <li> The arguments to certain operators are such that could produce a negative zero result,
23002 but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
23003 <li> Two declarations of the same object or function specify types that are not compatible
23004 (<a href="#6.2.7">6.2.7</a>).
23005 <li> Conversion to or from an integer type produces a value outside the range that can be
23006 represented (<a href="#6.3.1.4">6.3.1.4</a>).
23007 <li> Demotion of one real floating type to another produces a value outside the range that
23008 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
23009 <li> An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
23010 <li> A non-array lvalue with an incomplete type is used in a context that requires the value
23011 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
23012 <li> An lvalue having array type is converted to a pointer to the initial element of the
23013 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
23014 <li> An attempt is made to use the value of a void expression, or an implicit or explicit
23015 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
23016 <li> Conversion of a pointer to an integer type produces a value outside the range that can
23017 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
23018 <li> Conversion between two pointer types produces a result that is incorrectly aligned
23019 (<a href="#6.3.2.3">6.3.2.3</a>).
23020 <li> A pointer is used to call a function whose type is not compatible with the pointed-to
23021 type (<a href="#6.3.2.3">6.3.2.3</a>).
23022 <li> An unmatched ' or " character is encountered on a logical source line during
23023 tokenization (<a href="#6.4">6.4</a>).
23024 <li> A reserved keyword token is used in translation phase 7 or 8 for some purpose other
23025 than as a keyword (<a href="#6.4.1">6.4.1</a>).
23026 <li> A universal character name in an identifier does not designate a character whose
23027 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
23028 <li> The initial character of an identifier is a universal character name designating a digit
23029 (<a href="#6.4.2.1">6.4.2.1</a>).
23030 <li> Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
23031 <li> The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
23032 <!--page 506 indent 0-->
23033 <li> The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
23034 <li> The characters ', \, ", //, or /* occur in the sequence between the < and >
23035 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
23036 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
23037 <li> Between two sequence points, an object is modified more than once, or is modified
23038 and the prior value is read other than to determine the value to be stored (<a href="#6.5">6.5</a>).
23039 <li> An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
23040 <li> An object has its stored value accessed other than by an lvalue of an allowable type
23041 (<a href="#6.5">6.5</a>).
23042 <li> An attempt is made to modify the result of a function call, a conditional operator, an
23043 assignment operator, or a comma operator, or to access it after the next sequence
23044 point (<a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.15">6.5.15</a>, <a href="#6.5.16">6.5.16</a>, <a href="#6.5.17">6.5.17</a>).
23045 <li> For a call to a function without a function prototype in scope, the number of
23046 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
23047 <li> For call to a function without a function prototype in scope where the function is
23048 defined with a function prototype, either the prototype ends with an ellipsis or the
23049 types of the arguments after promotion are not compatible with the types of the
23050 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
23051 <li> For a call to a function without a function prototype in scope where the function is not
23052 defined with a function prototype, the types of the arguments after promotion are not
23053 compatible with those of the parameters after promotion (with certain exceptions)
23054 (<a href="#6.5.2.2">6.5.2.2</a>).
23055 <li> A function is defined with a type that is not compatible with the type (of the
23056 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
23057 <li> The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
23058 <li> A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
23059 <li> The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
23060 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
23061 integer type produces a result that does not point into, or just beyond, the same array
23062 object (<a href="#6.5.6">6.5.6</a>).
23063 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
23064 integer type produces a result that points just beyond the array object and is used as
23065 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
23066 <li> Pointers that do not point into, or just beyond, the same array object are subtracted
23067 (<a href="#6.5.6">6.5.6</a>).
23068 <!--page 507 indent 0-->
23069 <li> An array subscript is out of range, even if an object is apparently accessible with the
23070 given subscript (as in the lvalue expression a[1][7] given the declaration int
23071 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
23072 <li> The result of subtracting two pointers is not representable in an object of type
23073 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
23074 <li> An expression is shifted by a negative number or by an amount greater than or equal
23075 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
23076 <li> An expression having signed promoted type is left-shifted and either the value of the
23077 expression is negative or the result of shifting would be not be representable in the
23078 promoted type (<a href="#6.5.7">6.5.7</a>).
23079 <li> Pointers that do not point to the same aggregate or union (nor just beyond the same
23080 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
23081 <li> An object is assigned to an inexactly overlapping object or to an exactly overlapping
23082 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
23083 <li> An expression that is required to be an integer constant expression does not have an
23084 integer type; has operands that are not integer constants, enumeration constants,
23085 character constants, sizeof expressions whose results are integer constants, or
23086 immediately-cast floating constants; or contains casts (outside operands to sizeof
23087 operators) other than conversions of arithmetic types to integer types (<a href="#6.6">6.6</a>).
23088 <li> A constant expression in an initializer is not, or does not evaluate to, one of the
23089 following: an arithmetic constant expression, a null pointer constant, an address
23090 constant, or an address constant for an object type plus or minus an integer constant
23091 expression (<a href="#6.6">6.6</a>).
23092 <li> An arithmetic constant expression does not have arithmetic type; has operands that
23093 are not integer constants, floating constants, enumeration constants, character
23094 constants, or sizeof expressions; or contains casts (outside operands to sizeof
23095 operators) other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
23096 <li> The value of an object is accessed by an array-subscript [], member-access . or ->,
23097 address &, or indirection * operator or a pointer cast in creating an address constant
23098 (<a href="#6.6">6.6</a>).
23099 <li> An identifier for an object is declared with no linkage and the type of the object is
23100 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
23101 <li> A function is declared at block scope with an explicit storage-class specifier other
23102 than extern (<a href="#6.7.1">6.7.1</a>).
23103 <li> A structure or union is defined as containing no named members (<a href="#6.7.2.1">6.7.2.1</a>).
23104 <!--page 508 indent 0-->
23105 <li> An attempt is made to access, or generate a pointer to just past, a flexible array
23106 member of a structure when the referenced object provides no elements for that array
23107 (<a href="#6.7.2.1">6.7.2.1</a>).
23108 <li> When the complete type is needed, an incomplete structure or union type is not
23109 completed in the same scope by another declaration of the tag that defines the content
23110 (<a href="#6.7.2.3">6.7.2.3</a>).
23111 <li> An attempt is made to modify an object defined with a const-qualified type through
23112 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
23113 <li> An attempt is made to refer to an object defined with a volatile-qualified type through
23114 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
23115 <li> The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
23116 <li> Two qualified types that are required to be compatible do not have the identically
23117 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
23118 <li> An object which has been modified is accessed through a restrict-qualified pointer to
23119 a const-qualified type, or through a restrict-qualified pointer and another pointer that
23120 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
23121 <li> A restrict-qualified pointer is assigned a value based on another restricted pointer
23122 whose associated block neither began execution before the block associated with this
23123 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
23124 <li> A function with external linkage is declared with an inline function specifier, but is
23125 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
23126 <li> Two pointer types that are required to be compatible are not identically qualified, or
23127 are not pointers to compatible types (<a href="#6.7.5.1">6.7.5.1</a>).
23128 <li> The size expression in an array declaration is not a constant expression and evaluates
23129 at program execution time to a nonpositive value (<a href="#6.7.5.2">6.7.5.2</a>).
23130 <li> In a context requiring two array types to be compatible, they do not have compatible
23131 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.5.2">6.7.5.2</a>).
23132 <li> A declaration of an array parameter includes the keyword static within the [ and
23133 ] and the corresponding argument does not provide access to the first element of an
23134 array with at least the specified number of elements (<a href="#6.7.5.3">6.7.5.3</a>).
23135 <li> A storage-class specifier or type qualifier modifies the keyword void as a function
23136 parameter type list (<a href="#6.7.5.3">6.7.5.3</a>).
23137 <li> In a context requiring two function types to be compatible, they do not have
23138 compatible return types, or their parameters disagree in use of the ellipsis terminator
23139 or the number and type of parameters (after default argument promotion, when there
23140 is no parameter type list or when one type is specified by a function definition with an
23141 <!--page 509 indent 0-->
23142 identifier list) (<a href="#6.7.5.3">6.7.5.3</a>).
23143 <li> The value of an unnamed member of a structure or union is used (<a href="#6.7.8">6.7.8</a>).
23144 <li> The initializer for a scalar is neither a single expression nor a single expression
23145 enclosed in braces (<a href="#6.7.8">6.7.8</a>).
23146 <li> The initializer for a structure or union object that has automatic storage duration is
23147 neither an initializer list nor a single expression that has compatible structure or union
23148 type (<a href="#6.7.8">6.7.8</a>).
23149 <li> The initializer for an aggregate or union, other than an array initialized by a string
23150 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.8">6.7.8</a>).
23151 <li> An identifier with external linkage is used, but in the program there does not exist
23152 exactly one external definition for the identifier, or the identifier is not used and there
23153 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
23154 <li> A function definition includes an identifier list, but the types of the parameters are not
23155 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
23156 <li> An adjusted parameter type in a function definition is not an object type (<a href="#6.9.1">6.9.1</a>).
23157 <li> A function that accepts a variable number of arguments is defined without a
23158 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
23159 <li> The } that terminates a function is reached, and the value of the function call is used
23160 by the caller (<a href="#6.9.1">6.9.1</a>).
23161 <li> An identifier for an object with internal linkage and an incomplete type is declared
23162 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
23163 <li> The token defined is generated during the expansion of a #if or #elif
23164 preprocessing directive, or the use of the defined unary operator does not match
23165 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
23166 <li> The #include preprocessing directive that results after expansion does not match
23167 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
23168 <li> The character sequence in an #include preprocessing directive does not start with a
23169 letter (<a href="#6.10.2">6.10.2</a>).
23170 <li> There are sequences of preprocessing tokens within the list of macro arguments that
23171 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
23172 <li> The result of the preprocessing operator # is not a valid character string literal
23173 (<a href="#6.10.3.2">6.10.3.2</a>).
23174 <li> The result of the preprocessing operator ## is not a valid preprocessing token
23175 (<a href="#6.10.3.3">6.10.3.3</a>).
23176 <!--page 510 indent 0-->
23177 <li> The #line preprocessing directive that results after expansion does not match one of
23178 the two well-defined forms, or its digit sequence specifies zero or a number greater
23179 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
23180 <li> A non-STDC #pragma preprocessing directive that is documented as causing
23181 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
23182 <li> A #pragma STDC preprocessing directive does not match one of the well-defined
23183 forms (<a href="#6.10.6">6.10.6</a>).
23184 <li> The name of a predefined macro, or the identifier defined, is the subject of a
23185 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
23186 <li> An attempt is made to copy an object to an overlapping object by use of a library
23187 function, other than as explicitly allowed (e.g., memmove) (clause 7).
23188 <li> A file with the same name as one of the standard headers, not provided as part of the
23189 implementation, is placed in any of the standard places that are searched for included
23190 source files (<a href="#7.1.2">7.1.2</a>).
23191 <li> A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
23192 <li> A function, object, type, or macro that is specified as being declared or defined by
23193 some standard header is used before any header that declares or defines it is included
23194 (<a href="#7.1.2">7.1.2</a>).
23195 <li> A standard header is included while a macro is defined with the same name as a
23196 keyword (<a href="#7.1.2">7.1.2</a>).
23197 <li> The program attempts to declare a library function itself, rather than via a standard
23198 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
23199 <li> The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
23200 (<a href="#7.1.3">7.1.3</a>).
23201 <li> The program removes the definition of a macro whose name begins with an
23202 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
23203 <li> An argument to a library function has an invalid value or a type not expected by a
23204 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
23205 <li> The pointer passed to a library function array parameter does not have a value such
23206 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
23207 <li> The macro definition of assert is suppressed in order to access an actual function
23208 (<a href="#7.2">7.2</a>).
23209 <li> The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
23210 <li> The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
23211 any context other than outside all external declarations or preceding all explicit
23212 <!--page 511 indent 0-->
23213 declarations and statements inside a compound statement (<a href="#7.3.4">7.3.4</a>, <a href="#7.6.1">7.6.1</a>, <a href="#7.12.2">7.12.2</a>).
23214 <li> The value of an argument to a character handling function is neither equal to the value
23215 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
23216 <li> A macro definition of errno is suppressed in order to access an actual object, or the
23217 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
23218 <li> Part of the program tests floating-point status flags, sets floating-point control modes,
23219 or runs under non-default mode settings, but was translated with the state for the
23220 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
23221 <li> The exception-mask argument for one of the functions that provide access to the
23222 floating-point status flags has a nonzero value not obtained by bitwise OR of the
23223 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
23224 <li> The fesetexceptflag function is used to set floating-point status flags that were
23225 not specified in the call to the fegetexceptflag function that provided the value
23226 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
23227 <li> The argument to fesetenv or feupdateenv is neither an object set by a call to
23228 fegetenv or feholdexcept, nor is it an environment macro (<a href="#7.6.4.3">7.6.4.3</a>, <a href="#7.6.4.4">7.6.4.4</a>).
23229 <li> The value of the result of an integer arithmetic or conversion function cannot be
23230 represented (<a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.20.6.1">7.20.6.1</a>, <a href="#7.20.6.2">7.20.6.2</a>, <a href="#7.20.1">7.20.1</a>).
23231 <li> The program modifies the string pointed to by the value returned by the setlocale
23232 function (<a href="#7.11.1.1">7.11.1.1</a>).
23233 <li> The program modifies the structure pointed to by the value returned by the
23234 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
23235 <li> A macro definition of math_errhandling is suppressed or the program defines
23236 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
23237 <li> An argument to a floating-point classification or comparison macro is not of real
23238 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
23239 <li> A macro definition of setjmp is suppressed in order to access an actual function, or
23240 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
23241 <li> An invocation of the setjmp macro occurs other than in an allowed context
23242 (<a href="#7.13.2.1">7.13.2.1</a>).
23243 <li> The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
23244 <li> After a longjmp, there is an attempt to access the value of an object of automatic
23245 storage class with non-volatile-qualified type, local to the function containing the
23246 invocation of the corresponding setjmp macro, that was changed between the
23247 setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
23248 <!--page 512 indent 0-->
23249 <li> The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
23250 <li> A signal handler returns when the signal corresponded to a computational exception
23251 (<a href="#7.14.1.1">7.14.1.1</a>).
23252 <li> A signal occurs as the result of calling the abort or raise function, and the signal
23253 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
23254 <li> A signal occurs other than as the result of calling the abort or raise function, and
23255 the signal handler refers to an object with static storage duration other than by
23256 assigning a value to an object declared as volatile sig_atomic_t, or calls any
23257 function in the standard library other than the abort function, the _Exit function,
23258 or the signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
23259 <li> The value of errno is referred to after a signal occurred other than as the result of
23260 calling the abort or raise function and the corresponding signal handler obtained
23261 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
23262 <li> A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
23263 <li> A function with a variable number of arguments attempts to access its varying
23264 arguments other than through a properly declared and initialized va_list object, or
23265 before the va_start macro is invoked (<a href="#7.15">7.15</a>, <a href="#7.15.1.1">7.15.1.1</a>, <a href="#7.15.1.4">7.15.1.4</a>).
23266 <li> The macro va_arg is invoked using the parameter ap that was passed to a function
23267 that invoked the macro va_arg with the same parameter (<a href="#7.15">7.15</a>).
23268 <li> A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
23269 order to access an actual function, or the program defines an external identifier with
23270 the name va_copy or va_end (<a href="#7.15.1">7.15.1</a>).
23271 <li> The va_start or va_copy macro is invoked without a corresponding invocation
23272 of the va_end macro in the same function, or vice versa (<a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.2">7.15.1.2</a>, <a href="#7.15.1.3">7.15.1.3</a>,
23273 <a href="#7.15.1.4">7.15.1.4</a>).
23274 <li> The type parameter to the va_arg macro is not such that a pointer to an object of
23275 that type can be obtained simply by postfixing a * (<a href="#7.15.1.1">7.15.1.1</a>).
23276 <li> The va_arg macro is invoked when there is no actual next argument, or with a
23277 specified type that is not compatible with the promoted type of the actual next
23278 argument, with certain exceptions (<a href="#7.15.1.1">7.15.1.1</a>).
23279 <li> The va_copy or va_start macro is called to initialize a va_list that was
23280 previously initialized by either macro without an intervening invocation of the
23281 va_end macro for the same va_list (<a href="#7.15.1.2">7.15.1.2</a>, <a href="#7.15.1.4">7.15.1.4</a>).
23282 <li> The parameter parmN of a va_start macro is declared with the register
23283 storage class, with a function or array type, or with a type that is not compatible with
23284 the type that results after application of the default argument promotions (<a href="#7.15.1.4">7.15.1.4</a>).
23285 <!--page 513 indent 0-->
23286 <li> The member designator parameter of an offsetof macro is an invalid right
23287 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.17">7.17</a>).
23288 <li> The argument in an instance of one of the integer-constant macros is not a decimal,
23289 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
23290 corresponding type (<a href="#7.18.4">7.18.4</a>).
23291 <li> A byte input/output function is applied to a wide-oriented stream, or a wide character
23292 input/output function is applied to a byte-oriented stream (<a href="#7.19.2">7.19.2</a>).
23293 <li> Use is made of any portion of a file beyond the most recent wide character written to
23294 a wide-oriented stream (<a href="#7.19.2">7.19.2</a>).
23295 <li> The value of a pointer to a FILE object is used after the associated file is closed
23296 (<a href="#7.19.3">7.19.3</a>).
23297 <li> The stream for the fflush function points to an input stream or to an update stream
23298 in which the most recent operation was input (<a href="#7.19.5.2">7.19.5.2</a>).
23299 <li> The string pointed to by the mode argument in a call to the fopen function does not
23300 exactly match one of the specified character sequences (<a href="#7.19.5.3">7.19.5.3</a>).
23301 <li> An output operation on an update stream is followed by an input operation without an
23302 intervening call to the fflush function or a file positioning function, or an input
23303 operation on an update stream is followed by an output operation with an intervening
23304 call to a file positioning function (<a href="#7.19.5.3">7.19.5.3</a>).
23305 <li> An attempt is made to use the contents of the array that was supplied in a call to the
23306 setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
23307 <li> There are insufficient arguments for the format in a call to one of the formatted
23308 input/output functions, or an argument does not have an appropriate type (<a href="#7.19.6.1">7.19.6.1</a>,
23309 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23310 <li> The format in a call to one of the formatted input/output functions or to the
23311 strftime or wcsftime function is not a valid multibyte character sequence that
23312 begins and ends in its initial shift state (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>,
23313 <a href="#7.24.5.1">7.24.5.1</a>).
23314 <li> In a call to one of the formatted output functions, a precision appears with a
23315 conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
23316 <li> A conversion specification for a formatted output function uses an asterisk to denote
23317 an argument-supplied field width or precision, but the corresponding argument is not
23318 provided (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
23319 <li> A conversion specification for a formatted output function uses a # or 0 flag with a
23320 conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
23321 <!--page 514 indent 0-->
23322 <li> A conversion specification for one of the formatted input/output functions uses a
23323 length modifier with a conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>,
23324 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23325 <li> An s conversion specifier is encountered by one of the formatted output functions,
23326 and the argument is missing the null terminator (unless a precision is specified that
23327 does not require null termination) (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
23328 <li> An n conversion specification for one of the formatted input/output functions includes
23329 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.19.6.1">7.19.6.1</a>,
23330 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23331 <li> A % conversion specifier is encountered by one of the formatted input/output
23332 functions, but the complete conversion specification is not exactly %% (<a href="#7.19.6.1">7.19.6.1</a>,
23333 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23334 <li> An invalid conversion specification is found in the format for one of the formatted
23335 input/output functions, or the strftime or wcsftime function (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>,
23336 <a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.5.1">7.24.5.1</a>).
23337 <li> The number of characters transmitted by a formatted output function is greater than
23338 INT_MAX (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.10">7.19.6.10</a>).
23339 <li> The result of a conversion by one of the formatted input functions cannot be
23340 represented in the corresponding object, or the receiving object does not have an
23341 appropriate type (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23342 <li> A c, s, or [ conversion specifier is encountered by one of the formatted input
23343 functions, and the array pointed to by the corresponding argument is not large enough
23344 to accept the input sequence (and a null terminator if the conversion specifier is s or
23345 [) (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23346 <li> A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
23347 formatted input functions, but the input is not a valid multibyte character sequence
23348 that begins in the initial shift state (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23349 <li> The input item for a %p conversion by one of the formatted input functions is not a
23350 value converted earlier during the same program execution (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23351 <li> The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
23352 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
23353 vwscanf function is called with an improperly initialized va_list argument, or
23354 the argument is used (other than in an invocation of va_end) after the function
23355 returns (<a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>, <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>,
23356 <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>).
23357 <li> The contents of the array supplied in a call to the fgets, gets, or fgetws function
23358 are used after a read error occurred (<a href="#7.19.7.2">7.19.7.2</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.24.3.2">7.24.3.2</a>).
23359 <!--page 515 indent 0-->
23360 <li> The file position indicator for a binary stream is used after a call to the ungetc
23361 function where its value was zero before the call (<a href="#7.19.7.11">7.19.7.11</a>).
23362 <li> The file position indicator for a stream is used after an error occurred during a call to
23363 the fread or fwrite function (<a href="#7.19.8.1">7.19.8.1</a>, <a href="#7.19.8.2">7.19.8.2</a>).
23364 <li> A partial element read by a call to the fread function is used (<a href="#7.19.8.1">7.19.8.1</a>).
23365 <li> The fseek function is called for a text stream with a nonzero offset and either the
23366 offset was not returned by a previous successful call to the ftell function on a
23367 stream associated with the same file or whence is not SEEK_SET (<a href="#7.19.9.2">7.19.9.2</a>).
23368 <li> The fsetpos function is called to set a position that was not returned by a previous
23369 successful call to the fgetpos function on a stream associated with the same file
23370 (<a href="#7.19.9.3">7.19.9.3</a>).
23371 <li> A non-null pointer returned by a call to the calloc, malloc, or realloc function
23372 with a zero requested size is used to access an object (<a href="#7.20.3">7.20.3</a>).
23373 <li> The value of a pointer that refers to space deallocated by a call to the free or
23374 realloc function is used (<a href="#7.20.3">7.20.3</a>).
23375 <li> The pointer argument to the free or realloc function does not match a pointer
23376 earlier returned by calloc, malloc, or realloc, or the space has been
23377 deallocated by a call to free or realloc (<a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.4">7.20.3.4</a>).
23378 <li> The value of the object allocated by the malloc function is used (<a href="#7.20.3.3">7.20.3.3</a>).
23379 <li> The value of any bytes in a new object allocated by the realloc function beyond
23380 the size of the old object are used (<a href="#7.20.3.4">7.20.3.4</a>).
23381 <li> The program executes more than one call to the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
23382 <li> During the call to a function registered with the atexit function, a call is made to
23383 the longjmp function that would terminate the call to the registered function
23384 (<a href="#7.20.4.3">7.20.4.3</a>).
23385 <li> The string set up by the getenv or strerror function is modified by the program
23386 (<a href="#7.20.4.5">7.20.4.5</a>, <a href="#7.21.6.2">7.21.6.2</a>).
23387 <li> A command is executed through the system function in a way that is documented as
23388 causing termination or some other form of undefined behavior (<a href="#7.20.4.6">7.20.4.6</a>).
23389 <li> A searching or sorting utility function is called with an invalid pointer argument, even
23390 if the number of elements is zero (<a href="#7.20.5">7.20.5</a>).
23391 <li> The comparison function called by a searching or sorting utility function alters the
23392 contents of the array being searched or sorted, or returns ordering values
23393 inconsistently (<a href="#7.20.5">7.20.5</a>).
23394 <!--page 516 indent 0-->
23395 <li> The array being searched by the bsearch function does not have its elements in
23396 proper order (<a href="#7.20.5.1">7.20.5.1</a>).
23397 <li> The current conversion state is used by a multibyte/wide character conversion
23398 function after changing the LC_CTYPE category (<a href="#7.20.7">7.20.7</a>).
23399 <li> A string or wide string utility function is instructed to access an array beyond the end
23400 of an object (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
23401 <li> A string or wide string utility function is called with an invalid pointer argument, even
23402 if the length is zero (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
23403 <li> The contents of the destination array are used after a call to the strxfrm,
23404 strftime, wcsxfrm, or wcsftime function in which the specified length was
23405 too small to hold the entire null-terminated result (<a href="#7.21.4.5">7.21.4.5</a>, <a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.4.4.4">7.24.4.4.4</a>,
23406 <a href="#7.24.5.1">7.24.5.1</a>).
23407 <li> The first argument in the very first call to the strtok or wcstok is a null pointer
23408 (<a href="#7.21.5.8">7.21.5.8</a>, <a href="#7.24.4.5.7">7.24.4.5.7</a>).
23409 <li> The type of an argument to a type-generic macro is not compatible with the type of
23410 the corresponding parameter of the selected function (<a href="#7.22">7.22</a>).
23411 <li> A complex argument is supplied for a generic parameter of a type-generic macro that
23412 has no corresponding complex function (<a href="#7.22">7.22</a>).
23413 <li> The argument corresponding to an s specifier without an l qualifier in a call to the
23414 fwprintf function does not point to a valid multibyte character sequence that
23415 begins in the initial shift state (<a href="#7.24.2.11">7.24.2.11</a>).
23416 <li> In a call to the wcstok function, the object pointed to by ptr does not have the
23417 value stored by the previous call for the same wide string (<a href="#7.24.4.5.7">7.24.4.5.7</a>).
23418 <li> An mbstate_t object is used inappropriately (<a href="#7.24.6">7.24.6</a>).
23419 <li> The value of an argument of type wint_t to a wide character classification or case
23420 mapping function is neither equal to the value of WEOF nor representable as a
23421 wchar_t (<a href="#7.25.1">7.25.1</a>).
23422 <li> The iswctype function is called using a different LC_CTYPE category from the
23423 one in effect for the call to the wctype function that returned the description
23424 (<a href="#7.25.2.2.1">7.25.2.2.1</a>).
23425 <li> The towctrans function is called using a different LC_CTYPE category from the
23426 one in effect for the call to the wctrans function that returned the description
23427 (<a href="#7.25.3.2.1">7.25.3.2.1</a>).
23428 <!--page 517 indent 4-->
23431 <a name="J.3" href="#J.3"><h3>J.3 Implementation-defined behavior</h3></a>
23433 A conforming implementation is required to document its choice of behavior in each of
23434 the areas listed in this subclause. The following are implementation-defined:
23436 <a name="J.3.1" href="#J.3.1"><h4>J.3.1 Translation</h4></a>
23439 <li> How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
23440 <li> Whether each nonempty sequence of white-space characters other than new-line is
23441 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
23444 <a name="J.3.2" href="#J.3.2"><h4>J.3.2 Environment</h4></a>
23447 <li> The mapping between physical source file multibyte characters and the source
23448 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
23449 <li> The name and type of the function called at program startup in a freestanding
23450 environment (<a href="#5.1.2.1">5.1.2.1</a>).
23451 <li> The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
23452 <li> An alternative manner in which the main function may be defined (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
23453 <li> The values given to the strings pointed to by the argv argument to main (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
23454 <li> What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
23455 <li> The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
23456 <li> Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
23457 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
23458 <li> Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
23459 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
23460 <li> The set of environment names and the method for altering the environment list used
23461 by the getenv function (<a href="#7.20.4.5">7.20.4.5</a>).
23462 <li> The manner of execution of the string by the system function (<a href="#7.20.4.6">7.20.4.6</a>).
23465 <a name="J.3.3" href="#J.3.3"><h4>J.3.3 Identifiers</h4></a>
23468 <li> Which additional multibyte characters may appear in identifiers and their
23469 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
23470 <li> The number of significant initial characters in an identifier (<a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2">6.4.2</a>).
23471 <!--page 518 indent 4-->
23474 <a name="J.3.4" href="#J.3.4"><h4>J.3.4 Characters</h4></a>
23477 <li> The number of bits in a byte (<a href="#3.6">3.6</a>).
23478 <li> The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
23479 <li> The unique value of the member of the execution character set produced for each of
23480 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
23481 <li> The value of a char object into which has been stored any character other than a
23482 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
23483 <li> Which of signed char or unsigned char has the same range, representation,
23484 and behavior as ''plain'' char (<a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>).
23485 <li> The mapping of members of the source character set (in character constants and string
23486 literals) to members of the execution character set (<a href="#6.4.4.4">6.4.4.4</a>, <a href="#5.1.1.2">5.1.1.2</a>).
23487 <li> The value of an integer character constant containing more than one character or
23488 containing a character or escape sequence that does not map to a single-byte
23489 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
23490 <li> The value of a wide character constant containing more than one multibyte character,
23491 or containing a multibyte character or escape sequence not represented in the
23492 extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
23493 <li> The current locale used to convert a wide character constant consisting of a single
23494 multibyte character that maps to a member of the extended execution character set
23495 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
23496 <li> The current locale used to convert a wide string literal into corresponding wide
23497 character codes (<a href="#6.4.5">6.4.5</a>).
23498 <li> The value of a string literal containing a multibyte character or escape sequence not
23499 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
23502 <a name="J.3.5" href="#J.3.5"><h4>J.3.5 Integers</h4></a>
23505 <li> Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
23506 <li> Whether signed integer types are represented using sign and magnitude, two's
23507 complement, or ones' complement, and whether the extraordinary value is a trap
23508 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
23509 <li> The rank of any extended integer type relative to another extended integer type with
23510 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
23511 <li> The result of, or the signal raised by, converting an integer to a signed integer type
23512 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
23513 <!--page 519 indent 4-->
23514 <li> The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
23517 <a name="J.3.6" href="#J.3.6"><h4>J.3.6 Floating point</h4></a>
23520 <li> The accuracy of the floating-point operations and of the library functions in
23521 <math.h> and <complex.h> that return floating-point results (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
23522 <li> The accuracy of the conversions between floating-point internal representations and
23523 string representations performed by the library functions in <stdio.h>,
23524 <stdlib.h>, and <wchar.h> (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
23525 <li> The rounding behaviors characterized by non-standard values of FLT_ROUNDS
23526 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
23527 <li> The evaluation methods characterized by non-standard negative values of
23528 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
23529 <li> The direction of rounding when an integer is converted to a floating-point number that
23530 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
23531 <li> The direction of rounding when a floating-point number is converted to a narrower
23532 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
23533 <li> How the nearest representable value or the larger or smaller representable value
23534 immediately adjacent to the nearest representable value is chosen for certain floating
23535 constants (<a href="#6.4.4.2">6.4.4.2</a>).
23536 <li> Whether and how floating expressions are contracted when not disallowed by the
23537 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
23538 <li> The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
23539 <li> Additional floating-point exceptions, rounding modes, environments, and
23540 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
23541 <li> The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>). *
23544 <a name="J.3.7" href="#J.3.7"><h4>J.3.7 Arrays and pointers</h4></a>
23547 <li> The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
23548 <li> The size of the result of subtracting two pointers to elements of the same array
23549 (<a href="#6.5.6">6.5.6</a>).
23550 <!--page 520 indent 4-->
23553 <a name="J.3.8" href="#J.3.8"><h4>J.3.8 Hints</h4></a>
23556 <li> The extent to which suggestions made by using the register storage-class
23557 specifier are effective (<a href="#6.7.1">6.7.1</a>).
23558 <li> The extent to which suggestions made by using the inline function specifier are
23559 effective (<a href="#6.7.4">6.7.4</a>).
23562 <a name="J.3.9" href="#J.3.9"><h4>J.3.9 Structures, unions, enumerations, and bit-fields</h4></a>
23565 <li> Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
23566 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
23567 <li> Allowable bit-field types other than _Bool, signed int, and unsigned int
23568 (<a href="#6.7.2.1">6.7.2.1</a>).
23569 <li> Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
23570 <li> The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
23571 <li> The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
23572 no problem unless binary data written by one implementation is read by another.
23573 <li> The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
23576 <a name="J.3.10" href="#J.3.10"><h4>J.3.10 Qualifiers</h4></a>
23579 <li> What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
23582 <a name="J.3.11" href="#J.3.11"><h4>J.3.11 Preprocessing directives</h4></a>
23585 <li> The locations within #pragma directives where header name preprocessing tokens
23586 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
23587 <li> How sequences in both forms of header names are mapped to headers or external
23588 source file names (<a href="#6.4.7">6.4.7</a>).
23589 <li> Whether the value of a character constant in a constant expression that controls
23590 conditional inclusion matches the value of the same character constant in the
23591 execution character set (<a href="#6.10.1">6.10.1</a>).
23592 <li> Whether the value of a single-character character constant in a constant expression
23593 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
23594 <li> The places that are searched for an included < > delimited header, and how the places
23595 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
23596 <li> How the named source file is searched for in an included " " delimited header
23597 (<a href="#6.10.2">6.10.2</a>).
23598 <li> The method by which preprocessing tokens (possibly resulting from macro
23599 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
23600 <!--page 521 indent 4-->
23601 <li> The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
23602 <li> Whether the # operator inserts a \ character before the \ character that begins a
23603 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
23604 <li> The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
23605 <li> The definitions for __DATE__ and __TIME__ when respectively, the date and
23606 time of translation are not available (<a href="#6.10.8">6.10.8</a>).
23609 <a name="J.3.12" href="#J.3.12"><h4>J.3.12 Library functions</h4></a>
23612 <li> Any library facilities available to a freestanding program, other than the minimal set
23613 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
23614 <li> The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
23615 <li> The representation of the floating-point status flags stored by the
23616 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
23617 <li> Whether the feraiseexcept function raises the ''inexact'' floating-point
23618 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
23619 (<a href="#7.6.2.3">7.6.2.3</a>).
23620 <li> Strings other than "C" and "" that may be passed as the second argument to the
23621 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
23622 <li> The types defined for float_t and double_t when the value of the
23623 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
23624 <li> Domain errors for the mathematics functions, other than those required by this
23625 International Standard (<a href="#7.12.1">7.12.1</a>).
23626 <li> The values returned by the mathematics functions on domain errors (<a href="#7.12.1">7.12.1</a>).
23627 <li> The values returned by the mathematics functions on underflow range errors, whether
23628 errno is set to the value of the macro ERANGE when the integer expression
23629 math_errhandling & MATH_ERRNO is nonzero, and whether the ''underflow''
23630 floating-point exception is raised when the integer expression math_errhandling
23631 & MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
23632 <li> Whether a domain error occurs or zero is returned when an fmod function has a
23633 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
23634 <li> Whether a domain error occurs or zero is returned when a remainder function has
23635 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
23636 <li> The base-2 logarithm of the modulus used by the remquo functions in reducing the
23637 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
23638 <!--page 522 indent 0-->
23639 <li> Whether a domain error occurs or zero is returned when a remquo function has a
23640 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
23641 <li> Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
23642 of a signal handler, and, if not, the blocking of signals that is performed (<a href="#7.14.1.1">7.14.1.1</a>).
23643 <li> The null pointer constant to which the macro NULL expands (<a href="#7.17">7.17</a>).
23644 <li> Whether the last line of a text stream requires a terminating new-line character
23645 (<a href="#7.19.2">7.19.2</a>).
23646 <li> Whether space characters that are written out to a text stream immediately before a
23647 new-line character appear when read in (<a href="#7.19.2">7.19.2</a>).
23648 <li> The number of null characters that may be appended to data written to a binary
23649 stream (<a href="#7.19.2">7.19.2</a>).
23650 <li> Whether the file position indicator of an append-mode stream is initially positioned at
23651 the beginning or end of the file (<a href="#7.19.3">7.19.3</a>).
23652 <li> Whether a write on a text stream causes the associated file to be truncated beyond that
23653 point (<a href="#7.19.3">7.19.3</a>).
23654 <li> The characteristics of file buffering (<a href="#7.19.3">7.19.3</a>).
23655 <li> Whether a zero-length file actually exists (<a href="#7.19.3">7.19.3</a>).
23656 <li> The rules for composing valid file names (<a href="#7.19.3">7.19.3</a>).
23657 <li> Whether the same file can be simultaneously open multiple times (<a href="#7.19.3">7.19.3</a>).
23658 <li> The nature and choice of encodings used for multibyte characters in files (<a href="#7.19.3">7.19.3</a>).
23659 <li> The effect of the remove function on an open file (<a href="#7.19.4.1">7.19.4.1</a>).
23660 <li> The effect if a file with the new name exists prior to a call to the rename function
23661 (<a href="#7.19.4.2">7.19.4.2</a>).
23662 <li> Whether an open temporary file is removed upon abnormal program termination
23663 (<a href="#7.19.4.3">7.19.4.3</a>).
23664 <li> Which changes of mode are permitted (if any), and under what circumstances
23665 (<a href="#7.19.5.4">7.19.5.4</a>).
23666 <li> The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
23667 sequence printed for a NaN (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
23668 <li> The output for %p conversion in the fprintf or fwprintf function (<a href="#7.19.6.1">7.19.6.1</a>,
23669 <a href="#7.24.2.1">7.24.2.1</a>).
23670 <li> The interpretation of a - character that is neither the first nor the last character, nor
23671 the second where a ^ character is the first, in the scanlist for %[ conversion in the
23672 fscanf or fwscanf function (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>).
23673 <!--page 523 indent 4-->
23674 <li> The set of sequences matched by a %p conversion and the interpretation of the
23675 corresponding input item in the fscanf or fwscanf function (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
23676 <li> The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
23677 functions on failure (<a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.9.4">7.19.9.4</a>).
23678 <li> The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
23679 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
23680 function (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
23681 <li> Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
23682 function sets errno to ERANGE when underflow occurs (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
23683 <li> Whether the calloc, malloc, and realloc functions return a null pointer or a
23684 pointer to an allocated object when the size requested is zero (<a href="#7.20.3">7.20.3</a>).
23685 <li> Whether open streams with unwritten buffered data are flushed, open streams are
23686 closed, or temporary files are removed when the abort or _Exit function is called
23687 (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.4">7.20.4.4</a>).
23688 <li> The termination status returned to the host environment by the abort, exit, or
23689 _Exit function (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.3">7.20.4.3</a>, <a href="#7.20.4.4">7.20.4.4</a>).
23690 <li> The value returned by the system function when its argument is not a null pointer
23691 (<a href="#7.20.4.6">7.20.4.6</a>).
23692 <li> The local time zone and Daylight Saving Time (<a href="#7.23.1">7.23.1</a>).
23693 <li> The range and precision of times representable in clock_t and time_t (<a href="#7.23">7.23</a>).
23694 <li> The era for the clock function (<a href="#7.23.2.1">7.23.2.1</a>).
23695 <li> The replacement string for the %Z specifier to the strftime, and wcsftime
23696 functions in the "C" locale (<a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.5.1">7.24.5.1</a>).
23697 <li> Whether the functions in <math.h> honor the rounding direction mode in an
23698 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.9">F.9</a>).
23701 <a name="J.3.13" href="#J.3.13"><h4>J.3.13 Architecture</h4></a>
23704 <li> The values or expressions assigned to the macros specified in the headers
23705 <float.h>, <limits.h>, and <stdint.h> (<a href="#5.2.4.2">5.2.4.2</a>, <a href="#7.18.2">7.18.2</a>, <a href="#7.18.3">7.18.3</a>).
23706 <li> The number, order, and encoding of bytes in any object (when not explicitly specified
23707 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
23708 <li> The value of the result of the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>).
23709 <!--page 524 indent 4-->
23712 <a name="J.4" href="#J.4"><h3>J.4 Locale-specific behavior</h3></a>
23714 The following characteristics of a hosted environment are locale-specific and are required
23715 to be documented by the implementation:
23717 <li> Additional members of the source and execution character sets beyond the basic
23718 character set (<a href="#5.2.1">5.2.1</a>).
23719 <li> The presence, meaning, and representation of additional multibyte characters in the
23720 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
23721 <li> The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
23722 <li> The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
23723 <li> The decimal-point character (<a href="#7.1.1">7.1.1</a>).
23724 <li> The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
23725 <li> The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
23726 <li> The sets of characters tested for by the isalpha, isblank, islower, ispunct,
23727 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
23728 iswspace, or iswupper functions (<a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, <a href="#7.4.1.10">7.4.1.10</a>,
23729 <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a>, <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, <a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>).
23730 <li> The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
23731 <li> Additional subject sequences accepted by the numeric conversion functions (<a href="#7.20.1">7.20.1</a>,
23732 <a href="#7.24.4.1">7.24.4.1</a>).
23733 <li> The collation sequence of the execution character set (<a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.24.4.4.2">7.24.4.4.2</a>).
23734 <li> The contents of the error message strings set up by the strerror function
23735 (<a href="#7.21.6.2">7.21.6.2</a>).
23736 <li> The formats for time and date (<a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.5.1">7.24.5.1</a>).
23737 <li> Character mappings that are supported by the towctrans function (<a href="#7.25.1">7.25.1</a>).
23738 <li> Character classifications that are supported by the iswctype function (<a href="#7.25.1">7.25.1</a>).
23739 <!--page 525 indent 4-->
23742 <a name="J.5" href="#J.5"><h3>J.5 Common extensions</h3></a>
23744 The following extensions are widely used in many systems, but are not portable to all
23745 implementations. The inclusion of any extension that may cause a strictly conforming
23746 program to become invalid renders an implementation nonconforming. Examples of such
23747 extensions are new keywords, extra library functions declared in standard headers, or
23748 predefined macros with names that do not begin with an underscore.
23750 <a name="J.5.1" href="#J.5.1"><h4>J.5.1 Environment arguments</h4></a>
23752 In a hosted environment, the main function receives a third argument, char *envp[],
23753 that points to a null-terminated array of pointers to char, each of which points to a string
23754 that provides information about the environment for this execution of the program
23755 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
23757 <a name="J.5.2" href="#J.5.2"><h4>J.5.2 Specialized identifiers</h4></a>
23759 Characters other than the underscore _, letters, and digits, that are not part of the basic
23760 source character set (such as the dollar sign $, or characters in national character sets)
23761 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
23763 <a name="J.5.3" href="#J.5.3"><h4>J.5.3 Lengths and cases of identifiers</h4></a>
23765 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
23767 <a name="J.5.4" href="#J.5.4"><h4>J.5.4 Scopes of identifiers</h4></a>
23769 A function identifier, or the identifier of an object the declaration of which contains the
23770 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
23772 <a name="J.5.5" href="#J.5.5"><h4>J.5.5 Writable string literals</h4></a>
23774 String literals are modifiable (in which case, identical string literals should denote distinct
23775 objects) (<a href="#6.4.5">6.4.5</a>).
23777 <a name="J.5.6" href="#J.5.6"><h4>J.5.6 Other arithmetic types</h4></a>
23779 Additional arithmetic types, such as __int128 or double double, and their
23780 appropriate conversions are defined (<a href="#6.2.5">6.2.5</a>, <a href="#6.3.1">6.3.1</a>). Additional floating types may have
23781 more range or precision than long double, may be used for evaluating expressions of
23782 other floating types, and may be used to define float_t or double_t.
23783 <!--page 526 indent 4-->
23785 <a name="J.5.7" href="#J.5.7"><h4>J.5.7 Function pointer casts</h4></a>
23787 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
23788 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
23790 A pointer to a function may be cast to a pointer to an object or to void, allowing a
23791 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
23793 <a name="J.5.8" href="#J.5.8"><h4>J.5.8 Extended bit-field types</h4></a>
23795 A bit-field may be declared with a type other than _Bool, unsigned int, or
23796 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
23798 <a name="J.5.9" href="#J.5.9"><h4>J.5.9 The fortran keyword</h4></a>
23800 The fortran function specifier may be used in a function declaration to indicate that
23801 calls suitable for FORTRAN should be generated, or that a different representation for the
23802 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
23804 <a name="J.5.10" href="#J.5.10"><h4>J.5.10 The asm keyword</h4></a>
23806 The asm keyword may be used to insert assembly language directly into the translator
23807 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
23809 asm ( character-string-literal );</pre>
23811 <a name="J.5.11" href="#J.5.11"><h4>J.5.11 Multiple external definitions</h4></a>
23813 There may be more than one external definition for the identifier of an object, with or
23814 without the explicit use of the keyword extern; if the definitions disagree, or more than
23815 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
23817 <a name="J.5.12" href="#J.5.12"><h4>J.5.12 Predefined macro names</h4></a>
23819 Macro names that do not begin with an underscore, describing the translation and
23820 execution environments, are defined by the implementation before translation begins
23821 (<a href="#6.10.8">6.10.8</a>).
23823 <a name="J.5.13" href="#J.5.13"><h4>J.5.13 Floating-point status flags</h4></a>
23825 If any floating-point status flags are set on normal termination after all calls to functions
23826 registered by the atexit function have been made (see <a href="#7.20.4.3">7.20.4.3</a>), the implementation
23827 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
23828 <!--page 527 indent 4-->
23830 <a name="J.5.14" href="#J.5.14"><h4>J.5.14 Extra arguments for signal handlers</h4></a>
23832 Handlers for specific signals are called with extra arguments in addition to the signal
23833 number (<a href="#7.14.1.1">7.14.1.1</a>).
23835 <a name="J.5.15" href="#J.5.15"><h4>J.5.15 Additional stream types and file-opening modes</h4></a>
23837 Additional mappings from files to streams are supported (<a href="#7.19.2">7.19.2</a>).
23839 Additional file-opening modes may be specified by characters appended to the mode
23840 argument of the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
23842 <a name="J.5.16" href="#J.5.16"><h4>J.5.16 Defined file position indicator</h4></a>
23844 The file position indicator is decremented by each successful call to the ungetc or
23845 ungetwc function for a text stream, except if its value was zero before a call (<a href="#7.19.7.11">7.19.7.11</a>,
23846 <a href="#7.24.3.10">7.24.3.10</a>).
23848 <a name="J.5.17" href="#J.5.17"><h4>J.5.17 Math error reporting</h4></a>
23850 Functions declared in <complex.h> and <math.h> raise SIGFPE to report errors
23851 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
23852 <a href="#7.12">7.12</a>).
23853 <!--page 528 indent -1-->
23855 <a name="Bibliography" href="#Bibliography"><h2>Bibliography</h2></a>
23857 <li> ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
23858 published in The C Programming Language by Brian W. Kernighan and Dennis
23859 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&T.
23860 <li> 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
23861 California, USA, November 1984.
23862 <li> ANSI X3/TR-1-82 (1982), American National Dictionary for Information
23863 Processing Systems, Information Processing Systems Technical Report.
23864 <li> ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
23866 <li> ANSI/IEEE 854-1988, American National Standard for Radix-Independent
23867 Floating-Point Arithmetic.
23868 <li> IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
23869 second edition (previously designated IEC 559:1989).
23870 <li> ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
23871 symbols for use in the physical sciences and technology.
23872 <li> ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
23873 information interchange.
23874 <li> ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
23876 <li> ISO 4217:1995, Codes for the representation of currencies and funds.
23877 <li> ISO 8601:1988, Data elements and interchange formats -- Information
23878 interchange -- Representation of dates and times.
23879 <li> ISO/IEC 9899:1990, Programming languages -- C.
23880 <li> ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
23881 <li> ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
23882 <li> ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
23883 <li> ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
23884 Interface (POSIX) -- Part 2: Shell and Utilities.
23885 <li> ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
23886 preparation of programming language standards.
23887 <li> ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
23888 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
23889 <!--page 529 indent -1-->
23890 <li> ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
23891 ISO/IEC 10646-1:1993.
23892 <li> ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
23893 ISO/IEC 10646-1:1993.
23894 <li> ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
23895 Transformation Format for 16 planes of group 00 (UTF-16).
23896 <li> ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
23897 Transformation Format 8 (UTF-8).
23898 <li> ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
23899 <li> ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
23900 <li> ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
23902 <li> ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993 Tibetan.
23903 <li> ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
23904 additional characters.
23905 <li> ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
23906 <li> ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
23907 Identifiers for characters.
23908 <li> ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
23910 <li> ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
23911 Unified Canadian Aboriginal Syllabics.
23912 <li> ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
23914 <li> ISO/IEC 10967-1:1994, Information technology -- Language independent
23915 arithmetic -- Part 1: Integer and floating point arithmetic.
23916 <!--page 530 indent 0-->
23917 <!--page 531 indent 0-->
23920 <a name="Index" href="#Index"><h2>Index</h2></a>
23922 ??? x ???, <a href="#3.18">3.18</a> , (comma punctuator), <a href="#6.5.2">6.5.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.7.2.2">6.7.2.2</a>,
23923 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>
23924 ??? x ???, <a href="#3.19">3.19</a> - (subtraction operator), <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a>
23925 ! (logical negation operator), <a href="#6.5.3.3">6.5.3.3</a> - (unary minus operator), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a>
23926 != (inequality operator), <a href="#6.5.9">6.5.9</a> -- (postfix decrement operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a>
23927 # operator, <a href="#6.10.3.2">6.10.3.2</a> -- (prefix decrement operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a>
23928 # preprocessing directive, <a href="#6.10.7">6.10.7</a> -= (subtraction assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
23929 # punctuator, <a href="#6.10">6.10</a> -> (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
23930 ## operator, <a href="#6.10.3.3">6.10.3.3</a> . (structure/union member operator), <a href="#6.3.2.1">6.3.2.1</a>,
23931 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> <a href="#6.5.2.3">6.5.2.3</a>
23932 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.8">6.7.8</a>
23933 #else preprocessing directive, <a href="#6.10.1">6.10.1</a> ... (ellipsis punctuator), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.10.3">6.10.3</a>
23934 #endif preprocessing directive, <a href="#6.10.1">6.10.1</a> / (division operator), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a>
23935 #error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> /* */ (comment delimiters), <a href="#6.4.9">6.4.9</a>
23936 #if preprocessing directive, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, // (comment delimiter), <a href="#6.4.9">6.4.9</a>
23937 <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a> /= (division assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
23938 #ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a> : (colon punctuator), <a href="#6.7.2.1">6.7.2.1</a>
23939 #ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> :> (alternative spelling of ]), <a href="#6.4.6">6.4.6</a>
23940 #include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, ; (semicolon punctuator), <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.8.3">6.8.3</a>,
23941 <a href="#6.10.2">6.10.2</a> <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>
23942 #line preprocessing directive, <a href="#6.10.4">6.10.4</a> < (less-than operator), <a href="#6.5.8">6.5.8</a>
23943 #pragma preprocessing directive, <a href="#6.10.6">6.10.6</a> <% (alternative spelling of {), <a href="#6.4.6">6.4.6</a>
23944 #undef preprocessing directive, <a href="#6.10.3.5">6.10.3.5</a>, <a href="#7.1.3">7.1.3</a>, <: (alternative spelling of [), <a href="#6.4.6">6.4.6</a>
23945 <a href="#7.1.4">7.1.4</a> << (left-shift operator), <a href="#6.5.7">6.5.7</a>
23946 % (remainder operator), <a href="#6.5.5">6.5.5</a> <<= (left-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
23947 %: (alternative spelling of #), <a href="#6.4.6">6.4.6</a> <= (less-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a>
23948 %:%: (alternative spelling of ##), <a href="#6.4.6">6.4.6</a> <assert.h> header, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
23949 %= (remainder assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <complex.h> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>,
23950 %> (alternative spelling of }), <a href="#6.4.6">6.4.6</a> <a href="#7.26.1">7.26.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
23951 & (address operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <ctype.h> header, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
23952 & (bitwise AND operator), <a href="#6.5.10">6.5.10</a> <errno.h> header, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
23953 && (logical AND operator), <a href="#6.5.13">6.5.13</a> <fenv.h> header, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>,
23954 &= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#H">H</a>
23955 ' ' (space character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <float.h> header, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.20.1.3">7.20.1.3</a>,
23956 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>
23957 ( ) (cast operator), <a href="#6.5.4">6.5.4</a> <inttypes.h> header, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a>
23958 ( ) (function-call operator), <a href="#6.5.2.2">6.5.2.2</a> <iso646.h> header, <a href="#4">4</a>, <a href="#7.9">7.9</a>
23959 ( ) (parentheses punctuator), <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> <limits.h> header, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
23960 ( ){ } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a> <locale.h> header, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
23961 * (asterisk punctuator), <a href="#6.7.5.1">6.7.5.1</a>, <a href="#6.7.5.2">6.7.5.2</a> <math.h> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.22">7.22</a>, <a href="#F">F</a>,
23962 * (indirection operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#F.9">F.9</a>, <a href="#J.5.17">J.5.17</a>
23963 * (multiplication operator), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a> <setjmp.h> header, <a href="#7.13">7.13</a>
23964 *= (multiplication assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <signal.h> header, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a>
23965 + (addition operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <stdarg.h> header, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a>
23966 <a href="#G.5.2">G.5.2</a> <stdbool.h> header, <a href="#4">4</a>, <a href="#7.16">7.16</a>, <a href="#7.26.7">7.26.7</a>, <a href="#H">H</a>
23967 + (unary plus operator), <a href="#6.5.3.3">6.5.3.3</a> <stddef.h> header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>,
23968 ++ (postfix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.17">7.17</a>
23969 ++ (prefix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> <stdint.h> header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>,
23970 += (addition assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.18">7.18</a>, <a href="#7.26.8">7.26.8</a>
23971 , (comma operator), <a href="#6.5.17">6.5.17</a>
23972 <!--page 532 indent 0-->
23973 <stdio.h> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a> __cplusplus macro, <a href="#6.10.8">6.10.8</a>
23974 <stdlib.h> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a> __DATE__ macro, <a href="#6.10.8">6.10.8</a>
23975 <string.h> header, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a> __FILE__ macro, <a href="#6.10.8">6.10.8</a>, <a href="#7.2.1.1">7.2.1.1</a>
23976 <tgmath.h> header, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> __func__ identifier, <a href="#6.4.2.2">6.4.2.2</a>, <a href="#7.2.1.1">7.2.1.1</a>
23977 <time.h> header, <a href="#7.23">7.23</a> __LINE__ macro, <a href="#6.10.8">6.10.8</a>, <a href="#7.2.1.1">7.2.1.1</a>
23978 <wchar.h> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24">7.24</a>, __STDC_, <a href="#6.11.9">6.11.9</a>
23979 <a href="#7.26.12">7.26.12</a>, <a href="#F">F</a> __STDC__ macro, <a href="#6.10.8">6.10.8</a>
23980 <wctype.h> header, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a> __STDC_CONSTANT_MACROS macro, <a href="#7.18.4">7.18.4</a>
23981 = (equal-sign punctuator), <a href="#6.7">6.7</a>, <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.8">6.7.8</a> __STDC_FORMAT_MACROS macro, <a href="#7.8.1">7.8.1</a>
23982 = (simple assignment operator), <a href="#6.5.16.1">6.5.16.1</a> __STDC_HOSTED__ macro, <a href="#6.10.8">6.10.8</a>
23983 == (equality operator), <a href="#6.5.9">6.5.9</a> __STDC_IEC_559__ macro, <a href="#6.10.8">6.10.8</a>, <a href="#F.1">F.1</a>
23984 > (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
23985 >= (greater-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a> <a href="#6.10.8">6.10.8</a>, <a href="#G.1">G.1</a>
23986 >> (right-shift operator), <a href="#6.5.7">6.5.7</a> __STDC_ISO_10646__ macro, <a href="#6.10.8">6.10.8</a>
23987 >>= (right-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a> __STDC_LIMIT_MACROS macro, <a href="#7.18.2">7.18.2</a>,
23988 ? : (conditional operator), <a href="#6.5.15">6.5.15</a> <a href="#7.18.3">7.18.3</a>
23989 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
23990 [ ] (array subscript operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#6.10.8">6.10.8</a>, <a href="#7.17">7.17</a>
23991 [ ] (brackets punctuator), <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.7.8">6.7.8</a> __STDC_VERSION__ macro, <a href="#6.10.8">6.10.8</a>
23992 \ (backslash character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a> __TIME__ macro, <a href="#6.10.8">6.10.8</a>
23993 \ (escape character), <a href="#6.4.4.4">6.4.4.4</a> __VA_ARGS__ identifier, <a href="#6.10.3">6.10.3</a>, <a href="#6.10.3.1">6.10.3.1</a>
23994 \" (double-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, _Bool type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a>, <a href="#6.7.2">6.7.2</a>
23995 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> _Bool type conversions, <a href="#6.3.1.2">6.3.1.2</a>
23996 \\ (backslash escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a> _Complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>
23997 \' (single-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> _Complex_I macro, <a href="#7.3.1">7.3.1</a>
23998 \0 (null character), <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> _Exit function, <a href="#7.20.4.4">7.20.4.4</a>
23999 padding of binary stream, <a href="#7.19.2">7.19.2</a> _Imaginary keyword, <a href="#G.2">G.2</a>
24000 \? (question-mark escape sequence), <a href="#6.4.4.4">6.4.4.4</a> _Imaginary types, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>
24001 \a (alert escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> _Imaginary_I macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a>
24002 \b (backspace escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> _IOFBF macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.5">7.19.5.5</a>, <a href="#7.19.5.6">7.19.5.6</a>
24003 \f (form-feed escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, _IOLBF macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.6">7.19.5.6</a>
24004 <a href="#7.4.1.10">7.4.1.10</a> _IONBF macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.5">7.19.5.5</a>, <a href="#7.19.5.6">7.19.5.6</a>
24005 \n (new-line escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, _Pragma operator, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a>
24006 <a href="#7.4.1.10">7.4.1.10</a> { } (braces punctuator), <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>,
24007 \octal digits (octal-character escape sequence), <a href="#6.8.2">6.8.2</a>
24008 <a href="#6.4.4.4">6.4.4.4</a> { } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a>
24009 \r (carriage-return escape sequence), <a href="#5.2.2">5.2.2</a>, | (bitwise inclusive OR operator), <a href="#6.5.12">6.5.12</a>
24010 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a> |= (bitwise inclusive OR assignment operator),
24011 \t (horizontal-tab escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.5.16.2">6.5.16.2</a>
24012 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a> || (logical OR operator), <a href="#6.5.14">6.5.14</a>
24013 \U (universal character names), <a href="#6.4.3">6.4.3</a> ~ (bitwise complement operator), <a href="#6.5.3.3">6.5.3.3</a>
24014 \u (universal character names), <a href="#6.4.3">6.4.3</a>
24015 \v (vertical-tab escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, abort function, <a href="#7.2.1.1">7.2.1.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.19.3">7.19.3</a>,
24016 <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.20.4.1">7.20.4.1</a>
24017 \x hexadecimal digits (hexadecimal-character abs function, <a href="#7.20.6.1">7.20.6.1</a>
24018 escape sequence), <a href="#6.4.4.4">6.4.4.4</a> absolute-value functions
24019 ^ (bitwise exclusive OR operator), <a href="#6.5.11">6.5.11</a> complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a>
24020 ^= (bitwise exclusive OR assignment operator), integer, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.20.6.1">7.20.6.1</a>
24021 <a href="#6.5.16.2">6.5.16.2</a> real, <a href="#7.12.7">7.12.7</a>, <a href="#F.9.4">F.9.4</a>
24022 __bool_true_false_are_defined abstract declarator, <a href="#6.7.6">6.7.6</a>
24023 macro, <a href="#7.16">7.16</a> abstract machine, <a href="#5.1.2.3">5.1.2.3</a>
24024 <!--page 533 indent 0-->
24025 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a> array
24026 accuracy, see floating-point accuracy argument, <a href="#6.9.1">6.9.1</a>
24027 acos functions, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#F.9.1.1">F.9.1.1</a> declarator, <a href="#6.7.5.2">6.7.5.2</a>
24028 acos type-generic macro, <a href="#7.22">7.22</a> initialization, <a href="#6.7.8">6.7.8</a>
24029 acosh functions, <a href="#7.12.5.1">7.12.5.1</a>, <a href="#F.9.2.1">F.9.2.1</a> multidimensional, <a href="#6.5.2.1">6.5.2.1</a>
24030 acosh type-generic macro, <a href="#7.22">7.22</a> parameter, <a href="#6.9.1">6.9.1</a>
24031 active position, <a href="#5.2.2">5.2.2</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
24032 actual argument, <a href="#3.3">3.3</a> subscript operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>
24033 actual parameter (deprecated), <a href="#3.3">3.3</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
24034 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> type, <a href="#6.2.5">6.2.5</a>
24035 addition operator (+), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, type conversion, <a href="#6.3.2.1">6.3.2.1</a>
24036 <a href="#G.5.2">G.5.2</a> variable length, <a href="#6.7.5">6.7.5</a>, <a href="#6.7.5.2">6.7.5.2</a>
24037 additive expressions, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> arrow operator (->), <a href="#6.5.2.3">6.5.2.3</a>
24038 address constant, <a href="#6.6">6.6</a> as-if rule, <a href="#5.1.2.3">5.1.2.3</a>
24039 address operator (&), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> ASCII code set, <a href="#5.2.1.1">5.2.1.1</a>
24040 aggregate initialization, <a href="#6.7.8">6.7.8</a> asctime function, <a href="#7.23.3.1">7.23.3.1</a>
24041 aggregate types, <a href="#6.2.5">6.2.5</a> asin functions, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#F.9.1.2">F.9.1.2</a>
24042 alert escape sequence (\a), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> asin type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24043 aliasing, <a href="#6.5">6.5</a> asinh functions, <a href="#7.12.5.2">7.12.5.2</a>, <a href="#F.9.2.2">F.9.2.2</a>
24044 alignment, <a href="#3.2">3.2</a> asinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24045 pointer, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.3">6.3.2.3</a> asm keyword, <a href="#J.5.10">J.5.10</a>
24046 structure/union member, <a href="#6.7.2.1">6.7.2.1</a> assert macro, <a href="#7.2.1.1">7.2.1.1</a>
24047 allocated storage, order and contiguity, <a href="#7.20.3">7.20.3</a> assert.h header, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
24048 and macro, <a href="#7.9">7.9</a> assignment
24049 AND operators compound, <a href="#6.5.16.2">6.5.16.2</a>
24050 bitwise (&), <a href="#6.5.10">6.5.10</a> conversion, <a href="#6.5.16.1">6.5.16.1</a>
24051 bitwise assignment (&=), <a href="#6.5.16.2">6.5.16.2</a> expression, <a href="#6.5.16">6.5.16</a>
24052 logical (&&), <a href="#6.5.13">6.5.13</a> operators, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a>
24053 and_eq macro, <a href="#7.9">7.9</a> simple, <a href="#6.5.16.1">6.5.16.1</a>
24054 ANSI/IEEE 754, <a href="#F.1">F.1</a> associativity of operators, <a href="#6.5">6.5</a>
24055 ANSI/IEEE 854, <a href="#F.1">F.1</a> asterisk punctuator (*), <a href="#6.7.5.1">6.7.5.1</a>, <a href="#6.7.5.2">6.7.5.2</a>
24056 argc (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a> atan functions, <a href="#7.12.4.3">7.12.4.3</a>, <a href="#F.9.1.3">F.9.1.3</a>
24057 argument, <a href="#3.3">3.3</a> atan type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24058 array, <a href="#6.9.1">6.9.1</a> atan2 functions, <a href="#7.12.4.4">7.12.4.4</a>, <a href="#F.9.1.4">F.9.1.4</a>
24059 default promotions, <a href="#6.5.2.2">6.5.2.2</a> atan2 type-generic macro, <a href="#7.22">7.22</a>
24060 function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a> atanh functions, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#F.9.2.3">F.9.2.3</a>
24061 macro, substitution, <a href="#6.10.3.1">6.10.3.1</a> atanh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24062 argument, complex, <a href="#7.3.9.1">7.3.9.1</a> atexit function, <a href="#7.20.4.2">7.20.4.2</a>, <a href="#7.20.4.3">7.20.4.3</a>, <a href="#7.20.4.4">7.20.4.4</a>,
24063 argv (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a> <a href="#J.5.13">J.5.13</a>
24064 arithmetic constant expression, <a href="#6.6">6.6</a> atof function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.1">7.20.1.1</a>
24065 arithmetic conversions, usual, see usual arithmetic atoi function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
24066 conversions atol function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
24067 arithmetic operators atoll function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
24068 additive, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> auto storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
24069 bitwise, <a href="#6.5.10">6.5.10</a>, <a href="#6.5.11">6.5.11</a>, <a href="#6.5.12">6.5.12</a> automatic storage duration, <a href="#5.2.3">5.2.3</a>, <a href="#6.2.4">6.2.4</a>
24070 increment and decrement, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.3.1">6.5.3.1</a>
24071 multiplicative, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a> backslash character (\), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
24072 shift, <a href="#6.5.7">6.5.7</a> backslash escape sequence (\\), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a>
24073 unary, <a href="#6.5.3.3">6.5.3.3</a> backspace escape sequence (\b), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
24074 arithmetic types, <a href="#6.2.5">6.2.5</a> basic character set, <a href="#3.6">3.6</a>, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>
24075 arithmetic, pointer, <a href="#6.5.6">6.5.6</a> basic types, <a href="#6.2.5">6.2.5</a>
24076 <!--page 534 indent 0-->
24077 behavior, <a href="#3.4">3.4</a> call by value, <a href="#6.5.2.2">6.5.2.2</a>
24078 binary streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, calloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.1">7.20.3.1</a>, <a href="#7.20.3.2">7.20.3.2</a>,
24079 <a href="#7.19.9.4">7.19.9.4</a> <a href="#7.20.3.4">7.20.3.4</a>
24080 bit, <a href="#3.5">3.5</a> carg functions, <a href="#7.3.9.1">7.3.9.1</a>, <a href="#G.6">G.6</a>
24081 high order, <a href="#3.6">3.6</a> carg type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24082 low order, <a href="#3.6">3.6</a> carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>,
24083 bit-field, <a href="#6.7.2.1">6.7.2.1</a> <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a>
24084 bitand macro, <a href="#7.9">7.9</a> case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
24085 bitor macro, <a href="#7.9">7.9</a> case mapping functions
24086 bitwise operators, <a href="#6.5">6.5</a> character, <a href="#7.4.2">7.4.2</a>
24087 AND, <a href="#6.5.10">6.5.10</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
24088 AND assignment (&=), <a href="#6.5.16.2">6.5.16.2</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
24089 complement (~), <a href="#6.5.3.3">6.5.3.3</a> casin functions, <a href="#7.3.5.2">7.3.5.2</a>, <a href="#G.6">G.6</a>
24090 exclusive OR, <a href="#6.5.11">6.5.11</a> type-generic macro for, <a href="#7.22">7.22</a>
24091 exclusive OR assignment (^=), <a href="#6.5.16.2">6.5.16.2</a> casinh functions, <a href="#7.3.6.2">7.3.6.2</a>, <a href="#G.6.2.2">G.6.2.2</a>
24092 inclusive OR, <a href="#6.5.12">6.5.12</a> type-generic macro for, <a href="#7.22">7.22</a>
24093 inclusive OR assignment (|=), <a href="#6.5.16.2">6.5.16.2</a> cast expression, <a href="#6.5.4">6.5.4</a>
24094 shift, <a href="#6.5.7">6.5.7</a> cast operator (( )), <a href="#6.5.4">6.5.4</a>
24095 blank character, <a href="#7.4.1.3">7.4.1.3</a> catan functions, <a href="#7.3.5.3">7.3.5.3</a>, <a href="#G.6">G.6</a>
24096 block, <a href="#6.8">6.8</a>, <a href="#6.8.2">6.8.2</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> type-generic macro for, <a href="#7.22">7.22</a>
24097 block scope, <a href="#6.2.1">6.2.1</a> catanh functions, <a href="#7.3.6.3">7.3.6.3</a>, <a href="#G.6.2.3">G.6.2.3</a>
24098 block structure, <a href="#6.2.1">6.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
24099 bold type convention, <a href="#6.1">6.1</a> cbrt functions, <a href="#7.12.7.1">7.12.7.1</a>, <a href="#F.9.4.1">F.9.4.1</a>
24100 bool macro, <a href="#7.16">7.16</a> cbrt type-generic macro, <a href="#7.22">7.22</a>
24101 boolean type, <a href="#6.3.1.2">6.3.1.2</a> ccos functions, <a href="#7.3.5.4">7.3.5.4</a>, <a href="#G.6">G.6</a>
24102 boolean type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a> type-generic macro for, <a href="#7.22">7.22</a>
24103 braces punctuator ({ }), <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>, ccosh functions, <a href="#7.3.6.4">7.3.6.4</a>, <a href="#G.6.2.4">G.6.2.4</a>
24104 <a href="#6.8.2">6.8.2</a> type-generic macro for, <a href="#7.22">7.22</a>
24105 brackets operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> ceil functions, <a href="#7.12.9.1">7.12.9.1</a>, <a href="#F.9.6.1">F.9.6.1</a>
24106 brackets punctuator ([ ]), <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.7.8">6.7.8</a> ceil type-generic macro, <a href="#7.22">7.22</a>
24107 branch cuts, <a href="#7.3.3">7.3.3</a> cerf function, <a href="#7.26.1">7.26.1</a>
24108 break statement, <a href="#6.8.6.3">6.8.6.3</a> cerfc function, <a href="#7.26.1">7.26.1</a>
24109 broken-down time, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.3">7.23.3</a>, cexp functions, <a href="#7.3.7.1">7.3.7.1</a>, <a href="#G.6.3.1">G.6.3.1</a>
24110 <a href="#7.23.3.1">7.23.3.1</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a>, <a href="#7.23.3.5">7.23.3.5</a> type-generic macro for, <a href="#7.22">7.22</a>
24111 bsearch function, <a href="#7.20.5">7.20.5</a>, <a href="#7.20.5.1">7.20.5.1</a> cexp2 function, <a href="#7.26.1">7.26.1</a>
24112 btowc function, <a href="#7.24.6.1.1">7.24.6.1.1</a> cexpm1 function, <a href="#7.26.1">7.26.1</a>
24113 BUFSIZ macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.5.5">7.19.5.5</a> char type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>
24114 byte, <a href="#3.6">3.6</a>, <a href="#6.5.3.4">6.5.3.4</a> char type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
24115 byte input/output functions, <a href="#7.19.1">7.19.1</a> <a href="#6.3.1.8">6.3.1.8</a>
24116 byte-oriented stream, <a href="#7.19.2">7.19.2</a> CHAR_BIT macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24117 CHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24118 <a href="#C">C</a> program, <a href="#5.1.1.1">5.1.1.1</a> CHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24119 <a href="#C">C</a>++, <a href="#7.8.1">7.8.1</a>, <a href="#7.18.2">7.18.2</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.18.4">7.18.4</a> character, <a href="#3.7">3.7</a>, <a href="#3.7.1">3.7.1</a>
24120 cabs functions, <a href="#7.3.8.1">7.3.8.1</a>, <a href="#G.6">G.6</a> character array initialization, <a href="#6.7.8">6.7.8</a>
24121 type-generic macro for, <a href="#7.22">7.22</a> character case mapping functions, <a href="#7.4.2">7.4.2</a>
24122 cacos functions, <a href="#7.3.5.1">7.3.5.1</a>, <a href="#G.6.1.1">G.6.1.1</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
24123 type-generic macro for, <a href="#7.22">7.22</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
24124 cacosh functions, <a href="#7.3.6.1">7.3.6.1</a>, <a href="#G.6.2.1">G.6.2.1</a> character classification functions, <a href="#7.4.1">7.4.1</a>
24125 type-generic macro for, <a href="#7.22">7.22</a> wide character, <a href="#7.25.2.1">7.25.2.1</a>
24126 calendar time, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.2">7.23.2.2</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.2.4">7.23.2.4</a>, extensible, <a href="#7.25.2.2">7.25.2.2</a>
24127 <a href="#7.23.3.2">7.23.3.2</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a> character constant, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
24128 <!--page 535 indent 0-->
24129 character display semantics, <a href="#5.2.2">5.2.2</a> complex.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>, <a href="#7.26.1">7.26.1</a>,
24130 character handling header, <a href="#7.4">7.4</a>, <a href="#7.11.1.1">7.11.1.1</a> <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
24131 character input/output functions, <a href="#7.19.7">7.19.7</a> compliance, see conformance
24132 wide character, <a href="#7.24.3">7.24.3</a> components of time, <a href="#7.23.1">7.23.1</a>
24133 character sets, <a href="#5.2.1">5.2.1</a> composite type, <a href="#6.2.7">6.2.7</a>
24134 character string literal, see string literal compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
24135 character type conversion, <a href="#6.3.1.1">6.3.1.1</a> compound literals, <a href="#6.5.2.5">6.5.2.5</a>
24136 character types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.8">6.7.8</a> compound statement, <a href="#6.8.2">6.8.2</a>
24137 cimag functions, <a href="#7.3.9.2">7.3.9.2</a>, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> compound-literal operator (( ){ }), <a href="#6.5.2.5">6.5.2.5</a>
24138 cimag type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> concatenation functions
24139 cis function, <a href="#G.6">G.6</a> string, <a href="#7.21.3">7.21.3</a>
24140 classification functions wide string, <a href="#7.24.4.3">7.24.4.3</a>
24141 character, <a href="#7.4.1">7.4.1</a> concatenation, preprocessing, see preprocessing
24142 floating-point, <a href="#7.12.3">7.12.3</a> concatenation
24143 wide character, <a href="#7.25.2.1">7.25.2.1</a> conceptual models, <a href="#5.1">5.1</a>
24144 extensible, <a href="#7.25.2.2">7.25.2.2</a> conditional inclusion, <a href="#6.10.1">6.10.1</a>
24145 clearerr function, <a href="#7.19.10.1">7.19.10.1</a> conditional operator (? :), <a href="#6.5.15">6.5.15</a>
24146 clgamma function, <a href="#7.26.1">7.26.1</a> conformance, <a href="#4">4</a>
24147 clock function, <a href="#7.23.2.1">7.23.2.1</a> conj functions, <a href="#7.3.9.3">7.3.9.3</a>, <a href="#G.6">G.6</a>
24148 clock_t type, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.1">7.23.2.1</a> conj type-generic macro, <a href="#7.22">7.22</a>
24149 CLOCKS_PER_SEC macro, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.1">7.23.2.1</a> const type qualifier, <a href="#6.7.3">6.7.3</a>
24150 clog functions, <a href="#7.3.7.2">7.3.7.2</a>, <a href="#G.6.3.2">G.6.3.2</a> const-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.7.3">6.7.3</a>
24151 type-generic macro for, <a href="#7.22">7.22</a> constant expression, <a href="#6.6">6.6</a>, <a href="#F.7.4">F.7.4</a>
24152 clog10 function, <a href="#7.26.1">7.26.1</a> constants, <a href="#6.4.4">6.4.4</a>
24153 clog1p function, <a href="#7.26.1">7.26.1</a> as primary expression, <a href="#6.5.1">6.5.1</a>
24154 clog2 function, <a href="#7.26.1">7.26.1</a> character, <a href="#6.4.4.4">6.4.4.4</a>
24155 collating sequences, <a href="#5.2.1">5.2.1</a> enumeration, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
24156 colon punctuator (:), <a href="#6.7.2.1">6.7.2.1</a> floating, <a href="#6.4.4.2">6.4.4.2</a>
24157 comma operator (,), <a href="#6.5.17">6.5.17</a> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
24158 comma punctuator (,), <a href="#6.5.2">6.5.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.7.2.2">6.7.2.2</a>, integer, <a href="#6.4.4.1">6.4.4.1</a>
24159 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a> octal, <a href="#6.4.4.1">6.4.4.1</a>
24160 command processor, <a href="#7.20.4.6">7.20.4.6</a> constraint, <a href="#3.8">3.8</a>, <a href="#4">4</a>
24161 comment delimiters (/* */ and //), <a href="#6.4.9">6.4.9</a> content of structure/union/enumeration, <a href="#6.7.2.3">6.7.2.3</a>
24162 comments, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.4.9">6.4.9</a> contiguity of allocated storage, <a href="#7.20.3">7.20.3</a>
24163 common extensions, <a href="#J.5">J.5</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
24164 common initial sequence, <a href="#6.5.2.3">6.5.2.3</a> contracted expression, <a href="#6.5">6.5</a>, <a href="#7.12.2">7.12.2</a>, <a href="#F.6">F.6</a>
24165 common real type, <a href="#6.3.1.8">6.3.1.8</a> control character, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>
24166 common warnings, <a href="#I">I</a> control wide character, <a href="#7.25.2">7.25.2</a>
24167 comparison functions, <a href="#7.20.5">7.20.5</a>, <a href="#7.20.5.1">7.20.5.1</a>, <a href="#7.20.5.2">7.20.5.2</a> conversion, <a href="#6.3">6.3</a>
24168 string, <a href="#7.21.4">7.21.4</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
24169 wide string, <a href="#7.24.4.4">7.24.4.4</a> array argument, <a href="#6.9.1">6.9.1</a> *
24170 comparison macros, <a href="#7.12.14">7.12.14</a> array parameter, <a href="#6.9.1">6.9.1</a>
24171 comparison, pointer, <a href="#6.5.8">6.5.8</a> arrays, <a href="#6.3.2.1">6.3.2.1</a>
24172 compatible type, <a href="#6.2.7">6.2.7</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.5">6.7.5</a> boolean, <a href="#6.3.1.2">6.3.1.2</a>
24173 compl macro, <a href="#7.9">7.9</a> boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>
24174 complement operator (~), <a href="#6.5.3.3">6.5.3.3</a> by assignment, <a href="#6.5.16.1">6.5.16.1</a>
24175 complex macro, <a href="#7.3.1">7.3.1</a> by return statement, <a href="#6.8.6.4">6.8.6.4</a>
24176 complex numbers, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a> complex types, <a href="#6.3.1.6">6.3.1.6</a>
24177 complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, <a href="#6.3.1.7">6.3.1.7</a> explicit, <a href="#6.3">6.3</a>
24178 complex type domain, <a href="#6.2.5">6.2.5</a> function, <a href="#6.3.2.1">6.3.2.1</a>
24179 complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#G">G</a> function argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
24180 <!--page 536 indent 0-->
24181 function designators, <a href="#6.3.2.1">6.3.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
24182 function parameter, <a href="#6.9.1">6.9.1</a> csinh functions, <a href="#7.3.6.5">7.3.6.5</a>, <a href="#G.6.2.5">G.6.2.5</a>
24183 imaginary, <a href="#G.4.1">G.4.1</a> type-generic macro for, <a href="#7.22">7.22</a>
24184 imaginary and complex, <a href="#G.4.3">G.4.3</a> csqrt functions, <a href="#7.3.8.3">7.3.8.3</a>, <a href="#G.6.4.2">G.6.4.2</a>
24185 implicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.22">7.22</a>
24186 lvalues, <a href="#6.3.2.1">6.3.2.1</a> ctan functions, <a href="#7.3.5.6">7.3.5.6</a>, <a href="#G.6">G.6</a>
24187 pointer, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a> type-generic macro for, <a href="#7.22">7.22</a>
24188 real and complex, <a href="#6.3.1.7">6.3.1.7</a> ctanh functions, <a href="#7.3.6.6">7.3.6.6</a>, <a href="#G.6.2.6">G.6.2.6</a>
24189 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.22">7.22</a>
24190 real floating and integer, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> ctgamma function, <a href="#7.26.1">7.26.1</a>
24191 real floating types, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#F.3">F.3</a> ctime function, <a href="#7.23.3.2">7.23.3.2</a>
24192 signed and unsigned integers, <a href="#6.3.1.3">6.3.1.3</a> ctype.h header, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
24193 usual arithmetic, see usual arithmetic current object, <a href="#6.7.8">6.7.8</a>
24194 conversions CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
24195 void type, <a href="#6.3.2.2">6.3.2.2</a>
24196 conversion functions data stream, see streams
24197 multibyte/wide character, <a href="#7.20.7">7.20.7</a> date and time header, <a href="#7.23">7.23</a>
24198 extended, <a href="#7.24.6">7.24.6</a> Daylight Saving Time, <a href="#7.23.1">7.23.1</a>
24199 restartable, <a href="#7.24.6.3">7.24.6.3</a> DBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24200 multibyte/wide string, <a href="#7.20.8">7.20.8</a> DBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24201 restartable, <a href="#7.24.6.4">7.24.6.4</a> DBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24202 numeric, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1">7.20.1</a> DBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24203 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1">7.24.4.1</a> DBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24204 single byte/wide character, <a href="#7.24.6.1">7.24.6.1</a> DBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24205 time, <a href="#7.23.3">7.23.3</a> DBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24206 wide character, <a href="#7.24.5">7.24.5</a> DBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24207 conversion specifier, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, DBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24208 <a href="#7.24.2.2">7.24.2.2</a> decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
24209 conversion state, <a href="#7.20.7">7.20.7</a>, <a href="#7.24.6">7.24.6</a>, <a href="#7.24.6.2.1">7.24.6.2.1</a>, decimal digit, <a href="#5.2.1">5.2.1</a>
24210 <a href="#7.24.6.3">7.24.6.3</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4">7.24.6.4</a>, decimal-point character, <a href="#7.1.1">7.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24211 <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.6.1">7.19.6.1</a>,
24212 conversion state functions, <a href="#7.24.6.2">7.24.6.2</a> <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.5">F.5</a>
24213 copying functions declaration specifiers, <a href="#6.7">6.7</a>
24214 string, <a href="#7.21.2">7.21.2</a> declarations, <a href="#6.7">6.7</a>
24215 wide string, <a href="#7.24.4.2">7.24.4.2</a> function, <a href="#6.7.5.3">6.7.5.3</a>
24216 copysign functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#7.12.11.1">7.12.11.1</a>, <a href="#F.3">F.3</a>, pointer, <a href="#6.7.5.1">6.7.5.1</a>
24217 <a href="#F.9.8.1">F.9.8.1</a> structure/union, <a href="#6.7.2.1">6.7.2.1</a>
24218 copysign type-generic macro, <a href="#7.22">7.22</a> typedef, <a href="#6.7.7">6.7.7</a>
24219 correctly rounded result, <a href="#3.9">3.9</a> declarator, <a href="#6.7.5">6.7.5</a>
24220 corresponding real type, <a href="#6.2.5">6.2.5</a> abstract, <a href="#6.7.6">6.7.6</a>
24221 cos functions, <a href="#7.12.4.5">7.12.4.5</a>, <a href="#F.9.1.5">F.9.1.5</a> declarator type derivation, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.5">6.7.5</a>
24222 cos type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> decrement operators, see arithmetic operators,
24223 cosh functions, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#F.9.2.4">F.9.2.4</a> increment and decrement
24224 cosh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> default argument promotions, <a href="#6.5.2.2">6.5.2.2</a>
24225 cpow functions, <a href="#7.3.8.2">7.3.8.2</a>, <a href="#G.6.4.1">G.6.4.1</a> default initialization, <a href="#6.7.8">6.7.8</a>
24226 type-generic macro for, <a href="#7.22">7.22</a> default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
24227 cproj functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> define preprocessing directive, <a href="#6.10.3">6.10.3</a>
24228 cproj type-generic macro, <a href="#7.22">7.22</a> defined operator, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.8">6.10.8</a>
24229 creal functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a> definition, <a href="#6.7">6.7</a>
24230 creal type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> function, <a href="#6.9.1">6.9.1</a>
24231 csin functions, <a href="#7.3.5.5">7.3.5.5</a>, <a href="#G.6">G.6</a> derived declarator types, <a href="#6.2.5">6.2.5</a>
24232 <!--page 537 indent 0-->
24233 derived types, <a href="#6.2.5">6.2.5</a> end-of-file indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>,
24234 designated initializer, <a href="#6.7.8">6.7.8</a> <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>,
24235 destringizing, <a href="#6.10.9">6.10.9</a> <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.10.1">7.19.10.1</a>, <a href="#7.19.10.2">7.19.10.2</a>, <a href="#7.24.3.1">7.24.3.1</a>,
24236 device input/output, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.24.3.10">7.24.3.10</a>
24237 diagnostic message, <a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a> end-of-file macro, see EOF macro
24238 diagnostics, <a href="#5.1.1.3">5.1.1.3</a> end-of-line indicator, <a href="#5.2.1">5.2.1</a>
24239 diagnostics header, <a href="#7.2">7.2</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
24240 difftime function, <a href="#7.23.2.2">7.23.2.2</a> enum type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.2">6.7.2.2</a>
24241 digit, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> enumerated type, <a href="#6.2.5">6.2.5</a>
24242 digraphs, <a href="#6.4.6">6.4.6</a> enumeration, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.2">6.7.2.2</a>
24243 direct input/output functions, <a href="#7.19.8">7.19.8</a> enumeration constant, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
24244 display device, <a href="#5.2.2">5.2.2</a> enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
24245 div function, <a href="#7.20.6.2">7.20.6.2</a> enumeration members, <a href="#6.7.2.2">6.7.2.2</a>
24246 div_t type, <a href="#7.20">7.20</a> enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
24247 division assignment operator (/=), <a href="#6.5.16.2">6.5.16.2</a> enumeration tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
24248 division operator (/), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a> enumerator, <a href="#6.7.2.2">6.7.2.2</a>
24249 do statement, <a href="#6.8.5.2">6.8.5.2</a> environment, <a href="#5">5</a>
24250 documentation of implementation, <a href="#4">4</a> environment functions, <a href="#7.20.4">7.20.4</a>
24251 domain error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#7.12.4.4">7.12.4.4</a>, environment list, <a href="#7.20.4.5">7.20.4.5</a>
24252 <a href="#7.12.5.1">7.12.5.1</a>, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#7.12.6.7">7.12.6.7</a>, environmental considerations, <a href="#5.2">5.2</a>
24253 <a href="#7.12.6.8">7.12.6.8</a>, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#7.12.6.11">7.12.6.11</a>, environmental limits, <a href="#5.2.4">5.2.4</a>, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.19.2">7.19.2</a>,
24254 <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.4.4">7.19.4.4</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.20.2.1">7.20.2.1</a>, <a href="#7.20.4.2">7.20.4.2</a>,
24255 <a href="#7.12.9.7">7.12.9.7</a>, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.10.3">7.12.10.3</a> <a href="#7.24.2.1">7.24.2.1</a>
24256 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> EOF macro, <a href="#7.4">7.4</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.1">7.19.5.1</a>, <a href="#7.19.5.2">7.19.5.2</a>,
24257 double _Complex type, <a href="#6.2.5">6.2.5</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.19.6.7">7.19.6.7</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.11">7.19.6.11</a>,
24258 double _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, <a href="#7.19.6.14">7.19.6.14</a>, <a href="#7.19.7.1">7.19.7.1</a>, <a href="#7.19.7.3">7.19.7.3</a>, <a href="#7.19.7.4">7.19.7.4</a>,
24259 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a> <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.9">7.19.7.9</a>, <a href="#7.19.7.10">7.19.7.10</a>,
24260 double _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.2.4">7.24.2.4</a>,
24261 double type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.10">7.24.2.10</a>, <a href="#7.24.2.12">7.24.2.12</a>,
24262 <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.2">F.2</a> <a href="#7.24.3.4">7.24.3.4</a>, <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.24.6.1.2">7.24.6.1.2</a>
24263 double type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>, equal-sign punctuator (=), <a href="#6.7">6.7</a>, <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.8">6.7.8</a>
24264 <a href="#6.3.1.8">6.3.1.8</a> equal-to operator, see equality operator
24265 double-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> equality expressions, <a href="#6.5.9">6.5.9</a>
24266 double-quote escape sequence (\"), <a href="#6.4.4.4">6.4.4.4</a>, equality operator (==), <a href="#6.5.9">6.5.9</a>
24267 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> ERANGE macro, <a href="#7.5">7.5</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.12.1">7.12.1</a>,
24268 double_t type, <a href="#7.12">7.12</a>, <a href="#J.5.6">J.5.6</a> <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>, see
24270 EDOM macro, <a href="#7.5">7.5</a>, <a href="#7.12.1">7.12.1</a>, see also domain error erf functions, <a href="#7.12.8.1">7.12.8.1</a>, <a href="#F.9.5.1">F.9.5.1</a>
24271 effective type, <a href="#6.5">6.5</a> erf type-generic macro, <a href="#7.22">7.22</a>
24272 EILSEQ macro, <a href="#7.5">7.5</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a>, erfc functions, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#F.9.5.2">F.9.5.2</a>
24273 <a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a>, erfc type-generic macro, <a href="#7.22">7.22</a>
24274 see also encoding error errno macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.3.2">7.3.2</a>, <a href="#7.5">7.5</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>,
24275 element type, <a href="#6.2.5">6.2.5</a> <a href="#7.12.1">7.12.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.10.4">7.19.10.4</a>,
24276 elif preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.24.3.1">7.24.3.1</a>,
24277 ellipsis punctuator (...), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.10.3">6.10.3</a> <a href="#7.24.3.3">7.24.3.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>,
24278 else preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a>, <a href="#J.5.17">J.5.17</a>
24279 else statement, <a href="#6.8.4.1">6.8.4.1</a> errno.h header, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
24280 empty statement, <a href="#6.8.3">6.8.3</a> error
24281 encoding error, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a>, domain, see domain error
24282 <a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> encoding, see encoding error
24283 end-of-file, <a href="#7.24.1">7.24.1</a> range, see range error
24284 <!--page 538 indent 0-->
24285 error conditions, <a href="#7.12.1">7.12.1</a> extended characters, <a href="#5.2.1">5.2.1</a>
24286 error functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.9.5">F.9.5</a> extended integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>,
24287 error indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>, <a href="#7.18">7.18</a>
24288 <a href="#7.19.7.3">7.19.7.3</a>, <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.8">7.19.7.8</a>, extended multibyte/wide character conversion
24289 <a href="#7.19.7.9">7.19.7.9</a>, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.10.1">7.19.10.1</a>, <a href="#7.19.10.3">7.19.10.3</a>, utilities, <a href="#7.24.6">7.24.6</a>
24290 <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a> extensible wide character case mapping functions,
24291 error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> <a href="#7.25.3.2">7.25.3.2</a>
24292 error-handling functions, <a href="#7.19.10">7.19.10</a>, <a href="#7.21.6.2">7.21.6.2</a> extensible wide character classification functions,
24293 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.25.2.2">7.25.2.2</a>
24294 escape sequences, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.11.4">6.11.4</a> extern storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.7.1">6.7.1</a>
24295 evaluation format, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#7.12">7.12</a> external definition, <a href="#6.9">6.9</a>
24296 evaluation method, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#F.7.5">F.7.5</a> external identifiers, underscore, <a href="#7.1.3">7.1.3</a>
24297 evaluation order, <a href="#6.5">6.5</a> external linkage, <a href="#6.2.2">6.2.2</a>
24298 exceptional condition, <a href="#6.5">6.5</a>, <a href="#7.12.1">7.12.1</a> external name, <a href="#6.4.2.1">6.4.2.1</a>
24299 excess precision, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, external object definitions, <a href="#6.9.2">6.9.2</a>
24300 <a href="#6.8.6.4">6.8.6.4</a>
24301 excess range, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> fabs functions, <a href="#7.12.7.2">7.12.7.2</a>, <a href="#F.9.4.2">F.9.4.2</a>
24302 exclusive OR operators fabs type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24303 bitwise (^), <a href="#6.5.11">6.5.11</a> false macro, <a href="#7.16">7.16</a>
24304 bitwise assignment (^=), <a href="#6.5.16.2">6.5.16.2</a> fclose function, <a href="#7.19.5.1">7.19.5.1</a>
24305 executable program, <a href="#5.1.1.1">5.1.1.1</a> fdim functions, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#F.9.9.1">F.9.9.1</a>
24306 execution character set, <a href="#5.2.1">5.2.1</a> fdim type-generic macro, <a href="#7.22">7.22</a>
24307 execution environment, <a href="#5">5</a>, <a href="#5.1.2">5.1.2</a>, see also FE_ALL_EXCEPT macro, <a href="#7.6">7.6</a>
24308 environmental limits FE_DFL_ENV macro, <a href="#7.6">7.6</a>
24309 execution sequence, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.8">6.8</a> FE_DIVBYZERO macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24310 exit function, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.20">7.20</a>, <a href="#7.20.4.3">7.20.4.3</a>, FE_DOWNWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24311 <a href="#7.20.4.4">7.20.4.4</a> FE_INEXACT macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24312 EXIT_FAILURE macro, <a href="#7.20">7.20</a>, <a href="#7.20.4.3">7.20.4.3</a> FE_INVALID macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24313 EXIT_SUCCESS macro, <a href="#7.20">7.20</a>, <a href="#7.20.4.3">7.20.4.3</a> FE_OVERFLOW macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24314 exp functions, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#F.9.3.1">F.9.3.1</a> FE_TONEAREST macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24315 exp type-generic macro, <a href="#7.22">7.22</a> FE_TOWARDZERO macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24316 exp2 functions, <a href="#7.12.6.2">7.12.6.2</a>, <a href="#F.9.3.2">F.9.3.2</a> FE_UNDERFLOW macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24317 exp2 type-generic macro, <a href="#7.22">7.22</a> FE_UPWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24318 explicit conversion, <a href="#6.3">6.3</a> feclearexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.1">7.6.2.1</a>, <a href="#F.3">F.3</a>
24319 expm1 functions, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#F.9.3.3">F.9.3.3</a> fegetenv function, <a href="#7.6.4.1">7.6.4.1</a>, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
24320 expm1 type-generic macro, <a href="#7.22">7.22</a> fegetexceptflag function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.2">7.6.2.2</a>, <a href="#F.3">F.3</a>
24321 exponent part, <a href="#6.4.4.2">6.4.4.2</a> fegetround function, <a href="#7.6">7.6</a>, <a href="#7.6.3.1">7.6.3.1</a>, <a href="#F.3">F.3</a>
24322 exponential functions feholdexcept function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.3">7.6.4.3</a>,
24323 complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a> <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
24324 real, <a href="#7.12.6">7.12.6</a>, <a href="#F.9.3">F.9.3</a> fenv.h header, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>, <a href="#H">H</a>
24325 expression, <a href="#6.5">6.5</a> FENV_ACCESS pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.6.1">7.6.1</a>, <a href="#F.7">F.7</a>, <a href="#F.8">F.8</a>,
24326 assignment, <a href="#6.5.16">6.5.16</a> <a href="#F.9">F.9</a>
24327 cast, <a href="#6.5.4">6.5.4</a> fenv_t type, <a href="#7.6">7.6</a>
24328 constant, <a href="#6.6">6.6</a> feof function, <a href="#7.19.10.2">7.19.10.2</a>
24329 full, <a href="#6.8">6.8</a> feraiseexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.3">7.6.2.3</a>, <a href="#F.3">F.3</a>
24330 order of evaluation, <a href="#6.5">6.5</a> ferror function, <a href="#7.19.10.3">7.19.10.3</a>
24331 parenthesized, <a href="#6.5.1">6.5.1</a> fesetenv function, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#F.3">F.3</a>
24332 primary, <a href="#6.5.1">6.5.1</a> fesetexceptflag function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.4">7.6.2.4</a>, <a href="#F.3">F.3</a>
24333 unary, <a href="#6.5.3">6.5.3</a> fesetround function, <a href="#7.6">7.6</a>, <a href="#7.6.3.2">7.6.3.2</a>, <a href="#F.3">F.3</a>
24334 expression statement, <a href="#6.8.3">6.8.3</a> fetestexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.5">7.6.2.5</a>, <a href="#F.3">F.3</a>
24335 extended character set, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.1.2">5.2.1.2</a> feupdateenv function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
24336 <!--page 539 indent 0-->
24337 fexcept_t type, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> floating-point status flag, <a href="#7.6">7.6</a>, <a href="#F.7.6">F.7.6</a>
24338 fflush function, <a href="#7.19.5.2">7.19.5.2</a>, <a href="#7.19.5.3">7.19.5.3</a> floor functions, <a href="#7.12.9.2">7.12.9.2</a>, <a href="#F.9.6.2">F.9.6.2</a>
24339 fgetc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.7.1">7.19.7.1</a>, floor type-generic macro, <a href="#7.22">7.22</a>
24340 <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.8.1">7.19.8.1</a> FLT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24341 fgetpos function, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.3">7.19.9.3</a> FLT_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24342 fgets function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.2">7.19.7.2</a> FLT_EVAL_METHOD macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.8.6.4">6.8.6.4</a>,
24343 fgetwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.12">7.12</a>
24344 <a href="#7.24.3.6">7.24.3.6</a> FLT_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24345 fgetws function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.2">7.24.3.2</a> FLT_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24346 field width, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a> FLT_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24347 file, <a href="#7.19.3">7.19.3</a> FLT_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24348 access functions, <a href="#7.19.5">7.19.5</a> FLT_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24349 name, <a href="#7.19.3">7.19.3</a> FLT_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24350 operations, <a href="#7.19.4">7.19.4</a> FLT_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24351 position indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, FLT_RADIX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
24352 <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>, <a href="#7.19.7.3">7.19.7.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>
24353 <a href="#7.19.8.1">7.19.8.1</a>, <a href="#7.19.8.2">7.19.8.2</a>, <a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.2">7.19.9.2</a>, FLT_ROUNDS macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
24354 <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.9.4">7.19.9.4</a>, <a href="#7.19.9.5">7.19.9.5</a>, <a href="#7.24.3.1">7.24.3.1</a>, fma functions, <a href="#7.12">7.12</a>, <a href="#7.12.13.1">7.12.13.1</a>, <a href="#F.9.10.1">F.9.10.1</a>
24355 <a href="#7.24.3.3">7.24.3.3</a>, <a href="#7.24.3.10">7.24.3.10</a> fma type-generic macro, <a href="#7.22">7.22</a>
24356 positioning functions, <a href="#7.19.9">7.19.9</a> fmax functions, <a href="#7.12.12.2">7.12.12.2</a>, <a href="#F.9.9.2">F.9.9.2</a>
24357 file scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.9">6.9</a> fmax type-generic macro, <a href="#7.22">7.22</a>
24358 FILE type, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> fmin functions, <a href="#7.12.12.3">7.12.12.3</a>, <a href="#F.9.9.3">F.9.9.3</a>
24359 FILENAME_MAX macro, <a href="#7.19.1">7.19.1</a> fmin type-generic macro, <a href="#7.22">7.22</a>
24360 flags, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a> fmod functions, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#F.9.7.1">F.9.7.1</a>
24361 floating-point status, see floating-point status fmod type-generic macro, <a href="#7.22">7.22</a>
24362 flag fopen function, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.5.4">7.19.5.4</a>
24363 flexible array member, <a href="#6.7.2.1">6.7.2.1</a> FOPEN_MAX macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.4.3">7.19.4.3</a>
24364 float _Complex type, <a href="#6.2.5">6.2.5</a> for statement, <a href="#6.8.5">6.8.5</a>, <a href="#6.8.5.3">6.8.5.3</a>
24365 float _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, form-feed character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
24366 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a> form-feed escape sequence (\f), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>,
24367 float _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.4.1.10">7.4.1.10</a>
24368 float type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#F.2">F.2</a> formal argument (deprecated), <a href="#3.15">3.15</a>
24369 float type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>, formal parameter, <a href="#3.15">3.15</a>
24370 <a href="#6.3.1.8">6.3.1.8</a> formatted input/output functions, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.19.6">7.19.6</a>
24371 float.h header, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.20.1.3">7.20.1.3</a>, wide character, <a href="#7.24.2">7.24.2</a>
24372 <a href="#7.24.4.1.1">7.24.4.1.1</a> fortran keyword, <a href="#J.5.9">J.5.9</a>
24373 float_t type, <a href="#7.12">7.12</a>, <a href="#J.5.6">J.5.6</a> forward reference, <a href="#3.11">3.11</a>
24374 floating constant, <a href="#6.4.4.2">6.4.4.2</a> FP_CONTRACT pragma, <a href="#6.5">6.5</a>, <a href="#6.10.6">6.10.6</a>, <a href="#7.12.2">7.12.2</a>, see
24375 floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a> also contracted expression
24376 floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>, FP_FAST_FMA macro, <a href="#7.12">7.12</a>
24377 <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> FP_FAST_FMAF macro, <a href="#7.12">7.12</a>
24378 floating types, <a href="#6.2.5">6.2.5</a>, <a href="#6.11.1">6.11.1</a> FP_FAST_FMAL macro, <a href="#7.12">7.12</a>
24379 floating-point accuracy, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.5">6.5</a>, FP_ILOGB0 macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
24380 <a href="#7.20.1.3">7.20.1.3</a>, <a href="#F.5">F.5</a>, see also contracted expression FP_ILOGBNAN macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
24381 floating-point arithmetic functions, <a href="#7.12">7.12</a>, <a href="#F.9">F.9</a> FP_INFINITE macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24382 floating-point classification functions, <a href="#7.12.3">7.12.3</a> FP_NAN macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24383 floating-point control mode, <a href="#7.6">7.6</a>, <a href="#F.7.6">F.7.6</a> FP_NORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24384 floating-point environment, <a href="#7.6">7.6</a>, <a href="#F.7">F.7</a>, <a href="#F.7.6">F.7.6</a> FP_SUBNORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24385 floating-point exception, <a href="#7.6">7.6</a>, <a href="#7.6.2">7.6.2</a>, <a href="#F.9">F.9</a> FP_ZERO macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
24386 floating-point number, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.2.5">6.2.5</a> fpclassify macro, <a href="#7.12.3.1">7.12.3.1</a>, <a href="#F.3">F.3</a>
24387 floating-point rounding mode, <a href="#5.2.4.2.2">5.2.4.2.2</a> fpos_t type, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>
24388 <!--page 540 indent 0-->
24389 fprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.1">7.19.6.1</a>, language, <a href="#6.11">6.11</a>
24390 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.5">7.19.6.5</a>, <a href="#7.19.6.6">7.19.6.6</a>, library, <a href="#7.26">7.26</a>
24391 <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.3">F.3</a> fwide function, <a href="#7.19.2">7.19.2</a>, <a href="#7.24.3.5">7.24.3.5</a>
24392 fputc function, <a href="#5.2.2">5.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.7.3">7.19.7.3</a>, fwprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.2">7.19.6.2</a>,
24393 <a href="#7.19.7.8">7.19.7.8</a>, <a href="#7.19.8.2">7.19.8.2</a> <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.2.3">7.24.2.3</a>, <a href="#7.24.2.5">7.24.2.5</a>,
24394 fputs function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.4">7.19.7.4</a> <a href="#7.24.2.11">7.24.2.11</a>
24395 fputwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.3">7.24.3.3</a>, fwrite function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.2">7.19.8.2</a>
24396 <a href="#7.24.3.8">7.24.3.8</a> fwscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.2">7.24.2.2</a>,
24397 fputws function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.4">7.24.3.4</a> <a href="#7.24.2.4">7.24.2.4</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.12">7.24.2.12</a>, <a href="#7.24.3.10">7.24.3.10</a>
24398 fread function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.1">7.19.8.1</a>
24399 free function, <a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.4">7.20.3.4</a> gamma functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.9.5">F.9.5</a>
24400 freestanding execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>, general utilities, <a href="#7.20">7.20</a>
24401 <a href="#5.1.2.1">5.1.2.1</a> wide string, <a href="#7.24.4">7.24.4</a>
24402 freopen function, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.5.4">7.19.5.4</a> general wide string utilities, <a href="#7.24.4">7.24.4</a>
24403 frexp functions, <a href="#7.12.6.4">7.12.6.4</a>, <a href="#F.9.3.4">F.9.3.4</a> generic parameters, <a href="#7.22">7.22</a>
24404 frexp type-generic macro, <a href="#7.22">7.22</a> getc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>
24405 fscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, getchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.6">7.19.7.6</a>
24406 <a href="#7.19.6.4">7.19.6.4</a>, <a href="#7.19.6.7">7.19.6.7</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#F.3">F.3</a> getenv function, <a href="#7.20.4.5">7.20.4.5</a>
24407 fseek function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, gets function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.26.9">7.26.9</a>
24408 <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.9.4">7.19.9.4</a>, <a href="#7.19.9.5">7.19.9.5</a>, <a href="#7.24.3.10">7.24.3.10</a> getwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.6">7.24.3.6</a>, <a href="#7.24.3.7">7.24.3.7</a>
24409 fsetpos function, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, getwchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.7">7.24.3.7</a>
24410 <a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.24.3.10">7.24.3.10</a> gmtime function, <a href="#7.23.3.3">7.23.3.3</a>
24411 ftell function, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.9.4">7.19.9.4</a> goto statement, <a href="#6.2.1">6.2.1</a>, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.6.1">6.8.6.1</a>
24412 full declarator, <a href="#6.7.5">6.7.5</a> graphic characters, <a href="#5.2.1">5.2.1</a>
24413 full expression, <a href="#6.8">6.8</a> greater-than operator (>), <a href="#6.5.8">6.5.8</a>
24414 fully buffered stream, <a href="#7.19.3">7.19.3</a> greater-than-or-equal-to operator (>=), <a href="#6.5.8">6.5.8</a>
24416 argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a> header, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.2">7.1.2</a>, see also standard headers
24417 body, <a href="#6.9.1">6.9.1</a> header names, <a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>, <a href="#6.10.2">6.10.2</a>
24418 call, <a href="#6.5.2.2">6.5.2.2</a> hexadecimal constant, <a href="#6.4.4.1">6.4.4.1</a>
24419 library, <a href="#7.1.4">7.1.4</a> hexadecimal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
24420 declarator, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.11.6">6.11.6</a> hexadecimal prefix, <a href="#6.4.4.1">6.4.4.1</a>
24421 definition, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.7">6.11.7</a> hexadecimal-character escape sequence
24422 designator, <a href="#6.3.2.1">6.3.2.1</a> (\x hexadecimal digits), <a href="#6.4.4.4">6.4.4.4</a>
24423 image, <a href="#5.2.3">5.2.3</a> high-order bit, <a href="#3.6">3.6</a>
24424 library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.4">7.1.4</a> horizontal-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
24425 name length, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> horizontal-tab escape sequence (\r), <a href="#7.25.2.1.3">7.25.2.1.3</a>
24426 parameter, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.9.1">6.9.1</a> horizontal-tab escape sequence (\t), <a href="#5.2.2">5.2.2</a>,
24427 prototype, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.7">6.2.7</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>
24428 <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.6">6.11.6</a>, <a href="#6.11.7">6.11.7</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.12">7.12</a> hosted execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.2">5.1.2.2</a>
24429 prototype scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.7.5.2">6.7.5.2</a> HUGE_VAL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
24430 recursive call, <a href="#6.5.2.2">6.5.2.2</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.9">F.9</a>
24431 return, <a href="#6.8.6.4">6.8.6.4</a> HUGE_VALF macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
24432 scope, <a href="#6.2.1">6.2.1</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.9">F.9</a>
24433 type, <a href="#6.2.5">6.2.5</a> HUGE_VALL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
24434 type conversion, <a href="#6.3.2.1">6.3.2.1</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.9">F.9</a>
24435 function specifiers, <a href="#6.7.4">6.7.4</a> hyperbolic functions
24436 function type, <a href="#6.2.5">6.2.5</a> complex, <a href="#7.3.6">7.3.6</a>, <a href="#G.6.2">G.6.2</a>
24437 function-call operator (( )), <a href="#6.5.2.2">6.5.2.2</a> real, <a href="#7.12.5">7.12.5</a>, <a href="#F.9.2">F.9.2</a>
24438 function-like macro, <a href="#6.10.3">6.10.3</a> hypot functions, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#F.9.4.3">F.9.4.3</a>
24439 future directions hypot type-generic macro, <a href="#7.22">7.22</a>
24440 <!--page 541 indent 0-->
24441 <a href="#I">I</a> macro, <a href="#7.3.1">7.3.1</a>, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> initial position, <a href="#5.2.2">5.2.2</a>
24442 identifier, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.5.1">6.5.1</a> initial shift state, <a href="#5.2.1.2">5.2.1.2</a>
24443 linkage, see linkage initialization, <a href="#5.1.2">5.1.2</a>, <a href="#6.2.4">6.2.4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.5">6.5.2.5</a>, <a href="#6.7.8">6.7.8</a>,
24444 maximum length, <a href="#6.4.2.1">6.4.2.1</a> <a href="#F.7.5">F.7.5</a>
24445 name spaces, <a href="#6.2.3">6.2.3</a> in blocks, <a href="#6.8">6.8</a>
24446 reserved, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a> initializer, <a href="#6.7.8">6.7.8</a>
24447 scope, <a href="#6.2.1">6.2.1</a> permitted form, <a href="#6.6">6.6</a>
24448 type, <a href="#6.2.5">6.2.5</a> string literal, <a href="#6.3.2.1">6.3.2.1</a>
24449 identifier list, <a href="#6.7.5">6.7.5</a> inline, <a href="#6.7.4">6.7.4</a>
24450 identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a> inner scope, <a href="#6.2.1">6.2.1</a>
24451 IEC 559, <a href="#F.1">F.1</a> input failure, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.10">7.24.2.10</a>
24452 IEC 60559, <a href="#2">2</a>, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8">6.10.8</a>, <a href="#7.3.3">7.3.3</a>, <a href="#7.6">7.6</a>, input/output functions
24453 <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.14">7.12.14</a>, <a href="#F">F</a>, <a href="#G">G</a>, <a href="#H.1">H.1</a> character, <a href="#7.19.7">7.19.7</a>
24454 IEEE 754, <a href="#F.1">F.1</a> direct, <a href="#7.19.8">7.19.8</a>
24455 IEEE 854, <a href="#F.1">F.1</a> formatted, <a href="#7.19.6">7.19.6</a>
24456 IEEE floating-point arithmetic standard, see wide character, <a href="#7.24.2">7.24.2</a>
24457 IEC 60559, ANSI/IEEE 754, wide character, <a href="#7.24.3">7.24.3</a>
24458 ANSI/IEEE 854 formatted, <a href="#7.24.2">7.24.2</a>
24459 if preprocessing directive, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, input/output header, <a href="#7.19">7.19</a>
24460 <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a> input/output, device, <a href="#5.1.2.3">5.1.2.3</a>
24461 if statement, <a href="#6.8.4.1">6.8.4.1</a> int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.7.2">6.7.2</a>
24462 ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a> int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
24463 ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.3.1.8">6.3.1.8</a>
24464 ilogb functions, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.9.3.5">F.9.3.5</a> INT_FASTN_MAX macros, <a href="#7.18.2.3">7.18.2.3</a>
24465 ilogb type-generic macro, <a href="#7.22">7.22</a> INT_FASTN_MIN macros, <a href="#7.18.2.3">7.18.2.3</a>
24466 imaginary macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a> int_fastN_t types, <a href="#7.18.1.3">7.18.1.3</a>
24467 imaginary numbers, <a href="#G">G</a> INT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
24468 imaginary type domain, <a href="#G.2">G.2</a> INT_LEASTN_MIN macros, <a href="#7.18.2.2">7.18.2.2</a>
24469 imaginary types, <a href="#G">G</a> int_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
24470 imaxabs function, <a href="#7.8.2.1">7.8.2.1</a> INT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
24471 imaxdiv function, <a href="#7.8">7.8</a>, <a href="#7.8.2.2">7.8.2.2</a> INT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>
24472 imaxdiv_t type, <a href="#7.8">7.8</a> integer arithmetic functions, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>,
24473 implementation, <a href="#3.12">3.12</a> <a href="#7.20.6">7.20.6</a>
24474 implementation limit, <a href="#3.13">3.13</a>, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.4.2.1">6.4.2.1</a>, integer character constant, <a href="#6.4.4.4">6.4.4.4</a>
24475 <a href="#6.7.5">6.7.5</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#E">E</a>, see also environmental integer constant, <a href="#6.4.4.1">6.4.4.1</a>
24476 limits integer constant expression, <a href="#6.6">6.6</a>
24477 implementation-defined behavior, <a href="#3.4.1">3.4.1</a>, <a href="#4">4</a>, <a href="#J.3">J.3</a> integer conversion rank, <a href="#6.3.1.1">6.3.1.1</a>
24478 implementation-defined value, <a href="#3.17.1">3.17.1</a> integer promotions, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.3.1.1">6.3.1.1</a>,
24479 implicit conversion, <a href="#6.3">6.3</a> <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.3.3">6.5.3.3</a>, <a href="#6.5.7">6.5.7</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#7.18.2">7.18.2</a>, <a href="#7.18.3">7.18.3</a>,
24480 implicit initialization, <a href="#6.7.8">6.7.8</a> <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>
24481 include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.2">6.10.2</a> integer suffix, <a href="#6.4.4.1">6.4.4.1</a>
24482 inclusive OR operators integer type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
24483 bitwise (|), <a href="#6.5.12">6.5.12</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
24484 bitwise assignment (|=), <a href="#6.5.16.2">6.5.16.2</a> integer types, <a href="#6.2.5">6.2.5</a>, <a href="#7.18">7.18</a>
24485 incomplete type, <a href="#6.2.5">6.2.5</a> extended, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#7.18">7.18</a>
24486 increment operators, see arithmetic operators, interactive device, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.3">7.19.5.3</a>
24487 increment and decrement internal linkage, <a href="#6.2.2">6.2.2</a>
24488 indeterminate value, <a href="#3.17.2">3.17.2</a> internal name, <a href="#6.4.2.1">6.4.2.1</a>
24489 indirection operator (*), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> interrupt, <a href="#5.2.3">5.2.3</a>
24490 inequality operator (!=), <a href="#6.5.9">6.5.9</a> INTMAX_C macro, <a href="#7.18.4.2">7.18.4.2</a>
24491 INFINITY macro, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> INTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a>
24492 <!--page 542 indent 0-->
24493 INTMAX_MIN macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a> iswalpha function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
24494 intmax_t type, <a href="#7.18.1.5">7.18.1.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24495 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> iswblank function, <a href="#7.25.2.1.3">7.25.2.1.3</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24496 INTN_C macros, <a href="#7.18.4.1">7.18.4.1</a> iswcntrl function, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.4">7.25.2.1.4</a>,
24497 INTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24498 INTN_MIN macros, <a href="#7.18.2.1">7.18.2.1</a> iswctype function, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
24499 intN_t types, <a href="#7.18.1.1">7.18.1.1</a> iswdigit function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
24500 INTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a> <a href="#7.25.2.1.5">7.25.2.1.5</a>, <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24501 INTPTR_MIN macro, <a href="#7.18.2.4">7.18.2.4</a> iswgraph function, <a href="#7.25.2.1">7.25.2.1</a>, <a href="#7.25.2.1.6">7.25.2.1.6</a>,
24502 intptr_t type, <a href="#7.18.1.4">7.18.1.4</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24503 inttypes.h header, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a> iswlower function, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.7">7.25.2.1.7</a>,
24504 isalnum function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.9">7.4.1.9</a>, <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.3.1.1">7.25.3.1.1</a>, <a href="#7.25.3.1.2">7.25.3.1.2</a>
24505 isalpha function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a> iswprint function, <a href="#7.25.2.1.6">7.25.2.1.6</a>, <a href="#7.25.2.1.8">7.25.2.1.8</a>,
24506 isblank function, <a href="#7.4.1.3">7.4.1.3</a> <a href="#7.25.2.2.1">7.25.2.2.1</a>
24507 iscntrl function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.4">7.4.1.4</a>, <a href="#7.4.1.7">7.4.1.7</a>, iswpunct function, <a href="#7.25.2.1">7.25.2.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
24508 <a href="#7.4.1.11">7.4.1.11</a> <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, <a href="#7.25.2.1.10">7.25.2.1.10</a>,
24509 isdigit function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.5">7.4.1.5</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24510 <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.11.1.1">7.11.1.1</a> iswspace function, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>,
24511 isfinite macro, <a href="#7.12.3.2">7.12.3.2</a>, <a href="#F.3">F.3</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.6">7.25.2.1.6</a>,
24512 isgraph function, <a href="#7.4.1.6">7.4.1.6</a> <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, <a href="#7.25.2.1.10">7.25.2.1.10</a>,
24513 isgreater macro, <a href="#7.12.14.1">7.12.14.1</a>, <a href="#F.3">F.3</a> <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24514 isgreaterequal macro, <a href="#7.12.14.2">7.12.14.2</a>, <a href="#F.3">F.3</a> iswupper function, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>,
24515 isinf macro, <a href="#7.12.3.3">7.12.3.3</a> <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.3.1.1">7.25.3.1.1</a>, <a href="#7.25.3.1.2">7.25.3.1.2</a>
24516 isless macro, <a href="#7.12.14.3">7.12.14.3</a>, <a href="#F.3">F.3</a> iswxdigit function, <a href="#7.25.2.1.12">7.25.2.1.12</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
24517 islessequal macro, <a href="#7.12.14.4">7.12.14.4</a>, <a href="#F.3">F.3</a> isxdigit function, <a href="#7.4.1.12">7.4.1.12</a>, <a href="#7.11.1.1">7.11.1.1</a>
24518 islessgreater macro, <a href="#7.12.14.5">7.12.14.5</a>, <a href="#F.3">F.3</a> italic type convention, <a href="#3">3</a>, <a href="#6.1">6.1</a>
24519 islower function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.2.1">7.4.2.1</a>, iteration statements, <a href="#6.8.5">6.8.5</a>
24520 <a href="#7.4.2.2">7.4.2.2</a>
24521 isnan macro, <a href="#7.12.3.4">7.12.3.4</a>, <a href="#F.3">F.3</a> jmp_buf type, <a href="#7.13">7.13</a>
24522 isnormal macro, <a href="#7.12.3.5">7.12.3.5</a> jump statements, <a href="#6.8.6">6.8.6</a>
24523 ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>
24524 ISO 4217, <a href="#2">2</a>, <a href="#7.11.2.1">7.11.2.1</a> keywords, <a href="#6.4.1">6.4.1</a>, <a href="#G.2">G.2</a>, <a href="#J.5.9">J.5.9</a>, <a href="#J.5.10">J.5.10</a>
24525 ISO 8601, <a href="#2">2</a>, <a href="#7.23.3.5">7.23.3.5</a> known constant size, <a href="#6.2.5">6.2.5</a>
24526 ISO/IEC 10646, <a href="#2">2</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.4.3">6.4.3</a>, <a href="#6.10.8">6.10.8</a>
24527 ISO/IEC 10976-1, <a href="#H.1">H.1</a> L_tmpnam macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.4">7.19.4.4</a>
24528 ISO/IEC 2382-1, <a href="#2">2</a>, <a href="#3">3</a> label name, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.3">6.2.3</a>
24529 ISO/IEC 646, <a href="#2">2</a>, <a href="#5.2.1.1">5.2.1.1</a> labeled statement, <a href="#6.8.1">6.8.1</a>
24530 ISO/IEC 9945-2, <a href="#7.11">7.11</a> labs function, <a href="#7.20.6.1">7.20.6.1</a>
24531 ISO/IEC TR 10176, <a href="#D">D</a> language, <a href="#6">6</a>
24532 iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> future directions, <a href="#6.11">6.11</a>
24533 isprint function, <a href="#5.2.2">5.2.2</a>, <a href="#7.4.1.8">7.4.1.8</a> syntax summary, <a href="#A">A</a>
24534 ispunct function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, Latin alphabet, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
24535 <a href="#7.4.1.11">7.4.1.11</a> LC_ALL macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24536 isspace function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, LC_COLLATE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.4.3">7.21.4.3</a>,
24537 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.4.2">7.24.4.4.2</a>
24538 <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.2">7.24.2.2</a> LC_CTYPE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.20">7.20</a>, <a href="#7.20.7">7.20.7</a>,
24539 isunordered macro, <a href="#7.12.14.6">7.12.14.6</a>, <a href="#F.3">F.3</a> <a href="#7.20.8">7.20.8</a>, <a href="#7.24.6">7.24.6</a>, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>,
24540 isupper function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.4.2.1">7.4.2.1</a>, <a href="#7.25.3.2.1">7.25.3.2.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
24541 <a href="#7.4.2.2">7.4.2.2</a> LC_MONETARY macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24542 iswalnum function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, LC_NUMERIC macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24543 <a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a> LC_TIME macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.3.5">7.23.3.5</a>
24544 <!--page 543 indent 0-->
24545 lconv structure type, <a href="#7.11">7.11</a> llabs function, <a href="#7.20.6.1">7.20.6.1</a>
24546 LDBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> lldiv function, <a href="#7.20.6.2">7.20.6.2</a>
24547 LDBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> lldiv_t type, <a href="#7.20">7.20</a>
24548 LDBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> LLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>,
24549 LDBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.24.4.1.2">7.24.4.1.2</a>
24550 LDBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> LLONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>,
24551 LDBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.24.4.1.2">7.24.4.1.2</a>
24552 LDBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.9.6.5">F.9.6.5</a>
24553 LDBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llrint type-generic macro, <a href="#7.22">7.22</a>
24554 LDBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.7">F.9.6.7</a>
24555 ldexp functions, <a href="#7.12.6.6">7.12.6.6</a>, <a href="#F.9.3.6">F.9.3.6</a> llround type-generic macro, <a href="#7.22">7.22</a>
24556 ldexp type-generic macro, <a href="#7.22">7.22</a> local time, <a href="#7.23.1">7.23.1</a>
24557 ldiv function, <a href="#7.20.6.2">7.20.6.2</a> locale, <a href="#3.4.2">3.4.2</a>
24558 ldiv_t type, <a href="#7.20">7.20</a> locale-specific behavior, <a href="#3.4.2">3.4.2</a>, <a href="#J.4">J.4</a>
24559 leading underscore in identifiers, <a href="#7.1.3">7.1.3</a> locale.h header, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
24560 left-shift assignment operator (<<=), <a href="#6.5.16.2">6.5.16.2</a> localeconv function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24561 left-shift operator (<<), <a href="#6.5.7">6.5.7</a> localization, <a href="#7.11">7.11</a>
24562 length localtime function, <a href="#7.23.3.4">7.23.3.4</a>
24563 external name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> log functions, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#F.9.3.7">F.9.3.7</a>
24564 function name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> log type-generic macro, <a href="#7.22">7.22</a>
24565 identifier, <a href="#6.4.2.1">6.4.2.1</a> log10 functions, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#F.9.3.8">F.9.3.8</a>
24566 internal name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a> log10 type-generic macro, <a href="#7.22">7.22</a>
24567 length function, <a href="#7.20.7.1">7.20.7.1</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.24.4.6.1">7.24.4.6.1</a>, log1p functions, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#F.9.3.9">F.9.3.9</a>
24568 <a href="#7.24.6.3.1">7.24.6.3.1</a> log1p type-generic macro, <a href="#7.22">7.22</a>
24569 length modifier, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, log2 functions, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#F.9.3.10">F.9.3.10</a>
24570 <a href="#7.24.2.2">7.24.2.2</a> log2 type-generic macro, <a href="#7.22">7.22</a>
24571 less-than operator (<), <a href="#6.5.8">6.5.8</a> logarithmic functions
24572 less-than-or-equal-to operator (<=), <a href="#6.5.8">6.5.8</a> complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
24573 letter, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> real, <a href="#7.12.6">7.12.6</a>, <a href="#F.9.3">F.9.3</a>
24574 lexical elements, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a> logb functions, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#F.3">F.3</a>, <a href="#F.9.3.11">F.9.3.11</a>
24575 lgamma functions, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#F.9.5.3">F.9.5.3</a> logb type-generic macro, <a href="#7.22">7.22</a>
24576 lgamma type-generic macro, <a href="#7.22">7.22</a> logical operators
24577 library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7">7</a> AND (&&), <a href="#6.5.13">6.5.13</a>
24578 future directions, <a href="#7.26">7.26</a> negation (!), <a href="#6.5.3.3">6.5.3.3</a>
24579 summary, <a href="#B">B</a> OR (||), <a href="#6.5.14">6.5.14</a>
24580 terms, <a href="#7.1.1">7.1.1</a> logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
24581 use of functions, <a href="#7.1.4">7.1.4</a> long double _Complex type, <a href="#6.2.5">6.2.5</a>
24582 lifetime, <a href="#6.2.4">6.2.4</a> long double _Complex type conversion,
24583 limits <a href="#6.3.1.6">6.3.1.6</a>, <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
24584 environmental, see environmental limits long double _Imaginary type, <a href="#G.2">G.2</a>
24585 implementation, see implementation limits long double suffix, l or <a href="#L">L</a>, <a href="#6.4.4.2">6.4.4.2</a>
24586 numerical, see numerical limits long double type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>,
24587 translation, see translation limits <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.2">F.2</a>
24588 limits.h header, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a> long double type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>,
24589 line buffered stream, <a href="#7.19.3">7.19.3</a> <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
24590 line number, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8">6.10.8</a> long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.1">7.19.6.1</a>,
24591 line preprocessing directive, <a href="#6.10.4">6.10.4</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>
24592 lines, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#7.19.2">7.19.2</a> long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
24593 preprocessing directive, <a href="#6.10">6.10</a> <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
24594 linkage, <a href="#6.2.2">6.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.4">6.7.4</a>, <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.9">6.9</a>, <a href="#6.9.2">6.9.2</a>, long integer suffix, l or <a href="#L">L</a>, <a href="#6.4.4.1">6.4.4.1</a>
24595 <a href="#6.11.2">6.11.2</a> long long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>,
24596 <!--page 544 indent 0-->
24597 <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> mbsinit function, <a href="#7.24.6.2.1">7.24.6.2.1</a>
24598 long long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, mbsrtowcs function, <a href="#7.24.6.4.1">7.24.6.4.1</a>
24599 <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a> mbstate_t type, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.1">7.19.6.1</a>,
24600 long long integer suffix, ll or LL, <a href="#6.4.4.1">6.4.4.1</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.6">7.24.6</a>,
24601 LONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.6.2.1">7.24.6.2.1</a>, <a href="#7.24.6.3">7.24.6.3</a>, <a href="#7.24.6.3.1">7.24.6.3.1</a>, <a href="#7.24.6.4">7.24.6.4</a>
24602 LONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a> mbstowcs function, <a href="#6.4.5">6.4.5</a>, <a href="#7.20.8.1">7.20.8.1</a>, <a href="#7.24.6.4">7.24.6.4</a>
24603 longjmp function, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.13.2.1">7.13.2.1</a>, <a href="#7.20.4.3">7.20.4.3</a> mbtowc function, <a href="#7.20.7.1">7.20.7.1</a>, <a href="#7.20.7.2">7.20.7.2</a>, <a href="#7.20.8.1">7.20.8.1</a>,
24604 loop body, <a href="#6.8.5">6.8.5</a> <a href="#7.24.6.3">7.24.6.3</a>
24605 low-order bit, <a href="#3.6">3.6</a> member access operators (. and ->), <a href="#6.5.2.3">6.5.2.3</a>
24606 lowercase letter, <a href="#5.2.1">5.2.1</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
24607 lrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.9.6.5">F.9.6.5</a> memchr function, <a href="#7.21.5.1">7.21.5.1</a>
24608 lrint type-generic macro, <a href="#7.22">7.22</a> memcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.1">7.21.4.1</a>
24609 lround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.7">F.9.6.7</a> memcpy function, <a href="#7.21.2.1">7.21.2.1</a>
24610 lround type-generic macro, <a href="#7.22">7.22</a> memmove function, <a href="#7.21.2.2">7.21.2.2</a>
24611 lvalue, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.3.1">6.5.3.1</a>, <a href="#6.5.16">6.5.16</a> memory management functions, <a href="#7.20.3">7.20.3</a>
24612 memset function, <a href="#7.21.6.1">7.21.6.1</a>
24613 macro argument substitution, <a href="#6.10.3.1">6.10.3.1</a> minimum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.9.9">F.9.9</a>
24614 macro definition minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
24615 library function, <a href="#7.1.4">7.1.4</a> miscellaneous functions
24616 macro invocation, <a href="#6.10.3">6.10.3</a> string, <a href="#7.21.6">7.21.6</a>
24617 macro name, <a href="#6.10.3">6.10.3</a> wide string, <a href="#7.24.4.6">7.24.4.6</a>
24618 length, <a href="#5.2.4.1">5.2.4.1</a> mktime function, <a href="#7.23.2.3">7.23.2.3</a>
24619 predefined, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a> modf functions, <a href="#7.12.6.12">7.12.6.12</a>, <a href="#F.9.3.12">F.9.3.12</a>
24620 redefinition, <a href="#6.10.3">6.10.3</a> modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
24621 scope, <a href="#6.10.3.5">6.10.3.5</a> modulus functions, <a href="#7.12.6.12">7.12.6.12</a>
24622 macro parameter, <a href="#6.10.3">6.10.3</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
24623 macro preprocessor, <a href="#6.10">6.10</a> multibyte character, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
24624 macro replacement, <a href="#6.10.3">6.10.3</a> multibyte conversion functions
24625 magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a> wide character, <a href="#7.20.7">7.20.7</a>
24626 main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#6.7.3.1">6.7.3.1</a>, <a href="#6.7.4">6.7.4</a>, extended, <a href="#7.24.6">7.24.6</a>
24627 <a href="#7.19.3">7.19.3</a> restartable, <a href="#7.24.6.3">7.24.6.3</a>
24628 malloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.3">7.20.3.3</a>, wide string, <a href="#7.20.8">7.20.8</a>
24629 <a href="#7.20.3.4">7.20.3.4</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
24630 manipulation functions multibyte string, <a href="#7.1.1">7.1.1</a>
24631 complex, <a href="#7.3.9">7.3.9</a> multibyte/wide character conversion functions,
24632 real, <a href="#7.12.11">7.12.11</a>, <a href="#F.9.8">F.9.8</a> <a href="#7.20.7">7.20.7</a>
24633 matching failure, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.10">7.24.2.10</a> extended, <a href="#7.24.6">7.24.6</a>
24634 math.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.22">7.22</a>, <a href="#F">F</a>, <a href="#F.9">F.9</a>, restartable, <a href="#7.24.6.3">7.24.6.3</a>
24635 <a href="#J.5.17">J.5.17</a> multibyte/wide string conversion functions, <a href="#7.20.8">7.20.8</a>
24636 MATH_ERREXCEPT macro, <a href="#7.12">7.12</a>, <a href="#F.9">F.9</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
24637 math_errhandling macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.12">7.12</a>, <a href="#F.9">F.9</a> multidimensional array, <a href="#6.5.2.1">6.5.2.1</a>
24638 MATH_ERRNO macro, <a href="#7.12">7.12</a> multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>
24639 maximum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.9.9">F.9.9</a> multiplication operator (*), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a>
24640 MB_CUR_MAX macro, <a href="#7.1.1">7.1.1</a>, <a href="#7.20">7.20</a>, <a href="#7.20.7.2">7.20.7.2</a>, multiplicative expressions, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
24641 <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>
24642 MB_LEN_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.1.1">7.1.1</a>, <a href="#7.20">7.20</a> n-char sequence, <a href="#7.20.1.3">7.20.1.3</a>
24643 mblen function, <a href="#7.20.7.1">7.20.7.1</a>, <a href="#7.24.6.3">7.24.6.3</a> n-wchar sequence, <a href="#7.24.4.1.1">7.24.4.1.1</a>
24644 mbrlen function, <a href="#7.24.6.3.1">7.24.6.3.1</a> name
24645 mbrtowc function, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, external, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a>
24646 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.6.3.1">7.24.6.3.1</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>, file, <a href="#7.19.3">7.19.3</a>
24647 <a href="#7.24.6.4.1">7.24.6.4.1</a> internal, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
24648 <!--page 545 indent 0-->
24649 label, <a href="#6.2.3">6.2.3</a> octal-character escape sequence (\octal digits),
24650 structure/union member, <a href="#6.2.3">6.2.3</a> <a href="#6.4.4.4">6.4.4.4</a>
24651 name spaces, <a href="#6.2.3">6.2.3</a> offsetof macro, <a href="#7.17">7.17</a>
24652 named label, <a href="#6.8.1">6.8.1</a> on-off switch, <a href="#6.10.6">6.10.6</a>
24653 NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a> ones' complement, <a href="#6.2.6.2">6.2.6.2</a>
24654 nan functions, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#F.2.1">F.2.1</a>, <a href="#F.9.8.2">F.9.8.2</a> operand, <a href="#6.4.6">6.4.6</a>, <a href="#6.5">6.5</a>
24655 NAN macro, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> operating system, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#7.20.4.6">7.20.4.6</a>
24656 NDEBUG macro, <a href="#7.2">7.2</a> operations on files, <a href="#7.19.4">7.19.4</a>
24657 nearbyint functions, <a href="#7.12.9.3">7.12.9.3</a>, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, operator, <a href="#6.4.6">6.4.6</a>
24658 <a href="#F.9.6.3">F.9.6.3</a> operators, <a href="#6.5">6.5</a>
24659 nearbyint type-generic macro, <a href="#7.22">7.22</a> assignment, <a href="#6.5.16">6.5.16</a>
24660 nearest integer functions, <a href="#7.12.9">7.12.9</a>, <a href="#F.9.6">F.9.6</a> associativity, <a href="#6.5">6.5</a>
24661 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> equality, <a href="#6.5.9">6.5.9</a>
24662 negative zero, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.12.11.1">7.12.11.1</a> multiplicative, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
24663 new-line character, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#6.10.4">6.10.4</a> postfix, <a href="#6.5.2">6.5.2</a>
24664 new-line escape sequence (\n), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, precedence, <a href="#6.5">6.5</a>
24665 <a href="#7.4.1.10">7.4.1.10</a> preprocessing, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>, <a href="#6.10.9">6.10.9</a>
24666 nextafter functions, <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, relational, <a href="#6.5.8">6.5.8</a>
24667 <a href="#F.9.8.3">F.9.8.3</a> shift, <a href="#6.5.7">6.5.7</a>
24668 nextafter type-generic macro, <a href="#7.22">7.22</a> unary, <a href="#6.5.3">6.5.3</a>
24669 nexttoward functions, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, <a href="#F.9.8.4">F.9.8.4</a> unary arithmetic, <a href="#6.5.3.3">6.5.3.3</a>
24670 nexttoward type-generic macro, <a href="#7.22">7.22</a> or macro, <a href="#7.9">7.9</a>
24671 no linkage, <a href="#6.2.2">6.2.2</a> OR operators
24672 non-stop floating-point control mode, <a href="#7.6.4.2">7.6.4.2</a> bitwise exclusive (^), <a href="#6.5.11">6.5.11</a>
24673 nongraphic characters, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> bitwise exclusive assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
24674 nonlocal jumps header, <a href="#7.13">7.13</a> bitwise inclusive (|), <a href="#6.5.12">6.5.12</a>
24675 norm, complex, <a href="#7.3.8.1">7.3.8.1</a> bitwise inclusive assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
24676 not macro, <a href="#7.9">7.9</a> logical (||), <a href="#6.5.14">6.5.14</a>
24677 not-equal-to operator, see inequality operator or_eq macro, <a href="#7.9">7.9</a>
24678 not_eq macro, <a href="#7.9">7.9</a> order of allocated storage, <a href="#7.20.3">7.20.3</a>
24679 null character (\0), <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> order of evaluation, <a href="#6.5">6.5</a>
24680 padding of binary stream, <a href="#7.19.2">7.19.2</a> ordinary identifier name space, <a href="#6.2.3">6.2.3</a>
24681 NULL macro, <a href="#7.11">7.11</a>, <a href="#7.17">7.17</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.20">7.20</a>, <a href="#7.21.1">7.21.1</a>, orientation of stream, <a href="#7.19.2">7.19.2</a>, <a href="#7.24.3.5">7.24.3.5</a>
24682 <a href="#7.23.1">7.23.1</a>, <a href="#7.24.1">7.24.1</a> outer scope, <a href="#6.2.1">6.2.1</a>
24683 null pointer, <a href="#6.3.2.3">6.3.2.3</a>
24684 null pointer constant, <a href="#6.3.2.3">6.3.2.3</a> padding
24685 null preprocessing directive, <a href="#6.10.7">6.10.7</a> binary stream, <a href="#7.19.2">7.19.2</a>
24686 null statement, <a href="#6.8.3">6.8.3</a> bits, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.18.1.1">7.18.1.1</a>
24687 null wide character, <a href="#7.1.1">7.1.1</a> structure/union, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.7.2.1">6.7.2.1</a>
24688 number classification macros, <a href="#7.12">7.12</a>, <a href="#7.12.3.1">7.12.3.1</a> parameter, <a href="#3.15">3.15</a>
24689 numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1">7.20.1</a> array, <a href="#6.9.1">6.9.1</a>
24690 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1">7.24.4.1</a> ellipsis, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.10.3">6.10.3</a>
24691 numerical limits, <a href="#5.2.4.2">5.2.4.2</a> function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.9.1">6.9.1</a>
24692 macro, <a href="#6.10.3">6.10.3</a>
24693 object, <a href="#3.14">3.14</a> main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>
24694 object representation, <a href="#6.2.6.1">6.2.6.1</a> program, <a href="#5.1.2.2.1">5.1.2.2.1</a>
24695 object type, <a href="#6.2.5">6.2.5</a> parameter type list, <a href="#6.7.5.3">6.7.5.3</a>
24696 object-like macro, <a href="#6.10.3">6.10.3</a> parentheses punctuator (( )), <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a>
24697 obsolescence, <a href="#6.11">6.11</a>, <a href="#7.26">7.26</a> parenthesized expression, <a href="#6.5.1">6.5.1</a>
24698 octal constant, <a href="#6.4.4.1">6.4.4.1</a> parse state, <a href="#7.19.2">7.19.2</a>
24699 octal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.4">6.4.4.4</a> permitted form of initializer, <a href="#6.6">6.6</a>
24700 <!--page 546 indent 0-->
24701 perror function, <a href="#7.19.10.4">7.19.10.4</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
24702 phase angle, complex, <a href="#7.3.9.1">7.3.9.1</a> primary expression, <a href="#6.5.1">6.5.1</a>
24703 physical source lines, <a href="#5.1.1.2">5.1.1.2</a> printf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.10">7.19.6.10</a>
24704 placemarker, <a href="#6.10.3.3">6.10.3.3</a> printing character, <a href="#5.2.2">5.2.2</a>, <a href="#7.4">7.4</a>, <a href="#7.4.1.8">7.4.1.8</a>
24705 plus operator, unary, <a href="#6.5.3.3">6.5.3.3</a> printing wide character, <a href="#7.25.2">7.25.2</a>
24706 pointer arithmetic, <a href="#6.5.6">6.5.6</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
24707 pointer comparison, <a href="#6.5.8">6.5.8</a> program execution, <a href="#5.1.2.2.2">5.1.2.2.2</a>, <a href="#5.1.2.3">5.1.2.3</a>
24708 pointer declarator, <a href="#6.7.5.1">6.7.5.1</a> program file, <a href="#5.1.1.1">5.1.1.1</a>
24709 pointer operator (->), <a href="#6.5.2.3">6.5.2.3</a> program image, <a href="#5.1.1.2">5.1.1.2</a>
24710 pointer to function, <a href="#6.5.2.2">6.5.2.2</a> program name (argv[0]), <a href="#5.1.2.2.1">5.1.2.2.1</a>
24711 pointer type, <a href="#6.2.5">6.2.5</a> program parameters, <a href="#5.1.2.2.1">5.1.2.2.1</a>
24712 pointer type conversion, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a> program startup, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#5.1.2.2.1">5.1.2.2.1</a>
24713 pointer, null, <a href="#6.3.2.3">6.3.2.3</a> program structure, <a href="#5.1.1.1">5.1.1.1</a>
24714 portability, <a href="#4">4</a>, <a href="#J">J</a> program termination, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#5.1.2.2.3">5.1.2.2.3</a>,
24715 position indicator, file, see file position indicator <a href="#5.1.2.3">5.1.2.3</a>
24716 positive difference, <a href="#7.12.12.1">7.12.12.1</a> program, conforming, <a href="#4">4</a>
24717 positive difference functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.9.9">F.9.9</a> program, strictly conforming, <a href="#4">4</a>
24718 postfix decrement operator (--), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> promotions
24719 postfix expressions, <a href="#6.5.2">6.5.2</a> default argument, <a href="#6.5.2.2">6.5.2.2</a>
24720 postfix increment operator (++), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> integer, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.3.1.1">6.3.1.1</a>
24721 pow functions, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#F.9.4.4">F.9.4.4</a> prototype, see function prototype
24722 pow type-generic macro, <a href="#7.22">7.22</a> pseudo-random sequence functions, <a href="#7.20.2">7.20.2</a>
24723 power functions PTRDIFF_MAX macro, <a href="#7.18.3">7.18.3</a>
24724 complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a> PTRDIFF_MIN macro, <a href="#7.18.3">7.18.3</a>
24725 real, <a href="#7.12.7">7.12.7</a>, <a href="#F.9.4">F.9.4</a> ptrdiff_t type, <a href="#7.17">7.17</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.6.1">7.19.6.1</a>,
24726 pp-number, <a href="#6.4.8">6.4.8</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>
24727 pragma operator, <a href="#6.10.9">6.10.9</a> punctuators, <a href="#6.4.6">6.4.6</a>
24728 pragma preprocessing directive, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a> putc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.8">7.19.7.8</a>, <a href="#7.19.7.9">7.19.7.9</a>
24729 precedence of operators, <a href="#6.5">6.5</a> putchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.9">7.19.7.9</a>
24730 precedence of syntax rules, <a href="#5.1.1.2">5.1.1.2</a> puts function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.10">7.19.7.10</a>
24731 precision, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a> putwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.8">7.24.3.8</a>, <a href="#7.24.3.9">7.24.3.9</a>
24732 excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> putwchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.9">7.24.3.9</a>
24733 predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
24734 prefix decrement operator (--), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> qsort function, <a href="#7.20.5">7.20.5</a>, <a href="#7.20.5.2">7.20.5.2</a>
24735 prefix increment operator (++), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> qualified types, <a href="#6.2.5">6.2.5</a>
24736 preprocessing concatenation, <a href="#6.10.3.3">6.10.3.3</a> qualified version of type, <a href="#6.2.5">6.2.5</a>
24737 preprocessing directives, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10">6.10</a> question-mark escape sequence (\?), <a href="#6.4.4.4">6.4.4.4</a>
24738 preprocessing file, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.10">6.10</a> quiet NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>
24739 preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
24740 preprocessing operators raise function, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.14.2.1">7.14.2.1</a>, <a href="#7.20.4.1">7.20.4.1</a>
24741 #, <a href="#6.10.3.2">6.10.3.2</a> rand function, <a href="#7.20">7.20</a>, <a href="#7.20.2.1">7.20.2.1</a>, <a href="#7.20.2.2">7.20.2.2</a>
24742 ##, <a href="#6.10.3.3">6.10.3.3</a> RAND_MAX macro, <a href="#7.20">7.20</a>, <a href="#7.20.2.1">7.20.2.1</a>
24743 _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> range
24744 defined, <a href="#6.10.1">6.10.1</a> excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>
24745 preprocessing tokens, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a> range error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#7.12.5.5">7.12.5.5</a>,
24746 preprocessing translation unit, <a href="#5.1.1.1">5.1.1.1</a> <a href="#7.12.6.1">7.12.6.1</a>, <a href="#7.12.6.2">7.12.6.2</a>, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#7.12.6.5">7.12.6.5</a>,
24747 preprocessor, <a href="#6.10">6.10</a> <a href="#7.12.6.6">7.12.6.6</a>, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#7.12.6.9">7.12.6.9</a>,
24748 PRIcFASTN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.6.10">7.12.6.10</a>, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#7.12.7.3">7.12.7.3</a>,
24749 PRIcLEASTN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#7.12.8.4">7.12.8.4</a>,
24750 PRIcMAX macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.12.1">7.12.12.1</a>,
24751 PRIcN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.13.1">7.12.13.1</a>
24752 <!--page 547 indent 0-->
24753 rank, see integer conversion rank same scope, <a href="#6.2.1">6.2.1</a>
24754 real floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, save calling environment function, <a href="#7.13.1">7.13.1</a>
24755 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> scalar types, <a href="#6.2.5">6.2.5</a>
24756 real floating types, <a href="#6.2.5">6.2.5</a> scalbln function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.9.3.13">F.9.3.13</a>
24757 real type domain, <a href="#6.2.5">6.2.5</a> scalbln type-generic macro, <a href="#7.22">7.22</a>
24758 real types, <a href="#6.2.5">6.2.5</a> scalbn function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.9.3.13">F.9.3.13</a>
24759 real-floating, <a href="#7.12.3">7.12.3</a> scalbn type-generic macro, <a href="#7.22">7.22</a>
24760 realloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.4">7.20.3.4</a> scanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.4">7.19.6.4</a>, <a href="#7.19.6.11">7.19.6.11</a>
24761 recommended practice, <a href="#3.16">3.16</a> scanlist, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>
24762 recursion, <a href="#6.5.2.2">6.5.2.2</a> scanset, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>
24763 recursive function call, <a href="#6.5.2.2">6.5.2.2</a> SCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24764 redefinition of macro, <a href="#6.10.3">6.10.3</a> SCHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24765 reentrancy, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a> SCNcFASTN macros, <a href="#7.8.1">7.8.1</a>
24766 library functions, <a href="#7.1.4">7.1.4</a> SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>
24767 referenced type, <a href="#6.2.5">6.2.5</a> SCNcMAX macros, <a href="#7.8.1">7.8.1</a>
24768 register storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a> SCNcN macros, <a href="#7.8.1">7.8.1</a>
24769 relational expressions, <a href="#6.5.8">6.5.8</a> SCNcPTR macros, <a href="#7.8.1">7.8.1</a>
24770 reliability of data, interrupted, <a href="#5.1.2.3">5.1.2.3</a> scope of identifier, <a href="#6.2.1">6.2.1</a>, <a href="#6.9.2">6.9.2</a>
24771 remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a> search functions
24772 remainder functions, <a href="#7.12.10">7.12.10</a>, <a href="#F.9.7">F.9.7</a> string, <a href="#7.21.5">7.21.5</a>
24773 remainder functions, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>, utility, <a href="#7.20.5">7.20.5</a>
24774 <a href="#F.9.7.2">F.9.7.2</a> wide string, <a href="#7.24.4.5">7.24.4.5</a>
24775 remainder operator (%), <a href="#6.5.5">6.5.5</a> SEEK_CUR macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.9.2">7.19.9.2</a>
24776 remainder type-generic macro, <a href="#7.22">7.22</a> SEEK_END macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.9.2">7.19.9.2</a>
24777 remove function, <a href="#7.19.4.1">7.19.4.1</a>, <a href="#7.19.4.4">7.19.4.4</a> SEEK_SET macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.9.2">7.19.9.2</a>
24778 remquo functions, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>, <a href="#F.9.7.3">F.9.7.3</a> selection statements, <a href="#6.8.4">6.8.4</a>
24779 remquo type-generic macro, <a href="#7.22">7.22</a> self-referential structure, <a href="#6.7.2.3">6.7.2.3</a>
24780 rename function, <a href="#7.19.4.2">7.19.4.2</a> semicolon punctuator (;), <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.8.3">6.8.3</a>,
24781 representations of types, <a href="#6.2.6">6.2.6</a> <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>
24782 pointer, <a href="#6.2.5">6.2.5</a> separate compilation, <a href="#5.1.1.1">5.1.1.1</a>
24783 rescanning and replacement, <a href="#6.10.3.4">6.10.3.4</a> separate translation, <a href="#5.1.1.1">5.1.1.1</a>
24784 reserved identifiers, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a> sequence points, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a>, <a href="#6.8">6.8</a>, <a href="#7.1.4">7.1.4</a>, <a href="#7.19.6">7.19.6</a>,
24785 restartable multibyte/wide character conversion <a href="#7.20.5">7.20.5</a>, <a href="#7.24.2">7.24.2</a>, <a href="#C">C</a>
24786 functions, <a href="#7.24.6.3">7.24.6.3</a> sequencing of statements, <a href="#6.8">6.8</a>
24787 restartable multibyte/wide string conversion setbuf function, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.1">7.19.5.1</a>, <a href="#7.19.5.5">7.19.5.5</a>
24788 functions, <a href="#7.24.6.4">7.24.6.4</a> setjmp macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.13.2.1">7.13.2.1</a>
24789 restore calling environment function, <a href="#7.13.2">7.13.2</a> setjmp.h header, <a href="#7.13">7.13</a>
24790 restrict type qualifier, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a> setlocale function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
24791 restrict-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a> setvbuf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.1">7.19.5.1</a>,
24792 return statement, <a href="#6.8.6.4">6.8.6.4</a> <a href="#7.19.5.5">7.19.5.5</a>, <a href="#7.19.5.6">7.19.5.6</a>
24793 rewind function, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.5">7.19.9.5</a>, shall, <a href="#4">4</a>
24794 <a href="#7.24.3.10">7.24.3.10</a> shift expressions, <a href="#6.5.7">6.5.7</a>
24795 right-shift assignment operator (>>=), <a href="#6.5.16.2">6.5.16.2</a> shift sequence, <a href="#7.1.1">7.1.1</a>
24796 right-shift operator (>>), <a href="#6.5.7">6.5.7</a> shift states, <a href="#5.2.1.2">5.2.1.2</a>
24797 rint functions, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, <a href="#F.9.6.4">F.9.6.4</a> short identifier, character, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.3">6.4.3</a>
24798 rint type-generic macro, <a href="#7.22">7.22</a> short int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.1">7.19.6.1</a>,
24799 round functions, <a href="#7.12.9.6">7.12.9.6</a>, <a href="#F.9.6.6">F.9.6.6</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>
24800 round type-generic macro, <a href="#7.22">7.22</a> short int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
24801 rounding mode, floating point, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
24802 rvalue, <a href="#6.3.2.1">6.3.2.1</a> SHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24803 SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24804 <!--page 548 indent 0-->
24805 side effects, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a> source lines, <a href="#5.1.1.2">5.1.1.2</a>
24806 SIG_ATOMIC_MAX macro, <a href="#7.18.3">7.18.3</a> source text, <a href="#5.1.1.2">5.1.1.2</a>
24807 SIG_ATOMIC_MIN macro, <a href="#7.18.3">7.18.3</a> space character (' '), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>,
24808 sig_atomic_t type, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.18.3">7.18.3</a> <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a>
24809 SIG_DFL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sprintf function, <a href="#7.19.6.6">7.19.6.6</a>, <a href="#7.19.6.13">7.19.6.13</a>
24810 SIG_ERR macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sqrt functions, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#F.3">F.3</a>, <a href="#F.9.4.5">F.9.4.5</a>
24811 SIG_IGN macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sqrt type-generic macro, <a href="#7.22">7.22</a>
24812 SIGABRT macro, <a href="#7.14">7.14</a>, <a href="#7.20.4.1">7.20.4.1</a> srand function, <a href="#7.20.2.2">7.20.2.2</a>
24813 SIGFPE macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.5.17">J.5.17</a> sscanf function, <a href="#7.19.6.7">7.19.6.7</a>, <a href="#7.19.6.14">7.19.6.14</a>
24814 SIGILL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> standard error stream, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.10.4">7.19.10.4</a>
24815 SIGINT macro, <a href="#7.14">7.14</a> standard headers, <a href="#4">4</a>, <a href="#7.1.2">7.1.2</a>
24816 sign and magnitude, <a href="#6.2.6.2">6.2.6.2</a> <assert.h>, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
24817 sign bit, <a href="#6.2.6.2">6.2.6.2</a> <complex.h>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>, <a href="#7.26.1">7.26.1</a>,
24818 signal function, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.20.4.4">7.20.4.4</a> <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
24819 signal handler, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.14.2.1">7.14.2.1</a> <ctype.h>, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
24820 signal handling functions, <a href="#7.14.1">7.14.1</a> <errno.h>, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
24821 signal.h header, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a> <fenv.h>, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>, <a href="#H">H</a>
24822 signaling NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#F.2.1">F.2.1</a> <float.h>, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.20.1.3">7.20.1.3</a>,
24823 signals, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>, <a href="#7.14.1">7.14.1</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>
24824 signbit macro, <a href="#7.12.3.6">7.12.3.6</a>, <a href="#F.3">F.3</a> <inttypes.h>, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a>
24825 signed char type, <a href="#6.2.5">6.2.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <iso646.h>, <a href="#4">4</a>, <a href="#7.9">7.9</a>
24826 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> <limits.h>, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
24827 signed character, <a href="#6.3.1.1">6.3.1.1</a> <locale.h>, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
24828 signed integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a> <math.h>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.22">7.22</a>, <a href="#F">F</a>, <a href="#F.9">F.9</a>,
24829 signed type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#J.5.17">J.5.17</a>
24830 <a href="#6.3.1.8">6.3.1.8</a> <setjmp.h>, <a href="#7.13">7.13</a>
24831 signed types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a> <signal.h>, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a>
24832 significand part, <a href="#6.4.4.2">6.4.4.2</a> <stdarg.h>, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a>
24833 SIGSEGV macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> <stdbool.h>, <a href="#4">4</a>, <a href="#7.16">7.16</a>, <a href="#7.26.7">7.26.7</a>, <a href="#H">H</a>
24834 SIGTERM macro, <a href="#7.14">7.14</a> <stddef.h>, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>,
24835 simple assignment operator (=), <a href="#6.5.16.1">6.5.16.1</a> <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.17">7.17</a>
24836 sin functions, <a href="#7.12.4.6">7.12.4.6</a>, <a href="#F.9.1.6">F.9.1.6</a> <stdint.h>, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.18">7.18</a>,
24837 sin type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#7.26.8">7.26.8</a>
24838 single-byte character, <a href="#3.7.1">3.7.1</a>, <a href="#5.2.1.2">5.2.1.2</a> <stdio.h>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a>
24839 single-byte/wide character conversion functions, <stdlib.h>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a>
24840 <a href="#7.24.6.1">7.24.6.1</a> <string.h>, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a>
24841 single-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> <tgmath.h>, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24842 single-quote escape sequence (\'), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> <time.h>, <a href="#7.23">7.23</a>
24843 sinh functions, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#F.9.2.5">F.9.2.5</a> <wchar.h>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24">7.24</a>, <a href="#7.26.12">7.26.12</a>,
24844 sinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#F">F</a>
24845 SIZE_MAX macro, <a href="#7.18.3">7.18.3</a> <wctype.h>, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a>
24846 size_t type, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#7.17">7.17</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.1">7.19.1</a>, standard input stream, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>
24847 <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20">7.20</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.23.1">7.23.1</a>, standard integer types, <a href="#6.2.5">6.2.5</a>
24848 <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> standard output stream, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>
24849 sizeof operator, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3">6.5.3</a>, <a href="#6.5.3.4">6.5.3.4</a> standard signed integer types, <a href="#6.2.5">6.2.5</a>
24850 snprintf function, <a href="#7.19.6.5">7.19.6.5</a>, <a href="#7.19.6.12">7.19.6.12</a> state-dependent encoding, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#7.20.7">7.20.7</a>
24851 sorting utility functions, <a href="#7.20.5">7.20.5</a> statements, <a href="#6.8">6.8</a>
24852 source character set, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a> break, <a href="#6.8.6.3">6.8.6.3</a>
24853 source file, <a href="#5.1.1.1">5.1.1.1</a> compound, <a href="#6.8.2">6.8.2</a>
24854 name, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8">6.10.8</a> continue, <a href="#6.8.6.2">6.8.6.2</a>
24855 source file inclusion, <a href="#6.10.2">6.10.2</a> do, <a href="#6.8.5.2">6.8.5.2</a>
24856 <!--page 549 indent 0-->
24857 else, <a href="#6.8.4.1">6.8.4.1</a> strictly conforming program, <a href="#4">4</a>
24858 expression, <a href="#6.8.3">6.8.3</a> string, <a href="#7.1.1">7.1.1</a>
24859 for, <a href="#6.8.5.3">6.8.5.3</a> comparison functions, <a href="#7.21.4">7.21.4</a>
24860 goto, <a href="#6.8.6.1">6.8.6.1</a> concatenation functions, <a href="#7.21.3">7.21.3</a>
24861 if, <a href="#6.8.4.1">6.8.4.1</a> conversion functions, <a href="#7.11.1.1">7.11.1.1</a>
24862 iteration, <a href="#6.8.5">6.8.5</a> copying functions, <a href="#7.21.2">7.21.2</a>
24863 jump, <a href="#6.8.6">6.8.6</a> library function conventions, <a href="#7.21.1">7.21.1</a>
24864 labeled, <a href="#6.8.1">6.8.1</a> literal, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.7.8">6.7.8</a>
24865 null, <a href="#6.8.3">6.8.3</a> miscellaneous functions, <a href="#7.21.6">7.21.6</a>
24866 return, <a href="#6.8.6.4">6.8.6.4</a> numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1">7.20.1</a>
24867 selection, <a href="#6.8.4">6.8.4</a> search functions, <a href="#7.21.5">7.21.5</a>
24868 sequencing, <a href="#6.8">6.8</a> string handling header, <a href="#7.21">7.21</a>
24869 switch, <a href="#6.8.4.2">6.8.4.2</a> string.h header, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a>
24870 while, <a href="#6.8.5.1">6.8.5.1</a> stringizing, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.9">6.10.9</a>
24871 static storage duration, <a href="#6.2.4">6.2.4</a> strlen function, <a href="#7.21.6.3">7.21.6.3</a>
24872 static storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.2.4">6.2.4</a>, <a href="#6.7.1">6.7.1</a> strncat function, <a href="#7.21.3.2">7.21.3.2</a>
24873 static, in array declarators, <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.7.5.3">6.7.5.3</a> strncmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.4">7.21.4.4</a>
24874 stdarg.h header, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a> strncpy function, <a href="#7.21.2.4">7.21.2.4</a>
24875 stdbool.h header, <a href="#4">4</a>, <a href="#7.16">7.16</a>, <a href="#7.26.7">7.26.7</a>, <a href="#H">H</a> strpbrk function, <a href="#7.21.5.4">7.21.5.4</a>
24876 STDC, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a> strrchr function, <a href="#7.21.5.5">7.21.5.5</a>
24877 stddef.h header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>, strspn function, <a href="#7.21.5.6">7.21.5.6</a>
24878 <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.17">7.17</a> strstr function, <a href="#7.21.5.7">7.21.5.7</a>
24879 stderr macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a> strtod function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.3">7.20.1.3</a>,
24880 stdin macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.4">7.19.6.4</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.3">F.3</a>
24881 <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.24.2.12">7.24.2.12</a>, <a href="#7.24.3.7">7.24.3.7</a> strtof function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#F.3">F.3</a>
24882 stdint.h header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.18">7.18</a>, strtoimax function, <a href="#7.8.2.3">7.8.2.3</a>
24883 <a href="#7.26.8">7.26.8</a> strtok function, <a href="#7.21.5.8">7.21.5.8</a>
24884 stdio.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a> strtol function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.2">7.20.1.2</a>,
24885 stdlib.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a> <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.2">7.24.2.2</a>
24886 stdout macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.3">7.19.6.3</a>, strtold function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#F.3">F.3</a>
24887 <a href="#7.19.7.9">7.19.7.9</a>, <a href="#7.19.7.10">7.19.7.10</a>, <a href="#7.24.2.11">7.24.2.11</a>, <a href="#7.24.3.9">7.24.3.9</a> strtoll function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1.2">7.20.1.2</a>, <a href="#7.20.1.4">7.20.1.4</a>
24888 storage duration, <a href="#6.2.4">6.2.4</a> strtoul function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.2">7.20.1.2</a>,
24889 storage order of array, <a href="#6.5.2.1">6.5.2.1</a> <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.2">7.24.2.2</a>
24890 storage-class specifiers, <a href="#6.7.1">6.7.1</a>, <a href="#6.11.5">6.11.5</a> strtoull function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1.2">7.20.1.2</a>, <a href="#7.20.1.4">7.20.1.4</a>
24891 strcat function, <a href="#7.21.3.1">7.21.3.1</a> strtoumax function, <a href="#7.8.2.3">7.8.2.3</a>
24892 strchr function, <a href="#7.21.5.2">7.21.5.2</a> struct hack, see flexible array member
24893 strcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.2">7.21.4.2</a> structure
24894 strcoll function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.21.4.5">7.21.4.5</a> arrow operator (->), <a href="#6.5.2.3">6.5.2.3</a>
24895 strcpy function, <a href="#7.21.2.3">7.21.2.3</a> content, <a href="#6.7.2.3">6.7.2.3</a>
24896 strcspn function, <a href="#7.21.5.3">7.21.5.3</a> dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>
24897 streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.20.4.3">7.20.4.3</a> initialization, <a href="#6.7.8">6.7.8</a>
24898 fully buffered, <a href="#7.19.3">7.19.3</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
24899 line buffered, <a href="#7.19.3">7.19.3</a> member name space, <a href="#6.2.3">6.2.3</a>
24900 orientation, <a href="#7.19.2">7.19.2</a> member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a>
24901 standard error, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> pointer operator (->), <a href="#6.5.2.3">6.5.2.3</a>
24902 standard input, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> specifier, <a href="#6.7.2.1">6.7.2.1</a>
24903 standard output, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
24904 unbuffered, <a href="#7.19.3">7.19.3</a> type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a>
24905 strerror function, <a href="#7.19.10.4">7.19.10.4</a>, <a href="#7.21.6.2">7.21.6.2</a> strxfrm function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.4.5">7.21.4.5</a>
24906 strftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.3">7.23.3</a>, <a href="#7.23.3.5">7.23.3.5</a>, subscripting, <a href="#6.5.2.1">6.5.2.1</a>
24907 <a href="#7.24.5.1">7.24.5.1</a> subtraction assignment operator (-=), <a href="#6.5.16.2">6.5.16.2</a>
24908 <!--page 550 indent 0-->
24909 subtraction operator (-), <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a> tolower function, <a href="#7.4.2.1">7.4.2.1</a>
24910 suffix toupper function, <a href="#7.4.2.2">7.4.2.2</a>
24911 floating constant, <a href="#6.4.4.2">6.4.4.2</a> towctrans function, <a href="#7.25.3.2.1">7.25.3.2.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
24912 integer constant, <a href="#6.4.4.1">6.4.4.1</a> towlower function, <a href="#7.25.3.1.1">7.25.3.1.1</a>, <a href="#7.25.3.2.1">7.25.3.2.1</a>
24913 switch body, <a href="#6.8.4.2">6.8.4.2</a> towupper function, <a href="#7.25.3.1.2">7.25.3.1.2</a>, <a href="#7.25.3.2.1">7.25.3.2.1</a>
24914 switch case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> translation environment, <a href="#5">5</a>, <a href="#5.1.1">5.1.1</a>
24915 switch default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> translation limits, <a href="#5.2.4.1">5.2.4.1</a>
24916 switch statement, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> translation phases, <a href="#5.1.1.2">5.1.1.2</a>
24917 swprintf function, <a href="#7.24.2.3">7.24.2.3</a>, <a href="#7.24.2.7">7.24.2.7</a> translation unit, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.9">6.9</a>
24918 swscanf function, <a href="#7.24.2.4">7.24.2.4</a>, <a href="#7.24.2.8">7.24.2.8</a> trap representation, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.3.2.3">6.3.2.3</a>,
24919 symbols, <a href="#3">3</a> <a href="#6.5.2.3">6.5.2.3</a>
24920 syntactic categories, <a href="#6.1">6.1</a> trigonometric functions
24921 syntax notation, <a href="#6.1">6.1</a> complex, <a href="#7.3.5">7.3.5</a>, <a href="#G.6.1">G.6.1</a>
24922 syntax rule precedence, <a href="#5.1.1.2">5.1.1.2</a> real, <a href="#7.12.4">7.12.4</a>, <a href="#F.9.1">F.9.1</a>
24923 syntax summary, language, <a href="#A">A</a> trigraph sequences, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1.1">5.2.1.1</a>
24924 system function, <a href="#7.20.4.6">7.20.4.6</a> true macro, <a href="#7.16">7.16</a>
24925 trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.9.6.8">F.9.6.8</a>
24926 tab characters, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> trunc type-generic macro, <a href="#7.22">7.22</a>
24927 tag compatibility, <a href="#6.2.7">6.2.7</a> truncation, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.3">7.19.5.3</a>
24928 tag name space, <a href="#6.2.3">6.2.3</a> truncation toward zero, <a href="#6.5.5">6.5.5</a>
24929 tags, <a href="#6.7.2.3">6.7.2.3</a> two's complement, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.18.1.1">7.18.1.1</a>
24930 tan functions, <a href="#7.12.4.7">7.12.4.7</a>, <a href="#F.9.1.7">F.9.1.7</a> type category, <a href="#6.2.5">6.2.5</a>
24931 tan type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> type conversion, <a href="#6.3">6.3</a>
24932 tanh functions, <a href="#7.12.5.6">7.12.5.6</a>, <a href="#F.9.2.6">F.9.2.6</a> type definitions, <a href="#6.7.7">6.7.7</a>
24933 tanh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> type domain, <a href="#6.2.5">6.2.5</a>, <a href="#G.2">G.2</a>
24934 tentative definition, <a href="#6.9.2">6.9.2</a> type names, <a href="#6.7.6">6.7.6</a>
24935 terms, <a href="#3">3</a> type punning, <a href="#6.5.2.3">6.5.2.3</a>
24936 text streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.9.4">7.19.9.4</a> type qualifiers, <a href="#6.7.3">6.7.3</a>
24937 tgamma functions, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#F.9.5.4">F.9.5.4</a> type specifiers, <a href="#6.7.2">6.7.2</a>
24938 tgamma type-generic macro, <a href="#7.22">7.22</a> type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
24939 tgmath.h header, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> typedef declaration, <a href="#6.7.7">6.7.7</a>
24940 time typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.7">6.7.7</a>
24941 broken down, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.3">7.23.3</a>, <a href="#7.23.3.1">7.23.3.1</a>, types, <a href="#6.2.5">6.2.5</a>
24942 <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a>, <a href="#7.23.3.5">7.23.3.5</a> character, <a href="#6.7.8">6.7.8</a>
24943 calendar, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.2">7.23.2.2</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.2.4">7.23.2.4</a>, compatible, <a href="#6.2.7">6.2.7</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.5">6.7.5</a>
24944 <a href="#7.23.3.2">7.23.3.2</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a> complex, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a>
24945 components, <a href="#7.23.1">7.23.1</a> composite, <a href="#6.2.7">6.2.7</a>
24946 conversion functions, <a href="#7.23.3">7.23.3</a> const qualified, <a href="#6.7.3">6.7.3</a>
24947 wide character, <a href="#7.24.5">7.24.5</a> conversions, <a href="#6.3">6.3</a>
24948 local, <a href="#7.23.1">7.23.1</a> imaginary, <a href="#G">G</a>
24949 manipulation functions, <a href="#7.23.2">7.23.2</a> restrict qualified, <a href="#6.7.3">6.7.3</a>
24950 time function, <a href="#7.23.2.4">7.23.2.4</a> volatile qualified, <a href="#6.7.3">6.7.3</a>
24951 time.h header, <a href="#7.23">7.23</a>
24952 time_t type, <a href="#7.23.1">7.23.1</a> UCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24953 tm structure type, <a href="#7.23.1">7.23.1</a>, <a href="#7.24.1">7.24.1</a> UINT_FASTN_MAX macros, <a href="#7.18.2.3">7.18.2.3</a>
24954 TMP_MAX macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.3">7.19.4.3</a>, <a href="#7.19.4.4">7.19.4.4</a> uint_fastN_t types, <a href="#7.18.1.3">7.18.1.3</a>
24955 tmpfile function, <a href="#7.19.4.3">7.19.4.3</a>, <a href="#7.20.4.3">7.20.4.3</a> UINT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
24956 tmpnam function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.3">7.19.4.3</a>, <a href="#7.19.4.4">7.19.4.4</a> uint_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
24957 token, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, see also preprocessing tokens UINT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24958 token concatenation, <a href="#6.10.3.3">6.10.3.3</a> UINTMAX_C macro, <a href="#7.18.4.2">7.18.4.2</a>
24959 token pasting, <a href="#6.10.3.3">6.10.3.3</a> UINTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a>
24960 <!--page 551 indent 0-->
24961 uintmax_t type, <a href="#7.18.1.5">7.18.1.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, USHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
24962 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> usual arithmetic conversions, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.5.5">6.5.5</a>, <a href="#6.5.6">6.5.6</a>,
24963 UINTN_C macros, <a href="#7.18.4.1">7.18.4.1</a> <a href="#6.5.8">6.5.8</a>, <a href="#6.5.9">6.5.9</a>, <a href="#6.5.10">6.5.10</a>, <a href="#6.5.11">6.5.11</a>, <a href="#6.5.12">6.5.12</a>, <a href="#6.5.15">6.5.15</a>
24964 UINTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> utilities, general, <a href="#7.20">7.20</a>
24965 uintN_t types, <a href="#7.18.1.1">7.18.1.1</a> wide string, <a href="#7.24.4">7.24.4</a>
24966 UINTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a>
24967 uintptr_t type, <a href="#7.18.1.4">7.18.1.4</a> va_arg macro, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.1">7.15.1.1</a>, <a href="#7.15.1.2">7.15.1.2</a>,
24968 ULLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.15.1.4">7.15.1.4</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>,
24969 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>,
24970 ULONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>,
24971 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>
24972 unary arithmetic operators, <a href="#6.5.3.3">6.5.3.3</a> va_copy macro, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.1">7.15.1.1</a>, <a href="#7.15.1.2">7.15.1.2</a>,
24973 unary expression, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.3">7.15.1.3</a>
24974 unary minus operator (-), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a> va_end macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.3">7.15.1.3</a>,
24975 unary operators, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.4">7.15.1.4</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>,
24976 unary plus operator (+), <a href="#6.5.3.3">6.5.3.3</a> <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>,
24977 unbuffered stream, <a href="#7.19.3">7.19.3</a> <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>,
24978 undef preprocessing directive, <a href="#6.10.3.5">6.10.3.5</a>, <a href="#7.1.3">7.1.3</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>
24979 <a href="#7.1.4">7.1.4</a> va_list type, <a href="#7.15">7.15</a>, <a href="#7.15.1.3">7.15.1.3</a>
24980 undefined behavior, <a href="#3.4.3">3.4.3</a>, <a href="#4">4</a>, <a href="#J.2">J.2</a> va_start macro, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.1">7.15.1.1</a>,
24981 underscore character, <a href="#6.4.2.1">6.4.2.1</a> <a href="#7.15.1.2">7.15.1.2</a>, <a href="#7.15.1.3">7.15.1.3</a>, <a href="#7.15.1.4">7.15.1.4</a>, <a href="#7.19.6.8">7.19.6.8</a>,
24982 underscore, leading, in identifier, <a href="#7.1.3">7.1.3</a> <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>, <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>,
24983 ungetc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>, <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>,
24984 <a href="#7.19.9.3">7.19.9.3</a> <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>
24985 ungetwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.10">7.24.3.10</a> value, <a href="#3.17">3.17</a>
24986 Unicode required set, <a href="#6.10.8">6.10.8</a> value bits, <a href="#6.2.6.2">6.2.6.2</a>
24987 union variable arguments, <a href="#6.10.3">6.10.3</a>, <a href="#7.15">7.15</a>
24988 arrow operator (->), <a href="#6.5.2.3">6.5.2.3</a> variable arguments header, <a href="#7.15">7.15</a>
24989 content, <a href="#6.7.2.3">6.7.2.3</a> variable length array, <a href="#6.7.5">6.7.5</a>, <a href="#6.7.5.2">6.7.5.2</a>
24990 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> variably modified type, <a href="#6.7.5">6.7.5</a>, <a href="#6.7.5.2">6.7.5.2</a>
24991 initialization, <a href="#6.7.8">6.7.8</a> vertical-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
24992 member alignment, <a href="#6.7.2.1">6.7.2.1</a> vertical-tab escape sequence (\v), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>,
24993 member name space, <a href="#6.2.3">6.2.3</a> <a href="#7.4.1.10">7.4.1.10</a>
24994 member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a> vfprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>
24995 pointer operator (->), <a href="#6.5.2.3">6.5.2.3</a> vfscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>
24996 specifier, <a href="#6.7.2.1">6.7.2.1</a> vfwprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.5">7.24.2.5</a>
24997 tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a> vfwscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.3.10">7.24.3.10</a>
24998 type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a> visibility of identifier, <a href="#6.2.1">6.2.1</a>
24999 universal character name, <a href="#6.4.3">6.4.3</a> VLA, see variable length array
25000 unqualified type, <a href="#6.2.5">6.2.5</a> void expression, <a href="#6.3.2.2">6.3.2.2</a>
25001 unqualified version of type, <a href="#6.2.5">6.2.5</a> void function parameter, <a href="#6.7.5.3">6.7.5.3</a>
25002 unsigned integer suffix, u or <a href="#U">U</a>, <a href="#6.4.4.1">6.4.4.1</a> void type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.2">6.3.2.2</a>, <a href="#6.7.2">6.7.2</a>
25003 unsigned integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a> void type conversion, <a href="#6.3.2.2">6.3.2.2</a>
25004 unsigned type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, volatile storage, <a href="#5.1.2.3">5.1.2.3</a>
25005 <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a> volatile type qualifier, <a href="#6.7.3">6.7.3</a>
25006 unsigned types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, volatile-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a>
25007 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> vprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.10">7.19.6.10</a>
25008 unspecified behavior, <a href="#3.4.4">3.4.4</a>, <a href="#4">4</a>, <a href="#J.1">J.1</a> vscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.11">7.19.6.11</a>
25009 unspecified value, <a href="#3.17.3">3.17.3</a> vsnprintf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.12">7.19.6.12</a>
25010 uppercase letter, <a href="#5.2.1">5.2.1</a> vsprintf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.13">7.19.6.13</a>
25011 use of library functions, <a href="#7.1.4">7.1.4</a> vsscanf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.14">7.19.6.14</a>
25012 <!--page 552 indent 0-->
25013 vswprintf function, <a href="#7.24.2.7">7.24.2.7</a> wctype.h header, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a>
25014 vswscanf function, <a href="#7.24.2.8">7.24.2.8</a> wctype_t type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
25015 vwprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.9">7.24.2.9</a> WEOF macro, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a>, <a href="#7.24.3.6">7.24.3.6</a>,
25016 vwscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.10">7.24.2.10</a>, <a href="#7.24.3.10">7.24.3.10</a> <a href="#7.24.3.7">7.24.3.7</a>, <a href="#7.24.3.8">7.24.3.8</a>, <a href="#7.24.3.9">7.24.3.9</a>, <a href="#7.24.3.10">7.24.3.10</a>,
25017 <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.25.1">7.25.1</a>
25018 warnings, <a href="#I">I</a> while statement, <a href="#6.8.5.1">6.8.5.1</a>
25019 wchar.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24">7.24</a>, <a href="#7.26.12">7.26.12</a>, white space, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#7.4.1.10">7.4.1.10</a>,
25020 <a href="#F">F</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>
25021 WCHAR_MAX macro, <a href="#7.18.3">7.18.3</a>, <a href="#7.24.1">7.24.1</a> white-space characters, <a href="#6.4">6.4</a>
25022 WCHAR_MIN macro, <a href="#7.18.3">7.18.3</a>, <a href="#7.24.1">7.24.1</a> wide character, <a href="#3.7.3">3.7.3</a>
25023 wchar_t type, <a href="#3.7.3">3.7.3</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.7.8">6.7.8</a>, case mapping functions, <a href="#7.25.3.1">7.25.3.1</a>
25024 <a href="#6.10.8">6.10.8</a>, <a href="#7.17">7.17</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20">7.20</a>, extensible, <a href="#7.25.3.2">7.25.3.2</a>
25025 <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> classification functions, <a href="#7.25.2.1">7.25.2.1</a>
25026 wcrtomb function, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>, extensible, <a href="#7.25.2.2">7.25.2.2</a>
25027 <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> constant, <a href="#6.4.4.4">6.4.4.4</a>
25028 wcscat function, <a href="#7.24.4.3.1">7.24.4.3.1</a> formatted input/output functions, <a href="#7.24.2">7.24.2</a>
25029 wcschr function, <a href="#7.24.4.5.1">7.24.4.5.1</a> input functions, <a href="#7.19.1">7.19.1</a>
25030 wcscmp function, <a href="#7.24.4.4.1">7.24.4.4.1</a>, <a href="#7.24.4.4.4">7.24.4.4.4</a> input/output functions, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3">7.24.3</a>
25031 wcscoll function, <a href="#7.24.4.4.2">7.24.4.4.2</a>, <a href="#7.24.4.4.4">7.24.4.4.4</a> output functions, <a href="#7.19.1">7.19.1</a>
25032 wcscpy function, <a href="#7.24.4.2.1">7.24.4.2.1</a> single-byte conversion functions, <a href="#7.24.6.1">7.24.6.1</a>
25033 wcscspn function, <a href="#7.24.4.5.2">7.24.4.5.2</a> wide string, <a href="#7.1.1">7.1.1</a>
25034 wcsftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.5.1">7.24.5.1</a> wide string comparison functions, <a href="#7.24.4.4">7.24.4.4</a>
25035 wcslen function, <a href="#7.24.4.6.1">7.24.4.6.1</a> wide string concatenation functions, <a href="#7.24.4.3">7.24.4.3</a>
25036 wcsncat function, <a href="#7.24.4.3.2">7.24.4.3.2</a> wide string copying functions, <a href="#7.24.4.2">7.24.4.2</a>
25037 wcsncmp function, <a href="#7.24.4.4.3">7.24.4.4.3</a> wide string literal, see string literal
25038 wcsncpy function, <a href="#7.24.4.2.2">7.24.4.2.2</a> wide string miscellaneous functions, <a href="#7.24.4.6">7.24.4.6</a>
25039 wcspbrk function, <a href="#7.24.4.5.3">7.24.4.5.3</a> wide string numeric conversion functions, <a href="#7.8.2.4">7.8.2.4</a>,
25040 wcsrchr function, <a href="#7.24.4.5.4">7.24.4.5.4</a> <a href="#7.24.4.1">7.24.4.1</a>
25041 wcsrtombs function, <a href="#7.24.6.4.2">7.24.6.4.2</a> wide string search functions, <a href="#7.24.4.5">7.24.4.5</a>
25042 wcsspn function, <a href="#7.24.4.5.5">7.24.4.5.5</a> wide-oriented stream, <a href="#7.19.2">7.19.2</a>
25043 wcsstr function, <a href="#7.24.4.5.6">7.24.4.5.6</a> width, <a href="#6.2.6.2">6.2.6.2</a>
25044 wcstod function, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a> WINT_MAX macro, <a href="#7.18.3">7.18.3</a>
25045 wcstod function, <a href="#7.24.4.1.1">7.24.4.1.1</a> WINT_MIN macro, <a href="#7.18.3">7.18.3</a>
25046 wcstof function, <a href="#7.24.4.1.1">7.24.4.1.1</a> wint_t type, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>,
25047 wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a> <a href="#7.25.1">7.25.1</a>
25048 wcstok function, <a href="#7.24.4.5.7">7.24.4.5.7</a> wmemchr function, <a href="#7.24.4.5.8">7.24.4.5.8</a>
25049 wcstol function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>, wmemcmp function, <a href="#7.24.4.4.5">7.24.4.4.5</a>
25050 <a href="#7.24.4.1.2">7.24.4.1.2</a> wmemcpy function, <a href="#7.24.4.2.3">7.24.4.2.3</a>
25051 wcstold function, <a href="#7.24.4.1.1">7.24.4.1.1</a> wmemmove function, <a href="#7.24.4.2.4">7.24.4.2.4</a>
25052 wcstoll function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a> wmemset function, <a href="#7.24.4.6.2">7.24.4.6.2</a>
25053 wcstombs function, <a href="#7.20.8.2">7.20.8.2</a>, <a href="#7.24.6.4">7.24.6.4</a> wprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.11">7.24.2.11</a>
25054 wcstoul function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>, wscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.10">7.24.2.10</a>, <a href="#7.24.2.12">7.24.2.12</a>,
25055 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.3.10">7.24.3.10</a>
25056 wcstoull function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>
25057 wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a> xor macro, <a href="#7.9">7.9</a>
25058 wcsxfrm function, <a href="#7.24.4.4.4">7.24.4.4.4</a> xor_eq macro, <a href="#7.9">7.9</a>
25059 wctob function, <a href="#7.24.6.1.2">7.24.6.1.2</a>, <a href="#7.25.2.1">7.25.2.1</a>
25060 wctomb function, <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.20.8.2">7.20.8.2</a>, <a href="#7.24.6.3">7.24.6.3</a>
25061 wctrans function, <a href="#7.25.3.2.1">7.25.3.2.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
25062 wctrans_t type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
25063 wctype function, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>