fix <pre> placement in n1256
[c-standard.git] / n1256.html
blobc8996bb1a22c2a0f69d67e06502e4cdf65746051
1 <html><head><title>WG14/N1256 Septermber 7, 2007 ISO/IEC 9899:TC3</title></head><body>
2 <pre>
3 <!--page 1 -->
4 WG14/N1256 Committee Draft -- Septermber 7, 2007 ISO/IEC 9899:TC3
7 </pre>
9 <h2><a name="Contents" href="#Contents">Contents</a></h2>
10 <ul>
11 <li><a href="#Foreword">Foreword</a>
12 <li><a href="#Introduction">Introduction</a>
13 <li><a href="#1">1. Scope</a>
14 <li><a href="#2">2. Normative references</a>
15 <li><a href="#3">3. Terms, definitions, and symbols</a>
16 <li><a href="#4">4. Conformance</a>
17 <li><a href="#5">5. Environment</a>
18 <ul>
19 <li><a href="#5.1"> 5.1 Conceptual models</a>
20 <ul>
21 <li><a href="#5.1.1"> 5.1.1 Translation environment</a>
22 <li><a href="#5.1.2"> 5.1.2 Execution environments</a>
23 </ul>
24 <li><a href="#5.2"> 5.2 Environmental considerations</a>
25 <ul>
26 <li><a href="#5.2.1"> 5.2.1 Character sets</a>
27 <li><a href="#5.2.2"> 5.2.2 Character display semantics</a>
28 <li><a href="#5.2.3"> 5.2.3 Signals and interrupts</a>
29 <li><a href="#5.2.4"> 5.2.4 Environmental limits</a>
30 </ul>
31 </ul>
32 <li><a href="#6">6. Language</a>
33 <ul>
34 <li><a href="#6.1"> 6.1 Notation</a>
35 <li><a href="#6.2"> 6.2 Concepts</a>
36 <ul>
37 <li><a href="#6.2.1"> 6.2.1 Scopes of identifiers</a>
38 <li><a href="#6.2.2"> 6.2.2 Linkages of identifiers</a>
39 <li><a href="#6.2.3"> 6.2.3 Name spaces of identifiers</a>
40 <li><a href="#6.2.4"> 6.2.4 Storage durations of objects</a>
41 <li><a href="#6.2.5"> 6.2.5 Types</a>
42 <li><a href="#6.2.6"> 6.2.6 Representations of types</a>
43 <li><a href="#6.2.7"> 6.2.7 Compatible type and composite type</a>
44 </ul>
45 <li><a href="#6.3"> 6.3 Conversions</a>
46 <ul>
47 <li><a href="#6.3.1"> 6.3.1 Arithmetic operands</a>
48 <li><a href="#6.3.2"> 6.3.2 Other operands</a>
49 </ul>
50 <li><a href="#6.4"> 6.4 Lexical elements</a>
51 <ul>
52 <li><a href="#6.4.1"> 6.4.1 Keywords</a>
53 <li><a href="#6.4.2"> 6.4.2 Identifiers</a>
54 <li><a href="#6.4.3"> 6.4.3 Universal character names</a>
55 <li><a href="#6.4.4"> 6.4.4 Constants</a>
56 <li><a href="#6.4.5"> 6.4.5 String literals</a>
57 <li><a href="#6.4.6"> 6.4.6 Punctuators</a>
58 <li><a href="#6.4.7"> 6.4.7 Header names</a>
59 <li><a href="#6.4.8"> 6.4.8 Preprocessing numbers</a>
60 <li><a href="#6.4.9"> 6.4.9 Comments</a>
61 </ul>
62 <li><a href="#6.5"> 6.5 Expressions</a>
63 <!--page 2 -->
64 <ul>
65 <li><a href="#6.5.1"> 6.5.1 Primary expressions</a>
66 <li><a href="#6.5.2"> 6.5.2 Postfix operators</a>
67 <li><a href="#6.5.3"> 6.5.3 Unary operators</a>
68 <li><a href="#6.5.4"> 6.5.4 Cast operators</a>
69 <li><a href="#6.5.5"> 6.5.5 Multiplicative operators</a>
70 <li><a href="#6.5.6"> 6.5.6 Additive operators</a>
71 <li><a href="#6.5.7"> 6.5.7 Bitwise shift operators</a>
72 <li><a href="#6.5.8"> 6.5.8 Relational operators</a>
73 <li><a href="#6.5.9"> 6.5.9 Equality operators</a>
74 <li><a href="#6.5.10"> 6.5.10 Bitwise AND operator</a>
75 <li><a href="#6.5.11"> 6.5.11 Bitwise exclusive OR operator</a>
76 <li><a href="#6.5.12"> 6.5.12 Bitwise inclusive OR operator</a>
77 <li><a href="#6.5.13"> 6.5.13 Logical AND operator</a>
78 <li><a href="#6.5.14"> 6.5.14 Logical OR operator</a>
79 <li><a href="#6.5.15"> 6.5.15 Conditional operator</a>
80 <li><a href="#6.5.16"> 6.5.16 Assignment operators</a>
81 <li><a href="#6.5.17"> 6.5.17 Comma operator</a>
82 </ul>
83 <li><a href="#6.6"> 6.6 Constant expressions</a>
84 <li><a href="#6.7"> 6.7 Declarations</a>
85 <ul>
86 <li><a href="#6.7.1"> 6.7.1 Storage-class specifiers</a>
87 <li><a href="#6.7.2"> 6.7.2 Type specifiers</a>
88 <li><a href="#6.7.3"> 6.7.3 Type qualifiers</a>
89 <li><a href="#6.7.4"> 6.7.4 Function specifiers</a>
90 <li><a href="#6.7.5"> 6.7.5 Declarators</a>
91 <li><a href="#6.7.6"> 6.7.6 Type names</a>
92 <li><a href="#6.7.7"> 6.7.7 Type definitions</a>
93 <li><a href="#6.7.8"> 6.7.8 Initialization</a>
94 </ul>
95 <li><a href="#6.8"> 6.8 Statements and blocks</a>
96 <ul>
97 <li><a href="#6.8.1"> 6.8.1 Labeled statements</a>
98 <li><a href="#6.8.2"> 6.8.2 Compound statement</a>
99 <li><a href="#6.8.3"> 6.8.3 Expression and null statements</a>
100 <li><a href="#6.8.4"> 6.8.4 Selection statements</a>
101 <li><a href="#6.8.5"> 6.8.5 Iteration statements</a>
102 <li><a href="#6.8.6"> 6.8.6 Jump statements</a>
103 </ul>
104 <li><a href="#6.9"> 6.9 External definitions</a>
105 <ul>
106 <li><a href="#6.9.1"> 6.9.1 Function definitions</a>
107 <li><a href="#6.9.2"> 6.9.2 External object definitions</a>
108 </ul>
109 <li><a href="#6.10"> 6.10 Preprocessing directives</a>
110 <ul>
111 <li><a href="#6.10.1"> 6.10.1 Conditional inclusion</a>
112 <li><a href="#6.10.2"> 6.10.2 Source file inclusion</a>
113 <li><a href="#6.10.3"> 6.10.3 Macro replacement</a>
114 <li><a href="#6.10.4"> 6.10.4 Line control</a>
115 <li><a href="#6.10.5"> 6.10.5 Error directive</a>
116 <li><a href="#6.10.6"> 6.10.6 Pragma directive</a>
117 <!--page 3 -->
118 <li><a href="#6.10.7"> 6.10.7 Null directive</a>
119 <li><a href="#6.10.8"> 6.10.8 Predefined macro names</a>
120 <li><a href="#6.10.9"> 6.10.9 Pragma operator</a>
121 </ul>
122 <li><a href="#6.11"> 6.11 Future language directions</a>
123 <ul>
124 <li><a href="#6.11.1"> 6.11.1 Floating types</a>
125 <li><a href="#6.11.2"> 6.11.2 Linkages of identifiers</a>
126 <li><a href="#6.11.3"> 6.11.3 External names</a>
127 <li><a href="#6.11.4"> 6.11.4 Character escape sequences</a>
128 <li><a href="#6.11.5"> 6.11.5 Storage-class specifiers</a>
129 <li><a href="#6.11.6"> 6.11.6 Function declarators</a>
130 <li><a href="#6.11.7"> 6.11.7 Function definitions</a>
131 <li><a href="#6.11.8"> 6.11.8 Pragma directives</a>
132 <li><a href="#6.11.9"> 6.11.9 Predefined macro names</a>
133 </ul>
134 </ul>
135 <li><a href="#7">7. Library</a>
136 <ul>
137 <li><a href="#7.1"> 7.1 Introduction</a>
138 <ul>
139 <li><a href="#7.1.1"> 7.1.1 Definitions of terms</a>
140 <li><a href="#7.1.2"> 7.1.2 Standard headers</a>
141 <li><a href="#7.1.3"> 7.1.3 Reserved identifiers</a>
142 <li><a href="#7.1.4"> 7.1.4 Use of library functions</a>
143 </ul>
144 <li><a href="#7.2"> 7.2 Diagnostics &lt;assert.h&gt;</a>
145 <ul>
146 <li><a href="#7.2.1"> 7.2.1 Program diagnostics</a>
147 </ul>
148 <li><a href="#7.3"> 7.3 Complex arithmetic &lt;complex.h&gt;</a>
149 <ul>
150 <li><a href="#7.3.1"> 7.3.1 Introduction</a>
151 <li><a href="#7.3.2"> 7.3.2 Conventions</a>
152 <li><a href="#7.3.3"> 7.3.3 Branch cuts</a>
153 <li><a href="#7.3.4"> 7.3.4 The CX_LIMITED_RANGE pragma</a>
154 <li><a href="#7.3.5"> 7.3.5 Trigonometric functions</a>
155 <li><a href="#7.3.6"> 7.3.6 Hyperbolic functions</a>
156 <li><a href="#7.3.7"> 7.3.7 Exponential and logarithmic functions</a>
157 <li><a href="#7.3.8"> 7.3.8 Power and absolute-value functions</a>
158 <li><a href="#7.3.9"> 7.3.9 Manipulation functions</a>
159 </ul>
160 <li><a href="#7.4"> 7.4 Character handling &lt;ctype.h&gt;</a>
161 <ul>
162 <li><a href="#7.4.1"> 7.4.1 Character classification functions</a>
163 <li><a href="#7.4.2"> 7.4.2 Character case mapping functions</a>
164 </ul>
165 <li><a href="#7.5"> 7.5 Errors &lt;errno.h&gt;</a>
166 <li><a href="#7.6"> 7.6 Floating-point environment &lt;fenv.h&gt;</a>
167 <ul>
168 <li><a href="#7.6.1"> 7.6.1 The FENV_ACCESS pragma</a>
169 <li><a href="#7.6.2"> 7.6.2 Floating-point exceptions</a>
170 <li><a href="#7.6.3"> 7.6.3 Rounding</a>
171 <li><a href="#7.6.4"> 7.6.4 Environment</a>
172 </ul>
173 <li><a href="#7.7"> 7.7 Characteristics of floating types &lt;float.h&gt;</a>
174 <li><a href="#7.8"> 7.8 Format conversion of integer types &lt;inttypes.h&gt;</a>
175 <ul>
176 <li><a href="#7.8.1"> 7.8.1 Macros for format specifiers</a>
177 <li><a href="#7.8.2"> 7.8.2 Functions for greatest-width integer types</a>
178 <!--page 4 -->
179 </ul>
180 <li><a href="#7.9"> 7.9 Alternative spellings &lt;iso646.h&gt;</a>
181 <li><a href="#7.10"> 7.10 Sizes of integer types &lt;limits.h&gt;</a>
182 <li><a href="#7.11"> 7.11 Localization &lt;locale.h&gt;</a>
183 <ul>
184 <li><a href="#7.11.1"> 7.11.1 Locale control</a>
185 <li><a href="#7.11.2"> 7.11.2 Numeric formatting convention inquiry</a>
186 </ul>
187 <li><a href="#7.12"> 7.12 Mathematics &lt;math.h&gt;</a>
188 <ul>
189 <li><a href="#7.12.1"> 7.12.1 Treatment of error conditions</a>
190 <li><a href="#7.12.2"> 7.12.2 The FP_CONTRACT pragma</a>
191 <li><a href="#7.12.3"> 7.12.3 Classification macros</a>
192 <li><a href="#7.12.4"> 7.12.4 Trigonometric functions</a>
193 <li><a href="#7.12.5"> 7.12.5 Hyperbolic functions</a>
194 <li><a href="#7.12.6"> 7.12.6 Exponential and logarithmic functions</a>
195 <li><a href="#7.12.7"> 7.12.7 Power and absolute-value functions</a>
196 <li><a href="#7.12.8"> 7.12.8 Error and gamma functions</a>
197 <li><a href="#7.12.9"> 7.12.9 Nearest integer functions</a>
198 <li><a href="#7.12.10"> 7.12.10 Remainder functions</a>
199 <li><a href="#7.12.11"> 7.12.11 Manipulation functions</a>
200 <li><a href="#7.12.12"> 7.12.12 Maximum, minimum, and positive difference functions</a>
201 <li><a href="#7.12.13"> 7.12.13 Floating multiply-add</a>
202 <li><a href="#7.12.14"> 7.12.14 Comparison macros</a>
203 </ul>
204 <li><a href="#7.13"> 7.13 Nonlocal jumps &lt;setjmp.h&gt;</a>
205 <ul>
206 <li><a href="#7.13.1"> 7.13.1 Save calling environment</a>
207 <li><a href="#7.13.2"> 7.13.2 Restore calling environment</a>
208 </ul>
209 <li><a href="#7.14"> 7.14 Signal handling &lt;signal.h&gt;</a>
210 <ul>
211 <li><a href="#7.14.1"> 7.14.1 Specify signal handling</a>
212 <li><a href="#7.14.2"> 7.14.2 Send signal</a>
213 </ul>
214 <li><a href="#7.15"> 7.15 Variable arguments &lt;stdarg.h&gt;</a>
215 <ul>
216 <li><a href="#7.15.1"> 7.15.1 Variable argument list access macros</a>
217 </ul>
218 <li><a href="#7.16"> 7.16 Boolean type and values &lt;stdbool.h&gt;</a>
219 <li><a href="#7.17"> 7.17 Common definitions &lt;stddef.h&gt;</a>
220 <li><a href="#7.18"> 7.18 Integer types &lt;stdint.h&gt;</a>
221 <ul>
222 <li><a href="#7.18.1"> 7.18.1 Integer types</a>
223 <li><a href="#7.18.2"> 7.18.2 Limits of specified-width integer types</a>
224 <li><a href="#7.18.3"> 7.18.3 Limits of other integer types</a>
225 <li><a href="#7.18.4"> 7.18.4 Macros for integer constants</a>
226 </ul>
227 <li><a href="#7.19"> 7.19 Input/output &lt;stdio.h&gt;</a>
228 <ul>
229 <li><a href="#7.19.1"> 7.19.1 Introduction</a>
230 <li><a href="#7.19.2"> 7.19.2 Streams</a>
231 <li><a href="#7.19.3"> 7.19.3 Files</a>
232 <li><a href="#7.19.4"> 7.19.4 Operations on files</a>
233 <li><a href="#7.19.5"> 7.19.5 File access functions</a>
234 <li><a href="#7.19.6"> 7.19.6 Formatted input/output functions</a>
235 <li><a href="#7.19.7"> 7.19.7 Character input/output functions</a>
236 <li><a href="#7.19.8"> 7.19.8 Direct input/output functions</a>
237 <!--page 5 -->
238 <li><a href="#7.19.9"> 7.19.9 File positioning functions</a>
239 <li><a href="#7.19.10"> 7.19.10 Error-handling functions</a>
240 </ul>
241 <li><a href="#7.20"> 7.20 General utilities &lt;stdlib.h&gt;</a>
242 <ul>
243 <li><a href="#7.20.1"> 7.20.1 Numeric conversion functions</a>
244 <li><a href="#7.20.2"> 7.20.2 Pseudo-random sequence generation functions</a>
245 <li><a href="#7.20.3"> 7.20.3 Memory management functions</a>
246 <li><a href="#7.20.4"> 7.20.4 Communication with the environment</a>
247 <li><a href="#7.20.5"> 7.20.5 Searching and sorting utilities</a>
248 <li><a href="#7.20.6"> 7.20.6 Integer arithmetic functions</a>
249 <li><a href="#7.20.7"> 7.20.7 Multibyte/wide character conversion functions</a>
250 <li><a href="#7.20.8"> 7.20.8 Multibyte/wide string conversion functions</a>
251 </ul>
252 <li><a href="#7.21"> 7.21 String handling &lt;string.h&gt;</a>
253 <ul>
254 <li><a href="#7.21.1"> 7.21.1 String function conventions</a>
255 <li><a href="#7.21.2"> 7.21.2 Copying functions</a>
256 <li><a href="#7.21.3"> 7.21.3 Concatenation functions</a>
257 <li><a href="#7.21.4"> 7.21.4 Comparison functions</a>
258 <li><a href="#7.21.5"> 7.21.5 Search functions</a>
259 <li><a href="#7.21.6"> 7.21.6 Miscellaneous functions</a>
260 </ul>
261 <li><a href="#7.22"> 7.22 Type-generic math &lt;tgmath.h&gt;</a>
262 <li><a href="#7.23"> 7.23 Date and time &lt;time.h&gt;</a>
263 <ul>
264 <li><a href="#7.23.1"> 7.23.1 Components of time</a>
265 <li><a href="#7.23.2"> 7.23.2 Time manipulation functions</a>
266 <li><a href="#7.23.3"> 7.23.3 Time conversion functions</a>
267 </ul>
268 <li><a href="#7.24"> 7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
269 <ul>
270 <li><a href="#7.24.1"> 7.24.1 Introduction</a>
271 <li><a href="#7.24.2"> 7.24.2 Formatted wide character input/output functions</a>
272 <li><a href="#7.24.3"> 7.24.3 Wide character input/output functions</a>
273 <li><a href="#7.24.4"> 7.24.4 General wide string utilities</a>
274 <li><a href="#7.24.5"> 7.24.5 Wide character time conversion functions</a>
275 <li><a href="#7.24.6"> 7.24.6 Extended multibyte/wide character conversion utilities</a>
276 </ul>
277 <li><a href="#7.25"> 7.25 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
278 <ul>
279 <li><a href="#7.25.1"> 7.25.1 Introduction</a>
280 <li><a href="#7.25.2"> 7.25.2 Wide character classification utilities</a>
281 <li><a href="#7.25.3"> 7.25.3 Wide character case mapping utilities</a>
282 </ul>
283 <li><a href="#7.26"> 7.26 Future library directions</a>
284 <ul>
285 <li><a href="#7.26.1"> 7.26.1 Complex arithmetic &lt;complex.h&gt;</a>
286 <li><a href="#7.26.2"> 7.26.2 Character handling &lt;ctype.h&gt;</a>
287 <li><a href="#7.26.3"> 7.26.3 Errors &lt;errno.h&gt;</a>
288 <li><a href="#7.26.4"> 7.26.4 Format conversion of integer types &lt;inttypes.h&gt;</a>
289 <li><a href="#7.26.5"> 7.26.5 Localization &lt;locale.h&gt;</a>
290 <li><a href="#7.26.6"> 7.26.6 Signal handling &lt;signal.h&gt;</a>
291 <li><a href="#7.26.7"> 7.26.7 Boolean type and values &lt;stdbool.h&gt;</a>
292 <li><a href="#7.26.8"> 7.26.8 Integer types &lt;stdint.h&gt;</a>
293 <li><a href="#7.26.9"> 7.26.9 Input/output &lt;stdio.h&gt;</a>
294 <!--page 6 -->
295 <li><a href="#7.26.10"> 7.26.10 General utilities &lt;stdlib.h&gt;</a>
296 <li><a href="#7.26.11"> 7.26.11 String handling &lt;string.h&gt;</a>
297 <li><a href="#7.26.12"> 7.26.12 Extended multibyte and wide character utilities <wchar.h></a>
298 <li><a href="#7.26.13"> 7.26.13 Wide character classification and mapping utilities <wctype.h></a>
299 </ul>
300 </ul>
301 <li><a href="#A">Annex A (informative) Language syntax summary</a>
302 <ul>
303 <li><a href="#A.1"> A.1 Lexical grammar</a>
304 <li><a href="#A.2"> A.2 Phrase structure grammar</a>
305 <li><a href="#A.3"> A.3 Preprocessing directives</a>
306 </ul>
307 <li><a href="#B">Annex B (informative) Library summary</a>
308 <ul>
309 <li><a href="#B.1"> B.1 Diagnostics &lt;assert.h&gt;</a>
310 <li><a href="#B.2"> B.2 Complex &lt;complex.h&gt;</a>
311 <li><a href="#B.3"> B.3 Character handling &lt;ctype.h&gt;</a>
312 <li><a href="#B.4"> B.4 Errors &lt;errno.h&gt;</a>
313 <li><a href="#B.5"> B.5 Floating-point environment &lt;fenv.h&gt;</a>
314 <li><a href="#B.6"> B.6 Characteristics of floating types &lt;float.h&gt;</a>
315 <li><a href="#B.7"> B.7 Format conversion of integer types &lt;inttypes.h&gt;</a>
316 <li><a href="#B.8"> B.8 Alternative spellings &lt;iso646.h&gt;</a>
317 <li><a href="#B.9"> B.9 Sizes of integer types &lt;limits.h&gt;</a>
318 <li><a href="#B.10"> B.10 Localization &lt;locale.h&gt;</a>
319 <li><a href="#B.11"> B.11 Mathematics &lt;math.h&gt;</a>
320 <li><a href="#B.12"> B.12 Nonlocal jumps &lt;setjmp.h&gt;</a>
321 <li><a href="#B.13"> B.13 Signal handling &lt;signal.h&gt;</a>
322 <li><a href="#B.14"> B.14 Variable arguments &lt;stdarg.h&gt;</a>
323 <li><a href="#B.15"> B.15 Boolean type and values &lt;stdbool.h&gt;</a>
324 <li><a href="#B.16"> B.16 Common definitions &lt;stddef.h&gt;</a>
325 <li><a href="#B.17"> B.17 Integer types &lt;stdint.h&gt;</a>
326 <li><a href="#B.18"> B.18 Input/output &lt;stdio.h&gt;</a>
327 <li><a href="#B.19"> B.19 General utilities &lt;stdlib.h&gt;</a>
328 <li><a href="#B.20"> B.20 String handling &lt;string.h&gt;</a>
329 <li><a href="#B.21"> B.21 Type-generic math &lt;tgmath.h&gt;</a>
330 <li><a href="#B.22"> B.22 Date and time &lt;time.h&gt;</a>
331 <li><a href="#B.23"> B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt;</a>
332 <li><a href="#B.24"> B.24 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
333 </ul>
334 <li><a href="#C">Annex C (informative) Sequence points</a>
335 <li><a href="#D">Annex D (normative) Universal character names for identifiers</a>
336 <li><a href="#E">Annex E (informative) Implementation limits</a>
337 <li><a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic</a>
338 <ul>
339 <li><a href="#F.1"> F.1 Introduction</a>
340 <li><a href="#F.2"> F.2 Types</a>
341 <li><a href="#F.3"> F.3 Operators and functions</a>
342 <!--page 7 -->
343 <li><a href="#F.4"> F.4 Floating to integer conversion</a>
344 <li><a href="#F.5"> F.5 Binary-decimal conversion</a>
345 <li><a href="#F.6"> F.6 Contracted expressions</a>
346 <li><a href="#F.7"> F.7 Floating-point environment</a>
347 <li><a href="#F.8"> F.8 Optimization</a>
348 <li><a href="#F.9"> F.9 Mathematics &lt;math.h&gt;</a>
349 </ul>
350 <li><a href="#G">Annex G (informative) IEC 60559-compatible complex arithmetic</a>
351 <ul>
352 <li><a href="#G.1"> G.1 Introduction</a>
353 <li><a href="#G.2"> G.2 Types</a>
354 <li><a href="#G.3"> G.3 Conventions</a>
355 <li><a href="#G.4"> G.4 Conversions</a>
356 <li><a href="#G.5"> G.5 Binary operators</a>
357 <li><a href="#G.6"> G.6 Complex arithmetic &lt;complex.h&gt;</a>
358 <li><a href="#G.7"> G.7 Type-generic math &lt;tgmath.h&gt;</a>
359 </ul>
360 <li><a href="#H">Annex H (informative) Language independent arithmetic</a>
361 <ul>
362 <li><a href="#H.1"> H.1 Introduction</a>
363 <li><a href="#H.2"> H.2 Types</a>
364 <li><a href="#H.3"> H.3 Notification</a>
365 </ul>
366 <li><a href="#I">Annex I (informative) Common warnings</a>
367 <li><a href="#J">Annex J (informative) Portability issues</a>
368 <ul>
369 <li><a href="#J.1"> J.1 Unspecified behavior</a>
370 <li><a href="#J.2"> J.2 Undefined behavior</a>
371 <li><a href="#J.3"> J.3 Implementation-defined behavior</a>
372 <li><a href="#J.4"> J.4 Locale-specific behavior</a>
373 <li><a href="#J.5"> J.5 Common extensions</a>
374 </ul>
375 <li><a href="#Bibliography">Bibliography</a>
376 <li><a href="#Index">Index</a>
377 <!--page 8 -->
378 <!--page 9 -->
379 </ul>
381 <h2><a name="Foreword" href="#Foreword">Foreword</a></h2>
382 <p><!--para 1 -->
383 ISO (the International Organization for Standardization) and IEC (the International
384 Electrotechnical Commission) form the specialized system for worldwide
385 standardization. National bodies that are member of ISO or IEC participate in the
386 development of International Standards through technical committees established by the
387 respective organization to deal with particular fields of technical activity. ISO and IEC
388 technical committees collaborate in fields of mutual interest. Other international
389 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
390 take part in the work.
391 <p><!--para 2 -->
392 International Standards are drafted in accordance with the rules given in the ISO/IEC
393 Directives, Part 3.
394 <p><!--para 3 -->
395 In the field of information technology, ISO and IEC have established a joint technical
396 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
397 committee are circulated to national bodies for voting. Publication as an International
398 Standard requires approval by at least 75% of the national bodies casting a vote.
399 <p><!--para 4 -->
400 International Standard ISO/IEC 9899 was prepared by Joint Technical Committee
401 ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages,
402 their environments and system software interfaces. The Working Group responsible for
403 this standard (WG 14) maintains a site on the World Wide Web at
404 http://www.open-std.org/JTC1/SC22/WG14/ containing additional
405 information relevant to this standard such as a Rationale for many of the decisions made
406 during its preparation and a log of Defect Reports and Responses.
407 <p><!--para 5 -->
408 This second edition cancels and replaces the first edition, ISO/IEC 9899:1990, as
409 amended and corrected by ISO/IEC 9899/COR1:1994, ISO/IEC 9899/AMD1:1995, and
410 ISO/IEC 9899/COR2:1996. Major changes from the previous edition include:
411 <ul>
412 <li> restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
413 in AMD1)
414 <li> wide character library support in <a href="#7.24">&lt;wchar.h&gt;</a> and <a href="#7.25">&lt;wctype.h&gt;</a> (originally
415 specified in AMD1)
416 <li> more precise aliasing rules via effective type
417 <li> restricted pointers
418 <li> variable length arrays
419 <li> flexible array members
420 <li> static and type qualifiers in parameter array declarators
421 <li> complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
422 <li> type-generic math macros in <a href="#7.22">&lt;tgmath.h&gt;</a>
423 <li> the long long int type and library functions
424 <!--page 10 -->
425 <li> increased minimum translation limits
426 <li> additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
427 <li> remove implicit int
428 <li> reliable integer division
429 <li> universal character names (\u and \U)
430 <li> extended identifiers
431 <li> hexadecimal floating-point constants and %a and %A printf/scanf conversion
432 specifiers
433 <li> compound literals
434 <li> designated initializers
435 <li> // comments
436 <li> extended integer types and library functions in <a href="#7.8">&lt;inttypes.h&gt;</a> and <a href="#7.18">&lt;stdint.h&gt;</a>
437 <li> remove implicit function declaration
438 <li> preprocessor arithmetic done in intmax_t/uintmax_t
439 <li> mixed declarations and code
440 <li> new block scopes for selection and iteration statements
441 <li> integer constant type rules
442 <li> integer promotion rules
443 <li> macros with a variable number of arguments
444 <li> the vscanf family of functions in <a href="#7.19">&lt;stdio.h&gt;</a> and <a href="#7.24">&lt;wchar.h&gt;</a>
445 <li> additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
446 <li> treatment of error conditions by math library functions (math_errhandling)
447 <li> floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
448 <li> IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
449 <li> trailing comma allowed in enum declaration
450 <li> %lf conversion specifier allowed in printf
451 <li> inline functions
452 <li> the snprintf family of functions in <a href="#7.19">&lt;stdio.h&gt;</a>
453 <li> boolean type in <a href="#7.16">&lt;stdbool.h&gt;</a>
454 <li> idempotent type qualifiers
455 <li> empty macro arguments
456 <!--page 11 -->
457 <li> new structure type compatibility rules (tag compatibility)
458 <li> additional predefined macro names
459 <li> _Pragma preprocessing operator
460 <li> standard pragmas
461 <li> __func__ predefined identifier
462 <li> va_copy macro
463 <li> additional strftime conversion specifiers
464 <li> LIA compatibility annex
465 <li> deprecate ungetc at the beginning of a binary file
466 <li> remove deprecation of aliased array parameters
467 <li> conversion of array to pointer not limited to lvalues
468 <li> relaxed constraints on aggregate and union initialization
469 <li> relaxed restrictions on portable header names
470 <li> return without expression not permitted in function that returns a value (and vice
471 versa)
472 </ul>
473 <p><!--para 6 -->
474 Annexes D and F form a normative part of this standard; annexes A, B, C, E, G, H, I, J,
475 the bibliography, and the index are for information only. In accordance with Part 3 of the
476 ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples are
477 also for information only.
478 <!--page 12 -->
480 <h2><a name="Introduction" href="#Introduction">Introduction</a></h2>
481 <p><!--para 1 -->
482 With the introduction of new devices and extended character sets, new features may be
483 added to this International Standard. Subclauses in the language and library clauses warn
484 implementors and programmers of usages which, though valid in themselves, may
485 conflict with future additions.
486 <p><!--para 2 -->
487 Certain features are obsolescent, which means that they may be considered for
488 withdrawal in future revisions of this International Standard. They are retained because
489 of their widespread use, but their use in new implementations (for implementation
490 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.
491 <p><!--para 3 -->
492 This International Standard is divided into four major subdivisions:
493 <ul>
494 <li> preliminary elements (clauses 1-4);
495 <li> the characteristics of environments that translate and execute C programs (clause 5);
496 <li> the language syntax, constraints, and semantics (clause 6);
497 <li> the library facilities (clause 7).
498 </ul>
499 <p><!--para 4 -->
500 Examples are provided to illustrate possible forms of the constructions described.
501 Footnotes are provided to emphasize consequences of the rules described in that
502 subclause or elsewhere in this International Standard. References are used to refer to
503 other related subclauses. Recommendations are provided to give advice or guidance to
504 implementors. Annexes provide additional information and summarize the information
505 contained in this International Standard. A bibliography lists documents that were
506 referred to during the preparation of the standard.
507 <p><!--para 5 -->
508 The language clause (clause 6) is derived from ''The C Reference Manual''.
509 <p><!--para 6 -->
510 The library clause (clause 7) is based on the 1984 /usr/group Standard.
511 <!--page 13 -->
513 <h1>Programming languages -- C</h1>
519 <h2><a name="1" href="#1">1. Scope</a></h2>
520 <p><!--para 1 -->
521 This International Standard specifies the form and establishes the interpretation of
522 programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
523 <ul>
524 <li> the representation of C programs;
525 <li> the syntax and constraints of the C language;
526 <li> the semantic rules for interpreting C programs;
527 <li> the representation of input data to be processed by C programs;
528 <li> the representation of output data produced by C programs;
529 <li> the restrictions and limits imposed by a conforming implementation of C.
530 </ul>
531 <p><!--para 2 -->
532 This International Standard does not specify
533 <ul>
534 <li> the mechanism by which C programs are transformed for use by a data-processing
535 system;
536 <li> the mechanism by which C programs are invoked for use by a data-processing
537 system;
538 <li> the mechanism by which input data are transformed for use by a C program;
539 <li> the mechanism by which output data are transformed after being produced by a C
540 program;
541 <li> the size or complexity of a program and its data that will exceed the capacity of any
542 specific data-processing system or the capacity of a particular processor;
545 <!--page 14 -->
546 <li> all minimal requirements of a data-processing system that is capable of supporting a
547 conforming implementation.
549 </ul>
551 <h6>footnotes</h6>
552 <p><small><a name="note1" href="#note1">1)</a> This International Standard is designed to promote the portability of C programs among a variety of
553 data-processing systems. It is intended for use by implementors and programmers.
554 </small>
556 <h2><a name="2" href="#2">2. Normative references</a></h2>
557 <p><!--para 1 -->
558 The following normative documents contain provisions which, through reference in this
559 text, constitute provisions of this International Standard. For dated references,
560 subsequent amendments to, or revisions of, any of these publications do not apply.
561 However, parties to agreements based on this International Standard are encouraged to
562 investigate the possibility of applying the most recent editions of the normative
563 documents indicated below. For undated references, the latest edition of the normative
564 document referred to applies. Members of ISO and IEC maintain registers of currently
565 valid International Standards.
566 <p><!--para 2 -->
567 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
568 use in the physical sciences and technology.
569 <p><!--para 3 -->
570 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
571 interchange.
572 <p><!--para 4 -->
573 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
574 terms.
575 <p><!--para 5 -->
576 ISO 4217, Codes for the representation of currencies and funds.
577 <p><!--para 6 -->
578 ISO 8601, Data elements and interchange formats -- Information interchange --
579 Representation of dates and times.
580 <p><!--para 7 -->
581 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
582 Character Set (UCS).
583 <p><!--para 8 -->
584 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
585 designated IEC 559:1989).
586 <!--page 15 -->
588 <h2><a name="3" href="#3">3. Terms, definitions, and symbols</a></h2>
589 <p><!--para 1 -->
590 For the purposes of this International Standard, the following definitions apply. Other
591 terms are defined where they appear in italic type or on the left side of a syntax rule.
592 Terms explicitly defined in this International Standard are not to be presumed to refer
593 implicitly to similar terms defined elsewhere. Terms not defined in this International
594 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
595 defined in this International Standard are to be interpreted according to ISO 31-11.
597 <h3><a name="3.1" href="#3.1">3.1</a></h3>
598 <p><!--para 1 -->
599 <b> access</b><br>
600 &lt;execution-time action&gt; to read or modify the value of an object
601 <p><!--para 2 -->
602 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
604 <p><!--para 3 -->
605 NOTE 2 "Modify'' includes the case where the new value being stored is the same as the previous value.
607 <p><!--para 4 -->
608 NOTE 3 Expressions that are not evaluated do not access objects.
611 <h3><a name="3.2" href="#3.2">3.2</a></h3>
612 <p><!--para 1 -->
613 <b> alignment</b><br>
614 requirement that objects of a particular type be located on storage boundaries with
615 addresses that are particular multiples of a byte address
617 <h3><a name="3.3" href="#3.3">3.3</a></h3>
618 <p><!--para 1 -->
619 <b> argument</b><br>
620 actual argument<br>
621 actual parameter (deprecated)<br>
622 expression in the comma-separated list bounded by the parentheses in a function call
623 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
624 by the parentheses in a function-like macro invocation
626 <h3><a name="3.4" href="#3.4">3.4</a></h3>
627 <p><!--para 1 -->
628 <b> behavior</b><br>
629 external appearance or action
631 <h4><a name="3.4.1" href="#3.4.1">3.4.1</a></h4>
632 <p><!--para 1 -->
633 <b> implementation-defined behavior</b><br>
634 unspecified behavior where each implementation documents how the choice is made
635 <p><!--para 2 -->
636 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
637 when a signed integer is shifted right.
640 <h4><a name="3.4.2" href="#3.4.2">3.4.2</a></h4>
641 <p><!--para 1 -->
642 <b> locale-specific behavior</b><br>
643 behavior that depends on local conventions of nationality, culture, and language that each
644 implementation documents
645 <!--page 16 -->
646 <p><!--para 2 -->
647 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
648 characters other than the 26 lowercase Latin letters.
651 <h4><a name="3.4.3" href="#3.4.3">3.4.3</a></h4>
652 <p><!--para 1 -->
653 <b> undefined behavior</b><br>
654 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
655 for which this International Standard imposes no requirements
656 <p><!--para 2 -->
657 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
658 results, to behaving during translation or program execution in a documented manner characteristic of the
659 environment (with or without the issuance of a diagnostic message), to terminating a translation or
660 execution (with the issuance of a diagnostic message).
662 <p><!--para 3 -->
663 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
666 <h4><a name="3.4.4" href="#3.4.4">3.4.4</a></h4>
667 <p><!--para 1 -->
668 <b> unspecified behavior</b><br>
669 use of an unspecified value, or other behavior where this International Standard provides
670 two or more possibilities and imposes no further requirements on which is chosen in any
671 instance
672 <p><!--para 2 -->
673 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
674 evaluated.
677 <h3><a name="3.5" href="#3.5">3.5</a></h3>
678 <p><!--para 1 -->
679 <b> bit</b><br>
680 unit of data storage in the execution environment large enough to hold an object that may
681 have one of two values
682 <p><!--para 2 -->
683 NOTE It need not be possible to express the address of each individual bit of an object.
686 <h3><a name="3.6" href="#3.6">3.6</a></h3>
687 <p><!--para 1 -->
688 <b> byte</b><br>
689 addressable unit of data storage large enough to hold any member of the basic character
690 set of the execution environment
691 <p><!--para 2 -->
692 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
694 <p><!--para 3 -->
695 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
696 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
697 bit.
700 <h3><a name="3.7" href="#3.7">3.7</a></h3>
701 <p><!--para 1 -->
702 <b> character</b><br>
703 &lt;abstract&gt; member of a set of elements used for the organization, control, or
704 representation of data
706 <h4><a name="3.7.1" href="#3.7.1">3.7.1</a></h4>
707 <p><!--para 1 -->
708 <b> character</b><br>
709 single-byte character
710 &lt;C&gt; bit representation that fits in a byte
711 <!--page 17 -->
713 <h4><a name="3.7.2" href="#3.7.2">3.7.2</a></h4>
714 <p><!--para 1 -->
715 <b> multibyte character</b><br>
716 sequence of one or more bytes representing a member of the extended character set of
717 either the source or the execution environment
718 <p><!--para 2 -->
719 NOTE The extended character set is a superset of the basic character set.
722 <h4><a name="3.7.3" href="#3.7.3">3.7.3</a></h4>
723 <p><!--para 1 -->
724 <b> wide character</b><br>
725 bit representation that fits in an object of type wchar_t, capable of representing any
726 character in the current locale
728 <h3><a name="3.8" href="#3.8">3.8</a></h3>
729 <p><!--para 1 -->
730 <b> constraint</b><br>
731 restriction, either syntactic or semantic, by which the exposition of language elements is
732 to be interpreted
734 <h3><a name="3.9" href="#3.9">3.9</a></h3>
735 <p><!--para 1 -->
736 <b> correctly rounded result</b><br>
737 representation in the result format that is nearest in value, subject to the current rounding
738 mode, to what the result would be given unlimited range and precision
740 <h3><a name="3.10" href="#3.10">3.10</a></h3>
741 <p><!--para 1 -->
742 <b> diagnostic message</b><br>
743 message belonging to an implementation-defined subset of the implementation's message
744 output
746 <h3><a name="3.11" href="#3.11">3.11</a></h3>
747 <p><!--para 1 -->
748 <b> forward reference</b><br>
749 reference to a later subclause of this International Standard that contains additional
750 information relevant to this subclause
752 <h3><a name="3.12" href="#3.12">3.12</a></h3>
753 <p><!--para 1 -->
754 <b> implementation</b><br>
755 particular set of software, running in a particular translation environment under particular
756 control options, that performs translation of programs for, and supports execution of
757 functions in, a particular execution environment
759 <h3><a name="3.13" href="#3.13">3.13</a></h3>
760 <p><!--para 1 -->
761 <b> implementation limit</b><br>
762 restriction imposed upon programs by the implementation
764 <h3><a name="3.14" href="#3.14">3.14</a></h3>
765 <p><!--para 1 -->
766 <b> object</b><br>
767 region of data storage in the execution environment, the contents of which can represent
768 values
769 <!--page 18 -->
770 <p><!--para 2 -->
771 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>.
774 <h3><a name="3.15" href="#3.15">3.15</a></h3>
775 <p><!--para 1 -->
776 <b> parameter</b><br>
777 formal parameter
778 formal argument (deprecated)
779 object declared as part of a function declaration or definition that acquires a value on
780 entry to the function, or an identifier from the comma-separated list bounded by the
781 parentheses immediately following the macro name in a function-like macro definition
783 <h3><a name="3.16" href="#3.16">3.16</a></h3>
784 <p><!--para 1 -->
785 <b> recommended practice</b><br>
786 specification that is strongly recommended as being in keeping with the intent of the
787 standard, but that may be impractical for some implementations
789 <h3><a name="3.17" href="#3.17">3.17</a></h3>
790 <p><!--para 1 -->
791 <b> value</b><br>
792 precise meaning of the contents of an object when interpreted as having a specific type
794 <h4><a name="3.17.1" href="#3.17.1">3.17.1</a></h4>
795 <p><!--para 1 -->
796 <b> implementation-defined value</b><br>
797 unspecified value where each implementation documents how the choice is made
799 <h4><a name="3.17.2" href="#3.17.2">3.17.2</a></h4>
800 <p><!--para 1 -->
801 <b> indeterminate value</b><br>
802 either an unspecified value or a trap representation
804 <h4><a name="3.17.3" href="#3.17.3">3.17.3</a></h4>
805 <p><!--para 1 -->
806 <b> unspecified value</b><br>
807 valid value of the relevant type where this International Standard imposes no
808 requirements on which value is chosen in any instance
809 <p><!--para 2 -->
810 NOTE An unspecified value cannot be a trap representation.
813 <h3><a name="3.18" href="#3.18">3.18</a></h3>
814 <p><!--para 1 -->
815 <b> [^ x ^]</b><br>
816 ceiling of x: the least integer greater than or equal to x
817 <p><!--para 2 -->
818 EXAMPLE [^2.4^] is 3, [^-2.4^] is -2.
821 <h3><a name="3.19" href="#3.19">3.19</a></h3>
822 <p><!--para 1 -->
823 <b> [_ x _]</b><br>
824 floor of x: the greatest integer less than or equal to x
825 <p><!--para 2 -->
826 EXAMPLE [_2.4_] is 2, [_-2.4_] is -3.
827 <!--page 19 -->
829 <h2><a name="4" href="#4">4. Conformance</a></h2>
830 <p><!--para 1 -->
831 In this International Standard, ''shall'' is to be interpreted as a requirement on an
832 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
833 prohibition.
834 <p><!--para 2 -->
835 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated, the
836 behavior is undefined. Undefined behavior is otherwise indicated in this International
837 Standard by the words ''undefined behavior'' or by the omission of any explicit definition
838 of behavior. There is no difference in emphasis among these three; they all describe
839 ''behavior that is undefined''.
840 <p><!--para 3 -->
841 A program that is correct in all other aspects, operating on correct data, containing
842 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
843 <p><!--para 4 -->
844 The implementation shall not successfully translate a preprocessing translation unit
845 containing a #error preprocessing directive unless it is part of a group skipped by
846 conditional inclusion.
847 <p><!--para 5 -->
848 A strictly conforming program shall use only those features of the language and library
849 specified in this International Standard.<sup><a href="#note2"><b>2)</b></a></sup> It shall not produce output dependent on any
850 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
851 minimum implementation limit.
852 <p><!--para 6 -->
853 The two forms of conforming implementation are hosted and freestanding. A conforming
854 hosted implementation shall accept any strictly conforming program. A conforming
855 freestanding implementation shall accept any strictly conforming program that does not
856 use complex types and in which the use of the features specified in the library clause
857 (clause 7) is confined to the contents of the standard headers <a href="#7.7">&lt;float.h&gt;</a>,
858 <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#7.15">&lt;stdarg.h&gt;</a>, <a href="#7.16">&lt;stdbool.h&gt;</a>, <a href="#7.17">&lt;stddef.h&gt;</a>, and
859 <a href="#7.18">&lt;stdint.h&gt;</a>. A conforming implementation may have extensions (including additional
860 library functions), provided they do not alter the behavior of any strictly conforming
861 program.<sup><a href="#note3"><b>3)</b></a></sup>
865 <!--page 20 -->
866 <p><!--para 7 -->
867 A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note4"><b>4)</b></a></sup>
868 <p><!--para 8 -->
869 An implementation shall be accompanied by a document that defines all implementation-
870 defined and locale-specific characteristics and all extensions.
871 <p><b> Forward references</b>: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
872 characteristics of floating types <a href="#7.7">&lt;float.h&gt;</a> (<a href="#7.7">7.7</a>), alternative spellings <a href="#7.9">&lt;iso646.h&gt;</a>
873 (<a href="#7.9">7.9</a>), sizes of integer types <a href="#7.10">&lt;limits.h&gt;</a> (<a href="#7.10">7.10</a>), variable arguments <a href="#7.15">&lt;stdarg.h&gt;</a>
874 (<a href="#7.15">7.15</a>), boolean type and values <a href="#7.16">&lt;stdbool.h&gt;</a> (<a href="#7.16">7.16</a>), common definitions
875 <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>).
880 <!--page 21 -->
882 <h6>footnotes</h6>
883 <p><small><a name="note2" href="#note2">2)</a> A strictly conforming program can use conditional features (such as those in <a href="#F">annex F</a>) provided the
884 use is guarded by a #ifdef directive with the appropriate macro. For example:
886 <pre>
887 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
888 /* ... */
889 fesetround(FE_UPWARD);
890 /* ... */
891 #endif
892 </pre>
894 </small>
895 <p><small><a name="note3" href="#note3">3)</a> This implies that a conforming implementation reserves no identifiers other than those explicitly
896 reserved in this International Standard.
897 </small>
898 <p><small><a name="note4" href="#note4">4)</a> Strictly conforming programs are intended to be maximally portable among conforming
899 implementations. Conforming programs may depend upon nonportable features of a conforming
900 implementation.
901 </small>
903 <h2><a name="5" href="#5">5. Environment</a></h2>
904 <p><!--para 1 -->
905 An implementation translates C source files and executes C programs in two data-
906 processing-system environments, which will be called the translation environment and
907 the execution environment in this International Standard. Their characteristics define and
908 constrain the results of executing conforming C programs constructed according to the
909 syntactic and semantic rules for conforming implementations.
910 <p><b> Forward references</b>: In this clause, only a few of many possible forward references
911 have been noted.
913 <h3><a name="5.1" href="#5.1">5.1 Conceptual models</a></h3>
915 <h4><a name="5.1.1" href="#5.1.1">5.1.1 Translation environment</a></h4>
917 <h5><a name="5.1.1.1" href="#5.1.1.1">5.1.1.1 Program structure</a></h5>
918 <p><!--para 1 -->
919 A C program need not all be translated at the same time. The text of the program is kept
920 in units called source files, (or preprocessing files) in this International Standard. A
921 source file together with all the headers and source files included via the preprocessing
922 directive #include is known as a preprocessing translation unit. After preprocessing, a
923 preprocessing translation unit is called a translation unit. Previously translated translation
924 units may be preserved individually or in libraries. The separate translation units of a
925 program communicate by (for example) calls to functions whose identifiers have external
926 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
927 of data files. Translation units may be separately translated and then later linked to
928 produce an executable program.
929 <p><b> Forward references</b>: linkages of identifiers (<a href="#6.2.2">6.2.2</a>), external definitions (<a href="#6.9">6.9</a>),
930 preprocessing directives (<a href="#6.10">6.10</a>).
932 <h5><a name="5.1.1.2" href="#5.1.1.2">5.1.1.2 Translation phases</a></h5>
933 <p><!--para 1 -->
934 The precedence among the syntax rules of translation is specified by the following
935 phases.<sup><a href="#note5"><b>5)</b></a></sup>
936 <ol>
937 <li> Physical source file multibyte characters are mapped, in an implementation-
938 defined manner, to the source character set (introducing new-line characters for
939 end-of-line indicators) if necessary. Trigraph sequences are replaced by
940 corresponding single-character internal representations.
944 <!--page 22 -->
945 <li> Each instance of a backslash character (\) immediately followed by a new-line
946 character is deleted, splicing physical source lines to form logical source lines.
947 Only the last backslash on any physical source line shall be eligible for being part
948 of such a splice. A source file that is not empty shall end in a new-line character,
949 which shall not be immediately preceded by a backslash character before any such
950 splicing takes place.
951 <li> The source file is decomposed into preprocessing tokens<sup><a href="#note6"><b>6)</b></a></sup> and sequences of
952 white-space characters (including comments). A source file shall not end in a
953 partial preprocessing token or in a partial comment. Each comment is replaced by
954 one space character. New-line characters are retained. Whether each nonempty
955 sequence of white-space characters other than new-line is retained or replaced by
956 one space character is implementation-defined.
957 <li> Preprocessing directives are executed, macro invocations are expanded, and
958 _Pragma unary operator expressions are executed. If a character sequence that
959 matches the syntax of a universal character name is produced by token
960 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
961 directive causes the named header or source file to be processed from phase 1
962 through phase 4, recursively. All preprocessing directives are then deleted.
963 <li> Each source character set member and escape sequence in character constants and
964 string literals is converted to the corresponding member of the execution character
965 set; if there is no corresponding member, it is converted to an implementation-
966 defined member other than the null (wide) character.<sup><a href="#note7"><b>7)</b></a></sup>
967 <li> Adjacent string literal tokens are concatenated.
968 <li> White-space characters separating tokens are no longer significant. Each
969 preprocessing token is converted into a token. The resulting tokens are
970 syntactically and semantically analyzed and translated as a translation unit.
971 <li> All external object and function references are resolved. Library components are
972 linked to satisfy external references to functions and objects not defined in the
973 current translation. All such translator output is collected into a program image
974 which contains information needed for execution in its execution environment.
975 </ol>
976 <p><b> Forward references</b>: universal character names (<a href="#6.4.3">6.4.3</a>), lexical elements (<a href="#6.4">6.4</a>),
977 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>).
981 <!--page 23 -->
983 <h6>footnotes</h6>
984 <p><small><a name="note5" href="#note5">5)</a> Implementations shall behave as if these separate phases occur, even though many are typically folded
985 together in practice. Source files, translation units, and translated translation units need not
986 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
987 and any external representation. The description is conceptual only, and does not specify any
988 particular implementation.
989 </small>
990 <p><small><a name="note6" href="#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
991 context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
992 </small>
993 <p><small><a name="note7" href="#note7">7)</a> An implementation need not convert all non-corresponding source characters to the same execution
994 character.
995 </small>
997 <h5><a name="5.1.1.3" href="#5.1.1.3">5.1.1.3 Diagnostics</a></h5>
998 <p><!--para 1 -->
999 A conforming implementation shall produce at least one diagnostic message (identified in
1000 an implementation-defined manner) if a preprocessing translation unit or translation unit
1001 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
1002 specified as undefined or implementation-defined. Diagnostic messages need not be
1003 produced in other circumstances.<sup><a href="#note8"><b>8)</b></a></sup>
1004 <p><!--para 2 -->
1005 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
1006 <pre>
1007 char i;
1008 int i;
1009 </pre>
1010 because in those cases where wording in this International Standard describes the behavior for a construct
1011 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
1014 <h6>footnotes</h6>
1015 <p><small><a name="note8" href="#note8">8)</a> The intent is that an implementation should identify the nature of, and where possible localize, each
1016 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
1017 valid program is still correctly translated. It may also successfully translate an invalid program.
1018 </small>
1020 <h4><a name="5.1.2" href="#5.1.2">5.1.2 Execution environments</a></h4>
1021 <p><!--para 1 -->
1022 Two execution environments are defined: freestanding and hosted. In both cases,
1023 program startup occurs when a designated C function is called by the execution
1024 environment. All objects with static storage duration shall be initialized (set to their
1025 initial values) before program startup. The manner and timing of such initialization are
1026 otherwise unspecified. Program termination returns control to the execution
1027 environment.
1028 <p><b> Forward references</b>: storage durations of objects (<a href="#6.2.4">6.2.4</a>), initialization (<a href="#6.7.8">6.7.8</a>).
1030 <h5><a name="5.1.2.1" href="#5.1.2.1">5.1.2.1 Freestanding environment</a></h5>
1031 <p><!--para 1 -->
1032 In a freestanding environment (in which C program execution may take place without any
1033 benefit of an operating system), the name and type of the function called at program
1034 startup are implementation-defined. Any library facilities available to a freestanding
1035 program, other than the minimal set required by clause 4, are implementation-defined.
1036 <p><!--para 2 -->
1037 The effect of program termination in a freestanding environment is implementation-
1038 defined.
1040 <h5><a name="5.1.2.2" href="#5.1.2.2">5.1.2.2 Hosted environment</a></h5>
1041 <p><!--para 1 -->
1042 A hosted environment need not be provided, but shall conform to the following
1043 specifications if present.
1048 <!--page 24 -->
1050 <h5><a name="5.1.2.2.1" href="#5.1.2.2.1">5.1.2.2.1 Program startup</a></h5>
1051 <p><!--para 1 -->
1052 The function called at program startup is named main. The implementation declares no
1053 prototype for this function. It shall be defined with a return type of int and with no
1054 parameters:
1055 <pre>
1056 int main(void) { /* ... */ }
1057 </pre>
1058 or with two parameters (referred to here as argc and argv, though any names may be
1059 used, as they are local to the function in which they are declared):
1060 <pre>
1061 int main(int argc, char *argv[]) { /* ... */ }
1062 </pre>
1063 or equivalent;<sup><a href="#note9"><b>9)</b></a></sup> or in some other implementation-defined manner.
1064 <p><!--para 2 -->
1065 If they are declared, the parameters to the main function shall obey the following
1066 constraints:
1067 <ul>
1068 <li> The value of argc shall be nonnegative.
1069 <li> argv[argc] shall be a null pointer.
1070 <li> If the value of argc is greater than zero, the array members argv[0] through
1071 argv[argc-1] inclusive shall contain pointers to strings, which are given
1072 implementation-defined values by the host environment prior to program startup. The
1073 intent is to supply to the program information determined prior to program startup
1074 from elsewhere in the hosted environment. If the host environment is not capable of
1075 supplying strings with letters in both uppercase and lowercase, the implementation
1076 shall ensure that the strings are received in lowercase.
1077 <li> If the value of argc is greater than zero, the string pointed to by argv[0]
1078 represents the program name; argv[0][0] shall be the null character if the
1079 program name is not available from the host environment. If the value of argc is
1080 greater than one, the strings pointed to by argv[1] through argv[argc-1]
1081 represent the program parameters.
1082 <li> The parameters argc and argv and the strings pointed to by the argv array shall
1083 be modifiable by the program, and retain their last-stored values between program
1084 startup and program termination.
1085 </ul>
1087 <h6>footnotes</h6>
1088 <p><small><a name="note9" href="#note9">9)</a> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
1089 char ** argv, and so on.
1090 </small>
1092 <h5><a name="5.1.2.2.2" href="#5.1.2.2.2">5.1.2.2.2 Program execution</a></h5>
1093 <p><!--para 1 -->
1094 In a hosted environment, a program may use all the functions, macros, type definitions,
1095 and objects described in the library clause (clause 7).
1099 <!--page 25 -->
1101 <h5><a name="5.1.2.2.3" href="#5.1.2.2.3">5.1.2.2.3 Program termination</a></h5>
1102 <p><!--para 1 -->
1103 If the return type of the main function is a type compatible with int, a return from the
1104 initial call to the main function is equivalent to calling the exit function with the value
1105 returned by the main function as its argument;<sup><a href="#note10"><b>10)</b></a></sup> reaching the } that terminates the
1106 main function returns a value of 0. If the return type is not compatible with int, the
1107 termination status returned to the host environment is unspecified.
1108 <p><b> Forward references</b>: 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>).
1110 <h6>footnotes</h6>
1111 <p><small><a name="note10" href="#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
1112 will have ended in the former case, even where they would not have in the latter.
1113 </small>
1115 <h5><a name="5.1.2.3" href="#5.1.2.3">5.1.2.3 Program execution</a></h5>
1116 <p><!--para 1 -->
1117 The semantic descriptions in this International Standard describe the behavior of an
1118 abstract machine in which issues of optimization are irrelevant.
1119 <p><!--para 2 -->
1120 Accessing a volatile object, modifying an object, modifying a file, or calling a function
1121 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
1122 the execution environment. Evaluation of an expression may produce side effects. At
1123 certain specified points in the execution sequence called sequence points, all side effects
1124 of previous evaluations shall be complete and no side effects of subsequent evaluations
1125 shall have taken place. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
1126 <p><!--para 3 -->
1127 In the abstract machine, all expressions are evaluated as specified by the semantics. An
1128 actual implementation need not evaluate part of an expression if it can deduce that its
1129 value is not used and that no needed side effects are produced (including any caused by
1130 calling a function or accessing a volatile object).
1131 <p><!--para 4 -->
1132 When the processing of the abstract machine is interrupted by receipt of a signal, only the
1133 values of objects as of the previous sequence point may be relied on. Objects that may be
1134 modified between the previous sequence point and the next sequence point need not have
1135 received their correct values yet.
1136 <p><!--para 5 -->
1137 The least requirements on a conforming implementation are:
1138 <ul>
1139 <li> At sequence points, volatile objects are stable in the sense that previous accesses are
1140 complete and subsequent accesses have not yet occurred.
1145 <!--page 26 -->
1146 <li> At program termination, all data written into files shall be identical to the result that
1147 execution of the program according to the abstract semantics would have produced.
1148 <li> The input and output dynamics of interactive devices shall take place as specified in
1149 <a href="#7.19.3">7.19.3</a>. The intent of these requirements is that unbuffered or line-buffered output
1150 appear as soon as possible, to ensure that prompting messages actually appear prior to
1151 a program waiting for input.
1152 </ul>
1153 <p><!--para 6 -->
1154 What constitutes an interactive device is implementation-defined.
1155 <p><!--para 7 -->
1156 More stringent correspondences between abstract and actual semantics may be defined by
1157 each implementation.
1158 <p><!--para 8 -->
1159 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
1160 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
1161 abstract semantics. The keyword volatile would then be redundant.
1162 <p><!--para 9 -->
1163 Alternatively, an implementation might perform various optimizations within each translation unit, such
1164 that the actual semantics would agree with the abstract semantics only when making function calls across
1165 translation unit boundaries. In such an implementation, at the time of each function entry and function
1166 return where the calling function and the called function are in different translation units, the values of all
1167 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
1168 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
1169 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
1170 type of implementation, objects referred to by interrupt service routines activated by the signal function
1171 would require explicit specification of volatile storage, as well as other implementation-defined
1172 restrictions.
1174 <p><!--para 10 -->
1175 EXAMPLE 2 In executing the fragment
1176 <pre>
1177 char c1, c2;
1178 /* ... */
1179 c1 = c1 + c2;
1180 </pre>
1181 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
1182 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
1183 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
1184 produce the same result, possibly omitting the promotions.
1186 <p><!--para 11 -->
1187 EXAMPLE 3 Similarly, in the fragment
1188 <pre>
1189 float f1, f2;
1190 double d;
1191 /* ... */
1192 f1 = f2 * d;
1193 </pre>
1194 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
1195 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
1196 were replaced by the constant 2.0, which has type double).
1197 <!--page 27 -->
1198 <p><!--para 12 -->
1199 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1200 semantics. Values are independent of whether they are represented in a register or in memory. For
1201 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1202 is required to round to the precision of the storage type. In particular, casts and assignments are required to
1203 perform their specified conversion. For the fragment
1204 <pre>
1205 double d1, d2;
1206 float f;
1207 d1 = f = expression;
1208 d2 = (float) expression;
1209 </pre>
1210 the values assigned to d1 and d2 are required to have been converted to float.
1212 <p><!--para 13 -->
1213 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1214 precision as well as range. The implementation cannot generally apply the mathematical associative rules
1215 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1216 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1217 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1218 numbers are often not valid (see <a href="#F.8">F.8</a>).
1219 <pre>
1220 double x, y, z;
1221 /* ... */
1222 x = (x * y) * z; // not equivalent to x *= y * z;
1223 z = (x - y) + y ; // not equivalent to z = x;
1224 z = x + x * y; // not equivalent to z = x * (1.0 + y);
1225 y = x / 5.0; // not equivalent to y = x * 0.2;
1226 </pre>
1228 <p><!--para 14 -->
1229 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1230 <pre>
1231 int a, b;
1232 /* ... */
1233 a = a + 32760 + b + 5;
1234 </pre>
1235 the expression statement behaves exactly the same as
1236 <pre>
1237 a = (((a + 32760) + b) + 5);
1238 </pre>
1239 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1240 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1241 which overflows produce an explicit trap and in which the range of values representable by an int is
1242 [-32768, +32767], the implementation cannot rewrite this expression as
1243 <pre>
1244 a = ((a + b) + 32765);
1245 </pre>
1246 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1247 while the original expression would not; nor can the expression be rewritten either as
1248 <pre>
1249 a = ((a + 32765) + b);
1250 </pre>
1252 <pre>
1253 a = (a + (b + 32765));
1254 </pre>
1255 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1256 in which overflow silently generates some value and where positive and negative overflows cancel, the
1257 above expression statement can be rewritten by the implementation in any of the above ways because the
1258 same result will occur.
1259 <!--page 28 -->
1260 <p><!--para 15 -->
1261 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1262 following fragment
1263 <pre>
1264 #include <a href="#7.19">&lt;stdio.h&gt;</a>
1265 int sum;
1266 char *p;
1267 /* ... */
1268 sum = sum * 10 - '0' + (*p++ = getchar());
1269 </pre>
1270 the expression statement is grouped as if it were written as
1271 <pre>
1272 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));
1273 </pre>
1274 but the actual increment of p can occur at any time between the previous sequence point and the next
1275 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1276 value.
1278 <p><b> Forward references</b>: 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
1279 signal function (<a href="#7.14">7.14</a>), files (<a href="#7.19.3">7.19.3</a>).
1280 <!--page 29 -->
1282 <h6>footnotes</h6>
1283 <p><small><a name="note11" href="#note11">11)</a> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
1284 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
1285 values of floating-point operations. Implementations that support such floating-point state are
1286 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
1287 environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
1288 effects matter, freeing the implementations in other cases.
1289 </small>
1291 <h3><a name="5.2" href="#5.2">5.2 Environmental considerations</a></h3>
1293 <h4><a name="5.2.1" href="#5.2.1">5.2.1 Character sets</a></h4>
1294 <p><!--para 1 -->
1295 Two sets of characters and their associated collating sequences shall be defined: the set in
1296 which source files are written (the source character set), and the set interpreted in the
1297 execution environment (the execution character set). Each set is further divided into a
1298 basic character set, whose contents are given by this subclause, and a set of zero or more
1299 locale-specific members (which are not members of the basic character set) called
1300 extended characters. The combined set is also called the extended character set. The
1301 values of the members of the execution character set are implementation-defined.
1302 <p><!--para 2 -->
1303 In a character constant or string literal, members of the execution character set shall be
1304 represented by corresponding members of the source character set or by escape
1305 sequences consisting of the backslash \ followed by one or more characters. A byte with
1306 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1307 is used to terminate a character string.
1308 <p><!--para 3 -->
1309 Both the basic source and basic execution character sets shall have the following
1310 members: the 26 uppercase letters of the Latin alphabet
1311 <pre>
1312 A B C D E F G H I J K L M
1313 N O P Q R S T U V W X Y Z
1314 </pre>
1315 the 26 lowercase letters of the Latin alphabet
1316 <pre>
1317 a b c d e f g h i j k l m
1318 n o p q r s t u v w x y z
1319 </pre>
1320 the 10 decimal digits
1321 <pre>
1322 0 1 2 3 4 5 6 7 8 9
1323 </pre>
1324 the following 29 graphic characters
1325 <pre>
1326 ! " # % &amp; ' ( ) * + , - . / :
1327 ; &lt; = &gt; ? [ \ ] ^ _ { | } ~
1328 </pre>
1329 the space character, and control characters representing horizontal tab, vertical tab, and
1330 form feed. The representation of each member of the source and execution basic
1331 character sets shall fit in a byte. In both the source and execution basic character sets, the
1332 value of each character after 0 in the above list of decimal digits shall be one greater than
1333 the value of the previous. In source files, there shall be some way of indicating the end of
1334 each line of text; this International Standard treats such an end-of-line indicator as if it
1335 were a single new-line character. In the basic execution character set, there shall be
1336 control characters representing alert, backspace, carriage return, and new line. If any
1337 other characters are encountered in a source file (except in an identifier, a character
1338 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1339 <!--page 30 -->
1340 converted to a token), the behavior is undefined.
1341 <p><!--para 4 -->
1342 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1343 Standard the term does not include other characters that are letters in other alphabets.
1344 <p><!--para 5 -->
1345 The universal character name construct provides a way to name other characters.
1346 <p><b> Forward references</b>: 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>),
1347 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>).
1349 <h5><a name="5.2.1.1" href="#5.2.1.1">5.2.1.1 Trigraph sequences</a></h5>
1350 <p><!--para 1 -->
1351 Before any other processing takes place, each occurrence of one of the following
1352 sequences of three characters (called trigraph sequences<sup><a href="#note12"><b>12)</b></a></sup>) is replaced with the
1353 corresponding single character.
1354 <pre>
1355 ??= # ??) ] ??! |
1356 ??( [ ??' ^ ??&gt; }
1357 ??/ \ ??&lt; { ??- ~
1358 </pre>
1359 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1360 above is not changed.
1361 <p><!--para 2 -->
1362 EXAMPLE 1
1363 <pre>
1364 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)
1365 </pre>
1366 becomes
1367 <pre>
1368 #define arraycheck(a, b) a[b] || b[a]
1369 </pre>
1371 <p><!--para 3 -->
1372 EXAMPLE 2 The following source line
1373 <pre>
1374 printf("Eh???/n");
1375 </pre>
1376 becomes (after replacement of the trigraph sequence ??/)
1377 <pre>
1378 printf("Eh?\n");
1379 </pre>
1382 <h6>footnotes</h6>
1383 <p><small><a name="note12" href="#note12">12)</a> The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1384 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1385 </small>
1387 <h5><a name="5.2.1.2" href="#5.2.1.2">5.2.1.2 Multibyte characters</a></h5>
1388 <p><!--para 1 -->
1389 The source character set may contain multibyte characters, used to represent members of
1390 the extended character set. The execution character set may also contain multibyte
1391 characters, which need not have the same encoding as for the source character set. For
1392 both character sets, the following shall hold:
1393 <ul>
1394 <li> The basic character set shall be present and each character shall be encoded as a
1395 single byte.
1396 <li> The presence, meaning, and representation of any additional members is locale-
1397 specific.
1399 <!--page 31 -->
1400 <li> A multibyte character set may have a state-dependent encoding, wherein each
1401 sequence of multibyte characters begins in an initial shift state and enters other
1402 locale-specific shift states when specific multibyte characters are encountered in the
1403 sequence. While in the initial shift state, all single-byte characters retain their usual
1404 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1405 in the sequence is a function of the current shift state.
1406 <li> A byte with all bits zero shall be interpreted as a null character independent of shift
1407 state. Such a byte shall not occur as part of any other multibyte character.
1408 </ul>
1409 <p><!--para 2 -->
1410 For source files, the following shall hold:
1411 <ul>
1412 <li> An identifier, comment, string literal, character constant, or header name shall begin
1413 and end in the initial shift state.
1414 <li> An identifier, comment, string literal, character constant, or header name shall consist
1415 of a sequence of valid multibyte characters.
1416 </ul>
1418 <h4><a name="5.2.2" href="#5.2.2">5.2.2 Character display semantics</a></h4>
1419 <p><!--para 1 -->
1420 The active position is that location on a display device where the next character output by
1421 the fputc function would appear. The intent of writing a printing character (as defined
1422 by the isprint function) to a display device is to display a graphic representation of
1423 that character at the active position and then advance the active position to the next
1424 position on the current line. The direction of writing is locale-specific. If the active
1425 position is at the final position of a line (if there is one), the behavior of the display device
1426 is unspecified.
1427 <p><!--para 2 -->
1428 Alphabetic escape sequences representing nongraphic characters in the execution
1429 character set are intended to produce actions on display devices as follows:
1430 <dl>
1431 <dt> \a <dd>(alert) Produces an audible or visible alert without changing the active position.
1432 <dt> \b <dd>(backspace) Moves the active position to the previous position on the current line. If
1433 the active position is at the initial position of a line, the behavior of the display
1434 device is unspecified.
1435 <dt> \f <dd>( form feed) Moves the active position to the initial position at the start of the next
1436 logical page.
1437 <dt> \n <dd>(new line) Moves the active position to the initial position of the next line.
1438 <dt> \r <dd>(carriage return) Moves the active position to the initial position of the current line.
1439 <dt> \t <dd>(horizontal tab) Moves the active position to the next horizontal tabulation position
1440 on the current line. If the active position is at or past the last defined horizontal
1441 tabulation position, the behavior of the display device is unspecified.
1442 <dt> \v <dd>(vertical tab) Moves the active position to the initial position of the next vertical
1443 <!--page 32 -->
1444 tabulation position. If the active position is at or past the last defined vertical
1445 tabulation position, the behavior of the display device is unspecified.
1446 </dl>
1447 <p><!--para 3 -->
1448 Each of these escape sequences shall produce a unique implementation-defined value
1449 which can be stored in a single char object. The external representations in a text file
1450 need not be identical to the internal representations, and are outside the scope of this
1451 International Standard.
1452 <p><b> Forward references</b>: 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>).
1454 <h4><a name="5.2.3" href="#5.2.3">5.2.3 Signals and interrupts</a></h4>
1455 <p><!--para 1 -->
1456 Functions shall be implemented such that they may be interrupted at any time by a signal,
1457 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1458 invocations' control flow (after the interruption), function return values, or objects with
1459 automatic storage duration. All such objects shall be maintained outside the function
1460 image (the instructions that compose the executable representation of a function) on a
1461 per-invocation basis.
1463 <h4><a name="5.2.4" href="#5.2.4">5.2.4 Environmental limits</a></h4>
1464 <p><!--para 1 -->
1465 Both the translation and execution environments constrain the implementation of
1466 language translators and libraries. The following summarizes the language-related
1467 environmental limits on a conforming implementation; the library-related limits are
1468 discussed in clause 7.
1470 <h5><a name="5.2.4.1" href="#5.2.4.1">5.2.4.1 Translation limits</a></h5>
1471 <p><!--para 1 -->
1472 The implementation shall be able to translate and execute at least one program that
1473 contains at least one instance of every one of the following limits:<sup><a href="#note13"><b>13)</b></a></sup>
1474 <ul>
1475 <li> 127 nesting levels of blocks
1476 <li> 63 nesting levels of conditional inclusion
1477 <li> 12 pointer, array, and function declarators (in any combinations) modifying an
1478 arithmetic, structure, union, or incomplete type in a declaration
1479 <li> 63 nesting levels of parenthesized declarators within a full declarator
1480 <li> 63 nesting levels of parenthesized expressions within a full expression
1481 <li> 63 significant initial characters in an internal identifier or a macro name (each
1482 universal character name or extended source character is considered a single
1483 character)
1484 <li> 31 significant initial characters in an external identifier (each universal character name
1485 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1488 <!--page 33 -->
1489 universal character name specifying a short identifier of 00010000 or more is
1490 considered 10 characters, and each extended source character is considered the same
1491 number of characters as the corresponding universal character name, if any)<sup><a href="#note14"><b>14)</b></a></sup>
1492 <li> 4095 external identifiers in one translation unit
1493 <li> 511 identifiers with block scope declared in one block
1494 <li> 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1495 <li> 127 parameters in one function definition
1496 <li> 127 arguments in one function call
1497 <li> 127 parameters in one macro definition
1498 <li> 127 arguments in one macro invocation
1499 <li> 4095 characters in a logical source line
1500 <li> 4095 characters in a character string literal or wide string literal (after concatenation)
1501 <li> 65535 bytes in an object (in a hosted environment only)
1502 <li> 15 nesting levels for #included files
1503 <li> 1023 case labels for a switch statement (excluding those for any nested switch
1504 statements)
1505 <li> 1023 members in a single structure or union
1506 <li> 1023 enumeration constants in a single enumeration
1507 <li> 63 levels of nested structure or union definitions in a single struct-declaration-list
1508 </ul>
1510 <h6>footnotes</h6>
1511 <p><small><a name="note13" href="#note13">13)</a> Implementations should avoid imposing fixed translation limits whenever possible.
1512 </small>
1513 <p><small><a name="note14" href="#note14">14)</a> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
1514 </small>
1516 <h5><a name="5.2.4.2" href="#5.2.4.2">5.2.4.2 Numerical limits</a></h5>
1517 <p><!--para 1 -->
1518 An implementation is required to document all the limits specified in this subclause,
1519 which are specified in the headers <a href="#7.10">&lt;limits.h&gt;</a> and <a href="#7.7">&lt;float.h&gt;</a>. Additional limits are
1520 specified in <a href="#7.18">&lt;stdint.h&gt;</a>.
1521 <p><b> Forward references</b>: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>).
1523 <h5><a name="5.2.4.2.1" href="#5.2.4.2.1">5.2.4.2.1 Sizes of integer types <limits.h></a></h5>
1524 <p><!--para 1 -->
1525 The values given below shall be replaced by constant expressions suitable for use in #if
1526 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
1527 following shall be replaced by expressions that have the same type as would an
1528 expression that is an object of the corresponding type converted according to the integer
1529 promotions. Their implementation-defined values shall be equal or greater in magnitude
1532 <!--page 34 -->
1533 (absolute value) to those shown, with the same sign.
1534 <ul>
1535 <li> number of bits for smallest object that is not a bit-field (byte)
1536 <pre>
1537 CHAR_BIT 8
1538 </pre>
1539 <li> minimum value for an object of type signed char
1540 <pre>
1541 SCHAR_MIN -127 // -(2<sup>7</sup> - 1)
1542 </pre>
1543 <li> maximum value for an object of type signed char
1544 <pre>
1545 SCHAR_MAX +127 // 2<sup>7</sup> - 1
1546 </pre>
1547 <li> maximum value for an object of type unsigned char
1548 <pre>
1549 UCHAR_MAX 255 // 2<sup>8</sup> - 1
1550 </pre>
1551 <li> minimum value for an object of type char
1552 <pre>
1553 CHAR_MIN see below
1554 </pre>
1555 <li> maximum value for an object of type char
1556 <pre>
1557 CHAR_MAX see below
1558 </pre>
1559 <li> maximum number of bytes in a multibyte character, for any supported locale
1560 <pre>
1561 MB_LEN_MAX 1
1562 </pre>
1563 <li> minimum value for an object of type short int
1564 <pre>
1565 SHRT_MIN -32767 // -(2<sup>15</sup> - 1)
1566 </pre>
1567 <li> maximum value for an object of type short int
1568 <pre>
1569 SHRT_MAX +32767 // 2<sup>15</sup> - 1
1570 </pre>
1571 <li> maximum value for an object of type unsigned short int
1572 <pre>
1573 USHRT_MAX 65535 // 2<sup>16</sup> - 1
1574 </pre>
1575 <li> minimum value for an object of type int
1576 <pre>
1577 INT_MIN -32767 // -(2<sup>15</sup> - 1)
1578 </pre>
1579 <li> maximum value for an object of type int
1580 <pre>
1581 INT_MAX +32767 // 2<sup>15</sup> - 1
1582 </pre>
1583 <li> maximum value for an object of type unsigned int
1584 <pre>
1585 UINT_MAX 65535 // 2<sup>16</sup> - 1
1586 </pre>
1587 <li> minimum value for an object of type long int
1588 <pre>
1589 LONG_MIN -2147483647 // -(2<sup>31</sup> - 1)
1590 </pre>
1591 <li> maximum value for an object of type long int
1592 <pre>
1593 LONG_MAX +2147483647 // 2<sup>31</sup> - 1
1594 </pre>
1595 <li> maximum value for an object of type unsigned long int
1596 <pre>
1597 ULONG_MAX 4294967295 // 2<sup>32</sup> - 1
1598 </pre>
1599 <!--page 35 -->
1600 <li> minimum value for an object of type long long int
1601 <pre>
1602 LLONG_MIN -9223372036854775807 // -(2<sup>63</sup> - 1)
1603 </pre>
1604 <li> maximum value for an object of type long long int
1605 <pre>
1606 LLONG_MAX +9223372036854775807 // 2<sup>63</sup> - 1
1607 </pre>
1608 <li> maximum value for an object of type unsigned long long int
1609 <pre>
1610 ULLONG_MAX 18446744073709551615 // 2<sup>64</sup> - 1
1611 </pre>
1612 </ul>
1613 <p><!--para 2 -->
1614 If the value of an object of type char is treated as a signed integer when used in an
1615 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
1616 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
1617 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
1618 UCHAR_MAX.<sup><a href="#note15"><b>15)</b></a></sup> The value UCHAR_MAX shall equal 2<sup>CHAR_BIT</sup> - 1.
1619 <p><b> Forward references</b>: representations of types (<a href="#6.2.6">6.2.6</a>), conditional inclusion (<a href="#6.10.1">6.10.1</a>).
1621 <h6>footnotes</h6>
1622 <p><small><a name="note15" href="#note15">15)</a> See <a href="#6.2.5">6.2.5</a>.
1623 </small>
1625 <h5><a name="5.2.4.2.2" href="#5.2.4.2.2">5.2.4.2.2 Characteristics of floating types <float.h></a></h5>
1626 <p><!--para 1 -->
1627 The characteristics of floating types are defined in terms of a model that describes a
1628 representation of floating-point numbers and values that provide information about an
1629 implementation's floating-point arithmetic.<sup><a href="#note16"><b>16)</b></a></sup> The following parameters are used to
1630 define the model for each floating-point type:
1631 <p><!--para 2 -->
1632 <pre>
1633 s sign ((+-)1)
1634 b base or radix of exponent representation (an integer &gt; 1)
1635 e exponent (an integer between a minimum emin and a maximum emax )
1636 p precision (the number of base-b digits in the significand)
1637 f<sub>k</sub> nonnegative integers less than b (the significand digits)
1638 </pre>
1639 A floating-point number (x) is defined by the following model:
1640 <pre>
1642 x = s b<sup>e</sup> (Sum) f<sub>k</sub> b<sup>-k</sup> , emin &lt;= e &lt;= emax
1644 </pre>
1646 <p><!--para 3 -->
1647 In addition to normalized floating-point numbers ( f<sub>1</sub> &gt; 0 if x != 0), floating types may be
1648 able to contain other kinds of floating-point numbers, such as subnormal floating-point
1649 numbers (x != 0, e = emin , f<sub>1</sub> = 0) and unnormalized floating-point numbers (x != 0,
1650 e &gt; emin , f<sub>1</sub> = 0), and values that are not floating-point numbers, such as infinities and
1651 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
1652 through almost every arithmetic operation without raising a floating-point exception; a
1653 signaling NaN generally raises a floating-point exception when occurring as an
1656 <!--page 36 -->
1657 arithmetic operand.<sup><a href="#note17"><b>17)</b></a></sup>
1658 <p><!--para 4 -->
1659 An implementation may give zero and non-numeric values (such as infinities and NaNs) a
1660 sign or may leave them unsigned. Wherever such values are unsigned, any requirement
1661 in this International Standard to retrieve the sign shall produce an unspecified sign, and
1662 any requirement to set the sign shall be ignored.
1663 <p><!--para 5 -->
1664 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
1665 <a href="#7.12">&lt;math.h&gt;</a> and <a href="#7.3">&lt;complex.h&gt;</a> that return floating-point results is implementation-
1666 defined, as is the accuracy of the conversion between floating-point internal
1667 representations and string representations performed by the library functions in
1668 <a href="#7.19">&lt;stdio.h&gt;</a>, <a href="#7.20">&lt;stdlib.h&gt;</a>, and <a href="#7.24">&lt;wchar.h&gt;</a>. The implementation may state that the
1669 accuracy is unknown.
1670 <p><!--para 6 -->
1671 All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
1672 expressions suitable for use in #if preprocessing directives; all floating values shall be
1673 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
1674 and FLT_ROUNDS have separate names for all three floating-point types. The floating-point
1675 model representation is provided for all values except FLT_EVAL_METHOD and
1676 FLT_ROUNDS.
1677 <p><!--para 7 -->
1678 The rounding mode for floating-point addition is characterized by the implementation-
1679 defined value of FLT_ROUNDS:<sup><a href="#note18"><b>18)</b></a></sup>
1680 <pre>
1681 -1 indeterminable
1682 0 toward zero
1683 1 to nearest
1684 2 toward positive infinity
1685 3 toward negative infinity
1686 </pre>
1687 All other values for FLT_ROUNDS characterize implementation-defined rounding
1688 behavior.
1689 <p><!--para 8 -->
1690 Except for assignment and cast (which remove all extra range and precision), the values
1691 of operations with floating operands and values subject to the usual arithmetic
1692 conversions and of floating constants are evaluated to a format whose range and precision
1693 may be greater than required by the type. The use of evaluation formats is characterized
1694 by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note19"><b>19)</b></a></sup>
1698 <!--page 37 -->
1699 <pre>
1700 -1 indeterminable;
1701 0 evaluate all operations and constants just to the range and precision of the
1702 type;
1703 1 evaluate operations and constants of type float and double to the
1704 range and precision of the double type, evaluate long double
1705 operations and constants to the range and precision of the long double
1706 type;
1707 2 evaluate all operations and constants to the range and precision of the
1708 long double type.
1709 </pre>
1710 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
1711 behavior.
1712 <p><!--para 9 -->
1713 The values given in the following list shall be replaced by constant expressions with
1714 implementation-defined values that are greater or equal in magnitude (absolute value) to
1715 those shown, with the same sign:
1716 <ul>
1717 <li> radix of exponent representation, b
1718 <pre>
1719 FLT_RADIX 2
1720 </pre>
1721 <li> number of base-FLT_RADIX digits in the floating-point significand, p
1722 <pre>
1723 FLT_MANT_DIG
1724 DBL_MANT_DIG
1725 LDBL_MANT_DIG
1726 </pre>
1727 <li> number of decimal digits, n, such that any floating-point number in the widest
1728 supported floating type with pmax radix b digits can be rounded to a floating-point
1729 number with n decimal digits and back again without change to the value,
1730 <pre>
1731 { pmax log10 b if b is a power of 10
1733 { [^1 + pmax log10 b^] otherwise
1734 </pre>
1735 <pre>
1736 DECIMAL_DIG 10
1737 </pre>
1738 <li> number of decimal digits, q, such that any floating-point number with q decimal digits
1739 can be rounded into a floating-point number with p radix b digits and back again
1740 without change to the q decimal digits,
1745 <!--page 38 -->
1746 <pre>
1747 { p log10 b if b is a power of 10
1749 { [_( p - 1) log10 b_] otherwise
1750 </pre>
1751 <pre>
1752 FLT_DIG 6
1753 DBL_DIG 10
1754 LDBL_DIG 10
1755 </pre>
1756 <li> minimum negative integer such that FLT_RADIX raised to one less than that power is
1757 a normalized floating-point number, emin
1758 <pre>
1759 FLT_MIN_EXP
1760 DBL_MIN_EXP
1761 LDBL_MIN_EXP
1762 </pre>
1763 <li> minimum negative integer such that 10 raised to that power is in the range of
1764 normalized floating-point numbers, [^log10 b<sup>emin -1</sup>^]
1765 <pre>
1766 FLT_MIN_10_EXP -37
1767 DBL_MIN_10_EXP -37
1768 LDBL_MIN_10_EXP -37
1769 </pre>
1770 <li> maximum integer such that FLT_RADIX raised to one less than that power is a
1771 representable finite floating-point number, emax
1772 <pre>
1773 FLT_MAX_EXP
1774 DBL_MAX_EXP
1775 LDBL_MAX_EXP
1776 </pre>
1777 <li> maximum integer such that 10 raised to that power is in the range of representable
1778 finite floating-point numbers, [_log10 ((1 - b<sup>-p</sup>)b<sup>emax</sup>)_]
1779 <pre>
1780 FLT_MAX_10_EXP +37
1781 DBL_MAX_10_EXP +37
1782 LDBL_MAX_10_EXP +37
1783 </pre>
1784 </ul>
1785 <p><!--para 10 -->
1786 The values given in the following list shall be replaced by constant expressions with
1787 implementation-defined values that are greater than or equal to those shown:
1788 <ul>
1789 <li> maximum representable finite floating-point number, (1 - b<sup>-p</sup>)b<sup>emax</sup>
1790 <pre>
1791 FLT_MAX 1E+37
1792 DBL_MAX 1E+37
1793 LDBL_MAX 1E+37
1794 </pre>
1795 </ul>
1796 <p><!--para 11 -->
1797 The values given in the following list shall be replaced by constant expressions with
1798 implementation-defined (positive) values that are less than or equal to those shown:
1799 <ul>
1800 <li> the difference between 1 and the least value greater than 1 that is representable in the
1801 given floating point type, b<sup>1-p</sup>
1802 <!--page 39 -->
1803 <pre>
1804 FLT_EPSILON 1E-5
1805 DBL_EPSILON 1E-9
1806 LDBL_EPSILON 1E-9
1807 </pre>
1808 <li> minimum normalized positive floating-point number, b<sup>emin -1</sup>
1809 <pre>
1810 FLT_MIN 1E-37
1811 DBL_MIN 1E-37
1812 LDBL_MIN 1E-37
1813 </pre>
1814 </ul>
1815 <h6>Recommended practice</h6>
1816 <p><!--para 12 -->
1817 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
1818 should be the identity function.
1819 <p><!--para 13 -->
1820 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
1821 requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
1822 float:
1823 <pre>
1825 x = s 16<sup>e</sup> (Sum) f<sub>k</sub> 16<sup>-k</sup> , -31 &lt;= e &lt;= +32
1827 </pre>
1829 <pre>
1830 FLT_RADIX 16
1831 FLT_MANT_DIG 6
1832 FLT_EPSILON 9.53674316E-07F
1833 FLT_DIG 6
1834 FLT_MIN_EXP -31
1835 FLT_MIN 2.93873588E-39F
1836 FLT_MIN_10_EXP -38
1837 FLT_MAX_EXP +32
1838 FLT_MAX 3.40282347E+38F
1839 FLT_MAX_10_EXP +38
1840 </pre>
1842 <p><!--para 14 -->
1843 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
1844 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
1845 <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
1846 <pre>
1848 xf = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -125 &lt;= e &lt;= +128
1850 </pre>
1852 <pre>
1854 xd = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -1021 &lt;= e &lt;= +1024
1856 </pre>
1859 <pre>
1860 FLT_RADIX 2
1861 DECIMAL_DIG 17
1862 FLT_MANT_DIG 24
1863 FLT_EPSILON 1.19209290E-07F // decimal constant
1864 FLT_EPSILON 0X1P-23F // hex constant
1865 </pre>
1868 <!--page 40 -->
1869 <pre>
1870 FLT_DIG 6
1871 FLT_MIN_EXP -125
1872 FLT_MIN 1.17549435E-38F // decimal constant
1873 FLT_MIN 0X1P-126F // hex constant
1874 FLT_MIN_10_EXP -37
1875 FLT_MAX_EXP +128
1876 FLT_MAX 3.40282347E+38F // decimal constant
1877 FLT_MAX 0X1.fffffeP127F // hex constant
1878 FLT_MAX_10_EXP +38
1879 DBL_MANT_DIG 53
1880 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
1881 DBL_EPSILON 0X1P-52 // hex constant
1882 DBL_DIG 15
1883 DBL_MIN_EXP -1021
1884 DBL_MIN 2.2250738585072014E-308 // decimal constant
1885 DBL_MIN 0X1P-1022 // hex constant
1886 DBL_MIN_10_EXP -307
1887 DBL_MAX_EXP +1024
1888 DBL_MAX 1.7976931348623157E+308 // decimal constant
1889 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
1890 DBL_MAX_10_EXP +308
1891 </pre>
1892 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
1893 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
1894 precision), then DECIMAL_DIG would be 21.
1896 <p><b> Forward references</b>: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
1897 <a href="#7.3">&lt;complex.h&gt;</a> (<a href="#7.3">7.3</a>), extended multibyte and wide character utilities <a href="#7.24">&lt;wchar.h&gt;</a>
1898 (<a href="#7.24">7.24</a>), floating-point environment <a href="#7.6">&lt;fenv.h&gt;</a> (<a href="#7.6">7.6</a>), general utilities <a href="#7.20">&lt;stdlib.h&gt;</a>
1899 (<a href="#7.20">7.20</a>), input/output <a href="#7.19">&lt;stdio.h&gt;</a> (<a href="#7.19">7.19</a>), mathematics <a href="#7.12">&lt;math.h&gt;</a> (<a href="#7.12">7.12</a>).
1900 <!--page 41 -->
1902 <h6>footnotes</h6>
1903 <p><small><a name="note16" href="#note16">16)</a> The floating-point model is intended to clarify the description of each floating-point characteristic and
1904 does not require the floating-point arithmetic of the implementation to be identical.
1905 </small>
1906 <p><small><a name="note17" href="#note17">17)</a> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
1907 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
1908 similar behavior.
1909 </small>
1910 <p><small><a name="note18" href="#note18">18)</a> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
1911 the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
1912 </small>
1913 <p><small><a name="note19" href="#note19">19)</a> The evaluation method determines evaluation formats of expressions involving all floating types, not
1914 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
1915 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
1916 double.
1917 </small>
1918 <p><small><a name="note20" href="#note20">20)</a> The floating-point model in that standard sums powers of b from zero, so the values of the exponent
1919 limits are one less than shown here.
1920 </small>
1922 <h2><a name="6" href="#6">6. Language</a></h2>
1924 <h3><a name="6.1" href="#6.1">6.1 Notation</a></h3>
1925 <p><!--para 1 -->
1926 In the syntax notation used in this clause, syntactic categories (nonterminals) are
1927 indicated by italic type, and literal words and character set members (terminals) by bold
1928 type. A colon (:) following a nonterminal introduces its definition. Alternative
1929 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
1930 optional symbol is indicated by the subscript ''opt'', so that
1931 <pre>
1932 { expression<sub>opt</sub> }
1933 </pre>
1934 indicates an optional expression enclosed in braces.
1935 <p><!--para 2 -->
1936 When syntactic categories are referred to in the main text, they are not italicized and
1937 words are separated by spaces instead of hyphens.
1938 <p><!--para 3 -->
1939 A summary of the language syntax is given in <a href="#A">annex A</a>.
1941 <h3><a name="6.2" href="#6.2">6.2 Concepts</a></h3>
1943 <h4><a name="6.2.1" href="#6.2.1">6.2.1 Scopes of identifiers</a></h4>
1944 <p><!--para 1 -->
1945 An identifier can denote an object; a function; a tag or a member of a structure, union, or
1946 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
1947 same identifier can denote different entities at different points in the program. A member
1948 of an enumeration is called an enumeration constant. Macro names and macro
1949 parameters are not considered further here, because prior to the semantic phase of
1950 program translation any occurrences of macro names in the source file are replaced by the
1951 preprocessing token sequences that constitute their macro definitions.
1952 <p><!--para 2 -->
1953 For each different entity that an identifier designates, the identifier is visible (i.e., can be
1954 used) only within a region of program text called its scope. Different entities designated
1955 by the same identifier either have different scopes, or are in different name spaces. There
1956 are four kinds of scopes: function, file, block, and function prototype. (A function
1957 prototype is a declaration of a function that declares the types of its parameters.)
1958 <p><!--para 3 -->
1959 A label name is the only kind of identifier that has function scope. It can be used (in a
1960 goto statement) anywhere in the function in which it appears, and is declared implicitly
1961 by its syntactic appearance (followed by a : and a statement).
1962 <p><!--para 4 -->
1963 Every other identifier has scope determined by the placement of its declaration (in a
1964 declarator or type specifier). If the declarator or type specifier that declares the identifier
1965 appears outside of any block or list of parameters, the identifier has file scope, which
1966 terminates at the end of the translation unit. If the declarator or type specifier that
1967 declares the identifier appears inside a block or within the list of parameter declarations in
1968 a function definition, the identifier has block scope, which terminates at the end of the
1969 associated block. If the declarator or type specifier that declares the identifier appears
1970 <!--page 42 -->
1971 within the list of parameter declarations in a function prototype (not part of a function
1972 definition), the identifier has function prototype scope, which terminates at the end of the
1973 function declarator. If an identifier designates two different entities in the same name
1974 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will be a
1975 strict subset of the scope of the other entity (the outer scope). Within the inner scope, the
1976 identifier designates the entity declared in the inner scope; the entity declared in the outer
1977 scope is hidden (and not visible) within the inner scope.
1978 <p><!--para 5 -->
1979 Unless explicitly stated otherwise, where this International Standard uses the term
1980 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
1981 entity in the relevant name space whose declaration is visible at the point the identifier
1982 occurs.
1983 <p><!--para 6 -->
1984 Two identifiers have the same scope if and only if their scopes terminate at the same
1985 point.
1986 <p><!--para 7 -->
1987 Structure, union, and enumeration tags have scope that begins just after the appearance of
1988 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
1989 begins just after the appearance of its defining enumerator in an enumerator list. Any
1990 other identifier has scope that begins just after the completion of its declarator.
1991 <p><b> Forward references</b>: declarations (<a href="#6.7">6.7</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), function definitions
1992 (<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>),
1993 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
1995 <h4><a name="6.2.2" href="#6.2.2">6.2.2 Linkages of identifiers</a></h4>
1996 <p><!--para 1 -->
1997 An identifier declared in different scopes or in the same scope more than once can be
1998 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
1999 three kinds of linkage: external, internal, and none.
2000 <p><!--para 2 -->
2001 In the set of translation units and libraries that constitutes an entire program, each
2002 declaration of a particular identifier with external linkage denotes the same object or
2003 function. Within one translation unit, each declaration of an identifier with internal
2004 linkage denotes the same object or function. Each declaration of an identifier with no
2005 linkage denotes a unique entity.
2006 <p><!--para 3 -->
2007 If the declaration of a file scope identifier for an object or a function contains the storage-
2008 class specifier static, the identifier has internal linkage.<sup><a href="#note22"><b>22)</b></a></sup>
2009 <p><!--para 4 -->
2010 For an identifier declared with the storage-class specifier extern in a scope in which a
2014 <!--page 43 -->
2015 prior declaration of that identifier is visible,<sup><a href="#note23"><b>23)</b></a></sup> if the prior declaration specifies internal or
2016 external linkage, the linkage of the identifier at the later declaration is the same as the
2017 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
2018 declaration specifies no linkage, then the identifier has external linkage.
2019 <p><!--para 5 -->
2020 If the declaration of an identifier for a function has no storage-class specifier, its linkage
2021 is determined exactly as if it were declared with the storage-class specifier extern. If
2022 the declaration of an identifier for an object has file scope and no storage-class specifier,
2023 its linkage is external.
2024 <p><!--para 6 -->
2025 The following identifiers have no linkage: an identifier declared to be anything other than
2026 an object or a function; an identifier declared to be a function parameter; a block scope
2027 identifier for an object declared without the storage-class specifier extern.
2028 <p><!--para 7 -->
2029 If, within a translation unit, the same identifier appears with both internal and external
2030 linkage, the behavior is undefined.
2031 <p><b> Forward references</b>: 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>),
2032 statements (<a href="#6.8">6.8</a>).
2034 <h6>footnotes</h6>
2035 <p><small><a name="note21" href="#note21">21)</a> There is no linkage between different identifiers.
2036 </small>
2037 <p><small><a name="note22" href="#note22">22)</a> A function declaration can contain the storage-class specifier static only if it is at file scope; see
2038 <a href="#6.7.1">6.7.1</a>.
2039 </small>
2040 <p><small><a name="note23" href="#note23">23)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2041 </small>
2043 <h4><a name="6.2.3" href="#6.2.3">6.2.3 Name spaces of identifiers</a></h4>
2044 <p><!--para 1 -->
2045 If more than one declaration of a particular identifier is visible at any point in a
2046 translation unit, the syntactic context disambiguates uses that refer to different entities.
2047 Thus, there are separate name spaces for various categories of identifiers, as follows:
2048 <ul>
2049 <li> label names (disambiguated by the syntax of the label declaration and use);
2050 <li> the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note24"><b>24)</b></a></sup>
2051 of the keywords struct, union, or enum);
2052 <li> the members of structures or unions; each structure or union has a separate name
2053 space for its members (disambiguated by the type of the expression used to access the
2054 member via the . or -&gt; operator);
2055 <li> all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
2056 enumeration constants).
2057 </ul>
2058 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), labeled statements (<a href="#6.8.1">6.8.1</a>),
2059 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
2060 (<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>).
2065 <!--page 44 -->
2067 <h6>footnotes</h6>
2068 <p><small><a name="note24" href="#note24">24)</a> There is only one name space for tags even though three are possible.
2069 </small>
2071 <h4><a name="6.2.4" href="#6.2.4">6.2.4 Storage durations of objects</a></h4>
2072 <p><!--para 1 -->
2073 An object has a storage duration that determines its lifetime. There are three storage
2074 durations: static, automatic, and allocated. Allocated storage is described in <a href="#7.20.3">7.20.3</a>.
2075 <p><!--para 2 -->
2076 The lifetime of an object is the portion of program execution during which storage is
2077 guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note25"><b>25)</b></a></sup> and retains
2078 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
2079 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
2080 the object it points to reaches the end of its lifetime.
2081 <p><!--para 3 -->
2082 An object whose identifier is declared with external or internal linkage, or with the
2083 storage-class specifier static has static storage duration. Its lifetime is the entire
2084 execution of the program and its stored value is initialized only once, prior to program
2085 startup.
2086 <p><!--para 4 -->
2087 An object whose identifier is declared with no linkage and without the storage-class
2088 specifier static has automatic storage duration.
2089 <p><!--para 5 -->
2090 For such an object that does not have a variable length array type, its lifetime extends
2091 from entry into the block with which it is associated until execution of that block ends in
2092 any way. (Entering an enclosed block or calling a function suspends, but does not end,
2093 execution of the current block.) If the block is entered recursively, a new instance of the
2094 object is created each time. The initial value of the object is indeterminate. If an
2095 initialization is specified for the object, it is performed each time the declaration is
2096 reached in the execution of the block; otherwise, the value becomes indeterminate each
2097 time the declaration is reached.
2098 <p><!--para 6 -->
2099 For such an object that does have a variable length array type, its lifetime extends from
2100 the declaration of the object until execution of the program leaves the scope of the
2101 declaration.<sup><a href="#note27"><b>27)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
2102 each time. The initial value of the object is indeterminate.
2103 <p><b> Forward references</b>: 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
2104 declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
2109 <!--page 45 -->
2111 <h6>footnotes</h6>
2112 <p><small><a name="note25" href="#note25">25)</a> The term ''constant address'' means that two pointers to the object constructed at possibly different
2113 times will compare equal. The address may be different during two different executions of the same
2114 program.
2115 </small>
2116 <p><small><a name="note26" href="#note26">26)</a> In the case of a volatile object, the last store need not be explicit in the program.
2117 </small>
2118 <p><small><a name="note27" href="#note27">27)</a> Leaving the innermost block containing the declaration, or jumping to a point in that block or an
2119 embedded block prior to the declaration, leaves the scope of the declaration.
2120 </small>
2122 <h4><a name="6.2.5" href="#6.2.5">6.2.5 Types</a></h4>
2123 <p><!--para 1 -->
2124 The meaning of a value stored in an object or returned by a function is determined by the
2125 type of the expression used to access it. (An identifier declared to be an object is the
2126 simplest such expression; the type is specified in the declaration of the identifier.) Types
2127 are partitioned into object types (types that fully describe objects), function types (types
2128 that describe functions), and incomplete types (types that describe objects but lack
2129 information needed to determine their sizes).
2130 <p><!--para 2 -->
2131 An object declared as type _Bool is large enough to store the values 0 and 1.
2132 <p><!--para 3 -->
2133 An object declared as type char is large enough to store any member of the basic
2134 execution character set. If a member of the basic execution character set is stored in a
2135 char object, its value is guaranteed to be nonnegative. If any other character is stored in
2136 a char object, the resulting value is implementation-defined but shall be within the range
2137 of values that can be represented in that type.
2138 <p><!--para 4 -->
2139 There are five standard signed integer types, designated as signed char, short
2140 int, int, long int, and long long int. (These and other types may be
2141 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
2142 implementation-defined extended signed integer types.<sup><a href="#note28"><b>28)</b></a></sup> The standard and extended
2143 signed integer types are collectively called signed integer types.<sup><a href="#note29"><b>29)</b></a></sup>
2144 <p><!--para 5 -->
2145 An object declared as type signed char occupies the same amount of storage as a
2146 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
2147 architecture of the execution environment (large enough to contain any value in the range
2148 INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
2149 <p><!--para 6 -->
2150 For each of the signed integer types, there is a corresponding (but different) unsigned
2151 integer type (designated with the keyword unsigned) that uses the same amount of
2152 storage (including sign information) and has the same alignment requirements. The type
2153 _Bool and the unsigned integer types that correspond to the standard signed integer
2154 types are the standard unsigned integer types. The unsigned integer types that
2155 correspond to the extended signed integer types are the extended unsigned integer types.
2156 The standard and extended unsigned integer types are collectively called unsigned integer
2157 types.<sup><a href="#note30"><b>30)</b></a></sup>
2161 <!--page 46 -->
2162 <p><!--para 7 -->
2163 The standard signed integer types and standard unsigned integer types are collectively
2164 called the standard integer types, the extended signed integer types and extended
2165 unsigned integer types are collectively called the extended integer types.
2166 <p><!--para 8 -->
2167 For any two integer types with the same signedness and different integer conversion rank
2168 (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
2169 subrange of the values of the other type.
2170 <p><!--para 9 -->
2171 The range of nonnegative values of a signed integer type is a subrange of the
2172 corresponding unsigned integer type, and the representation of the same value in each
2173 type is the same.<sup><a href="#note31"><b>31)</b></a></sup> A computation involving unsigned operands can never overflow,
2174 because a result that cannot be represented by the resulting unsigned integer type is
2175 reduced modulo the number that is one greater than the largest value that can be
2176 represented by the resulting type.
2177 <p><!--para 10 -->
2178 There are three real floating types, designated as float, double, and long
2179 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
2180 type double; the set of values of the type double is a subset of the set of values of the
2181 type long double.
2182 <p><!--para 11 -->
2183 There are three complex types, designated as float _Complex, double
2184 _Complex, and long double _Complex.<sup><a href="#note33"><b>33)</b></a></sup> The real floating and complex types
2185 are collectively called the floating types.
2186 <p><!--para 12 -->
2187 For each floating type there is a corresponding real type, which is always a real floating
2188 type. For real floating types, it is the same type. For complex types, it is the type given
2189 by deleting the keyword _Complex from the type name.
2190 <p><!--para 13 -->
2191 Each complex type has the same representation and alignment requirements as an array
2192 type containing exactly two elements of the corresponding real type; the first element is
2193 equal to the real part, and the second element to the imaginary part, of the complex
2194 number.
2195 <p><!--para 14 -->
2196 The type char, the signed and unsigned integer types, and the floating types are
2197 collectively called the basic types. Even if the implementation defines two or more basic
2198 types to have the same representation, they are nevertheless different types.<sup><a href="#note34"><b>34)</b></a></sup>
2200 <!--page 47 -->
2201 <p><!--para 15 -->
2202 The three types char, signed char, and unsigned char are collectively called
2203 the character types. The implementation shall define char to have the same range,
2204 representation, and behavior as either signed char or unsigned char.<sup><a href="#note35"><b>35)</b></a></sup>
2205 <p><!--para 16 -->
2206 An enumeration comprises a set of named integer constant values. Each distinct
2207 enumeration constitutes a different enumerated type.
2208 <p><!--para 17 -->
2209 The type char, the signed and unsigned integer types, and the enumerated types are
2210 collectively called integer types. The integer and real floating types are collectively called
2211 real types.
2212 <p><!--para 18 -->
2213 Integer and floating types are collectively called arithmetic types. Each arithmetic type
2214 belongs to one type domain: the real type domain comprises the real types, the complex
2215 type domain comprises the complex types.
2216 <p><!--para 19 -->
2217 The void type comprises an empty set of values; it is an incomplete type that cannot be
2218 completed.
2219 <p><!--para 20 -->
2220 Any number of derived types can be constructed from the object, function, and
2221 incomplete types, as follows:
2222 <ul>
2223 <li> An array type describes a contiguously allocated nonempty set of objects with a
2224 particular member object type, called the element type.<sup><a href="#note36"><b>36)</b></a></sup> Array types are
2225 characterized by their element type and by the number of elements in the array. An
2226 array type is said to be derived from its element type, and if its element type is T , the
2227 array type is sometimes called ''array of T ''. The construction of an array type from
2228 an element type is called ''array type derivation''.
2229 <li> A structure type describes a sequentially allocated nonempty set of member objects
2230 (and, in certain circumstances, an incomplete array), each of which has an optionally
2231 specified name and possibly distinct type.
2232 <li> A union type describes an overlapping nonempty set of member objects, each of
2233 which has an optionally specified name and possibly distinct type.
2234 <li> A function type describes a function with specified return type. A function type is
2235 characterized by its return type and the number and types of its parameters. A
2236 function type is said to be derived from its return type, and if its return type is T , the
2237 function type is sometimes called ''function returning T ''. The construction of a
2238 function type from a return type is called ''function type derivation''.
2242 <!--page 48 -->
2243 <li> A pointer type may be derived from a function type, an object type, or an incomplete
2244 type, called the referenced type. A pointer type describes an object whose value
2245 provides a reference to an entity of the referenced type. A pointer type derived from
2246 the referenced type T is sometimes called ''pointer to T ''. The construction of a
2247 pointer type from a referenced type is called ''pointer type derivation''.
2248 </ul>
2249 These methods of constructing derived types can be applied recursively.
2250 <p><!--para 21 -->
2251 Arithmetic types and pointer types are collectively called scalar types. Array and
2252 structure types are collectively called aggregate types.<sup><a href="#note37"><b>37)</b></a></sup>
2253 <p><!--para 22 -->
2254 An array type of unknown size is an incomplete type. It is completed, for an identifier of
2255 that type, by specifying the size in a later declaration (with internal or external linkage).
2256 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
2257 type. It is completed, for all declarations of that type, by declaring the same structure or
2258 union tag with its defining content later in the same scope.
2259 <p><!--para 23 -->
2260 A type has known constant size if the type is not incomplete and is not a variable length
2261 array type.
2262 <p><!--para 24 -->
2263 Array, function, and pointer types are collectively called derived declarator types. A
2264 declarator type derivation from a type T is the construction of a derived declarator type
2265 from T by the application of an array-type, a function-type, or a pointer-type derivation to
2267 <p><!--para 25 -->
2268 A type is characterized by its type category, which is either the outermost derivation of a
2269 derived type (as noted above in the construction of derived types), or the type itself if the
2270 type consists of no derived types.
2271 <p><!--para 26 -->
2272 Any type so far mentioned is an unqualified type. Each unqualified type has several
2273 qualified versions of its type,<sup><a href="#note38"><b>38)</b></a></sup> corresponding to the combinations of one, two, or all
2274 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
2275 versions of a type are distinct types that belong to the same type category and have the
2276 same representation and alignment requirements.<sup><a href="#note39"><b>39)</b></a></sup> A derived type is not qualified by the
2277 qualifiers (if any) of the type from which it is derived.
2278 <p><!--para 27 -->
2279 A pointer to void shall have the same representation and alignment requirements as a
2280 pointer to a character type.39) Similarly, pointers to qualified or unqualified versions of
2281 compatible types shall have the same representation and alignment requirements. All
2284 <!--page 49 -->
2285 pointers to structure types shall have the same representation and alignment requirements
2286 as each other. All pointers to union types shall have the same representation and
2287 alignment requirements as each other. Pointers to other types need not have the same
2288 representation or alignment requirements.
2289 <p><!--para 28 -->
2290 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
2291 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
2292 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
2293 qualified float'' and is a pointer to a qualified type.
2295 <p><!--para 29 -->
2296 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
2297 function returning struct tag''. The array has length five and the function has a single parameter of type
2298 float. Its type category is array.
2300 <p><b> Forward references</b>: compatible type and composite type (<a href="#6.2.7">6.2.7</a>), declarations (<a href="#6.7">6.7</a>).
2302 <h6>footnotes</h6>
2303 <p><small><a name="note28" href="#note28">28)</a> Implementation-defined keywords shall have the form of an identifier reserved for any use as
2304 described in <a href="#7.1.3">7.1.3</a>.
2305 </small>
2306 <p><small><a name="note29" href="#note29">29)</a> Therefore, any statement in this Standard about signed integer types also applies to the extended
2307 signed integer types.
2308 </small>
2309 <p><small><a name="note30" href="#note30">30)</a> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
2310 unsigned integer types.
2311 </small>
2312 <p><small><a name="note31" href="#note31">31)</a> The same representation and alignment requirements are meant to imply interchangeability as
2313 arguments to functions, return values from functions, and members of unions.
2314 </small>
2315 <p><small><a name="note32" href="#note32">32)</a> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
2316 </small>
2317 <p><small><a name="note33" href="#note33">33)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
2318 </small>
2319 <p><small><a name="note34" href="#note34">34)</a> An implementation may define new keywords that provide alternative ways to designate a basic (or
2320 any other) type; this does not violate the requirement that all basic types be different.
2321 Implementation-defined keywords shall have the form of an identifier reserved for any use as
2322 described in <a href="#7.1.3">7.1.3</a>.
2323 </small>
2324 <p><small><a name="note35" href="#note35">35)</a> CHAR_MIN, defined in <a href="#7.10">&lt;limits.h&gt;</a>, will have one of the values 0 or SCHAR_MIN, and this can be
2325 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
2326 other two and is not compatible with either.
2327 </small>
2328 <p><small><a name="note36" href="#note36">36)</a> Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
2329 </small>
2330 <p><small><a name="note37" href="#note37">37)</a> Note that aggregate type does not include union type because an object with union type can only
2331 contain one member at a time.
2332 </small>
2333 <p><small><a name="note38" href="#note38">38)</a> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
2334 </small>
2335 <p><small><a name="note39" href="#note39">39)</a> The same representation and alignment requirements are meant to imply interchangeability as
2336 arguments to functions, return values from functions, and members of unions.
2337 </small>
2339 <h4><a name="6.2.6" href="#6.2.6">6.2.6 Representations of types</a></h4>
2341 <h5><a name="6.2.6.1" href="#6.2.6.1">6.2.6.1 General</a></h5>
2342 <p><!--para 1 -->
2343 The representations of all types are unspecified except as stated in this subclause.
2344 <p><!--para 2 -->
2345 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
2346 the number, order, and encoding of which are either explicitly specified or
2347 implementation-defined.
2348 <p><!--para 3 -->
2349 Values stored in unsigned bit-fields and objects of type unsigned char shall be
2350 represented using a pure binary notation.<sup><a href="#note40"><b>40)</b></a></sup>
2351 <p><!--para 4 -->
2352 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
2353 bits, where n is the size of an object of that type, in bytes. The value may be copied into
2354 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
2355 called the object representation of the value. Values stored in bit-fields consist of m bits,
2356 where m is the size specified for the bit-field. The object representation is the set of m
2357 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
2358 than NaNs) with the same object representation compare equal, but values that compare
2359 equal may have different object representations.
2360 <p><!--para 5 -->
2361 Certain object representations need not represent a value of the object type. If the stored
2362 value of an object has such a representation and is read by an lvalue expression that does
2363 not have character type, the behavior is undefined. If such a representation is produced
2364 by a side effect that modifies all or any part of the object by an lvalue expression that
2365 does not have character type, the behavior is undefined.<sup><a href="#note41"><b>41)</b></a></sup> Such a representation is called
2367 <!--page 50 -->
2368 a trap representation.
2369 <p><!--para 6 -->
2370 When a value is stored in an object of structure or union type, including in a member
2371 object, the bytes of the object representation that correspond to any padding bytes take
2372 unspecified values.<sup><a href="#note42"><b>42)</b></a></sup> The value of a structure or union object is never a trap
2373 representation, even though the value of a member of the structure or union object may be
2374 a trap representation.
2375 <p><!--para 7 -->
2376 When a value is stored in a member of an object of union type, the bytes of the object
2377 representation that do not correspond to that member but do correspond to other members
2378 take unspecified values.
2379 <p><!--para 8 -->
2380 Where an operator is applied to a value that has more than one object representation,
2381 which object representation is used shall not affect the value of the result.<sup><a href="#note43"><b>43)</b></a></sup> Where a
2382 value is stored in an object using a type that has more than one object representation for
2383 that value, it is unspecified which representation is used, but a trap representation shall
2384 not be generated.
2385 <p><b> Forward references</b>: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), lvalues, arrays, and function
2386 designators (<a href="#6.3.2.1">6.3.2.1</a>).
2388 <h6>footnotes</h6>
2389 <p><small><a name="note40" href="#note40">40)</a> A positional representation for integers that uses the binary digits 0 and 1, in which the values
2390 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
2391 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
2392 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
2393 type unsigned char range from 0 to 2<sup>CHAR_BIT</sup>- 1.
2394 </small>
2395 <p><small><a name="note41" href="#note41">41)</a> Thus, an automatic variable can be initialized to a trap representation without causing undefined
2396 behavior, but the value of the variable cannot be used until a proper value is stored in it.
2397 </small>
2398 <p><small><a name="note42" href="#note42">42)</a> Thus, for example, structure assignment need not copy any padding bits.
2399 </small>
2400 <p><small><a name="note43" href="#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
2401 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
2402 defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
2403 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
2404 on values of type T may distinguish between them.
2405 </small>
2407 <h5><a name="6.2.6.2" href="#6.2.6.2">6.2.6.2 Integer types</a></h5>
2408 <p><!--para 1 -->
2409 For unsigned integer types other than unsigned char, the bits of the object
2410 representation shall be divided into two groups: value bits and padding bits (there need
2411 not be any of the latter). If there are N value bits, each bit shall represent a different
2412 power of 2 between 1 and 2<sup>N-1</sup> , so that objects of that type shall be capable of
2413 representing values from 0 to 2<sup>N</sup> - 1 using a pure binary representation; this shall be
2414 known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note44"><b>44)</b></a></sup>
2415 <p><!--para 2 -->
2416 For signed integer types, the bits of the object representation shall be divided into three
2417 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
2419 <!--page 51 -->
2420 there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as
2421 the same bit in the object representation of the corresponding unsigned type (if there are
2422 M value bits in the signed type and N in the unsigned type, then M &lt;= N ). If the sign bit
2423 is zero, it shall not affect the resulting value. If the sign bit is one, the value shall be
2424 modified in one of the following ways:
2425 <ul>
2426 <li> the corresponding value with sign bit 0 is negated (sign and magnitude);
2427 <li> the sign bit has the value -(2<sup>N</sup> ) (two's complement);
2428 <li> the sign bit has the value -(2<sup>N</sup> - 1) (ones' complement ).
2429 </ul>
2430 Which of these applies is implementation-defined, as is whether the value with sign bit 1
2431 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
2432 complement), is a trap representation or a normal value. In the case of sign and
2433 magnitude and ones' complement, if this representation is a normal value it is called a
2434 negative zero.
2435 <p><!--para 3 -->
2436 If the implementation supports negative zeros, they shall be generated only by:
2437 <ul>
2438 <li> the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with arguments that produce such a value;
2439 <li> the +, -, *, /, and % operators where one argument is a negative zero and the result is
2440 zero;
2441 <li> compound assignment operators based on the above cases.
2442 </ul>
2443 It is unspecified whether these cases actually generate a negative zero or a normal zero,
2444 and whether a negative zero becomes a normal zero when stored in an object.
2445 <p><!--para 4 -->
2446 If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
2447 and &gt;&gt; operators with arguments that would produce such a value is undefined.
2448 <p><!--para 5 -->
2449 The values of any padding bits are unspecified.<sup><a href="#note45"><b>45)</b></a></sup> A valid (non-trap) object representation
2450 of a signed integer type where the sign bit is zero is a valid object representation of the
2451 corresponding unsigned type, and shall represent the same value. For any integer type,
2452 the object representation where all the bits are zero shall be a representation of the value
2453 zero in that type.
2454 <p><!--para 6 -->
2455 The precision of an integer type is the number of bits it uses to represent values,
2456 excluding any sign and padding bits. The width of an integer type is the same but
2457 including any sign bit; thus for unsigned integer types the two values are the same, while
2460 <!--page 52 -->
2461 for signed integer types the width is one greater than the precision.
2463 <h6>footnotes</h6>
2464 <p><small><a name="note44" href="#note44">44)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2465 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2466 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
2467 with unsigned types. All other combinations of padding bits are alternative object representations of
2468 the value specified by the value bits.
2469 </small>
2470 <p><small><a name="note45" href="#note45">45)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2471 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2472 representation other than as part of an exceptional condition such as an overflow. All other
2473 combinations of padding bits are alternative object representations of the value specified by the value
2474 bits.
2475 </small>
2477 <h4><a name="6.2.7" href="#6.2.7">6.2.7 Compatible type and composite type</a></h4>
2478 <p><!--para 1 -->
2479 Two types have compatible type if their types are the same. Additional rules for
2480 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
2481 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,
2482 union, or enumerated types declared in separate translation units are compatible if their
2483 tags and members satisfy the following requirements: If one is declared with a tag, the
2484 other shall be declared with the same tag. If both are complete types, then the following
2485 additional requirements apply: there shall be a one-to-one correspondence between their
2486 members such that each pair of corresponding members are declared with compatible
2487 types, and such that if one member of a corresponding pair is declared with a name, the
2488 other member is declared with the same name. For two structures, corresponding
2489 members shall be declared in the same order. For two structures or unions, corresponding
2490 bit-fields shall have the same widths. For two enumerations, corresponding members
2491 shall have the same values.
2492 <p><!--para 2 -->
2493 All declarations that refer to the same object or function shall have compatible type;
2494 otherwise, the behavior is undefined.
2495 <p><!--para 3 -->
2496 A composite type can be constructed from two types that are compatible; it is a type that
2497 is compatible with both of the two types and satisfies the following conditions:
2498 <ul>
2499 <li> If one type is an array of known constant size, the composite type is an array of that
2500 size; otherwise, if one type is a variable length array, the composite type is that type.
2501 <li> If only one type is a function type with a parameter type list (a function prototype),
2502 the composite type is a function prototype with the parameter type list.
2503 <li> If both types are function types with parameter type lists, the type of each parameter
2504 in the composite parameter type list is the composite type of the corresponding
2505 parameters.
2506 </ul>
2507 These rules apply recursively to the types from which the two types are derived.
2508 <p><!--para 4 -->
2509 For an identifier with internal or external linkage declared in a scope in which a prior
2510 declaration of that identifier is visible,<sup><a href="#note47"><b>47)</b></a></sup> if the prior declaration specifies internal or
2511 external linkage, the type of the identifier at the later declaration becomes the composite
2512 type.
2517 <!--page 53 -->
2518 <p><!--para 5 -->
2519 EXAMPLE Given the following two file scope declarations:
2520 <pre>
2521 int f(int (*)(), double (*)[3]);
2522 int f(int (*)(char *), double (*)[]);
2523 </pre>
2524 The resulting composite type for the function is:
2525 <!--page 54 -->
2526 <pre>
2527 int f(int (*)(char *), double (*)[3]);
2528 </pre>
2530 <h6>footnotes</h6>
2531 <p><small><a name="note46" href="#note46">46)</a> Two types need not be identical to be compatible.
2532 </small>
2533 <p><small><a name="note47" href="#note47">47)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2534 </small>
2536 <h3><a name="6.3" href="#6.3">6.3 Conversions</a></h3>
2537 <p><!--para 1 -->
2538 Several operators convert operand values from one type to another automatically. This
2539 subclause specifies the result required from such an implicit conversion, as well as those
2540 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
2541 the conversions performed by most ordinary operators; it is supplemented as required by
2542 the discussion of each operator in <a href="#6.5">6.5</a>.
2543 <p><!--para 2 -->
2544 Conversion of an operand value to a compatible type causes no change to the value or the
2545 representation.
2546 <p><b> Forward references</b>: cast operators (<a href="#6.5.4">6.5.4</a>).
2548 <h4><a name="6.3.1" href="#6.3.1">6.3.1 Arithmetic operands</a></h4>
2550 <h5><a name="6.3.1.1" href="#6.3.1.1">6.3.1.1 Boolean, characters, and integers</a></h5>
2551 <p><!--para 1 -->
2552 Every integer type has an integer conversion rank defined as follows:
2553 <ul>
2554 <li> No two signed integer types shall have the same rank, even if they have the same
2555 representation.
2556 <li> The rank of a signed integer type shall be greater than the rank of any signed integer
2557 type with less precision.
2558 <li> The rank of long long int shall be greater than the rank of long int, which
2559 shall be greater than the rank of int, which shall be greater than the rank of short
2560 int, which shall be greater than the rank of signed char.
2561 <li> The rank of any unsigned integer type shall equal the rank of the corresponding
2562 signed integer type, if any.
2563 <li> The rank of any standard integer type shall be greater than the rank of any extended
2564 integer type with the same width.
2565 <li> The rank of char shall equal the rank of signed char and unsigned char.
2566 <li> The rank of _Bool shall be less than the rank of all other standard integer types.
2567 <li> The rank of any enumerated type shall equal the rank of the compatible integer type
2568 (see <a href="#6.7.2.2">6.7.2.2</a>).
2569 <li> The rank of any extended signed integer type relative to another extended signed
2570 integer type with the same precision is implementation-defined, but still subject to the
2571 other rules for determining the integer conversion rank.
2572 <li> For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
2573 greater rank than T3, then T1 has greater rank than T3.
2574 </ul>
2575 <p><!--para 2 -->
2576 The following may be used in an expression wherever an int or unsigned int may
2577 be used:
2578 <!--page 55 -->
2579 <ul>
2580 <li> An object or expression with an integer type whose integer conversion rank is less
2581 than or equal to the rank of int and unsigned int.
2582 <li> A bit-field of type _Bool, int, signed int, or unsigned int.
2583 </ul>
2584 If an int can represent all values of the original type, the value is converted to an int;
2585 otherwise, it is converted to an unsigned int. These are called the integer
2586 promotions.<sup><a href="#note48"><b>48)</b></a></sup> All other types are unchanged by the integer promotions.
2587 <p><!--para 3 -->
2588 The integer promotions preserve value including sign. As discussed earlier, whether a
2589 ''plain'' char is treated as signed is implementation-defined.
2590 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
2591 (<a href="#6.7.2.1">6.7.2.1</a>).
2593 <h6>footnotes</h6>
2594 <p><small><a name="note48" href="#note48">48)</a> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
2595 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
2596 shift operators, as specified by their respective subclauses.
2597 </small>
2599 <h5><a name="6.3.1.2" href="#6.3.1.2">6.3.1.2 Boolean type</a></h5>
2600 <p><!--para 1 -->
2601 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
2602 to 0; otherwise, the result is 1.
2604 <h5><a name="6.3.1.3" href="#6.3.1.3">6.3.1.3 Signed and unsigned integers</a></h5>
2605 <p><!--para 1 -->
2606 When a value with integer type is converted to another integer type other than _Bool, if
2607 the value can be represented by the new type, it is unchanged.
2608 <p><!--para 2 -->
2609 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
2610 subtracting one more than the maximum value that can be represented in the new type
2611 until the value is in the range of the new type.<sup><a href="#note49"><b>49)</b></a></sup>
2612 <p><!--para 3 -->
2613 Otherwise, the new type is signed and the value cannot be represented in it; either the
2614 result is implementation-defined or an implementation-defined signal is raised.
2616 <h6>footnotes</h6>
2617 <p><small><a name="note49" href="#note49">49)</a> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
2618 </small>
2620 <h5><a name="6.3.1.4" href="#6.3.1.4">6.3.1.4 Real floating and integer</a></h5>
2621 <p><!--para 1 -->
2622 When a finite value of real floating type is converted to an integer type other than _Bool,
2623 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
2624 the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup>
2625 <p><!--para 2 -->
2626 When a value of integer type is converted to a real floating type, if the value being
2627 converted can be represented exactly in the new type, it is unchanged. If the value being
2628 converted is in the range of values that can be represented but cannot be represented
2630 <!--page 56 -->
2631 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2632 in an implementation-defined manner. If the value being converted is outside the range of
2633 values that can be represented, the behavior is undefined.
2635 <h6>footnotes</h6>
2636 <p><small><a name="note50" href="#note50">50)</a> The remaindering operation performed when a value of integer type is converted to unsigned type
2637 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
2638 range of portable real floating values is (-1, Utype_MAX+1).
2639 </small>
2641 <h5><a name="6.3.1.5" href="#6.3.1.5">6.3.1.5 Real floating types</a></h5>
2642 <p><!--para 1 -->
2643 When a float is promoted to double or long double, or a double is promoted
2644 to long double, its value is unchanged (if the source value is represented in the
2645 precision and range of its type).
2646 <p><!--para 2 -->
2647 When a double is demoted to float, a long double is demoted to double or
2648 float, or a value being represented in greater precision and range than required by its
2649 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
2650 being converted can be represented exactly in the new type, it is unchanged. If the value
2651 being converted is in the range of values that can be represented but cannot be
2652 represented exactly, the result is either the nearest higher or nearest lower representable
2653 value, chosen in an implementation-defined manner. If the value being converted is
2654 outside the range of values that can be represented, the behavior is undefined.
2656 <h5><a name="6.3.1.6" href="#6.3.1.6">6.3.1.6 Complex types</a></h5>
2657 <p><!--para 1 -->
2658 When a value of complex type is converted to another complex type, both the real and
2659 imaginary parts follow the conversion rules for the corresponding real types.
2661 <h5><a name="6.3.1.7" href="#6.3.1.7">6.3.1.7 Real and complex</a></h5>
2662 <p><!--para 1 -->
2663 When a value of real type is converted to a complex type, the real part of the complex
2664 result value is determined by the rules of conversion to the corresponding real type and
2665 the imaginary part of the complex result value is a positive zero or an unsigned zero.
2666 <p><!--para 2 -->
2667 When a value of complex type is converted to a real type, the imaginary part of the
2668 complex value is discarded and the value of the real part is converted according to the
2669 conversion rules for the corresponding real type.
2671 <h5><a name="6.3.1.8" href="#6.3.1.8">6.3.1.8 Usual arithmetic conversions</a></h5>
2672 <p><!--para 1 -->
2673 Many operators that expect operands of arithmetic type cause conversions and yield result
2674 types in a similar way. The purpose is to determine a common real type for the operands
2675 and result. For the specified operands, each operand is converted, without change of type
2676 domain, to a type whose corresponding real type is the common real type. Unless
2677 explicitly stated otherwise, the common real type is also the corresponding real type of
2678 the result, whose type domain is the type domain of the operands if they are the same,
2679 and complex otherwise. This pattern is called the usual arithmetic conversions:
2680 <!--page 57 -->
2681 <p><!--para 2 -->
2682 <ul>
2683 <li> First, if the corresponding real type of either operand is long double, the other
2684 operand is converted, without change of type domain, to a type whose
2685 corresponding real type is long double.
2686 <li> Otherwise, if the corresponding real type of either operand is double, the other
2687 operand is converted, without change of type domain, to a type whose
2688 corresponding real type is double.
2689 <li> Otherwise, if the corresponding real type of either operand is float, the other
2690 operand is converted, without change of type domain, to a type whose
2691 corresponding real type is float.<sup><a href="#note51"><b>51)</b></a></sup>
2692 <li> Otherwise, the integer promotions are performed on both operands. Then the
2693 following rules are applied to the promoted operands:
2694 <ul>
2695 <li> If both operands have the same type, then no further conversion is needed.
2696 <li> Otherwise, if both operands have signed integer types or both have unsigned
2697 integer types, the operand with the type of lesser integer conversion rank is
2698 converted to the type of the operand with greater rank.
2699 <li> Otherwise, if the operand that has unsigned integer type has rank greater or
2700 equal to the rank of the type of the other operand, then the operand with
2701 signed integer type is converted to the type of the operand with unsigned
2702 integer type.
2703 <li> Otherwise, if the type of the operand with signed integer type can represent
2704 all of the values of the type of the operand with unsigned integer type, then
2705 the operand with unsigned integer type is converted to the type of the
2706 operand with signed integer type.
2707 <li> Otherwise, both operands are converted to the unsigned integer type
2708 corresponding to the type of the operand with signed integer type.
2709 </ul>
2710 </ul>
2711 The values of floating operands and of the results of floating expressions may be
2712 represented in greater precision and range than that required by the type; the types are not
2713 changed thereby.<sup><a href="#note52"><b>52)</b></a></sup>
2718 <!--page 58 -->
2720 <h6>footnotes</h6>
2721 <p><small><a name="note51" href="#note51">51)</a> For example, addition of a double _Complex and a float entails just the conversion of the
2722 float operand to double (and yields a double _Complex result).
2723 </small>
2724 <p><small><a name="note52" href="#note52">52)</a> The cast and assignment operators are still required to perform their specified conversions as
2725 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>.
2726 </small>
2728 <h4><a name="6.3.2" href="#6.3.2">6.3.2 Other operands</a></h4>
2730 <h5><a name="6.3.2.1" href="#6.3.2.1">6.3.2.1 Lvalues, arrays, and function designators</a></h5>
2731 <p><!--para 1 -->
2732 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>
2733 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
2734 When an object is said to have a particular type, the type is specified by the lvalue used to
2735 designate the object. A modifiable lvalue is an lvalue that does not have array type, does
2736 not have an incomplete type, does not have a const-qualified type, and if it is a structure
2737 or union, does not have any member (including, recursively, any member or element of
2738 all contained aggregates or unions) with a const-qualified type.
2739 <p><!--para 2 -->
2740 Except when it is the operand of the sizeof operator, the unary &amp; operator, the ++
2741 operator, the -- operator, or the left operand of the . operator or an assignment operator,
2742 an lvalue that does not have array type is converted to the value stored in the designated
2743 object (and is no longer an lvalue). If the lvalue has qualified type, the value has the
2744 unqualified version of the type of the lvalue; otherwise, the value has the type of the
2745 lvalue. If the lvalue has an incomplete type and does not have array type, the behavior is
2746 undefined.
2747 <p><!--para 3 -->
2748 Except when it is the operand of the sizeof operator or the unary &amp; operator, or is a
2749 string literal used to initialize an array, an expression that has type ''array of type'' is
2750 converted to an expression with type ''pointer to type'' that points to the initial element of
2751 the array object and is not an lvalue. If the array object has register storage class, the
2752 behavior is undefined.
2753 <p><!--para 4 -->
2754 A function designator is an expression that has function type. Except when it is the
2755 operand of the sizeof operator<sup><a href="#note54"><b>54)</b></a></sup> or the unary &amp; operator, a function designator with
2756 type ''function returning type'' is converted to an expression that has type ''pointer to
2757 function returning type''.
2758 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
2759 (<a href="#6.5.16">6.5.16</a>), common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), initialization (<a href="#6.7.8">6.7.8</a>), postfix
2760 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2761 (<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>).
2764 <!--page 59 -->
2766 <h6>footnotes</h6>
2767 <p><small><a name="note53" href="#note53">53)</a> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
2768 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
2769 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
2770 as the ''value of an expression''.
2771 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
2772 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
2773 </small>
2774 <p><small><a name="note54" href="#note54">54)</a> Because this conversion does not occur, the operand of the sizeof operator remains a function
2775 designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
2776 </small>
2778 <h5><a name="6.3.2.2" href="#6.3.2.2">6.3.2.2 void</a></h5>
2779 <p><!--para 1 -->
2780 The (nonexistent) value of a void expression (an expression that has type void) shall not
2781 be used in any way, and implicit or explicit conversions (except to void) shall not be
2782 applied to such an expression. If an expression of any other type is evaluated as a void
2783 expression, its value or designator is discarded. (A void expression is evaluated for its
2784 side effects.)
2786 <h5><a name="6.3.2.3" href="#6.3.2.3">6.3.2.3 Pointers</a></h5>
2787 <p><!--para 1 -->
2788 A pointer to void may be converted to or from a pointer to any incomplete or object
2789 type. A pointer to any incomplete or object type may be converted to a pointer to void
2790 and back again; the result shall compare equal to the original pointer.
2791 <p><!--para 2 -->
2792 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
2793 the q-qualified version of the type; the values stored in the original and converted pointers
2794 shall compare equal.
2795 <p><!--para 3 -->
2796 An integer constant expression with the value 0, or such an expression cast to type
2797 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
2798 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
2799 to a pointer to any object or function.
2800 <p><!--para 4 -->
2801 Conversion of a null pointer to another pointer type yields a null pointer of that type.
2802 Any two null pointers shall compare equal.
2803 <p><!--para 5 -->
2804 An integer may be converted to any pointer type. Except as previously specified, the
2805 result is implementation-defined, might not be correctly aligned, might not point to an
2806 entity of the referenced type, and might be a trap representation.<sup><a href="#note56"><b>56)</b></a></sup>
2807 <p><!--para 6 -->
2808 Any pointer type may be converted to an integer type. Except as previously specified, the
2809 result is implementation-defined. If the result cannot be represented in the integer type,
2810 the behavior is undefined. The result need not be in the range of values of any integer
2811 type.
2812 <p><!--para 7 -->
2813 A pointer to an object or incomplete type may be converted to a pointer to a different
2814 object or incomplete type. If the resulting pointer is not correctly aligned<sup><a href="#note57"><b>57)</b></a></sup> for the
2815 pointed-to type, the behavior is undefined. Otherwise, when converted back again, the
2816 result shall compare equal to the original pointer. When a pointer to an object is
2819 <!--page 60 -->
2820 converted to a pointer to a character type, the result points to the lowest addressed byte of
2821 the object. Successive increments of the result, up to the size of the object, yield pointers
2822 to the remaining bytes of the object.
2823 <p><!--para 8 -->
2824 A pointer to a function of one type may be converted to a pointer to a function of another
2825 type and back again; the result shall compare equal to the original pointer. If a converted
2826 pointer is used to call a function whose type is not compatible with the pointed-to type,
2827 the behavior is undefined.
2828 <p><b> Forward references</b>: cast operators (<a href="#6.5.4">6.5.4</a>), equality operators (<a href="#6.5.9">6.5.9</a>), integer types
2829 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>).
2830 <!--page 61 -->
2832 <h6>footnotes</h6>
2833 <p><small><a name="note55" href="#note55">55)</a> The macro NULL is defined in <a href="#7.17">&lt;stddef.h&gt;</a> (and other headers) as a null pointer constant; see <a href="#7.17">7.17</a>.
2834 </small>
2835 <p><small><a name="note56" href="#note56">56)</a> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
2836 be consistent with the addressing structure of the execution environment.
2837 </small>
2838 <p><small><a name="note57" href="#note57">57)</a> In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
2839 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
2840 correctly aligned for a pointer to type C.
2841 </small>
2843 <h3><a name="6.4" href="#6.4">6.4 Lexical elements</a></h3>
2844 <h6>Syntax</h6>
2845 <p><!--para 1 -->
2846 <pre>
2847 token:
2848 keyword
2849 identifier
2850 constant
2851 string-literal
2852 punctuator
2853 preprocessing-token:
2854 header-name
2855 identifier
2856 pp-number
2857 character-constant
2858 string-literal
2859 punctuator
2860 each non-white-space character that cannot be one of the above
2861 </pre>
2862 <h6>Constraints</h6>
2863 <p><!--para 2 -->
2864 Each preprocessing token that is converted to a token shall have the lexical form of a
2865 keyword, an identifier, a constant, a string literal, or a punctuator.
2866 <h6>Semantics</h6>
2867 <p><!--para 3 -->
2868 A token is the minimal lexical element of the language in translation phases 7 and 8. The
2869 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
2870 A preprocessing token is the minimal lexical element of the language in translation
2871 phases 3 through 6. The categories of preprocessing tokens are: header names,
2872 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
2873 single non-white-space characters that do not lexically match the other preprocessing
2874 token categories.<sup><a href="#note58"><b>58)</b></a></sup> If a ' or a " character matches the last category, the behavior is
2875 undefined. Preprocessing tokens can be separated by white space; this consists of
2876 comments (described later), or white-space characters (space, horizontal tab, new-line,
2877 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
2878 during translation phase 4, white space (or the absence thereof) serves as more than
2879 preprocessing token separation. White space may appear within a preprocessing token
2880 only as part of a header name or between the quotation characters in a character constant
2881 or string literal.
2885 <!--page 62 -->
2886 <p><!--para 4 -->
2887 If the input stream has been parsed into preprocessing tokens up to a given character, the
2888 next preprocessing token is the longest sequence of characters that could constitute a
2889 preprocessing token. There is one exception to this rule: header name preprocessing
2890 tokens are recognized only within #include preprocessing directives and in
2891 implementation-defined locations within #pragma directives. In such contexts, a
2892 sequence of characters that could be either a header name or a string literal is recognized
2893 as the former.
2894 <p><!--para 5 -->
2895 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
2896 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
2897 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
2898 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
2899 not E is a macro name.
2901 <p><!--para 6 -->
2902 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
2903 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
2905 <p><b> Forward references</b>: 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>),
2906 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
2907 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2908 (<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
2909 (<a href="#6.4.5">6.4.5</a>).
2911 <h6>footnotes</h6>
2912 <p><small><a name="note58" href="#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
2913 occur in source files.
2914 </small>
2916 <h4><a name="6.4.1" href="#6.4.1">6.4.1 Keywords</a></h4>
2917 <h6>Syntax</h6>
2918 <p><!--para 1 -->
2919 <pre>
2920 keyword: one of
2921 auto enum restrict unsigned
2922 break extern return void
2923 case float short volatile
2924 char for signed while
2925 const goto sizeof _Bool
2926 continue if static _Complex
2927 default inline struct _Imaginary
2928 do int switch
2929 double long typedef
2930 else register union
2931 </pre>
2932 <h6>Semantics</h6>
2933 <p><!--para 2 -->
2934 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
2935 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
2936 specifying imaginary types.<sup><a href="#note59"><b>59)</b></a></sup>
2940 <!--page 63 -->
2942 <h6>footnotes</h6>
2943 <p><small><a name="note59" href="#note59">59)</a> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
2944 </small>
2946 <h4><a name="6.4.2" href="#6.4.2">6.4.2 Identifiers</a></h4>
2948 <h5><a name="6.4.2.1" href="#6.4.2.1">6.4.2.1 General</a></h5>
2949 <h6>Syntax</h6>
2950 <p><!--para 1 -->
2951 <pre>
2952 identifier:
2953 identifier-nondigit
2954 identifier identifier-nondigit
2955 identifier digit
2956 identifier-nondigit:
2957 nondigit
2958 universal-character-name
2959 other implementation-defined characters
2960 nondigit: one of
2961 _ a b c d e f g h i j k l m
2962 n o p q r s t u v w x y z
2963 A B C D E F G H I J K L M
2964 N O P Q R S T U V W X Y Z
2965 digit: one of
2966 0 1 2 3 4 5 6 7 8 9
2967 </pre>
2968 <h6>Semantics</h6>
2969 <p><!--para 2 -->
2970 An identifier is a sequence of nondigit characters (including the underscore _, the
2971 lowercase and uppercase Latin letters, and other characters) and digits, which designates
2972 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
2973 There is no specific limit on the maximum length of an identifier.
2974 <p><!--para 3 -->
2975 Each universal character name in an identifier shall designate a character whose encoding
2976 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
2977 character shall not be a universal character name designating a digit. An implementation
2978 may allow multibyte characters that are not part of the basic source character set to
2979 appear in identifiers; which characters and their correspondence to universal character
2980 names is implementation-defined.
2981 <p><!--para 4 -->
2982 When preprocessing tokens are converted to tokens during translation phase 7, if a
2983 preprocessing token could be converted to either a keyword or an identifier, it is converted
2984 to a keyword.
2987 <!--page 64 -->
2988 <h6>Implementation limits</h6>
2989 <p><!--para 5 -->
2990 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
2991 characters in an identifier; the limit for an external name (an identifier that has external
2992 linkage) may be more restrictive than that for an internal name (a macro name or an
2993 identifier that does not have external linkage). The number of significant characters in an
2994 identifier is implementation-defined.
2995 <p><!--para 6 -->
2996 Any identifiers that differ in a significant character are different identifiers. If two
2997 identifiers differ only in nonsignificant characters, the behavior is undefined.
2998 <p><b> Forward references</b>: universal character names (<a href="#6.4.3">6.4.3</a>), macro replacement (<a href="#6.10.3">6.10.3</a>).
3000 <h6>footnotes</h6>
3001 <p><small><a name="note60" href="#note60">60)</a> On systems in which linkers cannot accept extended characters, an encoding of the universal character
3002 name may be used in forming valid external identifiers. For example, some otherwise unused
3003 character or sequence of characters may be used to encode the \u in a universal character name.
3004 Extended characters may produce a long external identifier.
3005 </small>
3007 <h5><a name="6.4.2.2" href="#6.4.2.2">6.4.2.2 Predefined identifiers</a></h5>
3008 <h6>Semantics</h6>
3009 <p><!--para 1 -->
3010 The identifier __func__ shall be implicitly declared by the translator as if,
3011 immediately following the opening brace of each function definition, the declaration
3012 <pre>
3013 static const char __func__[] = "function-name";
3014 </pre>
3015 appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note61"><b>61)</b></a></sup>
3016 <p><!--para 2 -->
3017 This name is encoded as if the implicit declaration had been written in the source
3018 character set and then translated into the execution character set as indicated in translation
3019 phase 5.
3020 <p><!--para 3 -->
3021 EXAMPLE Consider the code fragment:
3022 <pre>
3023 #include <a href="#7.19">&lt;stdio.h&gt;</a>
3024 void myfunc(void)
3026 printf("%s\n", __func__);
3027 /* ... */
3029 </pre>
3030 Each time the function is called, it will print to the standard output stream:
3031 <pre>
3032 myfunc
3033 </pre>
3035 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
3040 <!--page 65 -->
3042 <h6>footnotes</h6>
3043 <p><small><a name="note61" href="#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
3044 identifier is explicitly declared using the name __func__, the behavior is undefined.
3045 </small>
3047 <h4><a name="6.4.3" href="#6.4.3">6.4.3 Universal character names</a></h4>
3048 <h6>Syntax</h6>
3049 <p><!--para 1 -->
3050 <pre>
3051 universal-character-name:
3052 \u hex-quad
3053 \U hex-quad hex-quad
3054 hex-quad:
3055 hexadecimal-digit hexadecimal-digit
3056 hexadecimal-digit hexadecimal-digit
3057 </pre>
3058 <h6>Constraints</h6>
3059 <p><!--para 2 -->
3060 A universal character name shall not specify a character whose short identifier is less than
3061 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
3062 DFFF inclusive.<sup><a href="#note62"><b>62)</b></a></sup>
3063 <h6>Description</h6>
3064 <p><!--para 3 -->
3065 Universal character names may be used in identifiers, character constants, and string
3066 literals to designate characters that are not in the basic character set.
3067 <h6>Semantics</h6>
3068 <p><!--para 4 -->
3069 The universal character name \Unnnnnnnn designates the character whose eight-digit
3070 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note63"><b>63)</b></a></sup> Similarly, the universal
3071 character name \unnnn designates the character whose four-digit short identifier is nnnn
3072 (and whose eight-digit short identifier is 0000nnnn).
3077 <!--page 66 -->
3079 <h6>footnotes</h6>
3080 <p><small><a name="note62" href="#note62">62)</a> The disallowed characters are the characters in the basic character set and the code positions reserved
3081 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
3082 UTF-16).
3083 </small>
3084 <p><small><a name="note63" href="#note63">63)</a> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
3085 </small>
3087 <h4><a name="6.4.4" href="#6.4.4">6.4.4 Constants</a></h4>
3088 <h6>Syntax</h6>
3089 <p><!--para 1 -->
3090 <pre>
3091 constant:
3092 integer-constant
3093 floating-constant
3094 enumeration-constant
3095 character-constant
3096 </pre>
3097 <h6>Constraints</h6>
3098 <p><!--para 2 -->
3099 Each constant shall have a type and the value of a constant shall be in the range of
3100 representable values for its type.
3101 <h6>Semantics</h6>
3102 <p><!--para 3 -->
3103 Each constant has a type, determined by its form and value, as detailed later.
3105 <h5><a name="6.4.4.1" href="#6.4.4.1">6.4.4.1 Integer constants</a></h5>
3106 <h6>Syntax</h6>
3107 <p><!--para 1 -->
3108 <!--page 67 -->
3109 <pre>
3110 integer-constant:
3111 decimal-constant integer-suffix<sub>opt</sub>
3112 octal-constant integer-suffix<sub>opt</sub>
3113 hexadecimal-constant integer-suffix<sub>opt</sub>
3114 decimal-constant:
3115 nonzero-digit
3116 decimal-constant digit
3117 octal-constant:
3119 octal-constant octal-digit
3120 hexadecimal-constant:
3121 hexadecimal-prefix hexadecimal-digit
3122 hexadecimal-constant hexadecimal-digit
3123 hexadecimal-prefix: one of
3124 0x 0X
3125 nonzero-digit: one of
3126 1 2 3 4 5 6 7 8 9
3127 octal-digit: one of
3128 0 1 2 3 4 5 6 7
3129 hexadecimal-digit: one of
3130 0 1 2 3 4 5 6 7 8 9
3131 a b c d e f
3132 A B C D E F
3133 integer-suffix:
3134 unsigned-suffix long-suffix<sub>opt</sub>
3135 unsigned-suffix long-long-suffix
3136 long-suffix unsigned-suffix<sub>opt</sub>
3137 long-long-suffix unsigned-suffix<sub>opt</sub>
3138 unsigned-suffix: one of
3140 long-suffix: one of
3142 long-long-suffix: one of
3143 ll LL
3144 </pre>
3145 <h6>Description</h6>
3146 <p><!--para 2 -->
3147 An integer constant begins with a digit, but has no period or exponent part. It may have a
3148 prefix that specifies its base and a suffix that specifies its type.
3149 <p><!--para 3 -->
3150 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
3151 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
3152 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
3153 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
3154 10 through 15 respectively.
3155 <h6>Semantics</h6>
3156 <p><!--para 4 -->
3157 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
3158 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
3159 <p><!--para 5 -->
3160 The type of an integer constant is the first of the corresponding list in which its value can
3161 be represented.
3162 <!--page 68 -->
3163 <table border=1>
3164 <tr><th> Suffix <th>Decimal Constant <th>Octal or Hexadecimal Constant
3165 <tr><td> none
3166 <td><pre>
3168 long int
3169 long long int
3170 </pre>
3171 <td><pre>
3173 unsigned int
3174 long int
3175 unsigned long int
3176 long long int
3177 unsigned long long int
3178 </pre>
3179 <tr><td> u or U
3180 <td><pre>
3181 unsigned int
3182 unsigned long int
3183 unsigned long long int
3184 </pre>
3185 <td><pre>
3186 unsigned int
3187 unsigned long int
3188 unsigned long long int
3189 </pre>
3190 <tr><td> l or L
3191 <td><pre>
3192 long int
3193 long long int
3194 </pre>
3195 <td><pre>
3196 long int
3197 unsigned long int
3198 long long int
3199 unsigned long long int
3200 </pre>
3201 <tr><td> Both u or U and l or L
3202 <td><pre>
3203 unsigned long int
3204 unsigned long long int
3205 </pre>
3206 <td><pre>
3207 unsigned long int
3208 unsigned long long int
3209 </pre>
3210 <tr><td> ll or LL
3211 <td><pre>
3212 long long int
3213 </pre>
3214 <td><pre>
3215 long long int
3216 unsigned long long int
3217 </pre>
3218 <tr><td> Both u or U and ll or LL
3219 <td><pre>
3220 unsigned long long int
3221 </pre>
3222 <td><pre>
3223 unsigned long long int
3224 </pre>
3225 </table>
3226 <p><!--para 6 -->
3227 If an integer constant cannot be represented by any type in its list, it may have an
3228 extended integer type, if the extended integer type can represent its value. If all of the
3229 types in the list for the constant are signed, the extended integer type shall be signed. If
3230 all of the types in the list for the constant are unsigned, the extended integer type shall be
3231 unsigned. If the list contains both signed and unsigned types, the extended integer type
3232 may be signed or unsigned. If an integer constant cannot be represented by any type in
3233 its list and has no extended integer type, then the integer constant has no type.
3234 <!--page 69 -->
3236 <h5><a name="6.4.4.2" href="#6.4.4.2">6.4.4.2 Floating constants</a></h5>
3237 <h6>Syntax</h6>
3238 <p><!--para 1 -->
3239 <!--page 70 -->
3240 <pre>
3241 floating-constant:
3242 decimal-floating-constant
3243 hexadecimal-floating-constant
3244 decimal-floating-constant:
3245 fractional-constant exponent-part<sub>opt</sub> floating-suffix<sub>opt</sub>
3246 digit-sequence exponent-part floating-suffix<sub>opt</sub>
3247 hexadecimal-floating-constant:
3248 hexadecimal-prefix hexadecimal-fractional-constant
3249 binary-exponent-part floating-suffix<sub>opt</sub>
3250 hexadecimal-prefix hexadecimal-digit-sequence
3251 binary-exponent-part floating-suffix<sub>opt</sub>
3252 fractional-constant:
3253 digit-sequence<sub>opt</sub> . digit-sequence
3254 digit-sequence .
3255 exponent-part:
3256 e sign<sub>opt</sub> digit-sequence
3257 E sign<sub>opt</sub> digit-sequence
3258 sign: one of
3260 digit-sequence:
3261 digit
3262 digit-sequence digit
3263 hexadecimal-fractional-constant:
3264 hexadecimal-digit-sequence<sub>opt</sub> .
3265 hexadecimal-digit-sequence
3266 hexadecimal-digit-sequence .
3267 binary-exponent-part:
3268 p sign<sub>opt</sub> digit-sequence
3269 P sign<sub>opt</sub> digit-sequence
3270 hexadecimal-digit-sequence:
3271 hexadecimal-digit
3272 hexadecimal-digit-sequence hexadecimal-digit
3273 floating-suffix: one of
3274 f l F L
3275 </pre>
3276 <h6>Description</h6>
3277 <p><!--para 2 -->
3278 A floating constant has a significand part that may be followed by an exponent part and a
3279 suffix that specifies its type. The components of the significand part may include a digit
3280 sequence representing the whole-number part, followed by a period (.), followed by a
3281 digit sequence representing the fraction part. The components of the exponent part are an
3282 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
3283 Either the whole-number part or the fraction part has to be present; for decimal floating
3284 constants, either the period or the exponent part has to be present.
3285 <h6>Semantics</h6>
3286 <p><!--para 3 -->
3287 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
3288 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
3289 floating constants, the exponent indicates the power of 10 by which the significand part is
3290 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
3291 by which the significand part is to be scaled. For decimal floating constants, and also for
3292 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
3293 the nearest representable value, or the larger or smaller representable value immediately
3294 adjacent to the nearest representable value, chosen in an implementation-defined manner.
3295 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
3296 correctly rounded.
3297 <p><!--para 4 -->
3298 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
3299 type float. If suffixed by the letter l or L, it has type long double.
3300 <p><!--para 5 -->
3301 Floating constants are converted to internal format as if at translation-time. The
3302 conversion of a floating constant shall not raise an exceptional condition or a floating-
3303 point exception at execution time.
3304 <h6>Recommended practice</h6>
3305 <p><!--para 6 -->
3306 The implementation should produce a diagnostic message if a hexadecimal constant
3307 cannot be represented exactly in its evaluation format; the implementation should then
3308 proceed with the translation of the program.
3309 <p><!--para 7 -->
3310 The translation-time conversion of floating constants should match the execution-time
3311 conversion of character strings by library functions, such as strtod, given matching
3312 inputs suitable for both conversions, the same result format, and default execution-time
3313 rounding.<sup><a href="#note64"><b>64)</b></a></sup>
3318 <!--page 71 -->
3320 <h6>footnotes</h6>
3321 <p><small><a name="note64" href="#note64">64)</a> The specification for the library functions recommends more accurate conversion than required for
3322 floating constants (see <a href="#7.20.1.3">7.20.1.3</a>).
3323 </small>
3325 <h5><a name="6.4.4.3" href="#6.4.4.3">6.4.4.3 Enumeration constants</a></h5>
3326 <h6>Syntax</h6>
3327 <p><!--para 1 -->
3328 <pre>
3329 enumeration-constant:
3330 identifier
3331 </pre>
3332 <h6>Semantics</h6>
3333 <p><!--para 2 -->
3334 An identifier declared as an enumeration constant has type int.
3335 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
3337 <h5><a name="6.4.4.4" href="#6.4.4.4">6.4.4.4 Character constants</a></h5>
3338 <h6>Syntax</h6>
3339 <p><!--para 1 -->
3340 <!--page 72 -->
3341 <pre>
3342 character-constant:
3343 ' c-char-sequence '
3344 L' c-char-sequence '
3345 c-char-sequence:
3346 c-char
3347 c-char-sequence c-char
3348 c-char:
3349 any member of the source character set except
3350 the single-quote ', backslash \, or new-line character
3351 escape-sequence
3352 escape-sequence:
3353 simple-escape-sequence
3354 octal-escape-sequence
3355 hexadecimal-escape-sequence
3356 universal-character-name
3357 simple-escape-sequence: one of
3358 \' \" \? \\
3359 \a \b \f \n \r \t \v
3360 octal-escape-sequence:
3361 \ octal-digit
3362 \ octal-digit octal-digit
3363 \ octal-digit octal-digit octal-digit
3364 hexadecimal-escape-sequence:
3365 \x hexadecimal-digit
3366 hexadecimal-escape-sequence hexadecimal-digit
3367 </pre>
3368 <h6>Description</h6>
3369 <p><!--para 2 -->
3370 An integer character constant is a sequence of one or more multibyte characters enclosed
3371 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
3372 letter L. With a few exceptions detailed later, the elements of the sequence are any
3373 members of the source character set; they are mapped in an implementation-defined
3374 manner to members of the execution character set.
3375 <p><!--para 3 -->
3376 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
3377 arbitrary integer values are representable according to the following table of escape
3378 sequences:
3379 <p><!--para 4 -->
3380 <pre>
3381 single quote ' \'
3382 double quote " \"
3383 question mark ? \?
3384 backslash \ \\
3385 octal character \octal digits
3386 hexadecimal character \x hexadecimal digits
3387 </pre>
3388 The double-quote " and question-mark ? are representable either by themselves or by the
3389 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
3390 shall be represented, respectively, by the escape sequences \' and \\.
3391 <p><!--para 5 -->
3392 The octal digits that follow the backslash in an octal escape sequence are taken to be part
3393 of the construction of a single character for an integer character constant or of a single
3394 wide character for a wide character constant. The numerical value of the octal integer so
3395 formed specifies the value of the desired character or wide character.
3396 <p><!--para 6 -->
3397 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
3398 sequence are taken to be part of the construction of a single character for an integer
3399 character constant or of a single wide character for a wide character constant. The
3400 numerical value of the hexadecimal integer so formed specifies the value of the desired
3401 character or wide character.
3402 <p><!--para 7 -->
3403 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
3404 constitute the escape sequence.
3405 <p><!--para 8 -->
3406 In addition, characters not in the basic character set are representable by universal
3407 character names and certain nongraphic characters are representable by escape sequences
3408 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
3409 and \v.<sup><a href="#note65"><b>65)</b></a></sup>
3414 <!--page 73 -->
3415 <h6>Constraints</h6>
3416 <p><!--para 9 -->
3417 The value of an octal or hexadecimal escape sequence shall be in the range of
3418 representable values for the type unsigned char for an integer character constant, or
3419 the unsigned type corresponding to wchar_t for a wide character constant.
3420 <h6>Semantics</h6>
3421 <p><!--para 10 -->
3422 An integer character constant has type int. The value of an integer character constant
3423 containing a single character that maps to a single-byte execution character is the
3424 numerical value of the representation of the mapped character interpreted as an integer.
3425 The value of an integer character constant containing more than one character (e.g.,
3426 'ab'), or containing a character or escape sequence that does not map to a single-byte
3427 execution character, is implementation-defined. If an integer character constant contains
3428 a single character or escape sequence, its value is the one that results when an object with
3429 type char whose value is that of the single character or escape sequence is converted to
3430 type int.
3431 <p><!--para 11 -->
3432 A wide character constant has type wchar_t, an integer type defined in the
3433 <a href="#7.17">&lt;stddef.h&gt;</a> header. The value of a wide character constant containing a single
3434 multibyte character that maps to a member of the extended execution character set is the
3435 wide character corresponding to that multibyte character, as defined by the mbtowc
3436 function, with an implementation-defined current locale. The value of a wide character
3437 constant containing more than one multibyte character, or containing a multibyte
3438 character or escape sequence not represented in the extended execution character set, is
3439 implementation-defined.
3440 <p><!--para 12 -->
3441 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
3443 <p><!--para 13 -->
3444 EXAMPLE 2 Consider implementations that use two's-complement representation for integers and eight
3445 bits for objects that have type char. In an implementation in which type char has the same range of
3446 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
3447 same range of values as unsigned char, the character constant '\xFF' has the value +255.
3449 <p><!--para 14 -->
3450 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
3451 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
3452 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
3453 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
3454 escape sequence is terminated after three octal digits. (The value of this two-character integer character
3455 constant is implementation-defined.)
3457 <p><!--para 15 -->
3458 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
3459 L'\1234' specifies the implementation-defined value that results from the combination of the values
3460 0123 and '4'.
3462 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbtowc function
3463 (<a href="#7.20.7.2">7.20.7.2</a>).
3464 <!--page 74 -->
3466 <h6>footnotes</h6>
3467 <p><small><a name="note65" href="#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,
3468 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
3469 </small>
3471 <h4><a name="6.4.5" href="#6.4.5">6.4.5 String literals</a></h4>
3472 <h6>Syntax</h6>
3473 <p><!--para 1 -->
3474 <pre>
3475 string-literal:
3476 " s-char-sequence<sub>opt</sub> "
3477 L" s-char-sequence<sub>opt</sub> "
3478 s-char-sequence:
3479 s-char
3480 s-char-sequence s-char
3481 s-char:
3482 any member of the source character set except
3483 the double-quote ", backslash \, or new-line character
3484 escape-sequence
3485 </pre>
3486 <h6>Description</h6>
3487 <p><!--para 2 -->
3488 A character string literal is a sequence of zero or more multibyte characters enclosed in
3489 double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the
3490 letter L.
3491 <p><!--para 3 -->
3492 The same considerations apply to each element of the sequence in a character string
3493 literal or a wide string literal as if it were in an integer character constant or a wide
3494 character constant, except that the single-quote ' is representable either by itself or by the
3495 escape sequence \', but the double-quote " shall be represented by the escape sequence
3497 <h6>Semantics</h6>
3498 <p><!--para 4 -->
3499 In translation phase 6, the multibyte character sequences specified by any sequence of
3500 adjacent character and wide string literal tokens are concatenated into a single multibyte
3501 character sequence. If any of the tokens are wide string literal tokens, the resulting
3502 multibyte character sequence is treated as a wide string literal; otherwise, it is treated as a
3503 character string literal.
3504 <p><!--para 5 -->
3505 In translation phase 7, a byte or code of value zero is appended to each multibyte
3506 character sequence that results from a string literal or literals.<sup><a href="#note66"><b>66)</b></a></sup> The multibyte character
3507 sequence is then used to initialize an array of static storage duration and length just
3508 sufficient to contain the sequence. For character string literals, the array elements have
3509 type char, and are initialized with the individual bytes of the multibyte character
3510 sequence; for wide string literals, the array elements have type wchar_t, and are
3511 initialized with the sequence of wide characters corresponding to the multibyte character
3513 <!--page 75 -->
3514 sequence, as defined by the mbstowcs function with an implementation-defined current
3515 locale. The value of a string literal containing a multibyte character or escape sequence
3516 not represented in the execution character set is implementation-defined.
3517 <p><!--para 6 -->
3518 It is unspecified whether these arrays are distinct provided their elements have the
3519 appropriate values. If the program attempts to modify such an array, the behavior is
3520 undefined.
3521 <p><!--para 7 -->
3522 EXAMPLE This pair of adjacent character string literals
3523 <pre>
3524 "\x12" "3"
3525 </pre>
3526 produces a single character string literal containing the two characters whose values are '\x12' and '3',
3527 because escape sequences are converted into single members of the execution character set just prior to
3528 adjacent string literal concatenation.
3530 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbstowcs
3531 function (<a href="#7.20.8.1">7.20.8.1</a>).
3533 <h6>footnotes</h6>
3534 <p><small><a name="note66" href="#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
3535 it by a \0 escape sequence.
3536 </small>
3538 <h4><a name="6.4.6" href="#6.4.6">6.4.6 Punctuators</a></h4>
3539 <h6>Syntax</h6>
3540 <p><!--para 1 -->
3541 <pre>
3542 punctuator: one of
3543 [ ] ( ) { } . -&gt;
3544 ++ -- &amp; * + - ~ !
3545 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
3546 ? : ; ...
3547 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
3548 , # ##
3549 &lt;: :&gt; &lt;% %&gt; %: %:%:
3550 </pre>
3551 <h6>Semantics</h6>
3552 <p><!--para 2 -->
3553 A punctuator is a symbol that has independent syntactic and semantic significance.
3554 Depending on context, it may specify an operation to be performed (which in turn may
3555 yield a value or a function designator, produce a side effect, or some combination thereof)
3556 in which case it is known as an operator (other forms of operator also exist in some
3557 contexts). An operand is an entity on which an operator acts.
3558 <!--page 76 -->
3559 <p><!--para 3 -->
3560 In all aspects of the language, the six tokens<sup><a href="#note67"><b>67)</b></a></sup>
3561 <pre>
3562 &lt;: :&gt; &lt;% %&gt; %: %:%:
3563 </pre>
3564 behave, respectively, the same as the six tokens
3565 <pre>
3566 [ ] { } # ##
3567 </pre>
3568 except for their spelling.<sup><a href="#note68"><b>68)</b></a></sup>
3569 <p><b> Forward references</b>: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
3570 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
3572 <h6>footnotes</h6>
3573 <p><small><a name="note67" href="#note67">67)</a> These tokens are sometimes called ''digraphs''.
3574 </small>
3575 <p><small><a name="note68" href="#note68">68)</a> Thus [ and &lt;: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
3576 interchanged.
3577 </small>
3579 <h4><a name="6.4.7" href="#6.4.7">6.4.7 Header names</a></h4>
3580 <h6>Syntax</h6>
3581 <p><!--para 1 -->
3582 <pre>
3583 header-name:
3584 &lt; h-char-sequence &gt;
3585 " q-char-sequence "
3586 h-char-sequence:
3587 h-char
3588 h-char-sequence h-char
3589 h-char:
3590 any member of the source character set except
3591 the new-line character and &gt;
3592 q-char-sequence:
3593 q-char
3594 q-char-sequence q-char
3595 q-char:
3596 any member of the source character set except
3597 the new-line character and "
3598 </pre>
3599 <h6>Semantics</h6>
3600 <p><!--para 2 -->
3601 The sequences in both forms of header names are mapped in an implementation-defined
3602 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
3603 <p><!--para 3 -->
3604 If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
3605 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
3610 <!--page 77 -->
3611 sequence between the " delimiters, the behavior is undefined.<sup><a href="#note69"><b>69)</b></a></sup> Header name
3612 preprocessing tokens are recognized only within #include preprocessing directives and
3613 in implementation-defined locations within #pragma directives.<sup><a href="#note70"><b>70)</b></a></sup>
3614 <p><!--para 4 -->
3615 EXAMPLE The following sequence of characters:
3616 <pre>
3617 0x3&lt;1/a.h&gt;1e2
3618 #include &lt;1/a.h&gt;
3619 #define const.member@$
3620 </pre>
3621 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
3622 by a { on the left and a } on the right).
3623 <pre>
3624 {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
3625 {#}{include} {&lt;1/a.h&gt;}
3626 {#}{define} {const}{.}{member}{@}{$}
3627 </pre>
3629 <p><b> Forward references</b>: source file inclusion (<a href="#6.10.2">6.10.2</a>).
3631 <h6>footnotes</h6>
3632 <p><small><a name="note69" href="#note69">69)</a> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
3633 </small>
3634 <p><small><a name="note70" href="#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>.
3635 </small>
3637 <h4><a name="6.4.8" href="#6.4.8">6.4.8 Preprocessing numbers</a></h4>
3638 <h6>Syntax</h6>
3639 <p><!--para 1 -->
3640 <pre>
3641 pp-number:
3642 digit
3643 . digit
3644 pp-number digit
3645 pp-number identifier-nondigit
3646 pp-number e sign
3647 pp-number E sign
3648 pp-number p sign
3649 pp-number P sign
3650 pp-number .
3651 </pre>
3652 <h6>Description</h6>
3653 <p><!--para 2 -->
3654 A preprocessing number begins with a digit optionally preceded by a period (.) and may
3655 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
3656 p+, p-, P+, or P-.
3657 <p><!--para 3 -->
3658 Preprocessing number tokens lexically include all floating and integer constant tokens.
3659 <h6>Semantics</h6>
3660 <p><!--para 4 -->
3661 A preprocessing number does not have type or a value; it acquires both after a successful
3662 conversion (as part of translation phase 7) to a floating constant token or an integer
3663 constant token.
3666 <!--page 78 -->
3668 <h4><a name="6.4.9" href="#6.4.9">6.4.9 Comments</a></h4>
3669 <p><!--para 1 -->
3670 Except within a character constant, a string literal, or a comment, the characters /*
3671 introduce a comment. The contents of such a comment are examined only to identify
3672 multibyte characters and to find the characters */ that terminate it.<sup><a href="#note71"><b>71)</b></a></sup>
3673 <p><!--para 2 -->
3674 Except within a character constant, a string literal, or a comment, the characters //
3675 introduce a comment that includes all multibyte characters up to, but not including, the
3676 next new-line character. The contents of such a comment are examined only to identify
3677 multibyte characters and to find the terminating new-line character.
3678 <p><!--para 3 -->
3679 EXAMPLE
3680 <pre>
3681 "a//b" // four-character string literal
3682 #include "//e" // undefined behavior
3683 // */ // comment, not syntax error
3684 f = g/**//h; // equivalent to f = g / h;
3686 i(); // part of a two-line comment
3688 / j(); // part of a two-line comment
3689 #define glue(x,y) x##y
3690 glue(/,/) k(); // syntax error, not comment
3691 /*//*/ l(); // equivalent to l();
3692 m = n//**/o
3693 + p; // equivalent to m = n + p;
3694 </pre>
3699 <!--page 79 -->
3701 <h6>footnotes</h6>
3702 <p><small><a name="note71" href="#note71">71)</a> Thus, /* ... */ comments do not nest.
3703 </small>
3705 <h3><a name="6.5" href="#6.5">6.5 Expressions</a></h3>
3706 <p><!--para 1 -->
3707 An expression is a sequence of operators and operands that specifies computation of a
3708 value, or that designates an object or a function, or that generates side effects, or that
3709 performs a combination thereof.
3710 <p><!--para 2 -->
3711 Between the previous and next sequence point an object shall have its stored value
3712 modified at most once by the evaluation of an expression.<sup><a href="#note72"><b>72)</b></a></sup> Furthermore, the prior value
3713 shall be read only to determine the value to be stored.<sup><a href="#note73"><b>73)</b></a></sup>
3714 <p><!--para 3 -->
3715 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note74"><b>74)</b></a></sup> Except as specified
3716 later (for the function-call (), &amp;&amp;, ||, ?:, and comma operators), the order of evaluation
3717 of subexpressions and the order in which side effects take place are both unspecified.
3718 <p><!--para 4 -->
3719 Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
3720 collectively described as bitwise operators) are required to have operands that have
3721 integer type. These operators yield values that depend on the internal representations of
3722 integers, and have implementation-defined and undefined aspects for signed types.
3723 <p><!--para 5 -->
3724 If an exceptional condition occurs during the evaluation of an expression (that is, if the
3725 result is not mathematically defined or not in the range of representable values for its
3726 type), the behavior is undefined.
3727 <p><!--para 6 -->
3728 The effective type of an object for an access to its stored value is the declared type of the
3729 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
3730 lvalue having a type that is not a character type, then the type of the lvalue becomes the
3733 <!--page 80 -->
3734 effective type of the object for that access and for subsequent accesses that do not modify
3735 the stored value. If a value is copied into an object having no declared type using
3736 memcpy or memmove, or is copied as an array of character type, then the effective type
3737 of the modified object for that access and for subsequent accesses that do not modify the
3738 value is the effective type of the object from which the value is copied, if it has one. For
3739 all other accesses to an object having no declared type, the effective type of the object is
3740 simply the type of the lvalue used for the access.
3741 <p><!--para 7 -->
3742 An object shall have its stored value accessed only by an lvalue expression that has one of
3743 the following types:<sup><a href="#note76"><b>76)</b></a></sup>
3744 <ul>
3745 <li> a type compatible with the effective type of the object,
3746 <li> a qualified version of a type compatible with the effective type of the object,
3747 <li> a type that is the signed or unsigned type corresponding to the effective type of the
3748 object,
3749 <li> a type that is the signed or unsigned type corresponding to a qualified version of the
3750 effective type of the object,
3751 <li> an aggregate or union type that includes one of the aforementioned types among its
3752 members (including, recursively, a member of a subaggregate or contained union), or
3753 <li> a character type.
3754 </ul>
3755 <p><!--para 8 -->
3756 A floating expression may be contracted, that is, evaluated as though it were an atomic
3757 operation, thereby omitting rounding errors implied by the source code and the
3758 expression evaluation method.<sup><a href="#note77"><b>77)</b></a></sup> The FP_CONTRACT pragma in <a href="#7.12">&lt;math.h&gt;</a> provides a
3759 way to disallow contracted expressions. Otherwise, whether and how expressions are
3760 contracted is implementation-defined.<sup><a href="#note78"><b>78)</b></a></sup>
3761 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.21.2">7.21.2</a>).
3766 <!--page 81 -->
3768 <h6>footnotes</h6>
3769 <p><small><a name="note72" href="#note72">72)</a> A floating-point status flag is not an object and can be set more than once within an expression.
3770 </small>
3771 <p><small><a name="note73" href="#note73">73)</a> This paragraph renders undefined statement expressions such as
3773 <pre>
3774 i = ++i + 1;
3775 a[i++] = i;
3776 </pre>
3777 while allowing
3778 <pre>
3779 i = i + 1;
3780 a[i] = i;
3781 </pre>
3783 </small>
3784 <p><small><a name="note74" href="#note74">74)</a> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
3785 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
3786 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
3787 <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
3788 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
3789 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
3790 the conditional operator ?: (<a href="#6.5.15">6.5.15</a>).
3792 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
3793 indicated in each subclause by the syntax for the expressions discussed therein.
3794 </small>
3795 <p><small><a name="note75" href="#note75">75)</a> Allocated objects have no declared type.
3796 </small>
3797 <p><small><a name="note76" href="#note76">76)</a> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
3798 </small>
3799 <p><small><a name="note77" href="#note77">77)</a> A contracted expression might also omit the raising of floating-point exceptions.
3800 </small>
3801 <p><small><a name="note78" href="#note78">78)</a> This license is specifically intended to allow implementations to exploit fast machine instructions that
3802 combine multiple C operators. As contractions potentially undermine predictability, and can even
3803 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
3804 documented.
3805 </small>
3807 <h4><a name="6.5.1" href="#6.5.1">6.5.1 Primary expressions</a></h4>
3808 <h6>Syntax</h6>
3809 <p><!--para 1 -->
3810 <pre>
3811 primary-expression:
3812 identifier
3813 constant
3814 string-literal
3815 ( expression )
3816 </pre>
3817 <h6>Semantics</h6>
3818 <p><!--para 2 -->
3819 An identifier is a primary expression, provided it has been declared as designating an
3820 object (in which case it is an lvalue) or a function (in which case it is a function
3821 designator).<sup><a href="#note79"><b>79)</b></a></sup>
3822 <p><!--para 3 -->
3823 A constant is a primary expression. Its type depends on its form and value, as detailed in
3824 <a href="#6.4.4">6.4.4</a>.
3825 <p><!--para 4 -->
3826 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>.
3827 <p><!--para 5 -->
3828 A parenthesized expression is a primary expression. Its type and value are identical to
3829 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
3830 expression if the unparenthesized expression is, respectively, an lvalue, a function
3831 designator, or a void expression.
3832 <p><b> Forward references</b>: declarations (<a href="#6.7">6.7</a>).
3834 <h6>footnotes</h6>
3835 <p><small><a name="note79" href="#note79">79)</a> Thus, an undeclared identifier is a violation of the syntax.
3836 </small>
3838 <h4><a name="6.5.2" href="#6.5.2">6.5.2 Postfix operators</a></h4>
3839 <h6>Syntax</h6>
3840 <p><!--para 1 -->
3841 <pre>
3842 postfix-expression:
3843 primary-expression
3844 postfix-expression [ expression ]
3845 postfix-expression ( argument-expression-list<sub>opt</sub> )
3846 postfix-expression . identifier
3847 postfix-expression -&gt; identifier
3848 postfix-expression ++
3849 postfix-expression --
3850 ( type-name ) { initializer-list }
3851 ( type-name ) { initializer-list , }
3852 </pre>
3857 <!--page 82 -->
3858 <pre>
3859 argument-expression-list:
3860 assignment-expression
3861 argument-expression-list , assignment-expression
3862 </pre>
3864 <h5><a name="6.5.2.1" href="#6.5.2.1">6.5.2.1 Array subscripting</a></h5>
3865 <h6>Constraints</h6>
3866 <p><!--para 1 -->
3867 One of the expressions shall have type ''pointer to object type'', the other expression shall
3868 have integer type, and the result has type ''type''.
3869 <h6>Semantics</h6>
3870 <p><!--para 2 -->
3871 A postfix expression followed by an expression in square brackets [] is a subscripted
3872 designation of an element of an array object. The definition of the subscript operator []
3873 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
3874 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
3875 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
3876 element of E1 (counting from zero).
3877 <p><!--para 3 -->
3878 Successive subscript operators designate an element of a multidimensional array object.
3879 If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
3880 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
3881 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
3882 implicitly as a result of subscripting, the result is the pointed-to (n - 1)-dimensional array,
3883 which itself is converted into a pointer if used as other than an lvalue. It follows from this
3884 that arrays are stored in row-major order (last subscript varies fastest).
3885 <p><!--para 4 -->
3886 EXAMPLE Consider the array object defined by the declaration
3887 <pre>
3888 int x[3][5];
3889 </pre>
3890 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
3891 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
3892 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
3893 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
3894 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
3895 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
3896 yields an int.
3898 <p><b> Forward references</b>: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
3899 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
3900 <!--page 83 -->
3902 <h5><a name="6.5.2.2" href="#6.5.2.2">6.5.2.2 Function calls</a></h5>
3903 <h6>Constraints</h6>
3904 <p><!--para 1 -->
3905 The expression that denotes the called function<sup><a href="#note80"><b>80)</b></a></sup> shall have type pointer to function
3906 returning void or returning an object type other than an array type.
3907 <p><!--para 2 -->
3908 If the expression that denotes the called function has a type that includes a prototype, the
3909 number of arguments shall agree with the number of parameters. Each argument shall
3910 have a type such that its value may be assigned to an object with the unqualified version
3911 of the type of its corresponding parameter.
3912 <h6>Semantics</h6>
3913 <p><!--para 3 -->
3914 A postfix expression followed by parentheses () containing a possibly empty, comma-
3915 separated list of expressions is a function call. The postfix expression denotes the called
3916 function. The list of expressions specifies the arguments to the function.
3917 <p><!--para 4 -->
3918 An argument may be an expression of any object type. In preparing for the call to a
3919 function, the arguments are evaluated, and each parameter is assigned the value of the
3920 corresponding argument.<sup><a href="#note81"><b>81)</b></a></sup>
3921 <p><!--para 5 -->
3922 If the expression that denotes the called function has type pointer to function returning an
3923 object type, the function call expression has the same type as that object type, and has the
3924 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. If
3925 an attempt is made to modify the result of a function call or to access it after the next
3926 sequence point, the behavior is undefined.
3927 <p><!--para 6 -->
3928 If the expression that denotes the called function has a type that does not include a
3929 prototype, the integer promotions are performed on each argument, and arguments that
3930 have type float are promoted to double. These are called the default argument
3931 promotions. If the number of arguments does not equal the number of parameters, the
3932 behavior is undefined. If the function is defined with a type that includes a prototype, and
3933 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
3934 promotion are not compatible with the types of the parameters, the behavior is undefined.
3935 If the function is defined with a type that does not include a prototype, and the types of
3936 the arguments after promotion are not compatible with those of the parameters after
3937 promotion, the behavior is undefined, except for the following cases:
3942 <!--page 84 -->
3943 <ul>
3944 <li> one promoted type is a signed integer type, the other promoted type is the
3945 corresponding unsigned integer type, and the value is representable in both types;
3946 <li> both types are pointers to qualified or unqualified versions of a character type or
3947 void.
3948 </ul>
3949 <p><!--para 7 -->
3950 If the expression that denotes the called function has a type that does include a prototype,
3951 the arguments are implicitly converted, as if by assignment, to the types of the
3952 corresponding parameters, taking the type of each parameter to be the unqualified version
3953 of its declared type. The ellipsis notation in a function prototype declarator causes
3954 argument type conversion to stop after the last declared parameter. The default argument
3955 promotions are performed on trailing arguments.
3956 <p><!--para 8 -->
3957 No other conversions are performed implicitly; in particular, the number and types of
3958 arguments are not compared with those of the parameters in a function definition that
3959 does not include a function prototype declarator.
3960 <p><!--para 9 -->
3961 If the function is defined with a type that is not compatible with the type (of the
3962 expression) pointed to by the expression that denotes the called function, the behavior is
3963 undefined.
3964 <p><!--para 10 -->
3965 The order of evaluation of the function designator, the actual arguments, and
3966 subexpressions within the actual arguments is unspecified, but there is a sequence point
3967 before the actual call.
3968 <p><!--para 11 -->
3969 Recursive function calls shall be permitted, both directly and indirectly through any chain
3970 of other functions.
3971 <p><!--para 12 -->
3972 EXAMPLE In the function call
3973 <pre>
3974 (*pf[f1()]) (f2(), f3() + f4())
3975 </pre>
3976 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
3977 the function pointed to by pf[f1()] is called.
3979 <p><b> Forward references</b>: function declarators (including prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), function
3980 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>).
3982 <h6>footnotes</h6>
3983 <p><small><a name="note80" href="#note80">80)</a> Most often, this is the result of converting an identifier that is a function designator.
3984 </small>
3985 <p><small><a name="note81" href="#note81">81)</a> A function may change the values of its parameters, but these changes cannot affect the values of the
3986 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
3987 change the value of the object pointed to. A parameter declared to have array or function type is
3988 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
3989 </small>
3991 <h5><a name="6.5.2.3" href="#6.5.2.3">6.5.2.3 Structure and union members</a></h5>
3992 <h6>Constraints</h6>
3993 <p><!--para 1 -->
3994 The first operand of the . operator shall have a qualified or unqualified structure or union
3995 type, and the second operand shall name a member of that type.
3996 <p><!--para 2 -->
3997 The first operand of the -&gt; operator shall have type ''pointer to qualified or unqualified
3998 structure'' or ''pointer to qualified or unqualified union'', and the second operand shall
3999 name a member of the type pointed to.
4000 <!--page 85 -->
4001 <h6>Semantics</h6>
4002 <p><!--para 3 -->
4003 A postfix expression followed by the . operator and an identifier designates a member of
4004 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
4005 the first expression is an lvalue. If the first expression has qualified type, the result has
4006 the so-qualified version of the type of the designated member.
4007 <p><!--para 4 -->
4008 A postfix expression followed by the -&gt; operator and an identifier designates a member
4009 of a structure or union object. The value is that of the named member of the object to
4010 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
4011 a qualified type, the result has the so-qualified version of the type of the designated
4012 member.
4013 <p><!--para 5 -->
4014 One special guarantee is made in order to simplify the use of unions: if a union contains
4015 several structures that share a common initial sequence (see below), and if the union
4016 object currently contains one of these structures, it is permitted to inspect the common
4017 initial part of any of them anywhere that a declaration of the complete type of the union is
4018 visible. Two structures share a common initial sequence if corresponding members have
4019 compatible types (and, for bit-fields, the same widths) for a sequence of one or more
4020 initial members.
4021 <p><!--para 6 -->
4022 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
4023 union, f().x is a valid postfix expression but is not an lvalue.
4025 <p><!--para 7 -->
4026 EXAMPLE 2 In:
4027 <pre>
4028 struct s { int i; const int ci; };
4029 struct s s;
4030 const struct s cs;
4031 volatile struct s vs;
4032 </pre>
4033 the various members have the types:
4034 <pre>
4035 s.i int
4036 s.ci const int
4037 cs.i const int
4038 cs.ci const int
4039 vs.i volatile int
4040 vs.ci volatile const int
4041 </pre>
4046 <!--page 86 -->
4047 <p><!--para 8 -->
4048 EXAMPLE 3 The following is a valid fragment:
4049 <pre>
4050 union {
4051 struct {
4052 int alltypes;
4053 } n;
4054 struct {
4055 int type;
4056 int intnode;
4057 } ni;
4058 struct {
4059 int type;
4060 double doublenode;
4061 } nf;
4062 } u;
4063 u.nf.type = 1;
4064 u.nf.doublenode = <a href="#3.14">3.14</a>;
4065 /* ... */
4066 if (u.n.alltypes == 1)
4067 if (sin(u.nf.doublenode) == 0.0)
4068 /* ... */
4069 </pre>
4070 The following is not a valid fragment (because the union type is not visible within function f):
4071 <pre>
4072 struct t1 { int m; };
4073 struct t2 { int m; };
4074 int f(struct t1 *p1, struct t2 *p2)
4076 if (p1-&gt;m &lt; 0)
4077 p2-&gt;m = -p2-&gt;m;
4078 return p1-&gt;m;
4080 int g()
4082 union {
4083 struct t1 s1;
4084 struct t2 s2;
4085 } u;
4086 /* ... */
4087 return f(&amp;u.s1, &amp;u.s2);
4089 </pre>
4091 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
4092 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
4093 <!--page 87 -->
4095 <h6>footnotes</h6>
4096 <p><small><a name="note82" href="#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
4097 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
4098 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
4099 punning"). This might be a trap representation.
4100 </small>
4101 <p><small><a name="note83" href="#note83">83)</a> If &amp;E is a valid pointer expression (where &amp; is the ''address-of '' operator, which generates a pointer to
4102 its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
4103 </small>
4105 <h5><a name="6.5.2.4" href="#6.5.2.4">6.5.2.4 Postfix increment and decrement operators</a></h5>
4106 <h6>Constraints</h6>
4107 <p><!--para 1 -->
4108 The operand of the postfix increment or decrement operator shall have qualified or
4109 unqualified real or pointer type and shall be a modifiable lvalue.
4110 <h6>Semantics</h6>
4111 <p><!--para 2 -->
4112 The result of the postfix ++ operator is the value of the operand. After the result is
4113 obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate
4114 type is added to it.) See the discussions of additive operators and compound assignment
4115 for information on constraints, types, and conversions and the effects of operations on
4116 pointers. The side effect of updating the stored value of the operand shall occur between
4117 the previous and the next sequence point.
4118 <p><!--para 3 -->
4119 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
4120 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
4121 it).
4122 <p><b> Forward references</b>: additive operators (<a href="#6.5.6">6.5.6</a>), compound assignment (<a href="#6.5.16.2">6.5.16.2</a>).
4124 <h5><a name="6.5.2.5" href="#6.5.2.5">6.5.2.5 Compound literals</a></h5>
4125 <h6>Constraints</h6>
4126 <p><!--para 1 -->
4127 The type name shall specify an object type or an array of unknown size, but not a variable
4128 length array type.
4129 <p><!--para 2 -->
4130 No initializer shall attempt to provide a value for an object not contained within the entire
4131 unnamed object specified by the compound literal.
4132 <p><!--para 3 -->
4133 If the compound literal occurs outside the body of a function, the initializer list shall
4134 consist of constant expressions.
4135 <h6>Semantics</h6>
4136 <p><!--para 4 -->
4137 A postfix expression that consists of a parenthesized type name followed by a brace-
4138 enclosed list of initializers is a compound literal. It provides an unnamed object whose
4139 value is given by the initializer list.<sup><a href="#note84"><b>84)</b></a></sup>
4140 <p><!--para 5 -->
4141 If the type name specifies an array of unknown size, the size is determined by the
4142 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
4143 completed array type. Otherwise (when the type name specifies an object type), the type
4144 of the compound literal is that specified by the type name. In either case, the result is an
4145 lvalue.
4148 <!--page 88 -->
4149 <p><!--para 6 -->
4150 The value of the compound literal is that of an unnamed object initialized by the
4151 initializer list. If the compound literal occurs outside the body of a function, the object
4152 has static storage duration; otherwise, it has automatic storage duration associated with
4153 the enclosing block.
4154 <p><!--para 7 -->
4155 All the semantic rules and constraints for initializer lists in <a href="#6.7.8">6.7.8</a> are applicable to
4156 compound literals.<sup><a href="#note85"><b>85)</b></a></sup>
4157 <p><!--para 8 -->
4158 String literals, and compound literals with const-qualified types, need not designate
4159 distinct objects.<sup><a href="#note86"><b>86)</b></a></sup>
4160 <p><!--para 9 -->
4161 EXAMPLE 1 The file scope definition
4162 <pre>
4163 int *p = (int []){2, 4};
4164 </pre>
4165 initializes p to point to the first element of an array of two ints, the first having the value two and the
4166 second, four. The expressions in this compound literal are required to be constant. The unnamed object
4167 has static storage duration.
4169 <p><!--para 10 -->
4170 EXAMPLE 2 In contrast, in
4171 <pre>
4172 void f(void)
4174 int *p;
4175 /*...*/
4176 p = (int [2]){*p};
4177 /*...*/
4179 </pre>
4180 p is assigned the address of the first element of an array of two ints, the first having the value previously
4181 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
4182 unnamed object has automatic storage duration.
4184 <p><!--para 11 -->
4185 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
4186 created using compound literals can be passed to functions without depending on member order:
4187 <pre>
4188 drawline((struct point){.x=1, .y=1},
4189 (struct point){.x=3, .y=4});
4190 </pre>
4191 Or, if drawline instead expected pointers to struct point:
4192 <pre>
4193 drawline(&amp;(struct point){.x=1, .y=1},
4194 &amp;(struct point){.x=3, .y=4});
4195 </pre>
4197 <p><!--para 12 -->
4198 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
4199 <pre>
4200 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}
4201 </pre>
4206 <!--page 89 -->
4207 <p><!--para 13 -->
4208 EXAMPLE 5 The following three expressions have different meanings:
4209 <pre>
4210 "/tmp/fileXXXXXX"
4211 (char []){"/tmp/fileXXXXXX"}
4212 (const char []){"/tmp/fileXXXXXX"}
4213 </pre>
4214 The first always has static storage duration and has type array of char, but need not be modifiable; the last
4215 two have automatic storage duration when they occur within the body of a function, and the first of these
4216 two is modifiable.
4218 <p><!--para 14 -->
4219 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
4220 and can even be shared. For example,
4221 <pre>
4222 (const char []){"abc"} == "abc"
4223 </pre>
4224 might yield 1 if the literals' storage is shared.
4226 <p><!--para 15 -->
4227 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
4228 linked object. For example, there is no way to write a self-referential compound literal that could be used
4229 as the function argument in place of the named object endless_zeros below:
4230 <pre>
4231 struct int_list { int car; struct int_list *cdr; };
4232 struct int_list endless_zeros = {0, &amp;endless_zeros};
4233 eval(endless_zeros);
4234 </pre>
4236 <p><!--para 16 -->
4237 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
4238 <pre>
4239 struct s { int i; };
4240 int f (void)
4242 struct s *p = 0, *q;
4243 int j = 0;
4244 again:
4245 q = p, p = &amp;((struct s){ j++ });
4246 if (j &lt; 2) goto again;
4247 return p == q &amp;&amp; q-&gt;i == 1;
4249 </pre>
4250 The function f() always returns the value 1.
4251 <p><!--para 17 -->
4252 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
4253 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
4254 have an indeterminate value, which would result in undefined behavior.
4256 <p><b> Forward references</b>: type names (<a href="#6.7.6">6.7.6</a>), initialization (<a href="#6.7.8">6.7.8</a>).
4257 <!--page 90 -->
4259 <h6>footnotes</h6>
4260 <p><small><a name="note84" href="#note84">84)</a> Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
4261 or void only, and the result of a cast expression is not an lvalue.
4262 </small>
4263 <p><small><a name="note85" href="#note85">85)</a> For example, subobjects without explicit initializers are initialized to zero.
4264 </small>
4265 <p><small><a name="note86" href="#note86">86)</a> This allows implementations to share storage for string literals and constant compound literals with
4266 the same or overlapping representations.
4267 </small>
4269 <h4><a name="6.5.3" href="#6.5.3">6.5.3 Unary operators</a></h4>
4270 <h6>Syntax</h6>
4271 <p><!--para 1 -->
4272 <pre>
4273 unary-expression:
4274 postfix-expression
4275 ++ unary-expression
4276 -- unary-expression
4277 unary-operator cast-expression
4278 sizeof unary-expression
4279 sizeof ( type-name )
4280 unary-operator: one of
4281 &amp; * + - ~ !
4282 </pre>
4284 <h5><a name="6.5.3.1" href="#6.5.3.1">6.5.3.1 Prefix increment and decrement operators</a></h5>
4285 <h6>Constraints</h6>
4286 <p><!--para 1 -->
4287 The operand of the prefix increment or decrement operator shall have qualified or
4288 unqualified real or pointer type and shall be a modifiable lvalue.
4289 <h6>Semantics</h6>
4290 <p><!--para 2 -->
4291 The value of the operand of the prefix ++ operator is incremented. The result is the new
4292 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
4293 See the discussions of additive operators and compound assignment for information on
4294 constraints, types, side effects, and conversions and the effects of operations on pointers.
4295 <p><!--para 3 -->
4296 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
4297 operand is decremented.
4298 <p><b> Forward references</b>: additive operators (<a href="#6.5.6">6.5.6</a>), compound assignment (<a href="#6.5.16.2">6.5.16.2</a>).
4300 <h5><a name="6.5.3.2" href="#6.5.3.2">6.5.3.2 Address and indirection operators</a></h5>
4301 <h6>Constraints</h6>
4302 <p><!--para 1 -->
4303 The operand of the unary &amp; operator shall be either a function designator, the result of a
4304 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
4305 not declared with the register storage-class specifier.
4306 <p><!--para 2 -->
4307 The operand of the unary * operator shall have pointer type.
4308 <h6>Semantics</h6>
4309 <p><!--para 3 -->
4310 The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
4311 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
4312 neither that operator nor the &amp; operator is evaluated and the result is as if both were
4313 omitted, except that the constraints on the operators still apply and the result is not an
4314 lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
4315 <!--page 91 -->
4316 the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
4317 were removed and the [] operator were changed to a + operator. Otherwise, the result is
4318 a pointer to the object or function designated by its operand.
4319 <p><!--para 4 -->
4320 The unary * operator denotes indirection. If the operand points to a function, the result is
4321 a function designator; if it points to an object, the result is an lvalue designating the
4322 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
4323 invalid value has been assigned to the pointer, the behavior of the unary * operator is
4324 undefined.<sup><a href="#note87"><b>87)</b></a></sup>
4325 <p><b> Forward references</b>: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
4326 (<a href="#6.7.2.1">6.7.2.1</a>).
4328 <h6>footnotes</h6>
4329 <p><small><a name="note87" href="#note87">87)</a> Thus, &amp;*E is equivalent to E (even if E is a null pointer), and &amp;(E1[E2]) to ((E1)+(E2)). It is
4330 always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
4331 operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
4332 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
4333 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
4334 address inappropriately aligned for the type of object pointed to, and the address of an object after the
4335 end of its lifetime.
4336 </small>
4338 <h5><a name="6.5.3.3" href="#6.5.3.3">6.5.3.3 Unary arithmetic operators</a></h5>
4339 <h6>Constraints</h6>
4340 <p><!--para 1 -->
4341 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
4342 integer type; of the ! operator, scalar type.
4343 <h6>Semantics</h6>
4344 <p><!--para 2 -->
4345 The result of the unary + operator is the value of its (promoted) operand. The integer
4346 promotions are performed on the operand, and the result has the promoted type.
4347 <p><!--para 3 -->
4348 The result of the unary - operator is the negative of its (promoted) operand. The integer
4349 promotions are performed on the operand, and the result has the promoted type.
4350 <p><!--para 4 -->
4351 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
4352 each bit in the result is set if and only if the corresponding bit in the converted operand is
4353 not set). The integer promotions are performed on the operand, and the result has the
4354 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
4355 to the maximum value representable in that type minus E.
4356 <p><!--para 5 -->
4357 The result of the logical negation operator ! is 0 if the value of its operand compares
4358 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
4359 The expression !E is equivalent to (0==E).
4364 <!--page 92 -->
4366 <h5><a name="6.5.3.4" href="#6.5.3.4">6.5.3.4 The sizeof operator</a></h5>
4367 <h6>Constraints</h6>
4368 <p><!--para 1 -->
4369 The sizeof operator shall not be applied to an expression that has function type or an
4370 incomplete type, to the parenthesized name of such a type, or to an expression that
4371 designates a bit-field member.
4372 <h6>Semantics</h6>
4373 <p><!--para 2 -->
4374 The sizeof operator yields the size (in bytes) of its operand, which may be an
4375 expression or the parenthesized name of a type. The size is determined from the type of
4376 the operand. The result is an integer. If the type of the operand is a variable length array
4377 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
4378 integer constant.
4379 <p><!--para 3 -->
4380 When applied to an operand that has type char, unsigned char, or signed char,
4381 (or a qualified version thereof) the result is 1. When applied to an operand that has array
4382 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
4383 that has structure or union type, the result is the total number of bytes in such an object,
4384 including internal and trailing padding.
4385 <p><!--para 4 -->
4386 The value of the result is implementation-defined, and its type (an unsigned integer type)
4387 is size_t, defined in <a href="#7.17">&lt;stddef.h&gt;</a> (and other headers).
4388 <p><!--para 5 -->
4389 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
4390 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
4391 allocate and return a pointer to void. For example:
4392 <pre>
4393 extern void *alloc(size_t);
4394 double *dp = alloc(sizeof *dp);
4395 </pre>
4396 The implementation of the alloc function should ensure that its return value is aligned suitably for
4397 conversion to a pointer to double.
4399 <p><!--para 6 -->
4400 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
4401 <pre>
4402 sizeof array / sizeof array[0]
4403 </pre>
4405 <p><!--para 7 -->
4406 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
4407 function:
4408 <pre>
4409 #include <a href="#7.17">&lt;stddef.h&gt;</a>
4410 size_t fsize3(int n)
4412 char b[n+3]; // variable length array
4413 return sizeof b; // execution time sizeof
4415 </pre>
4419 <!--page 93 -->
4420 <pre>
4421 int main()
4423 size_t size;
4424 size = fsize3(10); // fsize3 returns 13
4425 return 0;
4427 </pre>
4429 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), declarations (<a href="#6.7">6.7</a>),
4430 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>).
4432 <h6>footnotes</h6>
4433 <p><small><a name="note88" href="#note88">88)</a> When applied to a parameter declared to have array or function type, the sizeof operator yields the
4434 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
4435 </small>
4437 <h4><a name="6.5.4" href="#6.5.4">6.5.4 Cast operators</a></h4>
4438 <h6>Syntax</h6>
4439 <p><!--para 1 -->
4440 <pre>
4441 cast-expression:
4442 unary-expression
4443 ( type-name ) cast-expression
4444 </pre>
4445 <h6>Constraints</h6>
4446 <p><!--para 2 -->
4447 Unless the type name specifies a void type, the type name shall specify qualified or
4448 unqualified scalar type and the operand shall have scalar type.
4449 <p><!--para 3 -->
4450 Conversions that involve pointers, other than where permitted by the constraints of
4451 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
4452 <h6>Semantics</h6>
4453 <p><!--para 4 -->
4454 Preceding an expression by a parenthesized type name converts the value of the
4455 expression to the named type. This construction is called a cast.<sup><a href="#note89"><b>89)</b></a></sup> A cast that specifies
4456 no conversion has no effect on the type or value of an expression.
4457 <p><!--para 5 -->
4458 If the value of the expression is represented with greater precision or range than required
4459 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
4460 type of the expression is the same as the named type.
4461 <p><b> Forward references</b>: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
4462 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>).
4467 <!--page 94 -->
4469 <h6>footnotes</h6>
4470 <p><small><a name="note89" href="#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
4471 unqualified version of the type.
4472 </small>
4474 <h4><a name="6.5.5" href="#6.5.5">6.5.5 Multiplicative operators</a></h4>
4475 <h6>Syntax</h6>
4476 <p><!--para 1 -->
4477 <pre>
4478 multiplicative-expression:
4479 cast-expression
4480 multiplicative-expression * cast-expression
4481 multiplicative-expression / cast-expression
4482 multiplicative-expression % cast-expression
4483 </pre>
4484 <h6>Constraints</h6>
4485 <p><!--para 2 -->
4486 Each of the operands shall have arithmetic type. The operands of the % operator shall
4487 have integer type.
4488 <h6>Semantics</h6>
4489 <p><!--para 3 -->
4490 The usual arithmetic conversions are performed on the operands.
4491 <p><!--para 4 -->
4492 The result of the binary * operator is the product of the operands.
4493 <p><!--para 5 -->
4494 The result of the / operator is the quotient from the division of the first operand by the
4495 second; the result of the % operator is the remainder. In both operations, if the value of
4496 the second operand is zero, the behavior is undefined.
4497 <p><!--para 6 -->
4498 When integers are divided, the result of the / operator is the algebraic quotient with any
4499 fractional part discarded.<sup><a href="#note90"><b>90)</b></a></sup> If the quotient a/b is representable, the expression
4500 (a/b)*b + a%b shall equal a.
4502 <h6>footnotes</h6>
4503 <p><small><a name="note90" href="#note90">90)</a> This is often called ''truncation toward zero''.
4504 </small>
4506 <h4><a name="6.5.6" href="#6.5.6">6.5.6 Additive operators</a></h4>
4507 <h6>Syntax</h6>
4508 <p><!--para 1 -->
4509 <pre>
4510 additive-expression:
4511 multiplicative-expression
4512 additive-expression + multiplicative-expression
4513 additive-expression - multiplicative-expression
4514 </pre>
4515 <h6>Constraints</h6>
4516 <p><!--para 2 -->
4517 For addition, either both operands shall have arithmetic type, or one operand shall be a
4518 pointer to an object type and the other shall have integer type. (Incrementing is
4519 equivalent to adding 1.)
4520 <p><!--para 3 -->
4521 For subtraction, one of the following shall hold:
4522 <ul>
4523 <li> both operands have arithmetic type;
4527 <!--page 95 -->
4528 <li> both operands are pointers to qualified or unqualified versions of compatible object
4529 types; or
4530 <li> the left operand is a pointer to an object type and the right operand has integer type.
4531 </ul>
4532 (Decrementing is equivalent to subtracting 1.)
4533 <h6>Semantics</h6>
4534 <p><!--para 4 -->
4535 If both operands have arithmetic type, the usual arithmetic conversions are performed on
4536 them.
4537 <p><!--para 5 -->
4538 The result of the binary + operator is the sum of the operands.
4539 <p><!--para 6 -->
4540 The result of the binary - operator is the difference resulting from the subtraction of the
4541 second operand from the first.
4542 <p><!--para 7 -->
4543 For the purposes of these operators, a pointer to an object that is not an element of an
4544 array behaves the same as a pointer to the first element of an array of length one with the
4545 type of the object as its element type.
4546 <p><!--para 8 -->
4547 When an expression that has integer type is added to or subtracted from a pointer, the
4548 result has the type of the pointer operand. If the pointer operand points to an element of
4549 an array object, and the array is large enough, the result points to an element offset from
4550 the original element such that the difference of the subscripts of the resulting and original
4551 array elements equals the integer expression. In other words, if the expression P points to
4552 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
4553 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
4554 the array object, provided they exist. Moreover, if the expression P points to the last
4555 element of an array object, the expression (P)+1 points one past the last element of the
4556 array object, and if the expression Q points one past the last element of an array object,
4557 the expression (Q)-1 points to the last element of the array object. If both the pointer
4558 operand and the result point to elements of the same array object, or one past the last
4559 element of the array object, the evaluation shall not produce an overflow; otherwise, the
4560 behavior is undefined. If the result points one past the last element of the array object, it
4561 shall not be used as the operand of a unary * operator that is evaluated.
4562 <p><!--para 9 -->
4563 When two pointers are subtracted, both shall point to elements of the same array object,
4564 or one past the last element of the array object; the result is the difference of the
4565 subscripts of the two array elements. The size of the result is implementation-defined,
4566 and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.17">&lt;stddef.h&gt;</a> header.
4567 If the result is not representable in an object of that type, the behavior is undefined. In
4568 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
4569 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
4570 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
4571 an array object or one past the last element of an array object, and the expression Q points
4572 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
4573 <!--page 96 -->
4574 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
4575 expression P points one past the last element of the array object, even though the
4576 expression (Q)+1 does not point to an element of the array object.<sup><a href="#note91"><b>91)</b></a></sup>
4577 <p><!--para 10 -->
4578 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
4579 <p><!--para 11 -->
4580 <pre>
4582 int n = 4, m = 3;
4583 int a[n][m];
4584 int (*p)[m] = a; // p == &amp;a[0]
4585 p += 1; // p == &amp;a[1]
4586 (*p)[2] = 99; // a[1][2] == 99
4587 n = p - a; // n == 1
4589 </pre>
4590 If array a in the above example were declared to be an array of known constant size, and pointer p were
4591 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
4592 the same.
4594 <p><b> Forward references</b>: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), common definitions <a href="#7.17">&lt;stddef.h&gt;</a>
4595 (<a href="#7.17">7.17</a>).
4597 <h6>footnotes</h6>
4598 <p><small><a name="note91" href="#note91">91)</a> Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
4599 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
4600 by the size of the object originally pointed to, and the resulting pointer is converted back to the
4601 original type. For pointer subtraction, the result of the difference between the character pointers is
4602 similarly divided by the size of the object originally pointed to.
4603 When viewed in this way, an implementation need only provide one extra byte (which may overlap
4604 another object in the program) just after the end of the object in order to satisfy the ''one past the last
4605 element'' requirements.
4606 </small>
4608 <h4><a name="6.5.7" href="#6.5.7">6.5.7 Bitwise shift operators</a></h4>
4609 <h6>Syntax</h6>
4610 <p><!--para 1 -->
4611 <pre>
4612 shift-expression:
4613 additive-expression
4614 shift-expression &lt;&lt; additive-expression
4615 shift-expression &gt;&gt; additive-expression
4616 </pre>
4617 <h6>Constraints</h6>
4618 <p><!--para 2 -->
4619 Each of the operands shall have integer type.
4620 <h6>Semantics</h6>
4621 <p><!--para 3 -->
4622 The integer promotions are performed on each of the operands. The type of the result is
4623 that of the promoted left operand. If the value of the right operand is negative or is
4624 greater than or equal to the width of the promoted left operand, the behavior is undefined.
4629 <!--page 97 -->
4630 <p><!--para 4 -->
4631 The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
4632 zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
4633 one more than the maximum value representable in the result type. If E1 has a signed
4634 type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
4635 the resulting value; otherwise, the behavior is undefined.
4636 <p><!--para 5 -->
4637 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
4638 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
4639 part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
4640 resulting value is implementation-defined.
4642 <h4><a name="6.5.8" href="#6.5.8">6.5.8 Relational operators</a></h4>
4643 <h6>Syntax</h6>
4644 <p><!--para 1 -->
4645 <pre>
4646 relational-expression:
4647 shift-expression
4648 relational-expression &lt; shift-expression
4649 relational-expression &gt; shift-expression
4650 relational-expression &lt;= shift-expression
4651 relational-expression &gt;= shift-expression
4652 </pre>
4653 <h6>Constraints</h6>
4654 <p><!--para 2 -->
4655 One of the following shall hold:
4656 <ul>
4657 <li> both operands have real type;
4658 <li> both operands are pointers to qualified or unqualified versions of compatible object
4659 types; or
4660 <li> both operands are pointers to qualified or unqualified versions of compatible
4661 incomplete types.
4662 </ul>
4663 <h6>Semantics</h6>
4664 <p><!--para 3 -->
4665 If both of the operands have arithmetic type, the usual arithmetic conversions are
4666 performed.
4667 <p><!--para 4 -->
4668 For the purposes of these operators, a pointer to an object that is not an element of an
4669 array behaves the same as a pointer to the first element of an array of length one with the
4670 type of the object as its element type.
4671 <p><!--para 5 -->
4672 When two pointers are compared, the result depends on the relative locations in the
4673 address space of the objects pointed to. If two pointers to object or incomplete types both
4674 point to the same object, or both point one past the last element of the same array object,
4675 they compare equal. If the objects pointed to are members of the same aggregate object,
4676 pointers to structure members declared later compare greater than pointers to members
4677 declared earlier in the structure, and pointers to array elements with larger subscript
4678 <!--page 98 -->
4679 values compare greater than pointers to elements of the same array with lower subscript
4680 values. All pointers to members of the same union object compare equal. If the
4681 expression P points to an element of an array object and the expression Q points to the
4682 last element of the same array object, the pointer expression Q+1 compares greater than
4683 P. In all other cases, the behavior is undefined.
4684 <p><!--para 6 -->
4685 Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
4686 (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>
4687 The result has type int.
4689 <h6>footnotes</h6>
4690 <p><small><a name="note92" href="#note92">92)</a> The expression a&lt;b&lt;c is not interpreted as in ordinary mathematics. As the syntax indicates, it
4691 means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
4692 </small>
4694 <h4><a name="6.5.9" href="#6.5.9">6.5.9 Equality operators</a></h4>
4695 <h6>Syntax</h6>
4696 <p><!--para 1 -->
4697 <pre>
4698 equality-expression:
4699 relational-expression
4700 equality-expression == relational-expression
4701 equality-expression != relational-expression
4702 </pre>
4703 <h6>Constraints</h6>
4704 <p><!--para 2 -->
4705 One of the following shall hold:
4706 <ul>
4707 <li> both operands have arithmetic type;
4708 <li> both operands are pointers to qualified or unqualified versions of compatible types;
4709 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4710 qualified or unqualified version of void; or
4711 <li> one operand is a pointer and the other is a null pointer constant.
4712 </ul>
4713 <h6>Semantics</h6>
4714 <p><!--para 3 -->
4715 The == (equal to) and != (not equal to) operators are analogous to the relational
4716 operators except for their lower precedence.<sup><a href="#note93"><b>93)</b></a></sup> Each of the operators yields 1 if the
4717 specified relation is true and 0 if it is false. The result has type int. For any pair of
4718 operands, exactly one of the relations is true.
4719 <p><!--para 4 -->
4720 If both of the operands have arithmetic type, the usual arithmetic conversions are
4721 performed. Values of complex types are equal if and only if both their real parts are equal
4722 and also their imaginary parts are equal. Any two values of arithmetic types from
4723 different type domains are equal if and only if the results of their conversions to the
4724 (complex) result type determined by the usual arithmetic conversions are equal.
4727 <!--page 99 -->
4728 <p><!--para 5 -->
4729 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
4730 null pointer constant, the null pointer constant is converted to the type of the pointer. If
4731 one operand is a pointer to an object or incomplete type and the other is a pointer to a
4732 qualified or unqualified version of void, the former is converted to the type of the latter.
4733 <p><!--para 6 -->
4734 Two pointers compare equal if and only if both are null pointers, both are pointers to the
4735 same object (including a pointer to an object and a subobject at its beginning) or function,
4736 both are pointers to one past the last element of the same array object, or one is a pointer
4737 to one past the end of one array object and the other is a pointer to the start of a different
4738 array object that happens to immediately follow the first array object in the address
4739 space.<sup><a href="#note94"><b>94)</b></a></sup>
4740 <p><!--para 7 -->
4741 For the purposes of these operators, a pointer to an object that is not an element of an
4742 array behaves the same as a pointer to the first element of an array of length one with the
4743 type of the object as its element type.
4745 <h6>footnotes</h6>
4746 <p><small><a name="note93" href="#note93">93)</a> Because of the precedences, a&lt;b == c&lt;d is 1 whenever a&lt;b and c&lt;d have the same truth-value.
4747 </small>
4748 <p><small><a name="note94" href="#note94">94)</a> Two objects may be adjacent in memory because they are adjacent elements of a larger array or
4749 adjacent members of a structure with no padding between them, or because the implementation chose
4750 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
4751 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
4752 behavior.
4753 </small>
4755 <h4><a name="6.5.10" href="#6.5.10">6.5.10 Bitwise AND operator</a></h4>
4756 <h6>Syntax</h6>
4757 <p><!--para 1 -->
4758 <pre>
4759 AND-expression:
4760 equality-expression
4761 AND-expression &amp; equality-expression
4762 </pre>
4763 <h6>Constraints</h6>
4764 <p><!--para 2 -->
4765 Each of the operands shall have integer type.
4766 <h6>Semantics</h6>
4767 <p><!--para 3 -->
4768 The usual arithmetic conversions are performed on the operands.
4769 <p><!--para 4 -->
4770 The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
4771 the result is set if and only if each of the corresponding bits in the converted operands is
4772 set).
4777 <!--page 100 -->
4779 <h4><a name="6.5.11" href="#6.5.11">6.5.11 Bitwise exclusive OR operator</a></h4>
4780 <h6>Syntax</h6>
4781 <p><!--para 1 -->
4782 <pre>
4783 exclusive-OR-expression:
4784 AND-expression
4785 exclusive-OR-expression ^ AND-expression
4786 </pre>
4787 <h6>Constraints</h6>
4788 <p><!--para 2 -->
4789 Each of the operands shall have integer type.
4790 <h6>Semantics</h6>
4791 <p><!--para 3 -->
4792 The usual arithmetic conversions are performed on the operands.
4793 <p><!--para 4 -->
4794 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
4795 in the result is set if and only if exactly one of the corresponding bits in the converted
4796 operands is set).
4798 <h4><a name="6.5.12" href="#6.5.12">6.5.12 Bitwise inclusive OR operator</a></h4>
4799 <h6>Syntax</h6>
4800 <p><!--para 1 -->
4801 <pre>
4802 inclusive-OR-expression:
4803 exclusive-OR-expression
4804 inclusive-OR-expression | exclusive-OR-expression
4805 </pre>
4806 <h6>Constraints</h6>
4807 <p><!--para 2 -->
4808 Each of the operands shall have integer type.
4809 <h6>Semantics</h6>
4810 <p><!--para 3 -->
4811 The usual arithmetic conversions are performed on the operands.
4812 <p><!--para 4 -->
4813 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
4814 the result is set if and only if at least one of the corresponding bits in the converted
4815 operands is set).
4816 <!--page 101 -->
4818 <h4><a name="6.5.13" href="#6.5.13">6.5.13 Logical AND operator</a></h4>
4819 <h6>Syntax</h6>
4820 <p><!--para 1 -->
4821 <pre>
4822 logical-AND-expression:
4823 inclusive-OR-expression
4824 logical-AND-expression &amp;&amp; inclusive-OR-expression
4825 </pre>
4826 <h6>Constraints</h6>
4827 <p><!--para 2 -->
4828 Each of the operands shall have scalar type.
4829 <h6>Semantics</h6>
4830 <p><!--para 3 -->
4831 The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
4832 yields 0. The result has type int.
4833 <p><!--para 4 -->
4834 Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
4835 there is a sequence point after the evaluation of the first operand. If the first operand
4836 compares equal to 0, the second operand is not evaluated.
4838 <h4><a name="6.5.14" href="#6.5.14">6.5.14 Logical OR operator</a></h4>
4839 <h6>Syntax</h6>
4840 <p><!--para 1 -->
4841 <pre>
4842 logical-OR-expression:
4843 logical-AND-expression
4844 logical-OR-expression || logical-AND-expression
4845 </pre>
4846 <h6>Constraints</h6>
4847 <p><!--para 2 -->
4848 Each of the operands shall have scalar type.
4849 <h6>Semantics</h6>
4850 <p><!--para 3 -->
4851 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
4852 yields 0. The result has type int.
4853 <p><!--para 4 -->
4854 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is
4855 a sequence point after the evaluation of the first operand. If the first operand compares
4856 unequal to 0, the second operand is not evaluated.
4857 <!--page 102 -->
4859 <h4><a name="6.5.15" href="#6.5.15">6.5.15 Conditional operator</a></h4>
4860 <h6>Syntax</h6>
4861 <p><!--para 1 -->
4862 <pre>
4863 conditional-expression:
4864 logical-OR-expression
4865 logical-OR-expression ? expression : conditional-expression
4866 </pre>
4867 <h6>Constraints</h6>
4868 <p><!--para 2 -->
4869 The first operand shall have scalar type.
4870 <p><!--para 3 -->
4871 One of the following shall hold for the second and third operands:
4872 <ul>
4873 <li> both operands have arithmetic type;
4874 <li> both operands have the same structure or union type;
4875 <li> both operands have void type;
4876 <li> both operands are pointers to qualified or unqualified versions of compatible types;
4877 <li> one operand is a pointer and the other is a null pointer constant; or
4878 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4879 qualified or unqualified version of void.
4880 </ul>
4881 <h6>Semantics</h6>
4882 <p><!--para 4 -->
4883 The first operand is evaluated; there is a sequence point after its evaluation. The second
4884 operand is evaluated only if the first compares unequal to 0; the third operand is evaluated
4885 only if the first compares equal to 0; the result is the value of the second or third operand
4886 (whichever is evaluated), converted to the type described below.<sup><a href="#note95"><b>95)</b></a></sup> If an attempt is made
4887 to modify the result of a conditional operator or to access it after the next sequence point,
4888 the behavior is undefined.
4889 <p><!--para 5 -->
4890 If both the second and third operands have arithmetic type, the result type that would be
4891 determined by the usual arithmetic conversions, were they applied to those two operands,
4892 is the type of the result. If both the operands have structure or union type, the result has
4893 that type. If both operands have void type, the result has void type.
4894 <p><!--para 6 -->
4895 If both the second and third operands are pointers or one is a null pointer constant and the
4896 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
4897 of the types pointed-to by both operands. Furthermore, if both operands are pointers to
4898 compatible types or to differently qualified versions of compatible types, the result type is
4899 a pointer to an appropriately qualified version of the composite type; if one operand is a
4900 null pointer constant, the result has the type of the other operand; otherwise, one operand
4901 is a pointer to void or a qualified version of void, in which case the result type is a
4903 <!--page 103 -->
4904 pointer to an appropriately qualified version of void.
4905 <p><!--para 7 -->
4906 EXAMPLE The common type that results when the second and third operands are pointers is determined
4907 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
4908 pointers have compatible types.
4909 <p><!--para 8 -->
4910 Given the declarations
4911 <pre>
4912 const void *c_vp;
4913 void *vp;
4914 const int *c_ip;
4915 volatile int *v_ip;
4916 int *ip;
4917 const char *c_cp;
4918 </pre>
4919 the third column in the following table is the common type that is the result of a conditional expression in
4920 which the first two columns are the second and third operands (in either order):
4921 <pre>
4922 c_vp c_ip const void *
4923 v_ip 0 volatile int *
4924 c_ip v_ip const volatile int *
4925 vp c_cp const void *
4926 ip c_ip const int *
4927 vp ip void *
4928 </pre>
4931 <h6>footnotes</h6>
4932 <p><small><a name="note95" href="#note95">95)</a> A conditional expression does not yield an lvalue.
4933 </small>
4935 <h4><a name="6.5.16" href="#6.5.16">6.5.16 Assignment operators</a></h4>
4936 <h6>Syntax</h6>
4937 <p><!--para 1 -->
4938 <pre>
4939 assignment-expression:
4940 conditional-expression
4941 unary-expression assignment-operator assignment-expression
4942 assignment-operator: one of
4943 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
4944 </pre>
4945 <h6>Constraints</h6>
4946 <p><!--para 2 -->
4947 An assignment operator shall have a modifiable lvalue as its left operand.
4948 <h6>Semantics</h6>
4949 <p><!--para 3 -->
4950 An assignment operator stores a value in the object designated by the left operand. An
4951 assignment expression has the value of the left operand after the assignment, but is not an
4952 lvalue. The type of an assignment expression is the type of the left operand unless the
4953 left operand has qualified type, in which case it is the unqualified version of the type of
4954 the left operand. The side effect of updating the stored value of the left operand shall
4955 occur between the previous and the next sequence point.
4956 <p><!--para 4 -->
4957 The order of evaluation of the operands is unspecified. If an attempt is made to modify
4958 the result of an assignment operator or to access it after the next sequence point, the
4959 behavior is undefined.
4960 <!--page 104 -->
4962 <h5><a name="6.5.16.1" href="#6.5.16.1">6.5.16.1 Simple assignment</a></h5>
4963 <h6>Constraints</h6>
4964 <p><!--para 1 -->
4965 One of the following shall hold:<sup><a href="#note96"><b>96)</b></a></sup>
4966 <ul>
4967 <li> the left operand has qualified or unqualified arithmetic type and the right has
4968 arithmetic type;
4969 <li> the left operand has a qualified or unqualified version of a structure or union type
4970 compatible with the type of the right;
4971 <li> both operands are pointers to qualified or unqualified versions of compatible types,
4972 and the type pointed to by the left has all the qualifiers of the type pointed to by the
4973 right;
4974 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4975 qualified or unqualified version of void, and the type pointed to by the left has all
4976 the qualifiers of the type pointed to by the right;
4977 <li> the left operand is a pointer and the right is a null pointer constant; or
4978 <li> the left operand has type _Bool and the right is a pointer.
4979 </ul>
4980 <h6>Semantics</h6>
4981 <p><!--para 2 -->
4982 In simple assignment (=), the value of the right operand is converted to the type of the
4983 assignment expression and replaces the value stored in the object designated by the left
4984 operand.
4985 <p><!--para 3 -->
4986 If the value being stored in an object is read from another object that overlaps in any way
4987 the storage of the first object, then the overlap shall be exact and the two objects shall
4988 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
4989 undefined.
4990 <p><!--para 4 -->
4991 EXAMPLE 1 In the program fragment
4992 <pre>
4993 int f(void);
4994 char c;
4995 /* ... */
4996 if ((c = f()) == -1)
4997 /* ... */
4998 </pre>
4999 the int value returned by the function may be truncated when stored in the char, and then converted back
5000 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
5001 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
5005 <!--page 105 -->
5006 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
5007 variable c should be declared as int.
5009 <p><!--para 5 -->
5010 EXAMPLE 2 In the fragment:
5011 <pre>
5012 char c;
5013 int i;
5014 long l;
5015 l = (c = i);
5016 </pre>
5017 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
5018 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
5019 that is, long int type.
5021 <p><!--para 6 -->
5022 EXAMPLE 3 Consider the fragment:
5023 <pre>
5024 const char **cpp;
5025 char *p;
5026 const char c = 'A';
5027 cpp = &amp;p; // constraint violation
5028 *cpp = &amp;c; // valid
5029 *p = 0; // valid
5030 </pre>
5031 The first assignment is unsafe because it would allow the following valid code to attempt to change the
5032 value of the const object c.
5035 <h6>footnotes</h6>
5036 <p><small><a name="note96" href="#note96">96)</a> The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
5037 (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
5038 qualifiers that were applied to the type category of the expression (for example, it removes const but
5039 not volatile from the type int volatile * const).
5040 </small>
5042 <h5><a name="6.5.16.2" href="#6.5.16.2">6.5.16.2 Compound assignment</a></h5>
5043 <h6>Constraints</h6>
5044 <p><!--para 1 -->
5045 For the operators += and -= only, either the left operand shall be a pointer to an object
5046 type and the right shall have integer type, or the left operand shall have qualified or
5047 unqualified arithmetic type and the right shall have arithmetic type.
5048 <p><!--para 2 -->
5049 For the other operators, each operand shall have arithmetic type consistent with those
5050 allowed by the corresponding binary operator.
5051 <h6>Semantics</h6>
5052 <p><!--para 3 -->
5053 A compound assignment of the form E1 op = E2 differs from the simple assignment
5054 expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
5055 <!--page 106 -->
5057 <h4><a name="6.5.17" href="#6.5.17">6.5.17 Comma operator</a></h4>
5058 <h6>Syntax</h6>
5059 <p><!--para 1 -->
5060 <pre>
5061 expression:
5062 assignment-expression
5063 expression , assignment-expression
5064 </pre>
5065 <h6>Semantics</h6>
5066 <p><!--para 2 -->
5067 The left operand of a comma operator is evaluated as a void expression; there is a
5068 sequence point after its evaluation. Then the right operand is evaluated; the result has its
5069 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
5070 access it after the next sequence point, the behavior is undefined.
5071 <p><!--para 3 -->
5072 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
5073 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
5074 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
5075 expression of a conditional operator in such contexts. In the function call
5076 <pre>
5077 f(a, (t=3, t+2), c)
5078 </pre>
5079 the function has three arguments, the second of which has the value 5.
5081 <p><b> Forward references</b>: initialization (<a href="#6.7.8">6.7.8</a>).
5086 <!--page 107 -->
5088 <h6>footnotes</h6>
5089 <p><small><a name="note97" href="#note97">97)</a> A comma operator does not yield an lvalue.
5090 </small>
5092 <h3><a name="6.6" href="#6.6">6.6 Constant expressions</a></h3>
5093 <h6>Syntax</h6>
5094 <p><!--para 1 -->
5095 <pre>
5096 constant-expression:
5097 conditional-expression
5098 </pre>
5099 <h6>Description</h6>
5100 <p><!--para 2 -->
5101 A constant expression can be evaluated during translation rather than runtime, and
5102 accordingly may be used in any place that a constant may be.
5103 <h6>Constraints</h6>
5104 <p><!--para 3 -->
5105 Constant expressions shall not contain assignment, increment, decrement, function-call,
5106 or comma operators, except when they are contained within a subexpression that is not
5107 evaluated.<sup><a href="#note98"><b>98)</b></a></sup>
5108 <p><!--para 4 -->
5109 Each constant expression shall evaluate to a constant that is in the range of representable
5110 values for its type.
5111 <h6>Semantics</h6>
5112 <p><!--para 5 -->
5113 An expression that evaluates to a constant is required in several contexts. If a floating
5114 expression is evaluated in the translation environment, the arithmetic precision and range
5115 shall be at least as great as if the expression were being evaluated in the execution
5116 environment.
5117 <p><!--para 6 -->
5118 An integer constant expression<sup><a href="#note99"><b>99)</b></a></sup> shall have integer type and shall only have operands
5119 that are integer constants, enumeration constants, character constants, sizeof
5120 expressions whose results are integer constants, and floating constants that are the
5121 immediate operands of casts. Cast operators in an integer constant expression shall only
5122 convert arithmetic types to integer types, except as part of an operand to the sizeof
5123 operator.
5124 <p><!--para 7 -->
5125 More latitude is permitted for constant expressions in initializers. Such a constant
5126 expression shall be, or evaluate to, one of the following:
5127 <ul>
5128 <li> an arithmetic constant expression,
5129 <li> a null pointer constant,
5134 <!--page 108 -->
5135 <li> an address constant, or
5136 <li> an address constant for an object type plus or minus an integer constant expression.
5137 </ul>
5138 <p><!--para 8 -->
5139 An arithmetic constant expression shall have arithmetic type and shall only have
5140 operands that are integer constants, floating constants, enumeration constants, character
5141 constants, and sizeof expressions. Cast operators in an arithmetic constant expression
5142 shall only convert arithmetic types to arithmetic types, except as part of an operand to a
5143 sizeof operator whose result is an integer constant.
5144 <p><!--para 9 -->
5145 An address constant is a null pointer, a pointer to an lvalue designating an object of static
5146 storage duration, or a pointer to a function designator; it shall be created explicitly using
5147 the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
5148 an expression of array or function type. The array-subscript [] and member-access .
5149 and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
5150 be used in the creation of an address constant, but the value of an object shall not be
5151 accessed by use of these operators.
5152 <p><!--para 10 -->
5153 An implementation may accept other forms of constant expressions.
5154 <p><!--para 11 -->
5155 The semantic rules for the evaluation of a constant expression are the same as for
5156 nonconstant expressions.<sup><a href="#note100"><b>100)</b></a></sup>
5157 <p><b> Forward references</b>: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
5162 <!--page 109 -->
5164 <h6>footnotes</h6>
5165 <p><small><a name="note98" href="#note98">98)</a> The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
5166 </small>
5167 <p><small><a name="note99" href="#note99">99)</a> An integer constant expression is used to specify the size of a bit-field member of a structure, the
5168 value of an enumeration constant, the size of an array, or the value of a case constant. Further
5169 constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing
5170 directives are discussed in <a href="#6.10.1">6.10.1</a>.
5171 </small>
5172 <p><small><a name="note100" href="#note100">100)</a> Thus, in the following initialization,
5174 <pre>
5175 static int i = 2 || 1 / 0;
5176 </pre>
5177 the expression is a valid integer constant expression with value one.
5178 </small>
5180 <h3><a name="6.7" href="#6.7">6.7 Declarations</a></h3>
5181 <h6>Syntax</h6>
5182 <p><!--para 1 -->
5183 <pre>
5184 declaration:
5185 declaration-specifiers init-declarator-list<sub>opt</sub> ;
5186 declaration-specifiers:
5187 storage-class-specifier declaration-specifiers<sub>opt</sub>
5188 type-specifier declaration-specifiers<sub>opt</sub>
5189 type-qualifier declaration-specifiers<sub>opt</sub>
5190 function-specifier declaration-specifiers<sub>opt</sub>
5191 init-declarator-list:
5192 init-declarator
5193 init-declarator-list , init-declarator
5194 init-declarator:
5195 declarator
5196 declarator = initializer
5197 </pre>
5198 <h6>Constraints</h6>
5199 <p><!--para 2 -->
5200 A declaration shall declare at least a declarator (other than the parameters of a function or
5201 the members of a structure or union), a tag, or the members of an enumeration.
5202 <p><!--para 3 -->
5203 If an identifier has no linkage, there shall be no more than one declaration of the identifier
5204 (in a declarator or type specifier) with the same scope and in the same name space, except
5205 for tags as specified in <a href="#6.7.2.3">6.7.2.3</a>.
5206 <p><!--para 4 -->
5207 All declarations in the same scope that refer to the same object or function shall specify
5208 compatible types.
5209 <h6>Semantics</h6>
5210 <p><!--para 5 -->
5211 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
5212 of an identifier is a declaration for that identifier that:
5213 <ul>
5214 <li> for an object, causes storage to be reserved for that object;
5215 <li> for a function, includes the function body;<sup><a href="#note101"><b>101)</b></a></sup>
5216 <li> for an enumeration constant or typedef name, is the (only) declaration of the
5217 identifier.
5218 </ul>
5219 <p><!--para 6 -->
5220 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
5221 storage duration, and part of the type of the entities that the declarators denote. The init-
5222 declarator-list is a comma-separated sequence of declarators, each of which may have
5224 <!--page 110 -->
5225 additional type information, or an initializer, or both. The declarators contain the
5226 identifiers (if any) being declared.
5227 <p><!--para 7 -->
5228 If an identifier for an object is declared with no linkage, the type for the object shall be
5229 complete by the end of its declarator, or by the end of its init-declarator if it has an
5230 initializer; in the case of function parameters (including in prototypes), it is the adjusted
5231 type (see <a href="#6.7.5.3">6.7.5.3</a>) that is required to be complete.
5232 <p><b> Forward references</b>: declarators (<a href="#6.7.5">6.7.5</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
5233 (<a href="#6.7.8">6.7.8</a>).
5235 <h6>footnotes</h6>
5236 <p><small><a name="note101" href="#note101">101)</a> Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
5237 </small>
5239 <h4><a name="6.7.1" href="#6.7.1">6.7.1 Storage-class specifiers</a></h4>
5240 <h6>Syntax</h6>
5241 <p><!--para 1 -->
5242 <pre>
5243 storage-class-specifier:
5244 typedef
5245 extern
5246 static
5247 auto
5248 register
5249 </pre>
5250 <h6>Constraints</h6>
5251 <p><!--para 2 -->
5252 At most, one storage-class specifier may be given in the declaration specifiers in a
5253 declaration.<sup><a href="#note102"><b>102)</b></a></sup>
5254 <h6>Semantics</h6>
5255 <p><!--para 3 -->
5256 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
5257 only; it is discussed in <a href="#6.7.7">6.7.7</a>. The meanings of the various linkages and storage durations
5258 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
5259 <p><!--para 4 -->
5260 A declaration of an identifier for an object with storage-class specifier register
5261 suggests that access to the object be as fast as possible. The extent to which such
5262 suggestions are effective is implementation-defined.<sup><a href="#note103"><b>103)</b></a></sup>
5263 <p><!--para 5 -->
5264 The declaration of an identifier for a function that has block scope shall have no explicit
5265 storage-class specifier other than extern.
5269 <!--page 111 -->
5270 <p><!--para 6 -->
5271 If an aggregate or union object is declared with a storage-class specifier other than
5272 typedef, the properties resulting from the storage-class specifier, except with respect to
5273 linkage, also apply to the members of the object, and so on recursively for any aggregate
5274 or union member objects.
5275 <p><b> Forward references</b>: type definitions (<a href="#6.7.7">6.7.7</a>).
5277 <h6>footnotes</h6>
5278 <p><small><a name="note102" href="#note102">102)</a> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
5279 </small>
5280 <p><small><a name="note103" href="#note103">103)</a> The implementation may treat any register declaration simply as an auto declaration. However,
5281 whether or not addressable storage is actually used, the address of any part of an object declared with
5282 storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
5283 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
5284 <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
5285 register is sizeof.
5286 </small>
5288 <h4><a name="6.7.2" href="#6.7.2">6.7.2 Type specifiers</a></h4>
5289 <h6>Syntax</h6>
5290 <p><!--para 1 -->
5291 <pre>
5292 type-specifier:
5293 void
5294 char
5295 short
5297 long
5298 float
5299 double
5300 signed
5301 unsigned
5302 _Bool
5303 _Complex
5304 struct-or-union-specifier *
5305 enum-specifier
5306 typedef-name
5307 </pre>
5308 <h6>Constraints</h6>
5309 <p><!--para 2 -->
5310 At least one type specifier shall be given in the declaration specifiers in each declaration,
5311 and in the specifier-qualifier list in each struct declaration and type name. Each list of
5312 type specifiers shall be one of the following sets (delimited by commas, when there is
5313 more than one set on a line); the type specifiers may occur in any order, possibly
5314 intermixed with the other declaration specifiers.
5315 <ul>
5316 <li> void
5317 <li> char
5318 <li> signed char
5319 <li> unsigned char
5320 <li> short, signed short, short int, or signed short int
5321 <li> unsigned short, or unsigned short int
5322 <li> int, signed, or signed int
5323 <!--page 112 -->
5324 <li> unsigned, or unsigned int
5325 <li> long, signed long, long int, or signed long int
5326 <li> unsigned long, or unsigned long int
5327 <li> long long, signed long long, long long int, or
5328 signed long long int
5329 <li> unsigned long long, or unsigned long long int
5330 <li> float
5331 <li> double
5332 <li> long double
5333 <li> _Bool
5334 <li> float _Complex
5335 <li> double _Complex
5336 <li> long double _Complex
5337 <li> struct or union specifier *
5338 <li> enum specifier
5339 <li> typedef name
5340 </ul>
5341 <p><!--para 3 -->
5342 The type specifier _Complex shall not be used if the implementation does not provide
5343 complex types.<sup><a href="#note104"><b>104)</b></a></sup>
5344 <h6>Semantics</h6>
5345 <p><!--para 4 -->
5346 Specifiers for structures, unions, and enumerations are discussed in <a href="#6.7.2.1">6.7.2.1</a> through
5347 <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
5348 other types are discussed in <a href="#6.2.5">6.2.5</a>.
5349 <p><!--para 5 -->
5350 Each of the comma-separated sets designates the same type, except that for bit-fields, it is
5351 implementation-defined whether the specifier int designates the same type as signed
5352 int or the same type as unsigned int.
5353 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
5354 (<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>).
5359 <!--page 113 -->
5361 <h6>footnotes</h6>
5362 <p><small><a name="note104" href="#note104">104)</a> Freestanding implementations are not required to provide complex types. *
5363 </small>
5365 <h5><a name="6.7.2.1" href="#6.7.2.1">6.7.2.1 Structure and union specifiers</a></h5>
5366 <h6>Syntax</h6>
5367 <p><!--para 1 -->
5368 <pre>
5369 struct-or-union-specifier:
5370 struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
5371 struct-or-union identifier
5372 struct-or-union:
5373 struct
5374 union
5375 struct-declaration-list:
5376 struct-declaration
5377 struct-declaration-list struct-declaration
5378 struct-declaration:
5379 specifier-qualifier-list struct-declarator-list ;
5380 specifier-qualifier-list:
5381 type-specifier specifier-qualifier-list<sub>opt</sub>
5382 type-qualifier specifier-qualifier-list<sub>opt</sub>
5383 struct-declarator-list:
5384 struct-declarator
5385 struct-declarator-list , struct-declarator
5386 struct-declarator:
5387 declarator
5388 declarator<sub>opt</sub> : constant-expression
5389 </pre>
5390 <h6>Constraints</h6>
5391 <p><!--para 2 -->
5392 A structure or union shall not contain a member with incomplete or function type (hence,
5393 a structure shall not contain an instance of itself, but may contain a pointer to an instance
5394 of itself), except that the last member of a structure with more than one named member
5395 may have incomplete array type; such a structure (and any union containing, possibly
5396 recursively, a member that is such a structure) shall not be a member of a structure or an
5397 element of an array.
5398 <p><!--para 3 -->
5399 The expression that specifies the width of a bit-field shall be an integer constant
5400 expression with a nonnegative value that does not exceed the width of an object of the
5401 type that would be specified were the colon and expression omitted. If the value is zero,
5402 the declaration shall have no declarator.
5403 <p><!--para 4 -->
5404 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
5405 int, unsigned int, or some other implementation-defined type.
5406 <!--page 114 -->
5407 <h6>Semantics</h6>
5408 <p><!--para 5 -->
5409 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
5410 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
5411 of members whose storage overlap.
5412 <p><!--para 6 -->
5413 Structure and union specifiers have the same form. The keywords struct and union
5414 indicate that the type being specified is, respectively, a structure type or a union type.
5415 <p><!--para 7 -->
5416 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
5417 within a translation unit. The struct-declaration-list is a sequence of declarations for the
5418 members of the structure or union. If the struct-declaration-list contains no named
5419 members, the behavior is undefined. The type is incomplete until after the } that
5420 terminates the list.
5421 <p><!--para 8 -->
5422 A member of a structure or union may have any object type other than a variably
5423 modified type.<sup><a href="#note105"><b>105)</b></a></sup> In addition, a member may be declared to consist of a specified
5424 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
5425 width is preceded by a colon.
5426 <p><!--para 9 -->
5427 A bit-field is interpreted as a signed or unsigned integer type consisting of the specified
5428 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
5429 _Bool, the value of the bit-field shall compare equal to the value stored.
5430 <p><!--para 10 -->
5431 An implementation may allocate any addressable storage unit large enough to hold a bit-
5432 field. If enough space remains, a bit-field that immediately follows another bit-field in a
5433 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
5434 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
5435 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
5436 low-order or low-order to high-order) is implementation-defined. The alignment of the
5437 addressable storage unit is unspecified.
5438 <p><!--para 11 -->
5439 A bit-field declaration with no declarator, but only a colon and a width, indicates an
5440 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
5441 indicates that no further bit-field is to be packed into the unit in which the previous bit-
5442 field, if any, was placed.
5445 <!--page 115 -->
5446 <p><!--para 12 -->
5447 Each non-bit-field member of a structure or union object is aligned in an implementation-
5448 defined manner appropriate to its type.
5449 <p><!--para 13 -->
5450 Within a structure object, the non-bit-field members and the units in which bit-fields
5451 reside have addresses that increase in the order in which they are declared. A pointer to a
5452 structure object, suitably converted, points to its initial member (or if that member is a
5453 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
5454 padding within a structure object, but not at its beginning.
5455 <p><!--para 14 -->
5456 The size of a union is sufficient to contain the largest of its members. The value of at
5457 most one of the members can be stored in a union object at any time. A pointer to a
5458 union object, suitably converted, points to each of its members (or if a member is a bit-
5459 field, then to the unit in which it resides), and vice versa.
5460 <p><!--para 15 -->
5461 There may be unnamed padding at the end of a structure or union.
5462 <p><!--para 16 -->
5463 As a special case, the last element of a structure with more than one named member may
5464 have an incomplete array type; this is called a flexible array member. In most situations,
5465 the flexible array member is ignored. In particular, the size of the structure is as if the
5466 flexible array member were omitted except that it may have more trailing padding than
5467 the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
5468 (a pointer to) a structure with a flexible array member and the right operand names that
5469 member, it behaves as if that member were replaced with the longest array (with the same
5470 element type) that would not make the structure larger than the object being accessed; the
5471 offset of the array shall remain that of the flexible array member, even if this would differ
5472 from that of the replacement array. If this array would have no elements, it behaves as if
5473 it had one element but the behavior is undefined if any attempt is made to access that
5474 element or to generate a pointer one past it.
5475 <p><!--para 17 -->
5476 EXAMPLE After the declaration:
5477 <pre>
5478 struct s { int n; double d[]; };
5479 </pre>
5480 the structure struct s has a flexible array member d. A typical way to use this is:
5481 <pre>
5482 int m = /* some value */;
5483 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));
5484 </pre>
5485 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
5486 p had been declared as:
5487 <pre>
5488 struct { int n; double d[m]; } *p;
5489 </pre>
5490 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
5491 not be the same).
5492 <p><!--para 18 -->
5493 Following the above declaration:
5494 <!--page 116 -->
5495 <pre>
5496 struct s t1 = { 0 }; // valid
5497 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
5498 t1.n = 4; // valid
5499 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior
5500 </pre>
5501 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
5502 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
5503 <pre>
5504 sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)
5505 </pre>
5506 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
5507 code.
5508 <p><!--para 19 -->
5509 After the further declaration:
5510 <pre>
5511 struct ss { int n; };
5512 </pre>
5513 the expressions:
5514 <pre>
5515 sizeof (struct s) &gt;= sizeof (struct ss)
5516 sizeof (struct s) &gt;= offsetof(struct s, d)
5517 </pre>
5518 are always equal to 1.
5519 <p><!--para 20 -->
5520 If sizeof (double) is 8, then after the following code is executed:
5521 <pre>
5522 struct s *s1;
5523 struct s *s2;
5524 s1 = malloc(sizeof (struct s) + 64);
5525 s2 = malloc(sizeof (struct s) + 46);
5526 </pre>
5527 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
5528 purposes, as if the identifiers had been declared as:
5529 <p><!--para 21 -->
5530 <pre>
5531 struct { int n; double d[8]; } *s1;
5532 struct { int n; double d[5]; } *s2;
5533 </pre>
5534 Following the further successful assignments:
5535 <pre>
5536 s1 = malloc(sizeof (struct s) + 10);
5537 s2 = malloc(sizeof (struct s) + 6);
5538 </pre>
5539 they then behave as if the declarations were:
5540 <pre>
5541 struct { int n; double d[1]; } *s1, *s2;
5542 </pre>
5543 and:
5544 <p><!--para 22 -->
5545 <pre>
5546 double *dp;
5547 dp = &amp;(s1-&gt;d[0]); // valid
5548 *dp = 42; // valid
5549 dp = &amp;(s2-&gt;d[0]); // valid
5550 *dp = 42; // undefined behavior
5551 </pre>
5552 The assignment:
5553 <pre>
5554 *s1 = *s2;
5555 </pre>
5556 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
5557 of the structure, they might be copied or simply overwritten with indeterminate values.
5559 <p><b> Forward references</b>: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5560 <!--page 117 -->
5562 <h6>footnotes</h6>
5563 <p><small><a name="note105" href="#note105">105)</a> A structure or union can not contain a member with a variably modified type because member names
5564 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
5565 </small>
5566 <p><small><a name="note106" href="#note106">106)</a> The unary &amp; (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
5567 or arrays of bit-field objects.
5568 </small>
5569 <p><small><a name="note107" href="#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,
5570 then it is implementation-defined whether the bit-field is signed or unsigned.
5571 </small>
5572 <p><small><a name="note108" href="#note108">108)</a> An unnamed bit-field structure member is useful for padding to conform to externally imposed
5573 layouts.
5574 </small>
5576 <h5><a name="6.7.2.2" href="#6.7.2.2">6.7.2.2 Enumeration specifiers</a></h5>
5577 <h6>Syntax</h6>
5578 <p><!--para 1 -->
5579 <pre>
5580 enum-specifier:
5581 enum identifier<sub>opt</sub> { enumerator-list }
5582 enum identifier<sub>opt</sub> { enumerator-list , }
5583 enum identifier
5584 enumerator-list:
5585 enumerator
5586 enumerator-list , enumerator
5587 enumerator:
5588 enumeration-constant
5589 enumeration-constant = constant-expression
5590 </pre>
5591 <h6>Constraints</h6>
5592 <p><!--para 2 -->
5593 The expression that defines the value of an enumeration constant shall be an integer
5594 constant expression that has a value representable as an int.
5595 <h6>Semantics</h6>
5596 <p><!--para 3 -->
5597 The identifiers in an enumerator list are declared as constants that have type int and
5598 may appear wherever such are permitted.<sup><a href="#note109"><b>109)</b></a></sup> An enumerator with = defines its
5599 enumeration constant as the value of the constant expression. If the first enumerator has
5600 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
5601 defines its enumeration constant as the value of the constant expression obtained by
5602 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
5603 = may produce enumeration constants with values that duplicate other values in the same
5604 enumeration.) The enumerators of an enumeration are also known as its members.
5605 <p><!--para 4 -->
5606 Each enumerated type shall be compatible with char, a signed integer type, or an
5607 unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note110"><b>110)</b></a></sup> but shall be
5608 capable of representing the values of all the members of the enumeration. The
5609 enumerated type is incomplete until after the } that terminates the list of enumerator
5610 declarations.
5615 <!--page 118 -->
5616 <p><!--para 5 -->
5617 EXAMPLE The following fragment:
5618 <pre>
5619 enum hue { chartreuse, burgundy, claret=20, winedark };
5620 enum hue col, *cp;
5621 col = claret;
5622 cp = &amp;col;
5623 if (*cp != burgundy)
5624 /* ... */
5625 </pre>
5626 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
5627 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
5629 <p><b> Forward references</b>: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5631 <h6>footnotes</h6>
5632 <p><small><a name="note109" href="#note109">109)</a> Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
5633 each other and from other identifiers declared in ordinary declarators.
5634 </small>
5635 <p><small><a name="note110" href="#note110">110)</a> An implementation may delay the choice of which integer type until all enumeration constants have
5636 been seen.
5637 </small>
5639 <h5><a name="6.7.2.3" href="#6.7.2.3">6.7.2.3 Tags</a></h5>
5640 <h6>Constraints</h6>
5641 <p><!--para 1 -->
5642 A specific type shall have its content defined at most once.
5643 <p><!--para 2 -->
5644 Where two declarations that use the same tag declare the same type, they shall both use
5645 the same choice of struct, union, or enum.
5646 <p><!--para 3 -->
5647 A type specifier of the form
5648 <pre>
5649 enum identifier
5650 </pre>
5651 without an enumerator list shall only appear after the type it specifies is complete.
5652 <h6>Semantics</h6>
5653 <p><!--para 4 -->
5654 All declarations of structure, union, or enumerated types that have the same scope and
5655 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
5656 of the list defining the content, and complete thereafter.
5657 <p><!--para 5 -->
5658 Two declarations of structure, union, or enumerated types which are in different scopes or
5659 use different tags declare distinct types. Each declaration of a structure, union, or
5660 enumerated type which does not include a tag declares a distinct type.
5661 <p><!--para 6 -->
5662 A type specifier of the form
5663 <pre>
5664 struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
5665 </pre>
5667 <pre>
5668 enum identifier { enumerator-list }
5669 </pre>
5671 <pre>
5672 enum identifier { enumerator-list , }
5673 </pre>
5674 declares a structure, union, or enumerated type. The list defines the structure content,
5676 <!--page 119 -->
5677 union content, or enumeration content. If an identifier is provided,<sup><a href="#note112"><b>112)</b></a></sup> the type specifier
5678 also declares the identifier to be the tag of that type.
5679 <p><!--para 7 -->
5680 A declaration of the form
5681 <pre>
5682 struct-or-union identifier ;
5683 </pre>
5684 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>
5685 <p><!--para 8 -->
5686 If a type specifier of the form
5687 <pre>
5688 struct-or-union identifier
5689 </pre>
5690 occurs other than as part of one of the above forms, and no other declaration of the
5691 identifier as a tag is visible, then it declares an incomplete structure or union type, and
5692 declares the identifier as the tag of that type.113)
5693 <p><!--para 9 -->
5694 If a type specifier of the form
5695 <pre>
5696 struct-or-union identifier
5697 </pre>
5699 <pre>
5700 enum identifier
5701 </pre>
5702 occurs other than as part of one of the above forms, and a declaration of the identifier as a
5703 tag is visible, then it specifies the same type as that other declaration, and does not
5704 redeclare the tag.
5705 <p><!--para 10 -->
5706 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
5707 <pre>
5708 struct tnode {
5709 int count;
5710 struct tnode *left, *right;
5712 </pre>
5713 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
5714 declaration has been given, the declaration
5715 <pre>
5716 struct tnode s, *sp;
5717 </pre>
5718 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
5719 these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
5720 which sp points; the expression s.right-&gt;count designates the count member of the right struct
5721 tnode pointed to from s.
5722 <p><!--para 11 -->
5723 The following alternative formulation uses the typedef mechanism:
5728 <!--page 120 -->
5729 <pre>
5730 typedef struct tnode TNODE;
5731 struct tnode {
5732 int count;
5733 TNODE *left, *right;
5735 TNODE s, *sp;
5736 </pre>
5738 <p><!--para 12 -->
5739 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
5740 structures, the declarations
5741 <pre>
5742 struct s1 { struct s2 *s2p; /* ... */ }; // D1
5743 struct s2 { struct s1 *s1p; /* ... */ }; // D2
5744 </pre>
5745 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
5746 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
5747 D2. To eliminate this context sensitivity, the declaration
5748 <pre>
5749 struct s2;
5750 </pre>
5751 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
5752 completes the specification of the new type.
5754 <p><b> Forward references</b>: 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
5755 (<a href="#6.7.7">6.7.7</a>).
5757 <h6>footnotes</h6>
5758 <p><small><a name="note111" href="#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
5759 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
5760 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
5761 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
5762 </small>
5763 <p><small><a name="note112" href="#note112">112)</a> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
5764 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
5765 can make use of that typedef name to declare objects having the specified structure, union, or
5766 enumerated type.
5767 </small>
5768 <p><small><a name="note113" href="#note113">113)</a> A similar construction with enum does not exist.
5769 </small>
5771 <h4><a name="6.7.3" href="#6.7.3">6.7.3 Type qualifiers</a></h4>
5772 <h6>Syntax</h6>
5773 <p><!--para 1 -->
5774 <pre>
5775 type-qualifier:
5776 const
5777 restrict
5778 volatile
5779 </pre>
5780 <h6>Constraints</h6>
5781 <p><!--para 2 -->
5782 Types other than pointer types derived from object or incomplete types shall not be
5783 restrict-qualified.
5784 <h6>Semantics</h6>
5785 <p><!--para 3 -->
5786 The properties associated with qualified types are meaningful only for expressions that
5787 are lvalues.<sup><a href="#note114"><b>114)</b></a></sup>
5788 <p><!--para 4 -->
5789 If the same qualifier appears more than once in the same specifier-qualifier-list, either
5790 directly or via one or more typedefs, the behavior is the same as if it appeared only
5791 once.
5796 <!--page 121 -->
5797 <p><!--para 5 -->
5798 If an attempt is made to modify an object defined with a const-qualified type through use
5799 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
5800 made to refer to an object defined with a volatile-qualified type through use of an lvalue
5801 with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note115"><b>115)</b></a></sup>
5802 <p><!--para 6 -->
5803 An object that has volatile-qualified type may be modified in ways unknown to the
5804 implementation or have other unknown side effects. Therefore any expression referring
5805 to such an object shall be evaluated strictly according to the rules of the abstract machine,
5806 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
5807 object shall agree with that prescribed by the abstract machine, except as modified by the
5808 unknown factors mentioned previously.<sup><a href="#note116"><b>116)</b></a></sup> What constitutes an access to an object that
5809 has volatile-qualified type is implementation-defined.
5810 <p><!--para 7 -->
5811 An object that is accessed through a restrict-qualified pointer has a special association
5812 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
5813 that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note117"><b>117)</b></a></sup> The intended
5814 use of the restrict qualifier (like the register storage class) is to promote
5815 optimization, and deleting all instances of the qualifier from all preprocessing translation
5816 units composing a conforming program does not change its meaning (i.e., observable
5817 behavior).
5818 <p><!--para 8 -->
5819 If the specification of an array type includes any type qualifiers, the element type is so-
5820 qualified, not the array type. If the specification of a function type includes any type
5821 qualifiers, the behavior is undefined.<sup><a href="#note118"><b>118)</b></a></sup>
5822 <p><!--para 9 -->
5823 For two qualified types to be compatible, both shall have the identically qualified version
5824 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
5825 does not affect the specified type.
5826 <p><!--para 10 -->
5827 EXAMPLE 1 An object declared
5828 <pre>
5829 extern const volatile int real_time_clock;
5830 </pre>
5831 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
5836 <!--page 122 -->
5837 <p><!--para 11 -->
5838 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
5839 modify an aggregate type:
5840 <pre>
5841 const struct s { int mem; } cs = { 1 };
5842 struct s ncs; // the object ncs is modifiable
5843 typedef int A[2][3];
5844 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
5845 int *pi;
5846 const int *pci;
5847 ncs = cs; // valid
5848 cs = ncs; // violates modifiable lvalue constraint for =
5849 pi = &amp;ncs.mem; // valid
5850 pi = &amp;cs.mem; // violates type constraints for =
5851 pci = &amp;cs.mem; // valid
5852 pi = a[0]; // invalid: a[0] has type ''const int *''
5853 </pre>
5856 <h6>footnotes</h6>
5857 <p><small><a name="note114" href="#note114">114)</a> The implementation may place a const object that is not volatile in a read-only region of
5858 storage. Moreover, the implementation need not allocate storage for such an object if its address is
5859 never used.
5860 </small>
5861 <p><small><a name="note115" href="#note115">115)</a> This applies to those objects that behave as if they were defined with qualified types, even if they are
5862 never actually defined as objects in the program (such as an object at a memory-mapped input/output
5863 address).
5864 </small>
5865 <p><small><a name="note116" href="#note116">116)</a> A volatile declaration may be used to describe an object corresponding to a memory-mapped
5866 input/output port or an object accessed by an asynchronously interrupting function. Actions on
5867 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
5868 permitted by the rules for evaluating expressions.
5869 </small>
5870 <p><small><a name="note117" href="#note117">117)</a> For example, a statement that assigns a value returned by malloc to a single pointer establishes this
5871 association between the allocated object and the pointer.
5872 </small>
5873 <p><small><a name="note118" href="#note118">118)</a> Both of these can occur through the use of typedefs.
5874 </small>
5876 <h5><a name="6.7.3.1" href="#6.7.3.1">6.7.3.1 Formal definition of restrict</a></h5>
5877 <p><!--para 1 -->
5878 Let D be a declaration of an ordinary identifier that provides a means of designating an
5879 object P as a restrict-qualified pointer to type T.
5880 <p><!--para 2 -->
5881 If D appears inside a block and does not have storage class extern, let B denote the
5882 block. If D appears in the list of parameter declarations of a function definition, let B
5883 denote the associated block. Otherwise, let B denote the block of main (or the block of
5884 whatever function is called at program startup in a freestanding environment).
5885 <p><!--para 3 -->
5886 In what follows, a pointer expression E is said to be based on object P if (at some
5887 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
5888 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>
5889 Note that ''based'' is defined only for expressions with pointer types.
5890 <p><!--para 4 -->
5891 During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
5892 access the value of the object X that it designates, and X is also modified (by any means),
5893 then the following requirements apply: T shall not be const-qualified. Every other lvalue
5894 used to access the value of X shall also have its address based on P. Every access that
5895 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
5896 is assigned the value of a pointer expression E that is based on another restricted pointer
5897 object P2, associated with block B2, then either the execution of B2 shall begin before
5898 the execution of B, or the execution of B2 shall end prior to the assignment. If these
5899 requirements are not met, then the behavior is undefined.
5900 <p><!--para 5 -->
5901 Here an execution of B means that portion of the execution of the program that would
5902 correspond to the lifetime of an object with scalar type and automatic storage duration
5904 <!--page 123 -->
5905 associated with B.
5906 <p><!--para 6 -->
5907 A translator is free to ignore any or all aliasing implications of uses of restrict.
5908 <p><!--para 7 -->
5909 EXAMPLE 1 The file scope declarations
5910 <pre>
5911 int * restrict a;
5912 int * restrict b;
5913 extern int c[];
5914 </pre>
5915 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
5916 program, then it is never accessed using either of the other two.
5918 <p><!--para 8 -->
5919 EXAMPLE 2 The function parameter declarations in the following example
5920 <pre>
5921 void f(int n, int * restrict p, int * restrict q)
5923 while (n-- &gt; 0)
5924 *p++ = *q++;
5926 </pre>
5927 assert that, during each execution of the function, if an object is accessed through one of the pointer
5928 parameters, then it is not also accessed through the other.
5929 <p><!--para 9 -->
5930 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
5931 analysis of function f without examining any of the calls of f in the program. The cost is that the
5932 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
5933 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
5934 both p and q.
5935 <pre>
5936 void g(void)
5938 extern int d[100];
5939 f(50, d + 50, d); // valid
5940 f(50, d + 1, d); // undefined behavior
5942 </pre>
5944 <p><!--para 10 -->
5945 EXAMPLE 3 The function parameter declarations
5946 <pre>
5947 void h(int n, int * restrict p, int * restrict q, int * restrict r)
5949 int i;
5950 for (i = 0; i &lt; n; i++)
5951 p[i] = q[i] + r[i];
5953 </pre>
5954 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
5955 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
5956 modified within function h.
5958 <p><!--para 11 -->
5959 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
5960 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
5961 between restricted pointers declared in nested blocks have defined behavior.
5962 <!--page 124 -->
5963 <p><!--para 12 -->
5964 <pre>
5966 int * restrict p1;
5967 int * restrict q1;
5968 p1 = q1; // undefined behavior
5970 int * restrict p2 = p1; // valid
5971 int * restrict q2 = q1; // valid
5972 p1 = q2; // undefined behavior
5973 p2 = q2; // undefined behavior
5976 </pre>
5977 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
5978 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
5979 example, this permits new_vector to return a vector.
5980 <pre>
5981 typedef struct { int n; float * restrict v; } vector;
5982 vector new_vector(int n)
5984 vector t;
5985 t.n = n;
5986 t.v = malloc(n * sizeof (float));
5987 return t;
5989 </pre>
5992 <h6>footnotes</h6>
5993 <p><small><a name="note119" href="#note119">119)</a> In other words, E depends on the value of P itself rather than on the value of an object referenced
5994 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
5995 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
5996 expressions *p and p[1] are not.
5997 </small>
5999 <h4><a name="6.7.4" href="#6.7.4">6.7.4 Function specifiers</a></h4>
6000 <h6>Syntax</h6>
6001 <p><!--para 1 -->
6002 <pre>
6003 function-specifier:
6004 inline
6005 </pre>
6006 <h6>Constraints</h6>
6007 <p><!--para 2 -->
6008 Function specifiers shall be used only in the declaration of an identifier for a function.
6009 <p><!--para 3 -->
6010 An inline definition of a function with external linkage shall not contain a definition of a
6011 modifiable object with static storage duration, and shall not contain a reference to an
6012 identifier with internal linkage.
6013 <p><!--para 4 -->
6014 In a hosted environment, the inline function specifier shall not appear in a declaration
6015 of main.
6016 <h6>Semantics</h6>
6017 <p><!--para 5 -->
6018 A function declared with an inline function specifier is an inline function. The
6019 function specifier may appear more than once; the behavior is the same as if it appeared
6020 only once. Making a function an inline function suggests that calls to the function be as
6021 fast as possible.<sup><a href="#note120"><b>120)</b></a></sup> The extent to which such suggestions are effective is
6022 implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
6023 <p><!--para 6 -->
6024 Any function with internal linkage can be an inline function. For a function with external
6025 linkage, the following restrictions apply: If a function is declared with an inline
6026 <!--page 125 -->
6027 function specifier, then it shall also be defined in the same translation unit. If all of the
6028 file scope declarations for a function in a translation unit include the inline function
6029 specifier without extern, then the definition in that translation unit is an inline
6030 definition. An inline definition does not provide an external definition for the function,
6031 and does not forbid an external definition in another translation unit. An inline definition
6032 provides an alternative to an external definition, which a translator may use to implement
6033 any call to the function in the same translation unit. It is unspecified whether a call to the
6034 function uses the inline definition or the external definition.<sup><a href="#note122"><b>122)</b></a></sup>
6035 <p><!--para 7 -->
6036 EXAMPLE The declaration of an inline function with external linkage can result in either an external
6037 definition, or a definition available for use only within the translation unit. A file scope declaration with
6038 extern creates an external definition. The following example shows an entire translation unit.
6039 <p><!--para 8 -->
6040 <pre>
6041 inline double fahr(double t)
6043 return (9.0 * t) / 5.0 + 32.0;
6045 inline double cels(double t)
6047 return (5.0 * (t - 32.0)) / 9.0;
6049 extern double fahr(double); // creates an external definition
6050 double convert(int is_fahr, double temp)
6052 /* A translator may perform inline substitutions */
6053 return is_fahr ? cels(temp) : fahr(temp);
6055 </pre>
6056 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
6057 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
6058 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
6059 definition are distinct and either may be used for the call.
6061 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
6064 <!--page 126 -->
6066 <h6>footnotes</h6>
6067 <p><small><a name="note120" href="#note120">120)</a> By using, for example, an alternative to the usual function call mechanism, such as ''inline
6068 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
6069 Therefore, for example, the expansion of a macro used within the body of the function uses the
6070 definition it had at the point the function body appears, and not where the function is called; and
6071 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
6072 single address, regardless of the number of inline definitions that occur in addition to the external
6073 definition.
6074 </small>
6075 <p><small><a name="note121" href="#note121">121)</a> For example, an implementation might never perform inline substitution, or might only perform inline
6076 substitutions to calls in the scope of an inline declaration.
6077 </small>
6078 <p><small><a name="note122" href="#note122">122)</a> Since an inline definition is distinct from the corresponding external definition and from any other
6079 corresponding inline definitions in other translation units, all corresponding objects with static storage
6080 duration are also distinct in each of the definitions.
6081 </small>
6083 <h4><a name="6.7.5" href="#6.7.5">6.7.5 Declarators</a></h4>
6084 <h6>Syntax</h6>
6085 <p><!--para 1 -->
6086 <pre>
6087 declarator:
6088 pointer<sub>opt</sub> direct-declarator
6089 direct-declarator:
6090 identifier
6091 ( declarator )
6092 direct-declarator [ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
6093 direct-declarator [ static type-qualifier-list<sub>opt</sub> assignment-expression ]
6094 direct-declarator [ type-qualifier-list static assignment-expression ]
6095 direct-declarator [ type-qualifier-list<sub>opt</sub> * ]
6096 direct-declarator ( parameter-type-list )
6097 direct-declarator ( identifier-list<sub>opt</sub> )
6098 pointer:
6099 * type-qualifier-list<sub>opt</sub>
6100 * type-qualifier-list<sub>opt</sub> pointer
6101 type-qualifier-list:
6102 type-qualifier
6103 type-qualifier-list type-qualifier
6104 parameter-type-list:
6105 parameter-list
6106 parameter-list , ...
6107 parameter-list:
6108 parameter-declaration
6109 parameter-list , parameter-declaration
6110 parameter-declaration:
6111 declaration-specifiers declarator
6112 declaration-specifiers abstract-declarator<sub>opt</sub>
6113 identifier-list:
6114 identifier
6115 identifier-list , identifier
6116 </pre>
6117 <h6>Semantics</h6>
6118 <p><!--para 2 -->
6119 Each declarator declares one identifier, and asserts that when an operand of the same
6120 form as the declarator appears in an expression, it designates a function or object with the
6121 scope, storage duration, and type indicated by the declaration specifiers.
6122 <p><!--para 3 -->
6123 A full declarator is a declarator that is not part of another declarator. The end of a full
6124 declarator is a sequence point. If, in the nested sequence of declarators in a full
6125 <!--page 127 -->
6126 declarator, there is a declarator specifying a variable length array type, the type specified
6127 by the full declarator is said to be variably modified. Furthermore, any type derived by
6128 declarator type derivation from a variably modified type is itself variably modified.
6129 <p><!--para 4 -->
6130 In the following subclauses, consider a declaration
6131 <pre>
6132 T D1
6133 </pre>
6134 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
6135 a declarator that contains an identifier ident. The type specified for the identifier ident in
6136 the various forms of declarator is described inductively using this notation.
6137 <p><!--para 5 -->
6138 If, in the declaration ''T D1'', D1 has the form
6139 <pre>
6140 identifier
6141 </pre>
6142 then the type specified for ident is T .
6143 <p><!--para 6 -->
6144 If, in the declaration ''T D1'', D1 has the form
6145 <pre>
6146 ( D )
6147 </pre>
6148 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
6149 parentheses is identical to the unparenthesized declarator, but the binding of complicated
6150 declarators may be altered by parentheses.
6151 <h6>Implementation limits</h6>
6152 <p><!--para 7 -->
6153 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
6154 function declarators that modify an arithmetic, structure, union, or incomplete type, either
6155 directly or via one or more typedefs.
6156 <p><b> Forward references</b>: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
6158 <h5><a name="6.7.5.1" href="#6.7.5.1">6.7.5.1 Pointer declarators</a></h5>
6159 <h6>Semantics</h6>
6160 <p><!--para 1 -->
6161 If, in the declaration ''T D1'', D1 has the form
6162 <pre>
6163 * type-qualifier-list<sub>opt</sub> D
6164 </pre>
6165 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6166 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
6167 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
6168 <p><!--para 2 -->
6169 For two pointer types to be compatible, both shall be identically qualified and both shall
6170 be pointers to compatible types.
6171 <p><!--para 3 -->
6172 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
6173 to a constant value'' and a ''constant pointer to a variable value''.
6174 <!--page 128 -->
6175 <pre>
6176 const int *ptr_to_constant;
6177 int *const constant_ptr;
6178 </pre>
6179 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
6180 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
6181 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
6182 same location.
6183 <p><!--para 4 -->
6184 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
6185 type ''pointer to int''.
6186 <pre>
6187 typedef int *int_ptr;
6188 const int_ptr constant_ptr;
6189 </pre>
6190 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
6193 <h5><a name="6.7.5.2" href="#6.7.5.2">6.7.5.2 Array declarators</a></h5>
6194 <h6>Constraints</h6>
6195 <p><!--para 1 -->
6196 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
6197 an expression or *. If they delimit an expression (which specifies the size of an array), the
6198 expression shall have an integer type. If the expression is a constant expression, it shall
6199 have a value greater than zero. The element type shall not be an incomplete or function
6200 type. The optional type qualifiers and the keyword static shall appear only in a
6201 declaration of a function parameter with an array type, and then only in the outermost
6202 array type derivation.
6203 <p><!--para 2 -->
6204 An ordinary identifier (as defined in <a href="#6.2.3">6.2.3</a>) that has a variably modified type shall have
6205 either block scope and no linkage or function prototype scope. If an identifier is declared
6206 to be an object with static storage duration, it shall not have a variable length array type.
6207 <h6>Semantics</h6>
6208 <p><!--para 3 -->
6209 If, in the declaration ''T D1'', D1 has one of the forms:
6210 <pre>
6211 D[ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
6212 D[ static type-qualifier-list<sub>opt</sub> assignment-expression ]
6213 D[ type-qualifier-list static assignment-expression ]
6214 D[ type-qualifier-list<sub>opt</sub> * ]
6215 </pre>
6216 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6217 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note123"><b>123)</b></a></sup>
6218 (See <a href="#6.7.5.3">6.7.5.3</a> for the meaning of the optional type qualifiers and the keyword static.)
6219 <p><!--para 4 -->
6220 If the size is not present, the array type is an incomplete type. If the size is * instead of
6221 being an expression, the array type is a variable length array type of unspecified size,
6222 which can only be used in declarations with function prototype scope;<sup><a href="#note124"><b>124)</b></a></sup> such arrays are
6223 nonetheless complete types. If the size is an integer constant expression and the element
6225 <!--page 129 -->
6226 type has a known constant size, the array type is not a variable length array type;
6227 otherwise, the array type is a variable length array type.
6228 <p><!--para 5 -->
6229 If the size is an expression that is not an integer constant expression: if it occurs in a
6230 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
6231 each time it is evaluated it shall have a value greater than zero. The size of each instance
6232 of a variable length array type does not change during its lifetime. Where a size
6233 expression is part of the operand of a sizeof operator and changing the value of the
6234 size expression would not affect the result of the operator, it is unspecified whether or not
6235 the size expression is evaluated.
6236 <p><!--para 6 -->
6237 For two array types to be compatible, both shall have compatible element types, and if
6238 both size specifiers are present, and are integer constant expressions, then both size
6239 specifiers shall have the same constant value. If the two array types are used in a context
6240 which requires them to be compatible, it is undefined behavior if the two size specifiers
6241 evaluate to unequal values.
6242 <p><!--para 7 -->
6243 EXAMPLE 1
6244 <pre>
6245 float fa[11], *afp[17];
6246 </pre>
6247 declares an array of float numbers and an array of pointers to float numbers.
6249 <p><!--para 8 -->
6250 EXAMPLE 2 Note the distinction between the declarations
6251 <pre>
6252 extern int *x;
6253 extern int y[];
6254 </pre>
6255 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
6256 (an incomplete type), the storage for which is defined elsewhere.
6258 <p><!--para 9 -->
6259 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
6260 <pre>
6261 extern int n;
6262 extern int m;
6263 void fcompat(void)
6265 int a[n][6][m];
6266 int (*p)[4][n+1];
6267 int c[n][n][6][m];
6268 int (*r)[n][n][n+1];
6269 p = a; // invalid: not compatible because 4 != 6
6270 r = c; // compatible, but defined behavior only if
6271 // n == 6 and m == n+1
6273 </pre>
6278 <!--page 130 -->
6279 <p><!--para 10 -->
6280 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
6281 function prototype scope. Array objects declared with the static or extern storage-class specifier
6282 cannot have a variable length array (VLA) type. However, an object declared with the static storage-
6283 class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all identifiers declared with a
6284 VM type have to be ordinary identifiers and cannot, therefore, be members of structures or unions.
6285 <pre>
6286 extern int n;
6287 int A[n]; // invalid: file scope VLA
6288 extern int (*p2)[n]; // invalid: file scope VM
6289 int B[100]; // valid: file scope but not VM
6290 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
6291 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
6293 typedef int VLA[m][m]; // valid: block scope typedef VLA
6294 struct tag {
6295 int (*y)[n]; // invalid: y not ordinary identifier
6296 int z[n]; // invalid: z not ordinary identifier
6298 int D[m]; // valid: auto VLA
6299 static int E[m]; // invalid: static block scope VLA
6300 extern int F[m]; // invalid: F has linkage and is VLA
6301 int (*s)[m]; // valid: auto pointer to VLA
6302 extern int (*r)[m]; // invalid: r has linkage and points to VLA
6303 static int (*q)[m] = &amp;B; // valid: q is a static block pointer to VLA
6305 </pre>
6307 <p><b> Forward references</b>: function declarators (<a href="#6.7.5.3">6.7.5.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
6308 initialization (<a href="#6.7.8">6.7.8</a>).
6310 <h6>footnotes</h6>
6311 <p><small><a name="note123" href="#note123">123)</a> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
6312 </small>
6313 <p><small><a name="note124" href="#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>).
6314 </small>
6316 <h5><a name="6.7.5.3" href="#6.7.5.3">6.7.5.3 Function declarators (including prototypes)</a></h5>
6317 <h6>Constraints</h6>
6318 <p><!--para 1 -->
6319 A function declarator shall not specify a return type that is a function type or an array
6320 type.
6321 <p><!--para 2 -->
6322 The only storage-class specifier that shall occur in a parameter declaration is register.
6323 <p><!--para 3 -->
6324 An identifier list in a function declarator that is not part of a definition of that function
6325 shall be empty.
6326 <p><!--para 4 -->
6327 After adjustment, the parameters in a parameter type list in a function declarator that is
6328 part of a definition of that function shall not have incomplete type.
6329 <h6>Semantics</h6>
6330 <p><!--para 5 -->
6331 If, in the declaration ''T D1'', D1 has the form
6332 <pre>
6333 D( parameter-type-list )
6334 </pre>
6336 <!--page 131 -->
6337 <pre>
6338 D( identifier-list<sub>opt</sub> )
6339 </pre>
6340 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6341 T '', then the type specified for ident is ''derived-declarator-type-list function returning
6342 T ''.
6343 <p><!--para 6 -->
6344 A parameter type list specifies the types of, and may declare identifiers for, the
6345 parameters of the function.
6346 <p><!--para 7 -->
6347 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
6348 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
6349 array type derivation. If the keyword static also appears within the [ and ] of the
6350 array type derivation, then for each call to the function, the value of the corresponding
6351 actual argument shall provide access to the first element of an array with at least as many
6352 elements as specified by the size expression.
6353 <p><!--para 8 -->
6354 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
6355 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
6356 <p><!--para 9 -->
6357 If the list terminates with an ellipsis (, ...), no information about the number or types
6358 of the parameters after the comma is supplied.<sup><a href="#note125"><b>125)</b></a></sup>
6359 <p><!--para 10 -->
6360 The special case of an unnamed parameter of type void as the only item in the list
6361 specifies that the function has no parameters.
6362 <p><!--para 11 -->
6363 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
6364 parameter name, it shall be taken as a typedef name.
6365 <p><!--para 12 -->
6366 If the function declarator is not part of a definition of that function, parameters may have
6367 incomplete type and may use the [*] notation in their sequences of declarator specifiers
6368 to specify variable length array types.
6369 <p><!--para 13 -->
6370 The storage-class specifier in the declaration specifiers for a parameter declaration, if
6371 present, is ignored unless the declared parameter is one of the members of the parameter
6372 type list for a function definition.
6373 <p><!--para 14 -->
6374 An identifier list declares only the identifiers of the parameters of the function. An empty
6375 list in a function declarator that is part of a definition of that function specifies that the
6376 function has no parameters. The empty list in a function declarator that is not part of a
6377 definition of that function specifies that no information about the number or types of the
6378 parameters is supplied.<sup><a href="#note126"><b>126)</b></a></sup>
6379 <p><!--para 15 -->
6380 For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note127"><b>127)</b></a></sup>
6383 <!--page 132 -->
6384 Moreover, the parameter type lists, if both are present, shall agree in the number of
6385 parameters and in use of the ellipsis terminator; corresponding parameters shall have
6386 compatible types. If one type has a parameter type list and the other type is specified by a
6387 function declarator that is not part of a function definition and that contains an empty
6388 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
6389 parameter shall be compatible with the type that results from the application of the
6390 default argument promotions. If one type has a parameter type list and the other type is
6391 specified by a function definition that contains a (possibly empty) identifier list, both shall
6392 agree in the number of parameters, and the type of each prototype parameter shall be
6393 compatible with the type that results from the application of the default argument
6394 promotions to the type of the corresponding identifier. (In the determination of type
6395 compatibility and of a composite type, each parameter declared with function or array
6396 type is taken as having the adjusted type and each parameter declared with qualified type
6397 is taken as having the unqualified version of its declared type.)
6398 <p><!--para 16 -->
6399 EXAMPLE 1 The declaration
6400 <pre>
6401 int f(void), *fip(), (*pfi)();
6402 </pre>
6403 declares a function f with no parameters returning an int, a function fip with no parameter specification
6404 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
6405 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
6406 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
6407 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
6408 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
6409 designator, which is then used to call the function; it returns an int.
6410 <p><!--para 17 -->
6411 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
6412 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
6413 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
6414 the identifier of the pointer pfi has block scope and no linkage.
6416 <p><!--para 18 -->
6417 EXAMPLE 2 The declaration
6418 <pre>
6419 int (*apfi[3])(int *x, int *y);
6420 </pre>
6421 declares an array apfi of three pointers to functions returning int. Each of these functions has two
6422 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
6423 go out of scope at the end of the declaration of apfi.
6425 <p><!--para 19 -->
6426 EXAMPLE 3 The declaration
6427 <pre>
6428 int (*fpfi(int (*)(long), int))(int, ...);
6429 </pre>
6430 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
6431 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
6432 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
6433 additional arguments of any type.
6434 <!--page 133 -->
6435 <p><!--para 20 -->
6436 EXAMPLE 4 The following prototype has a variably modified parameter.
6437 <pre>
6438 void addscalar(int n, int m,
6439 double a[n][n*m+300], double x);
6440 int main()
6442 double b[4][308];
6443 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
6444 return 0;
6446 void addscalar(int n, int m,
6447 double a[n][n*m+300], double x)
6449 for (int i = 0; i &lt; n; i++)
6450 for (int j = 0, k = n*m+300; j &lt; k; j++)
6451 // a is a pointer to a VLA with n*m+300 elements
6452 a[i][j] += x;
6454 </pre>
6456 <p><!--para 21 -->
6457 EXAMPLE 5 The following are all compatible function prototype declarators.
6458 <pre>
6459 double maximum(int n, int m, double a[n][m]);
6460 double maximum(int n, int m, double a[*][*]);
6461 double maximum(int n, int m, double a[ ][*]);
6462 double maximum(int n, int m, double a[ ][m]);
6463 </pre>
6464 as are:
6465 <pre>
6466 void f(double (* restrict a)[5]);
6467 void f(double a[restrict][5]);
6468 void f(double a[restrict 3][5]);
6469 void f(double a[restrict static 3][5]);
6470 </pre>
6471 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
6472 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
6474 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
6475 <!--page 134 -->
6477 <h6>footnotes</h6>
6478 <p><small><a name="note125" href="#note125">125)</a> The macros defined in the <a href="#7.15">&lt;stdarg.h&gt;</a> header (<a href="#7.15">7.15</a>) may be used to access arguments that
6479 correspond to the ellipsis.
6480 </small>
6481 <p><small><a name="note126" href="#note126">126)</a> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
6482 </small>
6483 <p><small><a name="note127" href="#note127">127)</a> If both function types are ''old style'', parameter types are not compared.
6484 </small>
6486 <h4><a name="6.7.6" href="#6.7.6">6.7.6 Type names</a></h4>
6487 <h6>Syntax</h6>
6488 <p><!--para 1 -->
6489 <pre>
6490 type-name:
6491 specifier-qualifier-list abstract-declarator<sub>opt</sub>
6492 abstract-declarator:
6493 pointer
6494 pointer<sub>opt</sub> direct-abstract-declarator
6495 direct-abstract-declarator:
6496 ( abstract-declarator )
6497 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list<sub>opt</sub>
6498 assignment-expression<sub>opt</sub> ]
6499 direct-abstract-declarator<sub>opt</sub> [ static type-qualifier-list<sub>opt</sub>
6500 assignment-expression ]
6501 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list static
6502 assignment-expression ]
6503 direct-abstract-declarator<sub>opt</sub> [ * ]
6504 direct-abstract-declarator<sub>opt</sub> ( parameter-type-list<sub>opt</sub> )
6505 </pre>
6506 <h6>Semantics</h6>
6507 <p><!--para 2 -->
6508 In several contexts, it is necessary to specify a type. This is accomplished using a type
6509 name, which is syntactically a declaration for a function or an object of that type that
6510 omits the identifier.<sup><a href="#note128"><b>128)</b></a></sup>
6511 <p><!--para 3 -->
6512 EXAMPLE The constructions
6513 <pre>
6514 (a) int
6515 (b) int *
6516 (c) int *[3]
6517 (d) int (*)[3]
6518 (e) int (*)[*]
6519 (f) int *()
6520 (g) int (*)(void)
6521 (h) int (*const [])(unsigned int, ...)
6522 </pre>
6523 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
6524 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
6525 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
6526 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
6527 parameter that has type unsigned int and an unspecified number of other parameters, returning an
6528 int.
6533 <!--page 135 -->
6535 <h6>footnotes</h6>
6536 <p><small><a name="note128" href="#note128">128)</a> As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
6537 parameter specification'', rather than redundant parentheses around the omitted identifier.
6538 </small>
6540 <h4><a name="6.7.7" href="#6.7.7">6.7.7 Type definitions</a></h4>
6541 <h6>Syntax</h6>
6542 <p><!--para 1 -->
6543 <pre>
6544 typedef-name:
6545 identifier
6546 </pre>
6547 <h6>Constraints</h6>
6548 <p><!--para 2 -->
6549 If a typedef name specifies a variably modified type then it shall have block scope.
6550 <h6>Semantics</h6>
6551 <p><!--para 3 -->
6552 In a declaration whose storage-class specifier is typedef, each declarator defines an
6553 identifier to be a typedef name that denotes the type specified for the identifier in the way
6554 described in <a href="#6.7.5">6.7.5</a>. Any array size expressions associated with variable length array
6555 declarators are evaluated each time the declaration of the typedef name is reached in the
6556 order of execution. A typedef declaration does not introduce a new type, only a
6557 synonym for the type so specified. That is, in the following declarations:
6558 <pre>
6559 typedef T type_ident;
6560 type_ident D;
6561 </pre>
6562 type_ident is defined as a typedef name with the type specified by the declaration
6563 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
6564 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
6565 typedef name shares the same name space as other identifiers declared in ordinary
6566 declarators.
6567 <p><!--para 4 -->
6568 EXAMPLE 1 After
6569 <pre>
6570 typedef int MILES, KLICKSP();
6571 typedef struct { double hi, lo; } range;
6572 </pre>
6573 the constructions
6574 <pre>
6575 MILES distance;
6576 extern KLICKSP *metricp;
6577 range x;
6578 range z, *zp;
6579 </pre>
6580 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
6581 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
6582 such a structure. The object distance has a type compatible with any other int object.
6584 <p><!--para 5 -->
6585 EXAMPLE 2 After the declarations
6586 <pre>
6587 typedef struct s1 { int x; } t1, *tp1;
6588 typedef struct s2 { int x; } t2, *tp2;
6589 </pre>
6590 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
6591 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
6592 <!--page 136 -->
6593 <p><!--para 6 -->
6594 EXAMPLE 3 The following obscure constructions
6595 <pre>
6596 typedef signed int t;
6597 typedef int plain;
6598 struct tag {
6599 unsigned t:4;
6600 const t:5;
6601 plain r:5;
6603 </pre>
6604 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
6605 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
6606 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
6607 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
6608 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
6609 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
6610 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
6611 in an inner scope by
6612 <pre>
6613 t f(t (t));
6614 long t;
6615 </pre>
6616 then a function f is declared with type ''function returning signed int with one unnamed parameter
6617 with type pointer to function returning signed int with one unnamed parameter with type signed
6618 int'', and an identifier t with type long int.
6620 <p><!--para 7 -->
6621 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
6622 following declarations of the signal function specify exactly the same type, the first without making use
6623 of any typedef names.
6624 <pre>
6625 typedef void fv(int), (*pfv)(int);
6626 void (*signal(int, void (*)(int)))(int);
6627 fv *signal(int, fv *);
6628 pfv signal(int, pfv);
6629 </pre>
6631 <p><!--para 8 -->
6632 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
6633 time the typedef name is defined, not each time it is used:
6634 <!--page 137 -->
6635 <pre>
6636 void copyt(int n)
6638 typedef int B[n]; // B is n ints, n evaluated now
6639 n += 1;
6640 B a; // a is n ints, n without += 1
6641 int b[n]; // a and b are different sizes
6642 for (int i = 1; i &lt; n; i++)
6643 a[i-1] = b[i];
6645 </pre>
6647 <h4><a name="6.7.8" href="#6.7.8">6.7.8 Initialization</a></h4>
6648 <h6>Syntax</h6>
6649 <p><!--para 1 -->
6650 <pre>
6651 initializer:
6652 assignment-expression
6653 { initializer-list }
6654 { initializer-list , }
6655 initializer-list:
6656 designation<sub>opt</sub> initializer
6657 initializer-list , designation<sub>opt</sub> initializer
6658 designation:
6659 designator-list =
6660 designator-list:
6661 designator
6662 designator-list designator
6663 designator:
6664 [ constant-expression ]
6665 . identifier
6666 </pre>
6667 <h6>Constraints</h6>
6668 <p><!--para 2 -->
6669 No initializer shall attempt to provide a value for an object not contained within the entity
6670 being initialized.
6671 <p><!--para 3 -->
6672 The type of the entity to be initialized shall be an array of unknown size or an object type
6673 that is not a variable length array type.
6674 <p><!--para 4 -->
6675 All the expressions in an initializer for an object that has static storage duration shall be
6676 constant expressions or string literals.
6677 <p><!--para 5 -->
6678 If the declaration of an identifier has block scope, and the identifier has external or
6679 internal linkage, the declaration shall have no initializer for the identifier.
6680 <p><!--para 6 -->
6681 If a designator has the form
6682 <pre>
6683 [ constant-expression ]
6684 </pre>
6685 then the current object (defined below) shall have array type and the expression shall be
6686 an integer constant expression. If the array is of unknown size, any nonnegative value is
6687 valid.
6688 <p><!--para 7 -->
6689 If a designator has the form
6690 <pre>
6691 . identifier
6692 </pre>
6693 then the current object (defined below) shall have structure or union type and the
6694 identifier shall be the name of a member of that type.
6695 <!--page 138 -->
6696 <h6>Semantics</h6>
6697 <p><!--para 8 -->
6698 An initializer specifies the initial value stored in an object.
6699 <p><!--para 9 -->
6700 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
6701 members of objects of structure and union type do not participate in initialization.
6702 Unnamed members of structure objects have indeterminate value even after initialization.
6703 <p><!--para 10 -->
6704 If an object that has automatic storage duration is not initialized explicitly, its value is
6705 indeterminate. If an object that has static storage duration is not initialized explicitly,
6706 then:
6707 <ul>
6708 <li> if it has pointer type, it is initialized to a null pointer;
6709 <li> if it has arithmetic type, it is initialized to (positive or unsigned) zero;
6710 <li> if it is an aggregate, every member is initialized (recursively) according to these rules;
6711 <li> if it is a union, the first named member is initialized (recursively) according to these
6712 rules.
6713 </ul>
6714 <p><!--para 11 -->
6715 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
6716 initial value of the object is that of the expression (after conversion); the same type
6717 constraints and conversions as for simple assignment apply, taking the type of the scalar
6718 to be the unqualified version of its declared type.
6719 <p><!--para 12 -->
6720 The rest of this subclause deals with initializers for objects that have aggregate or union
6721 type.
6722 <p><!--para 13 -->
6723 The initializer for a structure or union object that has automatic storage duration shall be
6724 either an initializer list as described below, or a single expression that has compatible
6725 structure or union type. In the latter case, the initial value of the object, including
6726 unnamed members, is that of the expression.
6727 <p><!--para 14 -->
6728 An array of character type may be initialized by a character string literal, optionally
6729 enclosed in braces. Successive characters of the character string literal (including the
6730 terminating null character if there is room or if the array is of unknown size) initialize the
6731 elements of the array.
6732 <p><!--para 15 -->
6733 An array with element type compatible with wchar_t may be initialized by a wide
6734 string literal, optionally enclosed in braces. Successive wide characters of the wide string
6735 literal (including the terminating null wide character if there is room or if the array is of
6736 unknown size) initialize the elements of the array.
6737 <p><!--para 16 -->
6738 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
6739 enclosed list of initializers for the elements or named members.
6740 <p><!--para 17 -->
6741 Each brace-enclosed initializer list has an associated current object. When no
6742 designations are present, subobjects of the current object are initialized in order according
6743 to the type of the current object: array elements in increasing subscript order, structure
6744 <!--page 139 -->
6745 members in declaration order, and the first named member of a union.<sup><a href="#note129"><b>129)</b></a></sup> In contrast, a
6746 designation causes the following initializer to begin initialization of the subobject
6747 described by the designator. Initialization then continues forward in order, beginning
6748 with the next subobject after that described by the designator.<sup><a href="#note130"><b>130)</b></a></sup>
6749 <p><!--para 18 -->
6750 Each designator list begins its description with the current object associated with the
6751 closest surrounding brace pair. Each item in the designator list (in order) specifies a
6752 particular member of its current object and changes the current object for the next
6753 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
6754 designator list is the subobject to be initialized by the following initializer.
6755 <p><!--para 19 -->
6756 The initialization shall occur in initializer list order, each initializer provided for a
6757 particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note132"><b>132)</b></a></sup>
6758 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
6759 objects that have static storage duration.
6760 <p><!--para 20 -->
6761 If the aggregate or union contains elements or members that are aggregates or unions,
6762 these rules apply recursively to the subaggregates or contained unions. If the initializer of
6763 a subaggregate or contained union begins with a left brace, the initializers enclosed by
6764 that brace and its matching right brace initialize the elements or members of the
6765 subaggregate or the contained union. Otherwise, only enough initializers from the list are
6766 taken to account for the elements or members of the subaggregate or the first member of
6767 the contained union; any remaining initializers are left to initialize the next element or
6768 member of the aggregate of which the current subaggregate or contained union is a part.
6769 <p><!--para 21 -->
6770 If there are fewer initializers in a brace-enclosed list than there are elements or members
6771 of an aggregate, or fewer characters in a string literal used to initialize an array of known
6772 size than there are elements in the array, the remainder of the aggregate shall be
6773 initialized implicitly the same as objects that have static storage duration.
6774 <p><!--para 22 -->
6775 If an array of unknown size is initialized, its size is determined by the largest indexed
6776 element with an explicit initializer. At the end of its initializer list, the array no longer
6777 has incomplete type.
6781 <!--page 140 -->
6782 <p><!--para 23 -->
6783 The order in which any side effects occur among the initialization list expressions is
6784 unspecified.<sup><a href="#note133"><b>133)</b></a></sup>
6785 <p><!--para 24 -->
6786 EXAMPLE 1 Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
6787 <pre>
6788 int i = <a href="#3.5">3.5</a>;
6789 double complex c = 5 + 3 * I;
6790 </pre>
6791 define and initialize i with the value 3 and c with the value 5.0 + i3.0.
6793 <p><!--para 25 -->
6794 EXAMPLE 2 The declaration
6795 <pre>
6796 int x[] = { 1, 3, 5 };
6797 </pre>
6798 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
6799 and there are three initializers.
6801 <p><!--para 26 -->
6802 EXAMPLE 3 The declaration
6803 <pre>
6804 int y[4][3] = {
6805 { 1, 3, 5 },
6806 { 2, 4, 6 },
6807 { 3, 5, 7 },
6809 </pre>
6810 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
6811 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
6812 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
6813 been achieved by
6814 <pre>
6815 int y[4][3] = {
6816 1, 3, 5, 2, 4, 6, 3, 5, 7
6818 </pre>
6819 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
6820 next three are taken successively for y[1] and y[2].
6822 <p><!--para 27 -->
6823 EXAMPLE 4 The declaration
6824 <pre>
6825 int z[4][3] = {
6826 { 1 }, { 2 }, { 3 }, { 4 }
6828 </pre>
6829 initializes the first column of z as specified and initializes the rest with zeros.
6831 <p><!--para 28 -->
6832 EXAMPLE 5 The declaration
6833 <pre>
6834 struct { int a[3], b; } w[] = { { 1 }, 2 };
6835 </pre>
6836 is a definition with an inconsistently bracketed initialization. It defines an array with two element
6837 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
6842 <!--page 141 -->
6843 <p><!--para 29 -->
6844 EXAMPLE 6 The declaration
6845 <pre>
6846 short q[4][3][2] = {
6847 { 1 },
6848 { 2, 3 },
6849 { 4, 5, 6 }
6851 </pre>
6852 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
6853 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
6854 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
6855 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
6856 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
6857 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
6858 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
6859 diagnostic message would have been issued. The same initialization result could have been achieved by:
6860 <pre>
6861 short q[4][3][2] = {
6862 1, 0, 0, 0, 0, 0,
6863 2, 3, 0, 0, 0, 0,
6864 4, 5, 6
6866 </pre>
6867 or by:
6868 <pre>
6869 short q[4][3][2] = {
6871 { 1 },
6874 { 2, 3 },
6877 { 4, 5 },
6878 { 6 },
6881 </pre>
6882 in a fully bracketed form.
6883 <p><!--para 30 -->
6884 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
6885 cause confusion.
6887 <p><!--para 31 -->
6888 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
6889 declaration
6890 <pre>
6891 typedef int A[]; // OK - declared with block scope
6892 </pre>
6893 the declaration
6894 <pre>
6895 A a = { 1, 2 }, b = { 3, 4, 5 };
6896 </pre>
6897 is identical to
6898 <pre>
6899 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };
6900 </pre>
6901 due to the rules for incomplete types.
6902 <!--page 142 -->
6903 <p><!--para 32 -->
6904 EXAMPLE 8 The declaration
6905 <pre>
6906 char s[] = "abc", t[3] = "abc";
6907 </pre>
6908 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
6909 This declaration is identical to
6910 <pre>
6911 char s[] = { 'a', 'b', 'c', '\0' },
6912 t[] = { 'a', 'b', 'c' };
6913 </pre>
6914 The contents of the arrays are modifiable. On the other hand, the declaration
6915 <pre>
6916 char *p = "abc";
6917 </pre>
6918 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
6919 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
6920 modify the contents of the array, the behavior is undefined.
6922 <p><!--para 33 -->
6923 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
6924 designators:
6925 <pre>
6926 enum { member_one, member_two };
6927 const char *nm[] = {
6928 [member_two] = "member two",
6929 [member_one] = "member one",
6931 </pre>
6933 <p><!--para 34 -->
6934 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
6935 <pre>
6936 div_t answer = { .quot = 2, .rem = -1 };
6937 </pre>
6939 <p><!--para 35 -->
6940 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
6941 might be misunderstood:
6942 <pre>
6943 struct { int a[3], b; } w[] =
6944 { [0].a = {1}, [1].a[0] = 2 };
6945 </pre>
6947 <p><!--para 36 -->
6948 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
6949 <p><!--para 37 -->
6950 <pre>
6951 int a[MAX] = {
6952 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
6954 </pre>
6955 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
6956 than ten, some of the values provided by the first five initializers will be overridden by the second five.
6958 <p><!--para 38 -->
6959 EXAMPLE 13 Any member of a union can be initialized:
6960 <pre>
6961 union { /* ... */ } u = { .any_member = 42 };
6962 </pre>
6964 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>).
6965 <!--page 143 -->
6967 <h6>footnotes</h6>
6968 <p><small><a name="note129" href="#note129">129)</a> If the initializer list for a subaggregate or contained union does not begin with a left brace, its
6969 subobjects are initialized as usual, but the subaggregate or contained union does not become the
6970 current object: current objects are associated only with brace-enclosed initializer lists.
6971 </small>
6972 <p><small><a name="note130" href="#note130">130)</a> After a union member is initialized, the next object is not the next member of the union; instead, it is
6973 the next subobject of an object containing the union.
6974 </small>
6975 <p><small><a name="note131" href="#note131">131)</a> Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
6976 the surrounding brace pair. Note, too, that each separate designator list is independent.
6977 </small>
6978 <p><small><a name="note132" href="#note132">132)</a> Any initializer for the subobject which is overridden and so not used to initialize that subobject might
6979 not be evaluated at all.
6980 </small>
6981 <p><small><a name="note133" href="#note133">133)</a> In particular, the evaluation order need not be the same as the order of subobject initialization.
6982 </small>
6984 <h3><a name="6.8" href="#6.8">6.8 Statements and blocks</a></h3>
6985 <h6>Syntax</h6>
6986 <p><!--para 1 -->
6987 <pre>
6988 statement:
6989 labeled-statement
6990 compound-statement
6991 expression-statement
6992 selection-statement
6993 iteration-statement
6994 jump-statement
6995 </pre>
6996 <h6>Semantics</h6>
6997 <p><!--para 2 -->
6998 A statement specifies an action to be performed. Except as indicated, statements are
6999 executed in sequence.
7000 <p><!--para 3 -->
7001 A block allows a set of declarations and statements to be grouped into one syntactic unit.
7002 The initializers of objects that have automatic storage duration, and the variable length
7003 array declarators of ordinary identifiers with block scope, are evaluated and the values are
7004 stored in the objects (including storing an indeterminate value in objects without an
7005 initializer) each time the declaration is reached in the order of execution, as if it were a
7006 statement, and within each declaration in the order that declarators appear.
7007 <p><!--para 4 -->
7008 A full expression is an expression that is not part of another expression or of a declarator.
7009 Each of the following is a full expression: an initializer; the expression in an expression
7010 statement; the controlling expression of a selection statement (if or switch); the
7011 controlling expression of a while or do statement; each of the (optional) expressions of
7012 a for statement; the (optional) expression in a return statement. The end of a full
7013 expression is a sequence point.
7014 <p><b> Forward references</b>: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
7015 (<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>).
7017 <h4><a name="6.8.1" href="#6.8.1">6.8.1 Labeled statements</a></h4>
7018 <h6>Syntax</h6>
7019 <p><!--para 1 -->
7020 <pre>
7021 labeled-statement:
7022 identifier : statement
7023 case constant-expression : statement
7024 default : statement
7025 </pre>
7026 <h6>Constraints</h6>
7027 <p><!--para 2 -->
7028 A case or default label shall appear only in a switch statement. Further
7029 constraints on such labels are discussed under the switch statement.
7030 <!--page 144 -->
7031 <p><!--para 3 -->
7032 Label names shall be unique within a function.
7033 <h6>Semantics</h6>
7034 <p><!--para 4 -->
7035 Any statement may be preceded by a prefix that declares an identifier as a label name.
7036 Labels in themselves do not alter the flow of control, which continues unimpeded across
7037 them.
7038 <p><b> Forward references</b>: 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>).
7040 <h4><a name="6.8.2" href="#6.8.2">6.8.2 Compound statement</a></h4>
7041 <h6>Syntax</h6>
7042 <p><!--para 1 -->
7043 <pre>
7044 compound-statement:
7045 { block-item-list<sub>opt</sub> }
7046 block-item-list:
7047 block-item
7048 block-item-list block-item
7049 block-item:
7050 declaration
7051 statement
7052 </pre>
7053 <h6>Semantics</h6>
7054 <p><!--para 2 -->
7055 A compound statement is a block.
7057 <h4><a name="6.8.3" href="#6.8.3">6.8.3 Expression and null statements</a></h4>
7058 <h6>Syntax</h6>
7059 <p><!--para 1 -->
7060 <pre>
7061 expression-statement:
7062 expression<sub>opt</sub> ;
7063 </pre>
7064 <h6>Semantics</h6>
7065 <p><!--para 2 -->
7066 The expression in an expression statement is evaluated as a void expression for its side
7067 effects.<sup><a href="#note134"><b>134)</b></a></sup>
7068 <p><!--para 3 -->
7069 A null statement (consisting of just a semicolon) performs no operations.
7070 <p><!--para 4 -->
7071 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
7072 discarding of its value may be made explicit by converting the expression to a void expression by means of
7073 a cast:
7074 <pre>
7075 int p(int);
7076 /* ... */
7077 (void)p(0);
7078 </pre>
7082 <!--page 145 -->
7083 <p><!--para 5 -->
7084 EXAMPLE 2 In the program fragment
7085 <pre>
7086 char *s;
7087 /* ... */
7088 while (*s++ != '\0')
7090 </pre>
7091 a null statement is used to supply an empty loop body to the iteration statement.
7093 <p><!--para 6 -->
7094 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
7095 statement.
7096 <pre>
7097 while (loop1) {
7098 /* ... */
7099 while (loop2) {
7100 /* ... */
7101 if (want_out)
7102 goto end_loop1;
7103 /* ... */
7105 /* ... */
7106 end_loop1: ;
7108 </pre>
7110 <p><b> Forward references</b>: iteration statements (<a href="#6.8.5">6.8.5</a>).
7112 <h6>footnotes</h6>
7113 <p><small><a name="note134" href="#note134">134)</a> Such as assignments, and function calls which have side effects.
7114 </small>
7116 <h4><a name="6.8.4" href="#6.8.4">6.8.4 Selection statements</a></h4>
7117 <h6>Syntax</h6>
7118 <p><!--para 1 -->
7119 <pre>
7120 selection-statement:
7121 if ( expression ) statement
7122 if ( expression ) statement else statement
7123 switch ( expression ) statement
7124 </pre>
7125 <h6>Semantics</h6>
7126 <p><!--para 2 -->
7127 A selection statement selects among a set of statements depending on the value of a
7128 controlling expression.
7129 <p><!--para 3 -->
7130 A selection statement is a block whose scope is a strict subset of the scope of its
7131 enclosing block. Each associated substatement is also a block whose scope is a strict
7132 subset of the scope of the selection statement.
7134 <h5><a name="6.8.4.1" href="#6.8.4.1">6.8.4.1 The if statement</a></h5>
7135 <h6>Constraints</h6>
7136 <p><!--para 1 -->
7137 The controlling expression of an if statement shall have scalar type.
7138 <h6>Semantics</h6>
7139 <p><!--para 2 -->
7140 In both forms, the first substatement is executed if the expression compares unequal to 0.
7141 In the else form, the second substatement is executed if the expression compares equal
7142 <!--page 146 -->
7143 to 0. If the first substatement is reached via a label, the second substatement is not
7144 executed.
7145 <p><!--para 3 -->
7146 An else is associated with the lexically nearest preceding if that is allowed by the
7147 syntax.
7149 <h5><a name="6.8.4.2" href="#6.8.4.2">6.8.4.2 The switch statement</a></h5>
7150 <h6>Constraints</h6>
7151 <p><!--para 1 -->
7152 The controlling expression of a switch statement shall have integer type.
7153 <p><!--para 2 -->
7154 If a switch statement has an associated case or default label within the scope of an
7155 identifier with a variably modified type, the entire switch statement shall be within the
7156 scope of that identifier.<sup><a href="#note135"><b>135)</b></a></sup>
7157 <p><!--para 3 -->
7158 The expression of each case label shall be an integer constant expression and no two of
7159 the case constant expressions in the same switch statement shall have the same value
7160 after conversion. There may be at most one default label in a switch statement.
7161 (Any enclosed switch statement may have a default label or case constant
7162 expressions with values that duplicate case constant expressions in the enclosing
7163 switch statement.)
7164 <h6>Semantics</h6>
7165 <p><!--para 4 -->
7166 A switch statement causes control to jump to, into, or past the statement that is the
7167 switch body, depending on the value of a controlling expression, and on the presence of a
7168 default label and the values of any case labels on or in the switch body. A case or
7169 default label is accessible only within the closest enclosing switch statement.
7170 <p><!--para 5 -->
7171 The integer promotions are performed on the controlling expression. The constant
7172 expression in each case label is converted to the promoted type of the controlling
7173 expression. If a converted value matches that of the promoted controlling expression,
7174 control jumps to the statement following the matched case label. Otherwise, if there is
7175 a default label, control jumps to the labeled statement. If no converted case constant
7176 expression matches and there is no default label, no part of the switch body is
7177 executed.
7178 <h6>Implementation limits</h6>
7179 <p><!--para 6 -->
7180 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
7181 switch statement.
7186 <!--page 147 -->
7187 <p><!--para 7 -->
7188 EXAMPLE In the artificial program fragment
7189 <pre>
7190 switch (expr)
7192 int i = 4;
7193 f(i);
7194 case 0:
7195 i = 17;
7196 /* falls through into default code */
7197 default:
7198 printf("%d\n", i);
7200 </pre>
7201 the object whose identifier is i exists with automatic storage duration (within the block) but is never
7202 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
7203 access an indeterminate value. Similarly, the call to the function f cannot be reached.
7206 <h6>footnotes</h6>
7207 <p><small><a name="note135" href="#note135">135)</a> That is, the declaration either precedes the switch statement, or it follows the last case or
7208 default label associated with the switch that is in the block containing the declaration.
7209 </small>
7211 <h4><a name="6.8.5" href="#6.8.5">6.8.5 Iteration statements</a></h4>
7212 <h6>Syntax</h6>
7213 <p><!--para 1 -->
7214 <pre>
7215 iteration-statement:
7216 while ( expression ) statement
7217 do statement while ( expression ) ;
7218 for ( expression<sub>opt</sub> ; expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
7219 for ( declaration expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
7220 </pre>
7221 <h6>Constraints</h6>
7222 <p><!--para 2 -->
7223 The controlling expression of an iteration statement shall have scalar type.
7224 <p><!--para 3 -->
7225 The declaration part of a for statement shall only declare identifiers for objects having
7226 storage class auto or register.
7227 <h6>Semantics</h6>
7228 <p><!--para 4 -->
7229 An iteration statement causes a statement called the loop body to be executed repeatedly
7230 until the controlling expression compares equal to 0. The repetition occurs regardless of
7231 whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note136"><b>136)</b></a></sup>
7232 <p><!--para 5 -->
7233 An iteration statement is a block whose scope is a strict subset of the scope of its
7234 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
7235 of the iteration statement.
7240 <!--page 148 -->
7242 <h6>footnotes</h6>
7243 <p><small><a name="note136" href="#note136">136)</a> Code jumped over is not executed. In particular, the controlling expression of a for or while
7244 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
7245 </small>
7247 <h5><a name="6.8.5.1" href="#6.8.5.1">6.8.5.1 The while statement</a></h5>
7248 <p><!--para 1 -->
7249 The evaluation of the controlling expression takes place before each execution of the loop
7250 body.
7252 <h5><a name="6.8.5.2" href="#6.8.5.2">6.8.5.2 The do statement</a></h5>
7253 <p><!--para 1 -->
7254 The evaluation of the controlling expression takes place after each execution of the loop
7255 body.
7257 <h5><a name="6.8.5.3" href="#6.8.5.3">6.8.5.3 The for statement</a></h5>
7258 <p><!--para 1 -->
7259 The statement
7260 <pre>
7261 for ( clause-1 ; expression-2 ; expression-3 ) statement
7262 </pre>
7263 behaves as follows: The expression expression-2 is the controlling expression that is
7264 evaluated before each execution of the loop body. The expression expression-3 is
7265 evaluated as a void expression after each execution of the loop body. If clause-1 is a
7266 declaration, the scope of any identifiers it declares is the remainder of the declaration and
7267 the entire loop, including the other two expressions; it is reached in the order of execution
7268 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
7269 evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note137"><b>137)</b></a></sup>
7270 <p><!--para 2 -->
7271 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
7272 nonzero constant.
7274 <h6>footnotes</h6>
7275 <p><small><a name="note137" href="#note137">137)</a> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
7276 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
7277 such that execution of the loop continues until the expression compares equal to 0; and expression-3
7278 specifies an operation (such as incrementing) that is performed after each iteration.
7279 </small>
7281 <h4><a name="6.8.6" href="#6.8.6">6.8.6 Jump statements</a></h4>
7282 <h6>Syntax</h6>
7283 <p><!--para 1 -->
7284 <pre>
7285 jump-statement:
7286 goto identifier ;
7287 continue ;
7288 break ;
7289 return expression<sub>opt</sub> ;
7290 </pre>
7291 <h6>Semantics</h6>
7292 <p><!--para 2 -->
7293 A jump statement causes an unconditional jump to another place.
7298 <!--page 149 -->
7300 <h5><a name="6.8.6.1" href="#6.8.6.1">6.8.6.1 The goto statement</a></h5>
7301 <h6>Constraints</h6>
7302 <p><!--para 1 -->
7303 The identifier in a goto statement shall name a label located somewhere in the enclosing
7304 function. A goto statement shall not jump from outside the scope of an identifier having
7305 a variably modified type to inside the scope of that identifier.
7306 <h6>Semantics</h6>
7307 <p><!--para 2 -->
7308 A goto statement causes an unconditional jump to the statement prefixed by the named
7309 label in the enclosing function.
7310 <p><!--para 3 -->
7311 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
7312 following outline presents one possible approach to a problem based on these three assumptions:
7313 <ol>
7314 <li> The general initialization code accesses objects only visible to the current function.
7315 <li> The general initialization code is too large to warrant duplication.
7316 <li> The code to determine the next operation is at the head of the loop. (To allow it to be reached by
7317 continue statements, for example.)
7318 <pre>
7319 /* ... */
7320 goto first_time;
7321 for (;;) {
7322 // determine next operation
7323 /* ... */
7324 if (need to reinitialize) {
7325 // reinitialize-only code
7326 /* ... */
7327 first_time:
7328 // general initialization code
7329 /* ... */
7330 continue;
7332 // handle other operations
7333 /* ... */
7335 </pre>
7336 <!--page 150 -->
7337 </ol>
7338 <p><!--para 4 -->
7339 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
7340 modified types. A jump within the scope, however, is permitted.
7341 <pre>
7342 goto lab3; // invalid: going INTO scope of VLA.
7344 double a[n];
7345 a[j] = <a href="#4.4">4.4</a>;
7346 lab3:
7347 a[j] = <a href="#3.3">3.3</a>;
7348 goto lab4; // valid: going WITHIN scope of VLA.
7349 a[j] = <a href="#5.5">5.5</a>;
7350 lab4:
7351 a[j] = <a href="#6.6">6.6</a>;
7353 goto lab4; // invalid: going INTO scope of VLA.
7354 </pre>
7357 <h5><a name="6.8.6.2" href="#6.8.6.2">6.8.6.2 The continue statement</a></h5>
7358 <h6>Constraints</h6>
7359 <p><!--para 1 -->
7360 A continue statement shall appear only in or as a loop body.
7361 <h6>Semantics</h6>
7362 <p><!--para 2 -->
7363 A continue statement causes a jump to the loop-continuation portion of the smallest
7364 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
7365 of the statements
7366 <pre>
7367 while (/* ... */) { do { for (/* ... */) {
7368 /* ... */ /* ... */ /* ... */
7369 continue; continue; continue;
7370 /* ... */ /* ... */ /* ... */
7371 contin: ; contin: ; contin: ;
7372 } } while (/* ... */); }
7373 </pre>
7374 unless the continue statement shown is in an enclosed iteration statement (in which
7375 case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note138"><b>138)</b></a></sup>
7377 <h6>footnotes</h6>
7378 <p><small><a name="note138" href="#note138">138)</a> Following the contin: label is a null statement.
7379 </small>
7381 <h5><a name="6.8.6.3" href="#6.8.6.3">6.8.6.3 The break statement</a></h5>
7382 <h6>Constraints</h6>
7383 <p><!--para 1 -->
7384 A break statement shall appear only in or as a switch body or loop body.
7385 <h6>Semantics</h6>
7386 <p><!--para 2 -->
7387 A break statement terminates execution of the smallest enclosing switch or iteration
7388 statement.
7392 <!--page 151 -->
7394 <h5><a name="6.8.6.4" href="#6.8.6.4">6.8.6.4 The return statement</a></h5>
7395 <h6>Constraints</h6>
7396 <p><!--para 1 -->
7397 A return statement with an expression shall not appear in a function whose return type
7398 is void. A return statement without an expression shall only appear in a function
7399 whose return type is void.
7400 <h6>Semantics</h6>
7401 <p><!--para 2 -->
7402 A return statement terminates execution of the current function and returns control to
7403 its caller. A function may have any number of return statements.
7404 <p><!--para 3 -->
7405 If a return statement with an expression is executed, the value of the expression is
7406 returned to the caller as the value of the function call expression. If the expression has a
7407 type different from the return type of the function in which it appears, the value is
7408 converted as if by assignment to an object having the return type of the function.<sup><a href="#note139"><b>139)</b></a></sup>
7409 <p><!--para 4 -->
7410 EXAMPLE In:
7411 <pre>
7412 struct s { double i; } f(void);
7413 union {
7414 struct {
7415 int f1;
7416 struct s f2;
7417 } u1;
7418 struct {
7419 struct s f3;
7420 int f4;
7421 } u2;
7422 } g;
7423 struct s f(void)
7425 return g.u1.f2;
7427 /* ... */
7428 g.u2.f3 = f();
7429 </pre>
7430 there is no undefined behavior, although there would be if the assignment were done directly (without using
7431 a function call to fetch the value).
7436 <!--page 152 -->
7438 <h6>footnotes</h6>
7439 <p><small><a name="note139" href="#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
7440 apply to the case of function return. The representation of floating-point values may have wider range
7441 or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
7442 range and precision.
7443 </small>
7445 <h3><a name="6.9" href="#6.9">6.9 External definitions</a></h3>
7446 <h6>Syntax</h6>
7447 <p><!--para 1 -->
7448 <pre>
7449 translation-unit:
7450 external-declaration
7451 translation-unit external-declaration
7452 external-declaration:
7453 function-definition
7454 declaration
7455 </pre>
7456 <h6>Constraints</h6>
7457 <p><!--para 2 -->
7458 The storage-class specifiers auto and register shall not appear in the declaration
7459 specifiers in an external declaration.
7460 <p><!--para 3 -->
7461 There shall be no more than one external definition for each identifier declared with
7462 internal linkage in a translation unit. Moreover, if an identifier declared with internal
7463 linkage is used in an expression (other than as a part of the operand of a sizeof
7464 operator whose result is an integer constant), there shall be exactly one external definition
7465 for the identifier in the translation unit.
7466 <h6>Semantics</h6>
7467 <p><!--para 4 -->
7468 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,
7469 which consists of a sequence of external declarations. These are described as ''external''
7470 because they appear outside any function (and hence have file scope). As discussed in
7471 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
7472 by the identifier is a definition.
7473 <p><!--para 5 -->
7474 An external definition is an external declaration that is also a definition of a function
7475 (other than an inline definition) or an object. If an identifier declared with external
7476 linkage is used in an expression (other than as part of the operand of a sizeof operator
7477 whose result is an integer constant), somewhere in the entire program there shall be
7478 exactly one external definition for the identifier; otherwise, there shall be no more than
7479 one.<sup><a href="#note140"><b>140)</b></a></sup>
7484 <!--page 153 -->
7486 <h6>footnotes</h6>
7487 <p><small><a name="note140" href="#note140">140)</a> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
7488 external definition for it.
7489 </small>
7491 <h4><a name="6.9.1" href="#6.9.1">6.9.1 Function definitions</a></h4>
7492 <h6>Syntax</h6>
7493 <p><!--para 1 -->
7494 <pre>
7495 function-definition:
7496 declaration-specifiers declarator declaration-list<sub>opt</sub> compound-statement
7497 declaration-list:
7498 declaration
7499 declaration-list declaration
7500 </pre>
7501 <h6>Constraints</h6>
7502 <p><!--para 2 -->
7503 The identifier declared in a function definition (which is the name of the function) shall
7504 have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note141"><b>141)</b></a></sup>
7505 <p><!--para 3 -->
7506 The return type of a function shall be void or an object type other than array type.
7507 <p><!--para 4 -->
7508 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
7509 static.
7510 <p><!--para 5 -->
7511 If the declarator includes a parameter type list, the declaration of each parameter shall
7512 include an identifier, except for the special case of a parameter list consisting of a single
7513 parameter of type void, in which case there shall not be an identifier. No declaration list
7514 shall follow.
7515 <p><!--para 6 -->
7516 If the declarator includes an identifier list, each declaration in the declaration list shall
7517 have at least one declarator, those declarators shall declare only identifiers from the
7518 identifier list, and every identifier in the identifier list shall be declared. An identifier
7519 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
7520 declaration list shall contain no storage-class specifier other than register and no
7521 initializations.
7526 <!--page 154 -->
7527 <h6>Semantics</h6>
7528 <p><!--para 7 -->
7529 The declarator in a function definition specifies the name of the function being defined
7530 and the identifiers of its parameters. If the declarator includes a parameter type list, the
7531 list also specifies the types of all the parameters; such a declarator also serves as a
7532 function prototype for later calls to the same function in the same translation unit. If the
7533 declarator includes an identifier list,<sup><a href="#note142"><b>142)</b></a></sup> the types of the parameters shall be declared in a
7534 following declaration list. In either case, the type of each parameter is adjusted as
7535 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.
7536 <p><!--para 8 -->
7537 If a function that accepts a variable number of arguments is defined without a parameter
7538 type list that ends with the ellipsis notation, the behavior is undefined.
7539 <p><!--para 9 -->
7540 Each parameter has automatic storage duration. Its identifier is an lvalue, which is in
7541 effect declared at the head of the compound statement that constitutes the function body
7542 (and therefore cannot be redeclared in the function body except in an enclosed block).
7543 The layout of the storage for parameters is unspecified.
7544 <p><!--para 10 -->
7545 On entry to the function, the size expressions of each variably modified parameter are
7546 evaluated and the value of each argument expression is converted to the type of the
7547 corresponding parameter as if by assignment. (Array expressions and function
7548 designators as arguments were converted to pointers before the call.)
7549 <p><!--para 11 -->
7550 After all parameters have been assigned, the compound statement that constitutes the
7551 body of the function definition is executed.
7552 <p><!--para 12 -->
7553 If the } that terminates a function is reached, and the value of the function call is used by
7554 the caller, the behavior is undefined.
7555 <p><!--para 13 -->
7556 EXAMPLE 1 In the following:
7557 <pre>
7558 extern int max(int a, int b)
7560 return a &gt; b ? a : b;
7562 </pre>
7563 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
7564 function declarator; and
7565 <pre>
7566 { return a &gt; b ? a : b; }
7567 </pre>
7568 is the function body. The following similar definition uses the identifier-list form for the parameter
7569 declarations:
7574 <!--page 155 -->
7575 <pre>
7576 extern int max(a, b)
7577 int a, b;
7579 return a &gt; b ? a : b;
7581 </pre>
7582 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
7583 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
7584 to the function, whereas the second form does not.
7586 <p><!--para 14 -->
7587 EXAMPLE 2 To pass one function to another, one might say
7588 <pre>
7589 int f(void);
7590 /* ... */
7591 g(f);
7592 </pre>
7593 Then the definition of g might read
7594 <pre>
7595 void g(int (*funcp)(void))
7597 /* ... */
7598 (*funcp)(); /* or funcp(); ... */
7600 </pre>
7601 or, equivalently,
7602 <pre>
7603 void g(int func(void))
7605 /* ... */
7606 func(); /* or (*func)(); ... */
7608 </pre>
7611 <h6>footnotes</h6>
7612 <p><small><a name="note141" href="#note141">141)</a> The intent is that the type category in a function definition cannot be inherited from a typedef:
7614 <pre>
7615 typedef int F(void); // type F is ''function with no parameters
7616 // returning int''
7617 F f, g; // f and g both have type compatible with F
7618 F f { /* ... */ } // WRONG: syntax/constraint error
7619 F g() { /* ... */ } // WRONG: declares that g returns a function
7620 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
7621 int g() { /* ... */ } // RIGHT: g has type compatible with F
7622 F *e(void) { /* ... */ } // e returns a pointer to a function
7623 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
7624 int (*fp)(void); // fp points to a function that has type F
7625 F *Fp; // Fp points to a function that has type F
7626 </pre>
7627 </small>
7628 <p><small><a name="note142" href="#note142">142)</a> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
7629 </small>
7631 <h4><a name="6.9.2" href="#6.9.2">6.9.2 External object definitions</a></h4>
7632 <h6>Semantics</h6>
7633 <p><!--para 1 -->
7634 If the declaration of an identifier for an object has file scope and an initializer, the
7635 declaration is an external definition for the identifier.
7636 <p><!--para 2 -->
7637 A declaration of an identifier for an object that has file scope without an initializer, and
7638 without a storage-class specifier or with the storage-class specifier static, constitutes a
7639 tentative definition. If a translation unit contains one or more tentative definitions for an
7640 identifier, and the translation unit contains no external definition for that identifier, then
7641 the behavior is exactly as if the translation unit contains a file scope declaration of that
7642 identifier, with the composite type as of the end of the translation unit, with an initializer
7643 equal to 0.
7644 <p><!--para 3 -->
7645 If the declaration of an identifier for an object is a tentative definition and has internal
7646 linkage, the declared type shall not be an incomplete type.
7647 <!--page 156 -->
7648 <p><!--para 4 -->
7649 EXAMPLE 1
7650 <pre>
7651 int i1 = 1; // definition, external linkage
7652 static int i2 = 2; // definition, internal linkage
7653 extern int i3 = 3; // definition, external linkage
7654 int i4; // tentative definition, external linkage
7655 static int i5; // tentative definition, internal linkage
7656 int i1; // valid tentative definition, refers to previous
7657 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
7658 int i3; // valid tentative definition, refers to previous
7659 int i4; // valid tentative definition, refers to previous
7660 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
7661 extern int i1; // refers to previous, whose linkage is external
7662 extern int i2; // refers to previous, whose linkage is internal
7663 extern int i3; // refers to previous, whose linkage is external
7664 extern int i4; // refers to previous, whose linkage is external
7665 extern int i5; // refers to previous, whose linkage is internal
7666 </pre>
7668 <p><!--para 5 -->
7669 EXAMPLE 2 If at the end of the translation unit containing
7670 <pre>
7671 int i[];
7672 </pre>
7673 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
7674 zero on program startup.
7675 <!--page 157 -->
7677 <h3><a name="6.10" href="#6.10">6.10 Preprocessing directives</a></h3>
7678 <h6>Syntax</h6>
7679 <p><!--para 1 -->
7680 <!--page 158 -->
7681 <pre>
7682 preprocessing-file:
7683 group<sub>opt</sub>
7684 group:
7685 group-part
7686 group group-part
7687 group-part:
7688 if-section
7689 control-line
7690 text-line
7691 # non-directive
7692 if-section:
7693 if-group elif-groups<sub>opt</sub> else-group<sub>opt</sub> endif-line
7694 if-group:
7695 # if constant-expression new-line group<sub>opt</sub>
7696 # ifdef identifier new-line group<sub>opt</sub>
7697 # ifndef identifier new-line group<sub>opt</sub>
7698 elif-groups:
7699 elif-group
7700 elif-groups elif-group
7701 elif-group:
7702 # elif constant-expression new-line group<sub>opt</sub>
7703 else-group:
7704 # else new-line group<sub>opt</sub>
7705 endif-line:
7706 # endif new-line
7707 control-line:
7708 # include pp-tokens new-line
7709 # define identifier replacement-list new-line
7710 # define identifier lparen identifier-list<sub>opt</sub> )
7711 replacement-list new-line
7712 # define identifier lparen ... ) replacement-list new-line
7713 # define identifier lparen identifier-list , ... )
7714 replacement-list new-line
7715 # undef identifier new-line
7716 # line pp-tokens new-line
7717 # error pp-tokens<sub>opt</sub> new-line
7718 # pragma pp-tokens<sub>opt</sub> new-line
7719 # new-line
7720 text-line:
7721 pp-tokens<sub>opt</sub> new-line
7722 non-directive:
7723 pp-tokens new-line
7724 lparen:
7725 a ( character not immediately preceded by white-space
7726 replacement-list:
7727 pp-tokens<sub>opt</sub>
7728 pp-tokens:
7729 preprocessing-token
7730 pp-tokens preprocessing-token
7731 new-line:
7732 the new-line character
7733 </pre>
7734 <h6>Description</h6>
7735 <p><!--para 2 -->
7736 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
7737 following constraints: The first token in the sequence is a # preprocessing token that (at
7738 the start of translation phase 4) is either the first character in the source file (optionally
7739 after white space containing no new-line characters) or that follows white space
7740 containing at least one new-line character. The last token in the sequence is the first new-
7741 line character that follows the first token in the sequence.<sup><a href="#note143"><b>143)</b></a></sup> A new-line character ends
7742 the preprocessing directive even if it occurs within what would otherwise be an
7744 <!--page 159 -->
7745 invocation of a function-like macro.
7746 <p><!--para 3 -->
7747 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
7748 with any of the directive names appearing in the syntax.
7749 <p><!--para 4 -->
7750 When in a group that is skipped (<a href="#6.10.1">6.10.1</a>), the directive syntax is relaxed to allow any
7751 sequence of preprocessing tokens to occur between the directive name and the following
7752 new-line character.
7753 <h6>Constraints</h6>
7754 <p><!--para 5 -->
7755 The only white-space characters that shall appear between preprocessing tokens within a
7756 preprocessing directive (from just after the introducing # preprocessing token through
7757 just before the terminating new-line character) are space and horizontal-tab (including
7758 spaces that have replaced comments or possibly other white-space characters in
7759 translation phase 3).
7760 <h6>Semantics</h6>
7761 <p><!--para 6 -->
7762 The implementation can process and skip sections of source files conditionally, include
7763 other source files, and replace macros. These capabilities are called preprocessing,
7764 because conceptually they occur before translation of the resulting translation unit.
7765 <p><!--para 7 -->
7766 The preprocessing tokens within a preprocessing directive are not subject to macro
7767 expansion unless otherwise stated.
7768 <p><!--para 8 -->
7769 EXAMPLE In:
7770 <pre>
7771 #define EMPTY
7772 EMPTY # include &lt;file.h&gt;
7773 </pre>
7774 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
7775 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
7776 replaced.
7779 <h6>footnotes</h6>
7780 <p><small><a name="note143" href="#note143">143)</a> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
7781 significance, as all white space is equivalent except in certain situations during preprocessing (see the
7782 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
7783 </small>
7785 <h4><a name="6.10.1" href="#6.10.1">6.10.1 Conditional inclusion</a></h4>
7786 <h6>Constraints</h6>
7787 <p><!--para 1 -->
7788 The expression that controls conditional inclusion shall be an integer constant expression
7789 except that: it shall not contain a cast; identifiers (including those lexically identical to
7790 keywords) are interpreted as described below;<sup><a href="#note144"><b>144)</b></a></sup> and it may contain unary operator
7791 expressions of the form
7796 <!--page 160 -->
7797 <pre>
7798 defined identifier
7799 </pre>
7801 <pre>
7802 defined ( identifier )
7803 </pre>
7804 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
7805 predefined or if it has been the subject of a #define preprocessing directive without an
7806 intervening #undef directive with the same subject identifier), 0 if it is not.
7807 <p><!--para 2 -->
7808 Each preprocessing token that remains (in the list of preprocessing tokens that will
7809 become the controlling expression) after all macro replacements have occurred shall be in
7810 the lexical form of a token (<a href="#6.4">6.4</a>).
7811 <h6>Semantics</h6>
7812 <p><!--para 3 -->
7813 Preprocessing directives of the forms
7814 <pre>
7815 # if constant-expression new-line group<sub>opt</sub>
7816 # elif constant-expression new-line group<sub>opt</sub>
7817 </pre>
7818 check whether the controlling constant expression evaluates to nonzero.
7819 <p><!--para 4 -->
7820 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
7821 the controlling constant expression are replaced (except for those macro names modified
7822 by the defined unary operator), just as in normal text. If the token defined is
7823 generated as a result of this replacement process or use of the defined unary operator
7824 does not match one of the two specified forms prior to macro replacement, the behavior is
7825 undefined. After all replacements due to macro expansion and the defined unary
7826 operator have been performed, all remaining identifiers (including those lexically
7827 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
7828 token is converted into a token. The resulting tokens compose the controlling constant
7829 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
7830 token conversion and evaluation, all signed integer types and all unsigned integer types
7831 act as if they have the same representation as, respectively, the types intmax_t and
7832 uintmax_t defined in the header <a href="#7.18">&lt;stdint.h&gt;</a>.<sup><a href="#note145"><b>145)</b></a></sup> This includes interpreting
7833 character constants, which may involve converting escape sequences into execution
7834 character set members. Whether the numeric value for these character constants matches
7835 the value obtained when an identical character constant occurs in an expression (other
7836 than within a #if or #elif directive) is implementation-defined.<sup><a href="#note146"><b>146)</b></a></sup> Also, whether a
7837 single-character character constant may have a negative value is implementation-defined.
7838 <p><!--para 5 -->
7839 Preprocessing directives of the forms
7843 <!--page 161 -->
7844 <pre>
7845 # ifdef identifier new-line group<sub>opt</sub>
7846 # ifndef identifier new-line group<sub>opt</sub>
7847 </pre>
7848 check whether the identifier is or is not currently defined as a macro name. Their
7849 conditions are equivalent to #if defined identifier and #if !defined identifier
7850 respectively.
7851 <p><!--para 6 -->
7852 Each directive's condition is checked in order. If it evaluates to false (zero), the group
7853 that it controls is skipped: directives are processed only through the name that determines
7854 the directive in order to keep track of the level of nested conditionals; the rest of the
7855 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
7856 group. Only the first group whose control condition evaluates to true (nonzero) is
7857 processed. If none of the conditions evaluates to true, and there is a #else directive, the
7858 group controlled by the #else is processed; lacking a #else directive, all the groups
7859 until the #endif are skipped.<sup><a href="#note147"><b>147)</b></a></sup>
7860 <p><b> Forward references</b>: macro replacement (<a href="#6.10.3">6.10.3</a>), source file inclusion (<a href="#6.10.2">6.10.2</a>), largest
7861 integer types (<a href="#7.18.1.5">7.18.1.5</a>).
7863 <h6>footnotes</h6>
7864 <p><small><a name="note144" href="#note144">144)</a> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
7865 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
7866 </small>
7867 <p><small><a name="note145" href="#note145">145)</a> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
7868 0x8000 is signed and positive within a #if expression even though it would be unsigned in
7869 translation phase 7.
7870 </small>
7871 <p><small><a name="note146" href="#note146">146)</a> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
7872 evaluate to the same value in these two contexts.
7873 <pre>
7874 #if 'z' - 'a' == 25
7875 if ('z' - 'a' == 25)
7876 </pre>
7878 </small>
7879 <p><small><a name="note147" href="#note147">147)</a> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
7880 before the terminating new-line character. However, comments may appear anywhere in a source file,
7881 including within a preprocessing directive.
7882 </small>
7884 <h4><a name="6.10.2" href="#6.10.2">6.10.2 Source file inclusion</a></h4>
7885 <h6>Constraints</h6>
7886 <p><!--para 1 -->
7887 A #include directive shall identify a header or source file that can be processed by the
7888 implementation.
7889 <h6>Semantics</h6>
7890 <p><!--para 2 -->
7891 A preprocessing directive of the form
7892 <pre>
7893 # include &lt;h-char-sequence&gt; new-line
7894 </pre>
7895 searches a sequence of implementation-defined places for a header identified uniquely by
7896 the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
7897 directive by the entire contents of the header. How the places are specified or the header
7898 identified is implementation-defined.
7899 <p><!--para 3 -->
7900 A preprocessing directive of the form
7904 <!--page 162 -->
7905 <pre>
7906 # include "q-char-sequence" new-line
7907 </pre>
7908 causes the replacement of that directive by the entire contents of the source file identified
7909 by the specified sequence between the " delimiters. The named source file is searched
7910 for in an implementation-defined manner. If this search is not supported, or if the search
7911 fails, the directive is reprocessed as if it read
7912 <pre>
7913 # include &lt;h-char-sequence&gt; new-line
7914 </pre>
7915 with the identical contained sequence (including &gt; characters, if any) from the original
7916 directive.
7917 <p><!--para 4 -->
7918 A preprocessing directive of the form
7919 <pre>
7920 # include pp-tokens new-line
7921 </pre>
7922 (that does not match one of the two previous forms) is permitted. The preprocessing
7923 tokens after include in the directive are processed just as in normal text. (Each
7924 identifier currently defined as a macro name is replaced by its replacement list of
7925 preprocessing tokens.) The directive resulting after all replacements shall match one of
7926 the two previous forms.<sup><a href="#note148"><b>148)</b></a></sup> The method by which a sequence of preprocessing tokens
7927 between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
7928 single header name preprocessing token is implementation-defined.
7929 <p><!--para 5 -->
7930 The implementation shall provide unique mappings for sequences consisting of one or
7931 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
7932 first character shall not be a digit. The implementation may ignore distinctions of
7933 alphabetical case and restrict the mapping to eight significant characters before the
7934 period.
7935 <p><!--para 6 -->
7936 A #include preprocessing directive may appear in a source file that has been read
7937 because of a #include directive in another file, up to an implementation-defined
7938 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
7939 <p><!--para 7 -->
7940 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
7941 <pre>
7942 #include <a href="#7.19">&lt;stdio.h&gt;</a>
7943 #include "myprog.h"
7944 </pre>
7946 <p><!--para 8 -->
7947 EXAMPLE 2 This illustrates macro-replaced #include directives:
7952 <!--page 163 -->
7953 <pre>
7954 #if VERSION == 1
7955 #define INCFILE "vers1.h"
7956 #elif VERSION == 2
7957 #define INCFILE "vers2.h" // and so on
7958 #else
7959 #define INCFILE "versN.h"
7960 #endif
7961 #include INCFILE
7962 </pre>
7964 <p><b> Forward references</b>: macro replacement (<a href="#6.10.3">6.10.3</a>).
7966 <h6>footnotes</h6>
7967 <p><small><a name="note148" href="#note148">148)</a> Note that adjacent string literals are not concatenated into a single string literal (see the translation
7968 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.
7969 </small>
7971 <h4><a name="6.10.3" href="#6.10.3">6.10.3 Macro replacement</a></h4>
7972 <h6>Constraints</h6>
7973 <p><!--para 1 -->
7974 Two replacement lists are identical if and only if the preprocessing tokens in both have
7975 the same number, ordering, spelling, and white-space separation, where all white-space
7976 separations are considered identical.
7977 <p><!--para 2 -->
7978 An identifier currently defined as an object-like macro shall not be redefined by another
7979 #define preprocessing directive unless the second definition is an object-like macro
7980 definition and the two replacement lists are identical. Likewise, an identifier currently
7981 defined as a function-like macro shall not be redefined by another #define
7982 preprocessing directive unless the second definition is a function-like macro definition
7983 that has the same number and spelling of parameters, and the two replacement lists are
7984 identical.
7985 <p><!--para 3 -->
7986 There shall be white-space between the identifier and the replacement list in the definition
7987 of an object-like macro.
7988 <p><!--para 4 -->
7989 If the identifier-list in the macro definition does not end with an ellipsis, the number of
7990 arguments (including those arguments consisting of no preprocessing tokens) in an
7991 invocation of a function-like macro shall equal the number of parameters in the macro
7992 definition. Otherwise, there shall be more arguments in the invocation than there are
7993 parameters in the macro definition (excluding the ...). There shall exist a )
7994 preprocessing token that terminates the invocation.
7995 <p><!--para 5 -->
7996 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
7997 macro that uses the ellipsis notation in the parameters.
7998 <p><!--para 6 -->
7999 A parameter identifier in a function-like macro shall be uniquely declared within its
8000 scope.
8001 <h6>Semantics</h6>
8002 <p><!--para 7 -->
8003 The identifier immediately following the define is called the macro name. There is one
8004 name space for macro names. Any white-space characters preceding or following the
8005 replacement list of preprocessing tokens are not considered part of the replacement list
8006 for either form of macro.
8007 <!--page 164 -->
8008 <p><!--para 8 -->
8009 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
8010 a preprocessing directive could begin, the identifier is not subject to macro replacement.
8011 <p><!--para 9 -->
8012 A preprocessing directive of the form
8013 <pre>
8014 # define identifier replacement-list new-line
8015 </pre>
8016 defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note149"><b>149)</b></a></sup>
8017 to be replaced by the replacement list of preprocessing tokens that constitute the
8018 remainder of the directive. The replacement list is then rescanned for more macro names
8019 as specified below.
8020 <p><!--para 10 -->
8021 A preprocessing directive of the form
8022 <pre>
8023 # define identifier lparen identifier-list<sub>opt</sub> ) replacement-list new-line
8024 # define identifier lparen ... ) replacement-list new-line
8025 # define identifier lparen identifier-list , ... ) replacement-list new-line
8026 </pre>
8027 defines a function-like macro with parameters, whose use is similar syntactically to a
8028 function call. The parameters are specified by the optional list of identifiers, whose scope
8029 extends from their declaration in the identifier list until the new-line character that
8030 terminates the #define preprocessing directive. Each subsequent instance of the
8031 function-like macro name followed by a ( as the next preprocessing token introduces the
8032 sequence of preprocessing tokens that is replaced by the replacement list in the definition
8033 (an invocation of the macro). The replaced sequence of preprocessing tokens is
8034 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
8035 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
8036 tokens making up an invocation of a function-like macro, new-line is considered a normal
8037 white-space character.
8038 <p><!--para 11 -->
8039 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
8040 forms the list of arguments for the function-like macro. The individual arguments within
8041 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
8042 between matching inner parentheses do not separate arguments. If there are sequences of
8043 preprocessing tokens within the list of arguments that would otherwise act as
8044 preprocessing directives,<sup><a href="#note150"><b>150)</b></a></sup> the behavior is undefined.
8045 <p><!--para 12 -->
8046 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
8047 including any separating comma preprocessing tokens, are merged to form a single item:
8048 the variable arguments. The number of arguments so combined is such that, following
8051 <!--page 165 -->
8052 merger, the number of arguments is one more than the number of parameters in the macro
8053 definition (excluding the ...).
8055 <h6>footnotes</h6>
8056 <p><small><a name="note149" href="#note149">149)</a> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
8057 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
8058 are never scanned for macro names or parameters.
8059 </small>
8060 <p><small><a name="note150" href="#note150">150)</a> Despite the name, a non-directive is a preprocessing directive.
8061 </small>
8063 <h5><a name="6.10.3.1" href="#6.10.3.1">6.10.3.1 Argument substitution</a></h5>
8064 <p><!--para 1 -->
8065 After the arguments for the invocation of a function-like macro have been identified,
8066 argument substitution takes place. A parameter in the replacement list, unless preceded
8067 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
8068 replaced by the corresponding argument after all macros contained therein have been
8069 expanded. Before being substituted, each argument's preprocessing tokens are
8070 completely macro replaced as if they formed the rest of the preprocessing file; no other
8071 preprocessing tokens are available.
8072 <p><!--para 2 -->
8073 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
8074 were a parameter, and the variable arguments shall form the preprocessing tokens used to
8075 replace it.
8077 <h5><a name="6.10.3.2" href="#6.10.3.2">6.10.3.2 The # operator</a></h5>
8078 <h6>Constraints</h6>
8079 <p><!--para 1 -->
8080 Each # preprocessing token in the replacement list for a function-like macro shall be
8081 followed by a parameter as the next preprocessing token in the replacement list.
8082 <h6>Semantics</h6>
8083 <p><!--para 2 -->
8084 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
8085 token, both are replaced by a single character string literal preprocessing token that
8086 contains the spelling of the preprocessing token sequence for the corresponding
8087 argument. Each occurrence of white space between the argument's preprocessing tokens
8088 becomes a single space character in the character string literal. White space before the
8089 first preprocessing token and after the last preprocessing token composing the argument
8090 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
8091 is retained in the character string literal, except for special handling for producing the
8092 spelling of string literals and character constants: a \ character is inserted before each "
8093 and \ character of a character constant or string literal (including the delimiting "
8094 characters), except that it is implementation-defined whether a \ character is inserted
8095 before the \ character beginning a universal character name. If the replacement that
8096 results is not a valid character string literal, the behavior is undefined. The character
8097 string literal corresponding to an empty argument is "". The order of evaluation of # and
8098 ## operators is unspecified.
8099 <!--page 166 -->
8101 <h5><a name="6.10.3.3" href="#6.10.3.3">6.10.3.3 The ## operator</a></h5>
8102 <h6>Constraints</h6>
8103 <p><!--para 1 -->
8104 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
8105 list for either form of macro definition.
8106 <h6>Semantics</h6>
8107 <p><!--para 2 -->
8108 If, in the replacement list of a function-like macro, a parameter is immediately preceded
8109 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
8110 argument's preprocessing token sequence; however, if an argument consists of no
8111 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
8112 instead.<sup><a href="#note151"><b>151)</b></a></sup>
8113 <p><!--para 3 -->
8114 For both object-like and function-like macro invocations, before the replacement list is
8115 reexamined for more macro names to replace, each instance of a ## preprocessing token
8116 in the replacement list (not from an argument) is deleted and the preceding preprocessing
8117 token is concatenated with the following preprocessing token. Placemarker
8118 preprocessing tokens are handled specially: concatenation of two placemarkers results in
8119 a single placemarker preprocessing token, and concatenation of a placemarker with a
8120 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
8121 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
8122 token is available for further macro replacement. The order of evaluation of ## operators
8123 is unspecified.
8124 <p><!--para 4 -->
8125 EXAMPLE In the following fragment:
8126 <pre>
8127 #define hash_hash # ## #
8128 #define mkstr(a) # a
8129 #define in_between(a) mkstr(a)
8130 #define join(c, d) in_between(c hash_hash d)
8131 char p[] = join(x, y); // equivalent to
8132 // char p[] = "x ## y";
8133 </pre>
8134 The expansion produces, at various stages:
8135 <pre>
8136 join(x, y)
8137 in_between(x hash_hash y)
8138 in_between(x ## y)
8139 mkstr(x ## y)
8140 "x ## y"
8141 </pre>
8142 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
8143 this new token is not the ## operator.
8146 <!--page 167 -->
8148 <h6>footnotes</h6>
8149 <p><small><a name="note151" href="#note151">151)</a> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
8150 exist only within translation phase 4.
8151 </small>
8153 <h5><a name="6.10.3.4" href="#6.10.3.4">6.10.3.4 Rescanning and further replacement</a></h5>
8154 <p><!--para 1 -->
8155 After all parameters in the replacement list have been substituted and # and ##
8156 processing has taken place, all placemarker preprocessing tokens are removed. Then, the
8157 resulting preprocessing token sequence is rescanned, along with all subsequent
8158 preprocessing tokens of the source file, for more macro names to replace.
8159 <p><!--para 2 -->
8160 If the name of the macro being replaced is found during this scan of the replacement list
8161 (not including the rest of the source file's preprocessing tokens), it is not replaced.
8162 Furthermore, if any nested replacements encounter the name of the macro being replaced,
8163 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
8164 available for further replacement even if they are later (re)examined in contexts in which
8165 that macro name preprocessing token would otherwise have been replaced.
8166 <p><!--para 3 -->
8167 The resulting completely macro-replaced preprocessing token sequence is not processed
8168 as a preprocessing directive even if it resembles one, but all pragma unary operator
8169 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
8171 <h5><a name="6.10.3.5" href="#6.10.3.5">6.10.3.5 Scope of macro definitions</a></h5>
8172 <p><!--para 1 -->
8173 A macro definition lasts (independent of block structure) until a corresponding #undef
8174 directive is encountered or (if none is encountered) until the end of the preprocessing
8175 translation unit. Macro definitions have no significance after translation phase 4.
8176 <p><!--para 2 -->
8177 A preprocessing directive of the form
8178 <pre>
8179 # undef identifier new-line
8180 </pre>
8181 causes the specified identifier no longer to be defined as a macro name. It is ignored if
8182 the specified identifier is not currently defined as a macro name.
8183 <p><!--para 3 -->
8184 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
8185 <pre>
8186 #define TABSIZE 100
8187 int table[TABSIZE];
8188 </pre>
8190 <p><!--para 4 -->
8191 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
8192 It has the advantages of working for any compatible types of the arguments and of generating in-line code
8193 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
8194 arguments a second time (including side effects) and generating more code than a function if invoked
8195 several times. It also cannot have its address taken, as it has none.
8196 <pre>
8197 #define max(a, b) ((a) &gt; (b) ? (a) : (b))
8198 </pre>
8199 The parentheses ensure that the arguments and the resulting expression are bound properly.
8200 <!--page 168 -->
8201 <p><!--para 5 -->
8202 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
8203 <pre>
8204 #define x 3
8205 #define f(a) f(x * (a))
8206 #undef x
8207 #define x 2
8208 #define g f
8209 #define z z[0]
8210 #define h g(~
8211 #define m(a) a(w)
8212 #define w 0,1
8213 #define t(a) a
8214 #define p() int
8215 #define q(x) x
8216 #define r(x,y) x ## y
8217 #define str(x) # x
8218 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
8219 g(x+(3,4)-w) | h 5) &amp; m
8220 (f)^m(m);
8221 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
8222 char c[2][6] = { str(hello), str() };
8223 </pre>
8224 results in
8225 <pre>
8226 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
8227 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
8228 int i[] = { 1, 23, 4, 5, };
8229 char c[2][6] = { "hello", "" };
8230 </pre>
8232 <p><!--para 6 -->
8233 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
8234 sequence
8235 <pre>
8236 #define str(s) # s
8237 #define xstr(s) str(s)
8238 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
8239 x ## s, x ## t)
8240 #define INCFILE(n) vers ## n
8241 #define glue(a, b) a ## b
8242 #define xglue(a, b) glue(a, b)
8243 #define HIGHLOW "hello"
8244 #define LOW LOW ", world"
8245 debug(1, 2);
8246 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
8247 == 0) str(: @\n), s);
8248 #include xstr(INCFILE(2).h)
8249 glue(HIGH, LOW);
8250 xglue(HIGH, LOW)
8251 </pre>
8252 results in
8253 <!--page 169 -->
8254 <pre>
8255 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
8256 fputs(
8257 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
8259 #include "vers2.h" (after macro replacement, before file access)
8260 "hello";
8261 "hello" ", world"
8262 </pre>
8263 or, after concatenation of the character string literals,
8264 <pre>
8265 printf("x1= %d, x2= %s", x1, x2);
8266 fputs(
8267 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
8269 #include "vers2.h" (after macro replacement, before file access)
8270 "hello";
8271 "hello, world"
8272 </pre>
8273 Space around the # and ## tokens in the macro definition is optional.
8275 <p><!--para 7 -->
8276 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
8277 <pre>
8278 #define t(x,y,z) x ## y ## z
8279 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
8280 t(10,,), t(,11,), t(,,12), t(,,) };
8281 </pre>
8282 results in
8283 <pre>
8284 int j[] = { 123, 45, 67, 89,
8285 10, 11, 12, };
8286 </pre>
8288 <p><!--para 8 -->
8289 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
8290 <pre>
8291 #define OBJ_LIKE (1-1)
8292 #define OBJ_LIKE /* white space */ (1-1) /* other */
8293 #define FUNC_LIKE(a) ( a )
8294 #define FUNC_LIKE( a )( /* note the white space */ \
8295 a /* other stuff on this line
8296 */ )
8297 </pre>
8298 But the following redefinitions are invalid:
8299 <pre>
8300 #define OBJ_LIKE (0) // different token sequence
8301 #define OBJ_LIKE (1 - 1) // different white space
8302 #define FUNC_LIKE(b) ( a ) // different parameter usage
8303 #define FUNC_LIKE(b) ( b ) // different parameter spelling
8304 </pre>
8306 <p><!--para 9 -->
8307 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
8308 <!--page 170 -->
8309 <pre>
8310 #define debug(...) fprintf(stderr, __VA_ARGS__)
8311 #define showlist(...) puts(#__VA_ARGS__)
8312 #define report(test, ...) ((test)?puts(#test):\
8313 printf(__VA_ARGS__))
8314 debug("Flag");
8315 debug("X = %d\n", x);
8316 showlist(The first, second, and third items.);
8317 report(x&gt;y, "x is %d but y is %d", x, y);
8318 </pre>
8319 results in
8320 <pre>
8321 fprintf(stderr, "Flag" );
8322 fprintf(stderr, "X = %d\n", x );
8323 puts( "The first, second, and third items." );
8324 ((x&gt;y)?puts("x&gt;y"):
8325 printf("x is %d but y is %d", x, y));
8326 </pre>
8329 <h4><a name="6.10.4" href="#6.10.4">6.10.4 Line control</a></h4>
8330 <h6>Constraints</h6>
8331 <p><!--para 1 -->
8332 The string literal of a #line directive, if present, shall be a character string literal.
8333 <h6>Semantics</h6>
8334 <p><!--para 2 -->
8335 The line number of the current source line is one greater than the number of new-line
8336 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
8337 file to the current token.
8338 <p><!--para 3 -->
8339 A preprocessing directive of the form
8340 <pre>
8341 # line digit-sequence new-line
8342 </pre>
8343 causes the implementation to behave as if the following sequence of source lines begins
8344 with a source line that has a line number as specified by the digit sequence (interpreted as
8345 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
8346 2147483647.
8347 <p><!--para 4 -->
8348 A preprocessing directive of the form
8349 <pre>
8350 # line digit-sequence "s-char-sequence<sub>opt</sub>" new-line
8351 </pre>
8352 sets the presumed line number similarly and changes the presumed name of the source
8353 file to be the contents of the character string literal.
8354 <p><!--para 5 -->
8355 A preprocessing directive of the form
8356 <pre>
8357 # line pp-tokens new-line
8358 </pre>
8359 (that does not match one of the two previous forms) is permitted. The preprocessing
8360 tokens after line on the directive are processed just as in normal text (each identifier
8361 currently defined as a macro name is replaced by its replacement list of preprocessing
8362 tokens). The directive resulting after all replacements shall match one of the two
8363 previous forms and is then processed as appropriate.
8364 <!--page 171 -->
8366 <h4><a name="6.10.5" href="#6.10.5">6.10.5 Error directive</a></h4>
8367 <h6>Semantics</h6>
8368 <p><!--para 1 -->
8369 A preprocessing directive of the form
8370 <pre>
8371 # error pp-tokens<sub>opt</sub> new-line
8372 </pre>
8373 causes the implementation to produce a diagnostic message that includes the specified
8374 sequence of preprocessing tokens.
8376 <h4><a name="6.10.6" href="#6.10.6">6.10.6 Pragma directive</a></h4>
8377 <h6>Semantics</h6>
8378 <p><!--para 1 -->
8379 A preprocessing directive of the form
8380 <pre>
8381 # pragma pp-tokens<sub>opt</sub> new-line
8382 </pre>
8383 where the preprocessing token STDC does not immediately follow pragma in the
8384 directive (prior to any macro replacement)<sup><a href="#note152"><b>152)</b></a></sup> causes the implementation to behave in an
8385 implementation-defined manner. The behavior might cause translation to fail or cause the
8386 translator or the resulting program to behave in a non-conforming manner. Any such
8387 pragma that is not recognized by the implementation is ignored.
8388 <p><!--para 2 -->
8389 If the preprocessing token STDC does immediately follow pragma in the directive (prior
8390 to any macro replacement), then no macro replacement is performed on the directive, and
8391 the directive shall have one of the following forms<sup><a href="#note153"><b>153)</b></a></sup> whose meanings are described
8392 elsewhere:
8393 <pre>
8394 #pragma STDC FP_CONTRACT on-off-switch
8395 #pragma STDC FENV_ACCESS on-off-switch
8396 #pragma STDC CX_LIMITED_RANGE on-off-switch
8397 on-off-switch: one of
8398 ON OFF DEFAULT
8399 </pre>
8400 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
8401 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
8406 <!--page 172 -->
8408 <h6>footnotes</h6>
8409 <p><small><a name="note152" href="#note152">152)</a> An implementation is not required to perform macro replacement in pragmas, but it is permitted
8410 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
8411 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
8412 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
8413 but is not required to.
8414 </small>
8415 <p><small><a name="note153" href="#note153">153)</a> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
8416 </small>
8418 <h4><a name="6.10.7" href="#6.10.7">6.10.7 Null directive</a></h4>
8419 <h6>Semantics</h6>
8420 <p><!--para 1 -->
8421 A preprocessing directive of the form
8422 <pre>
8423 # new-line
8424 </pre>
8425 has no effect.
8427 <h4><a name="6.10.8" href="#6.10.8">6.10.8 Predefined macro names</a></h4>
8428 <p><!--para 1 -->
8429 The following macro names<sup><a href="#note154"><b>154)</b></a></sup> shall be defined by the implementation:
8430 <dl>
8431 <dt> __DATE__ <dd>The date of translation of the preprocessing translation unit: a character
8432 string literal of the form "Mmm dd yyyy", where the names of the
8433 months are the same as those generated by the asctime function, and the
8434 first character of dd is a space character if the value is less than 10. If the
8435 date of translation is not available, an implementation-defined valid date
8436 shall be supplied.
8437 <dt> __FILE__ <dd>The presumed name of the current source file (a character string literal).<sup><a href="#note155"><b>155)</b></a></sup>
8438 <dt> __LINE__ <dd>The presumed line number (within the current source file) of the current
8439 source line (an integer constant).<sup><a href="#note155"><b>155)</b></a></sup>
8440 <dt> __STDC__ <dd>The integer constant 1, intended to indicate a conforming implementation.
8441 <dt> __STDC_HOSTED__ <dd>The integer constant 1 if the implementation is a hosted
8442 implementation or the integer constant 0 if it is not.
8443 <dt> __STDC_MB_MIGHT_NEQ_WC__ <dd>The integer constant 1, intended to indicate that, in
8444 the encoding for wchar_t, a member of the basic character set need not
8445 have a code value equal to its value when used as the lone character in an
8446 integer character constant.
8447 <dt> __STDC_VERSION__ <dd>The integer constant 199901L.<sup><a href="#note156"><b>156)</b></a></sup>
8448 <dt> __TIME__ <dd>The time of translation of the preprocessing translation unit: a character
8449 string literal of the form "hh:mm:ss" as in the time generated by the
8450 asctime function. If the time of translation is not available, an
8451 implementation-defined valid time shall be supplied.
8452 </dl>
8455 <!--page 173 -->
8456 <p><!--para 2 -->
8457 The following macro names are conditionally defined by the implementation:
8458 <dl>
8459 <dt> __STDC_IEC_559__ <dd>The integer constant 1, intended to indicate conformance to the
8460 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
8461 <dt> __STDC_IEC_559_COMPLEX__ <dd>The integer constant 1, intended to indicate
8462 adherence to the specifications in informative <a href="#G">annex G</a> (IEC 60559
8463 compatible complex arithmetic).
8464 <dt> __STDC_ISO_10646__ <dd>An integer constant of the form yyyymmL (for example,
8465 199712L). If this symbol is defined, then every character in the Unicode
8466 required set, when stored in an object of type wchar_t, has the same
8467 value as the short identifier of that character. The Unicode required set
8468 consists of all the characters that are defined by ISO/IEC 10646, along with
8469 all amendments and technical corrigenda, as of the specified year and
8470 month.
8471 </dl>
8472 <p><!--para 3 -->
8473 The values of the predefined macros (except for __FILE__ and __LINE__) remain
8474 constant throughout the translation unit.
8475 <p><!--para 4 -->
8476 None of these macro names, nor the identifier defined, shall be the subject of a
8477 #define or a #undef preprocessing directive. Any other predefined macro names
8478 shall begin with a leading underscore followed by an uppercase letter or a second
8479 underscore.
8480 <p><!--para 5 -->
8481 The implementation shall not predefine the macro __cplusplus, nor shall it define it
8482 in any standard header.
8483 <p><b> Forward references</b>: 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>).
8485 <h6>footnotes</h6>
8486 <p><small><a name="note154" href="#note154">154)</a> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
8487 </small>
8488 <p><small><a name="note155" href="#note155">155)</a> The presumed source file name and line number can be changed by the #line directive.
8489 </small>
8490 <p><small><a name="note156" href="#note156">156)</a> This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
8491 ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
8492 int that is increased with each revision of this International Standard.
8493 </small>
8495 <h4><a name="6.10.9" href="#6.10.9">6.10.9 Pragma operator</a></h4>
8496 <h6>Semantics</h6>
8497 <p><!--para 1 -->
8498 A unary operator expression of the form:
8499 <pre>
8500 _Pragma ( string-literal )
8501 </pre>
8502 is processed as follows: The string literal is destringized by deleting the L prefix, if
8503 present, deleting the leading and trailing double-quotes, replacing each escape sequence
8504 \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The
8505 resulting sequence of characters is processed through translation phase 3 to produce
8506 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
8507 directive. The original four preprocessing tokens in the unary operator expression are
8508 removed.
8509 <p><!--para 2 -->
8510 EXAMPLE A directive of the form:
8511 <pre>
8512 #pragma listing on "..\listing.dir"
8513 </pre>
8514 can also be expressed as:
8515 <!--page 174 -->
8516 <pre>
8517 _Pragma ( "listing on \"..\\listing.dir\"" )
8518 </pre>
8519 The latter form is processed in the same way whether it appears literally as shown, or results from macro
8520 replacement, as in:
8521 <!--page 175 -->
8522 <pre>
8523 #define LISTING(x) PRAGMA(listing on #x)
8524 #define PRAGMA(x) _Pragma(#x)
8525 LISTING ( ..\listing.dir )
8526 </pre>
8528 <h3><a name="6.11" href="#6.11">6.11 Future language directions</a></h3>
8530 <h4><a name="6.11.1" href="#6.11.1">6.11.1 Floating types</a></h4>
8531 <p><!--para 1 -->
8532 Future standardization may include additional floating-point types, including those with
8533 greater range, precision, or both than long double.
8535 <h4><a name="6.11.2" href="#6.11.2">6.11.2 Linkages of identifiers</a></h4>
8536 <p><!--para 1 -->
8537 Declaring an identifier with internal linkage at file scope without the static storage-
8538 class specifier is an obsolescent feature.
8540 <h4><a name="6.11.3" href="#6.11.3">6.11.3 External names</a></h4>
8541 <p><!--para 1 -->
8542 Restriction of the significance of an external name to fewer than 255 characters
8543 (considering each universal character name or extended source character as a single
8544 character) is an obsolescent feature that is a concession to existing implementations.
8546 <h4><a name="6.11.4" href="#6.11.4">6.11.4 Character escape sequences</a></h4>
8547 <p><!--para 1 -->
8548 Lowercase letters as escape sequences are reserved for future standardization. Other
8549 characters may be used in extensions.
8551 <h4><a name="6.11.5" href="#6.11.5">6.11.5 Storage-class specifiers</a></h4>
8552 <p><!--para 1 -->
8553 The placement of a storage-class specifier other than at the beginning of the declaration
8554 specifiers in a declaration is an obsolescent feature.
8556 <h4><a name="6.11.6" href="#6.11.6">6.11.6 Function declarators</a></h4>
8557 <p><!--para 1 -->
8558 The use of function declarators with empty parentheses (not prototype-format parameter
8559 type declarators) is an obsolescent feature.
8561 <h4><a name="6.11.7" href="#6.11.7">6.11.7 Function definitions</a></h4>
8562 <p><!--para 1 -->
8563 The use of function definitions with separate parameter identifier and declaration lists
8564 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
8566 <h4><a name="6.11.8" href="#6.11.8">6.11.8 Pragma directives</a></h4>
8567 <p><!--para 1 -->
8568 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
8570 <h4><a name="6.11.9" href="#6.11.9">6.11.9 Predefined macro names</a></h4>
8571 <p><!--para 1 -->
8572 Macro names beginning with __STDC_ are reserved for future standardization.
8573 <!--page 176 -->
8575 <h2><a name="7" href="#7">7. Library</a></h2>
8578 <h3><a name="7.1" href="#7.1">7.1 Introduction</a></h3>
8580 <h4><a name="7.1.1" href="#7.1.1">7.1.1 Definitions of terms</a></h4>
8581 <p><!--para 1 -->
8582 A string is a contiguous sequence of characters terminated by and including the first null
8583 character. The term multibyte string is sometimes used instead to emphasize special
8584 processing given to multibyte characters contained in the string or to avoid confusion
8585 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
8586 character. The length of a string is the number of bytes preceding the null character and
8587 the value of a string is the sequence of the values of the contained characters, in order.
8588 <p><!--para 2 -->
8589 The decimal-point character is the character used by functions that convert floating-point
8590 numbers to or from character sequences to denote the beginning of the fractional part of
8591 such character sequences.<sup><a href="#note157"><b>157)</b></a></sup> It is represented in the text and examples by a period, but
8592 may be changed by the setlocale function.
8593 <p><!--para 3 -->
8594 A null wide character is a wide character with code value zero.
8595 <p><!--para 4 -->
8596 A wide string is a contiguous sequence of wide characters terminated by and including
8597 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
8598 addressed) wide character. The length of a wide string is the number of wide characters
8599 preceding the null wide character and the value of a wide string is the sequence of code
8600 values of the contained wide characters, in order.
8601 <p><!--para 5 -->
8602 A shift sequence is a contiguous sequence of bytes within a multibyte string that
8603 (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
8604 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
8605 character.<sup><a href="#note158"><b>158)</b></a></sup>
8606 <p><b> Forward references</b>: character handling (<a href="#7.4">7.4</a>), the setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
8611 <!--page 177 -->
8613 <h6>footnotes</h6>
8614 <p><small><a name="note157" href="#note157">157)</a> The functions that make use of the decimal-point character are the numeric conversion functions
8615 (<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>).
8616 </small>
8617 <p><small><a name="note158" href="#note158">158)</a> For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
8618 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
8619 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
8620 implementation's choice.
8621 </small>
8623 <h4><a name="7.1.2" href="#7.1.2">7.1.2 Standard headers</a></h4>
8624 <p><!--para 1 -->
8625 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note159"><b>159)</b></a></sup>
8626 whose contents are made available by the #include preprocessing directive. The
8627 header declares a set of related functions, plus any necessary types and additional macros
8628 needed to facilitate their use. Declarations of types described in this clause shall not
8629 include type qualifiers, unless explicitly stated otherwise.
8630 <p><!--para 2 -->
8631 The standard headers are
8632 <p><!--para 3 -->
8633 <pre>
8634 <a href="#7.2">&lt;assert.h&gt;</a> <a href="#7.8">&lt;inttypes.h&gt;</a> <a href="#7.14">&lt;signal.h&gt;</a> <a href="#7.20">&lt;stdlib.h&gt;</a>
8635 <a href="#7.3">&lt;complex.h&gt;</a> <a href="#7.9">&lt;iso646.h&gt;</a> <a href="#7.15">&lt;stdarg.h&gt;</a> <a href="#7.21">&lt;string.h&gt;</a>
8636 <a href="#7.4">&lt;ctype.h&gt;</a> <a href="#7.10">&lt;limits.h&gt;</a> <a href="#7.16">&lt;stdbool.h&gt;</a> <a href="#7.22">&lt;tgmath.h&gt;</a>
8637 <a href="#7.5">&lt;errno.h&gt;</a> <a href="#7.11">&lt;locale.h&gt;</a> <a href="#7.17">&lt;stddef.h&gt;</a> <a href="#7.23">&lt;time.h&gt;</a>
8638 <a href="#7.6">&lt;fenv.h&gt;</a> <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.18">&lt;stdint.h&gt;</a> <a href="#7.24">&lt;wchar.h&gt;</a>
8639 <a href="#7.7">&lt;float.h&gt;</a> <a href="#7.13">&lt;setjmp.h&gt;</a> <a href="#7.19">&lt;stdio.h&gt;</a> <a href="#7.25">&lt;wctype.h&gt;</a>
8640 </pre>
8641 If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
8642 provided as part of the implementation, is placed in any of the standard places that are
8643 searched for included source files, the behavior is undefined.
8644 <p><!--para 4 -->
8645 Standard headers may be included in any order; each may be included more than once in
8646 a given scope, with no effect different from being included only once, except that the
8647 effect of including <a href="#7.2">&lt;assert.h&gt;</a> depends on the definition of NDEBUG (see <a href="#7.2">7.2</a>). If
8648 used, a header shall be included outside of any external declaration or definition, and it
8649 shall first be included before the first reference to any of the functions or objects it
8650 declares, or to any of the types or macros it defines. However, if an identifier is declared
8651 or defined in more than one header, the second and subsequent associated headers may be
8652 included after the initial reference to the identifier. The program shall not have any
8653 macros with names lexically identical to keywords currently defined prior to the
8654 inclusion.
8655 <p><!--para 5 -->
8656 Any definition of an object-like macro described in this clause shall expand to code that is
8657 fully protected by parentheses where necessary, so that it groups in an arbitrary
8658 expression as if it were a single identifier.
8659 <p><!--para 6 -->
8660 Any declaration of a library function shall have external linkage.
8661 <p><!--para 7 -->
8662 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
8663 <p><b> Forward references</b>: diagnostics (<a href="#7.2">7.2</a>).
8668 <!--page 178 -->
8670 <h6>footnotes</h6>
8671 <p><small><a name="note159" href="#note159">159)</a> A header is not necessarily a source file, nor are the &lt; and &gt; delimited sequences in header names
8672 necessarily valid source file names.
8673 </small>
8675 <h4><a name="7.1.3" href="#7.1.3">7.1.3 Reserved identifiers</a></h4>
8676 <p><!--para 1 -->
8677 Each header declares or defines all identifiers listed in its associated subclause, and
8678 optionally declares or defines identifiers listed in its associated future library directions
8679 subclause and identifiers which are always reserved either for any use or for use as file
8680 scope identifiers.
8681 <ul>
8682 <li> All identifiers that begin with an underscore and either an uppercase letter or another
8683 underscore are always reserved for any use.
8684 <li> All identifiers that begin with an underscore are always reserved for use as identifiers
8685 with file scope in both the ordinary and tag name spaces.
8686 <li> Each macro name in any of the following subclauses (including the future library
8687 directions) is reserved for use as specified if any of its associated headers is included;
8688 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
8689 <li> All identifiers with external linkage in any of the following subclauses (including the
8690 future library directions) are always reserved for use as identifiers with external
8691 linkage.<sup><a href="#note160"><b>160)</b></a></sup>
8692 <li> Each identifier with file scope listed in any of the following subclauses (including the
8693 future library directions) is reserved for use as a macro name and as an identifier with
8694 file scope in the same name space if any of its associated headers is included.
8695 </ul>
8696 <p><!--para 2 -->
8697 No other identifiers are reserved. If the program declares or defines an identifier in a
8698 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
8699 identifier as a macro name, the behavior is undefined.
8700 <p><!--para 3 -->
8701 If the program removes (with #undef) any macro definition of an identifier in the first
8702 group listed above, the behavior is undefined.
8704 <h6>footnotes</h6>
8705 <p><small><a name="note160" href="#note160">160)</a> The list of reserved identifiers with external linkage includes errno, math_errhandling,
8706 setjmp, and va_end.
8707 </small>
8709 <h4><a name="7.1.4" href="#7.1.4">7.1.4 Use of library functions</a></h4>
8710 <p><!--para 1 -->
8711 Each of the following statements applies unless explicitly stated otherwise in the detailed
8712 descriptions that follow: If an argument to a function has an invalid value (such as a value
8713 outside the domain of the function, or a pointer outside the address space of the program,
8714 or a null pointer, or a pointer to non-modifiable storage when the corresponding
8715 parameter is not const-qualified) or a type (after promotion) not expected by a function
8716 with variable number of arguments, the behavior is undefined. If a function argument is
8717 described as being an array, the pointer actually passed to the function shall have a value
8718 such that all address computations and accesses to objects (that would be valid if the
8719 pointer did point to the first element of such an array) are in fact valid. Any function
8720 declared in a header may be additionally implemented as a function-like macro defined in
8722 <!--page 179 -->
8723 the header, so if a library function is declared explicitly when its header is included, one
8724 of the techniques shown below can be used to ensure the declaration is not affected by
8725 such a macro. Any macro definition of a function can be suppressed locally by enclosing
8726 the name of the function in parentheses, because the name is then not followed by the left
8727 parenthesis that indicates expansion of a macro function name. For the same syntactic
8728 reason, it is permitted to take the address of a library function even if it is also defined as
8729 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
8730 actual function is referred to. Any invocation of a library function that is implemented as
8731 a macro shall expand to code that evaluates each of its arguments exactly once, fully
8732 protected by parentheses where necessary, so it is generally safe to use arbitrary
8733 expressions as arguments.<sup><a href="#note162"><b>162)</b></a></sup> Likewise, those function-like macros described in the
8734 following subclauses may be invoked in an expression anywhere a function with a
8735 compatible return type could be called.<sup><a href="#note163"><b>163)</b></a></sup> All object-like macros listed as expanding to
8736 integer constant expressions shall additionally be suitable for use in #if preprocessing
8737 directives.
8738 <p><!--para 2 -->
8739 Provided that a library function can be declared without reference to any type defined in a
8740 header, it is also permissible to declare the function and use it without including its
8741 associated header.
8742 <p><!--para 3 -->
8743 There is a sequence point immediately before a library function returns.
8744 <p><!--para 4 -->
8745 The functions in the standard library are not guaranteed to be reentrant and may modify
8746 objects with static storage duration.<sup><a href="#note164"><b>164)</b></a></sup>
8750 <!--page 180 -->
8751 <p><!--para 5 -->
8752 EXAMPLE The function atoi may be used in any of several ways:
8753 <ul>
8754 <li> by use of its associated header (possibly generating a macro expansion)
8755 <pre>
8756 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
8757 const char *str;
8758 /* ... */
8759 i = atoi(str);
8760 </pre>
8761 <li> by use of its associated header (assuredly generating a true function reference)
8762 <pre>
8763 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
8764 #undef atoi
8765 const char *str;
8766 /* ... */
8767 i = atoi(str);
8768 </pre>
8770 <pre>
8771 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
8772 const char *str;
8773 /* ... */
8774 i = (atoi)(str);
8775 </pre>
8776 <li> by explicit declaration
8777 <!--page 181 -->
8778 <pre>
8779 extern int atoi(const char *);
8780 const char *str;
8781 /* ... */
8782 i = atoi(str);
8783 </pre>
8784 </ul>
8786 <h6>footnotes</h6>
8787 <p><small><a name="note161" href="#note161">161)</a> This means that an implementation shall provide an actual function for each library function, even if it
8788 also provides a macro for that function.
8789 </small>
8790 <p><small><a name="note162" href="#note162">162)</a> Such macros might not contain the sequence points that the corresponding function calls do.
8791 </small>
8792 <p><small><a name="note163" href="#note163">163)</a> Because external identifiers and some macro names beginning with an underscore are reserved,
8793 implementations may provide special semantics for such names. For example, the identifier
8794 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
8795 appropriate header could specify
8797 <pre>
8798 #define abs(x) _BUILTIN_abs(x)
8799 </pre>
8800 for a compiler whose code generator will accept it.
8801 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
8802 function may write
8804 <pre>
8805 #undef abs
8806 </pre>
8807 whether the implementation's header provides a macro implementation of abs or a built-in
8808 implementation. The prototype for the function, which precedes and is hidden by any macro
8809 definition, is thereby revealed also.
8810 </small>
8811 <p><small><a name="note164" href="#note164">164)</a> Thus, a signal handler cannot, in general, call standard library functions.
8812 </small>
8814 <h3><a name="7.2" href="#7.2">7.2 Diagnostics <assert.h></a></h3>
8815 <p><!--para 1 -->
8816 The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert macro and refers to another macro,
8817 <pre>
8818 NDEBUG
8819 </pre>
8820 which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
8821 point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
8822 simply as
8823 <pre>
8824 #define assert(ignore) ((void)0)
8825 </pre>
8826 The assert macro is redefined according to the current state of NDEBUG each time that
8827 <a href="#7.2">&lt;assert.h&gt;</a> is included.
8828 <p><!--para 2 -->
8829 The assert macro shall be implemented as a macro, not as an actual function. If the
8830 macro definition is suppressed in order to access an actual function, the behavior is
8831 undefined.
8833 <h4><a name="7.2.1" href="#7.2.1">7.2.1 Program diagnostics</a></h4>
8835 <h5><a name="7.2.1.1" href="#7.2.1.1">7.2.1.1 The assert macro</a></h5>
8836 <h6>Synopsis</h6>
8837 <p><!--para 1 -->
8838 <pre>
8839 #include <a href="#7.2">&lt;assert.h&gt;</a>
8840 void assert(scalar expression);
8841 </pre>
8842 <h6>Description</h6>
8843 <p><!--para 2 -->
8844 The assert macro puts diagnostic tests into programs; it expands to a void expression.
8845 When it is executed, if expression (which shall have a scalar type) is false (that is,
8846 compares equal to 0), the assert macro writes information about the particular call that
8847 failed (including the text of the argument, the name of the source file, the source line
8848 number, and the name of the enclosing function -- the latter are respectively the values of
8849 the preprocessing macros __FILE__ and __LINE__ and of the identifier
8850 __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note165"><b>165)</b></a></sup> It
8851 then calls the abort function.
8852 <h6>Returns</h6>
8853 <p><!--para 3 -->
8854 The assert macro returns no value.
8855 <p><b> Forward references</b>: the abort function (<a href="#7.20.4.1">7.20.4.1</a>).
8860 <!--page 182 -->
8862 <h6>footnotes</h6>
8863 <p><small><a name="note165" href="#note165">165)</a> The message written might be of the form:
8864 Assertion failed: expression, function abc, file xyz, line nnn.
8865 </small>
8867 <h3><a name="7.3" href="#7.3">7.3 Complex arithmetic <complex.h></a></h3>
8869 <h4><a name="7.3.1" href="#7.3.1">7.3.1 Introduction</a></h4>
8870 <p><!--para 1 -->
8871 The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
8872 arithmetic.<sup><a href="#note166"><b>166)</b></a></sup> Each synopsis specifies a family of functions consisting of a principal
8873 function with one or more double complex parameters and a double complex or
8874 double return value; and other functions with the same name but with f and l suffixes
8875 which are corresponding functions with float and long double parameters and
8876 return values.
8877 <p><!--para 2 -->
8878 The macro
8879 <pre>
8880 complex
8881 </pre>
8882 expands to _Complex; the macro
8883 <pre>
8884 _Complex_I
8885 </pre>
8886 expands to a constant expression of type const float _Complex, with the value of
8887 the imaginary unit.<sup><a href="#note167"><b>167)</b></a></sup>
8888 <p><!--para 3 -->
8889 The macros
8890 <pre>
8891 imaginary
8892 </pre>
8894 <pre>
8895 _Imaginary_I
8896 </pre>
8897 are defined if and only if the implementation supports imaginary types;<sup><a href="#note168"><b>168)</b></a></sup> if defined,
8898 they expand to _Imaginary and a constant expression of type const float
8899 _Imaginary with the value of the imaginary unit.
8900 <p><!--para 4 -->
8901 The macro
8902 <pre>
8904 </pre>
8905 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
8906 defined, I shall expand to _Complex_I.
8907 <p><!--para 5 -->
8908 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
8909 redefine the macros complex, imaginary, and I.
8910 <p><b> Forward references</b>: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
8914 <!--page 183 -->
8916 <h6>footnotes</h6>
8917 <p><small><a name="note166" href="#note166">166)</a> See ''future library directions'' (<a href="#7.26.1">7.26.1</a>).
8918 </small>
8919 <p><small><a name="note167" href="#note167">167)</a> The imaginary unit is a number i such that i<sup>2</sup> = -1.
8920 </small>
8921 <p><small><a name="note168" href="#note168">168)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
8922 </small>
8924 <h4><a name="7.3.2" href="#7.3.2">7.3.2 Conventions</a></h4>
8925 <p><!--para 1 -->
8926 Values are interpreted as radians, not degrees. An implementation may set errno but is
8927 not required to.
8929 <h4><a name="7.3.3" href="#7.3.3">7.3.3 Branch cuts</a></h4>
8930 <p><!--para 1 -->
8931 Some of the functions below have branch cuts, across which the function is
8932 discontinuous. For implementations with a signed zero (including all IEC 60559
8933 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
8934 one side of a cut from another so the function is continuous (except for format
8935 limitations) as the cut is approached from either side. For example, for the square root
8936 function, which has a branch cut along the negative real axis, the top of the cut, with
8937 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
8938 imaginary part -0, maps to the negative imaginary axis.
8939 <p><!--para 2 -->
8940 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
8941 sides of branch cuts. These implementations shall map a cut so the function is continuous
8942 as the cut is approached coming around the finite endpoint of the cut in a counter
8943 clockwise direction. (Branch cuts for the functions specified here have just one finite
8944 endpoint.) For example, for the square root function, coming counter clockwise around
8945 the finite endpoint of the cut along the negative real axis approaches the cut from above,
8946 so the cut maps to the positive imaginary axis.
8948 <h4><a name="7.3.4" href="#7.3.4">7.3.4 The CX_LIMITED_RANGE pragma</a></h4>
8949 <h6>Synopsis</h6>
8950 <p><!--para 1 -->
8951 <pre>
8952 #include <a href="#7.3">&lt;complex.h&gt;</a>
8953 #pragma STDC CX_LIMITED_RANGE on-off-switch
8954 </pre>
8955 <h6>Description</h6>
8956 <p><!--para 2 -->
8957 The usual mathematical formulas for complex multiply, divide, and absolute value are
8958 problematic because of their treatment of infinities and because of undue overflow and
8959 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
8960 implementation that (where the state is ''on'') the usual mathematical formulas are
8961 acceptable.<sup><a href="#note169"><b>169)</b></a></sup> The pragma can occur either outside external declarations or preceding all
8962 explicit declarations and statements inside a compound statement. When outside external
8964 <!--page 184 -->
8965 declarations, the pragma takes effect from its occurrence until another
8966 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
8967 When inside a compound statement, the pragma takes effect from its occurrence until
8968 another CX_LIMITED_RANGE pragma is encountered (including within a nested
8969 compound statement), or until the end of the compound statement; at the end of a
8970 compound statement the state for the pragma is restored to its condition just before the
8971 compound statement. If this pragma is used in any other context, the behavior is
8972 undefined. The default state for the pragma is ''off''.
8974 <h6>footnotes</h6>
8975 <p><small><a name="note169" href="#note169">169)</a> The purpose of the pragma is to allow the implementation to use the formulas:
8977 <pre>
8978 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
8979 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u<sup>2</sup> + v<sup>2</sup>)
8980 | x + iy | = (sqrt)(x<sup>2</sup> + y<sup>2</sup>)
8981 </pre>
8982 where the programmer can determine they are safe.
8983 </small>
8985 <h4><a name="7.3.5" href="#7.3.5">7.3.5 Trigonometric functions</a></h4>
8987 <h5><a name="7.3.5.1" href="#7.3.5.1">7.3.5.1 The cacos functions</a></h5>
8988 <h6>Synopsis</h6>
8989 <p><!--para 1 -->
8990 <pre>
8991 #include <a href="#7.3">&lt;complex.h&gt;</a>
8992 double complex cacos(double complex z);
8993 float complex cacosf(float complex z);
8994 long double complex cacosl(long double complex z);
8995 </pre>
8996 <h6>Description</h6>
8997 <p><!--para 2 -->
8998 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
8999 interval [-1, +1] along the real axis.
9000 <h6>Returns</h6>
9001 <p><!--para 3 -->
9002 The cacos functions return the complex arc cosine value, in the range of a strip
9003 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
9004 real axis.
9006 <h5><a name="7.3.5.2" href="#7.3.5.2">7.3.5.2 The casin functions</a></h5>
9007 <h6>Synopsis</h6>
9008 <p><!--para 1 -->
9009 <pre>
9010 #include <a href="#7.3">&lt;complex.h&gt;</a>
9011 double complex casin(double complex z);
9012 float complex casinf(float complex z);
9013 long double complex casinl(long double complex z);
9014 </pre>
9015 <h6>Description</h6>
9016 <p><!--para 2 -->
9017 The casin functions compute the complex arc sine of z, with branch cuts outside the
9018 interval [-1, +1] along the real axis.
9019 <h6>Returns</h6>
9020 <p><!--para 3 -->
9021 The casin functions return the complex arc sine value, in the range of a strip
9022 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
9023 along the real axis.
9024 <!--page 185 -->
9026 <h5><a name="7.3.5.3" href="#7.3.5.3">7.3.5.3 The catan functions</a></h5>
9027 <h6>Synopsis</h6>
9028 <p><!--para 1 -->
9029 <pre>
9030 #include <a href="#7.3">&lt;complex.h&gt;</a>
9031 double complex catan(double complex z);
9032 float complex catanf(float complex z);
9033 long double complex catanl(long double complex z);
9034 </pre>
9035 <h6>Description</h6>
9036 <p><!--para 2 -->
9037 The catan functions compute the complex arc tangent of z, with branch cuts outside the
9038 interval [-i, +i] along the imaginary axis.
9039 <h6>Returns</h6>
9040 <p><!--para 3 -->
9041 The catan functions return the complex arc tangent value, in the range of a strip
9042 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
9043 along the real axis.
9045 <h5><a name="7.3.5.4" href="#7.3.5.4">7.3.5.4 The ccos functions</a></h5>
9046 <h6>Synopsis</h6>
9047 <p><!--para 1 -->
9048 <pre>
9049 #include <a href="#7.3">&lt;complex.h&gt;</a>
9050 double complex ccos(double complex z);
9051 float complex ccosf(float complex z);
9052 long double complex ccosl(long double complex z);
9053 </pre>
9054 <h6>Description</h6>
9055 <p><!--para 2 -->
9056 The ccos functions compute the complex cosine of z.
9057 <h6>Returns</h6>
9058 <p><!--para 3 -->
9059 The ccos functions return the complex cosine value.
9061 <h5><a name="7.3.5.5" href="#7.3.5.5">7.3.5.5 The csin functions</a></h5>
9062 <h6>Synopsis</h6>
9063 <p><!--para 1 -->
9064 <pre>
9065 #include <a href="#7.3">&lt;complex.h&gt;</a>
9066 double complex csin(double complex z);
9067 float complex csinf(float complex z);
9068 long double complex csinl(long double complex z);
9069 </pre>
9070 <h6>Description</h6>
9071 <p><!--para 2 -->
9072 The csin functions compute the complex sine of z.
9073 <h6>Returns</h6>
9074 <p><!--para 3 -->
9075 The csin functions return the complex sine value.
9076 <!--page 186 -->
9078 <h5><a name="7.3.5.6" href="#7.3.5.6">7.3.5.6 The ctan functions</a></h5>
9079 <h6>Synopsis</h6>
9080 <p><!--para 1 -->
9081 <pre>
9082 #include <a href="#7.3">&lt;complex.h&gt;</a>
9083 double complex ctan(double complex z);
9084 float complex ctanf(float complex z);
9085 long double complex ctanl(long double complex z);
9086 </pre>
9087 <h6>Description</h6>
9088 <p><!--para 2 -->
9089 The ctan functions compute the complex tangent of z.
9090 <h6>Returns</h6>
9091 <p><!--para 3 -->
9092 The ctan functions return the complex tangent value.
9094 <h4><a name="7.3.6" href="#7.3.6">7.3.6 Hyperbolic functions</a></h4>
9096 <h5><a name="7.3.6.1" href="#7.3.6.1">7.3.6.1 The cacosh functions</a></h5>
9097 <h6>Synopsis</h6>
9098 <p><!--para 1 -->
9099 <pre>
9100 #include <a href="#7.3">&lt;complex.h&gt;</a>
9101 double complex cacosh(double complex z);
9102 float complex cacoshf(float complex z);
9103 long double complex cacoshl(long double complex z);
9104 </pre>
9105 <h6>Description</h6>
9106 <p><!--para 2 -->
9107 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
9108 cut at values less than 1 along the real axis.
9109 <h6>Returns</h6>
9110 <p><!--para 3 -->
9111 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
9112 half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along
9113 the imaginary axis.
9115 <h5><a name="7.3.6.2" href="#7.3.6.2">7.3.6.2 The casinh functions</a></h5>
9116 <h6>Synopsis</h6>
9117 <p><!--para 1 -->
9118 <pre>
9119 #include <a href="#7.3">&lt;complex.h&gt;</a>
9120 double complex casinh(double complex z);
9121 float complex casinhf(float complex z);
9122 long double complex casinhl(long double complex z);
9123 </pre>
9124 <h6>Description</h6>
9125 <p><!--para 2 -->
9126 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
9127 outside the interval [-i, +i] along the imaginary axis.
9128 <!--page 187 -->
9129 <h6>Returns</h6>
9130 <p><!--para 3 -->
9131 The casinh functions return the complex arc hyperbolic sine value, in the range of a
9132 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
9133 along the imaginary axis.
9135 <h5><a name="7.3.6.3" href="#7.3.6.3">7.3.6.3 The catanh functions</a></h5>
9136 <h6>Synopsis</h6>
9137 <p><!--para 1 -->
9138 <pre>
9139 #include <a href="#7.3">&lt;complex.h&gt;</a>
9140 double complex catanh(double complex z);
9141 float complex catanhf(float complex z);
9142 long double complex catanhl(long double complex z);
9143 </pre>
9144 <h6>Description</h6>
9145 <p><!--para 2 -->
9146 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
9147 cuts outside the interval [-1, +1] along the real axis.
9148 <h6>Returns</h6>
9149 <p><!--para 3 -->
9150 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
9151 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
9152 along the imaginary axis.
9154 <h5><a name="7.3.6.4" href="#7.3.6.4">7.3.6.4 The ccosh functions</a></h5>
9155 <h6>Synopsis</h6>
9156 <p><!--para 1 -->
9157 <pre>
9158 #include <a href="#7.3">&lt;complex.h&gt;</a>
9159 double complex ccosh(double complex z);
9160 float complex ccoshf(float complex z);
9161 long double complex ccoshl(long double complex z);
9162 </pre>
9163 <h6>Description</h6>
9164 <p><!--para 2 -->
9165 The ccosh functions compute the complex hyperbolic cosine of z.
9166 <h6>Returns</h6>
9167 <p><!--para 3 -->
9168 The ccosh functions return the complex hyperbolic cosine value.
9170 <h5><a name="7.3.6.5" href="#7.3.6.5">7.3.6.5 The csinh functions</a></h5>
9171 <h6>Synopsis</h6>
9172 <p><!--para 1 -->
9173 <!--page 188 -->
9174 <pre>
9175 #include <a href="#7.3">&lt;complex.h&gt;</a>
9176 double complex csinh(double complex z);
9177 float complex csinhf(float complex z);
9178 long double complex csinhl(long double complex z);
9179 </pre>
9180 <h6>Description</h6>
9181 <p><!--para 2 -->
9182 The csinh functions compute the complex hyperbolic sine of z.
9183 <h6>Returns</h6>
9184 <p><!--para 3 -->
9185 The csinh functions return the complex hyperbolic sine value.
9187 <h5><a name="7.3.6.6" href="#7.3.6.6">7.3.6.6 The ctanh functions</a></h5>
9188 <h6>Synopsis</h6>
9189 <p><!--para 1 -->
9190 <pre>
9191 #include <a href="#7.3">&lt;complex.h&gt;</a>
9192 double complex ctanh(double complex z);
9193 float complex ctanhf(float complex z);
9194 long double complex ctanhl(long double complex z);
9195 </pre>
9196 <h6>Description</h6>
9197 <p><!--para 2 -->
9198 The ctanh functions compute the complex hyperbolic tangent of z.
9199 <h6>Returns</h6>
9200 <p><!--para 3 -->
9201 The ctanh functions return the complex hyperbolic tangent value.
9203 <h4><a name="7.3.7" href="#7.3.7">7.3.7 Exponential and logarithmic functions</a></h4>
9205 <h5><a name="7.3.7.1" href="#7.3.7.1">7.3.7.1 The cexp functions</a></h5>
9206 <h6>Synopsis</h6>
9207 <p><!--para 1 -->
9208 <pre>
9209 #include <a href="#7.3">&lt;complex.h&gt;</a>
9210 double complex cexp(double complex z);
9211 float complex cexpf(float complex z);
9212 long double complex cexpl(long double complex z);
9213 </pre>
9214 <h6>Description</h6>
9215 <p><!--para 2 -->
9216 The cexp functions compute the complex base-e exponential of z.
9217 <h6>Returns</h6>
9218 <p><!--para 3 -->
9219 The cexp functions return the complex base-e exponential value.
9221 <h5><a name="7.3.7.2" href="#7.3.7.2">7.3.7.2 The clog functions</a></h5>
9222 <h6>Synopsis</h6>
9223 <p><!--para 1 -->
9224 <!--page 189 -->
9225 <pre>
9226 #include <a href="#7.3">&lt;complex.h&gt;</a>
9227 double complex clog(double complex z);
9228 float complex clogf(float complex z);
9229 long double complex clogl(long double complex z);
9230 </pre>
9231 <h6>Description</h6>
9232 <p><!--para 2 -->
9233 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
9234 cut along the negative real axis.
9235 <h6>Returns</h6>
9236 <p><!--para 3 -->
9237 The clog functions return the complex natural logarithm value, in the range of a strip
9238 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
9239 imaginary axis.
9241 <h4><a name="7.3.8" href="#7.3.8">7.3.8 Power and absolute-value functions</a></h4>
9243 <h5><a name="7.3.8.1" href="#7.3.8.1">7.3.8.1 The cabs functions</a></h5>
9244 <h6>Synopsis</h6>
9245 <p><!--para 1 -->
9246 <pre>
9247 #include <a href="#7.3">&lt;complex.h&gt;</a>
9248 double cabs(double complex z);
9249 float cabsf(float complex z);
9250 long double cabsl(long double complex z);
9251 </pre>
9252 <h6>Description</h6>
9253 <p><!--para 2 -->
9254 The cabs functions compute the complex absolute value (also called norm, modulus, or
9255 magnitude) of z.
9256 <h6>Returns</h6>
9257 <p><!--para 3 -->
9258 The cabs functions return the complex absolute value.
9260 <h5><a name="7.3.8.2" href="#7.3.8.2">7.3.8.2 The cpow functions</a></h5>
9261 <h6>Synopsis</h6>
9262 <p><!--para 1 -->
9263 <pre>
9264 #include <a href="#7.3">&lt;complex.h&gt;</a>
9265 double complex cpow(double complex x, double complex y);
9266 float complex cpowf(float complex x, float complex y);
9267 long double complex cpowl(long double complex x,
9268 long double complex y);
9269 </pre>
9270 <h6>Description</h6>
9271 <p><!--para 2 -->
9272 The cpow functions compute the complex power function xy , with a branch cut for the
9273 first parameter along the negative real axis.
9274 <h6>Returns</h6>
9275 <p><!--para 3 -->
9276 The cpow functions return the complex power function value.
9277 <!--page 190 -->
9279 <h5><a name="7.3.8.3" href="#7.3.8.3">7.3.8.3 The csqrt functions</a></h5>
9280 <h6>Synopsis</h6>
9281 <p><!--para 1 -->
9282 <pre>
9283 #include <a href="#7.3">&lt;complex.h&gt;</a>
9284 double complex csqrt(double complex z);
9285 float complex csqrtf(float complex z);
9286 long double complex csqrtl(long double complex z);
9287 </pre>
9288 <h6>Description</h6>
9289 <p><!--para 2 -->
9290 The csqrt functions compute the complex square root of z, with a branch cut along the
9291 negative real axis.
9292 <h6>Returns</h6>
9293 <p><!--para 3 -->
9294 The csqrt functions return the complex square root value, in the range of the right half-
9295 plane (including the imaginary axis).
9297 <h4><a name="7.3.9" href="#7.3.9">7.3.9 Manipulation functions</a></h4>
9299 <h5><a name="7.3.9.1" href="#7.3.9.1">7.3.9.1 The carg functions</a></h5>
9300 <h6>Synopsis</h6>
9301 <p><!--para 1 -->
9302 <pre>
9303 #include <a href="#7.3">&lt;complex.h&gt;</a>
9304 double carg(double complex z);
9305 float cargf(float complex z);
9306 long double cargl(long double complex z);
9307 </pre>
9308 <h6>Description</h6>
9309 <p><!--para 2 -->
9310 The carg functions compute the argument (also called phase angle) of z, with a branch
9311 cut along the negative real axis.
9312 <h6>Returns</h6>
9313 <p><!--para 3 -->
9314 The carg functions return the value of the argument in the interval [-pi , +pi ].
9316 <h5><a name="7.3.9.2" href="#7.3.9.2">7.3.9.2 The cimag functions</a></h5>
9317 <h6>Synopsis</h6>
9318 <p><!--para 1 -->
9319 <!--page 191 -->
9320 <pre>
9321 #include <a href="#7.3">&lt;complex.h&gt;</a>
9322 double cimag(double complex z);
9323 float cimagf(float complex z);
9324 long double cimagl(long double complex z);
9325 </pre>
9326 <h6>Description</h6>
9327 <p><!--para 2 -->
9328 The cimag functions compute the imaginary part of z.<sup><a href="#note170"><b>170)</b></a></sup>
9329 <h6>Returns</h6>
9330 <p><!--para 3 -->
9331 The cimag functions return the imaginary part value (as a real).
9333 <h6>footnotes</h6>
9334 <p><small><a name="note170" href="#note170">170)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
9335 </small>
9337 <h5><a name="7.3.9.3" href="#7.3.9.3">7.3.9.3 The conj functions</a></h5>
9338 <h6>Synopsis</h6>
9339 <p><!--para 1 -->
9340 <pre>
9341 #include <a href="#7.3">&lt;complex.h&gt;</a>
9342 double complex conj(double complex z);
9343 float complex conjf(float complex z);
9344 long double complex conjl(long double complex z);
9345 </pre>
9346 <h6>Description</h6>
9347 <p><!--para 2 -->
9348 The conj functions compute the complex conjugate of z, by reversing the sign of its
9349 imaginary part.
9350 <h6>Returns</h6>
9351 <p><!--para 3 -->
9352 The conj functions return the complex conjugate value.
9354 <h5><a name="7.3.9.4" href="#7.3.9.4">7.3.9.4 The cproj functions</a></h5>
9355 <h6>Synopsis</h6>
9356 <p><!--para 1 -->
9357 <pre>
9358 #include <a href="#7.3">&lt;complex.h&gt;</a>
9359 double complex cproj(double complex z);
9360 float complex cprojf(float complex z);
9361 long double complex cprojl(long double complex z);
9362 </pre>
9363 <h6>Description</h6>
9364 <p><!--para 2 -->
9365 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
9366 z except that all complex infinities (even those with one infinite part and one NaN part)
9367 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
9368 equivalent to
9369 <pre>
9370 INFINITY + I * copysign(0.0, cimag(z))
9371 </pre>
9372 <h6>Returns</h6>
9373 <p><!--para 3 -->
9374 The cproj functions return the value of the projection onto the Riemann sphere.
9379 <!--page 192 -->
9381 <h5><a name="7.3.9.5" href="#7.3.9.5">7.3.9.5 The creal functions</a></h5>
9382 <h6>Synopsis</h6>
9383 <p><!--para 1 -->
9384 <pre>
9385 #include <a href="#7.3">&lt;complex.h&gt;</a>
9386 double creal(double complex z);
9387 float crealf(float complex z);
9388 long double creall(long double complex z);
9389 </pre>
9390 <h6>Description</h6>
9391 <p><!--para 2 -->
9392 The creal functions compute the real part of z.<sup><a href="#note171"><b>171)</b></a></sup>
9393 <h6>Returns</h6>
9394 <p><!--para 3 -->
9395 The creal functions return the real part value.
9400 <!--page 193 -->
9402 <h6>footnotes</h6>
9403 <p><small><a name="note171" href="#note171">171)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
9404 </small>
9406 <h3><a name="7.4" href="#7.4">7.4 Character handling <ctype.h></a></h3>
9407 <p><!--para 1 -->
9408 The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
9409 characters.<sup><a href="#note172"><b>172)</b></a></sup> In all cases the argument is an int, the value of which shall be
9410 representable as an unsigned char or shall equal the value of the macro EOF. If the
9411 argument has any other value, the behavior is undefined.
9412 <p><!--para 2 -->
9413 The behavior of these functions is affected by the current locale. Those functions that
9414 have locale-specific aspects only when not in the "C" locale are noted below.
9415 <p><!--para 3 -->
9416 The term printing character refers to a member of a locale-specific set of characters, each
9417 of which occupies one printing position on a display device; the term control character
9418 refers to a member of a locale-specific set of characters that are not printing
9419 characters.<sup><a href="#note173"><b>173)</b></a></sup> All letters and digits are printing characters.
9420 <p><b> Forward references</b>: EOF (<a href="#7.19.1">7.19.1</a>), localization (<a href="#7.11">7.11</a>).
9422 <h6>footnotes</h6>
9423 <p><small><a name="note172" href="#note172">172)</a> See ''future library directions'' (<a href="#7.26.2">7.26.2</a>).
9424 </small>
9425 <p><small><a name="note173" href="#note173">173)</a> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
9426 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
9427 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
9428 </small>
9430 <h4><a name="7.4.1" href="#7.4.1">7.4.1 Character classification functions</a></h4>
9431 <p><!--para 1 -->
9432 The functions in this subclause return nonzero (true) if and only if the value of the
9433 argument c conforms to that in the description of the function.
9435 <h5><a name="7.4.1.1" href="#7.4.1.1">7.4.1.1 The isalnum function</a></h5>
9436 <h6>Synopsis</h6>
9437 <p><!--para 1 -->
9438 <pre>
9439 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9440 int isalnum(int c);
9441 </pre>
9442 <h6>Description</h6>
9443 <p><!--para 2 -->
9444 The isalnum function tests for any character for which isalpha or isdigit is true.
9446 <h5><a name="7.4.1.2" href="#7.4.1.2">7.4.1.2 The isalpha function</a></h5>
9447 <h6>Synopsis</h6>
9448 <p><!--para 1 -->
9449 <pre>
9450 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9451 int isalpha(int c);
9452 </pre>
9453 <h6>Description</h6>
9454 <p><!--para 2 -->
9455 The isalpha function tests for any character for which isupper or islower is true,
9456 or any character that is one of a locale-specific set of alphabetic characters for which
9460 <!--page 194 -->
9461 none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note174"><b>174)</b></a></sup> In the "C" locale,
9462 isalpha returns true only for the characters for which isupper or islower is true.
9464 <h6>footnotes</h6>
9465 <p><small><a name="note174" href="#note174">174)</a> The functions islower and isupper test true or false separately for each of these additional
9466 characters; all four combinations are possible.
9467 </small>
9469 <h5><a name="7.4.1.3" href="#7.4.1.3">7.4.1.3 The isblank function</a></h5>
9470 <h6>Synopsis</h6>
9471 <p><!--para 1 -->
9472 <pre>
9473 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9474 int isblank(int c);
9475 </pre>
9476 <h6>Description</h6>
9477 <p><!--para 2 -->
9478 The isblank function tests for any character that is a standard blank character or is one
9479 of a locale-specific set of characters for which isspace is true and that is used to
9480 separate words within a line of text. The standard blank characters are the following:
9481 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
9482 for the standard blank characters.
9484 <h5><a name="7.4.1.4" href="#7.4.1.4">7.4.1.4 The iscntrl function</a></h5>
9485 <h6>Synopsis</h6>
9486 <p><!--para 1 -->
9487 <pre>
9488 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9489 int iscntrl(int c);
9490 </pre>
9491 <h6>Description</h6>
9492 <p><!--para 2 -->
9493 The iscntrl function tests for any control character.
9495 <h5><a name="7.4.1.5" href="#7.4.1.5">7.4.1.5 The isdigit function</a></h5>
9496 <h6>Synopsis</h6>
9497 <p><!--para 1 -->
9498 <pre>
9499 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9500 int isdigit(int c);
9501 </pre>
9502 <h6>Description</h6>
9503 <p><!--para 2 -->
9504 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
9506 <h5><a name="7.4.1.6" href="#7.4.1.6">7.4.1.6 The isgraph function</a></h5>
9507 <h6>Synopsis</h6>
9508 <p><!--para 1 -->
9509 <pre>
9510 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9511 int isgraph(int c);
9512 </pre>
9517 <!--page 195 -->
9518 <h6>Description</h6>
9519 <p><!--para 2 -->
9520 The isgraph function tests for any printing character except space (' ').
9522 <h5><a name="7.4.1.7" href="#7.4.1.7">7.4.1.7 The islower function</a></h5>
9523 <h6>Synopsis</h6>
9524 <p><!--para 1 -->
9525 <pre>
9526 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9527 int islower(int c);
9528 </pre>
9529 <h6>Description</h6>
9530 <p><!--para 2 -->
9531 The islower function tests for any character that is a lowercase letter or is one of a
9532 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
9533 isspace is true. In the "C" locale, islower returns true only for the lowercase
9534 letters (as defined in <a href="#5.2.1">5.2.1</a>).
9536 <h5><a name="7.4.1.8" href="#7.4.1.8">7.4.1.8 The isprint function</a></h5>
9537 <h6>Synopsis</h6>
9538 <p><!--para 1 -->
9539 <pre>
9540 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9541 int isprint(int c);
9542 </pre>
9543 <h6>Description</h6>
9544 <p><!--para 2 -->
9545 The isprint function tests for any printing character including space (' ').
9547 <h5><a name="7.4.1.9" href="#7.4.1.9">7.4.1.9 The ispunct function</a></h5>
9548 <h6>Synopsis</h6>
9549 <p><!--para 1 -->
9550 <pre>
9551 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9552 int ispunct(int c);
9553 </pre>
9554 <h6>Description</h6>
9555 <p><!--para 2 -->
9556 The ispunct function tests for any printing character that is one of a locale-specific set
9557 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
9558 locale, ispunct returns true for every printing character for which neither isspace
9559 nor isalnum is true.
9561 <h5><a name="7.4.1.10" href="#7.4.1.10">7.4.1.10 The isspace function</a></h5>
9562 <h6>Synopsis</h6>
9563 <p><!--para 1 -->
9564 <pre>
9565 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9566 int isspace(int c);
9567 </pre>
9568 <h6>Description</h6>
9569 <p><!--para 2 -->
9570 The isspace function tests for any character that is a standard white-space character or
9571 is one of a locale-specific set of characters for which isalnum is false. The standard
9572 <!--page 196 -->
9573 white-space characters are the following: space (' '), form feed ('\f'), new-line
9574 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
9575 "C" locale, isspace returns true only for the standard white-space characters.
9577 <h5><a name="7.4.1.11" href="#7.4.1.11">7.4.1.11 The isupper function</a></h5>
9578 <h6>Synopsis</h6>
9579 <p><!--para 1 -->
9580 <pre>
9581 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9582 int isupper(int c);
9583 </pre>
9584 <h6>Description</h6>
9585 <p><!--para 2 -->
9586 The isupper function tests for any character that is an uppercase letter or is one of a
9587 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
9588 isspace is true. In the "C" locale, isupper returns true only for the uppercase
9589 letters (as defined in <a href="#5.2.1">5.2.1</a>).
9591 <h5><a name="7.4.1.12" href="#7.4.1.12">7.4.1.12 The isxdigit function</a></h5>
9592 <h6>Synopsis</h6>
9593 <p><!--para 1 -->
9594 <pre>
9595 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9596 int isxdigit(int c);
9597 </pre>
9598 <h6>Description</h6>
9599 <p><!--para 2 -->
9600 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
9602 <h4><a name="7.4.2" href="#7.4.2">7.4.2 Character case mapping functions</a></h4>
9604 <h5><a name="7.4.2.1" href="#7.4.2.1">7.4.2.1 The tolower function</a></h5>
9605 <h6>Synopsis</h6>
9606 <p><!--para 1 -->
9607 <pre>
9608 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9609 int tolower(int c);
9610 </pre>
9611 <h6>Description</h6>
9612 <p><!--para 2 -->
9613 The tolower function converts an uppercase letter to a corresponding lowercase letter.
9614 <h6>Returns</h6>
9615 <p><!--para 3 -->
9616 If the argument is a character for which isupper is true and there are one or more
9617 corresponding characters, as specified by the current locale, for which islower is true,
9618 the tolower function returns one of the corresponding characters (always the same one
9619 for any given locale); otherwise, the argument is returned unchanged.
9620 <!--page 197 -->
9622 <h5><a name="7.4.2.2" href="#7.4.2.2">7.4.2.2 The toupper function</a></h5>
9623 <h6>Synopsis</h6>
9624 <p><!--para 1 -->
9625 <pre>
9626 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9627 int toupper(int c);
9628 </pre>
9629 <h6>Description</h6>
9630 <p><!--para 2 -->
9631 The toupper function converts a lowercase letter to a corresponding uppercase letter.
9632 <h6>Returns</h6>
9633 <p><!--para 3 -->
9634 If the argument is a character for which islower is true and there are one or more
9635 corresponding characters, as specified by the current locale, for which isupper is true,
9636 the toupper function returns one of the corresponding characters (always the same one
9637 for any given locale); otherwise, the argument is returned unchanged.
9638 <!--page 198 -->
9640 <h3><a name="7.5" href="#7.5">7.5 Errors <errno.h></a></h3>
9641 <p><!--para 1 -->
9642 The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
9643 conditions.
9644 <p><!--para 2 -->
9645 The macros are
9646 <pre>
9647 EDOM
9648 EILSEQ
9649 ERANGE
9650 </pre>
9651 which expand to integer constant expressions with type int, distinct positive values, and
9652 which are suitable for use in #if preprocessing directives; and
9653 <pre>
9654 errno
9655 </pre>
9656 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
9657 positive error number by several library functions. It is unspecified whether errno is a
9658 macro or an identifier declared with external linkage. If a macro definition is suppressed
9659 in order to access an actual object, or a program defines an identifier with the name
9660 errno, the behavior is undefined.
9661 <p><!--para 3 -->
9662 The value of errno is zero at program startup, but is never set to zero by any library
9663 function.<sup><a href="#note176"><b>176)</b></a></sup> The value of errno may be set to nonzero by a library function call
9664 whether or not there is an error, provided the use of errno is not documented in the
9665 description of the function in this International Standard.
9666 <p><!--para 4 -->
9667 Additional macro definitions, beginning with E and a digit or E and an uppercase
9668 letter,<sup><a href="#note177"><b>177)</b></a></sup> may also be specified by the implementation.
9673 <!--page 199 -->
9675 <h6>footnotes</h6>
9676 <p><small><a name="note175" href="#note175">175)</a> The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
9677 resulting from a function call (for example, *errno()).
9678 </small>
9679 <p><small><a name="note176" href="#note176">176)</a> Thus, a program that uses errno for error checking should set it to zero before a library function call,
9680 then inspect it before a subsequent library function call. Of course, a library function can save the
9681 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
9682 value is still zero just before the return.
9683 </small>
9684 <p><small><a name="note177" href="#note177">177)</a> See ''future library directions'' (<a href="#7.26.3">7.26.3</a>).
9685 </small>
9687 <h3><a name="7.6" href="#7.6">7.6 Floating-point environment <fenv.h></a></h3>
9688 <p><!--para 1 -->
9689 The header <a href="#7.6">&lt;fenv.h&gt;</a> declares two types and several macros and functions to provide
9690 access to the floating-point environment. The floating-point environment refers
9691 collectively to any floating-point status flags and control modes supported by the
9692 implementation.<sup><a href="#note178"><b>178)</b></a></sup> A floating-point status flag is a system variable whose value is set
9693 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
9694 of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note179"><b>179)</b></a></sup> A floating-
9695 point control mode is a system variable whose value may be set by the user to affect the
9696 subsequent behavior of floating-point arithmetic.
9697 <p><!--para 2 -->
9698 Certain programming conventions support the intended model of use for the floating-
9699 point environment:<sup><a href="#note180"><b>180)</b></a></sup>
9700 <ul>
9701 <li> a function call does not alter its caller's floating-point control modes, clear its caller's
9702 floating-point status flags, nor depend on the state of its caller's floating-point status
9703 flags unless the function is so documented;
9704 <li> a function call is assumed to require default floating-point control modes, unless its
9705 documentation promises otherwise;
9706 <li> a function call is assumed to have the potential for raising floating-point exceptions,
9707 unless its documentation promises otherwise.
9708 </ul>
9709 <p><!--para 3 -->
9710 The type
9711 <pre>
9712 fenv_t
9713 </pre>
9714 represents the entire floating-point environment.
9715 <p><!--para 4 -->
9716 The type
9717 <pre>
9718 fexcept_t
9719 </pre>
9720 represents the floating-point status flags collectively, including any status the
9721 implementation associates with the flags.
9726 <!--page 200 -->
9727 <p><!--para 5 -->
9728 Each of the macros
9729 <pre>
9730 FE_DIVBYZERO
9731 FE_INEXACT
9732 FE_INVALID
9733 FE_OVERFLOW
9734 FE_UNDERFLOW
9735 </pre>
9736 is defined if and only if the implementation supports the floating-point exception by
9737 means of the functions in 7.6.2.<sup><a href="#note181"><b>181)</b></a></sup> Additional implementation-defined floating-point
9738 exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
9739 be specified by the implementation. The defined macros expand to integer constant
9740 expressions with values such that bitwise ORs of all combinations of the macros result in
9741 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
9742 zero.<sup><a href="#note182"><b>182)</b></a></sup>
9743 <p><!--para 6 -->
9744 The macro
9745 <pre>
9746 FE_ALL_EXCEPT
9747 </pre>
9748 is simply the bitwise OR of all floating-point exception macros defined by the
9749 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
9750 <p><!--para 7 -->
9751 Each of the macros
9752 <pre>
9753 FE_DOWNWARD
9754 FE_TONEAREST
9755 FE_TOWARDZERO
9756 FE_UPWARD
9757 </pre>
9758 is defined if and only if the implementation supports getting and setting the represented
9759 rounding direction by means of the fegetround and fesetround functions.
9760 Additional implementation-defined rounding directions, with macro definitions beginning
9761 with FE_ and an uppercase letter, may also be specified by the implementation. The
9762 defined macros expand to integer constant expressions whose values are distinct
9763 nonnegative values.<sup><a href="#note183"><b>183)</b></a></sup>
9764 <p><!--para 8 -->
9765 The macro
9769 <!--page 201 -->
9770 <pre>
9771 FE_DFL_ENV
9772 </pre>
9773 represents the default floating-point environment -- the one installed at program startup
9774 -- and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
9775 <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
9776 <p><!--para 9 -->
9777 Additional implementation-defined environments, with macro definitions beginning with
9778 FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
9779 also be specified by the implementation.
9781 <h6>footnotes</h6>
9782 <p><small><a name="note178" href="#note178">178)</a> This header is designed to support the floating-point exception status flags and directed-rounding
9783 control modes required by IEC 60559, and other similar floating-point state information. Also it is
9784 designed to facilitate code portability among all systems.
9785 </small>
9786 <p><small><a name="note179" href="#note179">179)</a> A floating-point status flag is not an object and can be set more than once within an expression.
9787 </small>
9788 <p><small><a name="note180" href="#note180">180)</a> With these conventions, a programmer can safely assume default floating-point control modes (or be
9789 unaware of them). The responsibilities associated with accessing the floating-point environment fall
9790 on the programmer or program that does so explicitly.
9791 </small>
9792 <p><small><a name="note181" href="#note181">181)</a> The implementation supports an exception if there are circumstances where a call to at least one of the
9793 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
9794 all the functions to succeed all the time.
9795 </small>
9796 <p><small><a name="note182" href="#note182">182)</a> The macros should be distinct powers of two.
9797 </small>
9798 <p><small><a name="note183" href="#note183">183)</a> Even though the rounding direction macros may expand to constants corresponding to the values of
9799 FLT_ROUNDS, they are not required to do so.
9800 </small>
9802 <h4><a name="7.6.1" href="#7.6.1">7.6.1 The FENV_ACCESS pragma</a></h4>
9803 <h6>Synopsis</h6>
9804 <p><!--para 1 -->
9805 <pre>
9806 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9807 #pragma STDC FENV_ACCESS on-off-switch
9808 </pre>
9809 <h6>Description</h6>
9810 <p><!--para 2 -->
9811 The FENV_ACCESS pragma provides a means to inform the implementation when a
9812 program might access the floating-point environment to test floating-point status flags or
9813 run under non-default floating-point control modes.<sup><a href="#note184"><b>184)</b></a></sup> The pragma shall occur either
9814 outside external declarations or preceding all explicit declarations and statements inside a
9815 compound statement. When outside external declarations, the pragma takes effect from
9816 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
9817 the translation unit. When inside a compound statement, the pragma takes effect from its
9818 occurrence until another FENV_ACCESS pragma is encountered (including within a
9819 nested compound statement), or until the end of the compound statement; at the end of a
9820 compound statement the state for the pragma is restored to its condition just before the
9821 compound statement. If this pragma is used in any other context, the behavior is
9822 undefined. If part of a program tests floating-point status flags, sets floating-point control
9823 modes, or runs under non-default mode settings, but was translated with the state for the
9824 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
9825 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
9826 the program translated with FENV_ACCESS ''off'' to a part translated with
9827 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
9828 floating-point control modes have their default settings.)
9833 <!--page 202 -->
9834 <p><!--para 3 -->
9835 EXAMPLE
9836 <p><!--para 4 -->
9837 <pre>
9838 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9839 void f(double x)
9841 #pragma STDC FENV_ACCESS ON
9842 void g(double);
9843 void h(double);
9844 /* ... */
9845 g(x + 1);
9846 h(x + 1);
9847 /* ... */
9849 </pre>
9850 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
9851 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
9852 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note185"><b>185)</b></a></sup>
9855 <h6>footnotes</h6>
9856 <p><small><a name="note184" href="#note184">184)</a> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
9857 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
9858 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
9859 modes are in effect and the flags are not tested.
9860 </small>
9861 <p><small><a name="note185" href="#note185">185)</a> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
9862 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
9863 ''off'', just one evaluation of x + 1 would suffice.
9864 </small>
9866 <h4><a name="7.6.2" href="#7.6.2">7.6.2 Floating-point exceptions</a></h4>
9867 <p><!--para 1 -->
9868 The following functions provide access to the floating-point status flags.<sup><a href="#note186"><b>186)</b></a></sup> The int
9869 input argument for the functions represents a subset of floating-point exceptions, and can
9870 be zero or the bitwise OR of one or more floating-point exception macros, for example
9871 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
9872 functions is undefined.
9874 <h6>footnotes</h6>
9875 <p><small><a name="note186" href="#note186">186)</a> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
9876 abstraction of flags that are either set or clear. An implementation may endow floating-point status
9877 flags with more information -- for example, the address of the code which first raised the floating-
9878 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
9879 content of flags.
9880 </small>
9882 <h5><a name="7.6.2.1" href="#7.6.2.1">7.6.2.1 The feclearexcept function</a></h5>
9883 <h6>Synopsis</h6>
9884 <p><!--para 1 -->
9885 <pre>
9886 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9887 int feclearexcept(int excepts);
9888 </pre>
9889 <h6>Description</h6>
9890 <p><!--para 2 -->
9891 The feclearexcept function attempts to clear the supported floating-point exceptions
9892 represented by its argument.
9893 <h6>Returns</h6>
9894 <p><!--para 3 -->
9895 The feclearexcept function returns zero if the excepts argument is zero or if all
9896 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
9899 <!--page 203 -->
9901 <h5><a name="7.6.2.2" href="#7.6.2.2">7.6.2.2 The fegetexceptflag function</a></h5>
9902 <h6>Synopsis</h6>
9903 <p><!--para 1 -->
9904 <pre>
9905 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9906 int fegetexceptflag(fexcept_t *flagp,
9907 int excepts);
9908 </pre>
9909 <h6>Description</h6>
9910 <p><!--para 2 -->
9911 The fegetexceptflag function attempts to store an implementation-defined
9912 representation of the states of the floating-point status flags indicated by the argument
9913 excepts in the object pointed to by the argument flagp.
9914 <h6>Returns</h6>
9915 <p><!--para 3 -->
9916 The fegetexceptflag function returns zero if the representation was successfully
9917 stored. Otherwise, it returns a nonzero value.
9919 <h5><a name="7.6.2.3" href="#7.6.2.3">7.6.2.3 The feraiseexcept function</a></h5>
9920 <h6>Synopsis</h6>
9921 <p><!--para 1 -->
9922 <pre>
9923 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9924 int feraiseexcept(int excepts);
9925 </pre>
9926 <h6>Description</h6>
9927 <p><!--para 2 -->
9928 The feraiseexcept function attempts to raise the supported floating-point exceptions
9929 represented by its argument.<sup><a href="#note187"><b>187)</b></a></sup> The order in which these floating-point exceptions are
9930 raised is unspecified, except as stated in <a href="#F.7.6">F.7.6</a>. Whether the feraiseexcept function
9931 additionally raises the ''inexact'' floating-point exception whenever it raises the
9932 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
9933 <h6>Returns</h6>
9934 <p><!--para 3 -->
9935 The feraiseexcept function returns zero if the excepts argument is zero or if all
9936 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
9941 <!--page 204 -->
9943 <h6>footnotes</h6>
9944 <p><small><a name="note187" href="#note187">187)</a> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
9945 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
9946 in <a href="#F.7.6">F.7.6</a> is in the same spirit.
9947 </small>
9949 <h5><a name="7.6.2.4" href="#7.6.2.4">7.6.2.4 The fesetexceptflag function</a></h5>
9950 <h6>Synopsis</h6>
9951 <p><!--para 1 -->
9952 <pre>
9953 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9954 int fesetexceptflag(const fexcept_t *flagp,
9955 int excepts);
9956 </pre>
9957 <h6>Description</h6>
9958 <p><!--para 2 -->
9959 The fesetexceptflag function attempts to set the floating-point status flags
9960 indicated by the argument excepts to the states stored in the object pointed to by
9961 flagp. The value of *flagp shall have been set by a previous call to
9962 fegetexceptflag whose second argument represented at least those floating-point
9963 exceptions represented by the argument excepts. This function does not raise floating-
9964 point exceptions, but only sets the state of the flags.
9965 <h6>Returns</h6>
9966 <p><!--para 3 -->
9967 The fesetexceptflag function returns zero if the excepts argument is zero or if
9968 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
9969 a nonzero value.
9971 <h5><a name="7.6.2.5" href="#7.6.2.5">7.6.2.5 The fetestexcept function</a></h5>
9972 <h6>Synopsis</h6>
9973 <p><!--para 1 -->
9974 <pre>
9975 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9976 int fetestexcept(int excepts);
9977 </pre>
9978 <h6>Description</h6>
9979 <p><!--para 2 -->
9980 The fetestexcept function determines which of a specified subset of the floating-
9981 point exception flags are currently set. The excepts argument specifies the floating-
9982 point status flags to be queried.<sup><a href="#note188"><b>188)</b></a></sup>
9983 <h6>Returns</h6>
9984 <p><!--para 3 -->
9985 The fetestexcept function returns the value of the bitwise OR of the floating-point
9986 exception macros corresponding to the currently set floating-point exceptions included in
9987 excepts.
9988 <p><!--para 4 -->
9989 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
9994 <!--page 205 -->
9995 <pre>
9996 #include <a href="#7.6">&lt;fenv.h&gt;</a>
9997 /* ... */
9999 #pragma STDC FENV_ACCESS ON
10000 int set_excepts;
10001 feclearexcept(FE_INVALID | FE_OVERFLOW);
10002 // maybe raise exceptions
10003 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
10004 if (set_excepts &amp; FE_INVALID) f();
10005 if (set_excepts &amp; FE_OVERFLOW) g();
10006 /* ... */
10008 </pre>
10011 <h6>footnotes</h6>
10012 <p><small><a name="note188" href="#note188">188)</a> This mechanism allows testing several floating-point exceptions with just one function call.
10013 </small>
10015 <h4><a name="7.6.3" href="#7.6.3">7.6.3 Rounding</a></h4>
10016 <p><!--para 1 -->
10017 The fegetround and fesetround functions provide control of rounding direction
10018 modes.
10020 <h5><a name="7.6.3.1" href="#7.6.3.1">7.6.3.1 The fegetround function</a></h5>
10021 <h6>Synopsis</h6>
10022 <p><!--para 1 -->
10023 <pre>
10024 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10025 int fegetround(void);
10026 </pre>
10027 <h6>Description</h6>
10028 <p><!--para 2 -->
10029 The fegetround function gets the current rounding direction.
10030 <h6>Returns</h6>
10031 <p><!--para 3 -->
10032 The fegetround function returns the value of the rounding direction macro
10033 representing the current rounding direction or a negative value if there is no such
10034 rounding direction macro or the current rounding direction is not determinable.
10036 <h5><a name="7.6.3.2" href="#7.6.3.2">7.6.3.2 The fesetround function</a></h5>
10037 <h6>Synopsis</h6>
10038 <p><!--para 1 -->
10039 <pre>
10040 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10041 int fesetround(int round);
10042 </pre>
10043 <h6>Description</h6>
10044 <p><!--para 2 -->
10045 The fesetround function establishes the rounding direction represented by its
10046 argument round. If the argument is not equal to the value of a rounding direction macro,
10047 the rounding direction is not changed.
10048 <h6>Returns</h6>
10049 <p><!--para 3 -->
10050 The fesetround function returns zero if and only if the requested rounding direction
10051 was established.
10052 <!--page 206 -->
10053 <p><!--para 4 -->
10054 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
10055 rounding direction fails.
10056 <pre>
10057 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10058 #include <a href="#7.2">&lt;assert.h&gt;</a>
10059 void f(int round_dir)
10061 #pragma STDC FENV_ACCESS ON
10062 int save_round;
10063 int setround_ok;
10064 save_round = fegetround();
10065 setround_ok = fesetround(round_dir);
10066 assert(setround_ok == 0);
10067 /* ... */
10068 fesetround(save_round);
10069 /* ... */
10071 </pre>
10074 <h4><a name="7.6.4" href="#7.6.4">7.6.4 Environment</a></h4>
10075 <p><!--para 1 -->
10076 The functions in this section manage the floating-point environment -- status flags and
10077 control modes -- as one entity.
10079 <h5><a name="7.6.4.1" href="#7.6.4.1">7.6.4.1 The fegetenv function</a></h5>
10080 <h6>Synopsis</h6>
10081 <p><!--para 1 -->
10082 <pre>
10083 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10084 int fegetenv(fenv_t *envp);
10085 </pre>
10086 <h6>Description</h6>
10087 <p><!--para 2 -->
10088 The fegetenv function attempts to store the current floating-point environment in the
10089 object pointed to by envp.
10090 <h6>Returns</h6>
10091 <p><!--para 3 -->
10092 The fegetenv function returns zero if the environment was successfully stored.
10093 Otherwise, it returns a nonzero value.
10095 <h5><a name="7.6.4.2" href="#7.6.4.2">7.6.4.2 The feholdexcept function</a></h5>
10096 <h6>Synopsis</h6>
10097 <p><!--para 1 -->
10098 <pre>
10099 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10100 int feholdexcept(fenv_t *envp);
10101 </pre>
10102 <h6>Description</h6>
10103 <p><!--para 2 -->
10104 The feholdexcept function saves the current floating-point environment in the object
10105 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
10106 (continue on floating-point exceptions) mode, if available, for all floating-point
10107 exceptions.<sup><a href="#note189"><b>189)</b></a></sup>
10108 <!--page 207 -->
10109 <h6>Returns</h6>
10110 <p><!--para 3 -->
10111 The feholdexcept function returns zero if and only if non-stop floating-point
10112 exception handling was successfully installed.
10114 <h6>footnotes</h6>
10115 <p><small><a name="note189" href="#note189">189)</a> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
10116 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
10117 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
10118 function to write routines that hide spurious floating-point exceptions from their callers.
10119 </small>
10121 <h5><a name="7.6.4.3" href="#7.6.4.3">7.6.4.3 The fesetenv function</a></h5>
10122 <h6>Synopsis</h6>
10123 <p><!--para 1 -->
10124 <pre>
10125 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10126 int fesetenv(const fenv_t *envp);
10127 </pre>
10128 <h6>Description</h6>
10129 <p><!--para 2 -->
10130 The fesetenv function attempts to establish the floating-point environment represented
10131 by the object pointed to by envp. The argument envp shall point to an object set by a
10132 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
10133 Note that fesetenv merely installs the state of the floating-point status flags
10134 represented through its argument, and does not raise these floating-point exceptions.
10135 <h6>Returns</h6>
10136 <p><!--para 3 -->
10137 The fesetenv function returns zero if the environment was successfully established.
10138 Otherwise, it returns a nonzero value.
10140 <h5><a name="7.6.4.4" href="#7.6.4.4">7.6.4.4 The feupdateenv function</a></h5>
10141 <h6>Synopsis</h6>
10142 <p><!--para 1 -->
10143 <pre>
10144 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10145 int feupdateenv(const fenv_t *envp);
10146 </pre>
10147 <h6>Description</h6>
10148 <p><!--para 2 -->
10149 The feupdateenv function attempts to save the currently raised floating-point
10150 exceptions in its automatic storage, install the floating-point environment represented by
10151 the object pointed to by envp, and then raise the saved floating-point exceptions. The
10152 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
10153 or equal a floating-point environment macro.
10154 <h6>Returns</h6>
10155 <p><!--para 3 -->
10156 The feupdateenv function returns zero if all the actions were successfully carried out.
10157 Otherwise, it returns a nonzero value.
10162 <!--page 208 -->
10163 <p><!--para 4 -->
10164 EXAMPLE Hide spurious underflow floating-point exceptions:
10165 <!--page 209 -->
10166 <pre>
10167 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10168 double f(double x)
10170 #pragma STDC FENV_ACCESS ON
10171 double result;
10172 fenv_t save_env;
10173 if (feholdexcept(&amp;save_env))
10174 return /* indication of an environmental problem */;
10175 // compute result
10176 if (/* test spurious underflow */)
10177 if (feclearexcept(FE_UNDERFLOW))
10178 return /* indication of an environmental problem */;
10179 if (feupdateenv(&amp;save_env))
10180 return /* indication of an environmental problem */;
10181 return result;
10183 </pre>
10185 <h3><a name="7.7" href="#7.7">7.7 Characteristics of floating types <float.h></a></h3>
10186 <p><!--para 1 -->
10187 The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
10188 parameters of the standard floating-point types.
10189 <p><!--para 2 -->
10190 The macros, their meanings, and the constraints (or restrictions) on their values are listed
10191 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
10192 <!--page 210 -->
10194 <h3><a name="7.8" href="#7.8">7.8 Format conversion of integer types <inttypes.h></a></h3>
10195 <p><!--para 1 -->
10196 The header <a href="#7.8">&lt;inttypes.h&gt;</a> includes the header <a href="#7.18">&lt;stdint.h&gt;</a> and extends it with
10197 additional facilities provided by hosted implementations.
10198 <p><!--para 2 -->
10199 It declares functions for manipulating greatest-width integers and converting numeric
10200 character strings to greatest-width integers, and it declares the type
10201 <pre>
10202 imaxdiv_t
10203 </pre>
10204 which is a structure type that is the type of the value returned by the imaxdiv function.
10205 For each type declared in <a href="#7.18">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
10206 specifiers for use with the formatted input/output functions.<sup><a href="#note190"><b>190)</b></a></sup>
10207 <p><b> Forward references</b>: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>), formatted input/output
10208 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>).
10210 <h6>footnotes</h6>
10211 <p><small><a name="note190" href="#note190">190)</a> See ''future library directions'' (<a href="#7.26.4">7.26.4</a>).
10212 </small>
10214 <h4><a name="7.8.1" href="#7.8.1">7.8.1 Macros for format specifiers</a></h4>
10215 <p><!--para 1 -->
10216 Each of the following object-like macros<sup><a href="#note191"><b>191)</b></a></sup> expands to a character string literal
10217 containing a conversion specifier, possibly modified by a length modifier, suitable for use
10218 within the format argument of a formatted input/output function when converting the
10219 corresponding integer type. These macro names have the general form of PRI (character
10220 string literals for the fprintf and fwprintf family) or SCN (character string literals
10221 for the fscanf and fwscanf family),<sup><a href="#note192"><b>192)</b></a></sup> followed by the conversion specifier,
10222 followed by a name corresponding to a similar type name in <a href="#7.18.1">7.18.1</a>. In these names, N
10223 represents the width of the type as described in <a href="#7.18.1">7.18.1</a>. For example, PRIdFAST32 can
10224 be used in a format string to print the value of an integer of type int_fast32_t.
10225 <p><!--para 2 -->
10226 The fprintf macros for signed integers are:
10227 <pre>
10228 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
10229 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
10230 </pre>
10235 <!--page 211 -->
10236 <p><!--para 3 -->
10237 The fprintf macros for unsigned integers are:
10238 <p><!--para 4 -->
10239 <pre>
10240 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
10241 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
10242 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
10243 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
10244 </pre>
10245 The fscanf macros for signed integers are:
10246 <p><!--para 5 -->
10247 <pre>
10248 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
10249 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
10250 </pre>
10251 The fscanf macros for unsigned integers are:
10252 <p><!--para 6 -->
10253 <pre>
10254 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
10255 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
10256 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
10257 </pre>
10258 For each type that the implementation provides in <a href="#7.18">&lt;stdint.h&gt;</a>, the corresponding
10259 fprintf macros shall be defined and the corresponding fscanf macros shall be
10260 defined unless the implementation does not have a suitable fscanf length modifier for
10261 the type.
10262 <p><!--para 7 -->
10263 EXAMPLE
10264 <pre>
10265 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10266 #include <a href="#7.24">&lt;wchar.h&gt;</a>
10267 int main(void)
10269 uintmax_t i = UINTMAX_MAX; // this type always exists
10270 wprintf(L"The largest integer value is %020"
10271 PRIxMAX "\n", i);
10272 return 0;
10274 </pre>
10277 <h6>footnotes</h6>
10278 <p><small><a name="note191" href="#note191">191)</a> C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined
10279 before <a href="#7.8">&lt;inttypes.h&gt;</a> is included.
10280 </small>
10281 <p><small><a name="note192" href="#note192">192)</a> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
10282 different format specifiers may be required for fprintf and fscanf, even when the type is the
10283 same.
10284 </small>
10286 <h4><a name="7.8.2" href="#7.8.2">7.8.2 Functions for greatest-width integer types</a></h4>
10288 <h5><a name="7.8.2.1" href="#7.8.2.1">7.8.2.1 The imaxabs function</a></h5>
10289 <h6>Synopsis</h6>
10290 <p><!--para 1 -->
10291 <pre>
10292 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10293 intmax_t imaxabs(intmax_t j);
10294 </pre>
10295 <h6>Description</h6>
10296 <p><!--para 2 -->
10297 The imaxabs function computes the absolute value of an integer j. If the result cannot
10298 be represented, the behavior is undefined.<sup><a href="#note193"><b>193)</b></a></sup>
10302 <!--page 212 -->
10303 <h6>Returns</h6>
10304 <p><!--para 3 -->
10305 The imaxabs function returns the absolute value.
10307 <h6>footnotes</h6>
10308 <p><small><a name="note193" href="#note193">193)</a> The absolute value of the most negative number cannot be represented in two's complement.
10309 </small>
10311 <h5><a name="7.8.2.2" href="#7.8.2.2">7.8.2.2 The imaxdiv function</a></h5>
10312 <h6>Synopsis</h6>
10313 <p><!--para 1 -->
10314 <pre>
10315 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10316 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
10317 </pre>
10318 <h6>Description</h6>
10319 <p><!--para 2 -->
10320 The imaxdiv function computes numer / denom and numer % denom in a single
10321 operation.
10322 <h6>Returns</h6>
10323 <p><!--para 3 -->
10324 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
10325 quotient and the remainder. The structure shall contain (in either order) the members
10326 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
10327 either part of the result cannot be represented, the behavior is undefined.
10329 <h5><a name="7.8.2.3" href="#7.8.2.3">7.8.2.3 The strtoimax and strtoumax functions</a></h5>
10330 <h6>Synopsis</h6>
10331 <p><!--para 1 -->
10332 <pre>
10333 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10334 intmax_t strtoimax(const char * restrict nptr,
10335 char ** restrict endptr, int base);
10336 uintmax_t strtoumax(const char * restrict nptr,
10337 char ** restrict endptr, int base);
10338 </pre>
10339 <h6>Description</h6>
10340 <p><!--para 2 -->
10341 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
10342 strtoul, and strtoull functions, except that the initial portion of the string is
10343 converted to intmax_t and uintmax_t representation, respectively.
10344 <h6>Returns</h6>
10345 <p><!--para 3 -->
10346 The strtoimax and strtoumax functions return the converted value, if any. If no
10347 conversion could be performed, zero is returned. If the correct value is outside the range
10348 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
10349 (according to the return type and sign of the value, if any), and the value of the macro
10350 ERANGE is stored in errno.
10351 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
10352 (<a href="#7.20.1.4">7.20.1.4</a>).
10353 <!--page 213 -->
10355 <h5><a name="7.8.2.4" href="#7.8.2.4">7.8.2.4 The wcstoimax and wcstoumax functions</a></h5>
10356 <h6>Synopsis</h6>
10357 <p><!--para 1 -->
10358 <pre>
10359 #include <a href="#7.17">&lt;stddef.h&gt;</a> // for wchar_t
10360 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10361 intmax_t wcstoimax(const wchar_t * restrict nptr,
10362 wchar_t ** restrict endptr, int base);
10363 uintmax_t wcstoumax(const wchar_t * restrict nptr,
10364 wchar_t ** restrict endptr, int base);
10365 </pre>
10366 <h6>Description</h6>
10367 <p><!--para 2 -->
10368 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
10369 wcstoul, and wcstoull functions except that the initial portion of the wide string is
10370 converted to intmax_t and uintmax_t representation, respectively.
10371 <h6>Returns</h6>
10372 <p><!--para 3 -->
10373 The wcstoimax function returns the converted value, if any. If no conversion could be
10374 performed, zero is returned. If the correct value is outside the range of representable
10375 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
10376 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
10377 errno.
10378 <p><b> Forward references</b>: the wcstol, wcstoll, wcstoul, and wcstoull functions
10379 (<a href="#7.24.4.1.2">7.24.4.1.2</a>).
10380 <!--page 214 -->
10382 <h3><a name="7.9" href="#7.9">7.9 Alternative spellings <iso646.h></a></h3>
10383 <p><!--para 1 -->
10384 The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
10385 to the corresponding tokens (on the right):
10386 <!--page 215 -->
10387 <pre>
10388 and &amp;&amp;
10389 and_eq &amp;=
10390 bitand &amp;
10391 bitor |
10392 compl ~
10393 not !
10394 not_eq !=
10395 or ||
10396 or_eq |=
10397 xor ^
10398 xor_eq ^=
10399 </pre>
10401 <h3><a name="7.10" href="#7.10">7.10 Sizes of integer types <limits.h></a></h3>
10402 <p><!--para 1 -->
10403 The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
10404 parameters of the standard integer types.
10405 <p><!--para 2 -->
10406 The macros, their meanings, and the constraints (or restrictions) on their values are listed
10407 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
10408 <!--page 216 -->
10410 <h3><a name="7.11" href="#7.11">7.11 Localization <locale.h></a></h3>
10411 <p><!--para 1 -->
10412 The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
10413 <p><!--para 2 -->
10414 The type is
10415 <pre>
10416 struct lconv
10417 </pre>
10418 which contains members related to the formatting of numeric values. The structure shall
10419 contain at least the following members, in any order. The semantics of the members and
10420 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
10421 the values specified in the comments.
10422 <!--page 217 -->
10423 <p><!--para 3 -->
10424 <pre>
10425 char *decimal_point; // "."
10426 char *thousands_sep; // ""
10427 char *grouping; // ""
10428 char *mon_decimal_point; // ""
10429 char *mon_thousands_sep; // ""
10430 char *mon_grouping; // ""
10431 char *positive_sign; // ""
10432 char *negative_sign; // ""
10433 char *currency_symbol; // ""
10434 char frac_digits; // CHAR_MAX
10435 char p_cs_precedes; // CHAR_MAX
10436 char n_cs_precedes; // CHAR_MAX
10437 char p_sep_by_space; // CHAR_MAX
10438 char n_sep_by_space; // CHAR_MAX
10439 char p_sign_posn; // CHAR_MAX
10440 char n_sign_posn; // CHAR_MAX
10441 char *int_curr_symbol; // ""
10442 char int_frac_digits; // CHAR_MAX
10443 char int_p_cs_precedes; // CHAR_MAX
10444 char int_n_cs_precedes; // CHAR_MAX
10445 char int_p_sep_by_space; // CHAR_MAX
10446 char int_n_sep_by_space; // CHAR_MAX
10447 char int_p_sign_posn; // CHAR_MAX
10448 char int_n_sign_posn; // CHAR_MAX
10449 </pre>
10450 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
10451 <pre>
10452 LC_ALL
10453 LC_COLLATE
10454 LC_CTYPE
10455 LC_MONETARY
10456 LC_NUMERIC
10457 LC_TIME
10458 </pre>
10459 which expand to integer constant expressions with distinct values, suitable for use as the
10460 first argument to the setlocale function.<sup><a href="#note194"><b>194)</b></a></sup> Additional macro definitions, beginning
10461 with the characters LC_ and an uppercase letter,<sup><a href="#note195"><b>195)</b></a></sup> may also be specified by the
10462 implementation.
10464 <h6>footnotes</h6>
10465 <p><small><a name="note194" href="#note194">194)</a> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
10466 </small>
10467 <p><small><a name="note195" href="#note195">195)</a> See ''future library directions'' (<a href="#7.26.5">7.26.5</a>).
10468 </small>
10470 <h4><a name="7.11.1" href="#7.11.1">7.11.1 Locale control</a></h4>
10472 <h5><a name="7.11.1.1" href="#7.11.1.1">7.11.1.1 The setlocale function</a></h5>
10473 <h6>Synopsis</h6>
10474 <p><!--para 1 -->
10475 <pre>
10476 #include <a href="#7.11">&lt;locale.h&gt;</a>
10477 char *setlocale(int category, const char *locale);
10478 </pre>
10479 <h6>Description</h6>
10480 <p><!--para 2 -->
10481 The setlocale function selects the appropriate portion of the program's locale as
10482 specified by the category and locale arguments. The setlocale function may be
10483 used to change or query the program's entire current locale or portions thereof. The value
10484 LC_ALL for category names the program's entire locale; the other values for
10485 category name only a portion of the program's locale. LC_COLLATE affects the
10486 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
10487 the character handling functions<sup><a href="#note196"><b>196)</b></a></sup> and the multibyte and wide character functions.
10488 LC_MONETARY affects the monetary formatting information returned by the
10489 localeconv function. LC_NUMERIC affects the decimal-point character for the
10490 formatted input/output functions and the string conversion functions, as well as the
10491 nonmonetary formatting information returned by the localeconv function. LC_TIME
10492 affects the behavior of the strftime and wcsftime functions.
10493 <p><!--para 3 -->
10494 A value of "C" for locale specifies the minimal environment for C translation; a value
10495 of "" for locale specifies the locale-specific native environment. Other
10496 implementation-defined strings may be passed as the second argument to setlocale.
10498 <!--page 218 -->
10499 <p><!--para 4 -->
10500 At program startup, the equivalent of
10501 <pre>
10502 setlocale(LC_ALL, "C");
10503 </pre>
10504 is executed.
10505 <p><!--para 5 -->
10506 The implementation shall behave as if no library function calls the setlocale function.
10507 <h6>Returns</h6>
10508 <p><!--para 6 -->
10509 If a pointer to a string is given for locale and the selection can be honored, the
10510 setlocale function returns a pointer to the string associated with the specified
10511 category for the new locale. If the selection cannot be honored, the setlocale
10512 function returns a null pointer and the program's locale is not changed.
10513 <p><!--para 7 -->
10514 A null pointer for locale causes the setlocale function to return a pointer to the
10515 string associated with the category for the program's current locale; the program's
10516 locale is not changed.<sup><a href="#note197"><b>197)</b></a></sup>
10517 <p><!--para 8 -->
10518 The pointer to string returned by the setlocale function is such that a subsequent call
10519 with that string value and its associated category will restore that part of the program's
10520 locale. The string pointed to shall not be modified by the program, but may be
10521 overwritten by a subsequent call to the setlocale function.
10522 <p><b> Forward references</b>: formatted input/output functions (<a href="#7.19.6">7.19.6</a>), multibyte/wide
10523 character conversion functions (<a href="#7.20.7">7.20.7</a>), multibyte/wide string conversion functions
10524 (<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
10525 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>).
10527 <h6>footnotes</h6>
10528 <p><small><a name="note196" href="#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
10529 isxdigit.
10530 </small>
10531 <p><small><a name="note197" href="#note197">197)</a> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
10532 locale when category has the value LC_ALL.
10533 </small>
10535 <h4><a name="7.11.2" href="#7.11.2">7.11.2 Numeric formatting convention inquiry</a></h4>
10537 <h5><a name="7.11.2.1" href="#7.11.2.1">7.11.2.1 The localeconv function</a></h5>
10538 <h6>Synopsis</h6>
10539 <p><!--para 1 -->
10540 <pre>
10541 #include <a href="#7.11">&lt;locale.h&gt;</a>
10542 struct lconv *localeconv(void);
10543 </pre>
10544 <h6>Description</h6>
10545 <p><!--para 2 -->
10546 The localeconv function sets the components of an object with type struct lconv
10547 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
10548 according to the rules of the current locale.
10549 <p><!--para 3 -->
10550 The members of the structure with type char * are pointers to strings, any of which
10551 (except decimal_point) can point to "", to indicate that the value is not available in
10552 the current locale or is of zero length. Apart from grouping and mon_grouping, the
10554 <!--page 219 -->
10555 strings shall start and end in the initial shift state. The members with type char are
10556 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
10557 available in the current locale. The members include the following:
10558 <dl>
10559 <dt> char *decimal_point
10560 <dd>
10561 The decimal-point character used to format nonmonetary quantities.
10562 <dt> char *thousands_sep
10563 <dd>
10564 The character used to separate groups of digits before the decimal-point
10565 character in formatted nonmonetary quantities.
10566 <dt> char *grouping
10567 <dd>
10568 A string whose elements indicate the size of each group of digits in
10569 formatted nonmonetary quantities.
10570 <dt> char *mon_decimal_point
10571 <dd>
10572 The decimal-point used to format monetary quantities.
10573 <dt> char *mon_thousands_sep
10574 <dd>
10575 The separator for groups of digits before the decimal-point in formatted
10576 monetary quantities.
10577 <dt> char *mon_grouping
10578 <dd>
10579 A string whose elements indicate the size of each group of digits in
10580 formatted monetary quantities.
10581 <dt> char *positive_sign
10582 <dd>
10583 The string used to indicate a nonnegative-valued formatted monetary
10584 quantity.
10585 <dt> char *negative_sign
10586 <dd>
10587 The string used to indicate a negative-valued formatted monetary quantity.
10588 <dt> char *currency_symbol
10589 <dd>
10590 The local currency symbol applicable to the current locale.
10591 <dt> char frac_digits
10592 <dd>
10593 The number of fractional digits (those after the decimal-point) to be
10594 displayed in a locally formatted monetary quantity.
10595 <dt> char p_cs_precedes
10596 <dd>
10597 Set to 1 or 0 if the currency_symbol respectively precedes or
10598 succeeds the value for a nonnegative locally formatted monetary quantity.
10599 <dt> char n_cs_precedes
10600 <!--page 220 -->
10601 <dd>
10602 Set to 1 or 0 if the currency_symbol respectively precedes or
10603 succeeds the value for a negative locally formatted monetary quantity.
10604 <dt> char p_sep_by_space
10605 <dd>
10606 Set to a value indicating the separation of the currency_symbol, the
10607 sign string, and the value for a nonnegative locally formatted monetary
10608 quantity.
10609 <dt> char n_sep_by_space
10610 <dd>
10611 Set to a value indicating the separation of the currency_symbol, the
10612 sign string, and the value for a negative locally formatted monetary
10613 quantity.
10614 <dt> char p_sign_posn
10615 <dd>
10616 Set to a value indicating the positioning of the positive_sign for a
10617 nonnegative locally formatted monetary quantity.
10618 <dt> char n_sign_posn
10619 <dd>
10620 Set to a value indicating the positioning of the negative_sign for a
10621 negative locally formatted monetary quantity.
10622 <dt> char *int_curr_symbol
10623 <dd>
10624 The international currency symbol applicable to the current locale. The
10625 first three characters contain the alphabetic international currency symbol
10626 in accordance with those specified in ISO 4217. The fourth character
10627 (immediately preceding the null character) is the character used to separate
10628 the international currency symbol from the monetary quantity.
10629 <dt> char int_frac_digits
10630 <dd>
10631 The number of fractional digits (those after the decimal-point) to be
10632 displayed in an internationally formatted monetary quantity.
10633 <dt> char int_p_cs_precedes
10634 <dd>
10635 Set to 1 or 0 if the int_curr_symbol respectively precedes or
10636 succeeds the value for a nonnegative internationally formatted monetary
10637 quantity.
10638 <dt> char int_n_cs_precedes
10639 <dd>
10640 Set to 1 or 0 if the int_curr_symbol respectively precedes or
10641 succeeds the value for a negative internationally formatted monetary
10642 quantity.
10643 <dt> char int_p_sep_by_space
10644 <!--page 221 -->
10645 <dd>
10646 Set to a value indicating the separation of the int_curr_symbol, the
10647 sign string, and the value for a nonnegative internationally formatted
10648 monetary quantity.
10649 <dt> char int_n_sep_by_space
10650 <dd>
10651 Set to a value indicating the separation of the int_curr_symbol, the
10652 sign string, and the value for a negative internationally formatted monetary
10653 quantity.
10654 <dt> char int_p_sign_posn
10655 <dd>
10656 Set to a value indicating the positioning of the positive_sign for a
10657 nonnegative internationally formatted monetary quantity.
10658 <dt> char int_n_sign_posn
10659 <dd>
10660 Set to a value indicating the positioning of the negative_sign for a
10661 negative internationally formatted monetary quantity.
10662 </dl>
10663 <p><!--para 4 -->
10664 The elements of grouping and mon_grouping are interpreted according to the
10665 following:
10666 <dl>
10667 <dt> CHAR_MAX <dd>No further grouping is to be performed.
10668 <dt> 0 <dd>The previous element is to be repeatedly used for the remainder of the
10669 digits.
10670 <dt> other <dd>The integer value is the number of digits that compose the current group.
10671 The next element is examined to determine the size of the next group of
10672 digits before the current group.
10673 </dl>
10674 <p><!--para 5 -->
10675 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
10676 and int_n_sep_by_space are interpreted according to the following:
10677 <dl>
10678 <dt> 0 <dd>No space separates the currency symbol and value.
10679 <dt> 1 <dd>If the currency symbol and sign string are adjacent, a space separates them from the
10680 value; otherwise, a space separates the currency symbol from the value.
10681 <dt> 2 <dd>If the currency symbol and sign string are adjacent, a space separates them;
10682 otherwise, a space separates the sign string from the value.
10683 </dl>
10684 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
10685 int_curr_symbol is used instead of a space.
10686 <p><!--para 6 -->
10687 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
10688 int_n_sign_posn are interpreted according to the following:
10689 <dl>
10690 <dt> 0 <dd>Parentheses surround the quantity and currency symbol.
10691 <dt> 1 <dd>The sign string precedes the quantity and currency symbol.
10692 <dt> 2 <dd>The sign string succeeds the quantity and currency symbol.
10693 <dt> 3 <dd>The sign string immediately precedes the currency symbol.
10694 <dt> 4 <dd>The sign string immediately succeeds the currency symbol.
10695 </dl>
10696 <!--page 222 -->
10697 <p><!--para 7 -->
10698 The implementation shall behave as if no library function calls the localeconv
10699 function.
10700 <h6>Returns</h6>
10701 <p><!--para 8 -->
10702 The localeconv function returns a pointer to the filled-in object. The structure
10703 pointed to by the return value shall not be modified by the program, but may be
10704 overwritten by a subsequent call to the localeconv function. In addition, calls to the
10705 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
10706 overwrite the contents of the structure.
10707 <p><!--para 9 -->
10708 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
10709 monetary quantities.
10710 <pre>
10711 Local format International format
10713 Country Positive Negative Positive Negative
10715 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
10716 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
10717 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
10718 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
10719 </pre>
10720 <p><!--para 10 -->
10721 For these four countries, the respective values for the monetary members of the structure returned by
10722 localeconv could be:
10723 <pre>
10724 Country1 Country2 Country3 Country4
10726 mon_decimal_point "," "" "," "."
10727 mon_thousands_sep "." "." "." ","
10728 mon_grouping "\3" "\3" "\3" "\3"
10729 positive_sign "" "" "" ""
10730 negative_sign "-" "-" "-" "C"
10731 currency_symbol "mk" "L." "\u0192" "SFrs."
10732 frac_digits 2 0 2 2
10733 p_cs_precedes 0 1 1 1
10734 n_cs_precedes 0 1 1 1
10735 p_sep_by_space 1 0 1 0
10736 n_sep_by_space 1 0 2 0
10737 p_sign_posn 1 1 1 1
10738 n_sign_posn 1 1 4 2
10739 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
10740 int_frac_digits 2 0 2 2
10741 int_p_cs_precedes 1 1 1 1
10742 int_n_cs_precedes 1 1 1 1
10743 int_p_sep_by_space 1 1 1 1
10744 int_n_sep_by_space 2 1 2 1
10745 int_p_sign_posn 1 1 1 1
10746 int_n_sign_posn 4 1 4 2
10747 </pre>
10748 <!--page 223 -->
10749 <p><!--para 11 -->
10750 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
10751 affect the formatted value.
10752 <pre>
10753 p_sep_by_space
10754 p_cs_precedes p_sign_posn 0 1 2
10756 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
10757 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
10758 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
10759 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
10760 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
10762 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
10763 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
10764 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
10765 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
10766 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25
10767 </pre>
10769 <!--page 224 -->
10770 <h3><a name="7.12" href="#7.12">7.12 Mathematics <math.h></a></h3>
10771 <p><!--para 1 -->
10772 The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
10773 several macros. Most synopses specify a family of functions consisting of a principal
10774 function with one or more double parameters, a double return value, or both; and
10775 other functions with the same name but with f and l suffixes, which are corresponding
10776 functions with float and long double parameters, return values, or both.<sup><a href="#note198"><b>198)</b></a></sup>
10777 Integer arithmetic functions and conversion functions are discussed later.
10778 <p><!--para 2 -->
10779 The types
10780 <pre>
10781 float_t
10782 double_t
10783 </pre>
10784 are floating types at least as wide as float and double, respectively, and such that
10785 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
10786 float_t and double_t are float and double, respectively; if
10787 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
10788 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
10789 otherwise implementation-defined.<sup><a href="#note199"><b>199)</b></a></sup>
10790 <p><!--para 3 -->
10791 The macro
10792 <pre>
10793 HUGE_VAL
10794 </pre>
10795 expands to a positive double constant expression, not necessarily representable as a
10796 float. The macros
10797 <pre>
10798 HUGE_VALF
10799 HUGE_VALL
10800 </pre>
10801 are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note200"><b>200)</b></a></sup>
10802 <p><!--para 4 -->
10803 The macro
10804 <pre>
10805 INFINITY
10806 </pre>
10807 expands to a constant expression of type float representing positive or unsigned
10808 infinity, if available; else to a positive constant of type float that overflows at
10812 <!--page 225 -->
10813 translation time.<sup><a href="#note201"><b>201)</b></a></sup>
10814 <p><!--para 5 -->
10815 The macro
10816 <pre>
10818 </pre>
10819 is defined if and only if the implementation supports quiet NaNs for the float type. It
10820 expands to a constant expression of type float representing a quiet NaN.
10821 <p><!--para 6 -->
10822 The number classification macros
10823 <pre>
10824 FP_INFINITE
10825 FP_NAN
10826 FP_NORMAL
10827 FP_SUBNORMAL
10828 FP_ZERO
10829 </pre>
10830 represent the mutually exclusive kinds of floating-point values. They expand to integer
10831 constant expressions with distinct values. Additional implementation-defined floating-
10832 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
10833 may also be specified by the implementation.
10834 <p><!--para 7 -->
10835 The macro
10836 <pre>
10837 FP_FAST_FMA
10838 </pre>
10839 is optionally defined. If defined, it indicates that the fma function generally executes
10840 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
10841 macros
10842 <pre>
10843 FP_FAST_FMAF
10844 FP_FAST_FMAL
10845 </pre>
10846 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
10847 these macros expand to the integer constant 1.
10848 <p><!--para 8 -->
10849 The macros
10850 <pre>
10851 FP_ILOGB0
10852 FP_ILOGBNAN
10853 </pre>
10854 expand to integer constant expressions whose values are returned by ilogb(x) if x is
10855 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
10856 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
10859 <!--page 226 -->
10860 <p><!--para 9 -->
10861 The macros
10862 <pre>
10863 MATH_ERRNO
10864 MATH_ERREXCEPT
10865 </pre>
10866 expand to the integer constants 1 and 2, respectively; the macro
10867 <pre>
10868 math_errhandling
10869 </pre>
10870 expands to an expression that has type int and the value MATH_ERRNO,
10871 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
10872 constant for the duration of the program. It is unspecified whether
10873 math_errhandling is a macro or an identifier with external linkage. If a macro
10874 definition is suppressed or a program defines an identifier with the name
10875 math_errhandling, the behavior is undefined. If the expression
10876 math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
10877 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
10878 <a href="#7.6">&lt;fenv.h&gt;</a>.
10880 <h6>footnotes</h6>
10881 <p><small><a name="note198" href="#note198">198)</a> Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
10882 and return values in wider format than the synopsis prototype indicates.
10883 </small>
10884 <p><small><a name="note199" href="#note199">199)</a> The types float_t and double_t are intended to be the implementation's most efficient types at
10885 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
10886 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
10887 </small>
10888 <p><small><a name="note200" href="#note200">200)</a> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
10889 supports infinities.
10890 </small>
10891 <p><small><a name="note201" href="#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.
10892 </small>
10893 <p><small><a name="note202" href="#note202">202)</a> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
10894 directly with a hardware multiply-add instruction. Software implementations are expected to be
10895 substantially slower.
10896 </small>
10898 <h4><a name="7.12.1" href="#7.12.1">7.12.1 Treatment of error conditions</a></h4>
10899 <p><!--para 1 -->
10900 The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
10901 values of its input arguments, except where stated otherwise. Each function shall execute
10902 as if it were a single operation without generating any externally visible exceptional
10903 conditions.
10904 <p><!--para 2 -->
10905 For all functions, a domain error occurs if an input argument is outside the domain over
10906 which the mathematical function is defined. The description of each function lists any
10907 required domain errors; an implementation may define additional domain errors, provided
10908 that such errors are consistent with the mathematical definition of the function.<sup><a href="#note203"><b>203)</b></a></sup> On a
10909 domain error, the function returns an implementation-defined value; if the integer
10910 expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
10911 errno acquires the value EDOM; if the integer expression math_errhandling &amp;
10912 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
10913 <p><!--para 3 -->
10914 Similarly, a range error occurs if the mathematical result of the function cannot be
10915 represented in an object of the specified type, due to extreme magnitude.
10916 <p><!--para 4 -->
10917 A floating result overflows if the magnitude of the mathematical result is finite but so
10918 large that the mathematical result cannot be represented without extraordinary roundoff
10919 error in an object of the specified type. If a floating result overflows and default rounding
10920 is in effect, or if the mathematical result is an exact infinity from finite arguments (for
10921 example log(0.0)), then the function returns the value of the macro HUGE_VAL,
10924 <!--page 227 -->
10925 HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the
10926 correct value of the function; if the integer expression math_errhandling &amp;
10927 MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if
10928 the integer expression math_errhandling &amp; MATH_ERREXCEPT is nonzero, the
10929 ''divide-by-zero'' floating-point exception is raised if the mathematical result is an exact
10930 infinity and the ''overflow'' floating-point exception is raised otherwise.
10931 <p><!--para 5 -->
10932 The result underflows if the magnitude of the mathematical result is so small that the
10933 mathematical result cannot be represented, without extraordinary roundoff error, in an
10934 object of the specified type.<sup><a href="#note204"><b>204)</b></a></sup> If the result underflows, the function returns an
10935 implementation-defined value whose magnitude is no greater than the smallest
10936 normalized positive number in the specified type; if the integer expression
10937 math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
10938 value ERANGE is implementation-defined; if the integer expression
10939 math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
10940 floating-point exception is raised is implementation-defined.
10942 <h6>footnotes</h6>
10943 <p><small><a name="note203" href="#note203">203)</a> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
10944 error if the mathematical domain of the function does not include the infinity.
10945 </small>
10946 <p><small><a name="note204" href="#note204">204)</a> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
10947 also ''flush-to-zero'' underflow.
10948 </small>
10950 <h4><a name="7.12.2" href="#7.12.2">7.12.2 The FP_CONTRACT pragma</a></h4>
10951 <h6>Synopsis</h6>
10952 <p><!--para 1 -->
10953 <pre>
10954 #include <a href="#7.12">&lt;math.h&gt;</a>
10955 #pragma STDC FP_CONTRACT on-off-switch
10956 </pre>
10957 <h6>Description</h6>
10958 <p><!--para 2 -->
10959 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
10960 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
10961 either outside external declarations or preceding all explicit declarations and statements
10962 inside a compound statement. When outside external declarations, the pragma takes
10963 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
10964 the end of the translation unit. When inside a compound statement, the pragma takes
10965 effect from its occurrence until another FP_CONTRACT pragma is encountered
10966 (including within a nested compound statement), or until the end of the compound
10967 statement; at the end of a compound statement the state for the pragma is restored to its
10968 condition just before the compound statement. If this pragma is used in any other
10969 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
10970 implementation-defined.
10975 <!--page 228 -->
10977 <h4><a name="7.12.3" href="#7.12.3">7.12.3 Classification macros</a></h4>
10978 <p><!--para 1 -->
10979 In the synopses in this subclause, real-floating indicates that the argument shall be an
10980 expression of real floating type.
10982 <h5><a name="7.12.3.1" href="#7.12.3.1">7.12.3.1 The fpclassify macro</a></h5>
10983 <h6>Synopsis</h6>
10984 <p><!--para 1 -->
10985 <pre>
10986 #include <a href="#7.12">&lt;math.h&gt;</a>
10987 int fpclassify(real-floating x);
10988 </pre>
10989 <h6>Description</h6>
10990 <p><!--para 2 -->
10991 The fpclassify macro classifies its argument value as NaN, infinite, normal,
10992 subnormal, zero, or into another implementation-defined category. First, an argument
10993 represented in a format wider than its semantic type is converted to its semantic type.
10994 Then classification is based on the type of the argument.<sup><a href="#note205"><b>205)</b></a></sup>
10995 <h6>Returns</h6>
10996 <p><!--para 3 -->
10997 The fpclassify macro returns the value of the number classification macro
10998 appropriate to the value of its argument.
10999 <p><!--para 4 -->
11000 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
11001 <pre>
11002 #define fpclassify(x) \
11003 ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : \
11004 (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) : \
11005 __fpclassifyl(x))
11006 </pre>
11009 <h6>footnotes</h6>
11010 <p><small><a name="note205" href="#note205">205)</a> Since an expression can be evaluated with more range and precision than its type has, it is important to
11011 know the type that classification is based on. For example, a normal long double value might
11012 become subnormal when converted to double, and zero when converted to float.
11013 </small>
11015 <h5><a name="7.12.3.2" href="#7.12.3.2">7.12.3.2 The isfinite macro</a></h5>
11016 <h6>Synopsis</h6>
11017 <p><!--para 1 -->
11018 <pre>
11019 #include <a href="#7.12">&lt;math.h&gt;</a>
11020 int isfinite(real-floating x);
11021 </pre>
11022 <h6>Description</h6>
11023 <p><!--para 2 -->
11024 The isfinite macro determines whether its argument has a finite value (zero,
11025 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
11026 format wider than its semantic type is converted to its semantic type. Then determination
11027 is based on the type of the argument.
11032 <!--page 229 -->
11033 <h6>Returns</h6>
11034 <p><!--para 3 -->
11035 The isfinite macro returns a nonzero value if and only if its argument has a finite
11036 value.
11038 <h5><a name="7.12.3.3" href="#7.12.3.3">7.12.3.3 The isinf macro</a></h5>
11039 <h6>Synopsis</h6>
11040 <p><!--para 1 -->
11041 <pre>
11042 #include <a href="#7.12">&lt;math.h&gt;</a>
11043 int isinf(real-floating x);
11044 </pre>
11045 <h6>Description</h6>
11046 <p><!--para 2 -->
11047 The isinf macro determines whether its argument value is an infinity (positive or
11048 negative). First, an argument represented in a format wider than its semantic type is
11049 converted to its semantic type. Then determination is based on the type of the argument.
11050 <h6>Returns</h6>
11051 <p><!--para 3 -->
11052 The isinf macro returns a nonzero value if and only if its argument has an infinite
11053 value.
11055 <h5><a name="7.12.3.4" href="#7.12.3.4">7.12.3.4 The isnan macro</a></h5>
11056 <h6>Synopsis</h6>
11057 <p><!--para 1 -->
11058 <pre>
11059 #include <a href="#7.12">&lt;math.h&gt;</a>
11060 int isnan(real-floating x);
11061 </pre>
11062 <h6>Description</h6>
11063 <p><!--para 2 -->
11064 The isnan macro determines whether its argument value is a NaN. First, an argument
11065 represented in a format wider than its semantic type is converted to its semantic type.
11066 Then determination is based on the type of the argument.<sup><a href="#note206"><b>206)</b></a></sup>
11067 <h6>Returns</h6>
11068 <p><!--para 3 -->
11069 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
11071 <h6>footnotes</h6>
11072 <p><small><a name="note206" href="#note206">206)</a> For the isnan macro, the type for determination does not matter unless the implementation supports
11073 NaNs in the evaluation type but not in the semantic type.
11074 </small>
11076 <h5><a name="7.12.3.5" href="#7.12.3.5">7.12.3.5 The isnormal macro</a></h5>
11077 <h6>Synopsis</h6>
11078 <p><!--para 1 -->
11079 <pre>
11080 #include <a href="#7.12">&lt;math.h&gt;</a>
11081 int isnormal(real-floating x);
11082 </pre>
11087 <!--page 230 -->
11088 <h6>Description</h6>
11089 <p><!--para 2 -->
11090 The isnormal macro determines whether its argument value is normal (neither zero,
11091 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
11092 semantic type is converted to its semantic type. Then determination is based on the type
11093 of the argument.
11094 <h6>Returns</h6>
11095 <p><!--para 3 -->
11096 The isnormal macro returns a nonzero value if and only if its argument has a normal
11097 value.
11099 <h5><a name="7.12.3.6" href="#7.12.3.6">7.12.3.6 The signbit macro</a></h5>
11100 <h6>Synopsis</h6>
11101 <p><!--para 1 -->
11102 <pre>
11103 #include <a href="#7.12">&lt;math.h&gt;</a>
11104 int signbit(real-floating x);
11105 </pre>
11106 <h6>Description</h6>
11107 <p><!--para 2 -->
11108 The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note207"><b>207)</b></a></sup>
11109 <h6>Returns</h6>
11110 <p><!--para 3 -->
11111 The signbit macro returns a nonzero value if and only if the sign of its argument value
11112 is negative.
11114 <h6>footnotes</h6>
11115 <p><small><a name="note207" href="#note207">207)</a> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
11116 unsigned, it is treated as positive.
11117 </small>
11119 <h4><a name="7.12.4" href="#7.12.4">7.12.4 Trigonometric functions</a></h4>
11121 <h5><a name="7.12.4.1" href="#7.12.4.1">7.12.4.1 The acos functions</a></h5>
11122 <h6>Synopsis</h6>
11123 <p><!--para 1 -->
11124 <pre>
11125 #include <a href="#7.12">&lt;math.h&gt;</a>
11126 double acos(double x);
11127 float acosf(float x);
11128 long double acosl(long double x);
11129 </pre>
11130 <h6>Description</h6>
11131 <p><!--para 2 -->
11132 The acos functions compute the principal value of the arc cosine of x. A domain error
11133 occurs for arguments not in the interval [-1, +1].
11134 <h6>Returns</h6>
11135 <p><!--para 3 -->
11136 The acos functions return arccos x in the interval [0, pi ] radians.
11141 <!--page 231 -->
11143 <h5><a name="7.12.4.2" href="#7.12.4.2">7.12.4.2 The asin functions</a></h5>
11144 <h6>Synopsis</h6>
11145 <p><!--para 1 -->
11146 <pre>
11147 #include <a href="#7.12">&lt;math.h&gt;</a>
11148 double asin(double x);
11149 float asinf(float x);
11150 long double asinl(long double x);
11151 </pre>
11152 <h6>Description</h6>
11153 <p><!--para 2 -->
11154 The asin functions compute the principal value of the arc sine of x. A domain error
11155 occurs for arguments not in the interval [-1, +1].
11156 <h6>Returns</h6>
11157 <p><!--para 3 -->
11158 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
11160 <h5><a name="7.12.4.3" href="#7.12.4.3">7.12.4.3 The atan functions</a></h5>
11161 <h6>Synopsis</h6>
11162 <p><!--para 1 -->
11163 <pre>
11164 #include <a href="#7.12">&lt;math.h&gt;</a>
11165 double atan(double x);
11166 float atanf(float x);
11167 long double atanl(long double x);
11168 </pre>
11169 <h6>Description</h6>
11170 <p><!--para 2 -->
11171 The atan functions compute the principal value of the arc tangent of x.
11172 <h6>Returns</h6>
11173 <p><!--para 3 -->
11174 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
11176 <h5><a name="7.12.4.4" href="#7.12.4.4">7.12.4.4 The atan2 functions</a></h5>
11177 <h6>Synopsis</h6>
11178 <p><!--para 1 -->
11179 <pre>
11180 #include <a href="#7.12">&lt;math.h&gt;</a>
11181 double atan2(double y, double x);
11182 float atan2f(float y, float x);
11183 long double atan2l(long double y, long double x);
11184 </pre>
11185 <h6>Description</h6>
11186 <p><!--para 2 -->
11187 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
11188 arguments to determine the quadrant of the return value. A domain error may occur if
11189 both arguments are zero.
11190 <h6>Returns</h6>
11191 <p><!--para 3 -->
11192 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
11193 <!--page 232 -->
11195 <h5><a name="7.12.4.5" href="#7.12.4.5">7.12.4.5 The cos functions</a></h5>
11196 <h6>Synopsis</h6>
11197 <p><!--para 1 -->
11198 <pre>
11199 #include <a href="#7.12">&lt;math.h&gt;</a>
11200 double cos(double x);
11201 float cosf(float x);
11202 long double cosl(long double x);
11203 </pre>
11204 <h6>Description</h6>
11205 <p><!--para 2 -->
11206 The cos functions compute the cosine of x (measured in radians).
11207 <h6>Returns</h6>
11208 <p><!--para 3 -->
11209 The cos functions return cos x.
11211 <h5><a name="7.12.4.6" href="#7.12.4.6">7.12.4.6 The sin functions</a></h5>
11212 <h6>Synopsis</h6>
11213 <p><!--para 1 -->
11214 <pre>
11215 #include <a href="#7.12">&lt;math.h&gt;</a>
11216 double sin(double x);
11217 float sinf(float x);
11218 long double sinl(long double x);
11219 </pre>
11220 <h6>Description</h6>
11221 <p><!--para 2 -->
11222 The sin functions compute the sine of x (measured in radians).
11223 <h6>Returns</h6>
11224 <p><!--para 3 -->
11225 The sin functions return sin x.
11227 <h5><a name="7.12.4.7" href="#7.12.4.7">7.12.4.7 The tan functions</a></h5>
11228 <h6>Synopsis</h6>
11229 <p><!--para 1 -->
11230 <pre>
11231 #include <a href="#7.12">&lt;math.h&gt;</a>
11232 double tan(double x);
11233 float tanf(float x);
11234 long double tanl(long double x);
11235 </pre>
11236 <h6>Description</h6>
11237 <p><!--para 2 -->
11238 The tan functions return the tangent of x (measured in radians).
11239 <h6>Returns</h6>
11240 <p><!--para 3 -->
11241 The tan functions return tan x.
11242 <!--page 233 -->
11244 <h4><a name="7.12.5" href="#7.12.5">7.12.5 Hyperbolic functions</a></h4>
11246 <h5><a name="7.12.5.1" href="#7.12.5.1">7.12.5.1 The acosh functions</a></h5>
11247 <h6>Synopsis</h6>
11248 <p><!--para 1 -->
11249 <pre>
11250 #include <a href="#7.12">&lt;math.h&gt;</a>
11251 double acosh(double x);
11252 float acoshf(float x);
11253 long double acoshl(long double x);
11254 </pre>
11255 <h6>Description</h6>
11256 <p><!--para 2 -->
11257 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
11258 error occurs for arguments less than 1.
11259 <h6>Returns</h6>
11260 <p><!--para 3 -->
11261 The acosh functions return arcosh x in the interval [0, +(inf)].
11263 <h5><a name="7.12.5.2" href="#7.12.5.2">7.12.5.2 The asinh functions</a></h5>
11264 <h6>Synopsis</h6>
11265 <p><!--para 1 -->
11266 <pre>
11267 #include <a href="#7.12">&lt;math.h&gt;</a>
11268 double asinh(double x);
11269 float asinhf(float x);
11270 long double asinhl(long double x);
11271 </pre>
11272 <h6>Description</h6>
11273 <p><!--para 2 -->
11274 The asinh functions compute the arc hyperbolic sine of x.
11275 <h6>Returns</h6>
11276 <p><!--para 3 -->
11277 The asinh functions return arsinh x.
11279 <h5><a name="7.12.5.3" href="#7.12.5.3">7.12.5.3 The atanh functions</a></h5>
11280 <h6>Synopsis</h6>
11281 <p><!--para 1 -->
11282 <pre>
11283 #include <a href="#7.12">&lt;math.h&gt;</a>
11284 double atanh(double x);
11285 float atanhf(float x);
11286 long double atanhl(long double x);
11287 </pre>
11288 <h6>Description</h6>
11289 <p><!--para 2 -->
11290 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
11291 for arguments not in the interval [-1, +1]. A range error may occur if the argument
11292 equals -1 or +1.
11293 <!--page 234 -->
11294 <h6>Returns</h6>
11295 <p><!--para 3 -->
11296 The atanh functions return artanh x.
11298 <h5><a name="7.12.5.4" href="#7.12.5.4">7.12.5.4 The cosh functions</a></h5>
11299 <h6>Synopsis</h6>
11300 <p><!--para 1 -->
11301 <pre>
11302 #include <a href="#7.12">&lt;math.h&gt;</a>
11303 double cosh(double x);
11304 float coshf(float x);
11305 long double coshl(long double x);
11306 </pre>
11307 <h6>Description</h6>
11308 <p><!--para 2 -->
11309 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
11310 magnitude of x is too large.
11311 <h6>Returns</h6>
11312 <p><!--para 3 -->
11313 The cosh functions return cosh x.
11315 <h5><a name="7.12.5.5" href="#7.12.5.5">7.12.5.5 The sinh functions</a></h5>
11316 <h6>Synopsis</h6>
11317 <p><!--para 1 -->
11318 <pre>
11319 #include <a href="#7.12">&lt;math.h&gt;</a>
11320 double sinh(double x);
11321 float sinhf(float x);
11322 long double sinhl(long double x);
11323 </pre>
11324 <h6>Description</h6>
11325 <p><!--para 2 -->
11326 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
11327 magnitude of x is too large.
11328 <h6>Returns</h6>
11329 <p><!--para 3 -->
11330 The sinh functions return sinh x.
11332 <h5><a name="7.12.5.6" href="#7.12.5.6">7.12.5.6 The tanh functions</a></h5>
11333 <h6>Synopsis</h6>
11334 <p><!--para 1 -->
11335 <pre>
11336 #include <a href="#7.12">&lt;math.h&gt;</a>
11337 double tanh(double x);
11338 float tanhf(float x);
11339 long double tanhl(long double x);
11340 </pre>
11341 <h6>Description</h6>
11342 <p><!--para 2 -->
11343 The tanh functions compute the hyperbolic tangent of x.
11344 <!--page 235 -->
11345 <h6>Returns</h6>
11346 <p><!--para 3 -->
11347 The tanh functions return tanh x.
11349 <h4><a name="7.12.6" href="#7.12.6">7.12.6 Exponential and logarithmic functions</a></h4>
11351 <h5><a name="7.12.6.1" href="#7.12.6.1">7.12.6.1 The exp functions</a></h5>
11352 <h6>Synopsis</h6>
11353 <p><!--para 1 -->
11354 <pre>
11355 #include <a href="#7.12">&lt;math.h&gt;</a>
11356 double exp(double x);
11357 float expf(float x);
11358 long double expl(long double x);
11359 </pre>
11360 <h6>Description</h6>
11361 <p><!--para 2 -->
11362 The exp functions compute the base-e exponential of x. A range error occurs if the
11363 magnitude of x is too large.
11364 <h6>Returns</h6>
11365 <p><!--para 3 -->
11366 The exp functions return e<sup>x</sup>.
11368 <h5><a name="7.12.6.2" href="#7.12.6.2">7.12.6.2 The exp2 functions</a></h5>
11369 <h6>Synopsis</h6>
11370 <p><!--para 1 -->
11371 <pre>
11372 #include <a href="#7.12">&lt;math.h&gt;</a>
11373 double exp2(double x);
11374 float exp2f(float x);
11375 long double exp2l(long double x);
11376 </pre>
11377 <h6>Description</h6>
11378 <p><!--para 2 -->
11379 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
11380 magnitude of x is too large.
11381 <h6>Returns</h6>
11382 <p><!--para 3 -->
11383 The exp2 functions return 2<sup>x</sup>.
11385 <h5><a name="7.12.6.3" href="#7.12.6.3">7.12.6.3 The expm1 functions</a></h5>
11386 <h6>Synopsis</h6>
11387 <p><!--para 1 -->
11388 <!--page 236 -->
11389 <pre>
11390 #include <a href="#7.12">&lt;math.h&gt;</a>
11391 double expm1(double x);
11392 float expm1f(float x);
11393 long double expm1l(long double x);
11394 </pre>
11395 <h6>Description</h6>
11396 <p><!--para 2 -->
11397 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
11398 error occurs if x is too large.<sup><a href="#note208"><b>208)</b></a></sup>
11399 <h6>Returns</h6>
11400 <p><!--para 3 -->
11401 The expm1 functions return e<sup>x</sup> - 1.
11403 <h6>footnotes</h6>
11404 <p><small><a name="note208" href="#note208">208)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
11405 </small>
11407 <h5><a name="7.12.6.4" href="#7.12.6.4">7.12.6.4 The frexp functions</a></h5>
11408 <h6>Synopsis</h6>
11409 <p><!--para 1 -->
11410 <pre>
11411 #include <a href="#7.12">&lt;math.h&gt;</a>
11412 double frexp(double value, int *exp);
11413 float frexpf(float value, int *exp);
11414 long double frexpl(long double value, int *exp);
11415 </pre>
11416 <h6>Description</h6>
11417 <p><!--para 2 -->
11418 The frexp functions break a floating-point number into a normalized fraction and an
11419 integral power of 2. They store the integer in the int object pointed to by exp.
11420 <h6>Returns</h6>
11421 <p><!--para 3 -->
11422 If value is not a floating-point number, the results are unspecified. Otherwise, the
11423 frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or
11424 zero, and value equals x 2<sup>*exp</sup> . If value is zero, both parts of the result are zero.
11426 <h5><a name="7.12.6.5" href="#7.12.6.5">7.12.6.5 The ilogb functions</a></h5>
11427 <h6>Synopsis</h6>
11428 <p><!--para 1 -->
11429 <pre>
11430 #include <a href="#7.12">&lt;math.h&gt;</a>
11431 int ilogb(double x);
11432 int ilogbf(float x);
11433 int ilogbl(long double x);
11434 </pre>
11435 <h6>Description</h6>
11436 <p><!--para 2 -->
11437 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
11438 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
11439 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
11440 the corresponding logb function and casting the returned value to type int. A domain
11441 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
11442 the range of the return type, the numeric result is unspecified.
11447 <!--page 237 -->
11448 <h6>Returns</h6>
11449 <p><!--para 3 -->
11450 The ilogb functions return the exponent of x as a signed int value.
11451 <p><b> Forward references</b>: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
11453 <h5><a name="7.12.6.6" href="#7.12.6.6">7.12.6.6 The ldexp functions</a></h5>
11454 <h6>Synopsis</h6>
11455 <p><!--para 1 -->
11456 <pre>
11457 #include <a href="#7.12">&lt;math.h&gt;</a>
11458 double ldexp(double x, int exp);
11459 float ldexpf(float x, int exp);
11460 long double ldexpl(long double x, int exp);
11461 </pre>
11462 <h6>Description</h6>
11463 <p><!--para 2 -->
11464 The ldexp functions multiply a floating-point number by an integral power of 2. A
11465 range error may occur.
11466 <h6>Returns</h6>
11467 <p><!--para 3 -->
11468 The ldexp functions return x 2<sup>exp</sup> .
11470 <h5><a name="7.12.6.7" href="#7.12.6.7">7.12.6.7 The log functions</a></h5>
11471 <h6>Synopsis</h6>
11472 <p><!--para 1 -->
11473 <pre>
11474 #include <a href="#7.12">&lt;math.h&gt;</a>
11475 double log(double x);
11476 float logf(float x);
11477 long double logl(long double x);
11478 </pre>
11479 <h6>Description</h6>
11480 <p><!--para 2 -->
11481 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
11482 the argument is negative. A range error may occur if the argument is zero.
11483 <h6>Returns</h6>
11484 <p><!--para 3 -->
11485 The log functions return loge x.
11487 <h5><a name="7.12.6.8" href="#7.12.6.8">7.12.6.8 The log10 functions</a></h5>
11488 <h6>Synopsis</h6>
11489 <p><!--para 1 -->
11490 <!--page 238 -->
11491 <pre>
11492 #include <a href="#7.12">&lt;math.h&gt;</a>
11493 double log10(double x);
11494 float log10f(float x);
11495 long double log10l(long double x);
11496 </pre>
11497 <h6>Description</h6>
11498 <p><!--para 2 -->
11499 The log10 functions compute the base-10 (common) logarithm of x. A domain error
11500 occurs if the argument is negative. A range error may occur if the argument is zero.
11501 <h6>Returns</h6>
11502 <p><!--para 3 -->
11503 The log10 functions return log10 x.
11505 <h5><a name="7.12.6.9" href="#7.12.6.9">7.12.6.9 The log1p functions</a></h5>
11506 <h6>Synopsis</h6>
11507 <p><!--para 1 -->
11508 <pre>
11509 #include <a href="#7.12">&lt;math.h&gt;</a>
11510 double log1p(double x);
11511 float log1pf(float x);
11512 long double log1pl(long double x);
11513 </pre>
11514 <h6>Description</h6>
11515 <p><!--para 2 -->
11516 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note209"><b>209)</b></a></sup>
11517 A domain error occurs if the argument is less than -1. A range error may occur if the
11518 argument equals -1.
11519 <h6>Returns</h6>
11520 <p><!--para 3 -->
11521 The log1p functions return loge (1 + x).
11523 <h6>footnotes</h6>
11524 <p><small><a name="note209" href="#note209">209)</a> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
11525 </small>
11527 <h5><a name="7.12.6.10" href="#7.12.6.10">7.12.6.10 The log2 functions</a></h5>
11528 <h6>Synopsis</h6>
11529 <p><!--para 1 -->
11530 <pre>
11531 #include <a href="#7.12">&lt;math.h&gt;</a>
11532 double log2(double x);
11533 float log2f(float x);
11534 long double log2l(long double x);
11535 </pre>
11536 <h6>Description</h6>
11537 <p><!--para 2 -->
11538 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
11539 argument is less than zero. A range error may occur if the argument is zero.
11540 <h6>Returns</h6>
11541 <p><!--para 3 -->
11542 The log2 functions return log2 x.
11547 <!--page 239 -->
11549 <h5><a name="7.12.6.11" href="#7.12.6.11">7.12.6.11 The logb functions</a></h5>
11550 <h6>Synopsis</h6>
11551 <p><!--para 1 -->
11552 <pre>
11553 #include <a href="#7.12">&lt;math.h&gt;</a>
11554 double logb(double x);
11555 float logbf(float x);
11556 long double logbl(long double x);
11557 </pre>
11558 <h6>Description</h6>
11559 <p><!--para 2 -->
11560 The logb functions extract the exponent of x, as a signed integer value in floating-point
11561 format. If x is subnormal it is treated as though it were normalized; thus, for positive
11562 finite x,
11563 <pre>
11564 1 &lt;= x FLT_RADIX<sup>-logb(x)</sup> &lt; FLT_RADIX
11565 </pre>
11566 A domain error or range error may occur if the argument is zero.
11567 <h6>Returns</h6>
11568 <p><!--para 3 -->
11569 The logb functions return the signed exponent of x.
11571 <h5><a name="7.12.6.12" href="#7.12.6.12">7.12.6.12 The modf functions</a></h5>
11572 <h6>Synopsis</h6>
11573 <p><!--para 1 -->
11574 <pre>
11575 #include <a href="#7.12">&lt;math.h&gt;</a>
11576 double modf(double value, double *iptr);
11577 float modff(float value, float *iptr);
11578 long double modfl(long double value, long double *iptr);
11579 </pre>
11580 <h6>Description</h6>
11581 <p><!--para 2 -->
11582 The modf functions break the argument value into integral and fractional parts, each of
11583 which has the same type and sign as the argument. They store the integral part (in
11584 floating-point format) in the object pointed to by iptr.
11585 <h6>Returns</h6>
11586 <p><!--para 3 -->
11587 The modf functions return the signed fractional part of value.
11588 <!--page 240 -->
11590 <h5><a name="7.12.6.13" href="#7.12.6.13">7.12.6.13 The scalbn and scalbln functions</a></h5>
11591 <h6>Synopsis</h6>
11592 <p><!--para 1 -->
11593 <pre>
11594 #include <a href="#7.12">&lt;math.h&gt;</a>
11595 double scalbn(double x, int n);
11596 float scalbnf(float x, int n);
11597 long double scalbnl(long double x, int n);
11598 double scalbln(double x, long int n);
11599 float scalblnf(float x, long int n);
11600 long double scalblnl(long double x, long int n);
11601 </pre>
11602 <h6>Description</h6>
11603 <p><!--para 2 -->
11604 The scalbn and scalbln functions compute x FLT_RADIX<sup>n</sup> efficiently, not
11605 normally by computing FLT_RADIX<sup>n</sup> explicitly. A range error may occur.
11606 <h6>Returns</h6>
11607 <p><!--para 3 -->
11608 The scalbn and scalbln functions return x FLT_RADIX<sup>n</sup> .
11610 <h4><a name="7.12.7" href="#7.12.7">7.12.7 Power and absolute-value functions</a></h4>
11612 <h5><a name="7.12.7.1" href="#7.12.7.1">7.12.7.1 The cbrt functions</a></h5>
11613 <h6>Synopsis</h6>
11614 <p><!--para 1 -->
11615 <pre>
11616 #include <a href="#7.12">&lt;math.h&gt;</a>
11617 double cbrt(double x);
11618 float cbrtf(float x);
11619 long double cbrtl(long double x);
11620 </pre>
11621 <h6>Description</h6>
11622 <p><!--para 2 -->
11623 The cbrt functions compute the real cube root of x.
11624 <h6>Returns</h6>
11625 <p><!--para 3 -->
11626 The cbrt functions return x<sup>1/3</sup>.
11628 <h5><a name="7.12.7.2" href="#7.12.7.2">7.12.7.2 The fabs functions</a></h5>
11629 <h6>Synopsis</h6>
11630 <p><!--para 1 -->
11631 <pre>
11632 #include <a href="#7.12">&lt;math.h&gt;</a>
11633 double fabs(double x);
11634 float fabsf(float x);
11635 long double fabsl(long double x);
11636 </pre>
11637 <h6>Description</h6>
11638 <p><!--para 2 -->
11639 The fabs functions compute the absolute value of a floating-point number x.
11640 <!--page 241 -->
11641 <h6>Returns</h6>
11642 <p><!--para 3 -->
11643 The fabs functions return | x |.
11645 <h5><a name="7.12.7.3" href="#7.12.7.3">7.12.7.3 The hypot functions</a></h5>
11646 <h6>Synopsis</h6>
11647 <p><!--para 1 -->
11648 <pre>
11649 #include <a href="#7.12">&lt;math.h&gt;</a>
11650 double hypot(double x, double y);
11651 float hypotf(float x, float y);
11652 long double hypotl(long double x, long double y);
11653 </pre>
11654 <h6>Description</h6>
11655 <p><!--para 2 -->
11656 The hypot functions compute the square root of the sum of the squares of x and y,
11657 without undue overflow or underflow. A range error may occur.
11658 <p><!--para 3 -->
11659 <h6>Returns</h6>
11660 <p><!--para 4 -->
11661 The hypot functions return (sqrt)(x<sup>2</sup> + y<sup>2</sup>).
11663 <h5><a name="7.12.7.4" href="#7.12.7.4">7.12.7.4 The pow functions</a></h5>
11664 <h6>Synopsis</h6>
11665 <p><!--para 1 -->
11666 <pre>
11667 #include <a href="#7.12">&lt;math.h&gt;</a>
11668 double pow(double x, double y);
11669 float powf(float x, float y);
11670 long double powl(long double x, long double y);
11671 </pre>
11672 <h6>Description</h6>
11673 <p><!--para 2 -->
11674 The pow functions compute x raised to the power y. A domain error occurs if x is finite
11675 and negative and y is finite and not an integer value. A range error may occur. A domain
11676 error may occur if x is zero and y is zero. A domain error or range error may occur if x
11677 is zero and y is less than zero.
11678 <h6>Returns</h6>
11679 <p><!--para 3 -->
11680 The pow functions return x<sup>y</sup>.
11682 <h5><a name="7.12.7.5" href="#7.12.7.5">7.12.7.5 The sqrt functions</a></h5>
11683 <h6>Synopsis</h6>
11684 <p><!--para 1 -->
11685 <!--page 242 -->
11686 <pre>
11687 #include <a href="#7.12">&lt;math.h&gt;</a>
11688 double sqrt(double x);
11689 float sqrtf(float x);
11690 long double sqrtl(long double x);
11691 </pre>
11692 <h6>Description</h6>
11693 <p><!--para 2 -->
11694 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
11695 the argument is less than zero.
11696 <h6>Returns</h6>
11697 <p><!--para 3 -->
11698 The sqrt functions return (sqrt)(x).
11700 <h4><a name="7.12.8" href="#7.12.8">7.12.8 Error and gamma functions</a></h4>
11702 <h5><a name="7.12.8.1" href="#7.12.8.1">7.12.8.1 The erf functions</a></h5>
11703 <h6>Synopsis</h6>
11704 <p><!--para 1 -->
11705 <pre>
11706 #include <a href="#7.12">&lt;math.h&gt;</a>
11707 double erf(double x);
11708 float erff(float x);
11709 long double erfl(long double x);
11710 </pre>
11711 <h6>Description</h6>
11712 <p><!--para 2 -->
11713 The erf functions compute the error function of x.
11714 <h6>Returns</h6>
11715 <p><!--para 3 -->
11716 The erf functions return
11717 <pre>
11719 erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
11720 (sqrt)(pi) 0
11721 </pre>
11723 <h5><a name="7.12.8.2" href="#7.12.8.2">7.12.8.2 The erfc functions</a></h5>
11724 <h6>Synopsis</h6>
11725 <p><!--para 1 -->
11726 <pre>
11727 #include <a href="#7.12">&lt;math.h&gt;</a>
11728 double erfc(double x);
11729 float erfcf(float x);
11730 long double erfcl(long double x);
11731 </pre>
11732 <h6>Description</h6>
11733 <p><!--para 2 -->
11734 The erfc functions compute the complementary error function of x. A range error
11735 occurs if x is too large.
11736 <h6>Returns</h6>
11737 <p><!--para 3 -->
11738 The erfc functions return
11739 <pre>
11740 2 (inf)
11741 erfc x = 1 - erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
11742 (sqrt)(pi) x
11743 </pre>
11745 <!--page 243 -->
11746 <h5><a name="7.12.8.3" href="#7.12.8.3">7.12.8.3 The lgamma functions</a></h5>
11747 <h6>Synopsis</h6>
11748 <p><!--para 1 -->
11749 <pre>
11750 #include <a href="#7.12">&lt;math.h&gt;</a>
11751 double lgamma(double x);
11752 float lgammaf(float x);
11753 long double lgammal(long double x);
11754 </pre>
11755 <h6>Description</h6>
11756 <p><!--para 2 -->
11757 The lgamma functions compute the natural logarithm of the absolute value of gamma of
11758 x. A range error occurs if x is too large. A range error may occur if x is a negative
11759 integer or zero.
11760 <h6>Returns</h6>
11761 <p><!--para 3 -->
11762 The lgamma functions return loge | (Gamma)(x) |.
11764 <h5><a name="7.12.8.4" href="#7.12.8.4">7.12.8.4 The tgamma functions</a></h5>
11765 <h6>Synopsis</h6>
11766 <p><!--para 1 -->
11767 <pre>
11768 #include <a href="#7.12">&lt;math.h&gt;</a>
11769 double tgamma(double x);
11770 float tgammaf(float x);
11771 long double tgammal(long double x);
11772 </pre>
11773 <h6>Description</h6>
11774 <p><!--para 2 -->
11775 The tgamma functions compute the gamma function of x. A domain error or range error
11776 may occur if x is a negative integer or zero. A range error may occur if the magnitude of
11777 x is too large or too small.
11778 <h6>Returns</h6>
11779 <p><!--para 3 -->
11780 The tgamma functions return (Gamma)(x).
11782 <h4><a name="7.12.9" href="#7.12.9">7.12.9 Nearest integer functions</a></h4>
11784 <h5><a name="7.12.9.1" href="#7.12.9.1">7.12.9.1 The ceil functions</a></h5>
11785 <h6>Synopsis</h6>
11786 <p><!--para 1 -->
11787 <pre>
11788 #include <a href="#7.12">&lt;math.h&gt;</a>
11789 double ceil(double x);
11790 float ceilf(float x);
11791 long double ceill(long double x);
11792 </pre>
11793 <h6>Description</h6>
11794 <p><!--para 2 -->
11795 The ceil functions compute the smallest integer value not less than x.
11796 <!--page 244 -->
11797 <h6>Returns</h6>
11798 <p><!--para 3 -->
11799 The ceil functions return [^x^], expressed as a floating-point number.
11801 <h5><a name="7.12.9.2" href="#7.12.9.2">7.12.9.2 The floor functions</a></h5>
11802 <h6>Synopsis</h6>
11803 <p><!--para 1 -->
11804 <pre>
11805 #include <a href="#7.12">&lt;math.h&gt;</a>
11806 double floor(double x);
11807 float floorf(float x);
11808 long double floorl(long double x);
11809 </pre>
11810 <h6>Description</h6>
11811 <p><!--para 2 -->
11812 The floor functions compute the largest integer value not greater than x.
11813 <h6>Returns</h6>
11814 <p><!--para 3 -->
11815 The floor functions return [_x_], expressed as a floating-point number.
11817 <h5><a name="7.12.9.3" href="#7.12.9.3">7.12.9.3 The nearbyint functions</a></h5>
11818 <h6>Synopsis</h6>
11819 <p><!--para 1 -->
11820 <pre>
11821 #include <a href="#7.12">&lt;math.h&gt;</a>
11822 double nearbyint(double x);
11823 float nearbyintf(float x);
11824 long double nearbyintl(long double x);
11825 </pre>
11826 <h6>Description</h6>
11827 <p><!--para 2 -->
11828 The nearbyint functions round their argument to an integer value in floating-point
11829 format, using the current rounding direction and without raising the ''inexact'' floating-
11830 point exception.
11831 <h6>Returns</h6>
11832 <p><!--para 3 -->
11833 The nearbyint functions return the rounded integer value.
11835 <h5><a name="7.12.9.4" href="#7.12.9.4">7.12.9.4 The rint functions</a></h5>
11836 <h6>Synopsis</h6>
11837 <p><!--para 1 -->
11838 <pre>
11839 #include <a href="#7.12">&lt;math.h&gt;</a>
11840 double rint(double x);
11841 float rintf(float x);
11842 long double rintl(long double x);
11843 </pre>
11844 <h6>Description</h6>
11845 <p><!--para 2 -->
11846 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
11847 rint functions may raise the ''inexact'' floating-point exception if the result differs in
11848 value from the argument.
11849 <!--page 245 -->
11850 <h6>Returns</h6>
11851 <p><!--para 3 -->
11852 The rint functions return the rounded integer value.
11854 <h5><a name="7.12.9.5" href="#7.12.9.5">7.12.9.5 The lrint and llrint functions</a></h5>
11855 <h6>Synopsis</h6>
11856 <p><!--para 1 -->
11857 <pre>
11858 #include <a href="#7.12">&lt;math.h&gt;</a>
11859 long int lrint(double x);
11860 long int lrintf(float x);
11861 long int lrintl(long double x);
11862 long long int llrint(double x);
11863 long long int llrintf(float x);
11864 long long int llrintl(long double x);
11865 </pre>
11866 <h6>Description</h6>
11867 <p><!--para 2 -->
11868 The lrint and llrint functions round their argument to the nearest integer value,
11869 rounding according to the current rounding direction. If the rounded value is outside the
11870 range of the return type, the numeric result is unspecified and a domain error or range
11871 error may occur. *
11872 <h6>Returns</h6>
11873 <p><!--para 3 -->
11874 The lrint and llrint functions return the rounded integer value.
11876 <h5><a name="7.12.9.6" href="#7.12.9.6">7.12.9.6 The round functions</a></h5>
11877 <h6>Synopsis</h6>
11878 <p><!--para 1 -->
11879 <pre>
11880 #include <a href="#7.12">&lt;math.h&gt;</a>
11881 double round(double x);
11882 float roundf(float x);
11883 long double roundl(long double x);
11884 </pre>
11885 <h6>Description</h6>
11886 <p><!--para 2 -->
11887 The round functions round their argument to the nearest integer value in floating-point
11888 format, rounding halfway cases away from zero, regardless of the current rounding
11889 direction.
11890 <h6>Returns</h6>
11891 <p><!--para 3 -->
11892 The round functions return the rounded integer value.
11893 <!--page 246 -->
11895 <h5><a name="7.12.9.7" href="#7.12.9.7">7.12.9.7 The lround and llround functions</a></h5>
11896 <h6>Synopsis</h6>
11897 <p><!--para 1 -->
11898 <pre>
11899 #include <a href="#7.12">&lt;math.h&gt;</a>
11900 long int lround(double x);
11901 long int lroundf(float x);
11902 long int lroundl(long double x);
11903 long long int llround(double x);
11904 long long int llroundf(float x);
11905 long long int llroundl(long double x);
11906 </pre>
11907 <h6>Description</h6>
11908 <p><!--para 2 -->
11909 The lround and llround functions round their argument to the nearest integer value,
11910 rounding halfway cases away from zero, regardless of the current rounding direction. If
11911 the rounded value is outside the range of the return type, the numeric result is unspecified
11912 and a domain error or range error may occur.
11913 <h6>Returns</h6>
11914 <p><!--para 3 -->
11915 The lround and llround functions return the rounded integer value.
11917 <h5><a name="7.12.9.8" href="#7.12.9.8">7.12.9.8 The trunc functions</a></h5>
11918 <h6>Synopsis</h6>
11919 <p><!--para 1 -->
11920 <pre>
11921 #include <a href="#7.12">&lt;math.h&gt;</a>
11922 double trunc(double x);
11923 float truncf(float x);
11924 long double truncl(long double x);
11925 </pre>
11926 <h6>Description</h6>
11927 <p><!--para 2 -->
11928 The trunc functions round their argument to the integer value, in floating format,
11929 nearest to but no larger in magnitude than the argument.
11930 <h6>Returns</h6>
11931 <p><!--para 3 -->
11932 The trunc functions return the truncated integer value.
11933 <!--page 247 -->
11935 <h4><a name="7.12.10" href="#7.12.10">7.12.10 Remainder functions</a></h4>
11937 <h5><a name="7.12.10.1" href="#7.12.10.1">7.12.10.1 The fmod functions</a></h5>
11938 <h6>Synopsis</h6>
11939 <p><!--para 1 -->
11940 <pre>
11941 #include <a href="#7.12">&lt;math.h&gt;</a>
11942 double fmod(double x, double y);
11943 float fmodf(float x, float y);
11944 long double fmodl(long double x, long double y);
11945 </pre>
11946 <h6>Description</h6>
11947 <p><!--para 2 -->
11948 The fmod functions compute the floating-point remainder of x/y.
11949 <h6>Returns</h6>
11950 <p><!--para 3 -->
11951 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
11952 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
11953 whether a domain error occurs or the fmod functions return zero is implementation-
11954 defined.
11956 <h5><a name="7.12.10.2" href="#7.12.10.2">7.12.10.2 The remainder functions</a></h5>
11957 <h6>Synopsis</h6>
11958 <p><!--para 1 -->
11959 <pre>
11960 #include <a href="#7.12">&lt;math.h&gt;</a>
11961 double remainder(double x, double y);
11962 float remainderf(float x, float y);
11963 long double remainderl(long double x, long double y);
11964 </pre>
11965 <h6>Description</h6>
11966 <p><!--para 2 -->
11967 The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note210"><b>210)</b></a></sup>
11968 <h6>Returns</h6>
11969 <p><!--para 3 -->
11970 The remainder functions return x REM y. If y is zero, whether a domain error occurs
11971 or the functions return zero is implementation defined.
11976 <!--page 248 -->
11978 <h6>footnotes</h6>
11979 <p><small><a name="note210" href="#note210">210)</a> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
11980 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
11981 | n - x/y | = 1/2, then n is even. Thus, the remainder is always exact. If r = 0, its sign shall be that of
11982 x.'' This definition is applicable for all implementations.
11983 </small>
11985 <h5><a name="7.12.10.3" href="#7.12.10.3">7.12.10.3 The remquo functions</a></h5>
11986 <h6>Synopsis</h6>
11987 <p><!--para 1 -->
11988 <pre>
11989 #include <a href="#7.12">&lt;math.h&gt;</a>
11990 double remquo(double x, double y, int *quo);
11991 float remquof(float x, float y, int *quo);
11992 long double remquol(long double x, long double y,
11993 int *quo);
11994 </pre>
11995 <h6>Description</h6>
11996 <p><!--para 2 -->
11997 The remquo functions compute the same remainder as the remainder functions. In
11998 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
11999 magnitude is congruent modulo 2<sup>n</sup> to the magnitude of the integral quotient of x/y, where
12000 n is an implementation-defined integer greater than or equal to 3.
12001 <h6>Returns</h6>
12002 <p><!--para 3 -->
12003 The remquo functions return x REM y. If y is zero, the value stored in the object
12004 pointed to by quo is unspecified and whether a domain error occurs or the functions
12005 return zero is implementation defined.
12007 <h4><a name="7.12.11" href="#7.12.11">7.12.11 Manipulation functions</a></h4>
12009 <h5><a name="7.12.11.1" href="#7.12.11.1">7.12.11.1 The copysign functions</a></h5>
12010 <h6>Synopsis</h6>
12011 <p><!--para 1 -->
12012 <pre>
12013 #include <a href="#7.12">&lt;math.h&gt;</a>
12014 double copysign(double x, double y);
12015 float copysignf(float x, float y);
12016 long double copysignl(long double x, long double y);
12017 </pre>
12018 <h6>Description</h6>
12019 <p><!--para 2 -->
12020 The copysign functions produce a value with the magnitude of x and the sign of y.
12021 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
12022 represent a signed zero but do not treat negative zero consistently in arithmetic
12023 operations, the copysign functions regard the sign of zero as positive.
12024 <h6>Returns</h6>
12025 <p><!--para 3 -->
12026 The copysign functions return a value with the magnitude of x and the sign of y.
12027 <!--page 249 -->
12029 <h5><a name="7.12.11.2" href="#7.12.11.2">7.12.11.2 The nan functions</a></h5>
12030 <h6>Synopsis</h6>
12031 <p><!--para 1 -->
12032 <pre>
12033 #include <a href="#7.12">&lt;math.h&gt;</a>
12034 double nan(const char *tagp);
12035 float nanf(const char *tagp);
12036 long double nanl(const char *tagp);
12037 </pre>
12038 <h6>Description</h6>
12039 <p><!--para 2 -->
12040 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
12041 sequence)", (char**) NULL); the call nan("") is equivalent to
12042 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
12043 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
12044 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
12045 and strtold.
12046 <h6>Returns</h6>
12047 <p><!--para 3 -->
12048 The nan functions return a quiet NaN, if available, with content indicated through tagp.
12049 If the implementation does not support quiet NaNs, the functions return zero.
12050 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
12052 <h5><a name="7.12.11.3" href="#7.12.11.3">7.12.11.3 The nextafter functions</a></h5>
12053 <h6>Synopsis</h6>
12054 <p><!--para 1 -->
12055 <pre>
12056 #include <a href="#7.12">&lt;math.h&gt;</a>
12057 double nextafter(double x, double y);
12058 float nextafterf(float x, float y);
12059 long double nextafterl(long double x, long double y);
12060 </pre>
12061 <h6>Description</h6>
12062 <p><!--para 2 -->
12063 The nextafter functions determine the next representable value, in the type of the
12064 function, after x in the direction of y, where x and y are first converted to the type of the
12065 function.<sup><a href="#note211"><b>211)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
12066 if the magnitude of x is the largest finite value representable in the type and the result is
12067 infinite or not representable in the type.
12068 <h6>Returns</h6>
12069 <p><!--para 3 -->
12070 The nextafter functions return the next representable value in the specified format
12071 after x in the direction of y.
12074 <!--page 250 -->
12076 <h6>footnotes</h6>
12077 <p><small><a name="note211" href="#note211">211)</a> The argument values are converted to the type of the function, even by a macro implementation of the
12078 function.
12079 </small>
12081 <h5><a name="7.12.11.4" href="#7.12.11.4">7.12.11.4 The nexttoward functions</a></h5>
12082 <h6>Synopsis</h6>
12083 <p><!--para 1 -->
12084 <pre>
12085 #include <a href="#7.12">&lt;math.h&gt;</a>
12086 double nexttoward(double x, long double y);
12087 float nexttowardf(float x, long double y);
12088 long double nexttowardl(long double x, long double y);
12089 </pre>
12090 <h6>Description</h6>
12091 <p><!--para 2 -->
12092 The nexttoward functions are equivalent to the nextafter functions except that the
12093 second parameter has type long double and the functions return y converted to the
12094 type of the function if x equals y.<sup><a href="#note212"><b>212)</b></a></sup>
12096 <h6>footnotes</h6>
12097 <p><small><a name="note212" href="#note212">212)</a> The result of the nexttoward functions is determined in the type of the function, without loss of
12098 range or precision in a floating second argument.
12099 </small>
12101 <h4><a name="7.12.12" href="#7.12.12">7.12.12 Maximum, minimum, and positive difference functions</a></h4>
12103 <h5><a name="7.12.12.1" href="#7.12.12.1">7.12.12.1 The fdim functions</a></h5>
12104 <h6>Synopsis</h6>
12105 <p><!--para 1 -->
12106 <pre>
12107 #include <a href="#7.12">&lt;math.h&gt;</a>
12108 double fdim(double x, double y);
12109 float fdimf(float x, float y);
12110 long double fdiml(long double x, long double y);
12111 </pre>
12112 <h6>Description</h6>
12113 <p><!--para 2 -->
12114 The fdim functions determine the positive difference between their arguments:
12115 <pre>
12116 {x - y if x &gt; y
12118 {+0 if x &lt;= y
12119 </pre>
12120 A range error may occur.
12121 <h6>Returns</h6>
12122 <p><!--para 3 -->
12123 The fdim functions return the positive difference value.
12125 <h5><a name="7.12.12.2" href="#7.12.12.2">7.12.12.2 The fmax functions</a></h5>
12126 <h6>Synopsis</h6>
12127 <p><!--para 1 -->
12128 <pre>
12129 #include <a href="#7.12">&lt;math.h&gt;</a>
12130 double fmax(double x, double y);
12131 float fmaxf(float x, float y);
12132 long double fmaxl(long double x, long double y);
12133 </pre>
12137 <!--page 251 -->
12138 <h6>Description</h6>
12139 <p><!--para 2 -->
12140 The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note213"><b>213)</b></a></sup>
12141 <h6>Returns</h6>
12142 <p><!--para 3 -->
12143 The fmax functions return the maximum numeric value of their arguments.
12145 <h6>footnotes</h6>
12146 <p><small><a name="note213" href="#note213">213)</a> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
12147 fmax functions choose the numeric value. See <a href="#F.9.9.2">F.9.9.2</a>.
12148 </small>
12150 <h5><a name="7.12.12.3" href="#7.12.12.3">7.12.12.3 The fmin functions</a></h5>
12151 <h6>Synopsis</h6>
12152 <p><!--para 1 -->
12153 <pre>
12154 #include <a href="#7.12">&lt;math.h&gt;</a>
12155 double fmin(double x, double y);
12156 float fminf(float x, float y);
12157 long double fminl(long double x, long double y);
12158 </pre>
12159 <h6>Description</h6>
12160 <p><!--para 2 -->
12161 The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note214"><b>214)</b></a></sup>
12162 <h6>Returns</h6>
12163 <p><!--para 3 -->
12164 The fmin functions return the minimum numeric value of their arguments.
12166 <h6>footnotes</h6>
12167 <p><small><a name="note214" href="#note214">214)</a> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
12168 </small>
12170 <h4><a name="7.12.13" href="#7.12.13">7.12.13 Floating multiply-add</a></h4>
12172 <h5><a name="7.12.13.1" href="#7.12.13.1">7.12.13.1 The fma functions</a></h5>
12173 <h6>Synopsis</h6>
12174 <p><!--para 1 -->
12175 <pre>
12176 #include <a href="#7.12">&lt;math.h&gt;</a>
12177 double fma(double x, double y, double z);
12178 float fmaf(float x, float y, float z);
12179 long double fmal(long double x, long double y,
12180 long double z);
12181 </pre>
12182 <h6>Description</h6>
12183 <p><!--para 2 -->
12184 The fma functions compute (x y) + z, rounded as one ternary operation: they compute
12185 the value (as if) to infinite precision and round once to the result format, according to the
12186 current rounding mode. A range error may occur.
12187 <h6>Returns</h6>
12188 <p><!--para 3 -->
12189 The fma functions return (x y) + z, rounded as one ternary operation.
12194 <!--page 252 -->
12196 <h4><a name="7.12.14" href="#7.12.14">7.12.14 Comparison macros</a></h4>
12197 <p><!--para 1 -->
12198 The relational and equality operators support the usual mathematical relationships
12199 between numeric values. For any ordered pair of numeric values exactly one of the
12200 relationships -- less, greater, and equal -- is true. Relational operators may raise the
12201 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
12202 numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note215"><b>215)</b></a></sup> The following
12203 subclauses provide macros that are quiet (non floating-point exception raising) versions
12204 of the relational operators, and other comparison macros that facilitate writing efficient
12205 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
12206 the synopses in this subclause, real-floating indicates that the argument shall be an
12207 expression of real floating type.
12209 <h6>footnotes</h6>
12210 <p><small><a name="note215" href="#note215">215)</a> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
12211 the operands compare unordered, as an error indicator for programs written without consideration of
12212 NaNs; the result in these cases is false.
12213 </small>
12215 <h5><a name="7.12.14.1" href="#7.12.14.1">7.12.14.1 The isgreater macro</a></h5>
12216 <h6>Synopsis</h6>
12217 <p><!--para 1 -->
12218 <pre>
12219 #include <a href="#7.12">&lt;math.h&gt;</a>
12220 int isgreater(real-floating x, real-floating y);
12221 </pre>
12222 <h6>Description</h6>
12223 <p><!--para 2 -->
12224 The isgreater macro determines whether its first argument is greater than its second
12225 argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
12226 unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
12227 exception when x and y are unordered.
12228 <h6>Returns</h6>
12229 <p><!--para 3 -->
12230 The isgreater macro returns the value of (x) &gt; (y).
12232 <h5><a name="7.12.14.2" href="#7.12.14.2">7.12.14.2 The isgreaterequal macro</a></h5>
12233 <h6>Synopsis</h6>
12234 <p><!--para 1 -->
12235 <pre>
12236 #include <a href="#7.12">&lt;math.h&gt;</a>
12237 int isgreaterequal(real-floating x, real-floating y);
12238 </pre>
12239 <h6>Description</h6>
12240 <p><!--para 2 -->
12241 The isgreaterequal macro determines whether its first argument is greater than or
12242 equal to its second argument. The value of isgreaterequal(x, y) is always equal
12243 to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
12244 not raise the ''invalid'' floating-point exception when x and y are unordered.
12248 <!--page 253 -->
12249 <h6>Returns</h6>
12250 <p><!--para 3 -->
12251 The isgreaterequal macro returns the value of (x) &gt;= (y).
12253 <h5><a name="7.12.14.3" href="#7.12.14.3">7.12.14.3 The isless macro</a></h5>
12254 <h6>Synopsis</h6>
12255 <p><!--para 1 -->
12256 <pre>
12257 #include <a href="#7.12">&lt;math.h&gt;</a>
12258 int isless(real-floating x, real-floating y);
12259 </pre>
12260 <h6>Description</h6>
12261 <p><!--para 2 -->
12262 The isless macro determines whether its first argument is less than its second
12263 argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
12264 unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
12265 exception when x and y are unordered.
12266 <h6>Returns</h6>
12267 <p><!--para 3 -->
12268 The isless macro returns the value of (x) &lt; (y).
12270 <h5><a name="7.12.14.4" href="#7.12.14.4">7.12.14.4 The islessequal macro</a></h5>
12271 <h6>Synopsis</h6>
12272 <p><!--para 1 -->
12273 <pre>
12274 #include <a href="#7.12">&lt;math.h&gt;</a>
12275 int islessequal(real-floating x, real-floating y);
12276 </pre>
12277 <h6>Description</h6>
12278 <p><!--para 2 -->
12279 The islessequal macro determines whether its first argument is less than or equal to
12280 its second argument. The value of islessequal(x, y) is always equal to
12281 (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
12282 the ''invalid'' floating-point exception when x and y are unordered.
12283 <h6>Returns</h6>
12284 <p><!--para 3 -->
12285 The islessequal macro returns the value of (x) &lt;= (y).
12287 <h5><a name="7.12.14.5" href="#7.12.14.5">7.12.14.5 The islessgreater macro</a></h5>
12288 <h6>Synopsis</h6>
12289 <p><!--para 1 -->
12290 <pre>
12291 #include <a href="#7.12">&lt;math.h&gt;</a>
12292 int islessgreater(real-floating x, real-floating y);
12293 </pre>
12294 <h6>Description</h6>
12295 <p><!--para 2 -->
12296 The islessgreater macro determines whether its first argument is less than or
12297 greater than its second argument. The islessgreater(x, y) macro is similar to
12298 (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
12299 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
12300 and y twice).
12301 <!--page 254 -->
12302 <h6>Returns</h6>
12303 <p><!--para 3 -->
12304 The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
12306 <h5><a name="7.12.14.6" href="#7.12.14.6">7.12.14.6 The isunordered macro</a></h5>
12307 <h6>Synopsis</h6>
12308 <p><!--para 1 -->
12309 <pre>
12310 #include <a href="#7.12">&lt;math.h&gt;</a>
12311 int isunordered(real-floating x, real-floating y);
12312 </pre>
12313 <h6>Description</h6>
12314 <p><!--para 2 -->
12315 The isunordered macro determines whether its arguments are unordered.
12316 <h6>Returns</h6>
12317 <p><!--para 3 -->
12318 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
12319 <!--page 255 -->
12321 <h3><a name="7.13" href="#7.13">7.13 Nonlocal jumps <setjmp.h></a></h3>
12322 <p><!--para 1 -->
12323 The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
12324 one type, for bypassing the normal function call and return discipline.<sup><a href="#note216"><b>216)</b></a></sup>
12325 <p><!--para 2 -->
12326 The type declared is
12327 <pre>
12328 jmp_buf
12329 </pre>
12330 which is an array type suitable for holding the information needed to restore a calling
12331 environment. The environment of a call to the setjmp macro consists of information
12332 sufficient for a call to the longjmp function to return execution to the correct block and
12333 invocation of that block, were it called recursively. It does not include the state of the
12334 floating-point status flags, of open files, or of any other component of the abstract
12335 machine.
12336 <p><!--para 3 -->
12337 It is unspecified whether setjmp is a macro or an identifier declared with external
12338 linkage. If a macro definition is suppressed in order to access an actual function, or a
12339 program defines an external identifier with the name setjmp, the behavior is undefined.
12341 <h6>footnotes</h6>
12342 <p><small><a name="note216" href="#note216">216)</a> These functions are useful for dealing with unusual conditions encountered in a low-level function of
12343 a program.
12344 </small>
12346 <h4><a name="7.13.1" href="#7.13.1">7.13.1 Save calling environment</a></h4>
12348 <h5><a name="7.13.1.1" href="#7.13.1.1">7.13.1.1 The setjmp macro</a></h5>
12349 <h6>Synopsis</h6>
12350 <p><!--para 1 -->
12351 <pre>
12352 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12353 int setjmp(jmp_buf env);
12354 </pre>
12355 <h6>Description</h6>
12356 <p><!--para 2 -->
12357 The setjmp macro saves its calling environment in its jmp_buf argument for later use
12358 by the longjmp function.
12359 <h6>Returns</h6>
12360 <p><!--para 3 -->
12361 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
12362 return is from a call to the longjmp function, the setjmp macro returns a nonzero
12363 value.
12364 <h6>Environmental limits</h6>
12365 <p><!--para 4 -->
12366 An invocation of the setjmp macro shall appear only in one of the following contexts:
12367 <ul>
12368 <li> the entire controlling expression of a selection or iteration statement;
12369 <li> one operand of a relational or equality operator with the other operand an integer
12370 constant expression, with the resulting expression being the entire controlling
12373 <!--page 256 -->
12374 expression of a selection or iteration statement;
12375 <li> the operand of a unary ! operator with the resulting expression being the entire
12376 controlling expression of a selection or iteration statement; or
12377 <li> the entire expression of an expression statement (possibly cast to void).
12378 </ul>
12379 <p><!--para 5 -->
12380 If the invocation appears in any other context, the behavior is undefined.
12382 <h4><a name="7.13.2" href="#7.13.2">7.13.2 Restore calling environment</a></h4>
12384 <h5><a name="7.13.2.1" href="#7.13.2.1">7.13.2.1 The longjmp function</a></h5>
12385 <h6>Synopsis</h6>
12386 <p><!--para 1 -->
12387 <pre>
12388 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12389 void longjmp(jmp_buf env, int val);
12390 </pre>
12391 <h6>Description</h6>
12392 <p><!--para 2 -->
12393 The longjmp function restores the environment saved by the most recent invocation of
12394 the setjmp macro in the same invocation of the program with the corresponding
12395 jmp_buf argument. If there has been no such invocation, or if the function containing
12396 the invocation of the setjmp macro has terminated execution<sup><a href="#note217"><b>217)</b></a></sup> in the interim, or if the
12397 invocation of the setjmp macro was within the scope of an identifier with variably
12398 modified type and execution has left that scope in the interim, the behavior is undefined.
12399 <p><!--para 3 -->
12400 All accessible objects have values, and all other components of the abstract machine<sup><a href="#note218"><b>218)</b></a></sup>
12401 have state, as of the time the longjmp function was called, except that the values of
12402 objects of automatic storage duration that are local to the function containing the
12403 invocation of the corresponding setjmp macro that do not have volatile-qualified type
12404 and have been changed between the setjmp invocation and longjmp call are
12405 indeterminate.
12406 <h6>Returns</h6>
12407 <p><!--para 4 -->
12408 After longjmp is completed, program execution continues as if the corresponding
12409 invocation of the setjmp macro had just returned the value specified by val. The
12410 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
12411 the setjmp macro returns the value 1.
12412 <p><!--para 5 -->
12413 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
12414 might cause memory associated with a variable length array object to be squandered.
12419 <!--page 257 -->
12420 <!--page 258 -->
12421 <pre>
12422 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12423 jmp_buf buf;
12424 void g(int n);
12425 void h(int n);
12426 int n = 6;
12427 void f(void)
12429 int x[n]; // valid: f is not terminated
12430 setjmp(buf);
12431 g(n);
12433 void g(int n)
12435 int a[n]; // a may remain allocated
12436 h(n);
12438 void h(int n)
12440 int b[n]; // b may remain allocated
12441 longjmp(buf, 2); // might cause memory loss
12443 </pre>
12445 <h6>footnotes</h6>
12446 <p><small><a name="note217" href="#note217">217)</a> For example, by executing a return statement or because another longjmp call has caused a
12447 transfer to a setjmp invocation in a function earlier in the set of nested calls.
12448 </small>
12449 <p><small><a name="note218" href="#note218">218)</a> This includes, but is not limited to, the floating-point status flags and the state of open files.
12450 </small>
12452 <h3><a name="7.14" href="#7.14">7.14 Signal handling <signal.h></a></h3>
12453 <p><!--para 1 -->
12454 The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
12455 for handling various signals (conditions that may be reported during program execution).
12456 <p><!--para 2 -->
12457 The type defined is
12458 <pre>
12459 sig_atomic_t
12460 </pre>
12461 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
12462 an atomic entity, even in the presence of asynchronous interrupts.
12463 <p><!--para 3 -->
12464 The macros defined are
12465 <pre>
12466 SIG_DFL
12467 SIG_ERR
12468 SIG_IGN
12469 </pre>
12470 which expand to constant expressions with distinct values that have type compatible with
12471 the second argument to, and the return value of, the signal function, and whose values
12472 compare unequal to the address of any declarable function; and the following, which
12473 expand to positive integer constant expressions with type int and distinct values that are
12474 the signal numbers, each corresponding to the specified condition:
12475 <p><!--para 4 -->
12476 <pre>
12477 SIGABRT abnormal termination, such as is initiated by the abort function
12478 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
12479 resulting in overflow
12480 SIGILL detection of an invalid function image, such as an invalid instruction
12481 SIGINT receipt of an interactive attention signal
12482 SIGSEGV an invalid access to storage
12483 SIGTERM a termination request sent to the program
12484 </pre>
12485 An implementation need not generate any of these signals, except as a result of explicit
12486 calls to the raise function. Additional signals and pointers to undeclarable functions,
12487 with macro definitions beginning, respectively, with the letters SIG and an uppercase
12488 letter or with SIG_ and an uppercase letter,<sup><a href="#note219"><b>219)</b></a></sup> may also be specified by the
12489 implementation. The complete set of signals, their semantics, and their default handling
12490 is implementation-defined; all signal numbers shall be positive.
12495 <!--page 259 -->
12497 <h6>footnotes</h6>
12498 <p><small><a name="note219" href="#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
12499 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
12500 and termination.
12501 </small>
12503 <h4><a name="7.14.1" href="#7.14.1">7.14.1 Specify signal handling</a></h4>
12505 <h5><a name="7.14.1.1" href="#7.14.1.1">7.14.1.1 The signal function</a></h5>
12506 <h6>Synopsis</h6>
12507 <p><!--para 1 -->
12508 <pre>
12509 #include <a href="#7.14">&lt;signal.h&gt;</a>
12510 void (*signal(int sig, void (*func)(int)))(int);
12511 </pre>
12512 <h6>Description</h6>
12513 <p><!--para 2 -->
12514 The signal function chooses one of three ways in which receipt of the signal number
12515 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
12516 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
12517 Otherwise, func shall point to a function to be called when that signal occurs. An
12518 invocation of such a function because of a signal, or (recursively) of any further functions
12519 called by that invocation (other than functions in the standard library), is called a signal
12520 handler.
12521 <p><!--para 3 -->
12522 When a signal occurs and func points to a function, it is implementation-defined
12523 whether the equivalent of signal(sig, SIG_DFL); is executed or the
12524 implementation prevents some implementation-defined set of signals (at least including
12525 sig) from occurring until the current signal handling has completed; in the case of
12526 SIGILL, the implementation may alternatively define that no action is taken. Then the
12527 equivalent of (*func)(sig); is executed. If and when the function returns, if the
12528 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
12529 value corresponding to a computational exception, the behavior is undefined; otherwise
12530 the program will resume execution at the point it was interrupted.
12531 <p><!--para 4 -->
12532 If the signal occurs as the result of calling the abort or raise function, the signal
12533 handler shall not call the raise function.
12534 <p><!--para 5 -->
12535 If the signal occurs other than as the result of calling the abort or raise function, the
12536 behavior is undefined if the signal handler refers to any object with static storage duration
12537 other than by assigning a value to an object declared as volatile sig_atomic_t, or
12538 the signal handler calls any function in the standard library other than the abort
12539 function, the _Exit function, or the signal function with the first argument equal to
12540 the signal number corresponding to the signal that caused the invocation of the handler.
12541 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
12542 value of errno is indeterminate.<sup><a href="#note220"><b>220)</b></a></sup>
12543 <p><!--para 6 -->
12544 At program startup, the equivalent of
12545 <pre>
12546 signal(sig, SIG_IGN);
12547 </pre>
12550 <!--page 260 -->
12551 may be executed for some signals selected in an implementation-defined manner; the
12552 equivalent of
12553 <pre>
12554 signal(sig, SIG_DFL);
12555 </pre>
12556 is executed for all other signals defined by the implementation.
12557 <p><!--para 7 -->
12558 The implementation shall behave as if no library function calls the signal function.
12559 <h6>Returns</h6>
12560 <p><!--para 8 -->
12561 If the request can be honored, the signal function returns the value of func for the
12562 most recent successful call to signal for the specified signal sig. Otherwise, a value of
12563 SIG_ERR is returned and a positive value is stored in errno.
12564 <p><b> Forward references</b>: 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
12565 _Exit function (<a href="#7.20.4.4">7.20.4.4</a>).
12567 <h6>footnotes</h6>
12568 <p><small><a name="note220" href="#note220">220)</a> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
12569 </small>
12571 <h4><a name="7.14.2" href="#7.14.2">7.14.2 Send signal</a></h4>
12573 <h5><a name="7.14.2.1" href="#7.14.2.1">7.14.2.1 The raise function</a></h5>
12574 <h6>Synopsis</h6>
12575 <p><!--para 1 -->
12576 <pre>
12577 #include <a href="#7.14">&lt;signal.h&gt;</a>
12578 int raise(int sig);
12579 </pre>
12580 <h6>Description</h6>
12581 <p><!--para 2 -->
12582 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
12583 signal handler is called, the raise function shall not return until after the signal handler
12584 does.
12585 <h6>Returns</h6>
12586 <p><!--para 3 -->
12587 The raise function returns zero if successful, nonzero if unsuccessful.
12588 <!--page 261 -->
12590 <h3><a name="7.15" href="#7.15">7.15 Variable arguments <stdarg.h></a></h3>
12591 <p><!--para 1 -->
12592 The header <a href="#7.15">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
12593 through a list of arguments whose number and types are not known to the called function
12594 when it is translated.
12595 <p><!--para 2 -->
12596 A function may be called with a variable number of arguments of varying types. As
12597 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
12598 parameter plays a special role in the access mechanism, and will be designated parmN in
12599 this description.
12600 <p><!--para 3 -->
12601 The type declared is
12602 <pre>
12603 va_list
12604 </pre>
12605 which is an object type suitable for holding information needed by the macros
12606 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
12607 desired, the called function shall declare an object (generally referred to as ap in this
12608 subclause) having type va_list. The object ap may be passed as an argument to
12609 another function; if that function invokes the va_arg macro with parameter ap, the
12610 value of ap in the calling function is indeterminate and shall be passed to the va_end
12611 macro prior to any further reference to ap.<sup><a href="#note221"><b>221)</b></a></sup>
12613 <h6>footnotes</h6>
12614 <p><small><a name="note221" href="#note221">221)</a> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
12615 case the original function may make further use of the original list after the other function returns.
12616 </small>
12618 <h4><a name="7.15.1" href="#7.15.1">7.15.1 Variable argument list access macros</a></h4>
12619 <p><!--para 1 -->
12620 The va_start and va_arg macros described in this subclause shall be implemented
12621 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
12622 identifiers declared with external linkage. If a macro definition is suppressed in order to
12623 access an actual function, or a program defines an external identifier with the same name,
12624 the behavior is undefined. Each invocation of the va_start and va_copy macros
12625 shall be matched by a corresponding invocation of the va_end macro in the same
12626 function.
12628 <h5><a name="7.15.1.1" href="#7.15.1.1">7.15.1.1 The va_arg macro</a></h5>
12629 <h6>Synopsis</h6>
12630 <p><!--para 1 -->
12631 <pre>
12632 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
12633 type va_arg(va_list ap, type);
12634 </pre>
12635 <h6>Description</h6>
12636 <p><!--para 2 -->
12637 The va_arg macro expands to an expression that has the specified type and the value of
12638 the next argument in the call. The parameter ap shall have been initialized by the
12639 va_start or va_copy macro (without an intervening invocation of the va_end
12641 <!--page 262 -->
12642 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
12643 values of successive arguments are returned in turn. The parameter type shall be a type
12644 name specified such that the type of a pointer to an object that has the specified type can
12645 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
12646 type is not compatible with the type of the actual next argument (as promoted according
12647 to the default argument promotions), the behavior is undefined, except for the following
12648 cases:
12649 <ul>
12650 <li> one type is a signed integer type, the other type is the corresponding unsigned integer
12651 type, and the value is representable in both types;
12652 <li> one type is pointer to void and the other is a pointer to a character type.
12653 </ul>
12654 <h6>Returns</h6>
12655 <p><!--para 3 -->
12656 The first invocation of the va_arg macro after that of the va_start macro returns the
12657 value of the argument after that specified by parmN . Successive invocations return the
12658 values of the remaining arguments in succession.
12660 <h5><a name="7.15.1.2" href="#7.15.1.2">7.15.1.2 The va_copy macro</a></h5>
12661 <h6>Synopsis</h6>
12662 <p><!--para 1 -->
12663 <pre>
12664 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
12665 void va_copy(va_list dest, va_list src);
12666 </pre>
12667 <h6>Description</h6>
12668 <p><!--para 2 -->
12669 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
12670 been applied to dest followed by the same sequence of uses of the va_arg macro as
12671 had previously been used to reach the present state of src. Neither the va_copy nor
12672 va_start macro shall be invoked to reinitialize dest without an intervening
12673 invocation of the va_end macro for the same dest.
12674 <h6>Returns</h6>
12675 <p><!--para 3 -->
12676 The va_copy macro returns no value.
12678 <h5><a name="7.15.1.3" href="#7.15.1.3">7.15.1.3 The va_end macro</a></h5>
12679 <h6>Synopsis</h6>
12680 <p><!--para 1 -->
12681 <pre>
12682 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
12683 void va_end(va_list ap);
12684 </pre>
12685 <h6>Description</h6>
12686 <p><!--para 2 -->
12687 The va_end macro facilitates a normal return from the function whose variable
12688 argument list was referred to by the expansion of the va_start macro, or the function
12689 containing the expansion of the va_copy macro, that initialized the va_list ap. The
12690 va_end macro may modify ap so that it is no longer usable (without being reinitialized
12691 <!--page 263 -->
12692 by the va_start or va_copy macro). If there is no corresponding invocation of the
12693 va_start or va_copy macro, or if the va_end macro is not invoked before the
12694 return, the behavior is undefined.
12695 <h6>Returns</h6>
12696 <p><!--para 3 -->
12697 The va_end macro returns no value.
12699 <h5><a name="7.15.1.4" href="#7.15.1.4">7.15.1.4 The va_start macro</a></h5>
12700 <h6>Synopsis</h6>
12701 <p><!--para 1 -->
12702 <pre>
12703 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
12704 void va_start(va_list ap, parmN);
12705 </pre>
12706 <h6>Description</h6>
12707 <p><!--para 2 -->
12708 The va_start macro shall be invoked before any access to the unnamed arguments.
12709 <p><!--para 3 -->
12710 The va_start macro initializes ap for subsequent use by the va_arg and va_end
12711 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
12712 without an intervening invocation of the va_end macro for the same ap.
12713 <p><!--para 4 -->
12714 The parameter parmN is the identifier of the rightmost parameter in the variable
12715 parameter list in the function definition (the one just before the , ...). If the parameter
12716 parmN is declared with the register storage class, with a function or array type, or
12717 with a type that is not compatible with the type that results after application of the default
12718 argument promotions, the behavior is undefined.
12719 <h6>Returns</h6>
12720 <p><!--para 5 -->
12721 The va_start macro returns no value.
12722 <p><!--para 6 -->
12723 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
12724 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
12725 pointers is specified by the first argument to f1.
12726 <!--page 264 -->
12727 <pre>
12728 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
12729 #define MAXARGS 31
12730 void f1(int n_ptrs, ...)
12732 va_list ap;
12733 char *array[MAXARGS];
12734 int ptr_no = 0;
12735 if (n_ptrs &gt; MAXARGS)
12736 n_ptrs = MAXARGS;
12737 va_start(ap, n_ptrs);
12738 while (ptr_no &lt; n_ptrs)
12739 array[ptr_no++] = va_arg(ap, char *);
12740 va_end(ap);
12741 f2(n_ptrs, array);
12743 </pre>
12744 Each call to f1 is required to have visible the definition of the function or a declaration such as
12745 <pre>
12746 void f1(int, ...);
12747 </pre>
12749 <p><!--para 7 -->
12750 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
12751 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
12752 is gathered again and passed to function f4.
12753 <!--page 265 -->
12754 <pre>
12755 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
12756 #define MAXARGS 31
12757 void f3(int n_ptrs, int f4_after, ...)
12759 va_list ap, ap_save;
12760 char *array[MAXARGS];
12761 int ptr_no = 0;
12762 if (n_ptrs &gt; MAXARGS)
12763 n_ptrs = MAXARGS;
12764 va_start(ap, f4_after);
12765 while (ptr_no &lt; n_ptrs) {
12766 array[ptr_no++] = va_arg(ap, char *);
12767 if (ptr_no == f4_after)
12768 va_copy(ap_save, ap);
12770 va_end(ap);
12771 f2(n_ptrs, array);
12772 // Now process the saved copy.
12773 n_ptrs -= f4_after;
12774 ptr_no = 0;
12775 while (ptr_no &lt; n_ptrs)
12776 array[ptr_no++] = va_arg(ap_save, char *);
12777 va_end(ap_save);
12778 f4(n_ptrs, array);
12780 </pre>
12782 <h3><a name="7.16" href="#7.16">7.16 Boolean type and values <stdbool.h></a></h3>
12783 <p><!--para 1 -->
12784 The header <a href="#7.16">&lt;stdbool.h&gt;</a> defines four macros.
12785 <p><!--para 2 -->
12786 The macro
12787 <pre>
12788 bool
12789 </pre>
12790 expands to _Bool.
12791 <p><!--para 3 -->
12792 The remaining three macros are suitable for use in #if preprocessing directives. They
12794 <pre>
12795 true
12796 </pre>
12797 which expands to the integer constant 1,
12798 <pre>
12799 false
12800 </pre>
12801 which expands to the integer constant 0, and
12802 <pre>
12803 __bool_true_false_are_defined
12804 </pre>
12805 which expands to the integer constant 1.
12806 <p><!--para 4 -->
12807 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
12808 redefine the macros bool, true, and false.<sup><a href="#note222"><b>222)</b></a></sup>
12813 <!--page 266 -->
12815 <h6>footnotes</h6>
12816 <p><small><a name="note222" href="#note222">222)</a> See ''future library directions'' (<a href="#7.26.7">7.26.7</a>).
12817 </small>
12819 <h3><a name="7.17" href="#7.17">7.17 Common definitions <stddef.h></a></h3>
12820 <p><!--para 1 -->
12821 The following types and macros are defined in the standard header <a href="#7.17">&lt;stddef.h&gt;</a>. Some
12822 are also defined in other headers, as noted in their respective subclauses.
12823 <p><!--para 2 -->
12824 The types are
12825 <pre>
12826 ptrdiff_t
12827 </pre>
12828 which is the signed integer type of the result of subtracting two pointers;
12829 <pre>
12830 size_t
12831 </pre>
12832 which is the unsigned integer type of the result of the sizeof operator; and
12833 <pre>
12834 wchar_t
12835 </pre>
12836 which is an integer type whose range of values can represent distinct codes for all
12837 members of the largest extended character set specified among the supported locales; the
12838 null character shall have the code value zero. Each member of the basic character set
12839 shall have a code value equal to its value when used as the lone character in an integer
12840 character constant if an implementation does not define
12841 __STDC_MB_MIGHT_NEQ_WC__.
12842 <p><!--para 3 -->
12843 The macros are
12844 <pre>
12845 NULL
12846 </pre>
12847 which expands to an implementation-defined null pointer constant; and
12848 <pre>
12849 offsetof(type, member-designator)
12850 </pre>
12851 which expands to an integer constant expression that has type size_t, the value of
12852 which is the offset in bytes, to the structure member (designated by member-designator),
12853 from the beginning of its structure (designated by type). The type and member designator
12854 shall be such that given
12855 <pre>
12856 static type t;
12857 </pre>
12858 then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
12859 specified member is a bit-field, the behavior is undefined.)
12860 <h6>Recommended practice</h6>
12861 <p><!--para 4 -->
12862 The types used for size_t and ptrdiff_t should not have an integer conversion rank
12863 greater than that of signed long int unless the implementation supports objects
12864 large enough to make this necessary.
12865 <p><b> Forward references</b>: localization (<a href="#7.11">7.11</a>).
12866 <!--page 267 -->
12868 <h3><a name="7.18" href="#7.18">7.18 Integer types <stdint.h></a></h3>
12869 <p><!--para 1 -->
12870 The header <a href="#7.18">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
12871 defines corresponding sets of macros.<sup><a href="#note223"><b>223)</b></a></sup> It also defines macros that specify limits of
12872 integer types corresponding to types defined in other standard headers.
12873 <p><!--para 2 -->
12874 Types are defined in the following categories:
12875 <ul>
12876 <li> integer types having certain exact widths;
12877 <li> integer types having at least certain specified widths;
12878 <li> fastest integer types having at least certain specified widths;
12879 <li> integer types wide enough to hold pointers to objects;
12880 <li> integer types having greatest width.
12881 </ul>
12882 (Some of these types may denote the same type.)
12883 <p><!--para 3 -->
12884 Corresponding macros specify limits of the declared types and construct suitable
12885 constants.
12886 <p><!--para 4 -->
12887 For each type described herein that the implementation provides,<sup><a href="#note224"><b>224)</b></a></sup> <a href="#7.18">&lt;stdint.h&gt;</a> shall
12888 declare that typedef name and define the associated macros. Conversely, for each type
12889 described herein that the implementation does not provide, <a href="#7.18">&lt;stdint.h&gt;</a> shall not
12890 declare that typedef name nor shall it define the associated macros. An implementation
12891 shall provide those types described as ''required'', but need not provide any of the others
12892 (described as ''optional'').
12894 <h6>footnotes</h6>
12895 <p><small><a name="note223" href="#note223">223)</a> See ''future library directions'' (<a href="#7.26.8">7.26.8</a>).
12896 </small>
12897 <p><small><a name="note224" href="#note224">224)</a> Some of these types may denote implementation-defined extended integer types.
12898 </small>
12900 <h4><a name="7.18.1" href="#7.18.1">7.18.1 Integer types</a></h4>
12901 <p><!--para 1 -->
12902 When typedef names differing only in the absence or presence of the initial u are defined,
12903 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
12904 implementation providing one of these corresponding types shall also provide the other.
12905 <p><!--para 2 -->
12906 In the following descriptions, the symbol N represents an unsigned decimal integer with
12907 no leading zeros (e.g., 8 or 24, but not 04 or 048).
12912 <!--page 268 -->
12914 <h5><a name="7.18.1.1" href="#7.18.1.1">7.18.1.1 Exact-width integer types</a></h5>
12915 <p><!--para 1 -->
12916 The typedef name intN_t designates a signed integer type with width N , no padding
12917 bits, and a two's complement representation. Thus, int8_t denotes a signed integer
12918 type with a width of exactly 8 bits.
12919 <p><!--para 2 -->
12920 The typedef name uintN_t designates an unsigned integer type with width N . Thus,
12921 uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
12922 <p><!--para 3 -->
12923 These types are optional. However, if an implementation provides integer types with
12924 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
12925 two's complement representation, it shall define the corresponding typedef names.
12927 <h5><a name="7.18.1.2" href="#7.18.1.2">7.18.1.2 Minimum-width integer types</a></h5>
12928 <p><!--para 1 -->
12929 The typedef name int_leastN_t designates a signed integer type with a width of at
12930 least N , such that no signed integer type with lesser size has at least the specified width.
12931 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
12932 <p><!--para 2 -->
12933 The typedef name uint_leastN_t designates an unsigned integer type with a width
12934 of at least N , such that no unsigned integer type with lesser size has at least the specified
12935 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
12936 least 16 bits.
12937 <p><!--para 3 -->
12938 The following types are required:
12939 <pre>
12940 int_least8_t uint_least8_t
12941 int_least16_t uint_least16_t
12942 int_least32_t uint_least32_t
12943 int_least64_t uint_least64_t
12944 </pre>
12945 All other types of this form are optional.
12947 <h5><a name="7.18.1.3" href="#7.18.1.3">7.18.1.3 Fastest minimum-width integer types</a></h5>
12948 <p><!--para 1 -->
12949 Each of the following types designates an integer type that is usually fastest<sup><a href="#note225"><b>225)</b></a></sup> to operate
12950 with among all integer types that have at least the specified width.
12951 <p><!--para 2 -->
12952 The typedef name int_fastN_t designates the fastest signed integer type with a width
12953 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
12954 type with a width of at least N .
12959 <!--page 269 -->
12960 <p><!--para 3 -->
12961 The following types are required:
12962 <pre>
12963 int_fast8_t uint_fast8_t
12964 int_fast16_t uint_fast16_t
12965 int_fast32_t uint_fast32_t
12966 int_fast64_t uint_fast64_t
12967 </pre>
12968 All other types of this form are optional.
12970 <h6>footnotes</h6>
12971 <p><small><a name="note225" href="#note225">225)</a> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
12972 grounds for choosing one type over another, it will simply pick some integer type satisfying the
12973 signedness and width requirements.
12974 </small>
12976 <h5><a name="7.18.1.4" href="#7.18.1.4">7.18.1.4 Integer types capable of holding object pointers</a></h5>
12977 <p><!--para 1 -->
12978 The following type designates a signed integer type with the property that any valid
12979 pointer to void can be converted to this type, then converted back to pointer to void,
12980 and the result will compare equal to the original pointer:
12981 <pre>
12982 intptr_t
12983 </pre>
12984 The following type designates an unsigned integer type with the property that any valid
12985 pointer to void can be converted to this type, then converted back to pointer to void,
12986 and the result will compare equal to the original pointer:
12987 <pre>
12988 uintptr_t
12989 </pre>
12990 These types are optional.
12992 <h5><a name="7.18.1.5" href="#7.18.1.5">7.18.1.5 Greatest-width integer types</a></h5>
12993 <p><!--para 1 -->
12994 The following type designates a signed integer type capable of representing any value of
12995 any signed integer type:
12996 <pre>
12997 intmax_t
12998 </pre>
12999 The following type designates an unsigned integer type capable of representing any value
13000 of any unsigned integer type:
13001 <pre>
13002 uintmax_t
13003 </pre>
13004 These types are required.
13006 <h4><a name="7.18.2" href="#7.18.2">7.18.2 Limits of specified-width integer types</a></h4>
13007 <p><!--para 1 -->
13008 The following object-like macros<sup><a href="#note226"><b>226)</b></a></sup> specify the minimum and maximum limits of the
13009 types declared in <a href="#7.18">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
13010 <a href="#7.18.1">7.18.1</a>.
13011 <p><!--para 2 -->
13012 Each instance of any defined macro shall be replaced by a constant expression suitable
13013 for use in #if preprocessing directives, and this expression shall have the same type as
13014 would an expression that is an object of the corresponding type converted according to
13016 <!--page 270 -->
13017 the integer promotions. Its implementation-defined value shall be equal to or greater in
13018 magnitude (absolute value) than the corresponding value given below, with the same sign,
13019 except where stated to be exactly the given value.
13021 <h6>footnotes</h6>
13022 <p><small><a name="note226" href="#note226">226)</a> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
13023 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
13024 </small>
13026 <h5><a name="7.18.2.1" href="#7.18.2.1">7.18.2.1 Limits of exact-width integer types</a></h5>
13027 <p><!--para 1 -->
13028 <ul>
13029 <li> minimum values of exact-width signed integer types
13030 <pre>
13031 INTN_MIN exactly -(2<sup>N-1</sup>)
13032 </pre>
13033 <li> maximum values of exact-width signed integer types
13034 <pre>
13035 INTN_MAX exactly 2<sup>N-1</sup> - 1
13036 </pre>
13037 <li> maximum values of exact-width unsigned integer types
13038 <pre>
13039 UINTN_MAX exactly 2<sup>N</sup> - 1
13040 </pre>
13041 </ul>
13043 <h5><a name="7.18.2.2" href="#7.18.2.2">7.18.2.2 Limits of minimum-width integer types</a></h5>
13044 <p><!--para 1 -->
13045 <ul>
13046 <li> minimum values of minimum-width signed integer types
13047 <pre>
13048 INT_LEASTN_MIN -(2<sup>N-1</sup> - 1)
13049 </pre>
13050 <li> maximum values of minimum-width signed integer types
13051 <pre>
13052 INT_LEASTN_MAX 2<sup>N-1</sup> - 1
13053 </pre>
13054 <li> maximum values of minimum-width unsigned integer types
13055 <pre>
13056 UINT_LEASTN_MAX 2<sup>N</sup> - 1
13057 </pre>
13058 </ul>
13060 <h5><a name="7.18.2.3" href="#7.18.2.3">7.18.2.3 Limits of fastest minimum-width integer types</a></h5>
13061 <p><!--para 1 -->
13062 <ul>
13063 <li> minimum values of fastest minimum-width signed integer types
13064 <pre>
13065 INT_FASTN_MIN -(2<sup>N-1</sup> - 1)
13066 </pre>
13067 <li> maximum values of fastest minimum-width signed integer types
13068 <pre>
13069 INT_FASTN_MAX 2<sup>N-1</sup> - 1
13070 </pre>
13071 <li> maximum values of fastest minimum-width unsigned integer types
13072 <pre>
13073 UINT_FASTN_MAX 2<sup>N</sup> - 1
13074 </pre>
13075 </ul>
13077 <h5><a name="7.18.2.4" href="#7.18.2.4">7.18.2.4 Limits of integer types capable of holding object pointers</a></h5>
13078 <p><!--para 1 -->
13079 <ul>
13080 <li> minimum value of pointer-holding signed integer type
13081 <pre>
13082 INTPTR_MIN -(2<sup>15</sup> - 1)
13083 </pre>
13084 <li> maximum value of pointer-holding signed integer type
13085 <!--page 271 -->
13086 <pre>
13087 INTPTR_MAX 2<sup>15</sup> - 1
13088 </pre>
13089 <li> maximum value of pointer-holding unsigned integer type
13090 <pre>
13091 UINTPTR_MAX 2<sup>16</sup> - 1
13092 </pre>
13093 </ul>
13095 <h5><a name="7.18.2.5" href="#7.18.2.5">7.18.2.5 Limits of greatest-width integer types</a></h5>
13096 <p><!--para 1 -->
13097 <ul>
13098 <li> minimum value of greatest-width signed integer type
13099 <pre>
13100 INTMAX_MIN -(2<sup>63</sup> - 1)
13101 </pre>
13102 <li> maximum value of greatest-width signed integer type
13103 <pre>
13104 INTMAX_MAX 2<sup>63</sup> - 1
13105 </pre>
13106 <li> maximum value of greatest-width unsigned integer type
13107 <pre>
13108 UINTMAX_MAX 2<sup>64</sup> - 1
13109 </pre>
13110 </ul>
13112 <h4><a name="7.18.3" href="#7.18.3">7.18.3 Limits of other integer types</a></h4>
13113 <p><!--para 1 -->
13114 The following object-like macros<sup><a href="#note227"><b>227)</b></a></sup> specify the minimum and maximum limits of
13115 integer types corresponding to types defined in other standard headers.
13116 <p><!--para 2 -->
13117 Each instance of these macros shall be replaced by a constant expression suitable for use
13118 in #if preprocessing directives, and this expression shall have the same type as would an
13119 expression that is an object of the corresponding type converted according to the integer
13120 promotions. Its implementation-defined value shall be equal to or greater in magnitude
13121 (absolute value) than the corresponding value given below, with the same sign. An
13122 implementation shall define only the macros corresponding to those typedef names it
13123 actually provides.<sup><a href="#note228"><b>228)</b></a></sup>
13124 <ul>
13125 <li> limits of ptrdiff_t
13126 <pre>
13127 PTRDIFF_MIN -65535
13128 PTRDIFF_MAX +65535
13129 </pre>
13130 <li> limits of sig_atomic_t
13131 <pre>
13132 SIG_ATOMIC_MIN see below
13133 SIG_ATOMIC_MAX see below
13134 </pre>
13135 <li> limit of size_t
13136 <pre>
13137 SIZE_MAX 65535
13138 </pre>
13139 <li> limits of wchar_t
13141 <!--page 272 -->
13142 <pre>
13143 WCHAR_MIN see below
13144 WCHAR_MAX see below
13145 </pre>
13146 <li> limits of wint_t
13147 <pre>
13148 WINT_MIN see below
13149 WINT_MAX see below
13150 </pre>
13151 </ul>
13152 <p><!--para 3 -->
13153 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
13154 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
13155 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
13156 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
13157 SIG_ATOMIC_MAX shall be no less than 255.
13158 <p><!--para 4 -->
13159 If wchar_t (see <a href="#7.17">7.17</a>) is defined as a signed integer type, the value of WCHAR_MIN
13160 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
13161 otherwise, wchar_t is defined as an unsigned integer type, and the value of
13162 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>
13163 <p><!--para 5 -->
13164 If wint_t (see <a href="#7.24">7.24</a>) is defined as a signed integer type, the value of WINT_MIN shall
13165 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
13166 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
13167 shall be 0 and the value of WINT_MAX shall be no less than 65535.
13169 <h6>footnotes</h6>
13170 <p><small><a name="note227" href="#note227">227)</a> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
13171 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
13172 </small>
13173 <p><small><a name="note228" href="#note228">228)</a> A freestanding implementation need not provide all of these types.
13174 </small>
13175 <p><small><a name="note229" href="#note229">229)</a> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
13176 character set.
13177 </small>
13179 <h4><a name="7.18.4" href="#7.18.4">7.18.4 Macros for integer constants</a></h4>
13180 <p><!--para 1 -->
13181 The following function-like macros<sup><a href="#note230"><b>230)</b></a></sup> expand to integer constants suitable for
13182 initializing objects that have integer types corresponding to types defined in
13183 <a href="#7.18">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in <a href="#7.18.1.2">7.18.1.2</a> or
13184 <a href="#7.18.1.5">7.18.1.5</a>.
13185 <p><!--para 2 -->
13186 The argument in any instance of these macros shall be an unsuffixed integer constant (as
13187 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.
13188 <p><!--para 3 -->
13189 Each invocation of one of these macros shall expand to an integer constant expression
13190 suitable for use in #if preprocessing directives. The type of the expression shall have
13191 the same type as would an expression of the corresponding type converted according to
13192 the integer promotions. The value of the expression shall be that of the argument.
13197 <!--page 273 -->
13199 <h6>footnotes</h6>
13200 <p><small><a name="note230" href="#note230">230)</a> C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
13201 defined before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
13202 </small>
13204 <h5><a name="7.18.4.1" href="#7.18.4.1">7.18.4.1 Macros for minimum-width integer constants</a></h5>
13205 <p><!--para 1 -->
13206 The macro INTN_C(value) shall expand to an integer constant expression
13207 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
13208 to an integer constant expression corresponding to the type uint_leastN_t. For
13209 example, if uint_least64_t is a name for the type unsigned long long int,
13210 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
13212 <h5><a name="7.18.4.2" href="#7.18.4.2">7.18.4.2 Macros for greatest-width integer constants</a></h5>
13213 <p><!--para 1 -->
13214 The following macro expands to an integer constant expression having the value specified
13215 by its argument and the type intmax_t:
13216 <pre>
13217 INTMAX_C(value)
13218 </pre>
13219 The following macro expands to an integer constant expression having the value specified
13220 by its argument and the type uintmax_t:
13221 <!--page 274 -->
13222 <pre>
13223 UINTMAX_C(value)
13224 </pre>
13226 <h3><a name="7.19" href="#7.19">7.19 Input/output <stdio.h></a></h3>
13228 <h4><a name="7.19.1" href="#7.19.1">7.19.1 Introduction</a></h4>
13229 <p><!--para 1 -->
13230 The header <a href="#7.19">&lt;stdio.h&gt;</a> declares three types, several macros, and many functions for
13231 performing input and output.
13232 <p><!--para 2 -->
13233 The types declared are size_t (described in <a href="#7.17">7.17</a>);
13234 <pre>
13235 FILE
13236 </pre>
13237 which is an object type capable of recording all the information needed to control a
13238 stream, including its file position indicator, a pointer to its associated buffer (if any), an
13239 error indicator that records whether a read/write error has occurred, and an end-of-file
13240 indicator that records whether the end of the file has been reached; and
13241 <pre>
13242 fpos_t
13243 </pre>
13244 which is an object type other than an array type capable of recording all the information
13245 needed to specify uniquely every position within a file.
13246 <p><!--para 3 -->
13247 The macros are NULL (described in <a href="#7.17">7.17</a>);
13248 <pre>
13249 _IOFBF
13250 _IOLBF
13251 _IONBF
13252 </pre>
13253 which expand to integer constant expressions with distinct values, suitable for use as the
13254 third argument to the setvbuf function;
13255 <pre>
13256 BUFSIZ
13257 </pre>
13258 which expands to an integer constant expression that is the size of the buffer used by the
13259 setbuf function;
13260 <pre>
13262 </pre>
13263 which expands to an integer constant expression, with type int and a negative value, that
13264 is returned by several functions to indicate end-of-file, that is, no more input from a
13265 stream;
13266 <pre>
13267 FOPEN_MAX
13268 </pre>
13269 which expands to an integer constant expression that is the minimum number of files that
13270 the implementation guarantees can be open simultaneously;
13271 <pre>
13272 FILENAME_MAX
13273 </pre>
13274 which expands to an integer constant expression that is the size needed for an array of
13275 char large enough to hold the longest file name string that the implementation
13276 <!--page 275 -->
13277 guarantees can be opened;<sup><a href="#note231"><b>231)</b></a></sup>
13278 <pre>
13279 L_tmpnam
13280 </pre>
13281 which expands to an integer constant expression that is the size needed for an array of
13282 char large enough to hold a temporary file name string generated by the tmpnam
13283 function;
13284 <pre>
13285 SEEK_CUR
13286 SEEK_END
13287 SEEK_SET
13288 </pre>
13289 which expand to integer constant expressions with distinct values, suitable for use as the
13290 third argument to the fseek function;
13291 <pre>
13292 TMP_MAX
13293 </pre>
13294 which expands to an integer constant expression that is the maximum number of unique
13295 file names that can be generated by the tmpnam function;
13296 <pre>
13297 stderr
13298 stdin
13299 stdout
13300 </pre>
13301 which are expressions of type ''pointer to FILE'' that point to the FILE objects
13302 associated, respectively, with the standard error, input, and output streams.
13303 <p><!--para 4 -->
13304 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
13305 and output. The wide character input/output functions described in that subclause
13306 provide operations analogous to most of those described here, except that the
13307 fundamental units internal to the program are wide characters. The external
13308 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
13309 described further in <a href="#7.19.3">7.19.3</a>.
13310 <p><!--para 5 -->
13311 The input/output functions are given the following collective terms:
13312 <ul>
13313 <li> The wide character input functions -- those functions described in <a href="#7.24">7.24</a> that perform
13314 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
13315 fwscanf, wscanf, vfwscanf, and vwscanf.
13316 <li> The wide character output functions -- those functions described in <a href="#7.24">7.24</a> that perform
13317 output from wide characters and wide strings: fputwc, fputws, putwc,
13318 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
13321 <!--page 276 -->
13322 <li> The wide character input/output functions -- the union of the ungetwc function, the
13323 wide character input functions, and the wide character output functions.
13324 <li> The byte input/output functions -- those functions described in this subclause that
13325 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
13326 fscanf, fwrite, getc, getchar, gets, printf, putc, putchar, puts,
13327 scanf, ungetc, vfprintf, vfscanf, vprintf, and vscanf.
13328 </ul>
13329 <p><b> Forward references</b>: 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
13330 tmpnam function (<a href="#7.19.4.4">7.19.4.4</a>), <a href="#7.24">&lt;wchar.h&gt;</a> (<a href="#7.24">7.24</a>).
13332 <h6>footnotes</h6>
13333 <p><small><a name="note231" href="#note231">231)</a> If the implementation imposes no practical limit on the length of file name strings, the value of
13334 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
13335 string. Of course, file name string contents are subject to other system-specific constraints; therefore
13336 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
13337 </small>
13339 <h4><a name="7.19.2" href="#7.19.2">7.19.2 Streams</a></h4>
13340 <p><!--para 1 -->
13341 Input and output, whether to or from physical devices such as terminals and tape drives,
13342 or whether to or from files supported on structured storage devices, are mapped into
13343 logical data streams, whose properties are more uniform than their various inputs and
13344 outputs. Two forms of mapping are supported, for text streams and for binary
13345 streams.<sup><a href="#note232"><b>232)</b></a></sup>
13346 <p><!--para 2 -->
13347 A text stream is an ordered sequence of characters composed into lines, each line
13348 consisting of zero or more characters plus a terminating new-line character. Whether the
13349 last line requires a terminating new-line character is implementation-defined. Characters
13350 may have to be added, altered, or deleted on input and output to conform to differing
13351 conventions for representing text in the host environment. Thus, there need not be a one-
13352 to-one correspondence between the characters in a stream and those in the external
13353 representation. Data read in from a text stream will necessarily compare equal to the data
13354 that were earlier written out to that stream only if: the data consist only of printing
13355 characters and the control characters horizontal tab and new-line; no new-line character is
13356 immediately preceded by space characters; and the last character is a new-line character.
13357 Whether space characters that are written out immediately before a new-line character
13358 appear when read in is implementation-defined.
13359 <p><!--para 3 -->
13360 A binary stream is an ordered sequence of characters that can transparently record
13361 internal data. Data read in from a binary stream shall compare equal to the data that were
13362 earlier written out to that stream, under the same implementation. Such a stream may,
13363 however, have an implementation-defined number of null characters appended to the end
13364 of the stream.
13365 <p><!--para 4 -->
13366 Each stream has an orientation. After a stream is associated with an external file, but
13367 before any operations are performed on it, the stream is without orientation. Once a wide
13368 character input/output function has been applied to a stream without orientation, the
13371 <!--page 277 -->
13372 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
13373 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
13374 Only a call to the freopen function or the fwide function can otherwise alter the
13375 orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note233"><b>233)</b></a></sup>
13376 <p><!--para 5 -->
13377 Byte input/output functions shall not be applied to a wide-oriented stream and wide
13378 character input/output functions shall not be applied to a byte-oriented stream. The
13379 remaining stream operations do not affect, and are not affected by, a stream's orientation,
13380 except for the following additional restrictions:
13381 <ul>
13382 <li> Binary wide-oriented streams have the file-positioning restrictions ascribed to both
13383 text and binary streams.
13384 <li> For wide-oriented streams, after a successful call to a file-positioning function that
13385 leaves the file position indicator prior to the end-of-file, a wide character output
13386 function can overwrite a partial multibyte character; any file contents beyond the
13387 byte(s) written are henceforth indeterminate.
13388 </ul>
13389 <p><!--para 6 -->
13390 Each wide-oriented stream has an associated mbstate_t object that stores the current
13391 parse state of the stream. A successful call to fgetpos stores a representation of the
13392 value of this mbstate_t object as part of the value of the fpos_t object. A later
13393 successful call to fsetpos using the same stored fpos_t value restores the value of
13394 the associated mbstate_t object as well as the position within the controlled stream.
13395 <h6>Environmental limits</h6>
13396 <p><!--para 7 -->
13397 An implementation shall support text files with lines containing at least 254 characters,
13398 including the terminating new-line character. The value of the macro BUFSIZ shall be at
13399 least 256.
13400 <p><b> Forward references</b>: 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>),
13401 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
13402 (<a href="#7.19.9.3">7.19.9.3</a>).
13407 <!--page 278 -->
13409 <h6>footnotes</h6>
13410 <p><small><a name="note232" href="#note232">232)</a> An implementation need not distinguish between text streams and binary streams. In such an
13411 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
13412 line.
13413 </small>
13414 <p><small><a name="note233" href="#note233">233)</a> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
13415 </small>
13417 <h4><a name="7.19.3" href="#7.19.3">7.19.3 Files</a></h4>
13418 <p><!--para 1 -->
13419 A stream is associated with an external file (which may be a physical device) by opening
13420 a file, which may involve creating a new file. Creating an existing file causes its former
13421 contents to be discarded, if necessary. If a file can support positioning requests (such as a
13422 disk file, as opposed to a terminal), then a file position indicator associated with the
13423 stream is positioned at the start (character number zero) of the file, unless the file is
13424 opened with append mode in which case it is implementation-defined whether the file
13425 position indicator is initially positioned at the beginning or the end of the file. The file
13426 position indicator is maintained by subsequent reads, writes, and positioning requests, to
13427 facilitate an orderly progression through the file.
13428 <p><!--para 2 -->
13429 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
13430 stream causes the associated file to be truncated beyond that point is implementation-
13431 defined.
13432 <p><!--para 3 -->
13433 When a stream is unbuffered, characters are intended to appear from the source or at the
13434 destination as soon as possible. Otherwise characters may be accumulated and
13435 transmitted to or from the host environment as a block. When a stream is fully buffered,
13436 characters are intended to be transmitted to or from the host environment as a block when
13437 a buffer is filled. When a stream is line buffered, characters are intended to be
13438 transmitted to or from the host environment as a block when a new-line character is
13439 encountered. Furthermore, characters are intended to be transmitted as a block to the host
13440 environment when a buffer is filled, when input is requested on an unbuffered stream, or
13441 when input is requested on a line buffered stream that requires the transmission of
13442 characters from the host environment. Support for these characteristics is
13443 implementation-defined, and may be affected via the setbuf and setvbuf functions.
13444 <p><!--para 4 -->
13445 A file may be disassociated from a controlling stream by closing the file. Output streams
13446 are flushed (any unwritten buffer contents are transmitted to the host environment) before
13447 the stream is disassociated from the file. The value of a pointer to a FILE object is
13448 indeterminate after the associated file is closed (including the standard text streams).
13449 Whether a file of zero length (on which no characters have been written by an output
13450 stream) actually exists is implementation-defined.
13451 <p><!--para 5 -->
13452 The file may be subsequently reopened, by the same or another program execution, and
13453 its contents reclaimed or modified (if it can be repositioned at its start). If the main
13454 function returns to its original caller, or if the exit function is called, all open files are
13455 closed (hence all output streams are flushed) before program termination. Other paths to
13456 program termination, such as calling the abort function, need not close all files
13457 properly.
13458 <p><!--para 6 -->
13459 The address of the FILE object used to control a stream may be significant; a copy of a
13460 FILE object need not serve in place of the original.
13461 <!--page 279 -->
13462 <p><!--para 7 -->
13463 At program startup, three text streams are predefined and need not be opened explicitly
13464 -- standard input (for reading conventional input), standard output (for writing
13465 conventional output), and standard error (for writing diagnostic output). As initially
13466 opened, the standard error stream is not fully buffered; the standard input and standard
13467 output streams are fully buffered if and only if the stream can be determined not to refer
13468 to an interactive device.
13469 <p><!--para 8 -->
13470 Functions that open additional (nontemporary) files require a file name, which is a string.
13471 The rules for composing valid file names are implementation-defined. Whether the same
13472 file can be simultaneously open multiple times is also implementation-defined.
13473 <p><!--para 9 -->
13474 Although both text and binary wide-oriented streams are conceptually sequences of wide
13475 characters, the external file associated with a wide-oriented stream is a sequence of
13476 multibyte characters, generalized as follows:
13477 <ul>
13478 <li> Multibyte encodings within files may contain embedded null bytes (unlike multibyte
13479 encodings valid for use internal to the program).
13480 <li> A file need not begin nor end in the initial shift state.<sup><a href="#note234"><b>234)</b></a></sup>
13481 </ul>
13482 <p><!--para 10 -->
13483 Moreover, the encodings used for multibyte characters may differ among files. Both the
13484 nature and choice of such encodings are implementation-defined.
13485 <p><!--para 11 -->
13486 The wide character input functions read multibyte characters from the stream and convert
13487 them to wide characters as if they were read by successive calls to the fgetwc function.
13488 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
13489 described by the stream's own mbstate_t object. The byte input functions read
13490 characters from the stream as if by successive calls to the fgetc function.
13491 <p><!--para 12 -->
13492 The wide character output functions convert wide characters to multibyte characters and
13493 write them to the stream as if they were written by successive calls to the fputwc
13494 function. Each conversion occurs as if by a call to the wcrtomb function, with the
13495 conversion state described by the stream's own mbstate_t object. The byte output
13496 functions write characters to the stream as if by successive calls to the fputc function.
13497 <p><!--para 13 -->
13498 In some cases, some of the byte input/output functions also perform conversions between
13499 multibyte characters and wide characters. These conversions also occur as if by calls to
13500 the mbrtowc and wcrtomb functions.
13501 <p><!--para 14 -->
13502 An encoding error occurs if the character sequence presented to the underlying
13503 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
13504 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
13507 <!--page 280 -->
13508 multibyte character. The wide character input/output functions and the byte input/output
13509 functions store the value of the macro EILSEQ in errno if and only if an encoding error
13510 occurs.
13511 <h6>Environmental limits</h6>
13512 <p><!--para 15 -->
13513 The value of FOPEN_MAX shall be at least eight, including the three standard text
13514 streams.
13515 <p><b> Forward references</b>: 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
13516 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
13517 (<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
13518 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
13519 (<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>).
13521 <h6>footnotes</h6>
13522 <p><small><a name="note234" href="#note234">234)</a> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
13523 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
13524 with state-dependent encoding that does not assuredly end in the initial shift state.
13525 </small>
13527 <h4><a name="7.19.4" href="#7.19.4">7.19.4 Operations on files</a></h4>
13529 <h5><a name="7.19.4.1" href="#7.19.4.1">7.19.4.1 The remove function</a></h5>
13530 <h6>Synopsis</h6>
13531 <p><!--para 1 -->
13532 <pre>
13533 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13534 int remove(const char *filename);
13535 </pre>
13536 <h6>Description</h6>
13537 <p><!--para 2 -->
13538 The remove function causes the file whose name is the string pointed to by filename
13539 to be no longer accessible by that name. A subsequent attempt to open that file using that
13540 name will fail, unless it is created anew. If the file is open, the behavior of the remove
13541 function is implementation-defined.
13542 <h6>Returns</h6>
13543 <p><!--para 3 -->
13544 The remove function returns zero if the operation succeeds, nonzero if it fails.
13546 <h5><a name="7.19.4.2" href="#7.19.4.2">7.19.4.2 The rename function</a></h5>
13547 <h6>Synopsis</h6>
13548 <p><!--para 1 -->
13549 <pre>
13550 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13551 int rename(const char *old, const char *new);
13552 </pre>
13553 <h6>Description</h6>
13554 <p><!--para 2 -->
13555 The rename function causes the file whose name is the string pointed to by old to be
13556 henceforth known by the name given by the string pointed to by new. The file named
13557 old is no longer accessible by that name. If a file named by the string pointed to by new
13558 exists prior to the call to the rename function, the behavior is implementation-defined.
13559 <!--page 281 -->
13560 <h6>Returns</h6>
13561 <p><!--para 3 -->
13562 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note235"><b>235)</b></a></sup> in
13563 which case if the file existed previously it is still known by its original name.
13565 <h6>footnotes</h6>
13566 <p><small><a name="note235" href="#note235">235)</a> Among the reasons the implementation may cause the rename function to fail are that the file is open
13567 or that it is necessary to copy its contents to effectuate its renaming.
13568 </small>
13570 <h5><a name="7.19.4.3" href="#7.19.4.3">7.19.4.3 The tmpfile function</a></h5>
13571 <h6>Synopsis</h6>
13572 <p><!--para 1 -->
13573 <pre>
13574 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13575 FILE *tmpfile(void);
13576 </pre>
13577 <h6>Description</h6>
13578 <p><!--para 2 -->
13579 The tmpfile function creates a temporary binary file that is different from any other
13580 existing file and that will automatically be removed when it is closed or at program
13581 termination. If the program terminates abnormally, whether an open temporary file is
13582 removed is implementation-defined. The file is opened for update with "wb+" mode.
13583 <h6>Recommended practice</h6>
13584 <p><!--para 3 -->
13585 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
13586 program (this limit may be shared with tmpnam) and there should be no limit on the
13587 number simultaneously open other than this limit and any limit on the number of open
13588 files (FOPEN_MAX).
13589 <h6>Returns</h6>
13590 <p><!--para 4 -->
13591 The tmpfile function returns a pointer to the stream of the file that it created. If the file
13592 cannot be created, the tmpfile function returns a null pointer.
13593 <p><b> Forward references</b>: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
13595 <h5><a name="7.19.4.4" href="#7.19.4.4">7.19.4.4 The tmpnam function</a></h5>
13596 <h6>Synopsis</h6>
13597 <p><!--para 1 -->
13598 <pre>
13599 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13600 char *tmpnam(char *s);
13601 </pre>
13602 <h6>Description</h6>
13603 <p><!--para 2 -->
13604 The tmpnam function generates a string that is a valid file name and that is not the same
13605 as the name of an existing file.<sup><a href="#note236"><b>236)</b></a></sup> The function is potentially capable of generating
13608 <!--page 282 -->
13609 TMP_MAX different strings, but any or all of them may already be in use by existing files
13610 and thus not be suitable return values.
13611 <p><!--para 3 -->
13612 The tmpnam function generates a different string each time it is called.
13613 <p><!--para 4 -->
13614 The implementation shall behave as if no library function calls the tmpnam function.
13615 <h6>Returns</h6>
13616 <p><!--para 5 -->
13617 If no suitable string can be generated, the tmpnam function returns a null pointer.
13618 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
13619 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
13620 function may modify the same object). If the argument is not a null pointer, it is assumed
13621 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
13622 in that array and returns the argument as its value.
13623 <h6>Environmental limits</h6>
13624 <p><!--para 6 -->
13625 The value of the macro TMP_MAX shall be at least 25.
13627 <h6>footnotes</h6>
13628 <p><small><a name="note236" href="#note236">236)</a> Files created using strings generated by the tmpnam function are temporary only in the sense that
13629 their names should not collide with those generated by conventional naming rules for the
13630 implementation. It is still necessary to use the remove function to remove such files when their use
13631 is ended, and before program termination.
13632 </small>
13634 <h4><a name="7.19.5" href="#7.19.5">7.19.5 File access functions</a></h4>
13636 <h5><a name="7.19.5.1" href="#7.19.5.1">7.19.5.1 The fclose function</a></h5>
13637 <h6>Synopsis</h6>
13638 <p><!--para 1 -->
13639 <pre>
13640 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13641 int fclose(FILE *stream);
13642 </pre>
13643 <h6>Description</h6>
13644 <p><!--para 2 -->
13645 A successful call to the fclose function causes the stream pointed to by stream to be
13646 flushed and the associated file to be closed. Any unwritten buffered data for the stream
13647 are delivered to the host environment to be written to the file; any unread buffered data
13648 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
13649 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
13650 (and deallocated if it was automatically allocated).
13651 <h6>Returns</h6>
13652 <p><!--para 3 -->
13653 The fclose function returns zero if the stream was successfully closed, or EOF if any
13654 errors were detected.
13656 <h5><a name="7.19.5.2" href="#7.19.5.2">7.19.5.2 The fflush function</a></h5>
13657 <h6>Synopsis</h6>
13658 <p><!--para 1 -->
13659 <!--page 283 -->
13660 <pre>
13661 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13662 int fflush(FILE *stream);
13663 </pre>
13664 <h6>Description</h6>
13665 <p><!--para 2 -->
13666 If stream points to an output stream or an update stream in which the most recent
13667 operation was not input, the fflush function causes any unwritten data for that stream
13668 to be delivered to the host environment to be written to the file; otherwise, the behavior is
13669 undefined.
13670 <p><!--para 3 -->
13671 If stream is a null pointer, the fflush function performs this flushing action on all
13672 streams for which the behavior is defined above.
13673 <h6>Returns</h6>
13674 <p><!--para 4 -->
13675 The fflush function sets the error indicator for the stream and returns EOF if a write
13676 error occurs, otherwise it returns zero.
13677 <p><b> Forward references</b>: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
13679 <h5><a name="7.19.5.3" href="#7.19.5.3">7.19.5.3 The fopen function</a></h5>
13680 <h6>Synopsis</h6>
13681 <p><!--para 1 -->
13682 <pre>
13683 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13684 FILE *fopen(const char * restrict filename,
13685 const char * restrict mode);
13686 </pre>
13687 <h6>Description</h6>
13688 <p><!--para 2 -->
13689 The fopen function opens the file whose name is the string pointed to by filename,
13690 and associates a stream with it.
13691 <p><!--para 3 -->
13692 The argument mode points to a string. If the string is one of the following, the file is
13693 open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note237"><b>237)</b></a></sup>
13694 <dl>
13695 <dt> r <dd>open text file for reading
13696 <dt> w <dd>truncate to zero length or create text file for writing
13697 <dt> a <dd>append; open or create text file for writing at end-of-file
13698 <dt> rb <dd>open binary file for reading
13699 <dt> wb <dd>truncate to zero length or create binary file for writing
13700 <dt> ab <dd><dd>append; open or create binary file for writing at end-of-file
13701 <dt> r+ <dd>open text file for update (reading and writing)
13702 <dt> w+ <dd>truncate to zero length or create text file for update
13703 <dt> a+ <dd>append; open or create text file for update, writing at end-of-file
13705 <!--page 284 -->
13706 <dt> r+b or rb+ <dd>open binary file for update (reading and writing)
13707 <dt> w+b or wb+ <dd>truncate to zero length or create binary file for update
13708 <dt> a+b or ab+ <dd>append; open or create binary file for update, writing at end-of-file
13709 </dl>
13710 <p><!--para 4 -->
13711 Opening a file with read mode ('r' as the first character in the mode argument) fails if
13712 the file does not exist or cannot be read.
13713 <p><!--para 5 -->
13714 Opening a file with append mode ('a' as the first character in the mode argument)
13715 causes all subsequent writes to the file to be forced to the then current end-of-file,
13716 regardless of intervening calls to the fseek function. In some implementations, opening
13717 a binary file with append mode ('b' as the second or third character in the above list of
13718 mode argument values) may initially position the file position indicator for the stream
13719 beyond the last data written, because of null character padding.
13720 <p><!--para 6 -->
13721 When a file is opened with update mode ('+' as the second or third character in the
13722 above list of mode argument values), both input and output may be performed on the
13723 associated stream. However, output shall not be directly followed by input without an
13724 intervening call to the fflush function or to a file positioning function (fseek,
13725 fsetpos, or rewind), and input shall not be directly followed by output without an
13726 intervening call to a file positioning function, unless the input operation encounters end-
13727 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
13728 binary stream in some implementations.
13729 <p><!--para 7 -->
13730 When opened, a stream is fully buffered if and only if it can be determined not to refer to
13731 an interactive device. The error and end-of-file indicators for the stream are cleared.
13732 <h6>Returns</h6>
13733 <p><!--para 8 -->
13734 The fopen function returns a pointer to the object controlling the stream. If the open
13735 operation fails, fopen returns a null pointer.
13736 <p><b> Forward references</b>: file positioning functions (<a href="#7.19.9">7.19.9</a>).
13738 <h6>footnotes</h6>
13739 <p><small><a name="note237" href="#note237">237)</a> If the string begins with one of the above sequences, the implementation might choose to ignore the
13740 remaining characters, or it might use them to select different kinds of a file (some of which might not
13741 conform to the properties in <a href="#7.19.2">7.19.2</a>).
13742 </small>
13744 <h5><a name="7.19.5.4" href="#7.19.5.4">7.19.5.4 The freopen function</a></h5>
13745 <h6>Synopsis</h6>
13746 <p><!--para 1 -->
13747 <pre>
13748 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13749 FILE *freopen(const char * restrict filename,
13750 const char * restrict mode,
13751 FILE * restrict stream);
13752 </pre>
13753 <h6>Description</h6>
13754 <p><!--para 2 -->
13755 The freopen function opens the file whose name is the string pointed to by filename
13756 and associates the stream pointed to by stream with it. The mode argument is used just
13757 <!--page 285 -->
13758 as in the fopen function.<sup><a href="#note238"><b>238)</b></a></sup>
13759 <p><!--para 3 -->
13760 If filename is a null pointer, the freopen function attempts to change the mode of
13761 the stream to that specified by mode, as if the name of the file currently associated with
13762 the stream had been used. It is implementation-defined which changes of mode are
13763 permitted (if any), and under what circumstances.
13764 <p><!--para 4 -->
13765 The freopen function first attempts to close any file that is associated with the specified
13766 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
13767 stream are cleared.
13768 <h6>Returns</h6>
13769 <p><!--para 5 -->
13770 The freopen function returns a null pointer if the open operation fails. Otherwise,
13771 freopen returns the value of stream.
13773 <h6>footnotes</h6>
13774 <p><small><a name="note238" href="#note238">238)</a> The primary use of the freopen function is to change the file associated with a standard text stream
13775 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
13776 returned by the fopen function may be assigned.
13777 </small>
13779 <h5><a name="7.19.5.5" href="#7.19.5.5">7.19.5.5 The setbuf function</a></h5>
13780 <h6>Synopsis</h6>
13781 <p><!--para 1 -->
13782 <pre>
13783 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13784 void setbuf(FILE * restrict stream,
13785 char * restrict buf);
13786 </pre>
13787 <h6>Description</h6>
13788 <p><!--para 2 -->
13789 Except that it returns no value, the setbuf function is equivalent to the setvbuf
13790 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
13791 is a null pointer), with the value _IONBF for mode.
13792 <h6>Returns</h6>
13793 <p><!--para 3 -->
13794 The setbuf function returns no value.
13795 <p><b> Forward references</b>: the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
13797 <h5><a name="7.19.5.6" href="#7.19.5.6">7.19.5.6 The setvbuf function</a></h5>
13798 <h6>Synopsis</h6>
13799 <p><!--para 1 -->
13800 <pre>
13801 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13802 int setvbuf(FILE * restrict stream,
13803 char * restrict buf,
13804 int mode, size_t size);
13805 </pre>
13810 <!--page 286 -->
13811 <h6>Description</h6>
13812 <p><!--para 2 -->
13813 The setvbuf function may be used only after the stream pointed to by stream has
13814 been associated with an open file and before any other operation (other than an
13815 unsuccessful call to setvbuf) is performed on the stream. The argument mode
13816 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
13817 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
13818 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
13819 used instead of a buffer allocated by the setvbuf function<sup><a href="#note239"><b>239)</b></a></sup> and the argument size
13820 specifies the size of the array; otherwise, size may determine the size of a buffer
13821 allocated by the setvbuf function. The contents of the array at any time are
13822 indeterminate.
13823 <h6>Returns</h6>
13824 <p><!--para 3 -->
13825 The setvbuf function returns zero on success, or nonzero if an invalid value is given
13826 for mode or if the request cannot be honored.
13828 <h6>footnotes</h6>
13829 <p><small><a name="note239" href="#note239">239)</a> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
13830 before a buffer that has automatic storage duration is deallocated upon block exit.
13831 </small>
13833 <h4><a name="7.19.6" href="#7.19.6">7.19.6 Formatted input/output functions</a></h4>
13834 <p><!--para 1 -->
13835 The formatted input/output functions shall behave as if there is a sequence point after the
13836 actions associated with each specifier.<sup><a href="#note240"><b>240)</b></a></sup>
13838 <h6>footnotes</h6>
13839 <p><small><a name="note240" href="#note240">240)</a> The fprintf functions perform writes to memory for the %n specifier.
13840 </small>
13842 <h5><a name="7.19.6.1" href="#7.19.6.1">7.19.6.1 The fprintf function</a></h5>
13843 <h6>Synopsis</h6>
13844 <p><!--para 1 -->
13845 <pre>
13846 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13847 int fprintf(FILE * restrict stream,
13848 const char * restrict format, ...);
13849 </pre>
13850 <h6>Description</h6>
13851 <p><!--para 2 -->
13852 The fprintf function writes output to the stream pointed to by stream, under control
13853 of the string pointed to by format that specifies how subsequent arguments are
13854 converted for output. If there are insufficient arguments for the format, the behavior is
13855 undefined. If the format is exhausted while arguments remain, the excess arguments are
13856 evaluated (as always) but are otherwise ignored. The fprintf function returns when
13857 the end of the format string is encountered.
13858 <p><!--para 3 -->
13859 The format shall be a multibyte character sequence, beginning and ending in its initial
13860 shift state. The format is composed of zero or more directives: ordinary multibyte
13861 characters (not %), which are copied unchanged to the output stream; and conversion
13864 <!--page 287 -->
13865 specifications, each of which results in fetching zero or more subsequent arguments,
13866 converting them, if applicable, according to the corresponding conversion specifier, and
13867 then writing the result to the output stream.
13868 <p><!--para 4 -->
13869 Each conversion specification is introduced by the character %. After the %, the following
13870 appear in sequence:
13871 <ul>
13872 <li> Zero or more flags (in any order) that modify the meaning of the conversion
13873 specification.
13874 <li> An optional minimum field width. If the converted value has fewer characters than the
13875 field width, it is padded with spaces (by default) on the left (or right, if the left
13876 adjustment flag, described later, has been given) to the field width. The field width
13877 takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note241"><b>241)</b></a></sup>
13878 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
13879 o, u, x, and X conversions, the number of digits to appear after the decimal-point
13880 character for a, A, e, E, f, and F conversions, the maximum number of significant
13881 digits for the g and G conversions, or the maximum number of bytes to be written for
13882 s conversions. The precision takes the form of a period (.) followed either by an
13883 asterisk * (described later) or by an optional decimal integer; if only the period is
13884 specified, the precision is taken as zero. If a precision appears with any other
13885 conversion specifier, the behavior is undefined.
13886 <li> An optional length modifier that specifies the size of the argument.
13887 <li> A conversion specifier character that specifies the type of conversion to be applied.
13888 </ul>
13889 <p><!--para 5 -->
13890 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
13891 this case, an int argument supplies the field width or precision. The arguments
13892 specifying field width, or precision, or both, shall appear (in that order) before the
13893 argument (if any) to be converted. A negative field width argument is taken as a - flag
13894 followed by a positive field width. A negative precision argument is taken as if the
13895 precision were omitted.
13896 <p><!--para 6 -->
13897 The flag characters and their meanings are:
13898 <dl>
13899 <dt> - <dd> The result of the conversion is left-justified within the field. (It is right-justified if
13900 this flag is not specified.)
13901 <dt> + <dd> The result of a signed conversion always begins with a plus or minus sign. (It
13902 begins with a sign only when a negative value is converted if this flag is not
13904 <!--page 288 -->
13905 specified.)<sup><a href="#note242"><b>242)</b></a></sup>
13906 <dt> space<dd> If the first character of a signed conversion is not a sign, or if a signed conversion
13907 results in no characters, a space is prefixed to the result. If the space and + flags
13908 both appear, the space flag is ignored.
13909 <dt> # <dd> The result is converted to an ''alternative form''. For o conversion, it increases
13910 the precision, if and only if necessary, to force the first digit of the result to be a
13911 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
13912 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
13913 and G conversions, the result of converting a floating-point number always
13914 contains a decimal-point character, even if no digits follow it. (Normally, a
13915 decimal-point character appears in the result of these conversions only if a digit
13916 follows it.) For g and G conversions, trailing zeros are not removed from the
13917 result. For other conversions, the behavior is undefined.
13918 <dt> 0 <dd> For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
13919 (following any indication of sign or base) are used to pad to the field width rather
13920 than performing space padding, except when converting an infinity or NaN. If the
13921 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
13922 conversions, if a precision is specified, the 0 flag is ignored. For other
13923 conversions, the behavior is undefined.
13924 </dl>
13925 <p><!--para 7 -->
13926 The length modifiers and their meanings are:
13927 <dl>
13928 <dt> hh <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13929 signed char or unsigned char argument (the argument will have
13930 been promoted according to the integer promotions, but its value shall be
13931 converted to signed char or unsigned char before printing); or that
13932 a following n conversion specifier applies to a pointer to a signed char
13933 argument.
13934 <dt> h <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13935 short int or unsigned short int argument (the argument will
13936 have been promoted according to the integer promotions, but its value shall
13937 be converted to short int or unsigned short int before printing);
13938 or that a following n conversion specifier applies to a pointer to a short
13939 int argument.
13940 <dt> l (ell) <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13941 long int or unsigned long int argument; that a following n
13942 conversion specifier applies to a pointer to a long int argument; that a
13943 <!--page 289 -->
13944 following c conversion specifier applies to a wint_t argument; that a
13945 following s conversion specifier applies to a pointer to a wchar_t
13946 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
13947 specifier.
13948 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13949 long long int or unsigned long long int argument; or that a
13950 following n conversion specifier applies to a pointer to a long long int
13951 argument.
13952 <dt> j <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to
13953 an intmax_t or uintmax_t argument; or that a following n conversion
13954 specifier applies to a pointer to an intmax_t argument.
13955 <dt> z <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13956 size_t or the corresponding signed integer type argument; or that a
13957 following n conversion specifier applies to a pointer to a signed integer type
13958 corresponding to size_t argument.
13959 <dt> t <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13960 ptrdiff_t or the corresponding unsigned integer type argument; or that a
13961 following n conversion specifier applies to a pointer to a ptrdiff_t
13962 argument.
13963 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
13964 applies to a long double argument.
13965 </dl>
13966 If a length modifier appears with any conversion specifier other than as specified above,
13967 the behavior is undefined.
13968 <p><!--para 8 -->
13969 The conversion specifiers and their meanings are:
13970 <dl>
13971 <dt> d,i <dd> The int argument is converted to signed decimal in the style [-]dddd. The
13972 precision specifies the minimum number of digits to appear; if the value
13973 being converted can be represented in fewer digits, it is expanded with
13974 leading zeros. The default precision is 1. The result of converting a zero
13975 value with a precision of zero is no characters.
13976 <dt> o,u,x,X<dd> The unsigned int argument is converted to unsigned octal (o), unsigned
13977 <!--page 290 -->
13978 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
13979 letters abcdef are used for x conversion and the letters ABCDEF for X
13980 conversion. The precision specifies the minimum number of digits to appear;
13981 if the value being converted can be represented in fewer digits, it is expanded
13982 with leading zeros. The default precision is 1. The result of converting a
13983 zero value with a precision of zero is no characters.
13984 <dt> f,F <dd> A double argument representing a floating-point number is converted to
13985 decimal notation in the style [-]ddd.ddd, where the number of digits after
13986 the decimal-point character is equal to the precision specification. If the
13987 precision is missing, it is taken as 6; if the precision is zero and the # flag is
13988 not specified, no decimal-point character appears. If a decimal-point
13989 character appears, at least one digit appears before it. The value is rounded to
13990 the appropriate number of digits.
13991 A double argument representing an infinity is converted in one of the styles
13992 [-]inf or [-]infinity -- which style is implementation-defined. A
13993 double argument representing a NaN is converted in one of the styles
13994 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
13995 any n-char-sequence, is implementation-defined. The F conversion specifier
13996 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
13997 respectively.<sup><a href="#note243"><b>243)</b></a></sup>
13998 <dt> e,E <dd> A double argument representing a floating-point number is converted in the
13999 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
14000 argument is nonzero) before the decimal-point character and the number of
14001 digits after it is equal to the precision; if the precision is missing, it is taken as
14002 6; if the precision is zero and the # flag is not specified, no decimal-point
14003 character appears. The value is rounded to the appropriate number of digits.
14004 The E conversion specifier produces a number with E instead of e
14005 introducing the exponent. The exponent always contains at least two digits,
14006 and only as many more digits as necessary to represent the exponent. If the
14007 value is zero, the exponent is zero.
14008 A double argument representing an infinity or NaN is converted in the style
14009 of an f or F conversion specifier.
14010 <dt> g,G <dd> A double argument representing a floating-point number is converted in
14011 style f or e (or in style F or E in the case of a G conversion specifier),
14012 depending on the value converted and the precision. Let P equal the
14013 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
14014 Then, if a conversion with style E would have an exponent of X :
14015 <ul>
14016 <li> if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
14017 P - (X + 1).
14018 <li> otherwise, the conversion is with style e (or E) and precision P - 1.
14019 </ul>
14020 Finally, unless the # flag is used, any trailing zeros are removed from the
14021 <!--page 291 -->
14022 fractional portion of the result and the decimal-point character is removed if
14023 there is no fractional portion remaining.
14024 A double argument representing an infinity or NaN is converted in the style
14025 of an f or F conversion specifier.
14026 <dt> a,A <dd> A double argument representing a floating-point number is converted in the
14027 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
14028 nonzero if the argument is a normalized floating-point number and is
14029 otherwise unspecified) before the decimal-point character<sup><a href="#note244"><b>244)</b></a></sup> and the number
14030 of hexadecimal digits after it is equal to the precision; if the precision is
14031 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
14032 an exact representation of the value; if the precision is missing and
14033 FLT_RADIX is not a power of 2, then the precision is sufficient to
14034 distinguish<sup><a href="#note245"><b>245)</b></a></sup> values of type double, except that trailing zeros may be
14035 omitted; if the precision is zero and the # flag is not specified, no decimal-
14036 point character appears. The letters abcdef are used for a conversion and
14037 the letters ABCDEF for A conversion. The A conversion specifier produces a
14038 number with X and P instead of x and p. The exponent always contains at
14039 least one digit, and only as many more digits as necessary to represent the
14040 decimal exponent of 2. If the value is zero, the exponent is zero.
14041 A double argument representing an infinity or NaN is converted in the style
14042 of an f or F conversion specifier.
14043 <dt> c <dd> If no l length modifier is present, the int argument is converted to an
14044 unsigned char, and the resulting character is written.
14045 If an l length modifier is present, the wint_t argument is converted as if by
14046 an ls conversion specification with no precision and an argument that points
14047 to the initial element of a two-element array of wchar_t, the first element
14048 containing the wint_t argument to the lc conversion specification and the
14049 second a null wide character.
14050 <dt> s <dd> If no l length modifier is present, the argument shall be a pointer to the initial
14051 element of an array of character type.<sup><a href="#note246"><b>246)</b></a></sup> Characters from the array are
14052 <!--page 292 -->
14053 written up to (but not including) the terminating null character. If the
14054 precision is specified, no more than that many bytes are written. If the
14055 precision is not specified or is greater than the size of the array, the array shall
14056 contain a null character.
14057 If an l length modifier is present, the argument shall be a pointer to the initial
14058 element of an array of wchar_t type. Wide characters from the array are
14059 converted to multibyte characters (each as if by a call to the wcrtomb
14060 function, with the conversion state described by an mbstate_t object
14061 initialized to zero before the first wide character is converted) up to and
14062 including a terminating null wide character. The resulting multibyte
14063 characters are written up to (but not including) the terminating null character
14064 (byte). If no precision is specified, the array shall contain a null wide
14065 character. If a precision is specified, no more than that many bytes are
14066 written (including shift sequences, if any), and the array shall contain a null
14067 wide character if, to equal the multibyte character sequence length given by
14068 the precision, the function would need to access a wide character one past the
14069 end of the array. In no case is a partial multibyte character written.<sup><a href="#note247"><b>247)</b></a></sup>
14070 <dt> p <dd> The argument shall be a pointer to void. The value of the pointer is
14071 converted to a sequence of printing characters, in an implementation-defined
14072 manner.
14073 <dt> n <dd> The argument shall be a pointer to signed integer into which is written the
14074 number of characters written to the output stream so far by this call to
14075 fprintf. No argument is converted, but one is consumed. If the conversion
14076 specification includes any flags, a field width, or a precision, the behavior is
14077 undefined.
14078 <dt> % <dd> A % character is written. No argument is converted. The complete
14079 conversion specification shall be %%.
14080 </dl>
14081 <p><!--para 9 -->
14082 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note248"><b>248)</b></a></sup> If any argument is
14083 not the correct type for the corresponding conversion specification, the behavior is
14084 undefined.
14085 <p><!--para 10 -->
14086 In no case does a nonexistent or small field width cause truncation of a field; if the result
14087 of a conversion is wider than the field width, the field is expanded to contain the
14088 conversion result.
14093 <!--page 293 -->
14094 <p><!--para 11 -->
14095 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
14096 to a hexadecimal floating number with the given precision.
14097 <h6>Recommended practice</h6>
14098 <p><!--para 12 -->
14099 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
14100 representable in the given precision, the result should be one of the two adjacent numbers
14101 in hexadecimal floating style with the given precision, with the extra stipulation that the
14102 error should have a correct sign for the current rounding direction.
14103 <p><!--para 13 -->
14104 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
14105 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note249"><b>249)</b></a></sup> If the number of
14106 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
14107 representable with DECIMAL_DIG digits, then the result should be an exact
14108 representation with trailing zeros. Otherwise, the source value is bounded by two
14109 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
14110 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
14111 the error should have a correct sign for the current rounding direction.
14112 <h6>Returns</h6>
14113 <p><!--para 14 -->
14114 The fprintf function returns the number of characters transmitted, or a negative value
14115 if an output or encoding error occurred.
14116 <h6>Environmental limits</h6>
14117 <p><!--para 15 -->
14118 The number of characters that can be produced by any single conversion shall be at least
14119 4095.
14120 <p><!--para 16 -->
14121 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
14122 places:
14123 <pre>
14124 #include <a href="#7.12">&lt;math.h&gt;</a>
14125 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14126 /* ... */
14127 char *weekday, *month; // pointers to strings
14128 int day, hour, min;
14129 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
14130 weekday, month, day, hour, min);
14131 fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
14132 </pre>
14134 <p><!--para 17 -->
14135 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
14136 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
14137 the first of which is denoted here by a and the second by an uppercase letter.
14142 <!--page 294 -->
14143 <p><!--para 18 -->
14144 Given the following wide string with length seven,
14145 <pre>
14146 static wchar_t wstr[] = L" X Yabc Z W";
14147 </pre>
14148 the seven calls
14149 <pre>
14150 fprintf(stdout, "|1234567890123|\n");
14151 fprintf(stdout, "|%13ls|\n", wstr);
14152 fprintf(stdout, "|%-13.9ls|\n", wstr);
14153 fprintf(stdout, "|%13.10ls|\n", wstr);
14154 fprintf(stdout, "|%13.11ls|\n", wstr);
14155 fprintf(stdout, "|%13.15ls|\n", &amp;wstr[2]);
14156 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
14157 </pre>
14158 will print the following seven lines:
14159 <pre>
14160 |1234567890123|
14161 | X Yabc Z W|
14162 | X Yabc Z |
14163 | X Yabc Z|
14164 | X Yabc Z W|
14165 | abc Z W|
14166 | Z|
14167 </pre>
14169 <p><b> Forward references</b>: 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>).
14171 <h6>footnotes</h6>
14172 <p><small><a name="note241" href="#note241">241)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
14173 </small>
14174 <p><small><a name="note242" href="#note242">242)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
14175 include a minus sign.
14176 </small>
14177 <p><small><a name="note243" href="#note243">243)</a> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
14178 the # and 0 flag characters have no effect.
14179 </small>
14180 <p><small><a name="note244" href="#note244">244)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
14181 that subsequent digits align to nibble (4-bit) boundaries.
14182 </small>
14183 <p><small><a name="note245" href="#note245">245)</a> The precision p is sufficient to distinguish values of the source type if 16<sup>p-1</sup> &gt; b n where b is
14184 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
14185 might suffice depending on the implementation's scheme for determining the digit to the left of the
14186 decimal-point character.
14187 </small>
14188 <p><small><a name="note246" href="#note246">246)</a> No special provisions are made for multibyte characters.
14189 </small>
14190 <p><small><a name="note247" href="#note247">247)</a> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
14191 </small>
14192 <p><small><a name="note248" href="#note248">248)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
14193 </small>
14194 <p><small><a name="note249" href="#note249">249)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
14195 given format specifier. The number of significant digits is determined by the format specifier, and in
14196 the case of fixed-point conversion by the source value as well.
14197 </small>
14199 <h5><a name="7.19.6.2" href="#7.19.6.2">7.19.6.2 The fscanf function</a></h5>
14200 <h6>Synopsis</h6>
14201 <p><!--para 1 -->
14202 <pre>
14203 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14204 int fscanf(FILE * restrict stream,
14205 const char * restrict format, ...);
14206 </pre>
14207 <h6>Description</h6>
14208 <p><!--para 2 -->
14209 The fscanf function reads input from the stream pointed to by stream, under control
14210 of the string pointed to by format that specifies the admissible input sequences and how
14211 they are to be converted for assignment, using subsequent arguments as pointers to the
14212 objects to receive the converted input. If there are insufficient arguments for the format,
14213 the behavior is undefined. If the format is exhausted while arguments remain, the excess
14214 arguments are evaluated (as always) but are otherwise ignored.
14215 <p><!--para 3 -->
14216 The format shall be a multibyte character sequence, beginning and ending in its initial
14217 shift state. The format is composed of zero or more directives: one or more white-space
14218 characters, an ordinary multibyte character (neither % nor a white-space character), or a
14219 conversion specification. Each conversion specification is introduced by the character %.
14220 After the %, the following appear in sequence:
14221 <ul>
14222 <li> An optional assignment-suppressing character *.
14223 <li> An optional decimal integer greater than zero that specifies the maximum field width
14224 (in characters).
14225 <!--page 295 -->
14226 <li> An optional length modifier that specifies the size of the receiving object.
14227 <li> A conversion specifier character that specifies the type of conversion to be applied.
14228 </ul>
14229 <p><!--para 4 -->
14230 The fscanf function executes each directive of the format in turn. If a directive fails, as
14231 detailed below, the function returns. Failures are described as input failures (due to the
14232 occurrence of an encoding error or the unavailability of input characters), or matching
14233 failures (due to inappropriate input).
14234 <p><!--para 5 -->
14235 A directive composed of white-space character(s) is executed by reading input up to the
14236 first non-white-space character (which remains unread), or until no more characters can
14237 be read.
14238 <p><!--para 6 -->
14239 A directive that is an ordinary multibyte character is executed by reading the next
14240 characters of the stream. If any of those characters differ from the ones composing the
14241 directive, the directive fails and the differing and subsequent characters remain unread.
14242 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
14243 read, the directive fails.
14244 <p><!--para 7 -->
14245 A directive that is a conversion specification defines a set of matching input sequences, as
14246 described below for each specifier. A conversion specification is executed in the
14247 following steps:
14248 <p><!--para 8 -->
14249 Input white-space characters (as specified by the isspace function) are skipped, unless
14250 the specification includes a [, c, or n specifier.<sup><a href="#note250"><b>250)</b></a></sup>
14251 <p><!--para 9 -->
14252 An input item is read from the stream, unless the specification includes an n specifier. An
14253 input item is defined as the longest sequence of input characters which does not exceed
14254 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>
14255 The first character, if any, after the input item remains unread. If the length of the input
14256 item is zero, the execution of the directive fails; this condition is a matching failure unless
14257 end-of-file, an encoding error, or a read error prevented input from the stream, in which
14258 case it is an input failure.
14259 <p><!--para 10 -->
14260 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
14261 count of input characters) is converted to a type appropriate to the conversion specifier. If
14262 the input item is not a matching sequence, the execution of the directive fails: this
14263 condition is a matching failure. Unless assignment suppression was indicated by a *, the
14264 result of the conversion is placed in the object pointed to by the first argument following
14265 the format argument that has not already received a conversion result. If this object
14266 does not have an appropriate type, or if the result of the conversion cannot be represented
14269 <!--page 296 -->
14270 in the object, the behavior is undefined.
14271 <p><!--para 11 -->
14272 The length modifiers and their meanings are:
14273 <dl>
14274 <dt> hh <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14275 to an argument with type pointer to signed char or unsigned char.
14276 <dt> h <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14277 to an argument with type pointer to short int or unsigned short
14278 int.
14279 <dt> l (ell) <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14280 to an argument with type pointer to long int or unsigned long
14281 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
14282 an argument with type pointer to double; or that a following c, s, or [
14283 conversion specifier applies to an argument with type pointer to wchar_t.
14284 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14285 to an argument with type pointer to long long int or unsigned
14286 long long int.
14287 <dt> j <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14288 to an argument with type pointer to intmax_t or uintmax_t.
14289 <dt> z <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14290 to an argument with type pointer to size_t or the corresponding signed
14291 integer type.
14292 <dt> t <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14293 to an argument with type pointer to ptrdiff_t or the corresponding
14294 unsigned integer type.
14295 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
14296 applies to an argument with type pointer to long double.
14297 </dl>
14298 If a length modifier appears with any conversion specifier other than as specified above,
14299 the behavior is undefined.
14300 <p><!--para 12 -->
14301 The conversion specifiers and their meanings are:
14302 <dl>
14303 <dt> d <dd> Matches an optionally signed decimal integer, whose format is the same as
14304 expected for the subject sequence of the strtol function with the value 10
14305 for the base argument. The corresponding argument shall be a pointer to
14306 signed integer.
14307 <dt> i <dd> Matches an optionally signed integer, whose format is the same as expected
14308 <!--page 297 -->
14309 for the subject sequence of the strtol function with the value 0 for the
14310 base argument. The corresponding argument shall be a pointer to signed
14311 integer.
14312 <dt> o <dd> Matches an optionally signed octal integer, whose format is the same as
14313 expected for the subject sequence of the strtoul function with the value 8
14314 for the base argument. The corresponding argument shall be a pointer to
14315 unsigned integer.
14316 <dt> u <dd> Matches an optionally signed decimal integer, whose format is the same as
14317 expected for the subject sequence of the strtoul function with the value 10
14318 for the base argument. The corresponding argument shall be a pointer to
14319 unsigned integer.
14320 <dt> x <dd> Matches an optionally signed hexadecimal integer, whose format is the same
14321 as expected for the subject sequence of the strtoul function with the value
14322 16 for the base argument. The corresponding argument shall be a pointer to
14323 unsigned integer.
14324 <dt> a,e,f,g<dd> Matches an optionally signed floating-point number, infinity, or NaN, whose
14325 format is the same as expected for the subject sequence of the strtod
14326 function. The corresponding argument shall be a pointer to floating.
14327 <dt> c <dd> Matches a sequence of characters of exactly the number specified by the field
14328 width (1 if no field width is present in the directive).<sup><a href="#note252"><b>252)</b></a></sup>
14329 If no l length modifier is present, the corresponding argument shall be a
14330 pointer to the initial element of a character array large enough to accept the
14331 sequence. No null character is added.
14332 If an l length modifier is present, the input shall be a sequence of multibyte
14333 characters that begins in the initial shift state. Each multibyte character in the
14334 sequence is converted to a wide character as if by a call to the mbrtowc
14335 function, with the conversion state described by an mbstate_t object
14336 initialized to zero before the first multibyte character is converted. The
14337 corresponding argument shall be a pointer to the initial element of an array of
14338 wchar_t large enough to accept the resulting sequence of wide characters.
14339 No null wide character is added.
14340 <dt> s <dd> Matches a sequence of non-white-space characters.<sup><a href="#note252"><b>252)</b></a></sup>
14341 If no l length modifier is present, the corresponding argument shall be a
14342 pointer to the initial element of a character array large enough to accept the
14343 sequence and a terminating null character, which will be added automatically.
14344 If an l length modifier is present, the input shall be a sequence of multibyte
14345 <!--page 298 -->
14346 characters that begins in the initial shift state. Each multibyte character is
14347 converted to a wide character as if by a call to the mbrtowc function, with
14348 the conversion state described by an mbstate_t object initialized to zero
14349 before the first multibyte character is converted. The corresponding argument
14350 shall be a pointer to the initial element of an array of wchar_t large enough
14351 to accept the sequence and the terminating null wide character, which will be
14352 added automatically.
14353 <dt> [ <dd> Matches a nonempty sequence of characters from a set of expected characters
14354 (the scanset).<sup><a href="#note252"><b>252)</b></a></sup>
14355 If no l length modifier is present, the corresponding argument shall be a
14356 pointer to the initial element of a character array large enough to accept the
14357 sequence and a terminating null character, which will be added automatically.
14358 If an l length modifier is present, the input shall be a sequence of multibyte
14359 characters that begins in the initial shift state. Each multibyte character is
14360 converted to a wide character as if by a call to the mbrtowc function, with
14361 the conversion state described by an mbstate_t object initialized to zero
14362 before the first multibyte character is converted. The corresponding argument
14363 shall be a pointer to the initial element of an array of wchar_t large enough
14364 to accept the sequence and the terminating null wide character, which will be
14365 added automatically.
14366 The conversion specifier includes all subsequent characters in the format
14367 string, up to and including the matching right bracket (]). The characters
14368 between the brackets (the scanlist) compose the scanset, unless the character
14369 after the left bracket is a circumflex (^), in which case the scanset contains all
14370 characters that do not appear in the scanlist between the circumflex and the
14371 right bracket. If the conversion specifier begins with [] or [^], the right
14372 bracket character is in the scanlist and the next following right bracket
14373 character is the matching right bracket that ends the specification; otherwise
14374 the first following right bracket character is the one that ends the
14375 specification. If a - character is in the scanlist and is not the first, nor the
14376 second where the first character is a ^, nor the last character, the behavior is
14377 implementation-defined.
14378 <dt> p <dd> Matches an implementation-defined set of sequences, which should be the
14379 <!--page 299 -->
14380 same as the set of sequences that may be produced by the %p conversion of
14381 the fprintf function. The corresponding argument shall be a pointer to a
14382 pointer to void. The input item is converted to a pointer value in an
14383 implementation-defined manner. If the input item is a value converted earlier
14384 during the same program execution, the pointer that results shall compare
14385 equal to that value; otherwise the behavior of the %p conversion is undefined.
14386 <dt> n <dd> No input is consumed. The corresponding argument shall be a pointer to
14387 signed integer into which is to be written the number of characters read from
14388 the input stream so far by this call to the fscanf function. Execution of a
14389 %n directive does not increment the assignment count returned at the
14390 completion of execution of the fscanf function. No argument is converted,
14391 but one is consumed. If the conversion specification includes an assignment-
14392 suppressing character or a field width, the behavior is undefined.
14393 <dt> % <dd> Matches a single % character; no conversion or assignment occurs. The
14394 complete conversion specification shall be %%.
14395 </dl>
14396 <p><!--para 13 -->
14397 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note253"><b>253)</b></a></sup>
14398 <p><!--para 14 -->
14399 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
14400 respectively, a, e, f, g, and x.
14401 <p><!--para 15 -->
14402 Trailing white space (including new-line characters) is left unread unless matched by a
14403 directive. The success of literal matches and suppressed assignments is not directly
14404 determinable other than via the %n directive.
14405 <h6>Returns</h6>
14406 <p><!--para 16 -->
14407 The fscanf function returns the value of the macro EOF if an input failure occurs
14408 before any conversion. Otherwise, the function returns the number of input items
14409 assigned, which can be fewer than provided for, or even zero, in the event of an early
14410 matching failure.
14411 <p><!--para 17 -->
14412 EXAMPLE 1 The call:
14413 <pre>
14414 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14415 /* ... */
14416 int n, i; float x; char name[50];
14417 n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);
14418 </pre>
14419 with the input line:
14420 <pre>
14421 25 54.32E-1 thompson
14422 </pre>
14423 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
14424 thompson\0.
14426 <p><!--para 18 -->
14427 EXAMPLE 2 The call:
14428 <pre>
14429 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14430 /* ... */
14431 int i; float x; char name[50];
14432 fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);
14433 </pre>
14434 with input:
14438 <!--page 300 -->
14439 <pre>
14440 56789 0123 56a72
14441 </pre>
14442 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
14443 sequence 56\0. The next character read from the input stream will be a.
14445 <p><!--para 19 -->
14446 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
14447 <p><!--para 20 -->
14448 <pre>
14449 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14450 /* ... */
14451 int count; float quant; char units[21], item[21];
14452 do {
14453 count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
14454 fscanf(stdin,"%*[^\n]");
14455 } while (!feof(stdin) &amp;&amp; !ferror(stdin));
14456 </pre>
14457 If the stdin stream contains the following lines:
14458 <pre>
14459 2 quarts of oil
14460 -12.8degrees Celsius
14461 lots of luck
14462 10.0LBS of
14463 dirt
14464 100ergs of energy
14465 </pre>
14466 the execution of the above example will be analogous to the following assignments:
14467 <pre>
14468 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
14469 count = 3;
14470 quant = -12.8; strcpy(units, "degrees");
14471 count = 2; // "C" fails to match "o"
14472 count = 0; // "l" fails to match "%f"
14473 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
14474 count = 3;
14475 count = 0; // "100e" fails to match "%f"
14476 count = EOF;
14477 </pre>
14479 <p><!--para 21 -->
14480 EXAMPLE 4 In:
14481 <pre>
14482 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14483 /* ... */
14484 int d1, d2, n1, n2, i;
14485 i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);
14486 </pre>
14487 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure the value
14488 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
14490 <p><!--para 22 -->
14491 EXAMPLE 5 In these examples, multibyte characters do have a state-dependent encoding, and the
14492 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
14493 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
14494 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
14495 entry into the alternate shift state.
14496 <p><!--para 23 -->
14497 After the call:
14498 <!--page 301 -->
14499 <pre>
14500 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14501 /* ... */
14502 char str[50];
14503 fscanf(stdin, "a%s", str);
14504 </pre>
14505 with the input line:
14506 <pre>
14507 a(uparrow) X Y(downarrow) bc
14508 </pre>
14509 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
14510 characters, in the more general case) appears to be a single-byte white-space character.
14511 <p><!--para 24 -->
14512 In contrast, after the call:
14513 <pre>
14514 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14515 #include <a href="#7.17">&lt;stddef.h&gt;</a>
14516 /* ... */
14517 wchar_t wstr[50];
14518 fscanf(stdin, "a%ls", wstr);
14519 </pre>
14520 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
14521 terminating null wide character.
14522 <p><!--para 25 -->
14523 However, the call:
14524 <pre>
14525 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14526 #include <a href="#7.17">&lt;stddef.h&gt;</a>
14527 /* ... */
14528 wchar_t wstr[50];
14529 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
14530 </pre>
14531 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
14532 string.
14533 <p><!--para 26 -->
14534 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
14535 character Y, after the call:
14536 <pre>
14537 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14538 #include <a href="#7.17">&lt;stddef.h&gt;</a>
14539 /* ... */
14540 wchar_t wstr[50];
14541 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
14542 </pre>
14543 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
14544 multibyte character.
14546 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>), the
14547 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.20.1.4">7.20.1.4</a>), conversion state
14548 (<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>).
14549 <!--page 302 -->
14551 <h6>footnotes</h6>
14552 <p><small><a name="note250" href="#note250">250)</a> These white-space characters are not counted against a specified field width.
14553 </small>
14554 <p><small><a name="note251" href="#note251">251)</a> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
14555 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
14556 </small>
14557 <p><small><a name="note252" href="#note252">252)</a> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
14558 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
14559 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
14560 </small>
14561 <p><small><a name="note253" href="#note253">253)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
14562 </small>
14564 <h5><a name="7.19.6.3" href="#7.19.6.3">7.19.6.3 The printf function</a></h5>
14565 <h6>Synopsis</h6>
14566 <p><!--para 1 -->
14567 <pre>
14568 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14569 int printf(const char * restrict format, ...);
14570 </pre>
14571 <h6>Description</h6>
14572 <p><!--para 2 -->
14573 The printf function is equivalent to fprintf with the argument stdout interposed
14574 before the arguments to printf.
14575 <h6>Returns</h6>
14576 <p><!--para 3 -->
14577 The printf function returns the number of characters transmitted, or a negative value if
14578 an output or encoding error occurred.
14580 <h5><a name="7.19.6.4" href="#7.19.6.4">7.19.6.4 The scanf function</a></h5>
14581 <h6>Synopsis</h6>
14582 <p><!--para 1 -->
14583 <pre>
14584 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14585 int scanf(const char * restrict format, ...);
14586 </pre>
14587 <h6>Description</h6>
14588 <p><!--para 2 -->
14589 The scanf function is equivalent to fscanf with the argument stdin interposed
14590 before the arguments to scanf.
14591 <h6>Returns</h6>
14592 <p><!--para 3 -->
14593 The scanf function returns the value of the macro EOF if an input failure occurs before
14594 any conversion. Otherwise, the scanf function returns the number of input items
14595 assigned, which can be fewer than provided for, or even zero, in the event of an early
14596 matching failure.
14598 <h5><a name="7.19.6.5" href="#7.19.6.5">7.19.6.5 The snprintf function</a></h5>
14599 <h6>Synopsis</h6>
14600 <p><!--para 1 -->
14601 <pre>
14602 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14603 int snprintf(char * restrict s, size_t n,
14604 const char * restrict format, ...);
14605 </pre>
14606 <h6>Description</h6>
14607 <p><!--para 2 -->
14608 The snprintf function is equivalent to fprintf, except that the output is written into
14609 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
14610 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
14611 discarded rather than being written to the array, and a null character is written at the end
14612 of the characters actually written into the array. If copying takes place between objects
14613 that overlap, the behavior is undefined.
14614 <!--page 303 -->
14615 <h6>Returns</h6>
14616 <p><!--para 3 -->
14617 The snprintf function returns the number of characters that would have been written
14618 had n been sufficiently large, not counting the terminating null character, or a negative
14619 value if an encoding error occurred. Thus, the null-terminated output has been
14620 completely written if and only if the returned value is nonnegative and less than n.
14622 <h5><a name="7.19.6.6" href="#7.19.6.6">7.19.6.6 The sprintf function</a></h5>
14623 <h6>Synopsis</h6>
14624 <p><!--para 1 -->
14625 <pre>
14626 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14627 int sprintf(char * restrict s,
14628 const char * restrict format, ...);
14629 </pre>
14630 <h6>Description</h6>
14631 <p><!--para 2 -->
14632 The sprintf function is equivalent to fprintf, except that the output is written into
14633 an array (specified by the argument s) rather than to a stream. A null character is written
14634 at the end of the characters written; it is not counted as part of the returned value. If
14635 copying takes place between objects that overlap, the behavior is undefined.
14636 <h6>Returns</h6>
14637 <p><!--para 3 -->
14638 The sprintf function returns the number of characters written in the array, not
14639 counting the terminating null character, or a negative value if an encoding error occurred.
14641 <h5><a name="7.19.6.7" href="#7.19.6.7">7.19.6.7 The sscanf function</a></h5>
14642 <h6>Synopsis</h6>
14643 <p><!--para 1 -->
14644 <pre>
14645 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14646 int sscanf(const char * restrict s,
14647 const char * restrict format, ...);
14648 </pre>
14649 <h6>Description</h6>
14650 <p><!--para 2 -->
14651 The sscanf function is equivalent to fscanf, except that input is obtained from a
14652 string (specified by the argument s) rather than from a stream. Reaching the end of the
14653 string is equivalent to encountering end-of-file for the fscanf function. If copying
14654 takes place between objects that overlap, the behavior is undefined.
14655 <h6>Returns</h6>
14656 <p><!--para 3 -->
14657 The sscanf function returns the value of the macro EOF if an input failure occurs
14658 before any conversion. Otherwise, the sscanf function returns the number of input
14659 items assigned, which can be fewer than provided for, or even zero, in the event of an
14660 early matching failure.
14661 <!--page 304 -->
14663 <h5><a name="7.19.6.8" href="#7.19.6.8">7.19.6.8 The vfprintf function</a></h5>
14664 <h6>Synopsis</h6>
14665 <p><!--para 1 -->
14666 <pre>
14667 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14668 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14669 int vfprintf(FILE * restrict stream,
14670 const char * restrict format,
14671 va_list arg);
14672 </pre>
14673 <h6>Description</h6>
14674 <p><!--para 2 -->
14675 The vfprintf function is equivalent to fprintf, with the variable argument list
14676 replaced by arg, which shall have been initialized by the va_start macro (and
14677 possibly subsequent va_arg calls). The vfprintf function does not invoke the
14678 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
14679 <h6>Returns</h6>
14680 <p><!--para 3 -->
14681 The vfprintf function returns the number of characters transmitted, or a negative
14682 value if an output or encoding error occurred.
14683 <p><!--para 4 -->
14684 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
14685 <pre>
14686 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14687 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14688 void error(char *function_name, char *format, ...)
14690 va_list args;
14691 va_start(args, format);
14692 // print out name of function causing error
14693 fprintf(stderr, "ERROR in %s: ", function_name);
14694 // print out remainder of message
14695 vfprintf(stderr, format, args);
14696 va_end(args);
14698 </pre>
14703 <!--page 305 -->
14705 <h6>footnotes</h6>
14706 <p><small><a name="note254" href="#note254">254)</a> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
14707 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
14708 </small>
14710 <h5><a name="7.19.6.9" href="#7.19.6.9">7.19.6.9 The vfscanf function</a></h5>
14711 <h6>Synopsis</h6>
14712 <p><!--para 1 -->
14713 <pre>
14714 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14715 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14716 int vfscanf(FILE * restrict stream,
14717 const char * restrict format,
14718 va_list arg);
14719 </pre>
14720 <h6>Description</h6>
14721 <p><!--para 2 -->
14722 The vfscanf function is equivalent to fscanf, with the variable argument list
14723 replaced by arg, which shall have been initialized by the va_start macro (and
14724 possibly subsequent va_arg calls). The vfscanf function does not invoke the
14725 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
14726 <h6>Returns</h6>
14727 <p><!--para 3 -->
14728 The vfscanf function returns the value of the macro EOF if an input failure occurs
14729 before any conversion. Otherwise, the vfscanf function returns the number of input
14730 items assigned, which can be fewer than provided for, or even zero, in the event of an
14731 early matching failure.
14733 <h5><a name="7.19.6.10" href="#7.19.6.10">7.19.6.10 The vprintf function</a></h5>
14734 <h6>Synopsis</h6>
14735 <p><!--para 1 -->
14736 <pre>
14737 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14738 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14739 int vprintf(const char * restrict format,
14740 va_list arg);
14741 </pre>
14742 <h6>Description</h6>
14743 <p><!--para 2 -->
14744 The vprintf function is equivalent to printf, with the variable argument list
14745 replaced by arg, which shall have been initialized by the va_start macro (and
14746 possibly subsequent va_arg calls). The vprintf function does not invoke the
14747 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
14748 <h6>Returns</h6>
14749 <p><!--para 3 -->
14750 The vprintf function returns the number of characters transmitted, or a negative value
14751 if an output or encoding error occurred.
14752 <!--page 306 -->
14754 <h5><a name="7.19.6.11" href="#7.19.6.11">7.19.6.11 The vscanf function</a></h5>
14755 <h6>Synopsis</h6>
14756 <p><!--para 1 -->
14757 <pre>
14758 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14759 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14760 int vscanf(const char * restrict format,
14761 va_list arg);
14762 </pre>
14763 <h6>Description</h6>
14764 <p><!--para 2 -->
14765 The vscanf function is equivalent to scanf, with the variable argument list replaced
14766 by arg, which shall have been initialized by the va_start macro (and possibly
14767 subsequent va_arg calls). The vscanf function does not invoke the va_end
14768 macro.<sup><a href="#note254"><b>254)</b></a></sup>
14769 <h6>Returns</h6>
14770 <p><!--para 3 -->
14771 The vscanf function returns the value of the macro EOF if an input failure occurs
14772 before any conversion. Otherwise, the vscanf function returns the number of input
14773 items assigned, which can be fewer than provided for, or even zero, in the event of an
14774 early matching failure.
14776 <h5><a name="7.19.6.12" href="#7.19.6.12">7.19.6.12 The vsnprintf function</a></h5>
14777 <h6>Synopsis</h6>
14778 <p><!--para 1 -->
14779 <pre>
14780 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14781 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14782 int vsnprintf(char * restrict s, size_t n,
14783 const char * restrict format,
14784 va_list arg);
14785 </pre>
14786 <h6>Description</h6>
14787 <p><!--para 2 -->
14788 The vsnprintf function is equivalent to snprintf, with the variable argument list
14789 replaced by arg, which shall have been initialized by the va_start macro (and
14790 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
14791 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup> If copying takes place between objects that overlap, the behavior is
14792 undefined.
14793 <h6>Returns</h6>
14794 <p><!--para 3 -->
14795 The vsnprintf function returns the number of characters that would have been written
14796 had n been sufficiently large, not counting the terminating null character, or a negative
14797 value if an encoding error occurred. Thus, the null-terminated output has been
14798 completely written if and only if the returned value is nonnegative and less than n.
14799 <!--page 307 -->
14801 <h5><a name="7.19.6.13" href="#7.19.6.13">7.19.6.13 The vsprintf function</a></h5>
14802 <h6>Synopsis</h6>
14803 <p><!--para 1 -->
14804 <pre>
14805 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14806 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14807 int vsprintf(char * restrict s,
14808 const char * restrict format,
14809 va_list arg);
14810 </pre>
14811 <h6>Description</h6>
14812 <p><!--para 2 -->
14813 The vsprintf function is equivalent to sprintf, with the variable argument list
14814 replaced by arg, which shall have been initialized by the va_start macro (and
14815 possibly subsequent va_arg calls). The vsprintf function does not invoke the
14816 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup> If copying takes place between objects that overlap, the behavior is
14817 undefined.
14818 <h6>Returns</h6>
14819 <p><!--para 3 -->
14820 The vsprintf function returns the number of characters written in the array, not
14821 counting the terminating null character, or a negative value if an encoding error occurred.
14823 <h5><a name="7.19.6.14" href="#7.19.6.14">7.19.6.14 The vsscanf function</a></h5>
14824 <h6>Synopsis</h6>
14825 <p><!--para 1 -->
14826 <pre>
14827 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14828 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14829 int vsscanf(const char * restrict s,
14830 const char * restrict format,
14831 va_list arg);
14832 </pre>
14833 <h6>Description</h6>
14834 <p><!--para 2 -->
14835 The vsscanf function is equivalent to sscanf, with the variable argument list
14836 replaced by arg, which shall have been initialized by the va_start macro (and
14837 possibly subsequent va_arg calls). The vsscanf function does not invoke the
14838 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
14839 <h6>Returns</h6>
14840 <p><!--para 3 -->
14841 The vsscanf function returns the value of the macro EOF if an input failure occurs
14842 before any conversion. Otherwise, the vsscanf function returns the number of input
14843 items assigned, which can be fewer than provided for, or even zero, in the event of an
14844 early matching failure.
14845 <!--page 308 -->
14847 <h4><a name="7.19.7" href="#7.19.7">7.19.7 Character input/output functions</a></h4>
14849 <h5><a name="7.19.7.1" href="#7.19.7.1">7.19.7.1 The fgetc function</a></h5>
14850 <h6>Synopsis</h6>
14851 <p><!--para 1 -->
14852 <pre>
14853 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14854 int fgetc(FILE *stream);
14855 </pre>
14856 <h6>Description</h6>
14857 <p><!--para 2 -->
14858 If the end-of-file indicator for the input stream pointed to by stream is not set and a
14859 next character is present, the fgetc function obtains that character as an unsigned
14860 char converted to an int and advances the associated file position indicator for the
14861 stream (if defined).
14862 <h6>Returns</h6>
14863 <p><!--para 3 -->
14864 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
14865 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
14866 fgetc function returns the next character from the input stream pointed to by stream.
14867 If a read error occurs, the error indicator for the stream is set and the fgetc function
14868 returns EOF.<sup><a href="#note255"><b>255)</b></a></sup>
14870 <h6>footnotes</h6>
14871 <p><small><a name="note255" href="#note255">255)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
14872 </small>
14874 <h5><a name="7.19.7.2" href="#7.19.7.2">7.19.7.2 The fgets function</a></h5>
14875 <h6>Synopsis</h6>
14876 <p><!--para 1 -->
14877 <pre>
14878 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14879 char *fgets(char * restrict s, int n,
14880 FILE * restrict stream);
14881 </pre>
14882 <h6>Description</h6>
14883 <p><!--para 2 -->
14884 The fgets function reads at most one less than the number of characters specified by n
14885 from the stream pointed to by stream into the array pointed to by s. No additional
14886 characters are read after a new-line character (which is retained) or after end-of-file. A
14887 null character is written immediately after the last character read into the array.
14888 <h6>Returns</h6>
14889 <p><!--para 3 -->
14890 The fgets function returns s if successful. If end-of-file is encountered and no
14891 characters have been read into the array, the contents of the array remain unchanged and a
14892 null pointer is returned. If a read error occurs during the operation, the array contents are
14893 indeterminate and a null pointer is returned.
14898 <!--page 309 -->
14900 <h5><a name="7.19.7.3" href="#7.19.7.3">7.19.7.3 The fputc function</a></h5>
14901 <h6>Synopsis</h6>
14902 <p><!--para 1 -->
14903 <pre>
14904 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14905 int fputc(int c, FILE *stream);
14906 </pre>
14907 <h6>Description</h6>
14908 <p><!--para 2 -->
14909 The fputc function writes the character specified by c (converted to an unsigned
14910 char) to the output stream pointed to by stream, at the position indicated by the
14911 associated file position indicator for the stream (if defined), and advances the indicator
14912 appropriately. If the file cannot support positioning requests, or if the stream was opened
14913 with append mode, the character is appended to the output stream.
14914 <h6>Returns</h6>
14915 <p><!--para 3 -->
14916 The fputc function returns the character written. If a write error occurs, the error
14917 indicator for the stream is set and fputc returns EOF.
14919 <h5><a name="7.19.7.4" href="#7.19.7.4">7.19.7.4 The fputs function</a></h5>
14920 <h6>Synopsis</h6>
14921 <p><!--para 1 -->
14922 <pre>
14923 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14924 int fputs(const char * restrict s,
14925 FILE * restrict stream);
14926 </pre>
14927 <h6>Description</h6>
14928 <p><!--para 2 -->
14929 The fputs function writes the string pointed to by s to the stream pointed to by
14930 stream. The terminating null character is not written.
14931 <h6>Returns</h6>
14932 <p><!--para 3 -->
14933 The fputs function returns EOF if a write error occurs; otherwise it returns a
14934 nonnegative value.
14936 <h5><a name="7.19.7.5" href="#7.19.7.5">7.19.7.5 The getc function</a></h5>
14937 <h6>Synopsis</h6>
14938 <p><!--para 1 -->
14939 <pre>
14940 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14941 int getc(FILE *stream);
14942 </pre>
14943 <h6>Description</h6>
14944 <p><!--para 2 -->
14945 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
14946 may evaluate stream more than once, so the argument should never be an expression
14947 with side effects.
14948 <!--page 310 -->
14949 <h6>Returns</h6>
14950 <p><!--para 3 -->
14951 The getc function returns the next character from the input stream pointed to by
14952 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
14953 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
14954 getc returns EOF.
14956 <h5><a name="7.19.7.6" href="#7.19.7.6">7.19.7.6 The getchar function</a></h5>
14957 <h6>Synopsis</h6>
14958 <p><!--para 1 -->
14959 <pre>
14960 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14961 int getchar(void);
14962 </pre>
14963 <h6>Description</h6>
14964 <p><!--para 2 -->
14965 The getchar function is equivalent to getc with the argument stdin.
14966 <h6>Returns</h6>
14967 <p><!--para 3 -->
14968 The getchar function returns the next character from the input stream pointed to by
14969 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
14970 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
14971 getchar returns EOF.
14973 <h5><a name="7.19.7.7" href="#7.19.7.7">7.19.7.7 The gets function</a></h5>
14974 <h6>Synopsis</h6>
14975 <p><!--para 1 -->
14976 <pre>
14977 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14978 char *gets(char *s);
14979 </pre>
14980 <h6>Description</h6>
14981 <p><!--para 2 -->
14982 The gets function reads characters from the input stream pointed to by stdin, into the
14983 array pointed to by s, until end-of-file is encountered or a new-line character is read.
14984 Any new-line character is discarded, and a null character is written immediately after the
14985 last character read into the array.
14986 <h6>Returns</h6>
14987 <p><!--para 3 -->
14988 The gets function returns s if successful. If end-of-file is encountered and no
14989 characters have been read into the array, the contents of the array remain unchanged and a
14990 null pointer is returned. If a read error occurs during the operation, the array contents are
14991 indeterminate and a null pointer is returned.
14992 <p><b> Forward references</b>: future library directions (<a href="#7.26.9">7.26.9</a>).
14993 <!--page 311 -->
14995 <h5><a name="7.19.7.8" href="#7.19.7.8">7.19.7.8 The putc function</a></h5>
14996 <h6>Synopsis</h6>
14997 <p><!--para 1 -->
14998 <pre>
14999 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15000 int putc(int c, FILE *stream);
15001 </pre>
15002 <h6>Description</h6>
15003 <p><!--para 2 -->
15004 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
15005 may evaluate stream more than once, so that argument should never be an expression
15006 with side effects.
15007 <h6>Returns</h6>
15008 <p><!--para 3 -->
15009 The putc function returns the character written. If a write error occurs, the error
15010 indicator for the stream is set and putc returns EOF.
15012 <h5><a name="7.19.7.9" href="#7.19.7.9">7.19.7.9 The putchar function</a></h5>
15013 <h6>Synopsis</h6>
15014 <p><!--para 1 -->
15015 <pre>
15016 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15017 int putchar(int c);
15018 </pre>
15019 <h6>Description</h6>
15020 <p><!--para 2 -->
15021 The putchar function is equivalent to putc with the second argument stdout.
15022 <h6>Returns</h6>
15023 <p><!--para 3 -->
15024 The putchar function returns the character written. If a write error occurs, the error
15025 indicator for the stream is set and putchar returns EOF.
15027 <h5><a name="7.19.7.10" href="#7.19.7.10">7.19.7.10 The puts function</a></h5>
15028 <h6>Synopsis</h6>
15029 <p><!--para 1 -->
15030 <pre>
15031 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15032 int puts(const char *s);
15033 </pre>
15034 <h6>Description</h6>
15035 <p><!--para 2 -->
15036 The puts function writes the string pointed to by s to the stream pointed to by stdout,
15037 and appends a new-line character to the output. The terminating null character is not
15038 written.
15039 <h6>Returns</h6>
15040 <p><!--para 3 -->
15041 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
15042 value.
15043 <!--page 312 -->
15045 <h5><a name="7.19.7.11" href="#7.19.7.11">7.19.7.11 The ungetc function</a></h5>
15046 <h6>Synopsis</h6>
15047 <p><!--para 1 -->
15048 <pre>
15049 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15050 int ungetc(int c, FILE *stream);
15051 </pre>
15052 <h6>Description</h6>
15053 <p><!--para 2 -->
15054 The ungetc function pushes the character specified by c (converted to an unsigned
15055 char) back onto the input stream pointed to by stream. Pushed-back characters will be
15056 returned by subsequent reads on that stream in the reverse order of their pushing. A
15057 successful intervening call (with the stream pointed to by stream) to a file positioning
15058 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
15059 stream. The external storage corresponding to the stream is unchanged.
15060 <p><!--para 3 -->
15061 One character of pushback is guaranteed. If the ungetc function is called too many
15062 times on the same stream without an intervening read or file positioning operation on that
15063 stream, the operation may fail.
15064 <p><!--para 4 -->
15065 If the value of c equals that of the macro EOF, the operation fails and the input stream is
15066 unchanged.
15067 <p><!--para 5 -->
15068 A successful call to the ungetc function clears the end-of-file indicator for the stream.
15069 The value of the file position indicator for the stream after reading or discarding all
15070 pushed-back characters shall be the same as it was before the characters were pushed
15071 back. For a text stream, the value of its file position indicator after a successful call to the
15072 ungetc function is unspecified until all pushed-back characters are read or discarded.
15073 For a binary stream, its file position indicator is decremented by each successful call to
15074 the ungetc function; if its value was zero before a call, it is indeterminate after the
15075 call.<sup><a href="#note256"><b>256)</b></a></sup>
15076 <h6>Returns</h6>
15077 <p><!--para 6 -->
15078 The ungetc function returns the character pushed back after conversion, or EOF if the
15079 operation fails.
15080 <p><b> Forward references</b>: file positioning functions (<a href="#7.19.9">7.19.9</a>).
15085 <!--page 313 -->
15087 <h6>footnotes</h6>
15088 <p><small><a name="note256" href="#note256">256)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
15089 </small>
15091 <h4><a name="7.19.8" href="#7.19.8">7.19.8 Direct input/output functions</a></h4>
15093 <h5><a name="7.19.8.1" href="#7.19.8.1">7.19.8.1 The fread function</a></h5>
15094 <h6>Synopsis</h6>
15095 <p><!--para 1 -->
15096 <pre>
15097 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15098 size_t fread(void * restrict ptr,
15099 size_t size, size_t nmemb,
15100 FILE * restrict stream);
15101 </pre>
15102 <h6>Description</h6>
15103 <p><!--para 2 -->
15104 The fread function reads, into the array pointed to by ptr, up to nmemb elements
15105 whose size is specified by size, from the stream pointed to by stream. For each
15106 object, size calls are made to the fgetc function and the results stored, in the order
15107 read, in an array of unsigned char exactly overlaying the object. The file position
15108 indicator for the stream (if defined) is advanced by the number of characters successfully
15109 read. If an error occurs, the resulting value of the file position indicator for the stream is
15110 indeterminate. If a partial element is read, its value is indeterminate.
15111 <h6>Returns</h6>
15112 <p><!--para 3 -->
15113 The fread function returns the number of elements successfully read, which may be
15114 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
15115 fread returns zero and the contents of the array and the state of the stream remain
15116 unchanged.
15118 <h5><a name="7.19.8.2" href="#7.19.8.2">7.19.8.2 The fwrite function</a></h5>
15119 <h6>Synopsis</h6>
15120 <p><!--para 1 -->
15121 <pre>
15122 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15123 size_t fwrite(const void * restrict ptr,
15124 size_t size, size_t nmemb,
15125 FILE * restrict stream);
15126 </pre>
15127 <h6>Description</h6>
15128 <p><!--para 2 -->
15129 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
15130 whose size is specified by size, to the stream pointed to by stream. For each object,
15131 size calls are made to the fputc function, taking the values (in order) from an array of
15132 unsigned char exactly overlaying the object. The file position indicator for the
15133 stream (if defined) is advanced by the number of characters successfully written. If an
15134 error occurs, the resulting value of the file position indicator for the stream is
15135 indeterminate.
15136 <!--page 314 -->
15137 <h6>Returns</h6>
15138 <p><!--para 3 -->
15139 The fwrite function returns the number of elements successfully written, which will be
15140 less than nmemb only if a write error is encountered. If size or nmemb is zero,
15141 fwrite returns zero and the state of the stream remains unchanged.
15143 <h4><a name="7.19.9" href="#7.19.9">7.19.9 File positioning functions</a></h4>
15145 <h5><a name="7.19.9.1" href="#7.19.9.1">7.19.9.1 The fgetpos function</a></h5>
15146 <h6>Synopsis</h6>
15147 <p><!--para 1 -->
15148 <pre>
15149 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15150 int fgetpos(FILE * restrict stream,
15151 fpos_t * restrict pos);
15152 </pre>
15153 <h6>Description</h6>
15154 <p><!--para 2 -->
15155 The fgetpos function stores the current values of the parse state (if any) and file
15156 position indicator for the stream pointed to by stream in the object pointed to by pos.
15157 The values stored contain unspecified information usable by the fsetpos function for
15158 repositioning the stream to its position at the time of the call to the fgetpos function.
15159 <h6>Returns</h6>
15160 <p><!--para 3 -->
15161 If successful, the fgetpos function returns zero; on failure, the fgetpos function
15162 returns nonzero and stores an implementation-defined positive value in errno.
15163 <p><b> Forward references</b>: the fsetpos function (<a href="#7.19.9.3">7.19.9.3</a>).
15165 <h5><a name="7.19.9.2" href="#7.19.9.2">7.19.9.2 The fseek function</a></h5>
15166 <h6>Synopsis</h6>
15167 <p><!--para 1 -->
15168 <pre>
15169 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15170 int fseek(FILE *stream, long int offset, int whence);
15171 </pre>
15172 <h6>Description</h6>
15173 <p><!--para 2 -->
15174 The fseek function sets the file position indicator for the stream pointed to by stream.
15175 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
15176 <p><!--para 3 -->
15177 For a binary stream, the new position, measured in characters from the beginning of the
15178 file, is obtained by adding offset to the position specified by whence. The specified
15179 position is the beginning of the file if whence is SEEK_SET, the current value of the file
15180 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
15181 meaningfully support fseek calls with a whence value of SEEK_END.
15182 <p><!--para 4 -->
15183 For a text stream, either offset shall be zero, or offset shall be a value returned by
15184 an earlier successful call to the ftell function on a stream associated with the same file
15185 and whence shall be SEEK_SET.
15186 <!--page 315 -->
15187 <p><!--para 5 -->
15188 After determining the new position, a successful call to the fseek function undoes any
15189 effects of the ungetc function on the stream, clears the end-of-file indicator for the
15190 stream, and then establishes the new position. After a successful fseek call, the next
15191 operation on an update stream may be either input or output.
15192 <h6>Returns</h6>
15193 <p><!--para 6 -->
15194 The fseek function returns nonzero only for a request that cannot be satisfied.
15195 <p><b> Forward references</b>: the ftell function (<a href="#7.19.9.4">7.19.9.4</a>).
15197 <h5><a name="7.19.9.3" href="#7.19.9.3">7.19.9.3 The fsetpos function</a></h5>
15198 <h6>Synopsis</h6>
15199 <p><!--para 1 -->
15200 <pre>
15201 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15202 int fsetpos(FILE *stream, const fpos_t *pos);
15203 </pre>
15204 <h6>Description</h6>
15205 <p><!--para 2 -->
15206 The fsetpos function sets the mbstate_t object (if any) and file position indicator
15207 for the stream pointed to by stream according to the value of the object pointed to by
15208 pos, which shall be a value obtained from an earlier successful call to the fgetpos
15209 function on a stream associated with the same file. If a read or write error occurs, the
15210 error indicator for the stream is set and fsetpos fails.
15211 <p><!--para 3 -->
15212 A successful call to the fsetpos function undoes any effects of the ungetc function
15213 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
15214 parse state and position. After a successful fsetpos call, the next operation on an
15215 update stream may be either input or output.
15216 <h6>Returns</h6>
15217 <p><!--para 4 -->
15218 If successful, the fsetpos function returns zero; on failure, the fsetpos function
15219 returns nonzero and stores an implementation-defined positive value in errno.
15221 <h5><a name="7.19.9.4" href="#7.19.9.4">7.19.9.4 The ftell function</a></h5>
15222 <h6>Synopsis</h6>
15223 <p><!--para 1 -->
15224 <pre>
15225 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15226 long int ftell(FILE *stream);
15227 </pre>
15228 <h6>Description</h6>
15229 <p><!--para 2 -->
15230 The ftell function obtains the current value of the file position indicator for the stream
15231 pointed to by stream. For a binary stream, the value is the number of characters from
15232 the beginning of the file. For a text stream, its file position indicator contains unspecified
15233 information, usable by the fseek function for returning the file position indicator for the
15234 stream to its position at the time of the ftell call; the difference between two such
15235 return values is not necessarily a meaningful measure of the number of characters written
15236 <!--page 316 -->
15237 or read.
15238 <h6>Returns</h6>
15239 <p><!--para 3 -->
15240 If successful, the ftell function returns the current value of the file position indicator
15241 for the stream. On failure, the ftell function returns -1L and stores an
15242 implementation-defined positive value in errno.
15244 <h5><a name="7.19.9.5" href="#7.19.9.5">7.19.9.5 The rewind function</a></h5>
15245 <h6>Synopsis</h6>
15246 <p><!--para 1 -->
15247 <pre>
15248 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15249 void rewind(FILE *stream);
15250 </pre>
15251 <h6>Description</h6>
15252 <p><!--para 2 -->
15253 The rewind function sets the file position indicator for the stream pointed to by
15254 stream to the beginning of the file. It is equivalent to
15255 <pre>
15256 (void)fseek(stream, 0L, SEEK_SET)
15257 </pre>
15258 except that the error indicator for the stream is also cleared.
15259 <h6>Returns</h6>
15260 <p><!--para 3 -->
15261 The rewind function returns no value.
15263 <h4><a name="7.19.10" href="#7.19.10">7.19.10 Error-handling functions</a></h4>
15265 <h5><a name="7.19.10.1" href="#7.19.10.1">7.19.10.1 The clearerr function</a></h5>
15266 <h6>Synopsis</h6>
15267 <p><!--para 1 -->
15268 <pre>
15269 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15270 void clearerr(FILE *stream);
15271 </pre>
15272 <h6>Description</h6>
15273 <p><!--para 2 -->
15274 The clearerr function clears the end-of-file and error indicators for the stream pointed
15275 to by stream.
15276 <h6>Returns</h6>
15277 <p><!--para 3 -->
15278 The clearerr function returns no value.
15279 <!--page 317 -->
15281 <h5><a name="7.19.10.2" href="#7.19.10.2">7.19.10.2 The feof function</a></h5>
15282 <h6>Synopsis</h6>
15283 <p><!--para 1 -->
15284 <pre>
15285 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15286 int feof(FILE *stream);
15287 </pre>
15288 <h6>Description</h6>
15289 <p><!--para 2 -->
15290 The feof function tests the end-of-file indicator for the stream pointed to by stream.
15291 <h6>Returns</h6>
15292 <p><!--para 3 -->
15293 The feof function returns nonzero if and only if the end-of-file indicator is set for
15294 stream.
15296 <h5><a name="7.19.10.3" href="#7.19.10.3">7.19.10.3 The ferror function</a></h5>
15297 <h6>Synopsis</h6>
15298 <p><!--para 1 -->
15299 <pre>
15300 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15301 int ferror(FILE *stream);
15302 </pre>
15303 <h6>Description</h6>
15304 <p><!--para 2 -->
15305 The ferror function tests the error indicator for the stream pointed to by stream.
15306 <h6>Returns</h6>
15307 <p><!--para 3 -->
15308 The ferror function returns nonzero if and only if the error indicator is set for
15309 stream.
15311 <h5><a name="7.19.10.4" href="#7.19.10.4">7.19.10.4 The perror function</a></h5>
15312 <h6>Synopsis</h6>
15313 <p><!--para 1 -->
15314 <pre>
15315 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15316 void perror(const char *s);
15317 </pre>
15318 <h6>Description</h6>
15319 <p><!--para 2 -->
15320 The perror function maps the error number in the integer expression errno to an
15321 error message. It writes a sequence of characters to the standard error stream thus: first
15322 (if s is not a null pointer and the character pointed to by s is not the null character), the
15323 string pointed to by s followed by a colon (:) and a space; then an appropriate error
15324 message string followed by a new-line character. The contents of the error message
15325 strings are the same as those returned by the strerror function with argument errno.
15326 <h6>Returns</h6>
15327 <p><!--para 3 -->
15328 The perror function returns no value.
15329 <p><b> Forward references</b>: the strerror function (<a href="#7.21.6.2">7.21.6.2</a>).
15330 <!--page 318 -->
15332 <h3><a name="7.20" href="#7.20">7.20 General utilities <stdlib.h></a></h3>
15333 <p><!--para 1 -->
15334 The header <a href="#7.20">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
15335 defines several macros.<sup><a href="#note257"><b>257)</b></a></sup>
15336 <p><!--para 2 -->
15337 The types declared are size_t and wchar_t (both described in <a href="#7.17">7.17</a>),
15338 <pre>
15339 div_t
15340 </pre>
15341 which is a structure type that is the type of the value returned by the div function,
15342 <pre>
15343 ldiv_t
15344 </pre>
15345 which is a structure type that is the type of the value returned by the ldiv function, and
15346 <pre>
15347 lldiv_t
15348 </pre>
15349 which is a structure type that is the type of the value returned by the lldiv function.
15350 <p><!--para 3 -->
15351 The macros defined are NULL (described in <a href="#7.17">7.17</a>);
15352 <pre>
15353 EXIT_FAILURE
15354 </pre>
15356 <pre>
15357 EXIT_SUCCESS
15358 </pre>
15359 which expand to integer constant expressions that can be used as the argument to the
15360 exit function to return unsuccessful or successful termination status, respectively, to the
15361 host environment;
15362 <pre>
15363 RAND_MAX
15364 </pre>
15365 which expands to an integer constant expression that is the maximum value returned by
15366 the rand function; and
15367 <pre>
15368 MB_CUR_MAX
15369 </pre>
15370 which expands to a positive integer expression with type size_t that is the maximum
15371 number of bytes in a multibyte character for the extended character set specified by the
15372 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
15377 <!--page 319 -->
15379 <h6>footnotes</h6>
15380 <p><small><a name="note257" href="#note257">257)</a> See ''future library directions'' (<a href="#7.26.10">7.26.10</a>).
15381 </small>
15383 <h4><a name="7.20.1" href="#7.20.1">7.20.1 Numeric conversion functions</a></h4>
15384 <p><!--para 1 -->
15385 The functions atof, atoi, atol, and atoll need not affect the value of the integer
15386 expression errno on an error. If the value of the result cannot be represented, the
15387 behavior is undefined.
15389 <h5><a name="7.20.1.1" href="#7.20.1.1">7.20.1.1 The atof function</a></h5>
15390 <h6>Synopsis</h6>
15391 <p><!--para 1 -->
15392 <pre>
15393 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15394 double atof(const char *nptr);
15395 </pre>
15396 <h6>Description</h6>
15397 <p><!--para 2 -->
15398 The atof function converts the initial portion of the string pointed to by nptr to
15399 double representation. Except for the behavior on error, it is equivalent to
15400 <pre>
15401 strtod(nptr, (char **)NULL)
15402 </pre>
15403 <h6>Returns</h6>
15404 <p><!--para 3 -->
15405 The atof function returns the converted value.
15406 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
15408 <h5><a name="7.20.1.2" href="#7.20.1.2">7.20.1.2 The atoi, atol, and atoll functions</a></h5>
15409 <h6>Synopsis</h6>
15410 <p><!--para 1 -->
15411 <pre>
15412 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15413 int atoi(const char *nptr);
15414 long int atol(const char *nptr);
15415 long long int atoll(const char *nptr);
15416 </pre>
15417 <h6>Description</h6>
15418 <p><!--para 2 -->
15419 The atoi, atol, and atoll functions convert the initial portion of the string pointed
15420 to by nptr to int, long int, and long long int representation, respectively.
15421 Except for the behavior on error, they are equivalent to
15422 <pre>
15423 atoi: (int)strtol(nptr, (char **)NULL, 10)
15424 atol: strtol(nptr, (char **)NULL, 10)
15425 atoll: strtoll(nptr, (char **)NULL, 10)
15426 </pre>
15427 <h6>Returns</h6>
15428 <p><!--para 3 -->
15429 The atoi, atol, and atoll functions return the converted value.
15430 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
15431 (<a href="#7.20.1.4">7.20.1.4</a>).
15432 <!--page 320 -->
15434 <h5><a name="7.20.1.3" href="#7.20.1.3">7.20.1.3 The strtod, strtof, and strtold functions</a></h5>
15435 <h6>Synopsis</h6>
15436 <p><!--para 1 -->
15437 <pre>
15438 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15439 double strtod(const char * restrict nptr,
15440 char ** restrict endptr);
15441 float strtof(const char * restrict nptr,
15442 char ** restrict endptr);
15443 long double strtold(const char * restrict nptr,
15444 char ** restrict endptr);
15445 </pre>
15446 <h6>Description</h6>
15447 <p><!--para 2 -->
15448 The strtod, strtof, and strtold functions convert the initial portion of the string
15449 pointed to by nptr to double, float, and long double representation,
15450 respectively. First, they decompose the input string into three parts: an initial, possibly
15451 empty, sequence of white-space characters (as specified by the isspace function), a
15452 subject sequence resembling a floating-point constant or representing an infinity or NaN;
15453 and a final string of one or more unrecognized characters, including the terminating null
15454 character of the input string. Then, they attempt to convert the subject sequence to a
15455 floating-point number, and return the result.
15456 <p><!--para 3 -->
15457 The expected form of the subject sequence is an optional plus or minus sign, then one of
15458 the following:
15459 <ul>
15460 <li> a nonempty sequence of decimal digits optionally containing a decimal-point
15461 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
15462 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
15463 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
15464 <li> INF or INFINITY, ignoring case
15465 <li> NAN or NAN(n-char-sequence<sub>opt</sub>), ignoring case in the NAN part, where:
15466 <pre>
15467 n-char-sequence:
15468 digit
15469 nondigit
15470 n-char-sequence digit
15471 n-char-sequence nondigit
15472 </pre>
15473 </ul>
15474 The subject sequence is defined as the longest initial subsequence of the input string,
15475 starting with the first non-white-space character, that is of the expected form. The subject
15476 sequence contains no characters if the input string is not of the expected form.
15477 <p><!--para 4 -->
15478 If the subject sequence has the expected form for a floating-point number, the sequence of
15479 characters starting with the first digit or the decimal-point character (whichever occurs
15480 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
15481 <!--page 321 -->
15482 decimal-point character is used in place of a period, and that if neither an exponent part
15483 nor a decimal-point character appears in a decimal floating point number, or if a binary
15484 exponent part does not appear in a hexadecimal floating point number, an exponent part
15485 of the appropriate type with value zero is assumed to follow the last digit in the string. If
15486 the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note258"><b>258)</b></a></sup>
15487 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
15488 the return type, else like a floating constant that is too large for the range of the return
15489 type. A character sequence NAN or NAN(n-char-sequence<sub>opt</sub>), is interpreted as a quiet
15490 NaN, if supported in the return type, else like a subject sequence part that does not have
15491 the expected form; the meaning of the n-char sequences is implementation-defined.<sup><a href="#note259"><b>259)</b></a></sup> A
15492 pointer to the final string is stored in the object pointed to by endptr, provided that
15493 endptr is not a null pointer.
15494 <p><!--para 5 -->
15495 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
15496 value resulting from the conversion is correctly rounded.
15497 <p><!--para 6 -->
15498 In other than the "C" locale, additional locale-specific subject sequence forms may be
15499 accepted.
15500 <p><!--para 7 -->
15501 If the subject sequence is empty or does not have the expected form, no conversion is
15502 performed; the value of nptr is stored in the object pointed to by endptr, provided
15503 that endptr is not a null pointer.
15504 <h6>Recommended practice</h6>
15505 <p><!--para 8 -->
15506 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
15507 the result is not exactly representable, the result should be one of the two numbers in the
15508 appropriate internal format that are adjacent to the hexadecimal floating source value,
15509 with the extra stipulation that the error should have a correct sign for the current rounding
15510 direction.
15511 <p><!--para 9 -->
15512 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
15513 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
15514 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
15515 consider the two bounding, adjacent decimal strings L and U, both having
15516 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
15517 The result should be one of the (equal or adjacent) values that would be obtained by
15518 correctly rounding L and U according to the current rounding direction, with the extra
15520 <!--page 322 -->
15521 stipulation that the error with respect to D should have a correct sign for the current
15522 rounding direction.<sup><a href="#note260"><b>260)</b></a></sup>
15523 <h6>Returns</h6>
15524 <p><!--para 10 -->
15525 The functions return the converted value, if any. If no conversion could be performed,
15526 zero is returned. If the correct value is outside the range of representable values, plus or
15527 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
15528 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
15529 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
15530 than the smallest normalized positive number in the return type; whether errno acquires
15531 the value ERANGE is implementation-defined.
15533 <h6>footnotes</h6>
15534 <p><small><a name="note258" href="#note258">258)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
15535 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
15536 methods may yield different results if rounding is toward positive or negative infinity. In either case,
15537 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
15538 </small>
15539 <p><small><a name="note259" href="#note259">259)</a> An implementation may use the n-char sequence to determine extra information to be represented in
15540 the NaN's significand.
15541 </small>
15542 <p><small><a name="note260" href="#note260">260)</a> DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
15543 to the same internal floating value, but if not will round to adjacent values.
15544 </small>
15546 <h5><a name="7.20.1.4" href="#7.20.1.4">7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions</a></h5>
15547 <h6>Synopsis</h6>
15548 <p><!--para 1 -->
15549 <pre>
15550 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15551 long int strtol(
15552 const char * restrict nptr,
15553 char ** restrict endptr,
15554 int base);
15555 long long int strtoll(
15556 const char * restrict nptr,
15557 char ** restrict endptr,
15558 int base);
15559 unsigned long int strtoul(
15560 const char * restrict nptr,
15561 char ** restrict endptr,
15562 int base);
15563 unsigned long long int strtoull(
15564 const char * restrict nptr,
15565 char ** restrict endptr,
15566 int base);
15567 </pre>
15568 <h6>Description</h6>
15569 <p><!--para 2 -->
15570 The strtol, strtoll, strtoul, and strtoull functions convert the initial
15571 portion of the string pointed to by nptr to long int, long long int, unsigned
15572 long int, and unsigned long long int representation, respectively. First,
15573 they decompose the input string into three parts: an initial, possibly empty, sequence of
15574 white-space characters (as specified by the isspace function), a subject sequence
15577 <!--page 323 -->
15578 resembling an integer represented in some radix determined by the value of base, and a
15579 final string of one or more unrecognized characters, including the terminating null
15580 character of the input string. Then, they attempt to convert the subject sequence to an
15581 integer, and return the result.
15582 <p><!--para 3 -->
15583 If the value of base is zero, the expected form of the subject sequence is that of an
15584 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
15585 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
15586 expected form of the subject sequence is a sequence of letters and digits representing an
15587 integer with the radix specified by base, optionally preceded by a plus or minus sign,
15588 but not including an integer suffix. The letters from a (or A) through z (or Z) are
15589 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
15590 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
15591 optionally precede the sequence of letters and digits, following the sign if present.
15592 <p><!--para 4 -->
15593 The subject sequence is defined as the longest initial subsequence of the input string,
15594 starting with the first non-white-space character, that is of the expected form. The subject
15595 sequence contains no characters if the input string is empty or consists entirely of white
15596 space, or if the first non-white-space character is other than a sign or a permissible letter
15597 or digit.
15598 <p><!--para 5 -->
15599 If the subject sequence has the expected form and the value of base is zero, the sequence
15600 of characters starting with the first digit is interpreted as an integer constant according to
15601 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
15602 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
15603 as given above. If the subject sequence begins with a minus sign, the value resulting from
15604 the conversion is negated (in the return type). A pointer to the final string is stored in the
15605 object pointed to by endptr, provided that endptr is not a null pointer.
15606 <p><!--para 6 -->
15607 In other than the "C" locale, additional locale-specific subject sequence forms may be
15608 accepted.
15609 <p><!--para 7 -->
15610 If the subject sequence is empty or does not have the expected form, no conversion is
15611 performed; the value of nptr is stored in the object pointed to by endptr, provided
15612 that endptr is not a null pointer.
15613 <h6>Returns</h6>
15614 <p><!--para 8 -->
15615 The strtol, strtoll, strtoul, and strtoull functions return the converted
15616 value, if any. If no conversion could be performed, zero is returned. If the correct value
15617 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
15618 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
15619 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
15620 <!--page 324 -->
15622 <h4><a name="7.20.2" href="#7.20.2">7.20.2 Pseudo-random sequence generation functions</a></h4>
15624 <h5><a name="7.20.2.1" href="#7.20.2.1">7.20.2.1 The rand function</a></h5>
15625 <h6>Synopsis</h6>
15626 <p><!--para 1 -->
15627 <pre>
15628 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15629 int rand(void);
15630 </pre>
15631 <h6>Description</h6>
15632 <p><!--para 2 -->
15633 The rand function computes a sequence of pseudo-random integers in the range 0 to
15634 RAND_MAX.
15635 <p><!--para 3 -->
15636 The implementation shall behave as if no library function calls the rand function.
15637 <h6>Returns</h6>
15638 <p><!--para 4 -->
15639 The rand function returns a pseudo-random integer.
15640 <h6>Environmental limits</h6>
15641 <p><!--para 5 -->
15642 The value of the RAND_MAX macro shall be at least 32767.
15644 <h5><a name="7.20.2.2" href="#7.20.2.2">7.20.2.2 The srand function</a></h5>
15645 <h6>Synopsis</h6>
15646 <p><!--para 1 -->
15647 <pre>
15648 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15649 void srand(unsigned int seed);
15650 </pre>
15651 <h6>Description</h6>
15652 <p><!--para 2 -->
15653 The srand function uses the argument as a seed for a new sequence of pseudo-random
15654 numbers to be returned by subsequent calls to rand. If srand is then called with the
15655 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
15656 called before any calls to srand have been made, the same sequence shall be generated
15657 as when srand is first called with a seed value of 1.
15658 <p><!--para 3 -->
15659 The implementation shall behave as if no library function calls the srand function.
15660 <h6>Returns</h6>
15661 <p><!--para 4 -->
15662 The srand function returns no value.
15663 <p><!--para 5 -->
15664 EXAMPLE The following functions define a portable implementation of rand and srand.
15665 <!--page 325 -->
15666 <pre>
15667 static unsigned long int next = 1;
15668 int rand(void) // RAND_MAX assumed to be 32767
15670 next = next * 1103515245 + 12345;
15671 return (unsigned int)(next/65536) % 32768;
15673 void srand(unsigned int seed)
15675 next = seed;
15677 </pre>
15680 <h4><a name="7.20.3" href="#7.20.3">7.20.3 Memory management functions</a></h4>
15681 <p><!--para 1 -->
15682 The order and contiguity of storage allocated by successive calls to the calloc,
15683 malloc, and realloc functions is unspecified. The pointer returned if the allocation
15684 succeeds is suitably aligned so that it may be assigned to a pointer to any type of object
15685 and then used to access such an object or an array of such objects in the space allocated
15686 (until the space is explicitly deallocated). The lifetime of an allocated object extends
15687 from the allocation until the deallocation. Each such allocation shall yield a pointer to an
15688 object disjoint from any other object. The pointer returned points to the start (lowest byte
15689 address) of the allocated space. If the space cannot be allocated, a null pointer is
15690 returned. If the size of the space requested is zero, the behavior is implementation-
15691 defined: either a null pointer is returned, or the behavior is as if the size were some
15692 nonzero value, except that the returned pointer shall not be used to access an object.
15694 <h5><a name="7.20.3.1" href="#7.20.3.1">7.20.3.1 The calloc function</a></h5>
15695 <h6>Synopsis</h6>
15696 <p><!--para 1 -->
15697 <pre>
15698 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15699 void *calloc(size_t nmemb, size_t size);
15700 </pre>
15701 <h6>Description</h6>
15702 <p><!--para 2 -->
15703 The calloc function allocates space for an array of nmemb objects, each of whose size
15704 is size. The space is initialized to all bits zero.<sup><a href="#note261"><b>261)</b></a></sup>
15705 <h6>Returns</h6>
15706 <p><!--para 3 -->
15707 The calloc function returns either a null pointer or a pointer to the allocated space.
15709 <h6>footnotes</h6>
15710 <p><small><a name="note261" href="#note261">261)</a> Note that this need not be the same as the representation of floating-point zero or a null pointer
15711 constant.
15712 </small>
15714 <h5><a name="7.20.3.2" href="#7.20.3.2">7.20.3.2 The free function</a></h5>
15715 <h6>Synopsis</h6>
15716 <p><!--para 1 -->
15717 <pre>
15718 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15719 void free(void *ptr);
15720 </pre>
15721 <h6>Description</h6>
15722 <p><!--para 2 -->
15723 The free function causes the space pointed to by ptr to be deallocated, that is, made
15724 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
15725 the argument does not match a pointer earlier returned by the calloc, malloc, or
15728 <!--page 326 -->
15729 realloc function, or if the space has been deallocated by a call to free or realloc,
15730 the behavior is undefined.
15731 <h6>Returns</h6>
15732 <p><!--para 3 -->
15733 The free function returns no value.
15735 <h5><a name="7.20.3.3" href="#7.20.3.3">7.20.3.3 The malloc function</a></h5>
15736 <h6>Synopsis</h6>
15737 <p><!--para 1 -->
15738 <pre>
15739 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15740 void *malloc(size_t size);
15741 </pre>
15742 <h6>Description</h6>
15743 <p><!--para 2 -->
15744 The malloc function allocates space for an object whose size is specified by size and
15745 whose value is indeterminate.
15746 <h6>Returns</h6>
15747 <p><!--para 3 -->
15748 The malloc function returns either a null pointer or a pointer to the allocated space.
15750 <h5><a name="7.20.3.4" href="#7.20.3.4">7.20.3.4 The realloc function</a></h5>
15751 <h6>Synopsis</h6>
15752 <p><!--para 1 -->
15753 <pre>
15754 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15755 void *realloc(void *ptr, size_t size);
15756 </pre>
15757 <h6>Description</h6>
15758 <p><!--para 2 -->
15759 The realloc function deallocates the old object pointed to by ptr and returns a
15760 pointer to a new object that has the size specified by size. The contents of the new
15761 object shall be the same as that of the old object prior to deallocation, up to the lesser of
15762 the new and old sizes. Any bytes in the new object beyond the size of the old object have
15763 indeterminate values.
15764 <p><!--para 3 -->
15765 If ptr is a null pointer, the realloc function behaves like the malloc function for the
15766 specified size. Otherwise, if ptr does not match a pointer earlier returned by the
15767 calloc, malloc, or realloc function, or if the space has been deallocated by a call
15768 to the free or realloc function, the behavior is undefined. If memory for the new
15769 object cannot be allocated, the old object is not deallocated and its value is unchanged.
15770 <h6>Returns</h6>
15771 <p><!--para 4 -->
15772 The realloc function returns a pointer to the new object (which may have the same
15773 value as a pointer to the old object), or a null pointer if the new object could not be
15774 allocated.
15775 <!--page 327 -->
15777 <h4><a name="7.20.4" href="#7.20.4">7.20.4 Communication with the environment</a></h4>
15779 <h5><a name="7.20.4.1" href="#7.20.4.1">7.20.4.1 The abort function</a></h5>
15780 <h6>Synopsis</h6>
15781 <p><!--para 1 -->
15782 <pre>
15783 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15784 void abort(void);
15785 </pre>
15786 <h6>Description</h6>
15787 <p><!--para 2 -->
15788 The abort function causes abnormal program termination to occur, unless the signal
15789 SIGABRT is being caught and the signal handler does not return. Whether open streams
15790 with unwritten buffered data are flushed, open streams are closed, or temporary files are
15791 removed is implementation-defined. An implementation-defined form of the status
15792 unsuccessful termination is returned to the host environment by means of the function
15793 call raise(SIGABRT).
15794 <h6>Returns</h6>
15795 <p><!--para 3 -->
15796 The abort function does not return to its caller.
15798 <h5><a name="7.20.4.2" href="#7.20.4.2">7.20.4.2 The atexit function</a></h5>
15799 <h6>Synopsis</h6>
15800 <p><!--para 1 -->
15801 <pre>
15802 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15803 int atexit(void (*func)(void));
15804 </pre>
15805 <h6>Description</h6>
15806 <p><!--para 2 -->
15807 The atexit function registers the function pointed to by func, to be called without
15808 arguments at normal program termination.
15809 <h6>Environmental limits</h6>
15810 <p><!--para 3 -->
15811 The implementation shall support the registration of at least 32 functions.
15812 <h6>Returns</h6>
15813 <p><!--para 4 -->
15814 The atexit function returns zero if the registration succeeds, nonzero if it fails.
15815 <p><b> Forward references</b>: the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
15817 <h5><a name="7.20.4.3" href="#7.20.4.3">7.20.4.3 The exit function</a></h5>
15818 <h6>Synopsis</h6>
15819 <p><!--para 1 -->
15820 <pre>
15821 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15822 void exit(int status);
15823 </pre>
15824 <h6>Description</h6>
15825 <p><!--para 2 -->
15826 The exit function causes normal program termination to occur. If more than one call to
15827 the exit function is executed by a program, the behavior is undefined.
15828 <!--page 328 -->
15829 <p><!--para 3 -->
15830 First, all functions registered by the atexit function are called, in the reverse order of
15831 their registration,<sup><a href="#note262"><b>262)</b></a></sup> except that a function is called after any previously registered
15832 functions that had already been called at the time it was registered. If, during the call to
15833 any such function, a call to the longjmp function is made that would terminate the call
15834 to the registered function, the behavior is undefined.
15835 <p><!--para 4 -->
15836 Next, all open streams with unwritten buffered data are flushed, all open streams are
15837 closed, and all files created by the tmpfile function are removed.
15838 <p><!--para 5 -->
15839 Finally, control is returned to the host environment. If the value of status is zero or
15840 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
15841 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
15842 of the status unsuccessful termination is returned. Otherwise the status returned is
15843 implementation-defined.
15844 <h6>Returns</h6>
15845 <p><!--para 6 -->
15846 The exit function cannot return to its caller.
15848 <h6>footnotes</h6>
15849 <p><small><a name="note262" href="#note262">262)</a> Each function is called as many times as it was registered, and in the correct order with respect to
15850 other registered functions.
15851 </small>
15853 <h5><a name="7.20.4.4" href="#7.20.4.4">7.20.4.4 The _Exit function</a></h5>
15854 <h6>Synopsis</h6>
15855 <p><!--para 1 -->
15856 <pre>
15857 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15858 void _Exit(int status);
15859 </pre>
15860 <h6>Description</h6>
15861 <p><!--para 2 -->
15862 The _Exit function causes normal program termination to occur and control to be
15863 returned to the host environment. No functions registered by the atexit function or
15864 signal handlers registered by the signal function are called. The status returned to the
15865 host environment is determined in the same way as for the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
15866 Whether open streams with unwritten buffered data are flushed, open streams are closed,
15867 or temporary files are removed is implementation-defined.
15868 <h6>Returns</h6>
15869 <p><!--para 3 -->
15870 The _Exit function cannot return to its caller.
15875 <!--page 329 -->
15877 <h5><a name="7.20.4.5" href="#7.20.4.5">7.20.4.5 The getenv function</a></h5>
15878 <h6>Synopsis</h6>
15879 <p><!--para 1 -->
15880 <pre>
15881 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15882 char *getenv(const char *name);
15883 </pre>
15884 <h6>Description</h6>
15885 <p><!--para 2 -->
15886 The getenv function searches an environment list, provided by the host environment,
15887 for a string that matches the string pointed to by name. The set of environment names
15888 and the method for altering the environment list are implementation-defined.
15889 <p><!--para 3 -->
15890 The implementation shall behave as if no library function calls the getenv function.
15891 <h6>Returns</h6>
15892 <p><!--para 4 -->
15893 The getenv function returns a pointer to a string associated with the matched list
15894 member. The string pointed to shall not be modified by the program, but may be
15895 overwritten by a subsequent call to the getenv function. If the specified name cannot
15896 be found, a null pointer is returned.
15898 <h5><a name="7.20.4.6" href="#7.20.4.6">7.20.4.6 The system function</a></h5>
15899 <h6>Synopsis</h6>
15900 <p><!--para 1 -->
15901 <pre>
15902 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15903 int system(const char *string);
15904 </pre>
15905 <h6>Description</h6>
15906 <p><!--para 2 -->
15907 If string is a null pointer, the system function determines whether the host
15908 environment has a command processor. If string is not a null pointer, the system
15909 function passes the string pointed to by string to that command processor to be
15910 executed in a manner which the implementation shall document; this might then cause the
15911 program calling system to behave in a non-conforming manner or to terminate.
15912 <h6>Returns</h6>
15913 <p><!--para 3 -->
15914 If the argument is a null pointer, the system function returns nonzero only if a
15915 command processor is available. If the argument is not a null pointer, and the system
15916 function does return, it returns an implementation-defined value.
15917 <!--page 330 -->
15919 <h4><a name="7.20.5" href="#7.20.5">7.20.5 Searching and sorting utilities</a></h4>
15920 <p><!--para 1 -->
15921 These utilities make use of a comparison function to search or sort arrays of unspecified
15922 type. Where an argument declared as size_t nmemb specifies the length of the array
15923 for a function, nmemb can have the value zero on a call to that function; the comparison
15924 function is not called, a search finds no matching element, and sorting performs no
15925 rearrangement. Pointer arguments on such a call shall still have valid values, as described
15926 in <a href="#7.1.4">7.1.4</a>.
15927 <p><!--para 2 -->
15928 The implementation shall ensure that the second argument of the comparison function
15929 (when called from bsearch), or both arguments (when called from qsort), are
15930 pointers to elements of the array.<sup><a href="#note263"><b>263)</b></a></sup> The first argument when called from bsearch
15931 shall equal key.
15932 <p><!--para 3 -->
15933 The comparison function shall not alter the contents of the array. The implementation
15934 may reorder elements of the array between calls to the comparison function, but shall not
15935 alter the contents of any individual element.
15936 <p><!--para 4 -->
15937 When the same objects (consisting of size bytes, irrespective of their current positions
15938 in the array) are passed more than once to the comparison function, the results shall be
15939 consistent with one another. That is, for qsort they shall define a total ordering on the
15940 array, and for bsearch the same object shall always compare the same way with the
15941 key.
15942 <p><!--para 5 -->
15943 A sequence point occurs immediately before and immediately after each call to the
15944 comparison function, and also between any call to the comparison function and any
15945 movement of the objects passed as arguments to that call.
15947 <h6>footnotes</h6>
15948 <p><small><a name="note263" href="#note263">263)</a> That is, if the value passed is p, then the following expressions are always nonzero:
15950 <pre>
15951 ((char *)p - (char *)base) % size == 0
15952 (char *)p &gt;= (char *)base
15953 (char *)p &lt; (char *)base + nmemb * size
15954 </pre>
15955 </small>
15957 <h5><a name="7.20.5.1" href="#7.20.5.1">7.20.5.1 The bsearch function</a></h5>
15958 <h6>Synopsis</h6>
15959 <p><!--para 1 -->
15960 <pre>
15961 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15962 void *bsearch(const void *key, const void *base,
15963 size_t nmemb, size_t size,
15964 int (*compar)(const void *, const void *));
15965 </pre>
15966 <h6>Description</h6>
15967 <p><!--para 2 -->
15968 The bsearch function searches an array of nmemb objects, the initial element of which
15969 is pointed to by base, for an element that matches the object pointed to by key. The
15972 <!--page 331 -->
15973 size of each element of the array is specified by size.
15974 <p><!--para 3 -->
15975 The comparison function pointed to by compar is called with two arguments that point
15976 to the key object and to an array element, in that order. The function shall return an
15977 integer less than, equal to, or greater than zero if the key object is considered,
15978 respectively, to be less than, to match, or to be greater than the array element. The array
15979 shall consist of: all the elements that compare less than, all the elements that compare
15980 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>
15981 <h6>Returns</h6>
15982 <p><!--para 4 -->
15983 The bsearch function returns a pointer to a matching element of the array, or a null
15984 pointer if no match is found. If two elements compare as equal, which element is
15985 matched is unspecified.
15987 <h6>footnotes</h6>
15988 <p><small><a name="note264" href="#note264">264)</a> In practice, the entire array is sorted according to the comparison function.
15989 </small>
15991 <h5><a name="7.20.5.2" href="#7.20.5.2">7.20.5.2 The qsort function</a></h5>
15992 <h6>Synopsis</h6>
15993 <p><!--para 1 -->
15994 <pre>
15995 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15996 void qsort(void *base, size_t nmemb, size_t size,
15997 int (*compar)(const void *, const void *));
15998 </pre>
15999 <h6>Description</h6>
16000 <p><!--para 2 -->
16001 The qsort function sorts an array of nmemb objects, the initial element of which is
16002 pointed to by base. The size of each object is specified by size.
16003 <p><!--para 3 -->
16004 The contents of the array are sorted into ascending order according to a comparison
16005 function pointed to by compar, which is called with two arguments that point to the
16006 objects being compared. The function shall return an integer less than, equal to, or
16007 greater than zero if the first argument is considered to be respectively less than, equal to,
16008 or greater than the second.
16009 <p><!--para 4 -->
16010 If two elements compare as equal, their order in the resulting sorted array is unspecified.
16011 <h6>Returns</h6>
16012 <p><!--para 5 -->
16013 The qsort function returns no value.
16018 <!--page 332 -->
16020 <h4><a name="7.20.6" href="#7.20.6">7.20.6 Integer arithmetic functions</a></h4>
16022 <h5><a name="7.20.6.1" href="#7.20.6.1">7.20.6.1 The abs, labs and llabs functions</a></h5>
16023 <h6>Synopsis</h6>
16024 <p><!--para 1 -->
16025 <pre>
16026 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16027 int abs(int j);
16028 long int labs(long int j);
16029 long long int llabs(long long int j);
16030 </pre>
16031 <h6>Description</h6>
16032 <p><!--para 2 -->
16033 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
16034 result cannot be represented, the behavior is undefined.<sup><a href="#note265"><b>265)</b></a></sup>
16035 <h6>Returns</h6>
16036 <p><!--para 3 -->
16037 The abs, labs, and llabs, functions return the absolute value.
16039 <h6>footnotes</h6>
16040 <p><small><a name="note265" href="#note265">265)</a> The absolute value of the most negative number cannot be represented in two's complement.
16041 </small>
16043 <h5><a name="7.20.6.2" href="#7.20.6.2">7.20.6.2 The div, ldiv, and lldiv functions</a></h5>
16044 <h6>Synopsis</h6>
16045 <p><!--para 1 -->
16046 <pre>
16047 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16048 div_t div(int numer, int denom);
16049 ldiv_t ldiv(long int numer, long int denom);
16050 lldiv_t lldiv(long long int numer, long long int denom);
16051 </pre>
16052 <h6>Description</h6>
16053 <p><!--para 2 -->
16054 The div, ldiv, and lldiv, functions compute numer / denom and numer %
16055 denom in a single operation.
16056 <h6>Returns</h6>
16057 <p><!--para 3 -->
16058 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
16059 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
16060 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
16061 each of which has the same type as the arguments numer and denom. If either part of
16062 the result cannot be represented, the behavior is undefined.
16067 <!--page 333 -->
16069 <h4><a name="7.20.7" href="#7.20.7">7.20.7 Multibyte/wide character conversion functions</a></h4>
16070 <p><!--para 1 -->
16071 The behavior of the multibyte character functions is affected by the LC_CTYPE category
16072 of the current locale. For a state-dependent encoding, each function is placed into its
16073 initial conversion state by a call for which its character pointer argument, s, is a null
16074 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
16075 state of the function to be altered as necessary. A call with s as a null pointer causes
16076 these functions to return a nonzero value if encodings have state dependency, and zero
16077 otherwise.<sup><a href="#note266"><b>266)</b></a></sup> Changing the LC_CTYPE category causes the conversion state of these
16078 functions to be indeterminate.
16080 <h6>footnotes</h6>
16081 <p><small><a name="note266" href="#note266">266)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
16082 character codes, but are grouped with an adjacent multibyte character.
16083 </small>
16085 <h5><a name="7.20.7.1" href="#7.20.7.1">7.20.7.1 The mblen function</a></h5>
16086 <h6>Synopsis</h6>
16087 <p><!--para 1 -->
16088 <pre>
16089 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16090 int mblen(const char *s, size_t n);
16091 </pre>
16092 <h6>Description</h6>
16093 <p><!--para 2 -->
16094 If s is not a null pointer, the mblen function determines the number of bytes contained
16095 in the multibyte character pointed to by s. Except that the conversion state of the
16096 mbtowc function is not affected, it is equivalent to
16097 <p><!--para 3 -->
16098 <pre>
16099 mbtowc((wchar_t *)0, s, n);
16100 </pre>
16101 The implementation shall behave as if no library function calls the mblen function.
16102 <h6>Returns</h6>
16103 <p><!--para 4 -->
16104 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
16105 character encodings, respectively, do or do not have state-dependent encodings. If s is
16106 not a null pointer, the mblen function either returns 0 (if s points to the null character),
16107 or returns the number of bytes that are contained in the multibyte character (if the next n
16108 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
16109 multibyte character).
16110 <p><b> Forward references</b>: the mbtowc function (<a href="#7.20.7.2">7.20.7.2</a>).
16115 <!--page 334 -->
16117 <h5><a name="7.20.7.2" href="#7.20.7.2">7.20.7.2 The mbtowc function</a></h5>
16118 <h6>Synopsis</h6>
16119 <p><!--para 1 -->
16120 <pre>
16121 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16122 int mbtowc(wchar_t * restrict pwc,
16123 const char * restrict s,
16124 size_t n);
16125 </pre>
16126 <h6>Description</h6>
16127 <p><!--para 2 -->
16128 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
16129 the byte pointed to by s to determine the number of bytes needed to complete the next
16130 multibyte character (including any shift sequences). If the function determines that the
16131 next multibyte character is complete and valid, it determines the value of the
16132 corresponding wide character and then, if pwc is not a null pointer, stores that value in
16133 the object pointed to by pwc. If the corresponding wide character is the null wide
16134 character, the function is left in the initial conversion state.
16135 <p><!--para 3 -->
16136 The implementation shall behave as if no library function calls the mbtowc function.
16137 <h6>Returns</h6>
16138 <p><!--para 4 -->
16139 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
16140 character encodings, respectively, do or do not have state-dependent encodings. If s is
16141 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
16142 or returns the number of bytes that are contained in the converted multibyte character (if
16143 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
16144 form a valid multibyte character).
16145 <p><!--para 5 -->
16146 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
16147 macro.
16149 <h5><a name="7.20.7.3" href="#7.20.7.3">7.20.7.3 The wctomb function</a></h5>
16150 <h6>Synopsis</h6>
16151 <p><!--para 1 -->
16152 <pre>
16153 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16154 int wctomb(char *s, wchar_t wc);
16155 </pre>
16156 <h6>Description</h6>
16157 <p><!--para 2 -->
16158 The wctomb function determines the number of bytes needed to represent the multibyte
16159 character corresponding to the wide character given by wc (including any shift
16160 sequences), and stores the multibyte character representation in the array whose first
16161 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
16162 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
16163 sequence needed to restore the initial shift state, and the function is left in the initial
16164 conversion state.
16165 <!--page 335 -->
16166 <p><!--para 3 -->
16167 The implementation shall behave as if no library function calls the wctomb function.
16168 <h6>Returns</h6>
16169 <p><!--para 4 -->
16170 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
16171 character encodings, respectively, do or do not have state-dependent encodings. If s is
16172 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
16173 to a valid multibyte character, or returns the number of bytes that are contained in the
16174 multibyte character corresponding to the value of wc.
16175 <p><!--para 5 -->
16176 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
16178 <h4><a name="7.20.8" href="#7.20.8">7.20.8 Multibyte/wide string conversion functions</a></h4>
16179 <p><!--para 1 -->
16180 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
16181 the current locale.
16183 <h5><a name="7.20.8.1" href="#7.20.8.1">7.20.8.1 The mbstowcs function</a></h5>
16184 <h6>Synopsis</h6>
16185 <p><!--para 1 -->
16186 <pre>
16187 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16188 size_t mbstowcs(wchar_t * restrict pwcs,
16189 const char * restrict s,
16190 size_t n);
16191 </pre>
16192 <h6>Description</h6>
16193 <p><!--para 2 -->
16194 The mbstowcs function converts a sequence of multibyte characters that begins in the
16195 initial shift state from the array pointed to by s into a sequence of corresponding wide
16196 characters and stores not more than n wide characters into the array pointed to by pwcs.
16197 No multibyte characters that follow a null character (which is converted into a null wide
16198 character) will be examined or converted. Each multibyte character is converted as if by
16199 a call to the mbtowc function, except that the conversion state of the mbtowc function is
16200 not affected.
16201 <p><!--para 3 -->
16202 No more than n elements will be modified in the array pointed to by pwcs. If copying
16203 takes place between objects that overlap, the behavior is undefined.
16204 <h6>Returns</h6>
16205 <p><!--para 4 -->
16206 If an invalid multibyte character is encountered, the mbstowcs function returns
16207 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
16208 elements modified, not including a terminating null wide character, if any.<sup><a href="#note267"><b>267)</b></a></sup>
16213 <!--page 336 -->
16215 <h6>footnotes</h6>
16216 <p><small><a name="note267" href="#note267">267)</a> The array will not be null-terminated if the value returned is n.
16217 </small>
16219 <h5><a name="7.20.8.2" href="#7.20.8.2">7.20.8.2 The wcstombs function</a></h5>
16220 <h6>Synopsis</h6>
16221 <p><!--para 1 -->
16222 <pre>
16223 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16224 size_t wcstombs(char * restrict s,
16225 const wchar_t * restrict pwcs,
16226 size_t n);
16227 </pre>
16228 <h6>Description</h6>
16229 <p><!--para 2 -->
16230 The wcstombs function converts a sequence of wide characters from the array pointed
16231 to by pwcs into a sequence of corresponding multibyte characters that begins in the
16232 initial shift state, and stores these multibyte characters into the array pointed to by s,
16233 stopping if a multibyte character would exceed the limit of n total bytes or if a null
16234 character is stored. Each wide character is converted as if by a call to the wctomb
16235 function, except that the conversion state of the wctomb function is not affected.
16236 <p><!--para 3 -->
16237 No more than n bytes will be modified in the array pointed to by s. If copying takes place
16238 between objects that overlap, the behavior is undefined.
16239 <h6>Returns</h6>
16240 <p><!--para 4 -->
16241 If a wide character is encountered that does not correspond to a valid multibyte character,
16242 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
16243 returns the number of bytes modified, not including a terminating null character, if
16244 any.<sup><a href="#note267"><b>267)</b></a></sup>
16245 <!--page 337 -->
16247 <h3><a name="7.21" href="#7.21">7.21 String handling <string.h></a></h3>
16249 <h4><a name="7.21.1" href="#7.21.1">7.21.1 String function conventions</a></h4>
16250 <p><!--para 1 -->
16251 The header <a href="#7.21">&lt;string.h&gt;</a> declares one type and several functions, and defines one
16252 macro useful for manipulating arrays of character type and other objects treated as arrays
16253 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
16254 <a href="#7.17">7.17</a>). Various methods are used for determining the lengths of the arrays, but in all cases
16255 a char * or void * argument points to the initial (lowest addressed) character of the
16256 array. If an array is accessed beyond the end of an object, the behavior is undefined.
16257 <p><!--para 2 -->
16258 Where an argument declared as size_t n specifies the length of the array for a
16259 function, n can have the value zero on a call to that function. Unless explicitly stated
16260 otherwise in the description of a particular function in this subclause, pointer arguments
16261 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
16262 function that locates a character finds no occurrence, a function that compares two
16263 character sequences returns zero, and a function that copies characters copies zero
16264 characters.
16265 <p><!--para 3 -->
16266 For all functions in this subclause, each character shall be interpreted as if it had the type
16267 unsigned char (and therefore every possible object representation is valid and has a
16268 different value).
16270 <h6>footnotes</h6>
16271 <p><small><a name="note268" href="#note268">268)</a> See ''future library directions'' (<a href="#7.26.11">7.26.11</a>).
16272 </small>
16274 <h4><a name="7.21.2" href="#7.21.2">7.21.2 Copying functions</a></h4>
16276 <h5><a name="7.21.2.1" href="#7.21.2.1">7.21.2.1 The memcpy function</a></h5>
16277 <h6>Synopsis</h6>
16278 <p><!--para 1 -->
16279 <pre>
16280 #include <a href="#7.21">&lt;string.h&gt;</a>
16281 void *memcpy(void * restrict s1,
16282 const void * restrict s2,
16283 size_t n);
16284 </pre>
16285 <h6>Description</h6>
16286 <p><!--para 2 -->
16287 The memcpy function copies n characters from the object pointed to by s2 into the
16288 object pointed to by s1. If copying takes place between objects that overlap, the behavior
16289 is undefined.
16290 <h6>Returns</h6>
16291 <p><!--para 3 -->
16292 The memcpy function returns the value of s1.
16297 <!--page 338 -->
16299 <h5><a name="7.21.2.2" href="#7.21.2.2">7.21.2.2 The memmove function</a></h5>
16300 <h6>Synopsis</h6>
16301 <p><!--para 1 -->
16302 <pre>
16303 #include <a href="#7.21">&lt;string.h&gt;</a>
16304 void *memmove(void *s1, const void *s2, size_t n);
16305 </pre>
16306 <h6>Description</h6>
16307 <p><!--para 2 -->
16308 The memmove function copies n characters from the object pointed to by s2 into the
16309 object pointed to by s1. Copying takes place as if the n characters from the object
16310 pointed to by s2 are first copied into a temporary array of n characters that does not
16311 overlap the objects pointed to by s1 and s2, and then the n characters from the
16312 temporary array are copied into the object pointed to by s1.
16313 <h6>Returns</h6>
16314 <p><!--para 3 -->
16315 The memmove function returns the value of s1.
16317 <h5><a name="7.21.2.3" href="#7.21.2.3">7.21.2.3 The strcpy function</a></h5>
16318 <h6>Synopsis</h6>
16319 <p><!--para 1 -->
16320 <pre>
16321 #include <a href="#7.21">&lt;string.h&gt;</a>
16322 char *strcpy(char * restrict s1,
16323 const char * restrict s2);
16324 </pre>
16325 <h6>Description</h6>
16326 <p><!--para 2 -->
16327 The strcpy function copies the string pointed to by s2 (including the terminating null
16328 character) into the array pointed to by s1. If copying takes place between objects that
16329 overlap, the behavior is undefined.
16330 <h6>Returns</h6>
16331 <p><!--para 3 -->
16332 The strcpy function returns the value of s1.
16334 <h5><a name="7.21.2.4" href="#7.21.2.4">7.21.2.4 The strncpy function</a></h5>
16335 <h6>Synopsis</h6>
16336 <p><!--para 1 -->
16337 <pre>
16338 #include <a href="#7.21">&lt;string.h&gt;</a>
16339 char *strncpy(char * restrict s1,
16340 const char * restrict s2,
16341 size_t n);
16342 </pre>
16343 <h6>Description</h6>
16344 <p><!--para 2 -->
16345 The strncpy function copies not more than n characters (characters that follow a null
16346 character are not copied) from the array pointed to by s2 to the array pointed to by
16347 <!--page 339 -->
16348 s1.<sup><a href="#note269"><b>269)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
16349 <p><!--para 3 -->
16350 If the array pointed to by s2 is a string that is shorter than n characters, null characters
16351 are appended to the copy in the array pointed to by s1, until n characters in all have been
16352 written.
16353 <h6>Returns</h6>
16354 <p><!--para 4 -->
16355 The strncpy function returns the value of s1.
16357 <h6>footnotes</h6>
16358 <p><small><a name="note269" href="#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
16359 not be null-terminated.
16360 </small>
16362 <h4><a name="7.21.3" href="#7.21.3">7.21.3 Concatenation functions</a></h4>
16364 <h5><a name="7.21.3.1" href="#7.21.3.1">7.21.3.1 The strcat function</a></h5>
16365 <h6>Synopsis</h6>
16366 <p><!--para 1 -->
16367 <pre>
16368 #include <a href="#7.21">&lt;string.h&gt;</a>
16369 char *strcat(char * restrict s1,
16370 const char * restrict s2);
16371 </pre>
16372 <h6>Description</h6>
16373 <p><!--para 2 -->
16374 The strcat function appends a copy of the string pointed to by s2 (including the
16375 terminating null character) to the end of the string pointed to by s1. The initial character
16376 of s2 overwrites the null character at the end of s1. If copying takes place between
16377 objects that overlap, the behavior is undefined.
16378 <h6>Returns</h6>
16379 <p><!--para 3 -->
16380 The strcat function returns the value of s1.
16382 <h5><a name="7.21.3.2" href="#7.21.3.2">7.21.3.2 The strncat function</a></h5>
16383 <h6>Synopsis</h6>
16384 <p><!--para 1 -->
16385 <pre>
16386 #include <a href="#7.21">&lt;string.h&gt;</a>
16387 char *strncat(char * restrict s1,
16388 const char * restrict s2,
16389 size_t n);
16390 </pre>
16391 <h6>Description</h6>
16392 <p><!--para 2 -->
16393 The strncat function appends not more than n characters (a null character and
16394 characters that follow it are not appended) from the array pointed to by s2 to the end of
16395 the string pointed to by s1. The initial character of s2 overwrites the null character at the
16396 end of s1. A terminating null character is always appended to the result.<sup><a href="#note270"><b>270)</b></a></sup> If copying
16398 <!--page 340 -->
16399 takes place between objects that overlap, the behavior is undefined.
16400 <h6>Returns</h6>
16401 <p><!--para 3 -->
16402 The strncat function returns the value of s1.
16403 <p><b> Forward references</b>: the strlen function (<a href="#7.21.6.3">7.21.6.3</a>).
16405 <h6>footnotes</h6>
16406 <p><small><a name="note270" href="#note270">270)</a> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
16407 strlen(s1)+n+1.
16408 </small>
16410 <h4><a name="7.21.4" href="#7.21.4">7.21.4 Comparison functions</a></h4>
16411 <p><!--para 1 -->
16412 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
16413 and strncmp is determined by the sign of the difference between the values of the first
16414 pair of characters (both interpreted as unsigned char) that differ in the objects being
16415 compared.
16417 <h5><a name="7.21.4.1" href="#7.21.4.1">7.21.4.1 The memcmp function</a></h5>
16418 <h6>Synopsis</h6>
16419 <p><!--para 1 -->
16420 <pre>
16421 #include <a href="#7.21">&lt;string.h&gt;</a>
16422 int memcmp(const void *s1, const void *s2, size_t n);
16423 </pre>
16424 <h6>Description</h6>
16425 <p><!--para 2 -->
16426 The memcmp function compares the first n characters of the object pointed to by s1 to
16427 the first n characters of the object pointed to by s2.<sup><a href="#note271"><b>271)</b></a></sup>
16428 <h6>Returns</h6>
16429 <p><!--para 3 -->
16430 The memcmp function returns an integer greater than, equal to, or less than zero,
16431 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
16432 pointed to by s2.
16434 <h6>footnotes</h6>
16435 <p><small><a name="note271" href="#note271">271)</a> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
16436 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
16437 comparison.
16438 </small>
16440 <h5><a name="7.21.4.2" href="#7.21.4.2">7.21.4.2 The strcmp function</a></h5>
16441 <h6>Synopsis</h6>
16442 <p><!--para 1 -->
16443 <pre>
16444 #include <a href="#7.21">&lt;string.h&gt;</a>
16445 int strcmp(const char *s1, const char *s2);
16446 </pre>
16447 <h6>Description</h6>
16448 <p><!--para 2 -->
16449 The strcmp function compares the string pointed to by s1 to the string pointed to by
16451 <h6>Returns</h6>
16452 <p><!--para 3 -->
16453 The strcmp function returns an integer greater than, equal to, or less than zero,
16454 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
16456 <!--page 341 -->
16457 pointed to by s2.
16459 <h5><a name="7.21.4.3" href="#7.21.4.3">7.21.4.3 The strcoll function</a></h5>
16460 <h6>Synopsis</h6>
16461 <p><!--para 1 -->
16462 <pre>
16463 #include <a href="#7.21">&lt;string.h&gt;</a>
16464 int strcoll(const char *s1, const char *s2);
16465 </pre>
16466 <h6>Description</h6>
16467 <p><!--para 2 -->
16468 The strcoll function compares the string pointed to by s1 to the string pointed to by
16469 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
16470 <h6>Returns</h6>
16471 <p><!--para 3 -->
16472 The strcoll function returns an integer greater than, equal to, or less than zero,
16473 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
16474 pointed to by s2 when both are interpreted as appropriate to the current locale.
16476 <h5><a name="7.21.4.4" href="#7.21.4.4">7.21.4.4 The strncmp function</a></h5>
16477 <h6>Synopsis</h6>
16478 <p><!--para 1 -->
16479 <pre>
16480 #include <a href="#7.21">&lt;string.h&gt;</a>
16481 int strncmp(const char *s1, const char *s2, size_t n);
16482 </pre>
16483 <h6>Description</h6>
16484 <p><!--para 2 -->
16485 The strncmp function compares not more than n characters (characters that follow a
16486 null character are not compared) from the array pointed to by s1 to the array pointed to
16487 by s2.
16488 <h6>Returns</h6>
16489 <p><!--para 3 -->
16490 The strncmp function returns an integer greater than, equal to, or less than zero,
16491 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
16492 to, or less than the possibly null-terminated array pointed to by s2.
16494 <h5><a name="7.21.4.5" href="#7.21.4.5">7.21.4.5 The strxfrm function</a></h5>
16495 <h6>Synopsis</h6>
16496 <p><!--para 1 -->
16497 <pre>
16498 #include <a href="#7.21">&lt;string.h&gt;</a>
16499 size_t strxfrm(char * restrict s1,
16500 const char * restrict s2,
16501 size_t n);
16502 </pre>
16503 <h6>Description</h6>
16504 <p><!--para 2 -->
16505 The strxfrm function transforms the string pointed to by s2 and places the resulting
16506 string into the array pointed to by s1. The transformation is such that if the strcmp
16507 function is applied to two transformed strings, it returns a value greater than, equal to, or
16508 <!--page 342 -->
16509 less than zero, corresponding to the result of the strcoll function applied to the same
16510 two original strings. No more than n characters are placed into the resulting array
16511 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
16512 be a null pointer. If copying takes place between objects that overlap, the behavior is
16513 undefined.
16514 <h6>Returns</h6>
16515 <p><!--para 3 -->
16516 The strxfrm function returns the length of the transformed string (not including the
16517 terminating null character). If the value returned is n or more, the contents of the array
16518 pointed to by s1 are indeterminate.
16519 <p><!--para 4 -->
16520 EXAMPLE The value of the following expression is the size of the array needed to hold the
16521 transformation of the string pointed to by s.
16522 <pre>
16523 1 + strxfrm(NULL, s, 0)
16524 </pre>
16527 <h4><a name="7.21.5" href="#7.21.5">7.21.5 Search functions</a></h4>
16529 <h5><a name="7.21.5.1" href="#7.21.5.1">7.21.5.1 The memchr function</a></h5>
16530 <h6>Synopsis</h6>
16531 <p><!--para 1 -->
16532 <pre>
16533 #include <a href="#7.21">&lt;string.h&gt;</a>
16534 void *memchr(const void *s, int c, size_t n);
16535 </pre>
16536 <h6>Description</h6>
16537 <p><!--para 2 -->
16538 The memchr function locates the first occurrence of c (converted to an unsigned
16539 char) in the initial n characters (each interpreted as unsigned char) of the object
16540 pointed to by s.
16541 <h6>Returns</h6>
16542 <p><!--para 3 -->
16543 The memchr function returns a pointer to the located character, or a null pointer if the
16544 character does not occur in the object.
16546 <h5><a name="7.21.5.2" href="#7.21.5.2">7.21.5.2 The strchr function</a></h5>
16547 <h6>Synopsis</h6>
16548 <p><!--para 1 -->
16549 <pre>
16550 #include <a href="#7.21">&lt;string.h&gt;</a>
16551 char *strchr(const char *s, int c);
16552 </pre>
16553 <h6>Description</h6>
16554 <p><!--para 2 -->
16555 The strchr function locates the first occurrence of c (converted to a char) in the
16556 string pointed to by s. The terminating null character is considered to be part of the
16557 string.
16558 <h6>Returns</h6>
16559 <p><!--para 3 -->
16560 The strchr function returns a pointer to the located character, or a null pointer if the
16561 character does not occur in the string.
16562 <!--page 343 -->
16564 <h5><a name="7.21.5.3" href="#7.21.5.3">7.21.5.3 The strcspn function</a></h5>
16565 <h6>Synopsis</h6>
16566 <p><!--para 1 -->
16567 <pre>
16568 #include <a href="#7.21">&lt;string.h&gt;</a>
16569 size_t strcspn(const char *s1, const char *s2);
16570 </pre>
16571 <h6>Description</h6>
16572 <p><!--para 2 -->
16573 The strcspn function computes the length of the maximum initial segment of the string
16574 pointed to by s1 which consists entirely of characters not from the string pointed to by
16576 <h6>Returns</h6>
16577 <p><!--para 3 -->
16578 The strcspn function returns the length of the segment.
16580 <h5><a name="7.21.5.4" href="#7.21.5.4">7.21.5.4 The strpbrk function</a></h5>
16581 <h6>Synopsis</h6>
16582 <p><!--para 1 -->
16583 <pre>
16584 #include <a href="#7.21">&lt;string.h&gt;</a>
16585 char *strpbrk(const char *s1, const char *s2);
16586 </pre>
16587 <h6>Description</h6>
16588 <p><!--para 2 -->
16589 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
16590 character from the string pointed to by s2.
16591 <h6>Returns</h6>
16592 <p><!--para 3 -->
16593 The strpbrk function returns a pointer to the character, or a null pointer if no character
16594 from s2 occurs in s1.
16596 <h5><a name="7.21.5.5" href="#7.21.5.5">7.21.5.5 The strrchr function</a></h5>
16597 <h6>Synopsis</h6>
16598 <p><!--para 1 -->
16599 <pre>
16600 #include <a href="#7.21">&lt;string.h&gt;</a>
16601 char *strrchr(const char *s, int c);
16602 </pre>
16603 <h6>Description</h6>
16604 <p><!--para 2 -->
16605 The strrchr function locates the last occurrence of c (converted to a char) in the
16606 string pointed to by s. The terminating null character is considered to be part of the
16607 string.
16608 <h6>Returns</h6>
16609 <p><!--para 3 -->
16610 The strrchr function returns a pointer to the character, or a null pointer if c does not
16611 occur in the string.
16612 <!--page 344 -->
16614 <h5><a name="7.21.5.6" href="#7.21.5.6">7.21.5.6 The strspn function</a></h5>
16615 <h6>Synopsis</h6>
16616 <p><!--para 1 -->
16617 <pre>
16618 #include <a href="#7.21">&lt;string.h&gt;</a>
16619 size_t strspn(const char *s1, const char *s2);
16620 </pre>
16621 <h6>Description</h6>
16622 <p><!--para 2 -->
16623 The strspn function computes the length of the maximum initial segment of the string
16624 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
16625 <h6>Returns</h6>
16626 <p><!--para 3 -->
16627 The strspn function returns the length of the segment.
16629 <h5><a name="7.21.5.7" href="#7.21.5.7">7.21.5.7 The strstr function</a></h5>
16630 <h6>Synopsis</h6>
16631 <p><!--para 1 -->
16632 <pre>
16633 #include <a href="#7.21">&lt;string.h&gt;</a>
16634 char *strstr(const char *s1, const char *s2);
16635 </pre>
16636 <h6>Description</h6>
16637 <p><!--para 2 -->
16638 The strstr function locates the first occurrence in the string pointed to by s1 of the
16639 sequence of characters (excluding the terminating null character) in the string pointed to
16640 by s2.
16641 <h6>Returns</h6>
16642 <p><!--para 3 -->
16643 The strstr function returns a pointer to the located string, or a null pointer if the string
16644 is not found. If s2 points to a string with zero length, the function returns s1.
16646 <h5><a name="7.21.5.8" href="#7.21.5.8">7.21.5.8 The strtok function</a></h5>
16647 <h6>Synopsis</h6>
16648 <p><!--para 1 -->
16649 <pre>
16650 #include <a href="#7.21">&lt;string.h&gt;</a>
16651 char *strtok(char * restrict s1,
16652 const char * restrict s2);
16653 </pre>
16654 <h6>Description</h6>
16655 <p><!--para 2 -->
16656 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
16657 sequence of tokens, each of which is delimited by a character from the string pointed to
16658 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
16659 sequence have a null first argument. The separator string pointed to by s2 may be
16660 different from call to call.
16661 <p><!--para 3 -->
16662 The first call in the sequence searches the string pointed to by s1 for the first character
16663 that is not contained in the current separator string pointed to by s2. If no such character
16664 is found, then there are no tokens in the string pointed to by s1 and the strtok function
16665 <!--page 345 -->
16666 returns a null pointer. If such a character is found, it is the start of the first token.
16667 <p><!--para 4 -->
16668 The strtok function then searches from there for a character that is contained in the
16669 current separator string. If no such character is found, the current token extends to the
16670 end of the string pointed to by s1, and subsequent searches for a token will return a null
16671 pointer. If such a character is found, it is overwritten by a null character, which
16672 terminates the current token. The strtok function saves a pointer to the following
16673 character, from which the next search for a token will start.
16674 <p><!--para 5 -->
16675 Each subsequent call, with a null pointer as the value of the first argument, starts
16676 searching from the saved pointer and behaves as described above.
16677 <p><!--para 6 -->
16678 The implementation shall behave as if no library function calls the strtok function.
16679 <h6>Returns</h6>
16680 <p><!--para 7 -->
16681 The strtok function returns a pointer to the first character of a token, or a null pointer
16682 if there is no token.
16683 <p><!--para 8 -->
16684 EXAMPLE
16685 <pre>
16686 #include <a href="#7.21">&lt;string.h&gt;</a>
16687 static char str[] = "?a???b,,,#c";
16688 char *t;
16689 t = strtok(str, "?"); // t points to the token "a"
16690 t = strtok(NULL, ","); // t points to the token "??b"
16691 t = strtok(NULL, "#,"); // t points to the token "c"
16692 t = strtok(NULL, "?"); // t is a null pointer
16693 </pre>
16696 <h4><a name="7.21.6" href="#7.21.6">7.21.6 Miscellaneous functions</a></h4>
16698 <h5><a name="7.21.6.1" href="#7.21.6.1">7.21.6.1 The memset function</a></h5>
16699 <h6>Synopsis</h6>
16700 <p><!--para 1 -->
16701 <pre>
16702 #include <a href="#7.21">&lt;string.h&gt;</a>
16703 void *memset(void *s, int c, size_t n);
16704 </pre>
16705 <h6>Description</h6>
16706 <p><!--para 2 -->
16707 The memset function copies the value of c (converted to an unsigned char) into
16708 each of the first n characters of the object pointed to by s.
16709 <h6>Returns</h6>
16710 <p><!--para 3 -->
16711 The memset function returns the value of s.
16712 <!--page 346 -->
16714 <h5><a name="7.21.6.2" href="#7.21.6.2">7.21.6.2 The strerror function</a></h5>
16715 <h6>Synopsis</h6>
16716 <p><!--para 1 -->
16717 <pre>
16718 #include <a href="#7.21">&lt;string.h&gt;</a>
16719 char *strerror(int errnum);
16720 </pre>
16721 <h6>Description</h6>
16722 <p><!--para 2 -->
16723 The strerror function maps the number in errnum to a message string. Typically,
16724 the values for errnum come from errno, but strerror shall map any value of type
16725 int to a message.
16726 <p><!--para 3 -->
16727 The implementation shall behave as if no library function calls the strerror function.
16728 <h6>Returns</h6>
16729 <p><!--para 4 -->
16730 The strerror function returns a pointer to the string, the contents of which are locale-
16731 specific. The array pointed to shall not be modified by the program, but may be
16732 overwritten by a subsequent call to the strerror function.
16734 <h5><a name="7.21.6.3" href="#7.21.6.3">7.21.6.3 The strlen function</a></h5>
16735 <h6>Synopsis</h6>
16736 <p><!--para 1 -->
16737 <pre>
16738 #include <a href="#7.21">&lt;string.h&gt;</a>
16739 size_t strlen(const char *s);
16740 </pre>
16741 <h6>Description</h6>
16742 <p><!--para 2 -->
16743 The strlen function computes the length of the string pointed to by s.
16744 <h6>Returns</h6>
16745 <p><!--para 3 -->
16746 The strlen function returns the number of characters that precede the terminating null
16747 character.
16748 <!--page 347 -->
16750 <h3><a name="7.22" href="#7.22">7.22 Type-generic math <tgmath.h></a></h3>
16751 <p><!--para 1 -->
16752 The header <a href="#7.22">&lt;tgmath.h&gt;</a> includes the headers <a href="#7.12">&lt;math.h&gt;</a> and <a href="#7.3">&lt;complex.h&gt;</a> and
16753 defines several type-generic macros.
16754 <p><!--para 2 -->
16755 Of the <a href="#7.12">&lt;math.h&gt;</a> and <a href="#7.3">&lt;complex.h&gt;</a> functions without an f (float) or l (long
16756 double) suffix, several have one or more parameters whose corresponding real type is
16757 double. For each such function, except modf, there is a corresponding type-generic
16758 macro.<sup><a href="#note272"><b>272)</b></a></sup> The parameters whose corresponding real type is double in the function
16759 synopsis are generic parameters. Use of the macro invokes a function whose
16760 corresponding real type and type domain are determined by the arguments for the generic
16761 parameters.<sup><a href="#note273"><b>273)</b></a></sup>
16762 <p><!--para 3 -->
16763 Use of the macro invokes a function whose generic parameters have the corresponding
16764 real type determined as follows:
16765 <ul>
16766 <li> First, if any argument for generic parameters has type long double, the type
16767 determined is long double.
16768 <li> Otherwise, if any argument for generic parameters has type double or is of integer
16769 type, the type determined is double.
16770 <li> Otherwise, the type determined is float.
16771 </ul>
16772 <p><!--para 4 -->
16773 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
16774 <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
16775 generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
16776 corresponding type-generic macro for fabs and cabs is fabs.
16781 <!--page 348 -->
16782 <pre>
16783 <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.3">&lt;complex.h&gt;</a> type-generic
16784 function function macro
16786 acos cacos acos
16787 asin casin asin
16788 atan catan atan
16789 acosh cacosh acosh
16790 asinh casinh asinh
16791 atanh catanh atanh
16792 cos ccos cos
16793 sin csin sin
16794 tan ctan tan
16795 cosh ccosh cosh
16796 sinh csinh sinh
16797 tanh ctanh tanh
16798 exp cexp exp
16799 log clog log
16800 pow cpow pow
16801 sqrt csqrt sqrt
16802 fabs cabs fabs
16803 </pre>
16804 If at least one argument for a generic parameter is complex, then use of the macro invokes
16805 a complex function; otherwise, use of the macro invokes a real function.
16806 <p><!--para 5 -->
16807 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
16808 <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
16809 name as the function. These type-generic macros are:
16810 <pre>
16811 atan2 fma llround remainder
16812 cbrt fmax log10 remquo
16813 ceil fmin log1p rint
16814 copysign fmod log2 round
16815 erf frexp logb scalbn
16816 erfc hypot lrint scalbln
16817 exp2 ilogb lround tgamma
16818 expm1 ldexp nearbyint trunc
16819 fdim lgamma nextafter
16820 floor llrint nexttoward
16821 </pre>
16822 If all arguments for generic parameters are real, then use of the macro invokes a real
16823 function; otherwise, use of the macro results in undefined behavior.
16824 <p><!--para 6 -->
16825 For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
16826 function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
16827 function. These type-generic macros are:
16828 <!--page 349 -->
16829 <pre>
16830 carg conj creal
16831 cimag cproj
16832 </pre>
16833 Use of the macro with any real or complex argument invokes a complex function.
16834 <p><!--para 7 -->
16835 EXAMPLE With the declarations
16836 <pre>
16837 #include <a href="#7.22">&lt;tgmath.h&gt;</a>
16838 int n;
16839 float f;
16840 double d;
16841 long double ld;
16842 float complex fc;
16843 double complex dc;
16844 long double complex ldc;
16845 </pre>
16846 functions invoked by use of type-generic macros are shown in the following table:
16847 <!--page 350 -->
16848 <pre>
16849 macro use invokes
16851 exp(n) exp(n), the function
16852 acosh(f) acoshf(f)
16853 sin(d) sin(d), the function
16854 atan(ld) atanl(ld)
16855 log(fc) clogf(fc)
16856 sqrt(dc) csqrt(dc)
16857 pow(ldc, f) cpowl(ldc, f)
16858 remainder(n, n) remainder(n, n), the function
16859 nextafter(d, f) nextafter(d, f), the function
16860 nexttoward(f, ld) nexttowardf(f, ld)
16861 copysign(n, ld) copysignl(n, ld)
16862 ceil(fc) undefined behavior
16863 rint(dc) undefined behavior
16864 fmax(ldc, ld) undefined behavior
16865 carg(n) carg(n), the function
16866 cproj(f) cprojf(f)
16867 creal(d) creal(d), the function
16868 cimag(ld) cimagl(ld)
16869 fabs(fc) cabsf(fc)
16870 carg(dc) carg(dc), the function
16871 cproj(ldc) cprojl(ldc)
16872 </pre>
16874 <h6>footnotes</h6>
16875 <p><small><a name="note272" href="#note272">272)</a> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
16876 make available the corresponding ordinary function.
16877 </small>
16878 <p><small><a name="note273" href="#note273">273)</a> If the type of the argument is not compatible with the type of the parameter for the selected function,
16879 the behavior is undefined.
16880 </small>
16882 <h3><a name="7.23" href="#7.23">7.23 Date and time <time.h></a></h3>
16884 <h4><a name="7.23.1" href="#7.23.1">7.23.1 Components of time</a></h4>
16885 <p><!--para 1 -->
16886 The header <a href="#7.23">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
16887 manipulating time. Many functions deal with a calendar time that represents the current
16888 date (according to the Gregorian calendar) and time. Some functions deal with local
16889 time, which is the calendar time expressed for some specific time zone, and with Daylight
16890 Saving Time, which is a temporary change in the algorithm for determining local time.
16891 The local time zone and Daylight Saving Time are implementation-defined.
16892 <p><!--para 2 -->
16893 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
16894 <pre>
16895 CLOCKS_PER_SEC
16896 </pre>
16897 which expands to an expression with type clock_t (described below) that is the
16898 number per second of the value returned by the clock function.
16899 <p><!--para 3 -->
16900 The types declared are size_t (described in <a href="#7.17">7.17</a>);
16901 <pre>
16902 clock_t
16903 </pre>
16905 <pre>
16906 time_t
16907 </pre>
16908 which are arithmetic types capable of representing times; and
16909 <pre>
16910 struct tm
16911 </pre>
16912 which holds the components of a calendar time, called the broken-down time.
16913 <p><!--para 4 -->
16914 The range and precision of times representable in clock_t and time_t are
16915 implementation-defined. The tm structure shall contain at least the following members,
16916 in any order. The semantics of the members and their normal ranges are expressed in the
16917 comments.<sup><a href="#note274"><b>274)</b></a></sup>
16918 <pre>
16919 int tm_sec; // seconds after the minute -- [0, 60]
16920 int tm_min; // minutes after the hour -- [0, 59]
16921 int tm_hour; // hours since midnight -- [0, 23]
16922 int tm_mday; // day of the month -- [1, 31]
16923 int tm_mon; // months since January -- [0, 11]
16924 int tm_year; // years since 1900
16925 int tm_wday; // days since Sunday -- [0, 6]
16926 int tm_yday; // days since January 1 -- [0, 365]
16927 int tm_isdst; // Daylight Saving Time flag
16928 </pre>
16932 <!--page 351 -->
16933 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
16934 Saving Time is not in effect, and negative if the information is not available.
16936 <h6>footnotes</h6>
16937 <p><small><a name="note274" href="#note274">274)</a> The range [0, 60] for tm_sec allows for a positive leap second.
16938 </small>
16940 <h4><a name="7.23.2" href="#7.23.2">7.23.2 Time manipulation functions</a></h4>
16942 <h5><a name="7.23.2.1" href="#7.23.2.1">7.23.2.1 The clock function</a></h5>
16943 <h6>Synopsis</h6>
16944 <p><!--para 1 -->
16945 <pre>
16946 #include <a href="#7.23">&lt;time.h&gt;</a>
16947 clock_t clock(void);
16948 </pre>
16949 <h6>Description</h6>
16950 <p><!--para 2 -->
16951 The clock function determines the processor time used.
16952 <h6>Returns</h6>
16953 <p><!--para 3 -->
16954 The clock function returns the implementation's best approximation to the processor
16955 time used by the program since the beginning of an implementation-defined era related
16956 only to the program invocation. To determine the time in seconds, the value returned by
16957 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
16958 the processor time used is not available or its value cannot be represented, the function
16959 returns the value (clock_t)(-1).<sup><a href="#note275"><b>275)</b></a></sup>
16961 <h6>footnotes</h6>
16962 <p><small><a name="note275" href="#note275">275)</a> In order to measure the time spent in a program, the clock function should be called at the start of
16963 the program and its return value subtracted from the value returned by subsequent calls.
16964 </small>
16966 <h5><a name="7.23.2.2" href="#7.23.2.2">7.23.2.2 The difftime function</a></h5>
16967 <h6>Synopsis</h6>
16968 <p><!--para 1 -->
16969 <pre>
16970 #include <a href="#7.23">&lt;time.h&gt;</a>
16971 double difftime(time_t time1, time_t time0);
16972 </pre>
16973 <h6>Description</h6>
16974 <p><!--para 2 -->
16975 The difftime function computes the difference between two calendar times: time1 -
16976 time0.
16977 <h6>Returns</h6>
16978 <p><!--para 3 -->
16979 The difftime function returns the difference expressed in seconds as a double.
16984 <!--page 352 -->
16986 <h5><a name="7.23.2.3" href="#7.23.2.3">7.23.2.3 The mktime function</a></h5>
16987 <h6>Synopsis</h6>
16988 <p><!--para 1 -->
16989 <pre>
16990 #include <a href="#7.23">&lt;time.h&gt;</a>
16991 time_t mktime(struct tm *timeptr);
16992 </pre>
16993 <h6>Description</h6>
16994 <p><!--para 2 -->
16995 The mktime function converts the broken-down time, expressed as local time, in the
16996 structure pointed to by timeptr into a calendar time value with the same encoding as
16997 that of the values returned by the time function. The original values of the tm_wday
16998 and tm_yday components of the structure are ignored, and the original values of the
16999 other components are not restricted to the ranges indicated above.<sup><a href="#note276"><b>276)</b></a></sup> On successful
17000 completion, the values of the tm_wday and tm_yday components of the structure are
17001 set appropriately, and the other components are set to represent the specified calendar
17002 time, but with their values forced to the ranges indicated above; the final value of
17003 tm_mday is not set until tm_mon and tm_year are determined.
17004 <h6>Returns</h6>
17005 <p><!--para 3 -->
17006 The mktime function returns the specified calendar time encoded as a value of type
17007 time_t. If the calendar time cannot be represented, the function returns the value
17008 (time_t)(-1).
17009 <p><!--para 4 -->
17010 EXAMPLE What day of the week is July 4, 2001?
17011 <pre>
17012 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17013 #include <a href="#7.23">&lt;time.h&gt;</a>
17014 static const char *const wday[] = {
17015 "Sunday", "Monday", "Tuesday", "Wednesday",
17016 "Thursday", "Friday", "Saturday", "-unknown-"
17018 struct tm time_str;
17019 /* ... */
17020 </pre>
17025 <!--page 353 -->
17026 <pre>
17027 time_str.tm_year = 2001 - 1900;
17028 time_str.tm_mon = 7 - 1;
17029 time_str.tm_mday = 4;
17030 time_str.tm_hour = 0;
17031 time_str.tm_min = 0;
17032 time_str.tm_sec = 1;
17033 time_str.tm_isdst = -1;
17034 if (mktime(&amp;time_str) == (time_t)(-1))
17035 time_str.tm_wday = 7;
17036 printf("%s\n", wday[time_str.tm_wday]);
17037 </pre>
17040 <h6>footnotes</h6>
17041 <p><small><a name="note276" href="#note276">276)</a> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
17042 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
17043 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
17044 </small>
17046 <h5><a name="7.23.2.4" href="#7.23.2.4">7.23.2.4 The time function</a></h5>
17047 <h6>Synopsis</h6>
17048 <p><!--para 1 -->
17049 <pre>
17050 #include <a href="#7.23">&lt;time.h&gt;</a>
17051 time_t time(time_t *timer);
17052 </pre>
17053 <h6>Description</h6>
17054 <p><!--para 2 -->
17055 The time function determines the current calendar time. The encoding of the value is
17056 unspecified.
17057 <h6>Returns</h6>
17058 <p><!--para 3 -->
17059 The time function returns the implementation's best approximation to the current
17060 calendar time. The value (time_t)(-1) is returned if the calendar time is not
17061 available. If timer is not a null pointer, the return value is also assigned to the object it
17062 points to.
17064 <h4><a name="7.23.3" href="#7.23.3">7.23.3 Time conversion functions</a></h4>
17065 <p><!--para 1 -->
17066 Except for the strftime function, these functions each return a pointer to one of two
17067 types of static objects: a broken-down time structure or an array of char. Execution of
17068 any of the functions that return a pointer to one of these object types may overwrite the
17069 information in any object of the same type pointed to by the value returned from any
17070 previous call to any of them. The implementation shall behave as if no other library
17071 functions call these functions.
17073 <h5><a name="7.23.3.1" href="#7.23.3.1">7.23.3.1 The asctime function</a></h5>
17074 <h6>Synopsis</h6>
17075 <p><!--para 1 -->
17076 <pre>
17077 #include <a href="#7.23">&lt;time.h&gt;</a>
17078 char *asctime(const struct tm *timeptr);
17079 </pre>
17080 <h6>Description</h6>
17081 <p><!--para 2 -->
17082 The asctime function converts the broken-down time in the structure pointed to by
17083 timeptr into a string in the form
17084 <!--page 354 -->
17085 <pre>
17086 Sun Sep 16 01:03:52 1973\n\0
17087 </pre>
17088 using the equivalent of the following algorithm.
17089 <pre>
17090 char *asctime(const struct tm *timeptr)
17092 static const char wday_name[7][3] = {
17093 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
17095 static const char mon_name[12][3] = {
17096 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
17097 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
17099 static char result[26];
17100 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
17101 wday_name[timeptr-&gt;tm_wday],
17102 mon_name[timeptr-&gt;tm_mon],
17103 timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
17104 timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
17105 1900 + timeptr-&gt;tm_year);
17106 return result;
17108 </pre>
17109 <h6>Returns</h6>
17110 <p><!--para 3 -->
17111 The asctime function returns a pointer to the string.
17113 <h5><a name="7.23.3.2" href="#7.23.3.2">7.23.3.2 The ctime function</a></h5>
17114 <h6>Synopsis</h6>
17115 <p><!--para 1 -->
17116 <pre>
17117 #include <a href="#7.23">&lt;time.h&gt;</a>
17118 char *ctime(const time_t *timer);
17119 </pre>
17120 <h6>Description</h6>
17121 <p><!--para 2 -->
17122 The ctime function converts the calendar time pointed to by timer to local time in the
17123 form of a string. It is equivalent to
17124 <pre>
17125 asctime(localtime(timer))
17126 </pre>
17127 <h6>Returns</h6>
17128 <p><!--para 3 -->
17129 The ctime function returns the pointer returned by the asctime function with that
17130 broken-down time as argument.
17131 <p><b> Forward references</b>: the localtime function (<a href="#7.23.3.4">7.23.3.4</a>).
17132 <!--page 355 -->
17134 <h5><a name="7.23.3.3" href="#7.23.3.3">7.23.3.3 The gmtime function</a></h5>
17135 <h6>Synopsis</h6>
17136 <p><!--para 1 -->
17137 <pre>
17138 #include <a href="#7.23">&lt;time.h&gt;</a>
17139 struct tm *gmtime(const time_t *timer);
17140 </pre>
17141 <h6>Description</h6>
17142 <p><!--para 2 -->
17143 The gmtime function converts the calendar time pointed to by timer into a broken-
17144 down time, expressed as UTC.
17145 <h6>Returns</h6>
17146 <p><!--para 3 -->
17147 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
17148 specified time cannot be converted to UTC.
17150 <h5><a name="7.23.3.4" href="#7.23.3.4">7.23.3.4 The localtime function</a></h5>
17151 <h6>Synopsis</h6>
17152 <p><!--para 1 -->
17153 <pre>
17154 #include <a href="#7.23">&lt;time.h&gt;</a>
17155 struct tm *localtime(const time_t *timer);
17156 </pre>
17157 <h6>Description</h6>
17158 <p><!--para 2 -->
17159 The localtime function converts the calendar time pointed to by timer into a
17160 broken-down time, expressed as local time.
17161 <h6>Returns</h6>
17162 <p><!--para 3 -->
17163 The localtime function returns a pointer to the broken-down time, or a null pointer if
17164 the specified time cannot be converted to local time.
17166 <h5><a name="7.23.3.5" href="#7.23.3.5">7.23.3.5 The strftime function</a></h5>
17167 <h6>Synopsis</h6>
17168 <p><!--para 1 -->
17169 <pre>
17170 #include <a href="#7.23">&lt;time.h&gt;</a>
17171 size_t strftime(char * restrict s,
17172 size_t maxsize,
17173 const char * restrict format,
17174 const struct tm * restrict timeptr);
17175 </pre>
17176 <h6>Description</h6>
17177 <p><!--para 2 -->
17178 The strftime function places characters into the array pointed to by s as controlled by
17179 the string pointed to by format. The format shall be a multibyte character sequence,
17180 beginning and ending in its initial shift state. The format string consists of zero or
17181 more conversion specifiers and ordinary multibyte characters. A conversion specifier
17182 consists of a % character, possibly followed by an E or O modifier character (described
17183 below), followed by a character that determines the behavior of the conversion specifier.
17184 All ordinary multibyte characters (including the terminating null character) are copied
17185 <!--page 356 -->
17186 unchanged into the array. If copying takes place between objects that overlap, the
17187 behavior is undefined. No more than maxsize characters are placed into the array.
17188 <p><!--para 3 -->
17189 Each conversion specifier is replaced by appropriate characters as described in the
17190 following list. The appropriate characters are determined using the LC_TIME category
17191 of the current locale and by the values of zero or more members of the broken-down time
17192 structure pointed to by timeptr, as specified in brackets in the description. If any of
17193 the specified values is outside the normal range, the characters stored are unspecified.
17194 <dl>
17195 <dt> %a <dd> is replaced by the locale's abbreviated weekday name. [tm_wday]
17196 <dt> %A <dd> is replaced by the locale's full weekday name. [tm_wday]
17197 <dt> %b <dd> is replaced by the locale's abbreviated month name. [tm_mon]
17198 <dt> %B <dd> is replaced by the locale's full month name. [tm_mon]
17199 <dt> %c <dd> is replaced by the locale's appropriate date and time representation. [all specified
17200 in <a href="#7.23.1">7.23.1</a>]
17201 <dt> %C <dd> is replaced by the year divided by 100 and truncated to an integer, as a decimal
17202 number (00-99). [tm_year]
17203 <dt> %d <dd> is replaced by the day of the month as a decimal number (01-31). [tm_mday]
17204 <dt> %D <dd> is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
17205 <dt> %e <dd> is replaced by the day of the month as a decimal number (1-31); a single digit is
17206 preceded by a space. [tm_mday]
17207 <dt> %F <dd> is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
17208 tm_mday]
17209 <dt> %g <dd> is replaced by the last 2 digits of the week-based year (see below) as a decimal
17210 number (00-99). [tm_year, tm_wday, tm_yday]
17211 <dt> %G <dd> is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
17212 [tm_year, tm_wday, tm_yday]
17213 <dt> %h <dd> is equivalent to ''%b''. [tm_mon]
17214 <dt> %H <dd> is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
17215 <dt> %I <dd> is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
17216 <dt> %j <dd> is replaced by the day of the year as a decimal number (001-366). [tm_yday]
17217 <dt> %m <dd> is replaced by the month as a decimal number (01-12). [tm_mon]
17218 <dt> %M <dd> is replaced by the minute as a decimal number (00-59). [tm_min]
17219 <dt> %n <dd> is replaced by a new-line character.
17220 <dt> %p <dd> is replaced by the locale's equivalent of the AM/PM designations associated with a
17221 12-hour clock. [tm_hour]
17222 <dt> %r <dd> is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
17223 <dt> %R <dd> is equivalent to ''%H:%M''. [tm_hour, tm_min]
17224 <dt> %S <dd> is replaced by the second as a decimal number (00-60). [tm_sec]
17225 <dt> %t <dd> is replaced by a horizontal-tab character.
17226 <dt> %T <dd> is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
17227 <!--page 357 -->
17228 tm_sec]
17229 <dt> %u <dd>is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
17230 is 1. [tm_wday]
17231 <dt> %U <dd> is replaced by the week number of the year (the first Sunday as the first day of week
17232 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
17233 <dt> %V <dd> is replaced by the ISO 8601 week number (see below) as a decimal number
17234 (01-53). [tm_year, tm_wday, tm_yday]
17235 <dt> %w <dd> is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
17236 [tm_wday]
17237 <dt> %W <dd> is replaced by the week number of the year (the first Monday as the first day of
17238 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
17239 <dt> %x <dd> is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
17240 <dt> %X <dd> is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
17241 <dt> %y <dd> is replaced by the last 2 digits of the year as a decimal number (00-99).
17242 [tm_year]
17243 <dt> %Y <dd> is replaced by the year as a decimal number (e.g., 1997). [tm_year]
17244 <dt> %z <dd> is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
17245 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
17246 zone is determinable. [tm_isdst]
17247 <dt> %Z <dd> is replaced by the locale's time zone name or abbreviation, or by no characters if no
17248 time zone is determinable. [tm_isdst]
17249 <dt> %% <dd> is replaced by %.
17250 </dl>
17251 <p><!--para 4 -->
17252 Some conversion specifiers can be modified by the inclusion of an E or O modifier
17253 character to indicate an alternative format or specification. If the alternative format or
17254 specification does not exist for the current locale, the modifier is ignored.
17255 <dl>
17256 <dt> %Ec <dd> is replaced by the locale's alternative date and time representation.
17257 <dt> %EC <dd>is replaced by the name of the base year (period) in the locale's alternative
17258 representation.
17259 <dt> %Ex <dd>is replaced by the locale's alternative date representation.
17260 <dt> %EX <dd>is replaced by the locale's alternative time representation.
17261 <dt> %Ey <dd>is replaced by the offset from %EC (year only) in the locale's alternative
17262 representation.
17263 <dt> %EY <dd>is replaced by the locale's full alternative year representation.
17264 <dt> %Od <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
17265 (filled as needed with leading zeros, or with leading spaces if there is no alternative
17266 symbol for zero).
17267 <dt> %Oe <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
17268 (filled as needed with leading spaces).
17269 <dt> %OH <dd>is replaced by the hour (24-hour clock), using the locale's alternative numeric
17270 <!--page 358 -->
17271 symbols.
17272 <dt> %OI <dd>is replaced by the hour (12-hour clock), using the locale's alternative numeric
17273 symbols.
17274 <dt> %Om <dd>is replaced by the month, using the locale's alternative numeric symbols.
17275 <dt> %OM <dd>is replaced by the minutes, using the locale's alternative numeric symbols.
17276 <dt> %OS <dd>is replaced by the seconds, using the locale's alternative numeric symbols.
17277 <dt> %Ou <dd>is replaced by the ISO 8601 weekday as a number in the locale's alternative
17278 representation, where Monday is 1.
17279 <dt> %OU <dd>is replaced by the week number, using the locale's alternative numeric symbols.
17280 <dt> %OV <dd>is replaced by the ISO 8601 week number, using the locale's alternative numeric
17281 symbols.
17282 <dt> %Ow <dd>is replaced by the weekday as a number, using the locale's alternative numeric
17283 symbols.
17284 <dt> %OW <dd>is replaced by the week number of the year, using the locale's alternative numeric
17285 symbols.
17286 <dt> %Oy <dd>is replaced by the last 2 digits of the year, using the locale's alternative numeric
17287 symbols.
17288 </dl>
17289 <p><!--para 5 -->
17290 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
17291 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
17292 which is also the week that includes the first Thursday of the year, and is also the first
17293 week that contains at least four days in the year. If the first Monday of January is the
17294 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
17295 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
17296 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
17297 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
17298 %V is replaced by 01.
17299 <p><!--para 6 -->
17300 If a conversion specifier is not one of the above, the behavior is undefined.
17301 <p><!--para 7 -->
17302 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
17303 following specifiers are:
17304 <dl>
17305 <dt> %a <dd> the first three characters of %A.
17306 <dt> %A <dd> one of ''Sunday'', ''Monday'', ... , ''Saturday''.
17307 <dt> %b <dd> the first three characters of %B.
17308 <dt> %B <dd> one of ''January'', ''February'', ... , ''December''.
17309 <dt> %c <dd> equivalent to ''%a %b %e %T %Y''.
17310 <dt> %p <dd> one of ''AM'' or ''PM''.
17311 <dt> %r <dd> equivalent to ''%I:%M:%S %p''.
17312 <dt> %x <dd> equivalent to ''%m/%d/%y''.
17313 <dt> %X <dd> equivalent to %T.
17314 <dt> %Z <dd> implementation-defined.
17315 </dl>
17316 <!--page 359 -->
17317 <h6>Returns</h6>
17318 <p><!--para 8 -->
17319 If the total number of resulting characters including the terminating null character is not
17320 more than maxsize, the strftime function returns the number of characters placed
17321 into the array pointed to by s not including the terminating null character. Otherwise,
17322 zero is returned and the contents of the array are indeterminate.
17323 <!--page 360 -->
17325 <h3><a name="7.24" href="#7.24">7.24 Extended multibyte and wide character utilities <wchar.h></a></h3>
17327 <h4><a name="7.24.1" href="#7.24.1">7.24.1 Introduction</a></h4>
17328 <p><!--para 1 -->
17329 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares four data types, one tag, four macros, and many
17330 functions.<sup><a href="#note277"><b>277)</b></a></sup>
17331 <p><!--para 2 -->
17332 The types declared are wchar_t and size_t (both described in <a href="#7.17">7.17</a>);
17333 <pre>
17334 mbstate_t
17335 </pre>
17336 which is an object type other than an array type that can hold the conversion state
17337 information necessary to convert between sequences of multibyte characters and wide
17338 characters;
17339 <pre>
17340 wint_t
17341 </pre>
17342 which is an integer type unchanged by default argument promotions that can hold any
17343 value corresponding to members of the extended character set, as well as at least one
17344 value that does not correspond to any member of the extended character set (see WEOF
17345 below);<sup><a href="#note278"><b>278)</b></a></sup> and
17346 <pre>
17347 struct tm
17348 </pre>
17349 which is declared as an incomplete structure type (the contents are described in <a href="#7.23.1">7.23.1</a>).
17350 <p><!--para 3 -->
17351 The macros defined are NULL (described in <a href="#7.17">7.17</a>); WCHAR_MIN and WCHAR_MAX
17352 (described in <a href="#7.18.3">7.18.3</a>); and
17353 <pre>
17354 WEOF
17355 </pre>
17356 which expands to a constant expression of type wint_t whose value does not
17357 correspond to any member of the extended character set.<sup><a href="#note279"><b>279)</b></a></sup> It is accepted (and returned)
17358 by several functions in this subclause to indicate end-of-file, that is, no more input from a
17359 stream. It is also used as a wide character value that does not correspond to any member
17360 of the extended character set.
17361 <p><!--para 4 -->
17362 The functions declared are grouped as follows:
17363 <ul>
17364 <li> Functions that perform input and output of wide characters, or multibyte characters,
17365 or both;
17366 <li> Functions that provide wide string numeric conversion;
17367 <li> Functions that perform general wide string manipulation;
17370 <!--page 361 -->
17371 <li> Functions for wide string date and time conversion; and
17372 <li> Functions that provide extended capabilities for conversion between multibyte and
17373 wide character sequences.
17374 </ul>
17375 <p><!--para 5 -->
17376 Unless explicitly stated otherwise, if the execution of a function described in this
17377 subclause causes copying to take place between objects that overlap, the behavior is
17378 undefined.
17380 <h6>footnotes</h6>
17381 <p><small><a name="note277" href="#note277">277)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
17382 </small>
17383 <p><small><a name="note278" href="#note278">278)</a> wchar_t and wint_t can be the same integer type.
17384 </small>
17385 <p><small><a name="note279" href="#note279">279)</a> The value of the macro WEOF may differ from that of EOF and need not be negative.
17386 </small>
17388 <h4><a name="7.24.2" href="#7.24.2">7.24.2 Formatted wide character input/output functions</a></h4>
17389 <p><!--para 1 -->
17390 The formatted wide character input/output functions shall behave as if there is a sequence
17391 point after the actions associated with each specifier.<sup><a href="#note280"><b>280)</b></a></sup>
17393 <h6>footnotes</h6>
17394 <p><small><a name="note280" href="#note280">280)</a> The fwprintf functions perform writes to memory for the %n specifier.
17395 </small>
17397 <h5><a name="7.24.2.1" href="#7.24.2.1">7.24.2.1 The fwprintf function</a></h5>
17398 <h6>Synopsis</h6>
17399 <p><!--para 1 -->
17400 <pre>
17401 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17402 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17403 int fwprintf(FILE * restrict stream,
17404 const wchar_t * restrict format, ...);
17405 </pre>
17406 <h6>Description</h6>
17407 <p><!--para 2 -->
17408 The fwprintf function writes output to the stream pointed to by stream, under
17409 control of the wide string pointed to by format that specifies how subsequent arguments
17410 are converted for output. If there are insufficient arguments for the format, the behavior
17411 is undefined. If the format is exhausted while arguments remain, the excess arguments
17412 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
17413 when the end of the format string is encountered.
17414 <p><!--para 3 -->
17415 The format is composed of zero or more directives: ordinary wide characters (not %),
17416 which are copied unchanged to the output stream; and conversion specifications, each of
17417 which results in fetching zero or more subsequent arguments, converting them, if
17418 applicable, according to the corresponding conversion specifier, and then writing the
17419 result to the output stream.
17420 <p><!--para 4 -->
17421 Each conversion specification is introduced by the wide character %. After the %, the
17422 following appear in sequence:
17423 <ul>
17424 <li> Zero or more flags (in any order) that modify the meaning of the conversion
17425 specification.
17426 <li> An optional minimum field width. If the converted value has fewer wide characters
17427 than the field width, it is padded with spaces (by default) on the left (or right, if the
17430 <!--page 362 -->
17431 left adjustment flag, described later, has been given) to the field width. The field
17432 width takes the form of an asterisk * (described later) or a nonnegative decimal
17433 integer.<sup><a href="#note281"><b>281)</b></a></sup>
17434 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
17435 o, u, x, and X conversions, the number of digits to appear after the decimal-point
17436 wide character for a, A, e, E, f, and F conversions, the maximum number of
17437 significant digits for the g and G conversions, or the maximum number of wide
17438 characters to be written for s conversions. The precision takes the form of a period
17439 (.) followed either by an asterisk * (described later) or by an optional decimal
17440 integer; if only the period is specified, the precision is taken as zero. If a precision
17441 appears with any other conversion specifier, the behavior is undefined.
17442 <li> An optional length modifier that specifies the size of the argument.
17443 <li> A conversion specifier wide character that specifies the type of conversion to be
17444 applied.
17445 </ul>
17446 <p><!--para 5 -->
17447 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
17448 this case, an int argument supplies the field width or precision. The arguments
17449 specifying field width, or precision, or both, shall appear (in that order) before the
17450 argument (if any) to be converted. A negative field width argument is taken as a - flag
17451 followed by a positive field width. A negative precision argument is taken as if the
17452 precision were omitted.
17453 <p><!--para 6 -->
17454 The flag wide characters and their meanings are:
17455 <dl>
17456 <dt> - <dd> The result of the conversion is left-justified within the field. (It is right-justified if
17457 this flag is not specified.)
17458 <dt> + <dd> The result of a signed conversion always begins with a plus or minus sign. (It
17459 begins with a sign only when a negative value is converted if this flag is not
17460 specified.)<sup><a href="#note282"><b>282)</b></a></sup>
17461 <dt> space<dd> If the first wide character of a signed conversion is not a sign, or if a signed
17462 conversion results in no wide characters, a space is prefixed to the result. If the
17463 space and + flags both appear, the space flag is ignored.
17464 <dt> # <dd> The result is converted to an ''alternative form''. For o conversion, it increases
17465 the precision, if and only if necessary, to force the first digit of the result to be a
17466 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
17467 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
17469 <!--page 363 -->
17470 and G conversions, the result of converting a floating-point number always
17471 contains a decimal-point wide character, even if no digits follow it. (Normally, a
17472 decimal-point wide character appears in the result of these conversions only if a
17473 digit follows it.) For g and G conversions, trailing zeros are not removed from the
17474 result. For other conversions, the behavior is undefined.
17475 <dt> 0 <dd> For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
17476 (following any indication of sign or base) are used to pad to the field width rather
17477 than performing space padding, except when converting an infinity or NaN. If the
17478 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
17479 conversions, if a precision is specified, the 0 flag is ignored. For other
17480 conversions, the behavior is undefined.
17481 </dl>
17482 <p><!--para 7 -->
17483 The length modifiers and their meanings are:
17484 <dl>
17485 <dt> hh <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
17486 signed char or unsigned char argument (the argument will have
17487 been promoted according to the integer promotions, but its value shall be
17488 converted to signed char or unsigned char before printing); or that
17489 a following n conversion specifier applies to a pointer to a signed char
17490 argument.
17491 <dt> h <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
17492 short int or unsigned short int argument (the argument will
17493 have been promoted according to the integer promotions, but its value shall
17494 be converted to short int or unsigned short int before printing);
17495 or that a following n conversion specifier applies to a pointer to a short
17496 int argument.
17497 <dt> l (ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
17498 long int or unsigned long int argument; that a following n
17499 conversion specifier applies to a pointer to a long int argument; that a
17500 following c conversion specifier applies to a wint_t argument; that a
17501 following s conversion specifier applies to a pointer to a wchar_t
17502 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
17503 specifier.
17504 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
17505 long long int or unsigned long long int argument; or that a
17506 following n conversion specifier applies to a pointer to a long long int
17507 argument.
17508 <dt> j <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to
17509 <!--page 364 -->
17510 an intmax_t or uintmax_t argument; or that a following n conversion
17511 specifier applies to a pointer to an intmax_t argument.
17512 <dt> z <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
17513 size_t or the corresponding signed integer type argument; or that a
17514 following n conversion specifier applies to a pointer to a signed integer type
17515 corresponding to size_t argument.
17516 <dt> t <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
17517 ptrdiff_t or the corresponding unsigned integer type argument; or that a
17518 following n conversion specifier applies to a pointer to a ptrdiff_t
17519 argument.
17520 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
17521 applies to a long double argument.
17522 </dl>
17523 If a length modifier appears with any conversion specifier other than as specified above,
17524 the behavior is undefined.
17525 <p><!--para 8 -->
17526 The conversion specifiers and their meanings are:
17527 <dl>
17528 <dt> d,i <dd> The int argument is converted to signed decimal in the style [-]dddd. The
17529 precision specifies the minimum number of digits to appear; if the value
17530 being converted can be represented in fewer digits, it is expanded with
17531 leading zeros. The default precision is 1. The result of converting a zero
17532 value with a precision of zero is no wide characters.
17533 <dt> o,u,x,X<dd> The unsigned int argument is converted to unsigned octal (o), unsigned
17534 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
17535 letters abcdef are used for x conversion and the letters ABCDEF for X
17536 conversion. The precision specifies the minimum number of digits to appear;
17537 if the value being converted can be represented in fewer digits, it is expanded
17538 with leading zeros. The default precision is 1. The result of converting a
17539 zero value with a precision of zero is no wide characters.
17540 <dt> f,F <dd> A double argument representing a floating-point number is converted to
17541 <!--page 365 -->
17542 decimal notation in the style [-]ddd.ddd, where the number of digits after
17543 the decimal-point wide character is equal to the precision specification. If the
17544 precision is missing, it is taken as 6; if the precision is zero and the # flag is
17545 not specified, no decimal-point wide character appears. If a decimal-point
17546 wide character appears, at least one digit appears before it. The value is
17547 rounded to the appropriate number of digits.
17548 A double argument representing an infinity is converted in one of the styles
17549 [-]inf or [-]infinity -- which style is implementation-defined. A
17550 double argument representing a NaN is converted in one of the styles
17551 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
17552 any n-wchar-sequence, is implementation-defined. The F conversion
17553 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
17554 nan, respectively.<sup><a href="#note283"><b>283)</b></a></sup>
17555 <dt> e,E <dd> A double argument representing a floating-point number is converted in the
17556 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
17557 argument is nonzero) before the decimal-point wide character and the number
17558 of digits after it is equal to the precision; if the precision is missing, it is taken
17559 as 6; if the precision is zero and the # flag is not specified, no decimal-point
17560 wide character appears. The value is rounded to the appropriate number of
17561 digits. The E conversion specifier produces a number with E instead of e
17562 introducing the exponent. The exponent always contains at least two digits,
17563 and only as many more digits as necessary to represent the exponent. If the
17564 value is zero, the exponent is zero.
17565 A double argument representing an infinity or NaN is converted in the style
17566 of an f or F conversion specifier.
17567 <dt> g,G <dd> A double argument representing a floating-point number is converted in
17568 style f or e (or in style F or E in the case of a G conversion specifier),
17569 depending on the value converted and the precision. Let P equal the
17570 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
17571 Then, if a conversion with style E would have an exponent of X :
17572 <ul>
17573 <li> if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
17574 P - (X + 1).
17575 <li> otherwise, the conversion is with style e (or E) and precision P - 1.
17576 </ul>
17577 Finally, unless the # flag is used, any trailing zeros are removed from the
17578 fractional portion of the result and the decimal-point wide character is
17579 removed if there is no fractional portion remaining.
17580 A double argument representing an infinity or NaN is converted in the style
17581 of an f or F conversion specifier.
17582 <dt> a,A <dd> A double argument representing a floating-point number is converted in the
17583 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
17584 nonzero if the argument is a normalized floating-point number and is
17585 otherwise unspecified) before the decimal-point wide character<sup><a href="#note284"><b>284)</b></a></sup> and the
17586 number of hexadecimal digits after it is equal to the precision; if the precision
17587 is missing and FLT_RADIX is a power of 2, then the precision is sufficient
17588 <!--page 366 -->
17589 for an exact representation of the value; if the precision is missing and
17590 FLT_RADIX is not a power of 2, then the precision is sufficient to
17591 distinguish<sup><a href="#note285"><b>285)</b></a></sup> values of type double, except that trailing zeros may be
17592 omitted; if the precision is zero and the # flag is not specified, no decimal-
17593 point wide character appears. The letters abcdef are used for a conversion
17594 and the letters ABCDEF for A conversion. The A conversion specifier
17595 produces a number with X and P instead of x and p. The exponent always
17596 contains at least one digit, and only as many more digits as necessary to
17597 represent the decimal exponent of 2. If the value is zero, the exponent is
17598 zero.
17599 A double argument representing an infinity or NaN is converted in the style
17600 of an f or F conversion specifier.
17601 <dt> c <dd> If no l length modifier is present, the int argument is converted to a wide
17602 character as if by calling btowc and the resulting wide character is written.
17603 If an l length modifier is present, the wint_t argument is converted to
17604 wchar_t and written.
17605 <dt> s <dd> If no l length modifier is present, the argument shall be a pointer to the initial
17606 element of a character array containing a multibyte character sequence
17607 beginning in the initial shift state. Characters from the array are converted as
17608 if by repeated calls to the mbrtowc function, with the conversion state
17609 described by an mbstate_t object initialized to zero before the first
17610 multibyte character is converted, and written up to (but not including) the
17611 terminating null wide character. If the precision is specified, no more than
17612 that many wide characters are written. If the precision is not specified or is
17613 greater than the size of the converted array, the converted array shall contain a
17614 null wide character.
17615 If an l length modifier is present, the argument shall be a pointer to the initial
17616 element of an array of wchar_t type. Wide characters from the array are
17617 written up to (but not including) a terminating null wide character. If the
17618 precision is specified, no more than that many wide characters are written. If
17619 the precision is not specified or is greater than the size of the array, the array
17620 shall contain a null wide character.
17621 <dt> p <dd> The argument shall be a pointer to void. The value of the pointer is
17622 converted to a sequence of printing wide characters, in an implementation-
17623 <!--page 367 -->
17624 defined manner.
17625 <dt> n <dd> The argument shall be a pointer to signed integer into which is written the
17626 number of wide characters written to the output stream so far by this call to
17627 fwprintf. No argument is converted, but one is consumed. If the
17628 conversion specification includes any flags, a field width, or a precision, the
17629 behavior is undefined.
17630 <dt> % <dd> A % wide character is written. No argument is converted. The complete
17631 conversion specification shall be %%.
17632 </dl>
17633 <p><!--para 9 -->
17634 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note286"><b>286)</b></a></sup> If any argument is
17635 not the correct type for the corresponding conversion specification, the behavior is
17636 undefined.
17637 <p><!--para 10 -->
17638 In no case does a nonexistent or small field width cause truncation of a field; if the result
17639 of a conversion is wider than the field width, the field is expanded to contain the
17640 conversion result.
17641 <p><!--para 11 -->
17642 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
17643 to a hexadecimal floating number with the given precision.
17644 <h6>Recommended practice</h6>
17645 <p><!--para 12 -->
17646 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
17647 representable in the given precision, the result should be one of the two adjacent numbers
17648 in hexadecimal floating style with the given precision, with the extra stipulation that the
17649 error should have a correct sign for the current rounding direction.
17650 <p><!--para 13 -->
17651 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
17652 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note287"><b>287)</b></a></sup> If the number of
17653 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
17654 representable with DECIMAL_DIG digits, then the result should be an exact
17655 representation with trailing zeros. Otherwise, the source value is bounded by two
17656 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
17657 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
17658 the error should have a correct sign for the current rounding direction.
17659 <h6>Returns</h6>
17660 <p><!--para 14 -->
17661 The fwprintf function returns the number of wide characters transmitted, or a negative
17662 value if an output or encoding error occurred.
17664 <!--page 368 -->
17665 <h6>Environmental limits</h6>
17666 <p><!--para 15 -->
17667 The number of wide characters that can be produced by any single conversion shall be at
17668 least 4095.
17669 <p><!--para 16 -->
17670 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
17671 places:
17672 <pre>
17673 #include <a href="#7.12">&lt;math.h&gt;</a>
17674 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17675 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17676 /* ... */
17677 wchar_t *weekday, *month; // pointers to wide strings
17678 int day, hour, min;
17679 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
17680 weekday, month, day, hour, min);
17681 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
17682 </pre>
17684 <p><b> Forward references</b>: the btowc function (<a href="#7.24.6.1.1">7.24.6.1.1</a>), the mbrtowc function
17685 (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
17687 <h6>footnotes</h6>
17688 <p><small><a name="note281" href="#note281">281)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
17689 </small>
17690 <p><small><a name="note282" href="#note282">282)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
17691 include a minus sign.
17692 </small>
17693 <p><small><a name="note283" href="#note283">283)</a> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
17694 meaning; the # and 0 flag wide characters have no effect.
17695 </small>
17696 <p><small><a name="note284" href="#note284">284)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
17697 character so that subsequent digits align to nibble (4-bit) boundaries.
17698 </small>
17699 <p><small><a name="note285" href="#note285">285)</a> The precision p is sufficient to distinguish values of the source type if 16<sup>p-1</sup> &gt; b n where b is
17700 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
17701 might suffice depending on the implementation's scheme for determining the digit to the left of the
17702 decimal-point wide character.
17703 </small>
17704 <p><small><a name="note286" href="#note286">286)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
17705 </small>
17706 <p><small><a name="note287" href="#note287">287)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
17707 given format specifier. The number of significant digits is determined by the format specifier, and in
17708 the case of fixed-point conversion by the source value as well.
17709 </small>
17711 <h5><a name="7.24.2.2" href="#7.24.2.2">7.24.2.2 The fwscanf function</a></h5>
17712 <h6>Synopsis</h6>
17713 <p><!--para 1 -->
17714 <pre>
17715 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17716 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17717 int fwscanf(FILE * restrict stream,
17718 const wchar_t * restrict format, ...);
17719 </pre>
17720 <h6>Description</h6>
17721 <p><!--para 2 -->
17722 The fwscanf function reads input from the stream pointed to by stream, under
17723 control of the wide string pointed to by format that specifies the admissible input
17724 sequences and how they are to be converted for assignment, using subsequent arguments
17725 as pointers to the objects to receive the converted input. If there are insufficient
17726 arguments for the format, the behavior is undefined. If the format is exhausted while
17727 arguments remain, the excess arguments are evaluated (as always) but are otherwise
17728 ignored.
17729 <p><!--para 3 -->
17730 The format is composed of zero or more directives: one or more white-space wide
17731 characters, an ordinary wide character (neither % nor a white-space wide character), or a
17732 conversion specification. Each conversion specification is introduced by the wide
17733 character %. After the %, the following appear in sequence:
17734 <ul>
17735 <li> An optional assignment-suppressing wide character *.
17736 <li> An optional decimal integer greater than zero that specifies the maximum field width
17737 (in wide characters).
17738 <!--page 369 -->
17739 <li> An optional length modifier that specifies the size of the receiving object.
17740 <li> A conversion specifier wide character that specifies the type of conversion to be
17741 applied.
17742 </ul>
17743 <p><!--para 4 -->
17744 The fwscanf function executes each directive of the format in turn. If a directive fails,
17745 as detailed below, the function returns. Failures are described as input failures (due to the
17746 occurrence of an encoding error or the unavailability of input characters), or matching
17747 failures (due to inappropriate input).
17748 <p><!--para 5 -->
17749 A directive composed of white-space wide character(s) is executed by reading input up to
17750 the first non-white-space wide character (which remains unread), or until no more wide
17751 characters can be read.
17752 <p><!--para 6 -->
17753 A directive that is an ordinary wide character is executed by reading the next wide
17754 character of the stream. If that wide character differs from the directive, the directive
17755 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
17756 of-file, an encoding error, or a read error prevents a wide character from being read, the
17757 directive fails.
17758 <p><!--para 7 -->
17759 A directive that is a conversion specification defines a set of matching input sequences, as
17760 described below for each specifier. A conversion specification is executed in the
17761 following steps:
17762 <p><!--para 8 -->
17763 Input white-space wide characters (as specified by the iswspace function) are skipped,
17764 unless the specification includes a [, c, or n specifier.<sup><a href="#note288"><b>288)</b></a></sup>
17765 <p><!--para 9 -->
17766 An input item is read from the stream, unless the specification includes an n specifier. An
17767 input item is defined as the longest sequence of input wide characters which does not
17768 exceed any specified field width and which is, or is a prefix of, a matching input
17769 sequence.<sup><a href="#note289"><b>289)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
17770 length of the input item is zero, the execution of the directive fails; this condition is a
17771 matching failure unless end-of-file, an encoding error, or a read error prevented input
17772 from the stream, in which case it is an input failure.
17773 <p><!--para 10 -->
17774 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
17775 count of input wide characters) is converted to a type appropriate to the conversion
17776 specifier. If the input item is not a matching sequence, the execution of the directive fails:
17777 this condition is a matching failure. Unless assignment suppression was indicated by a *,
17778 the result of the conversion is placed in the object pointed to by the first argument
17779 following the format argument that has not already received a conversion result. If this
17782 <!--page 370 -->
17783 object does not have an appropriate type, or if the result of the conversion cannot be
17784 represented in the object, the behavior is undefined.
17785 <p><!--para 11 -->
17786 The length modifiers and their meanings are:
17787 <dl>
17788 <dt> hh <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17789 to an argument with type pointer to signed char or unsigned char.
17790 <dt> h <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17791 to an argument with type pointer to short int or unsigned short
17792 int.
17793 <dt> l (ell) <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17794 to an argument with type pointer to long int or unsigned long
17795 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
17796 an argument with type pointer to double; or that a following c, s, or [
17797 conversion specifier applies to an argument with type pointer to wchar_t.
17798 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17799 to an argument with type pointer to long long int or unsigned
17800 long long int.
17801 <dt> j <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17802 to an argument with type pointer to intmax_t or uintmax_t.
17803 <dt> z <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17804 to an argument with type pointer to size_t or the corresponding signed
17805 integer type.
17806 <dt> t <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
17807 to an argument with type pointer to ptrdiff_t or the corresponding
17808 unsigned integer type.
17809 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
17810 applies to an argument with type pointer to long double.
17811 </dl>
17812 If a length modifier appears with any conversion specifier other than as specified above,
17813 the behavior is undefined.
17814 <p><!--para 12 -->
17815 The conversion specifiers and their meanings are:
17816 <dl>
17817 <dt> d <dd> Matches an optionally signed decimal integer, whose format is the same as
17818 expected for the subject sequence of the wcstol function with the value 10
17819 for the base argument. The corresponding argument shall be a pointer to
17820 signed integer.
17821 <dt> i <dd> Matches an optionally signed integer, whose format is the same as expected
17822 <!--page 371 -->
17823 for the subject sequence of the wcstol function with the value 0 for the
17824 base argument. The corresponding argument shall be a pointer to signed
17825 integer.
17826 <dt> o <dd> Matches an optionally signed octal integer, whose format is the same as
17827 expected for the subject sequence of the wcstoul function with the value 8
17828 for the base argument. The corresponding argument shall be a pointer to
17829 unsigned integer.
17830 <dt> u <dd> Matches an optionally signed decimal integer, whose format is the same as
17831 expected for the subject sequence of the wcstoul function with the value 10
17832 for the base argument. The corresponding argument shall be a pointer to
17833 unsigned integer.
17834 <dt> x <dd> Matches an optionally signed hexadecimal integer, whose format is the same
17835 as expected for the subject sequence of the wcstoul function with the value
17836 16 for the base argument. The corresponding argument shall be a pointer to
17837 unsigned integer.
17838 <dt> a,e,f,g<dd> Matches an optionally signed floating-point number, infinity, or NaN, whose
17839 format is the same as expected for the subject sequence of the wcstod
17840 function. The corresponding argument shall be a pointer to floating.
17841 <dt> c <dd> Matches a sequence of wide characters of exactly the number specified by the
17842 field width (1 if no field width is present in the directive).
17843 If no l length modifier is present, characters from the input field are
17844 converted as if by repeated calls to the wcrtomb function, with the
17845 conversion state described by an mbstate_t object initialized to zero
17846 before the first wide character is converted. The corresponding argument
17847 shall be a pointer to the initial element of a character array large enough to
17848 accept the sequence. No null character is added.
17849 If an l length modifier is present, the corresponding argument shall be a
17850 pointer to the initial element of an array of wchar_t large enough to accept
17851 the sequence. No null wide character is added.
17852 <dt> s <dd> Matches a sequence of non-white-space wide characters.
17853 <!--page 372 -->
17854 If no l length modifier is present, characters from the input field are
17855 converted as if by repeated calls to the wcrtomb function, with the
17856 conversion state described by an mbstate_t object initialized to zero
17857 before the first wide character is converted. The corresponding argument
17858 shall be a pointer to the initial element of a character array large enough to
17859 accept the sequence and a terminating null character, which will be added
17860 automatically.
17861 If an l length modifier is present, the corresponding argument shall be a
17862 pointer to the initial element of an array of wchar_t large enough to accept
17863 the sequence and the terminating null wide character, which will be added
17864 automatically.
17865 <dt> [ <dd> Matches a nonempty sequence of wide characters from a set of expected
17866 characters (the scanset).
17867 If no l length modifier is present, characters from the input field are
17868 converted as if by repeated calls to the wcrtomb function, with the
17869 conversion state described by an mbstate_t object initialized to zero
17870 before the first wide character is converted. The corresponding argument
17871 shall be a pointer to the initial element of a character array large enough to
17872 accept the sequence and a terminating null character, which will be added
17873 automatically.
17874 If an l length modifier is present, the corresponding argument shall be a
17875 pointer to the initial element of an array of wchar_t large enough to accept
17876 the sequence and the terminating null wide character, which will be added
17877 automatically.
17878 The conversion specifier includes all subsequent wide characters in the
17879 format string, up to and including the matching right bracket (]). The wide
17880 characters between the brackets (the scanlist) compose the scanset, unless the
17881 wide character after the left bracket is a circumflex (^), in which case the
17882 scanset contains all wide characters that do not appear in the scanlist between
17883 the circumflex and the right bracket. If the conversion specifier begins with
17884 [] or [^], the right bracket wide character is in the scanlist and the next
17885 following right bracket wide character is the matching right bracket that ends
17886 the specification; otherwise the first following right bracket wide character is
17887 the one that ends the specification. If a - wide character is in the scanlist and
17888 is not the first, nor the second where the first wide character is a ^, nor the
17889 last character, the behavior is implementation-defined.
17890 <dt> p <dd> Matches an implementation-defined set of sequences, which should be the
17891 same as the set of sequences that may be produced by the %p conversion of
17892 the fwprintf function. The corresponding argument shall be a pointer to a
17893 pointer to void. The input item is converted to a pointer value in an
17894 implementation-defined manner. If the input item is a value converted earlier
17895 during the same program execution, the pointer that results shall compare
17896 equal to that value; otherwise the behavior of the %p conversion is undefined.
17897 <dt> n <dd> No input is consumed. The corresponding argument shall be a pointer to
17898 <!--page 373 -->
17899 signed integer into which is to be written the number of wide characters read
17900 from the input stream so far by this call to the fwscanf function. Execution
17901 of a %n directive does not increment the assignment count returned at the
17902 completion of execution of the fwscanf function. No argument is
17903 converted, but one is consumed. If the conversion specification includes an
17904 assignment-suppressing wide character or a field width, the behavior is
17905 undefined.
17906 <dt> % <dd> Matches a single % wide character; no conversion or assignment occurs. The
17907 complete conversion specification shall be %%.
17908 </dl>
17909 <p><!--para 13 -->
17910 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note290"><b>290)</b></a></sup>
17911 <p><!--para 14 -->
17912 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
17913 respectively, a, e, f, g, and x.
17914 <p><!--para 15 -->
17915 Trailing white space (including new-line wide characters) is left unread unless matched
17916 by a directive. The success of literal matches and suppressed assignments is not directly
17917 determinable other than via the %n directive.
17918 <h6>Returns</h6>
17919 <p><!--para 16 -->
17920 The fwscanf function returns the value of the macro EOF if an input failure occurs
17921 before any conversion. Otherwise, the function returns the number of input items
17922 assigned, which can be fewer than provided for, or even zero, in the event of an early
17923 matching failure.
17924 <p><!--para 17 -->
17925 EXAMPLE 1 The call:
17926 <pre>
17927 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17928 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17929 /* ... */
17930 int n, i; float x; wchar_t name[50];
17931 n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);
17932 </pre>
17933 with the input line:
17934 <pre>
17935 25 54.32E-1 thompson
17936 </pre>
17937 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
17938 thompson\0.
17940 <p><!--para 18 -->
17941 EXAMPLE 2 The call:
17942 <pre>
17943 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17944 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17945 /* ... */
17946 int i; float x; double y;
17947 fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);
17948 </pre>
17949 with input:
17950 <pre>
17951 56789 0123 56a72
17952 </pre>
17953 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
17954 56.0. The next wide character read from the input stream will be a.
17957 <!--page 374 -->
17958 <p><b> Forward references</b>: the wcstod, wcstof, and wcstold functions (<a href="#7.24.4.1.1">7.24.4.1.1</a>), the
17959 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.24.4.1.2">7.24.4.1.2</a>), the wcrtomb
17960 function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
17962 <h6>footnotes</h6>
17963 <p><small><a name="note288" href="#note288">288)</a> These white-space wide characters are not counted against a specified field width.
17964 </small>
17965 <p><small><a name="note289" href="#note289">289)</a> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
17966 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
17967 </small>
17968 <p><small><a name="note290" href="#note290">290)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
17969 </small>
17971 <h5><a name="7.24.2.3" href="#7.24.2.3">7.24.2.3 The swprintf function</a></h5>
17972 <h6>Synopsis</h6>
17973 <p><!--para 1 -->
17974 <pre>
17975 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17976 int swprintf(wchar_t * restrict s,
17977 size_t n,
17978 const wchar_t * restrict format, ...);
17979 </pre>
17980 <h6>Description</h6>
17981 <p><!--para 2 -->
17982 The swprintf function is equivalent to fwprintf, except that the argument s
17983 specifies an array of wide characters into which the generated output is to be written,
17984 rather than written to a stream. No more than n wide characters are written, including a
17985 terminating null wide character, which is always added (unless n is zero).
17986 <h6>Returns</h6>
17987 <p><!--para 3 -->
17988 The swprintf function returns the number of wide characters written in the array, not
17989 counting the terminating null wide character, or a negative value if an encoding error
17990 occurred or if n or more wide characters were requested to be written.
17992 <h5><a name="7.24.2.4" href="#7.24.2.4">7.24.2.4 The swscanf function</a></h5>
17993 <h6>Synopsis</h6>
17994 <p><!--para 1 -->
17995 <pre>
17996 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17997 int swscanf(const wchar_t * restrict s,
17998 const wchar_t * restrict format, ...);
17999 </pre>
18000 <h6>Description</h6>
18001 <p><!--para 2 -->
18002 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
18003 wide string from which the input is to be obtained, rather than from a stream. Reaching
18004 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
18005 function.
18006 <h6>Returns</h6>
18007 <p><!--para 3 -->
18008 The swscanf function returns the value of the macro EOF if an input failure occurs
18009 before any conversion. Otherwise, the swscanf function returns the number of input
18010 items assigned, which can be fewer than provided for, or even zero, in the event of an
18011 early matching failure.
18012 <!--page 375 -->
18014 <h5><a name="7.24.2.5" href="#7.24.2.5">7.24.2.5 The vfwprintf function</a></h5>
18015 <h6>Synopsis</h6>
18016 <p><!--para 1 -->
18017 <pre>
18018 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18019 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18020 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18021 int vfwprintf(FILE * restrict stream,
18022 const wchar_t * restrict format,
18023 va_list arg);
18024 </pre>
18025 <h6>Description</h6>
18026 <p><!--para 2 -->
18027 The vfwprintf function is equivalent to fwprintf, with the variable argument list
18028 replaced by arg, which shall have been initialized by the va_start macro (and
18029 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
18030 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18031 <h6>Returns</h6>
18032 <p><!--para 3 -->
18033 The vfwprintf function returns the number of wide characters transmitted, or a
18034 negative value if an output or encoding error occurred.
18035 <p><!--para 4 -->
18036 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
18037 routine.
18038 <pre>
18039 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18040 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18041 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18042 void error(char *function_name, wchar_t *format, ...)
18044 va_list args;
18045 va_start(args, format);
18046 // print out name of function causing error
18047 fwprintf(stderr, L"ERROR in %s: ", function_name);
18048 // print out remainder of message
18049 vfwprintf(stderr, format, args);
18050 va_end(args);
18052 </pre>
18057 <!--page 376 -->
18059 <h6>footnotes</h6>
18060 <p><small><a name="note291" href="#note291">291)</a> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
18061 invoke the va_arg macro, the value of arg after the return is indeterminate.
18062 </small>
18064 <h5><a name="7.24.2.6" href="#7.24.2.6">7.24.2.6 The vfwscanf function</a></h5>
18065 <h6>Synopsis</h6>
18066 <p><!--para 1 -->
18067 <pre>
18068 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18069 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18070 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18071 int vfwscanf(FILE * restrict stream,
18072 const wchar_t * restrict format,
18073 va_list arg);
18074 </pre>
18075 <h6>Description</h6>
18076 <p><!--para 2 -->
18077 The vfwscanf function is equivalent to fwscanf, with the variable argument list
18078 replaced by arg, which shall have been initialized by the va_start macro (and
18079 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
18080 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18081 <h6>Returns</h6>
18082 <p><!--para 3 -->
18083 The vfwscanf function returns the value of the macro EOF if an input failure occurs
18084 before any conversion. Otherwise, the vfwscanf function returns the number of input
18085 items assigned, which can be fewer than provided for, or even zero, in the event of an
18086 early matching failure.
18088 <h5><a name="7.24.2.7" href="#7.24.2.7">7.24.2.7 The vswprintf function</a></h5>
18089 <h6>Synopsis</h6>
18090 <p><!--para 1 -->
18091 <pre>
18092 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18093 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18094 int vswprintf(wchar_t * restrict s,
18095 size_t n,
18096 const wchar_t * restrict format,
18097 va_list arg);
18098 </pre>
18099 <h6>Description</h6>
18100 <p><!--para 2 -->
18101 The vswprintf function is equivalent to swprintf, with the variable argument list
18102 replaced by arg, which shall have been initialized by the va_start macro (and
18103 possibly subsequent va_arg calls). The vswprintf function does not invoke the
18104 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18105 <h6>Returns</h6>
18106 <p><!--para 3 -->
18107 The vswprintf function returns the number of wide characters written in the array, not
18108 counting the terminating null wide character, or a negative value if an encoding error
18109 occurred or if n or more wide characters were requested to be generated.
18110 <!--page 377 -->
18112 <h5><a name="7.24.2.8" href="#7.24.2.8">7.24.2.8 The vswscanf function</a></h5>
18113 <h6>Synopsis</h6>
18114 <p><!--para 1 -->
18115 <pre>
18116 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18117 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18118 int vswscanf(const wchar_t * restrict s,
18119 const wchar_t * restrict format,
18120 va_list arg);
18121 </pre>
18122 <h6>Description</h6>
18123 <p><!--para 2 -->
18124 The vswscanf function is equivalent to swscanf, with the variable argument list
18125 replaced by arg, which shall have been initialized by the va_start macro (and
18126 possibly subsequent va_arg calls). The vswscanf function does not invoke the
18127 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18128 <h6>Returns</h6>
18129 <p><!--para 3 -->
18130 The vswscanf function returns the value of the macro EOF if an input failure occurs
18131 before any conversion. Otherwise, the vswscanf function returns the number of input
18132 items assigned, which can be fewer than provided for, or even zero, in the event of an
18133 early matching failure.
18135 <h5><a name="7.24.2.9" href="#7.24.2.9">7.24.2.9 The vwprintf function</a></h5>
18136 <h6>Synopsis</h6>
18137 <p><!--para 1 -->
18138 <pre>
18139 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18140 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18141 int vwprintf(const wchar_t * restrict format,
18142 va_list arg);
18143 </pre>
18144 <h6>Description</h6>
18145 <p><!--para 2 -->
18146 The vwprintf function is equivalent to wprintf, with the variable argument list
18147 replaced by arg, which shall have been initialized by the va_start macro (and
18148 possibly subsequent va_arg calls). The vwprintf function does not invoke the
18149 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18150 <h6>Returns</h6>
18151 <p><!--para 3 -->
18152 The vwprintf function returns the number of wide characters transmitted, or a negative
18153 value if an output or encoding error occurred.
18154 <!--page 378 -->
18156 <h5><a name="7.24.2.10" href="#7.24.2.10">7.24.2.10 The vwscanf function</a></h5>
18157 <h6>Synopsis</h6>
18158 <p><!--para 1 -->
18159 <pre>
18160 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18161 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18162 int vwscanf(const wchar_t * restrict format,
18163 va_list arg);
18164 </pre>
18165 <h6>Description</h6>
18166 <p><!--para 2 -->
18167 The vwscanf function is equivalent to wscanf, with the variable argument list
18168 replaced by arg, which shall have been initialized by the va_start macro (and
18169 possibly subsequent va_arg calls). The vwscanf function does not invoke the
18170 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18171 <h6>Returns</h6>
18172 <p><!--para 3 -->
18173 The vwscanf function returns the value of the macro EOF if an input failure occurs
18174 before any conversion. Otherwise, the vwscanf function returns the number of input
18175 items assigned, which can be fewer than provided for, or even zero, in the event of an
18176 early matching failure.
18178 <h5><a name="7.24.2.11" href="#7.24.2.11">7.24.2.11 The wprintf function</a></h5>
18179 <h6>Synopsis</h6>
18180 <p><!--para 1 -->
18181 <pre>
18182 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18183 int wprintf(const wchar_t * restrict format, ...);
18184 </pre>
18185 <h6>Description</h6>
18186 <p><!--para 2 -->
18187 The wprintf function is equivalent to fwprintf with the argument stdout
18188 interposed before the arguments to wprintf.
18189 <h6>Returns</h6>
18190 <p><!--para 3 -->
18191 The wprintf function returns the number of wide characters transmitted, or a negative
18192 value if an output or encoding error occurred.
18194 <h5><a name="7.24.2.12" href="#7.24.2.12">7.24.2.12 The wscanf function</a></h5>
18195 <h6>Synopsis</h6>
18196 <p><!--para 1 -->
18197 <pre>
18198 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18199 int wscanf(const wchar_t * restrict format, ...);
18200 </pre>
18201 <h6>Description</h6>
18202 <p><!--para 2 -->
18203 The wscanf function is equivalent to fwscanf with the argument stdin interposed
18204 before the arguments to wscanf.
18205 <!--page 379 -->
18206 <h6>Returns</h6>
18207 <p><!--para 3 -->
18208 The wscanf function returns the value of the macro EOF if an input failure occurs
18209 before any conversion. Otherwise, the wscanf function returns the number of input
18210 items assigned, which can be fewer than provided for, or even zero, in the event of an
18211 early matching failure.
18213 <h4><a name="7.24.3" href="#7.24.3">7.24.3 Wide character input/output functions</a></h4>
18215 <h5><a name="7.24.3.1" href="#7.24.3.1">7.24.3.1 The fgetwc function</a></h5>
18216 <h6>Synopsis</h6>
18217 <p><!--para 1 -->
18218 <pre>
18219 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18220 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18221 wint_t fgetwc(FILE *stream);
18222 </pre>
18223 <h6>Description</h6>
18224 <p><!--para 2 -->
18225 If the end-of-file indicator for the input stream pointed to by stream is not set and a
18226 next wide character is present, the fgetwc function obtains that wide character as a
18227 wchar_t converted to a wint_t and advances the associated file position indicator for
18228 the stream (if defined).
18229 <h6>Returns</h6>
18230 <p><!--para 3 -->
18231 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
18232 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
18233 the fgetwc function returns the next wide character from the input stream pointed to by
18234 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
18235 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
18236 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note292"><b>292)</b></a></sup>
18238 <h6>footnotes</h6>
18239 <p><small><a name="note292" href="#note292">292)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
18240 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
18241 </small>
18243 <h5><a name="7.24.3.2" href="#7.24.3.2">7.24.3.2 The fgetws function</a></h5>
18244 <h6>Synopsis</h6>
18245 <p><!--para 1 -->
18246 <pre>
18247 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18248 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18249 wchar_t *fgetws(wchar_t * restrict s,
18250 int n, FILE * restrict stream);
18251 </pre>
18252 <h6>Description</h6>
18253 <p><!--para 2 -->
18254 The fgetws function reads at most one less than the number of wide characters
18255 specified by n from the stream pointed to by stream into the array pointed to by s. No
18258 <!--page 380 -->
18259 additional wide characters are read after a new-line wide character (which is retained) or
18260 after end-of-file. A null wide character is written immediately after the last wide
18261 character read into the array.
18262 <h6>Returns</h6>
18263 <p><!--para 3 -->
18264 The fgetws function returns s if successful. If end-of-file is encountered and no
18265 characters have been read into the array, the contents of the array remain unchanged and a
18266 null pointer is returned. If a read or encoding error occurs during the operation, the array
18267 contents are indeterminate and a null pointer is returned.
18269 <h5><a name="7.24.3.3" href="#7.24.3.3">7.24.3.3 The fputwc function</a></h5>
18270 <h6>Synopsis</h6>
18271 <p><!--para 1 -->
18272 <pre>
18273 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18274 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18275 wint_t fputwc(wchar_t c, FILE *stream);
18276 </pre>
18277 <h6>Description</h6>
18278 <p><!--para 2 -->
18279 The fputwc function writes the wide character specified by c to the output stream
18280 pointed to by stream, at the position indicated by the associated file position indicator
18281 for the stream (if defined), and advances the indicator appropriately. If the file cannot
18282 support positioning requests, or if the stream was opened with append mode, the
18283 character is appended to the output stream.
18284 <h6>Returns</h6>
18285 <p><!--para 3 -->
18286 The fputwc function returns the wide character written. If a write error occurs, the
18287 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
18288 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
18290 <h5><a name="7.24.3.4" href="#7.24.3.4">7.24.3.4 The fputws function</a></h5>
18291 <h6>Synopsis</h6>
18292 <p><!--para 1 -->
18293 <pre>
18294 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18295 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18296 int fputws(const wchar_t * restrict s,
18297 FILE * restrict stream);
18298 </pre>
18299 <h6>Description</h6>
18300 <p><!--para 2 -->
18301 The fputws function writes the wide string pointed to by s to the stream pointed to by
18302 stream. The terminating null wide character is not written.
18303 <h6>Returns</h6>
18304 <p><!--para 3 -->
18305 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
18306 returns a nonnegative value.
18307 <!--page 381 -->
18309 <h5><a name="7.24.3.5" href="#7.24.3.5">7.24.3.5 The fwide function</a></h5>
18310 <h6>Synopsis</h6>
18311 <p><!--para 1 -->
18312 <pre>
18313 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18314 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18315 int fwide(FILE *stream, int mode);
18316 </pre>
18317 <h6>Description</h6>
18318 <p><!--para 2 -->
18319 The fwide function determines the orientation of the stream pointed to by stream. If
18320 mode is greater than zero, the function first attempts to make the stream wide oriented. If
18321 mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note293"><b>293)</b></a></sup>
18322 Otherwise, mode is zero and the function does not alter the orientation of the stream.
18323 <h6>Returns</h6>
18324 <p><!--para 3 -->
18325 The fwide function returns a value greater than zero if, after the call, the stream has
18326 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
18327 stream has no orientation.
18329 <h6>footnotes</h6>
18330 <p><small><a name="note293" href="#note293">293)</a> If the orientation of the stream has already been determined, fwide does not change it.
18331 </small>
18333 <h5><a name="7.24.3.6" href="#7.24.3.6">7.24.3.6 The getwc function</a></h5>
18334 <h6>Synopsis</h6>
18335 <p><!--para 1 -->
18336 <pre>
18337 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18338 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18339 wint_t getwc(FILE *stream);
18340 </pre>
18341 <h6>Description</h6>
18342 <p><!--para 2 -->
18343 The getwc function is equivalent to fgetwc, except that if it is implemented as a
18344 macro, it may evaluate stream more than once, so the argument should never be an
18345 expression with side effects.
18346 <h6>Returns</h6>
18347 <p><!--para 3 -->
18348 The getwc function returns the next wide character from the input stream pointed to by
18349 stream, or WEOF.
18351 <h5><a name="7.24.3.7" href="#7.24.3.7">7.24.3.7 The getwchar function</a></h5>
18352 <h6>Synopsis</h6>
18353 <p><!--para 1 -->
18354 <pre>
18355 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18356 wint_t getwchar(void);
18357 </pre>
18362 <!--page 382 -->
18363 <h6>Description</h6>
18364 <p><!--para 2 -->
18365 The getwchar function is equivalent to getwc with the argument stdin.
18366 <h6>Returns</h6>
18367 <p><!--para 3 -->
18368 The getwchar function returns the next wide character from the input stream pointed to
18369 by stdin, or WEOF.
18371 <h5><a name="7.24.3.8" href="#7.24.3.8">7.24.3.8 The putwc function</a></h5>
18372 <h6>Synopsis</h6>
18373 <p><!--para 1 -->
18374 <pre>
18375 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18376 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18377 wint_t putwc(wchar_t c, FILE *stream);
18378 </pre>
18379 <h6>Description</h6>
18380 <p><!--para 2 -->
18381 The putwc function is equivalent to fputwc, except that if it is implemented as a
18382 macro, it may evaluate stream more than once, so that argument should never be an
18383 expression with side effects.
18384 <h6>Returns</h6>
18385 <p><!--para 3 -->
18386 The putwc function returns the wide character written, or WEOF.
18388 <h5><a name="7.24.3.9" href="#7.24.3.9">7.24.3.9 The putwchar function</a></h5>
18389 <h6>Synopsis</h6>
18390 <p><!--para 1 -->
18391 <pre>
18392 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18393 wint_t putwchar(wchar_t c);
18394 </pre>
18395 <h6>Description</h6>
18396 <p><!--para 2 -->
18397 The putwchar function is equivalent to putwc with the second argument stdout.
18398 <h6>Returns</h6>
18399 <p><!--para 3 -->
18400 The putwchar function returns the character written, or WEOF.
18402 <h5><a name="7.24.3.10" href="#7.24.3.10">7.24.3.10 The ungetwc function</a></h5>
18403 <h6>Synopsis</h6>
18404 <p><!--para 1 -->
18405 <pre>
18406 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18407 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18408 wint_t ungetwc(wint_t c, FILE *stream);
18409 </pre>
18410 <h6>Description</h6>
18411 <p><!--para 2 -->
18412 The ungetwc function pushes the wide character specified by c back onto the input
18413 stream pointed to by stream. Pushed-back wide characters will be returned by
18414 subsequent reads on that stream in the reverse order of their pushing. A successful
18415 <!--page 383 -->
18416 intervening call (with the stream pointed to by stream) to a file positioning function
18417 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
18418 stream. The external storage corresponding to the stream is unchanged.
18419 <p><!--para 3 -->
18420 One wide character of pushback is guaranteed, even if the call to the ungetwc function
18421 follows just after a call to a formatted wide character input function fwscanf,
18422 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
18423 on the same stream without an intervening read or file positioning operation on that
18424 stream, the operation may fail.
18425 <p><!--para 4 -->
18426 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
18427 unchanged.
18428 <p><!--para 5 -->
18429 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
18430 The value of the file position indicator for the stream after reading or discarding all
18431 pushed-back wide characters is the same as it was before the wide characters were pushed
18432 back. For a text or binary stream, the value of its file position indicator after a successful
18433 call to the ungetwc function is unspecified until all pushed-back wide characters are
18434 read or discarded.
18435 <h6>Returns</h6>
18436 <p><!--para 6 -->
18437 The ungetwc function returns the wide character pushed back, or WEOF if the operation
18438 fails.
18440 <h4><a name="7.24.4" href="#7.24.4">7.24.4 General wide string utilities</a></h4>
18441 <p><!--para 1 -->
18442 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
18443 manipulation. Various methods are used for determining the lengths of the arrays, but in
18444 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
18445 array. If an array is accessed beyond the end of an object, the behavior is undefined.
18446 <p><!--para 2 -->
18447 Where an argument declared as size_t n determines the length of the array for a
18448 function, n can have the value zero on a call to that function. Unless explicitly stated
18449 otherwise in the description of a particular function in this subclause, pointer arguments
18450 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
18451 function that locates a wide character finds no occurrence, a function that compares two
18452 wide character sequences returns zero, and a function that copies wide characters copies
18453 zero wide characters.
18454 <!--page 384 -->
18456 <h5><a name="7.24.4.1" href="#7.24.4.1">7.24.4.1 Wide string numeric conversion functions</a></h5>
18458 <h5><a name="7.24.4.1.1" href="#7.24.4.1.1">7.24.4.1.1 The wcstod, wcstof, and wcstold functions</a></h5>
18459 <h6>Synopsis</h6>
18460 <p><!--para 1 -->
18461 <pre>
18462 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18463 double wcstod(const wchar_t * restrict nptr,
18464 wchar_t ** restrict endptr);
18465 float wcstof(const wchar_t * restrict nptr,
18466 wchar_t ** restrict endptr);
18467 long double wcstold(const wchar_t * restrict nptr,
18468 wchar_t ** restrict endptr);
18469 </pre>
18470 <h6>Description</h6>
18471 <p><!--para 2 -->
18472 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
18473 string pointed to by nptr to double, float, and long double representation,
18474 respectively. First, they decompose the input string into three parts: an initial, possibly
18475 empty, sequence of white-space wide characters (as specified by the iswspace
18476 function), a subject sequence resembling a floating-point constant or representing an
18477 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
18478 including the terminating null wide character of the input wide string. Then, they attempt
18479 to convert the subject sequence to a floating-point number, and return the result.
18480 <p><!--para 3 -->
18481 The expected form of the subject sequence is an optional plus or minus sign, then one of
18482 the following:
18483 <ul>
18484 <li> a nonempty sequence of decimal digits optionally containing a decimal-point wide
18485 character, then an optional exponent part as defined for the corresponding single-byte
18486 characters in <a href="#6.4.4.2">6.4.4.2</a>;
18487 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
18488 decimal-point wide character, then an optional binary exponent part as defined in
18489 <a href="#6.4.4.2">6.4.4.2</a>;
18490 <li> INF or INFINITY, or any other wide string equivalent except for case
18491 <li> NAN or NAN(n-wchar-sequence<sub>opt</sub>), or any other wide string equivalent except for
18492 case in the NAN part, where:
18493 <pre>
18494 n-wchar-sequence:
18495 digit
18496 nondigit
18497 n-wchar-sequence digit
18498 n-wchar-sequence nondigit
18499 </pre>
18500 </ul>
18501 The subject sequence is defined as the longest initial subsequence of the input wide
18502 string, starting with the first non-white-space wide character, that is of the expected form.
18503 <!--page 385 -->
18504 The subject sequence contains no wide characters if the input wide string is not of the
18505 expected form.
18506 <p><!--para 4 -->
18507 If the subject sequence has the expected form for a floating-point number, the sequence of
18508 wide characters starting with the first digit or the decimal-point wide character
18509 (whichever occurs first) is interpreted as a floating constant according to the rules of
18510 <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
18511 if neither an exponent part nor a decimal-point wide character appears in a decimal
18512 floating point number, or if a binary exponent part does not appear in a hexadecimal
18513 floating point number, an exponent part of the appropriate type with value zero is
18514 assumed to follow the last digit in the string. If the subject sequence begins with a minus
18515 sign, the sequence is interpreted as negated.<sup><a href="#note294"><b>294)</b></a></sup> A wide character sequence INF or
18516 INFINITY is interpreted as an infinity, if representable in the return type, else like a
18517 floating constant that is too large for the range of the return type. A wide character
18518 sequence NAN or NAN(n-wchar-sequence<sub>opt</sub>) is interpreted as a quiet NaN, if supported
18519 in the return type, else like a subject sequence part that does not have the expected form;
18520 the meaning of the n-wchar sequences is implementation-defined.<sup><a href="#note295"><b>295)</b></a></sup> A pointer to the
18521 final wide string is stored in the object pointed to by endptr, provided that endptr is
18522 not a null pointer.
18523 <p><!--para 5 -->
18524 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
18525 value resulting from the conversion is correctly rounded.
18526 <p><!--para 6 -->
18527 In other than the "C" locale, additional locale-specific subject sequence forms may be
18528 accepted.
18529 <p><!--para 7 -->
18530 If the subject sequence is empty or does not have the expected form, no conversion is
18531 performed; the value of nptr is stored in the object pointed to by endptr, provided
18532 that endptr is not a null pointer.
18533 <h6>Recommended practice</h6>
18534 <p><!--para 8 -->
18535 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
18536 the result is not exactly representable, the result should be one of the two numbers in the
18537 appropriate internal format that are adjacent to the hexadecimal floating source value,
18538 with the extra stipulation that the error should have a correct sign for the current rounding
18539 direction.
18543 <!--page 386 -->
18544 <p><!--para 9 -->
18545 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
18546 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
18547 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
18548 consider the two bounding, adjacent decimal strings L and U, both having
18549 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
18550 The result should be one of the (equal or adjacent) values that would be obtained by
18551 correctly rounding L and U according to the current rounding direction, with the extra
18552 stipulation that the error with respect to D should have a correct sign for the current
18553 rounding direction.<sup><a href="#note296"><b>296)</b></a></sup>
18554 <h6>Returns</h6>
18555 <p><!--para 10 -->
18556 The functions return the converted value, if any. If no conversion could be performed,
18557 zero is returned. If the correct value is outside the range of representable values, plus or
18558 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
18559 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
18560 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
18561 than the smallest normalized positive number in the return type; whether errno acquires
18562 the value ERANGE is implementation-defined.
18567 <!--page 387 -->
18569 <h6>footnotes</h6>
18570 <p><small><a name="note294" href="#note294">294)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
18571 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
18572 methods may yield different results if rounding is toward positive or negative infinity. In either case,
18573 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
18574 </small>
18575 <p><small><a name="note295" href="#note295">295)</a> An implementation may use the n-wchar sequence to determine extra information to be represented in
18576 the NaN's significand.
18577 </small>
18578 <p><small><a name="note296" href="#note296">296)</a> DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
18579 to the same internal floating value, but if not will round to adjacent values.
18580 </small>
18582 <h5><a name="7.24.4.1.2" href="#7.24.4.1.2">7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</a></h5>
18583 <h6>Synopsis</h6>
18584 <p><!--para 1 -->
18585 <pre>
18586 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18587 long int wcstol(
18588 const wchar_t * restrict nptr,
18589 wchar_t ** restrict endptr,
18590 int base);
18591 long long int wcstoll(
18592 const wchar_t * restrict nptr,
18593 wchar_t ** restrict endptr,
18594 int base);
18595 unsigned long int wcstoul(
18596 const wchar_t * restrict nptr,
18597 wchar_t ** restrict endptr,
18598 int base);
18599 unsigned long long int wcstoull(
18600 const wchar_t * restrict nptr,
18601 wchar_t ** restrict endptr,
18602 int base);
18603 </pre>
18604 <h6>Description</h6>
18605 <p><!--para 2 -->
18606 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
18607 portion of the wide string pointed to by nptr to long int, long long int,
18608 unsigned long int, and unsigned long long int representation,
18609 respectively. First, they decompose the input string into three parts: an initial, possibly
18610 empty, sequence of white-space wide characters (as specified by the iswspace
18611 function), a subject sequence resembling an integer represented in some radix determined
18612 by the value of base, and a final wide string of one or more unrecognized wide
18613 characters, including the terminating null wide character of the input wide string. Then,
18614 they attempt to convert the subject sequence to an integer, and return the result.
18615 <p><!--para 3 -->
18616 If the value of base is zero, the expected form of the subject sequence is that of an
18617 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
18618 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
18619 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
18620 is a sequence of letters and digits representing an integer with the radix specified by
18621 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
18622 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
18623 letters and digits whose ascribed values are less than that of base are permitted. If the
18624 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
18625 of letters and digits, following the sign if present.
18626 <!--page 388 -->
18627 <p><!--para 4 -->
18628 The subject sequence is defined as the longest initial subsequence of the input wide
18629 string, starting with the first non-white-space wide character, that is of the expected form.
18630 The subject sequence contains no wide characters if the input wide string is empty or
18631 consists entirely of white space, or if the first non-white-space wide character is other
18632 than a sign or a permissible letter or digit.
18633 <p><!--para 5 -->
18634 If the subject sequence has the expected form and the value of base is zero, the sequence
18635 of wide characters starting with the first digit is interpreted as an integer constant
18636 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
18637 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
18638 letter its value as given above. If the subject sequence begins with a minus sign, the value
18639 resulting from the conversion is negated (in the return type). A pointer to the final wide
18640 string is stored in the object pointed to by endptr, provided that endptr is not a null
18641 pointer.
18642 <p><!--para 6 -->
18643 In other than the "C" locale, additional locale-specific subject sequence forms may be
18644 accepted.
18645 <p><!--para 7 -->
18646 If the subject sequence is empty or does not have the expected form, no conversion is
18647 performed; the value of nptr is stored in the object pointed to by endptr, provided
18648 that endptr is not a null pointer.
18649 <h6>Returns</h6>
18650 <p><!--para 8 -->
18651 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
18652 value, if any. If no conversion could be performed, zero is returned. If the correct value
18653 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
18654 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
18655 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
18657 <h5><a name="7.24.4.2" href="#7.24.4.2">7.24.4.2 Wide string copying functions</a></h5>
18659 <h5><a name="7.24.4.2.1" href="#7.24.4.2.1">7.24.4.2.1 The wcscpy function</a></h5>
18660 <h6>Synopsis</h6>
18661 <p><!--para 1 -->
18662 <pre>
18663 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18664 wchar_t *wcscpy(wchar_t * restrict s1,
18665 const wchar_t * restrict s2);
18666 </pre>
18667 <h6>Description</h6>
18668 <p><!--para 2 -->
18669 The wcscpy function copies the wide string pointed to by s2 (including the terminating
18670 null wide character) into the array pointed to by s1.
18671 <h6>Returns</h6>
18672 <p><!--para 3 -->
18673 The wcscpy function returns the value of s1.
18674 <!--page 389 -->
18676 <h5><a name="7.24.4.2.2" href="#7.24.4.2.2">7.24.4.2.2 The wcsncpy function</a></h5>
18677 <h6>Synopsis</h6>
18678 <p><!--para 1 -->
18679 <pre>
18680 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18681 wchar_t *wcsncpy(wchar_t * restrict s1,
18682 const wchar_t * restrict s2,
18683 size_t n);
18684 </pre>
18685 <h6>Description</h6>
18686 <p><!--para 2 -->
18687 The wcsncpy function copies not more than n wide characters (those that follow a null
18688 wide character are not copied) from the array pointed to by s2 to the array pointed to by
18689 s1.<sup><a href="#note297"><b>297)</b></a></sup>
18690 <p><!--para 3 -->
18691 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
18692 wide characters are appended to the copy in the array pointed to by s1, until n wide
18693 characters in all have been written.
18694 <h6>Returns</h6>
18695 <p><!--para 4 -->
18696 The wcsncpy function returns the value of s1.
18698 <h6>footnotes</h6>
18699 <p><small><a name="note297" href="#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
18700 result will not be null-terminated.
18701 </small>
18703 <h5><a name="7.24.4.2.3" href="#7.24.4.2.3">7.24.4.2.3 The wmemcpy function</a></h5>
18704 <h6>Synopsis</h6>
18705 <p><!--para 1 -->
18706 <pre>
18707 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18708 wchar_t *wmemcpy(wchar_t * restrict s1,
18709 const wchar_t * restrict s2,
18710 size_t n);
18711 </pre>
18712 <h6>Description</h6>
18713 <p><!--para 2 -->
18714 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
18715 object pointed to by s1.
18716 <h6>Returns</h6>
18717 <p><!--para 3 -->
18718 The wmemcpy function returns the value of s1.
18723 <!--page 390 -->
18725 <h5><a name="7.24.4.2.4" href="#7.24.4.2.4">7.24.4.2.4 The wmemmove function</a></h5>
18726 <h6>Synopsis</h6>
18727 <p><!--para 1 -->
18728 <pre>
18729 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18730 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
18731 size_t n);
18732 </pre>
18733 <h6>Description</h6>
18734 <p><!--para 2 -->
18735 The wmemmove function copies n wide characters from the object pointed to by s2 to
18736 the object pointed to by s1. Copying takes place as if the n wide characters from the
18737 object pointed to by s2 are first copied into a temporary array of n wide characters that
18738 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
18739 the temporary array are copied into the object pointed to by s1.
18740 <h6>Returns</h6>
18741 <p><!--para 3 -->
18742 The wmemmove function returns the value of s1.
18744 <h5><a name="7.24.4.3" href="#7.24.4.3">7.24.4.3 Wide string concatenation functions</a></h5>
18746 <h5><a name="7.24.4.3.1" href="#7.24.4.3.1">7.24.4.3.1 The wcscat function</a></h5>
18747 <h6>Synopsis</h6>
18748 <p><!--para 1 -->
18749 <pre>
18750 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18751 wchar_t *wcscat(wchar_t * restrict s1,
18752 const wchar_t * restrict s2);
18753 </pre>
18754 <h6>Description</h6>
18755 <p><!--para 2 -->
18756 The wcscat function appends a copy of the wide string pointed to by s2 (including the
18757 terminating null wide character) to the end of the wide string pointed to by s1. The initial
18758 wide character of s2 overwrites the null wide character at the end of s1.
18759 <h6>Returns</h6>
18760 <p><!--para 3 -->
18761 The wcscat function returns the value of s1.
18763 <h5><a name="7.24.4.3.2" href="#7.24.4.3.2">7.24.4.3.2 The wcsncat function</a></h5>
18764 <h6>Synopsis</h6>
18765 <p><!--para 1 -->
18766 <pre>
18767 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18768 wchar_t *wcsncat(wchar_t * restrict s1,
18769 const wchar_t * restrict s2,
18770 size_t n);
18771 </pre>
18772 <h6>Description</h6>
18773 <p><!--para 2 -->
18774 The wcsncat function appends not more than n wide characters (a null wide character
18775 and those that follow it are not appended) from the array pointed to by s2 to the end of
18776 <!--page 391 -->
18777 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
18778 wide character at the end of s1. A terminating null wide character is always appended to
18779 the result.<sup><a href="#note298"><b>298)</b></a></sup>
18780 <h6>Returns</h6>
18781 <p><!--para 3 -->
18782 The wcsncat function returns the value of s1.
18784 <h6>footnotes</h6>
18785 <p><small><a name="note298" href="#note298">298)</a> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
18786 wcslen(s1)+n+1.
18787 </small>
18789 <h5><a name="7.24.4.4" href="#7.24.4.4">7.24.4.4 Wide string comparison functions</a></h5>
18790 <p><!--para 1 -->
18791 Unless explicitly stated otherwise, the functions described in this subclause order two
18792 wide characters the same way as two integers of the underlying integer type designated
18793 by wchar_t.
18795 <h5><a name="7.24.4.4.1" href="#7.24.4.4.1">7.24.4.4.1 The wcscmp function</a></h5>
18796 <h6>Synopsis</h6>
18797 <p><!--para 1 -->
18798 <pre>
18799 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18800 int wcscmp(const wchar_t *s1, const wchar_t *s2);
18801 </pre>
18802 <h6>Description</h6>
18803 <p><!--para 2 -->
18804 The wcscmp function compares the wide string pointed to by s1 to the wide string
18805 pointed to by s2.
18806 <h6>Returns</h6>
18807 <p><!--para 3 -->
18808 The wcscmp function returns an integer greater than, equal to, or less than zero,
18809 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
18810 wide string pointed to by s2.
18812 <h5><a name="7.24.4.4.2" href="#7.24.4.4.2">7.24.4.4.2 The wcscoll function</a></h5>
18813 <h6>Synopsis</h6>
18814 <p><!--para 1 -->
18815 <pre>
18816 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18817 int wcscoll(const wchar_t *s1, const wchar_t *s2);
18818 </pre>
18819 <h6>Description</h6>
18820 <p><!--para 2 -->
18821 The wcscoll function compares the wide string pointed to by s1 to the wide string
18822 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
18823 current locale.
18824 <h6>Returns</h6>
18825 <p><!--para 3 -->
18826 The wcscoll function returns an integer greater than, equal to, or less than zero,
18827 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
18830 <!--page 392 -->
18831 wide string pointed to by s2 when both are interpreted as appropriate to the current
18832 locale.
18834 <h5><a name="7.24.4.4.3" href="#7.24.4.4.3">7.24.4.4.3 The wcsncmp function</a></h5>
18835 <h6>Synopsis</h6>
18836 <p><!--para 1 -->
18837 <pre>
18838 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18839 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
18840 size_t n);
18841 </pre>
18842 <h6>Description</h6>
18843 <p><!--para 2 -->
18844 The wcsncmp function compares not more than n wide characters (those that follow a
18845 null wide character are not compared) from the array pointed to by s1 to the array
18846 pointed to by s2.
18847 <h6>Returns</h6>
18848 <p><!--para 3 -->
18849 The wcsncmp function returns an integer greater than, equal to, or less than zero,
18850 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
18851 to, or less than the possibly null-terminated array pointed to by s2.
18853 <h5><a name="7.24.4.4.4" href="#7.24.4.4.4">7.24.4.4.4 The wcsxfrm function</a></h5>
18854 <h6>Synopsis</h6>
18855 <p><!--para 1 -->
18856 <pre>
18857 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18858 size_t wcsxfrm(wchar_t * restrict s1,
18859 const wchar_t * restrict s2,
18860 size_t n);
18861 </pre>
18862 <h6>Description</h6>
18863 <p><!--para 2 -->
18864 The wcsxfrm function transforms the wide string pointed to by s2 and places the
18865 resulting wide string into the array pointed to by s1. The transformation is such that if
18866 the wcscmp function is applied to two transformed wide strings, it returns a value greater
18867 than, equal to, or less than zero, corresponding to the result of the wcscoll function
18868 applied to the same two original wide strings. No more than n wide characters are placed
18869 into the resulting array pointed to by s1, including the terminating null wide character. If
18870 n is zero, s1 is permitted to be a null pointer.
18871 <h6>Returns</h6>
18872 <p><!--para 3 -->
18873 The wcsxfrm function returns the length of the transformed wide string (not including
18874 the terminating null wide character). If the value returned is n or greater, the contents of
18875 the array pointed to by s1 are indeterminate.
18876 <p><!--para 4 -->
18877 EXAMPLE The value of the following expression is the length of the array needed to hold the
18878 transformation of the wide string pointed to by s:
18879 <!--page 393 -->
18880 <pre>
18881 1 + wcsxfrm(NULL, s, 0)
18882 </pre>
18885 <h5><a name="7.24.4.4.5" href="#7.24.4.4.5">7.24.4.4.5 The wmemcmp function</a></h5>
18886 <h6>Synopsis</h6>
18887 <p><!--para 1 -->
18888 <pre>
18889 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18890 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
18891 size_t n);
18892 </pre>
18893 <h6>Description</h6>
18894 <p><!--para 2 -->
18895 The wmemcmp function compares the first n wide characters of the object pointed to by
18896 s1 to the first n wide characters of the object pointed to by s2.
18897 <h6>Returns</h6>
18898 <p><!--para 3 -->
18899 The wmemcmp function returns an integer greater than, equal to, or less than zero,
18900 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
18901 pointed to by s2.
18903 <h5><a name="7.24.4.5" href="#7.24.4.5">7.24.4.5 Wide string search functions</a></h5>
18905 <h5><a name="7.24.4.5.1" href="#7.24.4.5.1">7.24.4.5.1 The wcschr function</a></h5>
18906 <h6>Synopsis</h6>
18907 <p><!--para 1 -->
18908 <pre>
18909 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18910 wchar_t *wcschr(const wchar_t *s, wchar_t c);
18911 </pre>
18912 <h6>Description</h6>
18913 <p><!--para 2 -->
18914 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
18915 The terminating null wide character is considered to be part of the wide string.
18916 <h6>Returns</h6>
18917 <p><!--para 3 -->
18918 The wcschr function returns a pointer to the located wide character, or a null pointer if
18919 the wide character does not occur in the wide string.
18921 <h5><a name="7.24.4.5.2" href="#7.24.4.5.2">7.24.4.5.2 The wcscspn function</a></h5>
18922 <h6>Synopsis</h6>
18923 <p><!--para 1 -->
18924 <pre>
18925 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18926 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
18927 </pre>
18928 <h6>Description</h6>
18929 <p><!--para 2 -->
18930 The wcscspn function computes the length of the maximum initial segment of the wide
18931 string pointed to by s1 which consists entirely of wide characters not from the wide
18932 string pointed to by s2.
18933 <!--page 394 -->
18934 <h6>Returns</h6>
18935 <p><!--para 3 -->
18936 The wcscspn function returns the length of the segment.
18938 <h5><a name="7.24.4.5.3" href="#7.24.4.5.3">7.24.4.5.3 The wcspbrk function</a></h5>
18939 <h6>Synopsis</h6>
18940 <p><!--para 1 -->
18941 <pre>
18942 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18943 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
18944 </pre>
18945 <h6>Description</h6>
18946 <p><!--para 2 -->
18947 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
18948 any wide character from the wide string pointed to by s2.
18949 <h6>Returns</h6>
18950 <p><!--para 3 -->
18951 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
18952 no wide character from s2 occurs in s1.
18954 <h5><a name="7.24.4.5.4" href="#7.24.4.5.4">7.24.4.5.4 The wcsrchr function</a></h5>
18955 <h6>Synopsis</h6>
18956 <p><!--para 1 -->
18957 <pre>
18958 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18959 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
18960 </pre>
18961 <h6>Description</h6>
18962 <p><!--para 2 -->
18963 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
18964 s. The terminating null wide character is considered to be part of the wide string.
18965 <h6>Returns</h6>
18966 <p><!--para 3 -->
18967 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
18968 not occur in the wide string.
18970 <h5><a name="7.24.4.5.5" href="#7.24.4.5.5">7.24.4.5.5 The wcsspn function</a></h5>
18971 <h6>Synopsis</h6>
18972 <p><!--para 1 -->
18973 <pre>
18974 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18975 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
18976 </pre>
18977 <h6>Description</h6>
18978 <p><!--para 2 -->
18979 The wcsspn function computes the length of the maximum initial segment of the wide
18980 string pointed to by s1 which consists entirely of wide characters from the wide string
18981 pointed to by s2.
18982 <h6>Returns</h6>
18983 <p><!--para 3 -->
18984 The wcsspn function returns the length of the segment.
18985 <!--page 395 -->
18987 <h5><a name="7.24.4.5.6" href="#7.24.4.5.6">7.24.4.5.6 The wcsstr function</a></h5>
18988 <h6>Synopsis</h6>
18989 <p><!--para 1 -->
18990 <pre>
18991 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18992 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
18993 </pre>
18994 <h6>Description</h6>
18995 <p><!--para 2 -->
18996 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
18997 the sequence of wide characters (excluding the terminating null wide character) in the
18998 wide string pointed to by s2.
18999 <h6>Returns</h6>
19000 <p><!--para 3 -->
19001 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
19002 wide string is not found. If s2 points to a wide string with zero length, the function
19003 returns s1.
19005 <h5><a name="7.24.4.5.7" href="#7.24.4.5.7">7.24.4.5.7 The wcstok function</a></h5>
19006 <h6>Synopsis</h6>
19007 <p><!--para 1 -->
19008 <pre>
19009 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19010 wchar_t *wcstok(wchar_t * restrict s1,
19011 const wchar_t * restrict s2,
19012 wchar_t ** restrict ptr);
19013 </pre>
19014 <h6>Description</h6>
19015 <p><!--para 2 -->
19016 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
19017 a sequence of tokens, each of which is delimited by a wide character from the wide string
19018 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
19019 which the wcstok function stores information necessary for it to continue scanning the
19020 same wide string.
19021 <p><!--para 3 -->
19022 The first call in a sequence has a non-null first argument and stores an initial value in the
19023 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
19024 the object pointed to by ptr is required to have the value stored by the previous call in
19025 the sequence, which is then updated. The separator wide string pointed to by s2 may be
19026 different from call to call.
19027 <p><!--para 4 -->
19028 The first call in the sequence searches the wide string pointed to by s1 for the first wide
19029 character that is not contained in the current separator wide string pointed to by s2. If no
19030 such wide character is found, then there are no tokens in the wide string pointed to by s1
19031 and the wcstok function returns a null pointer. If such a wide character is found, it is
19032 the start of the first token.
19033 <p><!--para 5 -->
19034 The wcstok function then searches from there for a wide character that is contained in
19035 the current separator wide string. If no such wide character is found, the current token
19036 <!--page 396 -->
19037 extends to the end of the wide string pointed to by s1, and subsequent searches in the
19038 same wide string for a token return a null pointer. If such a wide character is found, it is
19039 overwritten by a null wide character, which terminates the current token.
19040 <p><!--para 6 -->
19041 In all cases, the wcstok function stores sufficient information in the pointer pointed to
19042 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
19043 value for ptr, shall start searching just past the element overwritten by a null wide
19044 character (if any).
19045 <h6>Returns</h6>
19046 <p><!--para 7 -->
19047 The wcstok function returns a pointer to the first wide character of a token, or a null
19048 pointer if there is no token.
19049 <p><!--para 8 -->
19050 EXAMPLE
19051 <pre>
19052 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19053 static wchar_t str1[] = L"?a???b,,,#c";
19054 static wchar_t str2[] = L"\t \t";
19055 wchar_t *t, *ptr1, *ptr2;
19056 t = wcstok(str1, L"?", &amp;ptr1); // t points to the token L"a"
19057 t = wcstok(NULL, L",", &amp;ptr1); // t points to the token L"??b"
19058 t = wcstok(str2, L" \t", &amp;ptr2); // t is a null pointer
19059 t = wcstok(NULL, L"#,", &amp;ptr1); // t points to the token L"c"
19060 t = wcstok(NULL, L"?", &amp;ptr1); // t is a null pointer
19061 </pre>
19064 <h5><a name="7.24.4.5.8" href="#7.24.4.5.8">7.24.4.5.8 The wmemchr function</a></h5>
19065 <h6>Synopsis</h6>
19066 <p><!--para 1 -->
19067 <pre>
19068 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19069 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
19070 size_t n);
19071 </pre>
19072 <h6>Description</h6>
19073 <p><!--para 2 -->
19074 The wmemchr function locates the first occurrence of c in the initial n wide characters of
19075 the object pointed to by s.
19076 <h6>Returns</h6>
19077 <p><!--para 3 -->
19078 The wmemchr function returns a pointer to the located wide character, or a null pointer if
19079 the wide character does not occur in the object.
19080 <!--page 397 -->
19082 <h5><a name="7.24.4.6" href="#7.24.4.6">7.24.4.6 Miscellaneous functions</a></h5>
19084 <h5><a name="7.24.4.6.1" href="#7.24.4.6.1">7.24.4.6.1 The wcslen function</a></h5>
19085 <h6>Synopsis</h6>
19086 <p><!--para 1 -->
19087 <pre>
19088 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19089 size_t wcslen(const wchar_t *s);
19090 </pre>
19091 <h6>Description</h6>
19092 <p><!--para 2 -->
19093 The wcslen function computes the length of the wide string pointed to by s.
19094 <h6>Returns</h6>
19095 <p><!--para 3 -->
19096 The wcslen function returns the number of wide characters that precede the terminating
19097 null wide character.
19099 <h5><a name="7.24.4.6.2" href="#7.24.4.6.2">7.24.4.6.2 The wmemset function</a></h5>
19100 <h6>Synopsis</h6>
19101 <p><!--para 1 -->
19102 <pre>
19103 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19104 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
19105 </pre>
19106 <h6>Description</h6>
19107 <p><!--para 2 -->
19108 The wmemset function copies the value of c into each of the first n wide characters of
19109 the object pointed to by s.
19110 <h6>Returns</h6>
19111 <p><!--para 3 -->
19112 The wmemset function returns the value of s.
19114 <h4><a name="7.24.5" href="#7.24.5">7.24.5 Wide character time conversion functions</a></h4>
19116 <h5><a name="7.24.5.1" href="#7.24.5.1">7.24.5.1 The wcsftime function</a></h5>
19117 <h6>Synopsis</h6>
19118 <p><!--para 1 -->
19119 <pre>
19120 #include <a href="#7.23">&lt;time.h&gt;</a>
19121 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19122 size_t wcsftime(wchar_t * restrict s,
19123 size_t maxsize,
19124 const wchar_t * restrict format,
19125 const struct tm * restrict timeptr);
19126 </pre>
19127 <h6>Description</h6>
19128 <p><!--para 2 -->
19129 The wcsftime function is equivalent to the strftime function, except that:
19130 <ul>
19131 <li> The argument s points to the initial element of an array of wide characters into which
19132 the generated output is to be placed.
19133 <!--page 398 -->
19134 <li> The argument maxsize indicates the limiting number of wide characters.
19135 <li> The argument format is a wide string and the conversion specifiers are replaced by
19136 corresponding sequences of wide characters.
19137 <li> The return value indicates the number of wide characters.
19138 </ul>
19139 <h6>Returns</h6>
19140 <p><!--para 3 -->
19141 If the total number of resulting wide characters including the terminating null wide
19142 character is not more than maxsize, the wcsftime function returns the number of
19143 wide characters placed into the array pointed to by s not including the terminating null
19144 wide character. Otherwise, zero is returned and the contents of the array are
19145 indeterminate.
19147 <h4><a name="7.24.6" href="#7.24.6">7.24.6 Extended multibyte/wide character conversion utilities</a></h4>
19148 <p><!--para 1 -->
19149 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
19150 between multibyte characters and wide characters.
19151 <p><!--para 2 -->
19152 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.24.6.3">7.24.6.3</a> and
19153 <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
19154 to describe the current conversion state from a particular multibyte character sequence to
19155 a wide character sequence (or the reverse) under the rules of a particular setting for the
19156 LC_CTYPE category of the current locale.
19157 <p><!--para 3 -->
19158 The initial conversion state corresponds, for a conversion in either direction, to the
19159 beginning of a new multibyte character in the initial shift state. A zero-valued
19160 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
19161 valued mbstate_t object can be used to initiate conversion involving any multibyte
19162 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
19163 been altered by any of the functions described in this subclause, and is then used with a
19164 different multibyte character sequence, or in the other conversion direction, or with a
19165 different LC_CTYPE category setting than on earlier function calls, the behavior is
19166 undefined.<sup><a href="#note299"><b>299)</b></a></sup>
19167 <p><!--para 4 -->
19168 On entry, each function takes the described conversion state (either internal or pointed to
19169 by an argument) as current. The conversion state described by the pointed-to object is
19170 altered as needed to track the shift state, and the position within a multibyte character, for
19171 the associated multibyte character sequence.
19176 <!--page 399 -->
19178 <h6>footnotes</h6>
19179 <p><small><a name="note299" href="#note299">299)</a> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
19180 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
19181 character string.
19182 </small>
19184 <h5><a name="7.24.6.1" href="#7.24.6.1">7.24.6.1 Single-byte/wide character conversion functions</a></h5>
19186 <h5><a name="7.24.6.1.1" href="#7.24.6.1.1">7.24.6.1.1 The btowc function</a></h5>
19187 <h6>Synopsis</h6>
19188 <p><!--para 1 -->
19189 <pre>
19190 #include <a href="#7.19">&lt;stdio.h&gt;</a>
19191 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19192 wint_t btowc(int c);
19193 </pre>
19194 <h6>Description</h6>
19195 <p><!--para 2 -->
19196 The btowc function determines whether c constitutes a valid single-byte character in the
19197 initial shift state.
19198 <h6>Returns</h6>
19199 <p><!--para 3 -->
19200 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
19201 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
19202 returns the wide character representation of that character.
19204 <h5><a name="7.24.6.1.2" href="#7.24.6.1.2">7.24.6.1.2 The wctob function</a></h5>
19205 <h6>Synopsis</h6>
19206 <p><!--para 1 -->
19207 <pre>
19208 #include <a href="#7.19">&lt;stdio.h&gt;</a>
19209 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19210 int wctob(wint_t c);
19211 </pre>
19212 <h6>Description</h6>
19213 <p><!--para 2 -->
19214 The wctob function determines whether c corresponds to a member of the extended
19215 character set whose multibyte character representation is a single byte when in the initial
19216 shift state.
19217 <h6>Returns</h6>
19218 <p><!--para 3 -->
19219 The wctob function returns EOF if c does not correspond to a multibyte character with
19220 length one in the initial shift state. Otherwise, it returns the single-byte representation of
19221 that character as an unsigned char converted to an int.
19223 <h5><a name="7.24.6.2" href="#7.24.6.2">7.24.6.2 Conversion state functions</a></h5>
19225 <h5><a name="7.24.6.2.1" href="#7.24.6.2.1">7.24.6.2.1 The mbsinit function</a></h5>
19226 <h6>Synopsis</h6>
19227 <p><!--para 1 -->
19228 <pre>
19229 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19230 int mbsinit(const mbstate_t *ps);
19231 </pre>
19232 <h6>Description</h6>
19233 <p><!--para 2 -->
19234 If ps is not a null pointer, the mbsinit function determines whether the pointed-to
19235 mbstate_t object describes an initial conversion state.
19236 <!--page 400 -->
19237 <h6>Returns</h6>
19238 <p><!--para 3 -->
19239 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object
19240 describes an initial conversion state; otherwise, it returns zero.
19242 <h5><a name="7.24.6.3" href="#7.24.6.3">7.24.6.3 Restartable multibyte/wide character conversion functions</a></h5>
19243 <p><!--para 1 -->
19244 These functions differ from the corresponding multibyte character functions of <a href="#7.20.7">7.20.7</a>
19245 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
19246 pointer to mbstate_t that points to an object that can completely describe the current
19247 conversion state of the associated multibyte character sequence. If ps is a null pointer,
19248 each function uses its own internal mbstate_t object instead, which is initialized at
19249 program startup to the initial conversion state. The implementation behaves as if no
19250 library function calls these functions with a null pointer for ps.
19251 <p><!--para 2 -->
19252 Also unlike their corresponding functions, the return value does not represent whether the
19253 encoding is state-dependent.
19255 <h5><a name="7.24.6.3.1" href="#7.24.6.3.1">7.24.6.3.1 The mbrlen function</a></h5>
19256 <h6>Synopsis</h6>
19257 <p><!--para 1 -->
19258 <pre>
19259 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19260 size_t mbrlen(const char * restrict s,
19261 size_t n,
19262 mbstate_t * restrict ps);
19263 </pre>
19264 <h6>Description</h6>
19265 <p><!--para 2 -->
19266 The mbrlen function is equivalent to the call:
19267 <pre>
19268 mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)
19269 </pre>
19270 where internal is the mbstate_t object for the mbrlen function, except that the
19271 expression designated by ps is evaluated only once.
19272 <h6>Returns</h6>
19273 <p><!--para 3 -->
19274 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
19275 or (size_t)(-1).
19276 <p><b> Forward references</b>: the mbrtowc function (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
19277 <!--page 401 -->
19279 <h5><a name="7.24.6.3.2" href="#7.24.6.3.2">7.24.6.3.2 The mbrtowc function</a></h5>
19280 <h6>Synopsis</h6>
19281 <p><!--para 1 -->
19282 <pre>
19283 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19284 size_t mbrtowc(wchar_t * restrict pwc,
19285 const char * restrict s,
19286 size_t n,
19287 mbstate_t * restrict ps);
19288 </pre>
19289 <h6>Description</h6>
19290 <p><!--para 2 -->
19291 If s is a null pointer, the mbrtowc function is equivalent to the call:
19292 <pre>
19293 mbrtowc(NULL, "", 1, ps)
19294 </pre>
19295 In this case, the values of the parameters pwc and n are ignored.
19296 <p><!--para 3 -->
19297 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
19298 the byte pointed to by s to determine the number of bytes needed to complete the next
19299 multibyte character (including any shift sequences). If the function determines that the
19300 next multibyte character is complete and valid, it determines the value of the
19301 corresponding wide character and then, if pwc is not a null pointer, stores that value in
19302 the object pointed to by pwc. If the corresponding wide character is the null wide
19303 character, the resulting state described is the initial conversion state.
19304 <h6>Returns</h6>
19305 <p><!--para 4 -->
19306 The mbrtowc function returns the first of the following that applies (given the current
19307 conversion state):
19308 <dl>
19309 <dt> 0 <dd> if the next n or fewer bytes complete the multibyte character that
19310 corresponds to the null wide character (which is the value stored).
19311 <dt> between 1 and n inclusive<dd> if the next n or fewer bytes complete a valid multibyte
19312 character (which is the value stored); the value returned is the number
19313 of bytes that complete the multibyte character.
19314 <dt> (size_t)(-2)<dd> if the next n bytes contribute to an incomplete (but potentially valid)
19315 multibyte character, and all n bytes have been processed (no value is
19316 stored).<sup><a href="#note300"><b>300)</b></a></sup>
19317 <dt> (size_t)(-1)<dd> if an encoding error occurs, in which case the next n or fewer bytes
19318 do not contribute to a complete and valid multibyte character (no
19319 value is stored); the value of the macro EILSEQ is stored in errno,
19320 and the conversion state is unspecified.
19321 </dl>
19322 <!--page 402 -->
19324 <h6>footnotes</h6>
19325 <p><small><a name="note300" href="#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
19326 sequence of redundant shift sequences (for implementations with state-dependent encodings).
19327 </small>
19329 <h5><a name="7.24.6.3.3" href="#7.24.6.3.3">7.24.6.3.3 The wcrtomb function</a></h5>
19330 <h6>Synopsis</h6>
19331 <p><!--para 1 -->
19332 <pre>
19333 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19334 size_t wcrtomb(char * restrict s,
19335 wchar_t wc,
19336 mbstate_t * restrict ps);
19337 </pre>
19338 <h6>Description</h6>
19339 <p><!--para 2 -->
19340 If s is a null pointer, the wcrtomb function is equivalent to the call
19341 <pre>
19342 wcrtomb(buf, L'\0', ps)
19343 </pre>
19344 where buf is an internal buffer.
19345 <p><!--para 3 -->
19346 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
19347 to represent the multibyte character that corresponds to the wide character given by wc
19348 (including any shift sequences), and stores the multibyte character representation in the
19349 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
19350 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
19351 to restore the initial shift state; the resulting state described is the initial conversion state.
19352 <h6>Returns</h6>
19353 <p><!--para 4 -->
19354 The wcrtomb function returns the number of bytes stored in the array object (including
19355 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
19356 the function stores the value of the macro EILSEQ in errno and returns
19357 (size_t)(-1); the conversion state is unspecified.
19359 <h5><a name="7.24.6.4" href="#7.24.6.4">7.24.6.4 Restartable multibyte/wide string conversion functions</a></h5>
19360 <p><!--para 1 -->
19361 These functions differ from the corresponding multibyte string functions of <a href="#7.20.8">7.20.8</a>
19362 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
19363 mbstate_t that points to an object that can completely describe the current conversion
19364 state of the associated multibyte character sequence. If ps is a null pointer, each function
19365 uses its own internal mbstate_t object instead, which is initialized at program startup
19366 to the initial conversion state. The implementation behaves as if no library function calls
19367 these functions with a null pointer for ps.
19368 <p><!--para 2 -->
19369 Also unlike their corresponding functions, the conversion source parameter, src, has a
19370 pointer-to-pointer type. When the function is storing the results of conversions (that is,
19371 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
19372 to reflect the amount of the source processed by that invocation.
19373 <!--page 403 -->
19375 <h5><a name="7.24.6.4.1" href="#7.24.6.4.1">7.24.6.4.1 The mbsrtowcs function</a></h5>
19376 <h6>Synopsis</h6>
19377 <p><!--para 1 -->
19378 <pre>
19379 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19380 size_t mbsrtowcs(wchar_t * restrict dst,
19381 const char ** restrict src,
19382 size_t len,
19383 mbstate_t * restrict ps);
19384 </pre>
19385 <h6>Description</h6>
19386 <p><!--para 2 -->
19387 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
19388 conversion state described by the object pointed to by ps, from the array indirectly
19389 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
19390 pointer, the converted characters are stored into the array pointed to by dst. Conversion
19391 continues up to and including a terminating null character, which is also stored.
19392 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
19393 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
19394 characters have been stored into the array pointed to by dst.<sup><a href="#note301"><b>301)</b></a></sup> Each conversion takes
19395 place as if by a call to the mbrtowc function.
19396 <p><!--para 3 -->
19397 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
19398 pointer (if conversion stopped due to reaching a terminating null character) or the address
19399 just past the last multibyte character converted (if any). If conversion stopped due to
19400 reaching a terminating null character and if dst is not a null pointer, the resulting state
19401 described is the initial conversion state.
19402 <h6>Returns</h6>
19403 <p><!--para 4 -->
19404 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
19405 character, an encoding error occurs: the mbsrtowcs function stores the value of the
19406 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
19407 unspecified. Otherwise, it returns the number of multibyte characters successfully
19408 converted, not including the terminating null character (if any).
19413 <!--page 404 -->
19415 <h6>footnotes</h6>
19416 <p><small><a name="note301" href="#note301">301)</a> Thus, the value of len is ignored if dst is a null pointer.
19417 </small>
19419 <h5><a name="7.24.6.4.2" href="#7.24.6.4.2">7.24.6.4.2 The wcsrtombs function</a></h5>
19420 <h6>Synopsis</h6>
19421 <p><!--para 1 -->
19422 <pre>
19423 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19424 size_t wcsrtombs(char * restrict dst,
19425 const wchar_t ** restrict src,
19426 size_t len,
19427 mbstate_t * restrict ps);
19428 </pre>
19429 <h6>Description</h6>
19430 <p><!--para 2 -->
19431 The wcsrtombs function converts a sequence of wide characters from the array
19432 indirectly pointed to by src into a sequence of corresponding multibyte characters that
19433 begins in the conversion state described by the object pointed to by ps. If dst is not a
19434 null pointer, the converted characters are then stored into the array pointed to by dst.
19435 Conversion continues up to and including a terminating null wide character, which is also
19436 stored. Conversion stops earlier in two cases: when a wide character is reached that does
19437 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
19438 next multibyte character would exceed the limit of len total bytes to be stored into the
19439 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
19440 function.<sup><a href="#note302"><b>302)</b></a></sup>
19441 <p><!--para 3 -->
19442 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
19443 pointer (if conversion stopped due to reaching a terminating null wide character) or the
19444 address just past the last wide character converted (if any). If conversion stopped due to
19445 reaching a terminating null wide character, the resulting state described is the initial
19446 conversion state.
19447 <h6>Returns</h6>
19448 <p><!--para 4 -->
19449 If conversion stops because a wide character is reached that does not correspond to a
19450 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
19451 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
19452 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
19453 character sequence, not including the terminating null character (if any).
19458 <!--page 405 -->
19460 <h6>footnotes</h6>
19461 <p><small><a name="note302" href="#note302">302)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
19462 include those necessary to reach the initial shift state immediately before the null byte.
19463 </small>
19465 <h3><a name="7.25" href="#7.25">7.25 Wide character classification and mapping utilities <wctype.h></a></h3>
19467 <h4><a name="7.25.1" href="#7.25.1">7.25.1 Introduction</a></h4>
19468 <p><!--para 1 -->
19469 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares three data types, one macro, and many functions.<sup><a href="#note303"><b>303)</b></a></sup>
19470 <p><!--para 2 -->
19471 The types declared are
19472 <pre>
19473 wint_t
19474 </pre>
19475 described in <a href="#7.24.1">7.24.1</a>;
19476 <pre>
19477 wctrans_t
19478 </pre>
19479 which is a scalar type that can hold values which represent locale-specific character
19480 mappings; and
19481 <pre>
19482 wctype_t
19483 </pre>
19484 which is a scalar type that can hold values which represent locale-specific character
19485 classifications.
19486 <p><!--para 3 -->
19487 The macro defined is WEOF (described in <a href="#7.24.1">7.24.1</a>).
19488 <p><!--para 4 -->
19489 The functions declared are grouped as follows:
19490 <ul>
19491 <li> Functions that provide wide character classification;
19492 <li> Extensible functions that provide wide character classification;
19493 <li> Functions that provide wide character case mapping;
19494 <li> Extensible functions that provide wide character mapping.
19495 </ul>
19496 <p><!--para 5 -->
19497 For all functions described in this subclause that accept an argument of type wint_t, the
19498 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
19499 this argument has any other value, the behavior is undefined.
19500 <p><!--para 6 -->
19501 The behavior of these functions is affected by the LC_CTYPE category of the current
19502 locale.
19507 <!--page 406 -->
19509 <h6>footnotes</h6>
19510 <p><small><a name="note303" href="#note303">303)</a> See ''future library directions'' (<a href="#7.26.13">7.26.13</a>).
19511 </small>
19513 <h4><a name="7.25.2" href="#7.25.2">7.25.2 Wide character classification utilities</a></h4>
19514 <p><!--para 1 -->
19515 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
19516 characters.
19517 <p><!--para 2 -->
19518 The term printing wide character refers to a member of a locale-specific set of wide
19519 characters, each of which occupies at least one printing position on a display device. The
19520 term control wide character refers to a member of a locale-specific set of wide characters
19521 that are not printing wide characters.
19523 <h5><a name="7.25.2.1" href="#7.25.2.1">7.25.2.1 Wide character classification functions</a></h5>
19524 <p><!--para 1 -->
19525 The functions in this subclause return nonzero (true) if and only if the value of the
19526 argument wc conforms to that in the description of the function.
19527 <p><!--para 2 -->
19528 Each of the following functions returns true for each wide character that corresponds (as
19529 if by a call to the wctob function) to a single-byte character for which the corresponding
19530 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
19531 iswpunct functions may differ with respect to wide characters other than L' ' that are
19532 both printing and white-space wide characters.<sup><a href="#note304"><b>304)</b></a></sup>
19533 <p><b> Forward references</b>: the wctob function (<a href="#7.24.6.1.2">7.24.6.1.2</a>).
19535 <h6>footnotes</h6>
19536 <p><small><a name="note304" href="#note304">304)</a> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
19537 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
19538 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
19539 &amp;&amp; iswspace(wc) is true, but not both.
19540 </small>
19542 <h5><a name="7.25.2.1.1" href="#7.25.2.1.1">7.25.2.1.1 The iswalnum function</a></h5>
19543 <h6>Synopsis</h6>
19544 <p><!--para 1 -->
19545 <pre>
19546 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19547 int iswalnum(wint_t wc);
19548 </pre>
19549 <h6>Description</h6>
19550 <p><!--para 2 -->
19551 The iswalnum function tests for any wide character for which iswalpha or
19552 iswdigit is true.
19554 <h5><a name="7.25.2.1.2" href="#7.25.2.1.2">7.25.2.1.2 The iswalpha function</a></h5>
19555 <h6>Synopsis</h6>
19556 <p><!--para 1 -->
19557 <pre>
19558 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19559 int iswalpha(wint_t wc);
19560 </pre>
19561 <h6>Description</h6>
19562 <p><!--para 2 -->
19563 The iswalpha function tests for any wide character for which iswupper or
19564 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
19566 <!--page 407 -->
19567 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
19568 is true.<sup><a href="#note305"><b>305)</b></a></sup>
19570 <h6>footnotes</h6>
19571 <p><small><a name="note305" href="#note305">305)</a> The functions iswlower and iswupper test true or false separately for each of these additional
19572 wide characters; all four combinations are possible.
19573 </small>
19575 <h5><a name="7.25.2.1.3" href="#7.25.2.1.3">7.25.2.1.3 The iswblank function</a></h5>
19576 <h6>Synopsis</h6>
19577 <p><!--para 1 -->
19578 <pre>
19579 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19580 int iswblank(wint_t wc);
19581 </pre>
19582 <h6>Description</h6>
19583 <p><!--para 2 -->
19584 The iswblank function tests for any wide character that is a standard blank wide
19585 character or is one of a locale-specific set of wide characters for which iswspace is true
19586 and that is used to separate words within a line of text. The standard blank wide
19587 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
19588 locale, iswblank returns true only for the standard blank characters.
19590 <h5><a name="7.25.2.1.4" href="#7.25.2.1.4">7.25.2.1.4 The iswcntrl function</a></h5>
19591 <h6>Synopsis</h6>
19592 <p><!--para 1 -->
19593 <pre>
19594 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19595 int iswcntrl(wint_t wc);
19596 </pre>
19597 <h6>Description</h6>
19598 <p><!--para 2 -->
19599 The iswcntrl function tests for any control wide character.
19601 <h5><a name="7.25.2.1.5" href="#7.25.2.1.5">7.25.2.1.5 The iswdigit function</a></h5>
19602 <h6>Synopsis</h6>
19603 <p><!--para 1 -->
19604 <pre>
19605 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19606 int iswdigit(wint_t wc);
19607 </pre>
19608 <h6>Description</h6>
19609 <p><!--para 2 -->
19610 The iswdigit function tests for any wide character that corresponds to a decimal-digit
19611 character (as defined in <a href="#5.2.1">5.2.1</a>).
19613 <h5><a name="7.25.2.1.6" href="#7.25.2.1.6">7.25.2.1.6 The iswgraph function</a></h5>
19614 <h6>Synopsis</h6>
19615 <p><!--para 1 -->
19616 <pre>
19617 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19618 int iswgraph(wint_t wc);
19619 </pre>
19624 <!--page 408 -->
19625 <h6>Description</h6>
19626 <p><!--para 2 -->
19627 The iswgraph function tests for any wide character for which iswprint is true and
19628 iswspace is false.<sup><a href="#note306"><b>306)</b></a></sup>
19630 <h6>footnotes</h6>
19631 <p><small><a name="note306" href="#note306">306)</a> Note that the behavior of the iswgraph and iswpunct functions may differ from their
19632 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
19633 characters other than ' '.
19634 </small>
19636 <h5><a name="7.25.2.1.7" href="#7.25.2.1.7">7.25.2.1.7 The iswlower function</a></h5>
19637 <h6>Synopsis</h6>
19638 <p><!--para 1 -->
19639 <pre>
19640 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19641 int iswlower(wint_t wc);
19642 </pre>
19643 <h6>Description</h6>
19644 <p><!--para 2 -->
19645 The iswlower function tests for any wide character that corresponds to a lowercase
19646 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
19647 iswdigit, iswpunct, or iswspace is true.
19649 <h5><a name="7.25.2.1.8" href="#7.25.2.1.8">7.25.2.1.8 The iswprint function</a></h5>
19650 <h6>Synopsis</h6>
19651 <p><!--para 1 -->
19652 <pre>
19653 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19654 int iswprint(wint_t wc);
19655 </pre>
19656 <h6>Description</h6>
19657 <p><!--para 2 -->
19658 The iswprint function tests for any printing wide character.
19660 <h5><a name="7.25.2.1.9" href="#7.25.2.1.9">7.25.2.1.9 The iswpunct function</a></h5>
19661 <h6>Synopsis</h6>
19662 <p><!--para 1 -->
19663 <pre>
19664 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19665 int iswpunct(wint_t wc);
19666 </pre>
19667 <h6>Description</h6>
19668 <p><!--para 2 -->
19669 The iswpunct function tests for any printing wide character that is one of a locale-
19670 specific set of punctuation wide characters for which neither iswspace nor iswalnum
19671 is true.306)
19673 <h5><a name="7.25.2.1.10" href="#7.25.2.1.10">7.25.2.1.10 The iswspace function</a></h5>
19674 <h6>Synopsis</h6>
19675 <p><!--para 1 -->
19676 <pre>
19677 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19678 int iswspace(wint_t wc);
19679 </pre>
19683 <!--page 409 -->
19684 <h6>Description</h6>
19685 <p><!--para 2 -->
19686 The iswspace function tests for any wide character that corresponds to a locale-specific
19687 set of white-space wide characters for which none of iswalnum, iswgraph, or
19688 iswpunct is true.
19690 <h5><a name="7.25.2.1.11" href="#7.25.2.1.11">7.25.2.1.11 The iswupper function</a></h5>
19691 <h6>Synopsis</h6>
19692 <p><!--para 1 -->
19693 <pre>
19694 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19695 int iswupper(wint_t wc);
19696 </pre>
19697 <h6>Description</h6>
19698 <p><!--para 2 -->
19699 The iswupper function tests for any wide character that corresponds to an uppercase
19700 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
19701 iswdigit, iswpunct, or iswspace is true.
19703 <h5><a name="7.25.2.1.12" href="#7.25.2.1.12">7.25.2.1.12 The iswxdigit function</a></h5>
19704 <h6>Synopsis</h6>
19705 <p><!--para 1 -->
19706 <pre>
19707 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19708 int iswxdigit(wint_t wc);
19709 </pre>
19710 <h6>Description</h6>
19711 <p><!--para 2 -->
19712 The iswxdigit function tests for any wide character that corresponds to a
19713 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
19715 <h5><a name="7.25.2.2" href="#7.25.2.2">7.25.2.2 Extensible wide character classification functions</a></h5>
19716 <p><!--para 1 -->
19717 The functions wctype and iswctype provide extensible wide character classification
19718 as well as testing equivalent to that performed by the functions described in the previous
19719 subclause (<a href="#7.25.2.1">7.25.2.1</a>).
19721 <h5><a name="7.25.2.2.1" href="#7.25.2.2.1">7.25.2.2.1 The iswctype function</a></h5>
19722 <h6>Synopsis</h6>
19723 <p><!--para 1 -->
19724 <pre>
19725 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19726 int iswctype(wint_t wc, wctype_t desc);
19727 </pre>
19728 <h6>Description</h6>
19729 <p><!--para 2 -->
19730 The iswctype function determines whether the wide character wc has the property
19731 described by desc. The current setting of the LC_CTYPE category shall be the same as
19732 during the call to wctype that returned the value desc.
19733 <p><!--para 3 -->
19734 Each of the following expressions has a truth-value equivalent to the call to the wide
19735 character classification function (<a href="#7.25.2.1">7.25.2.1</a>) in the comment that follows the expression:
19736 <!--page 410 -->
19737 <pre>
19738 iswctype(wc, wctype("alnum")) // iswalnum(wc)
19739 iswctype(wc, wctype("alpha")) // iswalpha(wc)
19740 iswctype(wc, wctype("blank")) // iswblank(wc)
19741 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
19742 iswctype(wc, wctype("digit")) // iswdigit(wc)
19743 iswctype(wc, wctype("graph")) // iswgraph(wc)
19744 iswctype(wc, wctype("lower")) // iswlower(wc)
19745 iswctype(wc, wctype("print")) // iswprint(wc)
19746 iswctype(wc, wctype("punct")) // iswpunct(wc)
19747 iswctype(wc, wctype("space")) // iswspace(wc)
19748 iswctype(wc, wctype("upper")) // iswupper(wc)
19749 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)
19750 </pre>
19751 <h6>Returns</h6>
19752 <p><!--para 4 -->
19753 The iswctype function returns nonzero (true) if and only if the value of the wide
19754 character wc has the property described by desc.
19755 <p><b> Forward references</b>: the wctype function (<a href="#7.25.2.2.2">7.25.2.2.2</a>).
19757 <h5><a name="7.25.2.2.2" href="#7.25.2.2.2">7.25.2.2.2 The wctype function</a></h5>
19758 <h6>Synopsis</h6>
19759 <p><!--para 1 -->
19760 <pre>
19761 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19762 wctype_t wctype(const char *property);
19763 </pre>
19764 <h6>Description</h6>
19765 <p><!--para 2 -->
19766 The wctype function constructs a value with type wctype_t that describes a class of
19767 wide characters identified by the string argument property.
19768 <p><!--para 3 -->
19769 The strings listed in the description of the iswctype function shall be valid in all
19770 locales as property arguments to the wctype function.
19771 <h6>Returns</h6>
19772 <p><!--para 4 -->
19773 If property identifies a valid class of wide characters according to the LC_CTYPE
19774 category of the current locale, the wctype function returns a nonzero value that is valid
19775 as the second argument to the iswctype function; otherwise, it returns zero. *
19776 <!--page 411 -->
19778 <h4><a name="7.25.3" href="#7.25.3">7.25.3 Wide character case mapping utilities</a></h4>
19779 <p><!--para 1 -->
19780 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
19782 <h5><a name="7.25.3.1" href="#7.25.3.1">7.25.3.1 Wide character case mapping functions</a></h5>
19784 <h5><a name="7.25.3.1.1" href="#7.25.3.1.1">7.25.3.1.1 The towlower function</a></h5>
19785 <h6>Synopsis</h6>
19786 <p><!--para 1 -->
19787 <pre>
19788 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19789 wint_t towlower(wint_t wc);
19790 </pre>
19791 <h6>Description</h6>
19792 <p><!--para 2 -->
19793 The towlower function converts an uppercase letter to a corresponding lowercase letter.
19794 <h6>Returns</h6>
19795 <p><!--para 3 -->
19796 If the argument is a wide character for which iswupper is true and there are one or
19797 more corresponding wide characters, as specified by the current locale, for which
19798 iswlower is true, the towlower function returns one of the corresponding wide
19799 characters (always the same one for any given locale); otherwise, the argument is
19800 returned unchanged.
19802 <h5><a name="7.25.3.1.2" href="#7.25.3.1.2">7.25.3.1.2 The towupper function</a></h5>
19803 <h6>Synopsis</h6>
19804 <p><!--para 1 -->
19805 <pre>
19806 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19807 wint_t towupper(wint_t wc);
19808 </pre>
19809 <h6>Description</h6>
19810 <p><!--para 2 -->
19811 The towupper function converts a lowercase letter to a corresponding uppercase letter.
19812 <h6>Returns</h6>
19813 <p><!--para 3 -->
19814 If the argument is a wide character for which iswlower is true and there are one or
19815 more corresponding wide characters, as specified by the current locale, for which
19816 iswupper is true, the towupper function returns one of the corresponding wide
19817 characters (always the same one for any given locale); otherwise, the argument is
19818 returned unchanged.
19820 <h5><a name="7.25.3.2" href="#7.25.3.2">7.25.3.2 Extensible wide character case mapping functions</a></h5>
19821 <p><!--para 1 -->
19822 The functions wctrans and towctrans provide extensible wide character mapping as
19823 well as case mapping equivalent to that performed by the functions described in the
19824 previous subclause (<a href="#7.25.3.1">7.25.3.1</a>).
19825 <!--page 412 -->
19827 <h5><a name="7.25.3.2.1" href="#7.25.3.2.1">7.25.3.2.1 The towctrans function</a></h5>
19828 <h6>Synopsis</h6>
19829 <p><!--para 1 -->
19830 <pre>
19831 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19832 wint_t towctrans(wint_t wc, wctrans_t desc);
19833 </pre>
19834 <h6>Description</h6>
19835 <p><!--para 2 -->
19836 The towctrans function maps the wide character wc using the mapping described by
19837 desc. The current setting of the LC_CTYPE category shall be the same as during the call
19838 to wctrans that returned the value desc.
19839 <p><!--para 3 -->
19840 Each of the following expressions behaves the same as the call to the wide character case
19841 mapping function (<a href="#7.25.3.1">7.25.3.1</a>) in the comment that follows the expression:
19842 <pre>
19843 towctrans(wc, wctrans("tolower")) // towlower(wc)
19844 towctrans(wc, wctrans("toupper")) // towupper(wc)
19845 </pre>
19846 <h6>Returns</h6>
19847 <p><!--para 4 -->
19848 The towctrans function returns the mapped value of wc using the mapping described
19849 by desc.
19851 <h5><a name="7.25.3.2.2" href="#7.25.3.2.2">7.25.3.2.2 The wctrans function</a></h5>
19852 <h6>Synopsis</h6>
19853 <p><!--para 1 -->
19854 <pre>
19855 #include <a href="#7.25">&lt;wctype.h&gt;</a>
19856 wctrans_t wctrans(const char *property);
19857 </pre>
19858 <h6>Description</h6>
19859 <p><!--para 2 -->
19860 The wctrans function constructs a value with type wctrans_t that describes a
19861 mapping between wide characters identified by the string argument property.
19862 <p><!--para 3 -->
19863 The strings listed in the description of the towctrans function shall be valid in all
19864 locales as property arguments to the wctrans function.
19865 <h6>Returns</h6>
19866 <p><!--para 4 -->
19867 If property identifies a valid mapping of wide characters according to the LC_CTYPE
19868 category of the current locale, the wctrans function returns a nonzero value that is valid
19869 as the second argument to the towctrans function; otherwise, it returns zero.
19870 <!--page 413 -->
19872 <h3><a name="7.26" href="#7.26">7.26 Future library directions</a></h3>
19873 <p><!--para 1 -->
19874 The following names are grouped under individual headers for convenience. All external
19875 names described below are reserved no matter what headers are included by the program.
19877 <h4><a name="7.26.1" href="#7.26.1">7.26.1 Complex arithmetic <complex.h></a></h4>
19878 <p><!--para 1 -->
19879 The function names
19880 <pre>
19881 cerf cexpm1 clog2
19882 cerfc clog10 clgamma
19883 cexp2 clog1p ctgamma
19884 </pre>
19885 and the same names suffixed with f or l may be added to the declarations in the
19886 <a href="#7.3">&lt;complex.h&gt;</a> header.
19888 <h4><a name="7.26.2" href="#7.26.2">7.26.2 Character handling <ctype.h></a></h4>
19889 <p><!--para 1 -->
19890 Function names that begin with either is or to, and a lowercase letter may be added to
19891 the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
19893 <h4><a name="7.26.3" href="#7.26.3">7.26.3 Errors <errno.h></a></h4>
19894 <p><!--para 1 -->
19895 Macros that begin with E and a digit or E and an uppercase letter may be added to the
19896 declarations in the <a href="#7.5">&lt;errno.h&gt;</a> header.
19898 <h4><a name="7.26.4" href="#7.26.4">7.26.4 Format conversion of integer types <inttypes.h></a></h4>
19899 <p><!--para 1 -->
19900 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
19901 added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
19903 <h4><a name="7.26.5" href="#7.26.5">7.26.5 Localization <locale.h></a></h4>
19904 <p><!--para 1 -->
19905 Macros that begin with LC_ and an uppercase letter may be added to the definitions in
19906 the <a href="#7.11">&lt;locale.h&gt;</a> header.
19908 <h4><a name="7.26.6" href="#7.26.6">7.26.6 Signal handling <signal.h></a></h4>
19909 <p><!--para 1 -->
19910 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
19911 letter may be added to the definitions in the <a href="#7.14">&lt;signal.h&gt;</a> header.
19913 <h4><a name="7.26.7" href="#7.26.7">7.26.7 Boolean type and values <stdbool.h></a></h4>
19914 <p><!--para 1 -->
19915 The ability to undefine and perhaps then redefine the macros bool, true, and false is
19916 an obsolescent feature.
19918 <h4><a name="7.26.8" href="#7.26.8">7.26.8 Integer types <stdint.h></a></h4>
19919 <p><!--para 1 -->
19920 Typedef names beginning with int or uint and ending with _t may be added to the
19921 types defined in the <a href="#7.18">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
19922 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
19923 <a href="#7.18">&lt;stdint.h&gt;</a> header.
19924 <!--page 414 -->
19926 <h4><a name="7.26.9" href="#7.26.9">7.26.9 Input/output <stdio.h></a></h4>
19927 <p><!--para 1 -->
19928 Lowercase letters may be added to the conversion specifiers and length modifiers in
19929 fprintf and fscanf. Other characters may be used in extensions.
19930 <p><!--para 2 -->
19931 The gets function is obsolescent, and is deprecated.
19932 <p><!--para 3 -->
19933 The use of ungetc on a binary stream where the file position indicator is zero prior to
19934 the call is an obsolescent feature.
19936 <h4><a name="7.26.10" href="#7.26.10">7.26.10 General utilities <stdlib.h></a></h4>
19937 <p><!--para 1 -->
19938 Function names that begin with str and a lowercase letter may be added to the
19939 declarations in the <a href="#7.20">&lt;stdlib.h&gt;</a> header.
19941 <h4><a name="7.26.11" href="#7.26.11">7.26.11 String handling <string.h></a></h4>
19942 <p><!--para 1 -->
19943 Function names that begin with str, mem, or wcs and a lowercase letter may be added
19944 to the declarations in the <a href="#7.21">&lt;string.h&gt;</a> header.
19946 <h4><a name="7.26.12" href="#7.26.12">7.26.12 Extended multibyte and wide character utilities <wchar.h></a></h4>
19947 <p><!--para 1 -->
19948 Function names that begin with wcs and a lowercase letter may be added to the
19949 declarations in the <a href="#7.24">&lt;wchar.h&gt;</a> header.
19950 <p><!--para 2 -->
19951 Lowercase letters may be added to the conversion specifiers and length modifiers in
19952 fwprintf and fwscanf. Other characters may be used in extensions.
19954 <h4><a name="7.26.13" href="#7.26.13">7.26.13 Wide character classification and mapping utilities</a></h4>
19955 <a href="#7.25">&lt;wctype.h&gt;</a>
19956 <p><!--para 1 -->
19957 Function names that begin with is or to and a lowercase letter may be added to the
19958 declarations in the <a href="#7.25">&lt;wctype.h&gt;</a> header.
19959 <!--page 415 -->
19961 <h2><a name="A" href="#A">Annex A</a></h2>
19962 <p><!--para 1 -->
19963 <pre>
19964 (informative)
19965 Language syntax summary
19966 </pre>
19967 NOTE The notation is described in <a href="#6.1">6.1</a>.
19970 <h3><a name="A.1" href="#A.1">A.1 Lexical grammar</a></h3>
19972 <h4><a name="A.1.1" href="#A.1.1">A.1.1 Lexical elements</a></h4>
19973 (<a href="#6.4">6.4</a>) token:
19974 <pre>
19975 keyword
19976 identifier
19977 constant
19978 string-literal
19979 punctuator
19980 </pre>
19981 (<a href="#6.4">6.4</a>) preprocessing-token:
19982 <pre>
19983 header-name
19984 identifier
19985 pp-number
19986 character-constant
19987 string-literal
19988 punctuator
19989 each non-white-space character that cannot be one of the above
19990 </pre>
19992 <h4><a name="A.1.2" href="#A.1.2">A.1.2 Keywords</a></h4>
19993 (<a href="#6.4.1">6.4.1</a>) keyword: one of
19994 <!--page 416 -->
19995 <pre>
19996 auto enum restrict unsigned
19997 break extern return void
19998 case float short volatile
19999 char for signed while
20000 const goto sizeof _Bool
20001 continue if static _Complex
20002 default inline struct _Imaginary
20003 do int switch
20004 double long typedef
20005 else register union
20006 </pre>
20008 <h4><a name="A.1.3" href="#A.1.3">A.1.3 Identifiers</a></h4>
20009 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
20010 <pre>
20011 identifier-nondigit
20012 identifier identifier-nondigit
20013 identifier digit
20014 </pre>
20015 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
20016 <pre>
20017 nondigit
20018 universal-character-name
20019 other implementation-defined characters
20020 </pre>
20021 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
20022 <pre>
20023 _ a b c d e f g h i j k l m
20024 n o p q r s t u v w x y z
20025 A B C D E F G H I J K L M
20026 N O P Q R S T U V W X Y Z
20027 </pre>
20028 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
20029 <pre>
20030 0 1 2 3 4 5 6 7 8 9
20031 </pre>
20033 <h4><a name="A.1.4" href="#A.1.4">A.1.4 Universal character names</a></h4>
20034 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
20035 <pre>
20036 \u hex-quad
20037 \U hex-quad hex-quad
20038 </pre>
20039 (<a href="#6.4.3">6.4.3</a>) hex-quad:
20040 <pre>
20041 hexadecimal-digit hexadecimal-digit
20042 hexadecimal-digit hexadecimal-digit
20043 </pre>
20045 <h4><a name="A.1.5" href="#A.1.5">A.1.5 Constants</a></h4>
20046 (<a href="#6.4.4">6.4.4</a>) constant:
20047 <pre>
20048 integer-constant
20049 floating-constant
20050 enumeration-constant
20051 character-constant
20052 </pre>
20053 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
20054 <pre>
20055 decimal-constant integer-suffixopt
20056 octal-constant integer-suffixopt
20057 hexadecimal-constant integer-suffixopt
20058 </pre>
20059 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
20060 <!--page 417 -->
20061 <pre>
20062 nonzero-digit
20063 decimal-constant digit
20064 </pre>
20065 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
20066 <pre>
20068 octal-constant octal-digit
20069 </pre>
20070 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
20071 <pre>
20072 hexadecimal-prefix hexadecimal-digit
20073 hexadecimal-constant hexadecimal-digit
20074 </pre>
20075 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
20076 <pre>
20077 0x 0X
20078 </pre>
20079 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
20080 <pre>
20081 1 2 3 4 5 6 7 8 9
20082 </pre>
20083 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
20084 <pre>
20085 0 1 2 3 4 5 6 7
20086 </pre>
20087 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
20088 <pre>
20089 0 1 2 3 4 5 6 7 8 9
20090 a b c d e f
20091 A B C D E F
20092 </pre>
20093 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
20094 <pre>
20095 unsigned-suffix long-suffixopt
20096 unsigned-suffix long-long-suffix
20097 long-suffix unsigned-suffixopt
20098 long-long-suffix unsigned-suffixopt
20099 </pre>
20100 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
20101 <pre>
20103 </pre>
20104 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
20105 <pre>
20107 </pre>
20108 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
20109 <pre>
20110 ll LL
20111 </pre>
20112 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
20113 <pre>
20114 decimal-floating-constant
20115 hexadecimal-floating-constant
20116 </pre>
20117 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
20118 <!--page 418 -->
20119 <pre>
20120 fractional-constant exponent-partopt floating-suffixopt
20121 digit-sequence exponent-part floating-suffixopt
20122 </pre>
20123 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
20124 <pre>
20125 hexadecimal-prefix hexadecimal-fractional-constant
20126 binary-exponent-part floating-suffixopt
20127 hexadecimal-prefix hexadecimal-digit-sequence
20128 binary-exponent-part floating-suffixopt
20129 </pre>
20130 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
20131 <pre>
20132 digit-sequenceopt . digit-sequence
20133 digit-sequence .
20134 </pre>
20135 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
20136 <pre>
20137 e signopt digit-sequence
20138 E signopt digit-sequence
20139 </pre>
20140 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
20141 <pre>
20143 </pre>
20144 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
20145 <pre>
20146 digit
20147 digit-sequence digit
20148 </pre>
20149 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
20150 <pre>
20151 hexadecimal-digit-sequenceopt .
20152 hexadecimal-digit-sequence
20153 hexadecimal-digit-sequence .
20154 </pre>
20155 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
20156 <pre>
20157 p signopt digit-sequence
20158 P signopt digit-sequence
20159 </pre>
20160 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
20161 <pre>
20162 hexadecimal-digit
20163 hexadecimal-digit-sequence hexadecimal-digit
20164 </pre>
20165 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
20166 <pre>
20167 f l F L
20168 </pre>
20169 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
20170 <pre>
20171 identifier
20172 </pre>
20173 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
20174 <!--page 419 -->
20175 <pre>
20176 ' c-char-sequence '
20177 L' c-char-sequence '
20178 </pre>
20179 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
20180 <pre>
20181 c-char
20182 c-char-sequence c-char
20183 </pre>
20184 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
20185 <pre>
20186 any member of the source character set except
20187 the single-quote ', backslash \, or new-line character
20188 escape-sequence
20189 </pre>
20190 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
20191 <pre>
20192 simple-escape-sequence
20193 octal-escape-sequence
20194 hexadecimal-escape-sequence
20195 universal-character-name
20196 </pre>
20197 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
20198 <pre>
20199 \' \" \? \\
20200 \a \b \f \n \r \t \v
20201 </pre>
20202 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
20203 <pre>
20204 \ octal-digit
20205 \ octal-digit octal-digit
20206 \ octal-digit octal-digit octal-digit
20207 </pre>
20208 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
20209 <pre>
20210 \x hexadecimal-digit
20211 hexadecimal-escape-sequence hexadecimal-digit
20212 </pre>
20214 <h4><a name="A.1.6" href="#A.1.6">A.1.6 String literals</a></h4>
20215 (<a href="#6.4.5">6.4.5</a>) string-literal:
20216 <pre>
20217 " s-char-sequenceopt "
20218 L" s-char-sequenceopt "
20219 </pre>
20220 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
20221 <pre>
20222 s-char
20223 s-char-sequence s-char
20224 </pre>
20225 (<a href="#6.4.5">6.4.5</a>) s-char:
20226 <!--page 420 -->
20227 <pre>
20228 any member of the source character set except
20229 the double-quote ", backslash \, or new-line character
20230 escape-sequence
20231 </pre>
20233 <h4><a name="A.1.7" href="#A.1.7">A.1.7 Punctuators</a></h4>
20234 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
20235 <pre>
20236 [ ] ( ) { } . -&gt;
20237 ++ -- &amp; * + - ~ !
20238 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
20239 ? : ; ...
20240 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
20241 , # ##
20242 &lt;: :&gt; &lt;% %&gt; %: %:%:
20243 </pre>
20245 <h4><a name="A.1.8" href="#A.1.8">A.1.8 Header names</a></h4>
20246 (<a href="#6.4.7">6.4.7</a>) header-name:
20247 <pre>
20248 &lt; h-char-sequence &gt;
20249 " q-char-sequence "
20250 </pre>
20251 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
20252 <pre>
20253 h-char
20254 h-char-sequence h-char
20255 </pre>
20256 (<a href="#6.4.7">6.4.7</a>) h-char:
20257 <pre>
20258 any member of the source character set except
20259 the new-line character and &gt;
20260 </pre>
20261 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
20262 <pre>
20263 q-char
20264 q-char-sequence q-char
20265 </pre>
20266 (<a href="#6.4.7">6.4.7</a>) q-char:
20267 <pre>
20268 any member of the source character set except
20269 the new-line character and "
20270 </pre>
20272 <h4><a name="A.1.9" href="#A.1.9">A.1.9 Preprocessing numbers</a></h4>
20273 (<a href="#6.4.8">6.4.8</a>) pp-number:
20274 <!--page 421 -->
20275 <pre>
20276 digit
20277 . digit
20278 pp-number digit
20279 pp-number identifier-nondigit
20280 pp-number e sign
20281 pp-number E sign
20282 pp-number p sign
20283 pp-number P sign
20284 pp-number .
20285 </pre>
20287 <h3><a name="A.2" href="#A.2">A.2 Phrase structure grammar</a></h3>
20289 <h4><a name="A.2.1" href="#A.2.1">A.2.1 Expressions</a></h4>
20290 (<a href="#6.5.1">6.5.1</a>) primary-expression:
20291 <pre>
20292 identifier
20293 constant
20294 string-literal
20295 ( expression )
20296 </pre>
20297 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
20298 <pre>
20299 primary-expression
20300 postfix-expression [ expression ]
20301 postfix-expression ( argument-expression-listopt )
20302 postfix-expression . identifier
20303 postfix-expression -&gt; identifier
20304 postfix-expression ++
20305 postfix-expression --
20306 ( type-name ) { initializer-list }
20307 ( type-name ) { initializer-list , }
20308 </pre>
20309 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
20310 <pre>
20311 assignment-expression
20312 argument-expression-list , assignment-expression
20313 </pre>
20314 (<a href="#6.5.3">6.5.3</a>) unary-expression:
20315 <pre>
20316 postfix-expression
20317 ++ unary-expression
20318 -- unary-expression
20319 unary-operator cast-expression
20320 sizeof unary-expression
20321 sizeof ( type-name )
20322 </pre>
20323 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
20324 <pre>
20325 &amp; * + - ~ !
20326 </pre>
20327 (<a href="#6.5.4">6.5.4</a>) cast-expression:
20328 <pre>
20329 unary-expression
20330 ( type-name ) cast-expression
20331 </pre>
20332 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
20333 <!--page 422 -->
20334 <pre>
20335 cast-expression
20336 multiplicative-expression * cast-expression
20337 multiplicative-expression / cast-expression
20338 multiplicative-expression % cast-expression
20339 </pre>
20340 (<a href="#6.5.6">6.5.6</a>) additive-expression:
20341 <pre>
20342 multiplicative-expression
20343 additive-expression + multiplicative-expression
20344 additive-expression - multiplicative-expression
20345 </pre>
20346 (<a href="#6.5.7">6.5.7</a>) shift-expression:
20347 <pre>
20348 additive-expression
20349 shift-expression &lt;&lt; additive-expression
20350 shift-expression &gt;&gt; additive-expression
20351 </pre>
20352 (<a href="#6.5.8">6.5.8</a>) relational-expression:
20353 <pre>
20354 shift-expression
20355 relational-expression &lt; shift-expression
20356 relational-expression &gt; shift-expression
20357 relational-expression &lt;= shift-expression
20358 relational-expression &gt;= shift-expression
20359 </pre>
20360 (<a href="#6.5.9">6.5.9</a>) equality-expression:
20361 <pre>
20362 relational-expression
20363 equality-expression == relational-expression
20364 equality-expression != relational-expression
20365 </pre>
20366 (<a href="#6.5.10">6.5.10</a>) AND-expression:
20367 <pre>
20368 equality-expression
20369 AND-expression &amp; equality-expression
20370 </pre>
20371 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
20372 <pre>
20373 AND-expression
20374 exclusive-OR-expression ^ AND-expression
20375 </pre>
20376 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
20377 <pre>
20378 exclusive-OR-expression
20379 inclusive-OR-expression | exclusive-OR-expression
20380 </pre>
20381 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
20382 <pre>
20383 inclusive-OR-expression
20384 logical-AND-expression &amp;&amp; inclusive-OR-expression
20385 </pre>
20386 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
20387 <pre>
20388 logical-AND-expression
20389 logical-OR-expression || logical-AND-expression
20390 </pre>
20391 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
20392 <!--page 423 -->
20393 <pre>
20394 logical-OR-expression
20395 logical-OR-expression ? expression : conditional-expression
20396 </pre>
20397 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
20398 <pre>
20399 conditional-expression
20400 unary-expression assignment-operator assignment-expression
20401 </pre>
20402 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
20403 <pre>
20404 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
20405 </pre>
20406 (<a href="#6.5.17">6.5.17</a>) expression:
20407 <pre>
20408 assignment-expression
20409 expression , assignment-expression
20410 </pre>
20411 (<a href="#6.6">6.6</a>) constant-expression:
20412 <pre>
20413 conditional-expression
20414 </pre>
20416 <h4><a name="A.2.2" href="#A.2.2">A.2.2 Declarations</a></h4>
20417 (<a href="#6.7">6.7</a>) declaration:
20418 <pre>
20419 declaration-specifiers init-declarator-listopt ;
20420 </pre>
20421 (<a href="#6.7">6.7</a>) declaration-specifiers:
20422 <pre>
20423 storage-class-specifier declaration-specifiersopt
20424 type-specifier declaration-specifiersopt
20425 type-qualifier declaration-specifiersopt
20426 function-specifier declaration-specifiersopt
20427 </pre>
20428 (<a href="#6.7">6.7</a>) init-declarator-list:
20429 <pre>
20430 init-declarator
20431 init-declarator-list , init-declarator
20432 </pre>
20433 (<a href="#6.7">6.7</a>) init-declarator:
20434 <pre>
20435 declarator
20436 declarator = initializer
20437 </pre>
20438 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
20439 <!--page 424 -->
20440 <pre>
20441 typedef
20442 extern
20443 static
20444 auto
20445 register
20446 </pre>
20447 (<a href="#6.7.2">6.7.2</a>) type-specifier:
20448 <pre>
20449 void
20450 char
20451 short
20453 long
20454 float
20455 double
20456 signed
20457 unsigned
20458 _Bool
20459 _Complex
20460 struct-or-union-specifier *
20461 enum-specifier
20462 typedef-name
20463 </pre>
20464 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
20465 <pre>
20466 struct-or-union identifieropt { struct-declaration-list }
20467 struct-or-union identifier
20468 </pre>
20469 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
20470 <pre>
20471 struct
20472 union
20473 </pre>
20474 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
20475 <pre>
20476 struct-declaration
20477 struct-declaration-list struct-declaration
20478 </pre>
20479 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
20480 <pre>
20481 specifier-qualifier-list struct-declarator-list ;
20482 </pre>
20483 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
20484 <pre>
20485 type-specifier specifier-qualifier-listopt
20486 type-qualifier specifier-qualifier-listopt
20487 </pre>
20488 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
20489 <pre>
20490 struct-declarator
20491 struct-declarator-list , struct-declarator
20492 </pre>
20493 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
20494 <!--page 425 -->
20495 <pre>
20496 declarator
20497 declaratoropt : constant-expression
20498 </pre>
20499 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
20500 <pre>
20501 enum identifieropt { enumerator-list }
20502 enum identifieropt { enumerator-list , }
20503 enum identifier
20504 </pre>
20505 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
20506 <pre>
20507 enumerator
20508 enumerator-list , enumerator
20509 </pre>
20510 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
20511 <pre>
20512 enumeration-constant
20513 enumeration-constant = constant-expression
20514 </pre>
20515 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
20516 <pre>
20517 const
20518 restrict
20519 volatile
20520 </pre>
20521 (<a href="#6.7.4">6.7.4</a>) function-specifier:
20522 <pre>
20523 inline
20524 </pre>
20525 (<a href="#6.7.5">6.7.5</a>) declarator:
20526 <pre>
20527 pointeropt direct-declarator
20528 </pre>
20529 (<a href="#6.7.5">6.7.5</a>) direct-declarator:
20530 <pre>
20531 identifier
20532 ( declarator )
20533 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
20534 direct-declarator [ static type-qualifier-listopt assignment-expression ]
20535 direct-declarator [ type-qualifier-list static assignment-expression ]
20536 direct-declarator [ type-qualifier-listopt * ]
20537 direct-declarator ( parameter-type-list )
20538 direct-declarator ( identifier-listopt )
20539 </pre>
20540 (<a href="#6.7.5">6.7.5</a>) pointer:
20541 <pre>
20542 * type-qualifier-listopt
20543 * type-qualifier-listopt pointer
20544 </pre>
20545 (<a href="#6.7.5">6.7.5</a>) type-qualifier-list:
20546 <pre>
20547 type-qualifier
20548 type-qualifier-list type-qualifier
20549 </pre>
20550 (<a href="#6.7.5">6.7.5</a>) parameter-type-list:
20551 <!--page 426 -->
20552 <pre>
20553 parameter-list
20554 parameter-list , ...
20555 </pre>
20556 (<a href="#6.7.5">6.7.5</a>) parameter-list:
20557 <pre>
20558 parameter-declaration
20559 parameter-list , parameter-declaration
20560 </pre>
20561 (<a href="#6.7.5">6.7.5</a>) parameter-declaration:
20562 <pre>
20563 declaration-specifiers declarator
20564 declaration-specifiers abstract-declaratoropt
20565 </pre>
20566 (<a href="#6.7.5">6.7.5</a>) identifier-list:
20567 <pre>
20568 identifier
20569 identifier-list , identifier
20570 </pre>
20571 (<a href="#6.7.6">6.7.6</a>) type-name:
20572 <pre>
20573 specifier-qualifier-list abstract-declaratoropt
20574 </pre>
20575 (<a href="#6.7.6">6.7.6</a>) abstract-declarator:
20576 <pre>
20577 pointer
20578 pointeropt direct-abstract-declarator
20579 </pre>
20580 (<a href="#6.7.6">6.7.6</a>) direct-abstract-declarator:
20581 <pre>
20582 ( abstract-declarator )
20583 direct-abstract-declaratoropt [ type-qualifier-listopt
20584 assignment-expressionopt ]
20585 direct-abstract-declaratoropt [ static type-qualifier-listopt
20586 assignment-expression ]
20587 direct-abstract-declaratoropt [ type-qualifier-list static
20588 assignment-expression ]
20589 direct-abstract-declaratoropt [ * ]
20590 direct-abstract-declaratoropt ( parameter-type-listopt )
20591 </pre>
20592 (<a href="#6.7.7">6.7.7</a>) typedef-name:
20593 <pre>
20594 identifier
20595 </pre>
20596 (<a href="#6.7.8">6.7.8</a>) initializer:
20597 <pre>
20598 assignment-expression
20599 { initializer-list }
20600 { initializer-list , }
20601 </pre>
20602 (<a href="#6.7.8">6.7.8</a>) initializer-list:
20603 <pre>
20604 designationopt initializer
20605 initializer-list , designationopt initializer
20606 </pre>
20607 (<a href="#6.7.8">6.7.8</a>) designation:
20608 <!--page 427 -->
20609 <pre>
20610 designator-list =
20611 </pre>
20612 (<a href="#6.7.8">6.7.8</a>) designator-list:
20613 <pre>
20614 designator
20615 designator-list designator
20616 </pre>
20617 (<a href="#6.7.8">6.7.8</a>) designator:
20618 <pre>
20619 [ constant-expression ]
20620 . identifier
20621 </pre>
20623 <h4><a name="A.2.3" href="#A.2.3">A.2.3 Statements</a></h4>
20624 (<a href="#6.8">6.8</a>) statement:
20625 <pre>
20626 labeled-statement
20627 compound-statement
20628 expression-statement
20629 selection-statement
20630 iteration-statement
20631 jump-statement
20632 </pre>
20633 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
20634 <pre>
20635 identifier : statement
20636 case constant-expression : statement
20637 default : statement
20638 </pre>
20639 (<a href="#6.8.2">6.8.2</a>) compound-statement:
20640 <pre>
20641 { block-item-listopt }
20642 </pre>
20643 (<a href="#6.8.2">6.8.2</a>) block-item-list:
20644 <pre>
20645 block-item
20646 block-item-list block-item
20647 </pre>
20648 (<a href="#6.8.2">6.8.2</a>) block-item:
20649 <pre>
20650 declaration
20651 statement
20652 </pre>
20653 (<a href="#6.8.3">6.8.3</a>) expression-statement:
20654 <pre>
20655 expressionopt ;
20656 </pre>
20657 (<a href="#6.8.4">6.8.4</a>) selection-statement:
20658 <!--page 428 -->
20659 <pre>
20660 if ( expression ) statement
20661 if ( expression ) statement else statement
20662 switch ( expression ) statement
20663 </pre>
20664 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
20665 <pre>
20666 while ( expression ) statement
20667 do statement while ( expression ) ;
20668 for ( expressionopt ; expressionopt ; expressionopt ) statement
20669 for ( declaration expressionopt ; expressionopt ) statement
20670 </pre>
20671 (<a href="#6.8.6">6.8.6</a>) jump-statement:
20672 <pre>
20673 goto identifier ;
20674 continue ;
20675 break ;
20676 return expressionopt ;
20677 </pre>
20679 <h4><a name="A.2.4" href="#A.2.4">A.2.4 External definitions</a></h4>
20680 (<a href="#6.9">6.9</a>) translation-unit:
20681 <pre>
20682 external-declaration
20683 translation-unit external-declaration
20684 </pre>
20685 (<a href="#6.9">6.9</a>) external-declaration:
20686 <pre>
20687 function-definition
20688 declaration
20689 </pre>
20690 (<a href="#6.9.1">6.9.1</a>) function-definition:
20691 <pre>
20692 declaration-specifiers declarator declaration-listopt compound-statement
20693 </pre>
20694 (<a href="#6.9.1">6.9.1</a>) declaration-list:
20695 <pre>
20696 declaration
20697 declaration-list declaration
20698 </pre>
20700 <h3><a name="A.3" href="#A.3">A.3 Preprocessing directives</a></h3>
20701 (<a href="#6.10">6.10</a>) preprocessing-file:
20702 <pre>
20703 groupopt
20704 </pre>
20705 (<a href="#6.10">6.10</a>) group:
20706 <pre>
20707 group-part
20708 group group-part
20709 </pre>
20710 (<a href="#6.10">6.10</a>) group-part:
20711 <pre>
20712 if-section
20713 control-line
20714 text-line
20715 # non-directive
20716 </pre>
20717 (<a href="#6.10">6.10</a>) if-section:
20718 <!--page 429 -->
20719 <pre>
20720 if-group elif-groupsopt else-groupopt endif-line
20721 </pre>
20722 (<a href="#6.10">6.10</a>) if-group:
20723 <pre>
20724 # if constant-expression new-line groupopt
20725 # ifdef identifier new-line groupopt
20726 # ifndef identifier new-line groupopt
20727 </pre>
20728 (<a href="#6.10">6.10</a>) elif-groups:
20729 <pre>
20730 elif-group
20731 elif-groups elif-group
20732 </pre>
20733 (<a href="#6.10">6.10</a>) elif-group:
20734 <pre>
20735 # elif constant-expression new-line groupopt
20736 </pre>
20737 (<a href="#6.10">6.10</a>) else-group:
20738 <pre>
20739 # else new-line groupopt
20740 </pre>
20741 (<a href="#6.10">6.10</a>) endif-line:
20742 <pre>
20743 # endif new-line
20744 </pre>
20745 (<a href="#6.10">6.10</a>) control-line:
20746 <pre>
20747 # include pp-tokens new-line
20748 # define identifier replacement-list new-line
20749 # define identifier lparen identifier-listopt )
20750 replacement-list new-line
20751 # define identifier lparen ... ) replacement-list new-line
20752 # define identifier lparen identifier-list , ... )
20753 replacement-list new-line
20754 # undef identifier new-line
20755 # line pp-tokens new-line
20756 # error pp-tokensopt new-line
20757 # pragma pp-tokensopt new-line
20758 # new-line
20759 </pre>
20760 (<a href="#6.10">6.10</a>) text-line:
20761 <pre>
20762 pp-tokensopt new-line
20763 </pre>
20764 (<a href="#6.10">6.10</a>) non-directive:
20765 <pre>
20766 pp-tokens new-line
20767 </pre>
20768 (<a href="#6.10">6.10</a>) lparen:
20769 <pre>
20770 a ( character not immediately preceded by white-space
20771 </pre>
20772 (<a href="#6.10">6.10</a>) replacement-list:
20773 <!--page 430 -->
20774 <pre>
20775 pp-tokensopt
20776 </pre>
20777 (<a href="#6.10">6.10</a>) pp-tokens:
20778 <pre>
20779 preprocessing-token
20780 pp-tokens preprocessing-token
20781 </pre>
20782 (<a href="#6.10">6.10</a>) new-line:
20783 <!--page 431 -->
20784 <pre>
20785 the new-line character
20786 </pre>
20788 <h2><a name="B" href="#B">Annex B</a></h2>
20789 <pre>
20790 (informative)
20791 Library summary
20792 </pre>
20794 <h3><a name="B.1" href="#B.1">B.1 Diagnostics <assert.h></a></h3>
20795 <pre>
20796 NDEBUG
20797 void assert(scalar expression);
20798 </pre>
20800 <h3><a name="B.2" href="#B.2">B.2 Complex <complex.h></a></h3>
20801 <!--page 432 -->
20802 <!--page 433 -->
20803 <pre>
20804 complex imaginary I
20805 _Complex_I _Imaginary_I
20806 #pragma STDC CX_LIMITED_RANGE on-off-switch
20807 double complex cacos(double complex z);
20808 float complex cacosf(float complex z);
20809 long double complex cacosl(long double complex z);
20810 double complex casin(double complex z);
20811 float complex casinf(float complex z);
20812 long double complex casinl(long double complex z);
20813 double complex catan(double complex z);
20814 float complex catanf(float complex z);
20815 long double complex catanl(long double complex z);
20816 double complex ccos(double complex z);
20817 float complex ccosf(float complex z);
20818 long double complex ccosl(long double complex z);
20819 double complex csin(double complex z);
20820 float complex csinf(float complex z);
20821 long double complex csinl(long double complex z);
20822 double complex ctan(double complex z);
20823 float complex ctanf(float complex z);
20824 long double complex ctanl(long double complex z);
20825 double complex cacosh(double complex z);
20826 float complex cacoshf(float complex z);
20827 long double complex cacoshl(long double complex z);
20828 double complex casinh(double complex z);
20829 float complex casinhf(float complex z);
20830 long double complex casinhl(long double complex z);
20831 double complex catanh(double complex z);
20832 float complex catanhf(float complex z);
20833 long double complex catanhl(long double complex z);
20834 double complex ccosh(double complex z);
20835 float complex ccoshf(float complex z);
20836 long double complex ccoshl(long double complex z);
20837 double complex csinh(double complex z);
20838 float complex csinhf(float complex z);
20839 long double complex csinhl(long double complex z);
20840 double complex ctanh(double complex z);
20841 float complex ctanhf(float complex z);
20842 long double complex ctanhl(long double complex z);
20843 double complex cexp(double complex z);
20844 float complex cexpf(float complex z);
20845 long double complex cexpl(long double complex z);
20846 double complex clog(double complex z);
20847 float complex clogf(float complex z);
20848 long double complex clogl(long double complex z);
20849 double cabs(double complex z);
20850 float cabsf(float complex z);
20851 long double cabsl(long double complex z);
20852 double complex cpow(double complex x, double complex y);
20853 float complex cpowf(float complex x, float complex y);
20854 long double complex cpowl(long double complex x,
20855 long double complex y);
20856 double complex csqrt(double complex z);
20857 float complex csqrtf(float complex z);
20858 long double complex csqrtl(long double complex z);
20859 double carg(double complex z);
20860 float cargf(float complex z);
20861 long double cargl(long double complex z);
20862 double cimag(double complex z);
20863 float cimagf(float complex z);
20864 long double cimagl(long double complex z);
20865 double complex conj(double complex z);
20866 float complex conjf(float complex z);
20867 long double complex conjl(long double complex z);
20868 double complex cproj(double complex z);
20869 float complex cprojf(float complex z);
20870 long double complex cprojl(long double complex z);
20871 double creal(double complex z);
20872 float crealf(float complex z);
20873 long double creall(long double complex z);
20874 </pre>
20876 <h3><a name="B.3" href="#B.3">B.3 Character handling <ctype.h></a></h3>
20877 <pre>
20878 int isalnum(int c);
20879 int isalpha(int c);
20880 int isblank(int c);
20881 int iscntrl(int c);
20882 int isdigit(int c);
20883 int isgraph(int c);
20884 int islower(int c);
20885 int isprint(int c);
20886 int ispunct(int c);
20887 int isspace(int c);
20888 int isupper(int c);
20889 int isxdigit(int c);
20890 int tolower(int c);
20891 int toupper(int c);
20892 </pre>
20894 <h3><a name="B.4" href="#B.4">B.4 Errors <errno.h></a></h3>
20895 <pre>
20896 EDOM EILSEQ ERANGE errno
20897 </pre>
20899 <h3><a name="B.5" href="#B.5">B.5 Floating-point environment <fenv.h></a></h3>
20900 <!--page 434 -->
20901 <pre>
20902 fenv_t FE_OVERFLOW FE_TOWARDZERO
20903 fexcept_t FE_UNDERFLOW FE_UPWARD
20904 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
20905 FE_INEXACT FE_DOWNWARD
20906 FE_INVALID FE_TONEAREST
20907 #pragma STDC FENV_ACCESS on-off-switch
20908 int feclearexcept(int excepts);
20909 int fegetexceptflag(fexcept_t *flagp, int excepts);
20910 int feraiseexcept(int excepts);
20911 int fesetexceptflag(const fexcept_t *flagp,
20912 int excepts);
20913 int fetestexcept(int excepts);
20914 int fegetround(void);
20915 int fesetround(int round);
20916 int fegetenv(fenv_t *envp);
20917 int feholdexcept(fenv_t *envp);
20918 int fesetenv(const fenv_t *envp);
20919 int feupdateenv(const fenv_t *envp);
20920 </pre>
20922 <h3><a name="B.6" href="#B.6">B.6 Characteristics of floating types <float.h></a></h3>
20923 <pre>
20924 FLT_ROUNDS DBL_MIN_EXP FLT_MAX
20925 FLT_EVAL_METHOD LDBL_MIN_EXP DBL_MAX
20926 FLT_RADIX FLT_MIN_10_EXP LDBL_MAX
20927 FLT_MANT_DIG DBL_MIN_10_EXP FLT_EPSILON
20928 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_EPSILON
20929 LDBL_MANT_DIG FLT_MAX_EXP LDBL_EPSILON
20930 DECIMAL_DIG DBL_MAX_EXP FLT_MIN
20931 FLT_DIG LDBL_MAX_EXP DBL_MIN
20932 DBL_DIG FLT_MAX_10_EXP LDBL_MIN
20933 LDBL_DIG DBL_MAX_10_EXP
20934 FLT_MIN_EXP LDBL_MAX_10_EXP
20935 </pre>
20937 <h3><a name="B.7" href="#B.7">B.7 Format conversion of integer types <inttypes.h></a></h3>
20938 <!--page 435 -->
20939 <pre>
20940 imaxdiv_t
20941 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
20942 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
20943 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
20944 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
20945 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
20946 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
20947 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
20948 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
20949 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
20950 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
20951 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
20952 intmax_t imaxabs(intmax_t j);
20953 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
20954 intmax_t strtoimax(const char * restrict nptr,
20955 char ** restrict endptr, int base);
20956 uintmax_t strtoumax(const char * restrict nptr,
20957 char ** restrict endptr, int base);
20958 intmax_t wcstoimax(const wchar_t * restrict nptr,
20959 wchar_t ** restrict endptr, int base);
20960 uintmax_t wcstoumax(const wchar_t * restrict nptr,
20961 wchar_t ** restrict endptr, int base);
20962 </pre>
20964 <h3><a name="B.8" href="#B.8">B.8 Alternative spellings <iso646.h></a></h3>
20965 <pre>
20966 and bitor not_eq xor
20967 and_eq compl or xor_eq
20968 bitand not or_eq
20969 </pre>
20971 <h3><a name="B.9" href="#B.9">B.9 Sizes of integer types <limits.h></a></h3>
20972 <pre>
20973 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
20974 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
20975 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
20976 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
20977 CHAR_MIN USHRT_MAX LONG_MAX
20978 </pre>
20980 <h3><a name="B.10" href="#B.10">B.10 Localization <locale.h></a></h3>
20981 <pre>
20982 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
20983 NULL LC_COLLATE LC_MONETARY LC_TIME
20984 char *setlocale(int category, const char *locale);
20985 struct lconv *localeconv(void);
20986 </pre>
20988 <h3><a name="B.11" href="#B.11">B.11 Mathematics <math.h></a></h3>
20989 <!--page 436 -->
20990 <!--page 437 -->
20991 <!--page 438 -->
20992 <!--page 439 -->
20993 <!--page 440 -->
20994 <pre>
20995 float_t FP_INFINITE FP_FAST_FMAL
20996 double_t FP_NAN FP_ILOGB0
20997 HUGE_VAL FP_NORMAL FP_ILOGBNAN
20998 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
20999 HUGE_VALL FP_ZERO MATH_ERREXCEPT
21000 INFINITY FP_FAST_FMA math_errhandling
21001 NAN FP_FAST_FMAF
21002 #pragma STDC FP_CONTRACT on-off-switch
21003 int fpclassify(real-floating x);
21004 int isfinite(real-floating x);
21005 int isinf(real-floating x);
21006 int isnan(real-floating x);
21007 int isnormal(real-floating x);
21008 int signbit(real-floating x);
21009 double acos(double x);
21010 float acosf(float x);
21011 long double acosl(long double x);
21012 double asin(double x);
21013 float asinf(float x);
21014 long double asinl(long double x);
21015 double atan(double x);
21016 float atanf(float x);
21017 long double atanl(long double x);
21018 double atan2(double y, double x);
21019 float atan2f(float y, float x);
21020 long double atan2l(long double y, long double x);
21021 double cos(double x);
21022 float cosf(float x);
21023 long double cosl(long double x);
21024 double sin(double x);
21025 float sinf(float x);
21026 long double sinl(long double x);
21027 double tan(double x);
21028 float tanf(float x);
21029 long double tanl(long double x);
21030 double acosh(double x);
21031 float acoshf(float x);
21032 long double acoshl(long double x);
21033 double asinh(double x);
21034 float asinhf(float x);
21035 long double asinhl(long double x);
21036 double atanh(double x);
21037 float atanhf(float x);
21038 long double atanhl(long double x);
21039 double cosh(double x);
21040 float coshf(float x);
21041 long double coshl(long double x);
21042 double sinh(double x);
21043 float sinhf(float x);
21044 long double sinhl(long double x);
21045 double tanh(double x);
21046 float tanhf(float x);
21047 long double tanhl(long double x);
21048 double exp(double x);
21049 float expf(float x);
21050 long double expl(long double x);
21051 double exp2(double x);
21052 float exp2f(float x);
21053 long double exp2l(long double x);
21054 double expm1(double x);
21055 float expm1f(float x);
21056 long double expm1l(long double x);
21057 double frexp(double value, int *exp);
21058 float frexpf(float value, int *exp);
21059 long double frexpl(long double value, int *exp);
21060 int ilogb(double x);
21061 int ilogbf(float x);
21062 int ilogbl(long double x);
21063 double ldexp(double x, int exp);
21064 float ldexpf(float x, int exp);
21065 long double ldexpl(long double x, int exp);
21066 double log(double x);
21067 float logf(float x);
21068 long double logl(long double x);
21069 double log10(double x);
21070 float log10f(float x);
21071 long double log10l(long double x);
21072 double log1p(double x);
21073 float log1pf(float x);
21074 long double log1pl(long double x);
21075 double log2(double x);
21076 float log2f(float x);
21077 long double log2l(long double x);
21078 double logb(double x);
21079 float logbf(float x);
21080 long double logbl(long double x);
21081 double modf(double value, double *iptr);
21082 float modff(float value, float *iptr);
21083 long double modfl(long double value, long double *iptr);
21084 double scalbn(double x, int n);
21085 float scalbnf(float x, int n);
21086 long double scalbnl(long double x, int n);
21087 double scalbln(double x, long int n);
21088 float scalblnf(float x, long int n);
21089 long double scalblnl(long double x, long int n);
21090 double cbrt(double x);
21091 float cbrtf(float x);
21092 long double cbrtl(long double x);
21093 double fabs(double x);
21094 float fabsf(float x);
21095 long double fabsl(long double x);
21096 double hypot(double x, double y);
21097 float hypotf(float x, float y);
21098 long double hypotl(long double x, long double y);
21099 double pow(double x, double y);
21100 float powf(float x, float y);
21101 long double powl(long double x, long double y);
21102 double sqrt(double x);
21103 float sqrtf(float x);
21104 long double sqrtl(long double x);
21105 double erf(double x);
21106 float erff(float x);
21107 long double erfl(long double x);
21108 double erfc(double x);
21109 float erfcf(float x);
21110 long double erfcl(long double x);
21111 double lgamma(double x);
21112 float lgammaf(float x);
21113 long double lgammal(long double x);
21114 double tgamma(double x);
21115 float tgammaf(float x);
21116 long double tgammal(long double x);
21117 double ceil(double x);
21118 float ceilf(float x);
21119 long double ceill(long double x);
21120 double floor(double x);
21121 float floorf(float x);
21122 long double floorl(long double x);
21123 double nearbyint(double x);
21124 float nearbyintf(float x);
21125 long double nearbyintl(long double x);
21126 double rint(double x);
21127 float rintf(float x);
21128 long double rintl(long double x);
21129 long int lrint(double x);
21130 long int lrintf(float x);
21131 long int lrintl(long double x);
21132 long long int llrint(double x);
21133 long long int llrintf(float x);
21134 long long int llrintl(long double x);
21135 double round(double x);
21136 float roundf(float x);
21137 long double roundl(long double x);
21138 long int lround(double x);
21139 long int lroundf(float x);
21140 long int lroundl(long double x);
21141 long long int llround(double x);
21142 long long int llroundf(float x);
21143 long long int llroundl(long double x);
21144 double trunc(double x);
21145 float truncf(float x);
21146 long double truncl(long double x);
21147 double fmod(double x, double y);
21148 float fmodf(float x, float y);
21149 long double fmodl(long double x, long double y);
21150 double remainder(double x, double y);
21151 float remainderf(float x, float y);
21152 long double remainderl(long double x, long double y);
21153 double remquo(double x, double y, int *quo);
21154 float remquof(float x, float y, int *quo);
21155 long double remquol(long double x, long double y,
21156 int *quo);
21157 double copysign(double x, double y);
21158 float copysignf(float x, float y);
21159 long double copysignl(long double x, long double y);
21160 double nan(const char *tagp);
21161 float nanf(const char *tagp);
21162 long double nanl(const char *tagp);
21163 double nextafter(double x, double y);
21164 float nextafterf(float x, float y);
21165 long double nextafterl(long double x, long double y);
21166 double nexttoward(double x, long double y);
21167 float nexttowardf(float x, long double y);
21168 long double nexttowardl(long double x, long double y);
21169 double fdim(double x, double y);
21170 float fdimf(float x, float y);
21171 long double fdiml(long double x, long double y);
21172 double fmax(double x, double y);
21173 float fmaxf(float x, float y);
21174 long double fmaxl(long double x, long double y);
21175 double fmin(double x, double y);
21176 float fminf(float x, float y);
21177 long double fminl(long double x, long double y);
21178 double fma(double x, double y, double z);
21179 float fmaf(float x, float y, float z);
21180 long double fmal(long double x, long double y,
21181 long double z);
21182 int isgreater(real-floating x, real-floating y);
21183 int isgreaterequal(real-floating x, real-floating y);
21184 int isless(real-floating x, real-floating y);
21185 int islessequal(real-floating x, real-floating y);
21186 int islessgreater(real-floating x, real-floating y);
21187 int isunordered(real-floating x, real-floating y);
21188 </pre>
21190 <h3><a name="B.12" href="#B.12">B.12 Nonlocal jumps <setjmp.h></a></h3>
21191 <pre>
21192 jmp_buf
21193 int setjmp(jmp_buf env);
21194 void longjmp(jmp_buf env, int val);
21195 </pre>
21197 <h3><a name="B.13" href="#B.13">B.13 Signal handling <signal.h></a></h3>
21198 <pre>
21199 sig_atomic_t SIG_IGN SIGILL SIGTERM
21200 SIG_DFL SIGABRT SIGINT
21201 SIG_ERR SIGFPE SIGSEGV
21202 void (*signal(int sig, void (*func)(int)))(int);
21203 int raise(int sig);
21204 </pre>
21206 <h3><a name="B.14" href="#B.14">B.14 Variable arguments <stdarg.h></a></h3>
21207 <pre>
21208 va_list
21209 type va_arg(va_list ap, type);
21210 void va_copy(va_list dest, va_list src);
21211 void va_end(va_list ap);
21212 void va_start(va_list ap, parmN);
21213 </pre>
21215 <h3><a name="B.15" href="#B.15">B.15 Boolean type and values <stdbool.h></a></h3>
21216 <!--page 441 -->
21217 <pre>
21218 bool
21219 true
21220 false
21221 __bool_true_false_are_defined
21222 </pre>
21224 <h3><a name="B.16" href="#B.16">B.16 Common definitions <stddef.h></a></h3>
21225 <pre>
21226 ptrdiff_t size_t wchar_t NULL
21227 offsetof(type, member-designator)
21228 </pre>
21230 <h3><a name="B.17" href="#B.17">B.17 Integer types <stdint.h></a></h3>
21231 <pre>
21232 intN_t INT_LEASTN_MIN PTRDIFF_MAX
21233 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
21234 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
21235 uint_leastN_t INT_FASTN_MIN SIZE_MAX
21236 int_fastN_t INT_FASTN_MAX WCHAR_MIN
21237 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
21238 intptr_t INTPTR_MIN WINT_MIN
21239 uintptr_t INTPTR_MAX WINT_MAX
21240 intmax_t UINTPTR_MAX INTN_C(value)
21241 uintmax_t INTMAX_MIN UINTN_C(value)
21242 INTN_MIN INTMAX_MAX INTMAX_C(value)
21243 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
21244 UINTN_MAX PTRDIFF_MIN
21245 </pre>
21247 <h3><a name="B.18" href="#B.18">B.18 Input/output <stdio.h></a></h3>
21248 <!--page 442 -->
21249 <!--page 443 -->
21250 <pre>
21251 size_t _IOLBF FILENAME_MAX TMP_MAX
21252 FILE _IONBF L_tmpnam stderr
21253 fpos_t BUFSIZ SEEK_CUR stdin
21254 NULL EOF SEEK_END stdout
21255 _IOFBF FOPEN_MAX SEEK_SET
21256 int remove(const char *filename);
21257 int rename(const char *old, const char *new);
21258 FILE *tmpfile(void);
21259 char *tmpnam(char *s);
21260 int fclose(FILE *stream);
21261 int fflush(FILE *stream);
21262 FILE *fopen(const char * restrict filename,
21263 const char * restrict mode);
21264 FILE *freopen(const char * restrict filename,
21265 const char * restrict mode,
21266 FILE * restrict stream);
21267 void setbuf(FILE * restrict stream,
21268 char * restrict buf);
21269 int setvbuf(FILE * restrict stream,
21270 char * restrict buf,
21271 int mode, size_t size);
21272 int fprintf(FILE * restrict stream,
21273 const char * restrict format, ...);
21274 int fscanf(FILE * restrict stream,
21275 const char * restrict format, ...);
21276 int printf(const char * restrict format, ...);
21277 int scanf(const char * restrict format, ...);
21278 int snprintf(char * restrict s, size_t n,
21279 const char * restrict format, ...);
21280 int sprintf(char * restrict s,
21281 const char * restrict format, ...);
21282 int sscanf(const char * restrict s,
21283 const char * restrict format, ...);
21284 int vfprintf(FILE * restrict stream,
21285 const char * restrict format, va_list arg);
21286 int vfscanf(FILE * restrict stream,
21287 const char * restrict format, va_list arg);
21288 int vprintf(const char * restrict format, va_list arg);
21289 int vscanf(const char * restrict format, va_list arg);
21290 int vsnprintf(char * restrict s, size_t n,
21291 const char * restrict format, va_list arg);
21292 int vsprintf(char * restrict s,
21293 const char * restrict format, va_list arg);
21294 int vsscanf(const char * restrict s,
21295 const char * restrict format, va_list arg);
21296 int fgetc(FILE *stream);
21297 char *fgets(char * restrict s, int n,
21298 FILE * restrict stream);
21299 int fputc(int c, FILE *stream);
21300 int fputs(const char * restrict s,
21301 FILE * restrict stream);
21302 int getc(FILE *stream);
21303 int getchar(void);
21304 char *gets(char *s);
21305 int putc(int c, FILE *stream);
21306 int putchar(int c);
21307 int puts(const char *s);
21308 int ungetc(int c, FILE *stream);
21309 size_t fread(void * restrict ptr,
21310 size_t size, size_t nmemb,
21311 FILE * restrict stream);
21312 size_t fwrite(const void * restrict ptr,
21313 size_t size, size_t nmemb,
21314 FILE * restrict stream);
21315 int fgetpos(FILE * restrict stream,
21316 fpos_t * restrict pos);
21317 int fseek(FILE *stream, long int offset, int whence);
21318 int fsetpos(FILE *stream, const fpos_t *pos);
21319 long int ftell(FILE *stream);
21320 void rewind(FILE *stream);
21321 void clearerr(FILE *stream);
21322 int feof(FILE *stream);
21323 int ferror(FILE *stream);
21324 void perror(const char *s);
21325 </pre>
21327 <h3><a name="B.19" href="#B.19">B.19 General utilities <stdlib.h></a></h3>
21328 <!--page 444 -->
21329 <!--page 445 -->
21330 <pre>
21331 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
21332 wchar_t lldiv_t EXIT_SUCCESS
21333 div_t NULL RAND_MAX
21334 double atof(const char *nptr);
21335 int atoi(const char *nptr);
21336 long int atol(const char *nptr);
21337 long long int atoll(const char *nptr);
21338 double strtod(const char * restrict nptr,
21339 char ** restrict endptr);
21340 float strtof(const char * restrict nptr,
21341 char ** restrict endptr);
21342 long double strtold(const char * restrict nptr,
21343 char ** restrict endptr);
21344 long int strtol(const char * restrict nptr,
21345 char ** restrict endptr, int base);
21346 long long int strtoll(const char * restrict nptr,
21347 char ** restrict endptr, int base);
21348 unsigned long int strtoul(
21349 const char * restrict nptr,
21350 char ** restrict endptr, int base);
21351 unsigned long long int strtoull(
21352 const char * restrict nptr,
21353 char ** restrict endptr, int base);
21354 int rand(void);
21355 void srand(unsigned int seed);
21356 void *calloc(size_t nmemb, size_t size);
21357 void free(void *ptr);
21358 void *malloc(size_t size);
21359 void *realloc(void *ptr, size_t size);
21360 void abort(void);
21361 int atexit(void (*func)(void));
21362 void exit(int status);
21363 void _Exit(int status);
21364 char *getenv(const char *name);
21365 int system(const char *string);
21366 void *bsearch(const void *key, const void *base,
21367 size_t nmemb, size_t size,
21368 int (*compar)(const void *, const void *));
21369 void qsort(void *base, size_t nmemb, size_t size,
21370 int (*compar)(const void *, const void *));
21371 int abs(int j);
21372 long int labs(long int j);
21373 long long int llabs(long long int j);
21374 div_t div(int numer, int denom);
21375 ldiv_t ldiv(long int numer, long int denom);
21376 lldiv_t lldiv(long long int numer,
21377 long long int denom);
21378 int mblen(const char *s, size_t n);
21379 int mbtowc(wchar_t * restrict pwc,
21380 const char * restrict s, size_t n);
21381 int wctomb(char *s, wchar_t wchar);
21382 size_t mbstowcs(wchar_t * restrict pwcs,
21383 const char * restrict s, size_t n);
21384 size_t wcstombs(char * restrict s,
21385 const wchar_t * restrict pwcs, size_t n);
21386 </pre>
21388 <h3><a name="B.20" href="#B.20">B.20 String handling <string.h></a></h3>
21389 <!--page 446 -->
21390 <pre>
21391 size_t
21392 NULL
21393 void *memcpy(void * restrict s1,
21394 const void * restrict s2, size_t n);
21395 void *memmove(void *s1, const void *s2, size_t n);
21396 char *strcpy(char * restrict s1,
21397 const char * restrict s2);
21398 char *strncpy(char * restrict s1,
21399 const char * restrict s2, size_t n);
21400 char *strcat(char * restrict s1,
21401 const char * restrict s2);
21402 char *strncat(char * restrict s1,
21403 const char * restrict s2, size_t n);
21404 int memcmp(const void *s1, const void *s2, size_t n);
21405 int strcmp(const char *s1, const char *s2);
21406 int strcoll(const char *s1, const char *s2);
21407 int strncmp(const char *s1, const char *s2, size_t n);
21408 size_t strxfrm(char * restrict s1,
21409 const char * restrict s2, size_t n);
21410 void *memchr(const void *s, int c, size_t n);
21411 char *strchr(const char *s, int c);
21412 size_t strcspn(const char *s1, const char *s2);
21413 char *strpbrk(const char *s1, const char *s2);
21414 char *strrchr(const char *s, int c);
21415 size_t strspn(const char *s1, const char *s2);
21416 char *strstr(const char *s1, const char *s2);
21417 char *strtok(char * restrict s1,
21418 const char * restrict s2);
21419 void *memset(void *s, int c, size_t n);
21420 char *strerror(int errnum);
21421 size_t strlen(const char *s);
21422 </pre>
21424 <h3><a name="B.21" href="#B.21">B.21 Type-generic math <tgmath.h></a></h3>
21425 <pre>
21426 acos sqrt fmod nextafter
21427 asin fabs frexp nexttoward
21428 atan atan2 hypot remainder
21429 acosh cbrt ilogb remquo
21430 asinh ceil ldexp rint
21431 atanh copysign lgamma round
21432 cos erf llrint scalbn
21433 sin erfc llround scalbln
21434 tan exp2 log10 tgamma
21435 cosh expm1 log1p trunc
21436 sinh fdim log2 carg
21437 tanh floor logb cimag
21438 exp fma lrint conj
21439 log fmax lround cproj
21440 pow fmin nearbyint creal
21441 </pre>
21443 <h3><a name="B.22" href="#B.22">B.22 Date and time <time.h></a></h3>
21444 <!--page 447 -->
21445 <pre>
21446 NULL size_t time_t
21447 CLOCKS_PER_SEC clock_t struct tm
21448 clock_t clock(void);
21449 double difftime(time_t time1, time_t time0);
21450 time_t mktime(struct tm *timeptr);
21451 time_t time(time_t *timer);
21452 char *asctime(const struct tm *timeptr);
21453 char *ctime(const time_t *timer);
21454 struct tm *gmtime(const time_t *timer);
21455 struct tm *localtime(const time_t *timer);
21456 size_t strftime(char * restrict s,
21457 size_t maxsize,
21458 const char * restrict format,
21459 const struct tm * restrict timeptr);
21460 </pre>
21462 <h3><a name="B.23" href="#B.23">B.23 Extended multibyte/wide character utilities <wchar.h></a></h3>
21463 <!--page 448 -->
21464 <!--page 449 -->
21465 <pre>
21466 wchar_t wint_t WCHAR_MAX
21467 size_t struct tm WCHAR_MIN
21468 mbstate_t NULL WEOF
21469 int fwprintf(FILE * restrict stream,
21470 const wchar_t * restrict format, ...);
21471 int fwscanf(FILE * restrict stream,
21472 const wchar_t * restrict format, ...);
21473 int swprintf(wchar_t * restrict s, size_t n,
21474 const wchar_t * restrict format, ...);
21475 int swscanf(const wchar_t * restrict s,
21476 const wchar_t * restrict format, ...);
21477 int vfwprintf(FILE * restrict stream,
21478 const wchar_t * restrict format, va_list arg);
21479 int vfwscanf(FILE * restrict stream,
21480 const wchar_t * restrict format, va_list arg);
21481 int vswprintf(wchar_t * restrict s, size_t n,
21482 const wchar_t * restrict format, va_list arg);
21483 int vswscanf(const wchar_t * restrict s,
21484 const wchar_t * restrict format, va_list arg);
21485 int vwprintf(const wchar_t * restrict format,
21486 va_list arg);
21487 int vwscanf(const wchar_t * restrict format,
21488 va_list arg);
21489 int wprintf(const wchar_t * restrict format, ...);
21490 int wscanf(const wchar_t * restrict format, ...);
21491 wint_t fgetwc(FILE *stream);
21492 wchar_t *fgetws(wchar_t * restrict s, int n,
21493 FILE * restrict stream);
21494 wint_t fputwc(wchar_t c, FILE *stream);
21495 int fputws(const wchar_t * restrict s,
21496 FILE * restrict stream);
21497 int fwide(FILE *stream, int mode);
21498 wint_t getwc(FILE *stream);
21499 wint_t getwchar(void);
21500 wint_t putwc(wchar_t c, FILE *stream);
21501 wint_t putwchar(wchar_t c);
21502 wint_t ungetwc(wint_t c, FILE *stream);
21503 double wcstod(const wchar_t * restrict nptr,
21504 wchar_t ** restrict endptr);
21505 float wcstof(const wchar_t * restrict nptr,
21506 wchar_t ** restrict endptr);
21507 long double wcstold(const wchar_t * restrict nptr,
21508 wchar_t ** restrict endptr);
21509 long int wcstol(const wchar_t * restrict nptr,
21510 wchar_t ** restrict endptr, int base);
21511 long long int wcstoll(const wchar_t * restrict nptr,
21512 wchar_t ** restrict endptr, int base);
21513 unsigned long int wcstoul(const wchar_t * restrict nptr,
21514 wchar_t ** restrict endptr, int base);
21515 unsigned long long int wcstoull(
21516 const wchar_t * restrict nptr,
21517 wchar_t ** restrict endptr, int base);
21518 wchar_t *wcscpy(wchar_t * restrict s1,
21519 const wchar_t * restrict s2);
21520 wchar_t *wcsncpy(wchar_t * restrict s1,
21521 const wchar_t * restrict s2, size_t n);
21522 wchar_t *wmemcpy(wchar_t * restrict s1,
21523 const wchar_t * restrict s2, size_t n);
21524 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
21525 size_t n);
21526 wchar_t *wcscat(wchar_t * restrict s1,
21527 const wchar_t * restrict s2);
21528 wchar_t *wcsncat(wchar_t * restrict s1,
21529 const wchar_t * restrict s2, size_t n);
21530 int wcscmp(const wchar_t *s1, const wchar_t *s2);
21531 int wcscoll(const wchar_t *s1, const wchar_t *s2);
21532 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
21533 size_t n);
21534 size_t wcsxfrm(wchar_t * restrict s1,
21535 const wchar_t * restrict s2, size_t n);
21536 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
21537 size_t n);
21538 wchar_t *wcschr(const wchar_t *s, wchar_t c);
21539 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
21540 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2); *
21541 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
21542 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
21543 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
21544 wchar_t *wcstok(wchar_t * restrict s1,
21545 const wchar_t * restrict s2,
21546 wchar_t ** restrict ptr);
21547 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
21548 size_t wcslen(const wchar_t *s);
21549 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
21550 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
21551 const wchar_t * restrict format,
21552 const struct tm * restrict timeptr);
21553 wint_t btowc(int c);
21554 int wctob(wint_t c);
21555 int mbsinit(const mbstate_t *ps);
21556 size_t mbrlen(const char * restrict s, size_t n,
21557 mbstate_t * restrict ps);
21558 size_t mbrtowc(wchar_t * restrict pwc,
21559 const char * restrict s, size_t n,
21560 mbstate_t * restrict ps);
21561 size_t wcrtomb(char * restrict s, wchar_t wc,
21562 mbstate_t * restrict ps);
21563 size_t mbsrtowcs(wchar_t * restrict dst,
21564 const char ** restrict src, size_t len,
21565 mbstate_t * restrict ps);
21566 size_t wcsrtombs(char * restrict dst,
21567 const wchar_t ** restrict src, size_t len,
21568 mbstate_t * restrict ps);
21569 </pre>
21571 <h3><a name="B.24" href="#B.24">B.24 Wide character classification and mapping utilities <wctype.h></a></h3>
21572 <!--page 450 -->
21573 <!--page 451 -->
21574 <pre>
21575 wint_t wctrans_t wctype_t WEOF
21576 int iswalnum(wint_t wc);
21577 int iswalpha(wint_t wc);
21578 int iswblank(wint_t wc);
21579 int iswcntrl(wint_t wc);
21580 int iswdigit(wint_t wc);
21581 int iswgraph(wint_t wc);
21582 int iswlower(wint_t wc);
21583 int iswprint(wint_t wc);
21584 int iswpunct(wint_t wc);
21585 int iswspace(wint_t wc);
21586 int iswupper(wint_t wc);
21587 int iswxdigit(wint_t wc);
21588 int iswctype(wint_t wc, wctype_t desc);
21589 wctype_t wctype(const char *property);
21590 wint_t towlower(wint_t wc);
21591 wint_t towupper(wint_t wc);
21592 wint_t towctrans(wint_t wc, wctrans_t desc);
21593 wctrans_t wctrans(const char *property);
21594 </pre>
21596 <h2><a name="C" href="#C">Annex C</a></h2>
21597 <p><!--para 1 -->
21598 <pre>
21599 (informative)
21600 Sequence points
21601 </pre>
21602 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
21603 <ul>
21604 <li> The call to a function, after the arguments have been evaluated (<a href="#6.5.2.2">6.5.2.2</a>).
21605 <li> The end of the first operand of the following operators: logical AND &amp;&amp; (<a href="#6.5.13">6.5.13</a>);
21606 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>).
21607 <li> The end of a full declarator: declarators (<a href="#6.7.5">6.7.5</a>);
21608 <li> The end of a full expression: an initializer (<a href="#6.7.8">6.7.8</a>); the expression in an expression
21609 statement (<a href="#6.8.3">6.8.3</a>); the controlling expression of a selection statement (if or switch)
21610 (<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
21611 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the expression in a return statement
21612 (<a href="#6.8.6.4">6.8.6.4</a>).
21613 <li> Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
21614 <li> After the actions associated with each formatted input/output function conversion
21615 specifier (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
21616 <li> Immediately before and immediately after each call to a comparison function, and
21617 also between any call to a comparison function and any movement of the objects
21618 passed as arguments to that call (<a href="#7.20.5">7.20.5</a>).
21619 <!--page 452 -->
21620 </ul>
21622 <h2><a name="D" href="#D">Annex D</a></h2>
21623 <p><!--para 1 -->
21624 <pre>
21625 (normative)
21626 Universal character names for identifiers
21627 </pre>
21628 This clause lists the hexadecimal code values that are valid in universal character names
21629 in identifiers.
21630 <p><!--para 2 -->
21631 This table is reproduced unchanged from ISO/IEC TR 10176:1998, produced by ISO/IEC
21632 JTC 1/SC 22/WG 20, except for the omission of ranges that are part of the basic character
21633 sets.
21634 Latin: 00AA, 00BA, 00C0-00D6, 00D8-00F6, 00F8-01F5, 01FA-0217,
21635 <pre>
21636 0250-02A8, 1E00-1E9B, 1EA0-1EF9, 207F
21637 </pre>
21638 Greek: 0386, 0388-038A, 038C, 038E-03A1, 03A3-03CE, 03D0-03D6,
21639 <pre>
21640 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 1F00-1F15, 1F18-1F1D,
21641 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D,
21642 1F5F-1F7D, 1F80-1FB4, 1FB6-1FBC, 1FC2-1FC4, 1FC6-1FCC,
21643 1FD0-1FD3, 1FD6-1FDB, 1FE0-1FEC, 1FF2-1FF4, 1FF6-1FFC
21644 </pre>
21645 Cyrillic: 0401-040C, 040E-044F, 0451-045C, 045E-0481, 0490-04C4,
21646 <pre>
21647 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9
21648 </pre>
21649 Armenian: 0531-0556, 0561-0587
21650 Hebrew: 05B0-05B9, 05BB-05BD, 05BF, 05C1-05C2, 05D0-05EA,
21651 <pre>
21652 05F0-05F2
21653 </pre>
21654 Arabic: 0621-063A, 0640-0652, 0670-06B7, 06BA-06BE, 06C0-06CE,
21655 <pre>
21656 06D0-06DC, 06E5-06E8, 06EA-06ED
21657 </pre>
21658 Devanagari: 0901-0903, 0905-0939, 093E-094D, 0950-0952, 0958-0963
21659 Bengali: 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0,
21660 <pre>
21661 09B2, 09B6-09B9, 09BE-09C4, 09C7-09C8, 09CB-09CD,
21662 09DC-09DD, 09DF-09E3, 09F0-09F1
21663 </pre>
21664 Gurmukhi: 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30,
21665 <pre>
21666 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3E-0A42, 0A47-0A48,
21667 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A74
21668 </pre>
21669 Gujarati: 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F-0A91, 0A93-0AA8,
21670 <pre>
21671 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABD-0AC5,
21672 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0
21673 </pre>
21674 Oriya: 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30,
21675 <!--page 453 -->
21676 <pre>
21677 0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D,
21678 0B5C-0B5D, 0B5F-0B61
21679 </pre>
21680 Tamil: 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A,
21681 <pre>
21682 0B9C, 0B9E-0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5,
21683 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD
21684 </pre>
21685 Telugu: 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33,
21686 <pre>
21687 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C60-0C61
21688 </pre>
21689 Kannada: 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3,
21690 <pre>
21691 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CDE,
21692 0CE0-0CE1
21693 </pre>
21694 Malayalam: 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39,
21695 <pre>
21696 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D60-0D61
21697 </pre>
21698 Thai: 0E01-0E3A, 0E40-0E5B
21699 Lao: 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97,
21700 <pre>
21701 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB,
21702 0EAD-0EAE, 0EB0-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6,
21703 0EC8-0ECD, 0EDC-0EDD
21704 </pre>
21705 Tibetan: 0F00, 0F18-0F19, 0F35, 0F37, 0F39, 0F3E-0F47, 0F49-0F69,
21706 <pre>
21707 0F71-0F84, 0F86-0F8B, 0F90-0F95, 0F97, 0F99-0FAD,
21708 0FB1-0FB7, 0FB9
21709 </pre>
21710 Georgian: 10A0-10C5, 10D0-10F6
21711 Hiragana: 3041-3093, 309B-309C
21712 Katakana: 30A1-30F6, 30FB-30FC
21713 Bopomofo: 3105-312C
21714 CJK Unified Ideographs: 4E00-9FA5
21715 Hangul: AC00-D7A3
21716 Digits: 0660-0669, 06F0-06F9, 0966-096F, 09E6-09EF, 0A66-0A6F,
21717 <pre>
21718 0AE6-0AEF, 0B66-0B6F, 0BE7-0BEF, 0C66-0C6F, 0CE6-0CEF,
21719 0D66-0D6F, 0E50-0E59, 0ED0-0ED9, 0F20-0F33
21720 </pre>
21721 Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1,
21722 <!--page 454 -->
21723 <pre>
21724 02E0-02E4, 037A, 0559, 093D, 0B3D, 1FBE, 203F-2040, 2102,
21725 2107, 210A-2113, 2115, 2118-211D, 2124, 2126, 2128, 212A-2131,
21726 2133-2138, 2160-2182, 3005-3007, 3021-3029
21727 </pre>
21729 <h2><a name="E" href="#E">Annex E</a></h2>
21730 <p><!--para 1 -->
21731 <pre>
21732 (informative)
21733 <h6> Implementation limits</h6>
21734 </pre>
21735 The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
21736 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
21737 with the same sign. The values shall all be constant expressions suitable for use in #if
21738 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
21739 <p><!--para 2 -->
21740 <pre>
21741 #define CHAR_BIT 8
21742 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
21743 #define CHAR_MIN 0 or SCHAR_MIN
21744 #define INT_MAX +32767
21745 #define INT_MIN -32767
21746 #define LONG_MAX +2147483647
21747 #define LONG_MIN -2147483647
21748 #define LLONG_MAX +9223372036854775807
21749 #define LLONG_MIN -9223372036854775807
21750 #define MB_LEN_MAX 1
21751 #define SCHAR_MAX +127
21752 #define SCHAR_MIN -127
21753 #define SHRT_MAX +32767
21754 #define SHRT_MIN -32767
21755 #define UCHAR_MAX 255
21756 #define USHRT_MAX 65535
21757 #define UINT_MAX 65535
21758 #define ULONG_MAX 4294967295
21759 #define ULLONG_MAX 18446744073709551615
21760 </pre>
21761 The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
21762 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
21763 directives; all floating values shall be constant expressions. The components are
21764 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
21765 <p><!--para 3 -->
21766 The values given in the following list shall be replaced by implementation-defined
21767 expressions:
21768 <p><!--para 4 -->
21769 <pre>
21770 #define FLT_EVAL_METHOD
21771 #define FLT_ROUNDS
21772 </pre>
21773 The values given in the following list shall be replaced by implementation-defined
21774 constant expressions that are greater or equal in magnitude (absolute value) to those
21775 shown, with the same sign:
21776 <!--page 455 -->
21777 <p><!--para 5 -->
21778 <pre>
21779 #define DBL_DIG 10
21780 #define DBL_MANT_DIG
21781 #define DBL_MAX_10_EXP +37
21782 #define DBL_MAX_EXP
21783 #define DBL_MIN_10_EXP -37
21784 #define DBL_MIN_EXP
21785 #define DECIMAL_DIG 10
21786 #define FLT_DIG 6
21787 #define FLT_MANT_DIG
21788 #define FLT_MAX_10_EXP +37
21789 #define FLT_MAX_EXP
21790 #define FLT_MIN_10_EXP -37
21791 #define FLT_MIN_EXP
21792 #define FLT_RADIX 2
21793 #define LDBL_DIG 10
21794 #define LDBL_MANT_DIG
21795 #define LDBL_MAX_10_EXP +37
21796 #define LDBL_MAX_EXP
21797 #define LDBL_MIN_10_EXP -37
21798 #define LDBL_MIN_EXP
21799 </pre>
21800 The values given in the following list shall be replaced by implementation-defined
21801 constant expressions with values that are greater than or equal to those shown:
21802 <p><!--para 6 -->
21803 <pre>
21804 #define DBL_MAX 1E+37
21805 #define FLT_MAX 1E+37
21806 #define LDBL_MAX 1E+37
21807 </pre>
21808 The values given in the following list shall be replaced by implementation-defined
21809 constant expressions with (positive) values that are less than or equal to those shown:
21810 <!--page 456 -->
21811 <pre>
21812 #define DBL_EPSILON 1E-9
21813 #define DBL_MIN 1E-37
21814 #define FLT_EPSILON 1E-5
21815 #define FLT_MIN 1E-37
21816 #define LDBL_EPSILON 1E-9
21817 #define LDBL_MIN 1E-37
21818 </pre>
21820 <h2><a name="F" href="#F">Annex F</a></h2>
21821 <pre>
21822 (normative)
21823 IEC 60559 floating-point arithmetic
21824 </pre>
21826 <h3><a name="F.1" href="#F.1">F.1 Introduction</a></h3>
21827 <p><!--para 1 -->
21828 This annex specifies C language support for the IEC 60559 floating-point standard. The
21829 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
21830 microprocessor systems, second edition (IEC 60559:1989), previously designated
21831 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
21832 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
21833 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
21834 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
21835 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
21836 defines __STDC_IEC_559__ shall conform to the specifications in this annex. Where
21837 a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified
21838 behavior is adopted by reference, unless stated otherwise.
21840 <h3><a name="F.2" href="#F.2">F.2 Types</a></h3>
21841 <p><!--para 1 -->
21842 The C floating types match the IEC 60559 formats as follows:
21843 <ul>
21844 <li> The float type matches the IEC 60559 single format.
21845 <li> The double type matches the IEC 60559 double format.
21846 <li> The long double type matches an IEC 60559 extended format,<sup><a href="#note307"><b>307)</b></a></sup> else a
21847 non-IEC 60559 extended format, else the IEC 60559 double format.
21848 </ul>
21849 Any non-IEC 60559 extended format used for the long double type shall have more
21850 precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note308"><b>308)</b></a></sup>
21851 <h6>Recommended practice</h6>
21852 <p><!--para 2 -->
21853 The long double type should match an IEC 60559 extended format.
21858 <!--page 457 -->
21860 <h6>footnotes</h6>
21861 <p><small><a name="note307" href="#note307">307)</a> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
21862 and quadruple 128-bit IEC 60559 formats.
21863 </small>
21864 <p><small><a name="note308" href="#note308">308)</a> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
21865 all double values.
21866 </small>
21868 <h4><a name="F.2.1" href="#F.2.1">F.2.1 Infinities, signed zeros, and NaNs</a></h4>
21869 <p><!--para 1 -->
21870 This specification does not define the behavior of signaling NaNs.<sup><a href="#note309"><b>309)</b></a></sup> It generally uses
21871 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
21872 functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
21874 <h6>footnotes</h6>
21875 <p><small><a name="note309" href="#note309">309)</a> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
21876 sufficient for closure of the arithmetic.
21877 </small>
21879 <h3><a name="F.3" href="#F.3">F.3 Operators and functions</a></h3>
21880 <p><!--para 1 -->
21881 C operators and functions provide IEC 60559 required and recommended facilities as
21882 listed below.
21883 <ul>
21884 <li> The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
21885 divide operations.
21886 <li> The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
21887 <li> The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
21888 operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
21889 with additional information.
21890 <li> The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
21891 floating-point number to an integer value (in the same precision). The nearbyint
21892 functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
21893 Appendix to ANSI/IEEE 854.
21894 <li> The conversions for floating types provide the IEC 60559 conversions between
21895 floating-point precisions.
21896 <li> The conversions from integer to floating types provide the IEC 60559 conversions
21897 from integer to floating point.
21898 <li> The conversions from floating to integer types provide IEC 60559-like conversions
21899 but always round toward zero.
21900 <li> The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
21901 conversions, which honor the directed rounding mode, from floating point to the
21902 long int and long long int integer formats. The lrint and llrint
21903 functions can be used to implement IEC 60559 conversions from floating to other
21904 integer formats.
21905 <li> The translation time conversion of floating constants and the strtod, strtof,
21906 strtold, fprintf, fscanf, and related library functions in <a href="#7.20">&lt;stdlib.h&gt;</a>,
21907 <a href="#7.19">&lt;stdio.h&gt;</a>, and <a href="#7.24">&lt;wchar.h&gt;</a> provide IEC 60559 binary-decimal conversions. The
21908 strtold function in <a href="#7.20">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
21909 Appendix to ANSI/IEEE 854.
21911 <!--page 458 -->
21912 <li> The relational and equality operators provide IEC 60559 comparisons. IEC 60559
21913 identifies a need for additional comparison predicates to facilitate writing code that
21914 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
21915 isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
21916 supplement the language operators to address this need. The islessgreater and
21917 isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
21918 the unordered predicate recommended in the Appendix to IEC 60559.
21919 <li> The feclearexcept, feraiseexcept, and fetestexcept functions in
21920 <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
21921 exception status flags. The fegetexceptflag and fesetexceptflag
21922 functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
21923 one time. These functions are used in conjunction with the type fexcept_t and the
21924 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
21925 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
21926 <li> The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
21927 to select among the IEC 60559 directed rounding modes represented by the rounding
21928 direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
21929 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
21930 IEC 60559 directed rounding modes.
21931 <li> The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
21932 <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
21933 the IEC 60559 status flags and control modes.
21934 <li> The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
21935 recommended in the Appendix to IEC 60559.
21936 <li> The unary minus (-) operator provides the minus (-) operation recommended in the
21937 Appendix to IEC 60559.
21938 <li> The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
21939 recommended in the Appendix to IEC 60559.
21940 <li> The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
21941 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
21942 <li> The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
21943 function recommended in the Appendix to IEC 60559 (but with a minor change to
21944 better handle signed zeros).
21945 <li> The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
21946 the Appendix to IEC 60559.
21947 <li> The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
21948 Appendix to IEC 60559.
21949 <!--page 459 -->
21950 <li> The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
21951 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
21952 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
21953 function recommended in the Appendix to IEC 60559 (except that the classification
21954 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
21955 </ul>
21957 <h3><a name="F.4" href="#F.4">F.4 Floating to integer conversion</a></h3>
21958 <p><!--para 1 -->
21959 If the floating value is infinite or NaN or if the integral part of the floating value exceeds
21960 the range of the integer type, then the ''invalid'' floating-point exception is raised and the
21961 resulting value is unspecified. Whether conversion of non-integer floating values whose
21962 integral part is within the range of the integer type raises the ''inexact'' floating-point
21963 exception is unspecified.<sup><a href="#note310"><b>310)</b></a></sup>
21965 <h6>footnotes</h6>
21966 <p><small><a name="note310" href="#note310">310)</a> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
21967 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
21968 cases where it matters, library functions can be used to effect such conversions with or without raising
21969 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
21970 <a href="#7.12">&lt;math.h&gt;</a>.
21971 </small>
21973 <h3><a name="F.5" href="#F.5">F.5 Binary-decimal conversion</a></h3>
21974 <p><!--para 1 -->
21975 Conversion from the widest supported IEC 60559 format to decimal with
21976 DECIMAL_DIG digits and back is the identity function.<sup><a href="#note311"><b>311)</b></a></sup>
21977 <p><!--para 2 -->
21978 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
21979 particular, conversion between any supported IEC 60559 format and decimal with
21980 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
21981 rounding mode), which assures that conversion from the widest supported IEC 60559
21982 format to decimal with DECIMAL_DIG digits and back is the identity function.
21983 <p><!--para 3 -->
21984 Functions such as strtod that convert character sequences to floating types honor the
21985 rounding direction. Hence, if the rounding direction might be upward or downward, the
21986 implementation cannot convert a minus-signed sequence by negating the converted
21987 unsigned sequence.
21992 <!--page 460 -->
21994 <h6>footnotes</h6>
21995 <p><small><a name="note311" href="#note311">311)</a> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
21996 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
21997 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
21998 DBL_DIG are 18 and 15, respectively, for these formats.)
21999 </small>
22001 <h3><a name="F.6" href="#F.6">F.6 Contracted expressions</a></h3>
22002 <p><!--para 1 -->
22003 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
22004 rounding directions in a manner consistent with the basic arithmetic operations covered
22005 by IEC 60559.
22006 <h6>Recommended practice</h6>
22007 <p><!--para 2 -->
22008 A contracted expression should raise floating-point exceptions in a manner generally
22009 consistent with the basic arithmetic operations. A contracted expression should deliver
22010 the same value as its uncontracted counterpart, else should be correctly rounded (once).
22012 <h3><a name="F.7" href="#F.7">F.7 Floating-point environment</a></h3>
22013 <p><!--para 1 -->
22014 The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
22015 point exception status flags and directed-rounding control modes. It includes also
22016 IEC 60559 dynamic rounding precision and trap enablement modes, if the
22017 implementation supports them.<sup><a href="#note312"><b>312)</b></a></sup>
22019 <h6>footnotes</h6>
22020 <p><small><a name="note312" href="#note312">312)</a> This specification does not require dynamic rounding precision nor trap enablement modes.
22021 </small>
22023 <h4><a name="F.7.1" href="#F.7.1">F.7.1 Environment management</a></h4>
22024 <p><!--para 1 -->
22025 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
22026 status flags, and that rounding control modes can be set explicitly to affect result values of
22027 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
22028 <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
22029 which respect sequence points.<sup><a href="#note313"><b>313)</b></a></sup>
22031 <h6>footnotes</h6>
22032 <p><small><a name="note313" href="#note313">313)</a> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
22033 point control modes will be the default ones and the floating-point status flags will not be tested,
22034 which allows certain optimizations (see <a href="#F.8">F.8</a>).
22035 </small>
22037 <h4><a name="F.7.2" href="#F.7.2">F.7.2 Translation</a></h4>
22038 <p><!--para 1 -->
22039 During translation the IEC 60559 default modes are in effect:
22040 <ul>
22041 <li> The rounding direction mode is rounding to nearest.
22042 <li> The rounding precision mode (if supported) is set so that results are not shortened.
22043 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
22044 </ul>
22045 <h6>Recommended practice</h6>
22046 <p><!--para 2 -->
22047 The implementation should produce a diagnostic message for each translation-time
22052 <!--page 461 -->
22053 floating-point exception, other than ''inexact'';<sup><a href="#note314"><b>314)</b></a></sup> the implementation should then
22054 proceed with the translation of the program.
22056 <h6>footnotes</h6>
22057 <p><small><a name="note314" href="#note314">314)</a> As floating constants are converted to appropriate internal representations at translation time, their
22058 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
22059 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
22060 strtod, provide execution-time conversion of numeric strings.
22061 </small>
22063 <h4><a name="F.7.3" href="#F.7.3">F.7.3 Execution</a></h4>
22064 <p><!--para 1 -->
22065 At program startup the floating-point environment is initialized as prescribed by
22066 IEC 60559:
22067 <ul>
22068 <li> All floating-point exception status flags are cleared.
22069 <li> The rounding direction mode is rounding to nearest.
22070 <li> The dynamic rounding precision mode (if supported) is set so that results are not
22071 shortened.
22072 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
22073 </ul>
22075 <h4><a name="F.7.4" href="#F.7.4">F.7.4 Constant expressions</a></h4>
22076 <p><!--para 1 -->
22077 An arithmetic constant expression of floating type, other than one in an initializer for an
22078 object that has static storage duration, is evaluated (as if) during execution; thus, it is
22079 affected by any operative floating-point control modes and raises floating-point
22080 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
22081 is ''on'').<sup><a href="#note315"><b>315)</b></a></sup>
22082 <p><!--para 2 -->
22083 EXAMPLE
22084 <p><!--para 3 -->
22085 <pre>
22086 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22087 #pragma STDC FENV_ACCESS ON
22088 void f(void)
22090 float w[] = { 0.0/0.0 }; // raises an exception
22091 static float x = 0.0/0.0; // does not raise an exception
22092 float y = 0.0/0.0; // raises an exception
22093 double z = 0.0/0.0; // raises an exception
22094 /* ... */
22096 </pre>
22097 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
22098 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
22101 <!--page 462 -->
22102 execution time.
22105 <h6>footnotes</h6>
22106 <p><small><a name="note315" href="#note315">315)</a> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
22107 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
22108 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
22109 efficiency of translation-time evaluation through static initialization, such as
22111 <pre>
22112 const static double one_third = 1.0/3.0;
22113 </pre>
22114 </small>
22116 <h4><a name="F.7.5" href="#F.7.5">F.7.5 Initialization</a></h4>
22117 <p><!--para 1 -->
22118 All computation for automatic initialization is done (as if) at execution time; thus, it is
22119 affected by any operative modes and raises floating-point exceptions as required by
22120 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
22121 for initialization of objects that have static storage duration is done (as if) at translation
22122 time.
22123 <p><!--para 2 -->
22124 EXAMPLE
22125 <p><!--para 3 -->
22126 <pre>
22127 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22128 #pragma STDC FENV_ACCESS ON
22129 void f(void)
22131 float u[] = { 1.1e75 }; // raises exceptions
22132 static float v = 1.1e75; // does not raise exceptions
22133 float w = 1.1e75; // raises exceptions
22134 double x = 1.1e75; // may raise exceptions
22135 float y = 1.1e75f; // may raise exceptions
22136 long double z = 1.1e75; // does not raise exceptions
22137 /* ... */
22139 </pre>
22140 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
22141 done at translation time. The automatic initialization of u and w require an execution-time conversion to
22142 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
22143 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
22144 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
22145 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
22146 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
22147 their internal representations occur at translation time in all cases.
22152 <!--page 463 -->
22154 <h6>footnotes</h6>
22155 <p><small><a name="note316" href="#note316">316)</a> Use of float_t and double_t variables increases the likelihood of translation-time computation.
22156 For example, the automatic initialization
22158 <pre>
22159 double_t x = 1.1e75;
22160 </pre>
22161 could be done at translation time, regardless of the expression evaluation method.
22162 </small>
22164 <h4><a name="F.7.6" href="#F.7.6">F.7.6 Changing the environment</a></h4>
22165 <p><!--para 1 -->
22166 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
22167 change floating-point status flags and control modes just as indicated by their
22168 specifications (including conformance to IEC 60559). They do not change flags or modes
22169 (so as to be detectable by the user) in any other cases.
22170 <p><!--para 2 -->
22171 If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
22172 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
22173 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
22174 before ''inexact''.
22176 <h3><a name="F.8" href="#F.8">F.8 Optimization</a></h3>
22177 <p><!--para 1 -->
22178 This section identifies code transformations that might subvert IEC 60559-specified
22179 behavior, and others that do not.
22181 <h4><a name="F.8.1" href="#F.8.1">F.8.1 Global transformations</a></h4>
22182 <p><!--para 1 -->
22183 Floating-point arithmetic operations and external function calls may entail side effects
22184 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
22185 ''on''. The flags and modes in the floating-point environment may be regarded as global
22186 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
22187 flags.
22188 <p><!--para 2 -->
22189 Concern about side effects may inhibit code motion and removal of seemingly useless
22190 code. For example, in
22191 <pre>
22192 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22193 #pragma STDC FENV_ACCESS ON
22194 void f(double x)
22196 /* ... */
22197 for (i = 0; i &lt; n; i++) x + 1;
22198 /* ... */
22200 </pre>
22201 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
22202 body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
22203 course these optimizations are valid if the implementation can rule out the nettlesome
22204 cases.)
22205 <p><!--para 3 -->
22206 This specification does not require support for trap handlers that maintain information
22207 about the order or count of floating-point exceptions. Therefore, between function calls,
22208 floating-point exceptions need not be precise: the actual order and number of occurrences
22209 of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
22210 the preceding loop could be treated as
22211 <!--page 464 -->
22212 <pre>
22213 if (0 &lt; n) x + 1;
22214 </pre>
22216 <h4><a name="F.8.2" href="#F.8.2">F.8.2 Expression transformations</a></h4>
22217 <p><!--para 1 -->
22218 x / 2 &lt;-&gt; x * 0.5 Although similar transformations involving inexact
22219 <pre>
22220 constants generally do not yield numerically equivalent
22221 expressions, if the constants are exact then such
22222 transformations can be made on IEC 60559 machines
22223 and others that round perfectly.
22224 </pre>
22225 1 * x and x / 1 -&gt; x The expressions 1 * x, x / 1, and x are equivalent
22226 <pre>
22227 (on IEC 60559 machines, among others).<sup><a href="#note317"><b>317)</b></a></sup>
22228 </pre>
22229 x / x -&gt; 1.0 The expressions x / x and 1.0 are not equivalent if x
22230 <pre>
22231 can be zero, infinite, or NaN.
22232 </pre>
22233 x - y &lt;-&gt; x + (-y) The expressions x - y, x + (-y), and (-y) + x
22234 <pre>
22235 are equivalent (on IEC 60559 machines, among others).
22236 </pre>
22237 x - y &lt;-&gt; -(y - x) The expressions x - y and -(y - x) are not
22238 <pre>
22239 equivalent because 1 - 1 is +0 but -(1 - 1) is -0 (in the
22240 default rounding direction).<sup><a href="#note318"><b>318)</b></a></sup>
22241 </pre>
22242 x - x -&gt; 0.0 The expressions x - x and 0.0 are not equivalent if
22243 <pre>
22244 x is a NaN or infinite.
22245 </pre>
22246 0 * x -&gt; 0.0 The expressions 0 * x and 0.0 are not equivalent if
22247 <pre>
22248 x is a NaN, infinite, or -0.
22249 </pre>
22250 x + 0-&gt;x The expressions x + 0 and x are not equivalent if x is
22251 <pre>
22252 -0, because (-0) + (+0) yields +0 (in the default
22253 rounding direction), not -0.
22254 </pre>
22255 x - 0-&gt;x (+0) - (+0) yields -0 when rounding is downward
22256 <pre>
22257 (toward -(inf)), but +0 otherwise, and (-0) - (+0) always
22258 yields -0; so, if the state of the FENV_ACCESS pragma
22259 is ''off'', promising default rounding, then the
22260 implementation can replace x - 0 by x, even if x
22261 </pre>
22264 <!--page 465 -->
22265 <pre>
22266 might be zero.
22267 </pre>
22268 -x &lt;-&gt; 0 - x The expressions -x and 0 - x are not equivalent if x
22269 <pre>
22270 is +0, because -(+0) yields -0, but 0 - (+0) yields +0
22271 (unless rounding is downward).
22272 </pre>
22274 <h6>footnotes</h6>
22275 <p><small><a name="note317" href="#note317">317)</a> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
22276 other transformations that remove arithmetic operators.
22277 </small>
22278 <p><small><a name="note318" href="#note318">318)</a> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
22279 Examples include:
22281 <pre>
22282 1/(1/ (+-) (inf)) is (+-) (inf)
22283 </pre>
22286 <pre>
22287 conj(csqrt(z)) is csqrt(conj(z)),
22288 </pre>
22289 for complex z.
22290 </small>
22292 <h4><a name="F.8.3" href="#F.8.3">F.8.3 Relational operators</a></h4>
22293 <p><!--para 1 -->
22294 x != x -&gt; false The statement x != x is true if x is a NaN.
22295 x == x -&gt; true The statement x == x is false if x is a NaN.
22296 x &lt; y -&gt; isless(x,y) (and similarly for &lt;=, &gt;, &gt;=) Though numerically
22297 <pre>
22298 equal, these expressions are not equivalent because of
22299 side effects when x or y is a NaN and the state of the
22300 FENV_ACCESS pragma is ''on''. This transformation,
22301 which would be desirable if extra code were required to
22302 cause the ''invalid'' floating-point exception for
22303 unordered cases, could be performed provided the state
22304 of the FENV_ACCESS pragma is ''off''.
22305 </pre>
22306 The sense of relational operators shall be maintained. This includes handling unordered
22307 cases as expressed by the source code.
22308 <p><!--para 2 -->
22309 EXAMPLE
22310 <pre>
22311 // calls g and raises ''invalid'' if a and b are unordered
22312 if (a &lt; b)
22313 f();
22314 else
22315 g();
22316 </pre>
22317 is not equivalent to
22318 <pre>
22319 // calls f and raises ''invalid'' if a and b are unordered
22320 if (a &gt;= b)
22321 g();
22322 else
22323 f();
22324 </pre>
22325 nor to
22326 <pre>
22327 // calls f without raising ''invalid'' if a and b are unordered
22328 if (isgreaterequal(a,b))
22329 g();
22330 else
22331 f();
22332 </pre>
22333 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
22334 <!--page 466 -->
22335 <pre>
22336 // calls g without raising ''invalid'' if a and b are unordered
22337 if (isless(a,b))
22338 f();
22339 else
22340 g();
22341 </pre>
22342 but is equivalent to
22343 <pre>
22344 if (!(a &lt; b))
22345 g();
22346 else
22347 f();
22348 </pre>
22351 <h4><a name="F.8.4" href="#F.8.4">F.8.4 Constant arithmetic</a></h4>
22352 <p><!--para 1 -->
22353 The implementation shall honor floating-point exceptions raised by execution-time
22354 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.7.4">F.7.4</a>
22355 and <a href="#F.7.5">F.7.5</a>.) An operation on constants that raises no floating-point exception can be
22356 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
22357 further check is required to assure that changing the rounding direction to downward does
22358 not alter the sign of the result,<sup><a href="#note319"><b>319)</b></a></sup> and implementations that support dynamic rounding
22359 precision modes shall assure further that the result of the operation raises no floating-
22360 point exception when converted to the semantic type of the operation.
22362 <h6>footnotes</h6>
22363 <p><small><a name="note319" href="#note319">319)</a> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
22364 </small>
22366 <h3><a name="F.9" href="#F.9">F.9 Mathematics <math.h></a></h3>
22367 <p><!--para 1 -->
22368 This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
22369 for IEC 60559 implementations.
22370 <p><!--para 2 -->
22371 The Standard C macro HUGE_VAL and its float and long double analogs,
22372 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
22373 infinities.
22374 <p><!--para 3 -->
22375 Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
22376 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
22377 other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
22378 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
22379 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
22380 <p><!--para 4 -->
22381 The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
22382 nonzero value.
22383 <p><!--para 5 -->
22384 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
22385 subsequent subclauses of this annex.
22386 <p><!--para 6 -->
22387 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
22388 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
22391 <!--page 467 -->
22392 whose magnitude is too large.
22393 <p><!--para 7 -->
22394 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
22395 subnormal or zero) and suffers loss of accuracy.<sup><a href="#note320"><b>320)</b></a></sup>
22396 <p><!--para 8 -->
22397 Whether or when library functions raise the ''inexact'' floating-point exception is
22398 unspecified, unless explicitly specified otherwise.
22399 <p><!--para 9 -->
22400 Whether or when library functions raise an undeserved ''underflow'' floating-point
22401 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 <a href="#7.12">&lt;math.h&gt;</a> functions do
22402 not raise spurious floating-point exceptions (detectable by the user), other than the
22403 ''inexact'' floating-point exception.
22404 <p><!--para 10 -->
22405 Whether the functions honor the rounding direction mode is implementation-defined,
22406 unless explicitly specified otherwise.
22407 <p><!--para 11 -->
22408 Functions with a NaN argument return a NaN result and raise no floating-point exception,
22409 except where stated otherwise.
22410 <p><!--para 12 -->
22411 The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
22412 For families of functions, the specifications apply to all of the functions even though only
22413 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
22414 occurs in both an argument and the result, the result has the same sign as the argument.
22415 <h6>Recommended practice</h6>
22416 <p><!--para 13 -->
22417 If a function with one or more NaN arguments returns a NaN result, the result should be
22418 the same as one of the NaN arguments (after possible type conversion), except perhaps
22419 for the sign.
22421 <h6>footnotes</h6>
22422 <p><small><a name="note320" href="#note320">320)</a> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
22423 when the floating-point exception is raised.
22424 </small>
22425 <p><small><a name="note321" href="#note321">321)</a> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
22426 avoiding them would be too costly.
22427 </small>
22429 <h4><a name="F.9.1" href="#F.9.1">F.9.1 Trigonometric functions</a></h4>
22431 <h5><a name="F.9.1.1" href="#F.9.1.1">F.9.1.1 The acos functions</a></h5>
22432 <p><!--para 1 -->
22433 <ul>
22434 <li> acos(1) returns +0.
22435 <li> acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
22436 | x | &gt; 1.
22441 <!--page 468 -->
22442 </ul>
22444 <h5><a name="F.9.1.2" href="#F.9.1.2">F.9.1.2 The asin functions</a></h5>
22445 <p><!--para 1 -->
22446 <ul>
22447 <li> asin((+-)0) returns (+-)0.
22448 <li> asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
22449 | x | &gt; 1.
22450 </ul>
22452 <h5><a name="F.9.1.3" href="#F.9.1.3">F.9.1.3 The atan functions</a></h5>
22453 <p><!--para 1 -->
22454 <ul>
22455 <li> atan((+-)0) returns (+-)0.
22456 <li> atan((+-)(inf)) returns (+-)pi /2.
22457 </ul>
22459 <h5><a name="F.9.1.4" href="#F.9.1.4">F.9.1.4 The atan2 functions</a></h5>
22460 <p><!--para 1 -->
22461 <ul>
22462 <li> atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note322"><b>322)</b></a></sup>
22463 <li> atan2((+-)0, +0) returns (+-)0.
22464 <li> atan2((+-)0, x) returns (+-)pi for x &lt; 0.
22465 <li> atan2((+-)0, x) returns (+-)0 for x &gt; 0.
22466 <li> atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
22467 <li> atan2(y, (+-)0) returns pi /2 for y &gt; 0.
22468 <li> atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
22469 <li> atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
22470 <li> atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
22471 <li> atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
22472 <li> atan2((+-)(inf), +(inf)) returns (+-)pi /4.
22473 </ul>
22475 <h6>footnotes</h6>
22476 <p><small><a name="note322" href="#note322">322)</a> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
22477 the ''divide-by-zero'' floating-point exception.
22478 </small>
22480 <h5><a name="F.9.1.5" href="#F.9.1.5">F.9.1.5 The cos functions</a></h5>
22481 <p><!--para 1 -->
22482 <ul>
22483 <li> cos((+-)0) returns 1.
22484 <li> cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
22485 </ul>
22487 <h5><a name="F.9.1.6" href="#F.9.1.6">F.9.1.6 The sin functions</a></h5>
22488 <p><!--para 1 -->
22489 <ul>
22490 <li> sin((+-)0) returns (+-)0.
22491 <li> sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
22496 <!--page 469 -->
22497 </ul>
22499 <h5><a name="F.9.1.7" href="#F.9.1.7">F.9.1.7 The tan functions</a></h5>
22500 <p><!--para 1 -->
22501 <ul>
22502 <li> tan((+-)0) returns (+-)0.
22503 <li> tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
22504 </ul>
22506 <h4><a name="F.9.2" href="#F.9.2">F.9.2 Hyperbolic functions</a></h4>
22508 <h5><a name="F.9.2.1" href="#F.9.2.1">F.9.2.1 The acosh functions</a></h5>
22509 <p><!--para 1 -->
22510 <ul>
22511 <li> acosh(1) returns +0.
22512 <li> acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
22513 <li> acosh(+(inf)) returns +(inf).
22514 </ul>
22516 <h5><a name="F.9.2.2" href="#F.9.2.2">F.9.2.2 The asinh functions</a></h5>
22517 <p><!--para 1 -->
22518 <ul>
22519 <li> asinh((+-)0) returns (+-)0.
22520 <li> asinh((+-)(inf)) returns (+-)(inf).
22521 </ul>
22523 <h5><a name="F.9.2.3" href="#F.9.2.3">F.9.2.3 The atanh functions</a></h5>
22524 <p><!--para 1 -->
22525 <ul>
22526 <li> atanh((+-)0) returns (+-)0.
22527 <li> atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
22528 <li> atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
22529 | x | &gt; 1.
22530 </ul>
22532 <h5><a name="F.9.2.4" href="#F.9.2.4">F.9.2.4 The cosh functions</a></h5>
22533 <p><!--para 1 -->
22534 <ul>
22535 <li> cosh((+-)0) returns 1.
22536 <li> cosh((+-)(inf)) returns +(inf).
22537 </ul>
22539 <h5><a name="F.9.2.5" href="#F.9.2.5">F.9.2.5 The sinh functions</a></h5>
22540 <p><!--para 1 -->
22541 <ul>
22542 <li> sinh((+-)0) returns (+-)0.
22543 <li> sinh((+-)(inf)) returns (+-)(inf).
22544 </ul>
22546 <h5><a name="F.9.2.6" href="#F.9.2.6">F.9.2.6 The tanh functions</a></h5>
22547 <p><!--para 1 -->
22548 <ul>
22549 <li> tanh((+-)0) returns (+-)0.
22550 <li> tanh((+-)(inf)) returns (+-)1.
22551 <!--page 470 -->
22552 </ul>
22554 <h4><a name="F.9.3" href="#F.9.3">F.9.3 Exponential and logarithmic functions</a></h4>
22556 <h5><a name="F.9.3.1" href="#F.9.3.1">F.9.3.1 The exp functions</a></h5>
22557 <p><!--para 1 -->
22558 <ul>
22559 <li> exp((+-)0) returns 1.
22560 <li> exp(-(inf)) returns +0.
22561 <li> exp(+(inf)) returns +(inf).
22562 </ul>
22564 <h5><a name="F.9.3.2" href="#F.9.3.2">F.9.3.2 The exp2 functions</a></h5>
22565 <p><!--para 1 -->
22566 <ul>
22567 <li> exp2((+-)0) returns 1.
22568 <li> exp2(-(inf)) returns +0.
22569 <li> exp2(+(inf)) returns +(inf).
22570 </ul>
22572 <h5><a name="F.9.3.3" href="#F.9.3.3">F.9.3.3 The expm1 functions</a></h5>
22573 <p><!--para 1 -->
22574 <ul>
22575 <li> expm1((+-)0) returns (+-)0.
22576 <li> expm1(-(inf)) returns -1.
22577 <li> expm1(+(inf)) returns +(inf).
22578 </ul>
22580 <h5><a name="F.9.3.4" href="#F.9.3.4">F.9.3.4 The frexp functions</a></h5>
22581 <p><!--para 1 -->
22582 <ul>
22583 <li> frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
22584 <li> frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
22585 pointed to by exp.
22586 <li> frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
22587 (and returns a NaN).
22588 </ul>
22589 <p><!--para 2 -->
22590 frexp raises no floating-point exceptions.
22591 <p><!--para 3 -->
22592 On a binary system, the body of the frexp function might be
22593 <pre>
22595 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
22596 return scalbn(value, -(*exp));
22598 </pre>
22600 <h5><a name="F.9.3.5" href="#F.9.3.5">F.9.3.5 The ilogb functions</a></h5>
22601 <p><!--para 1 -->
22602 If the correct result is outside the range of the return type, the numeric result is
22603 unspecified and the ''invalid'' floating-point exception is raised.
22604 <!--page 471 -->
22606 <h5><a name="F.9.3.6" href="#F.9.3.6">F.9.3.6 The ldexp functions</a></h5>
22607 <p><!--para 1 -->
22608 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
22610 <h5><a name="F.9.3.7" href="#F.9.3.7">F.9.3.7 The log functions</a></h5>
22611 <p><!--para 1 -->
22612 <ul>
22613 <li> log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
22614 <li> log(1) returns +0.
22615 <li> log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
22616 <li> log(+(inf)) returns +(inf).
22617 </ul>
22619 <h5><a name="F.9.3.8" href="#F.9.3.8">F.9.3.8 The log10 functions</a></h5>
22620 <p><!--para 1 -->
22621 <ul>
22622 <li> log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
22623 <li> log10(1) returns +0.
22624 <li> log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
22625 <li> log10(+(inf)) returns +(inf).
22626 </ul>
22628 <h5><a name="F.9.3.9" href="#F.9.3.9">F.9.3.9 The log1p functions</a></h5>
22629 <p><!--para 1 -->
22630 <ul>
22631 <li> log1p((+-)0) returns (+-)0.
22632 <li> log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
22633 <li> log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
22634 x &lt; -1.
22635 <li> log1p(+(inf)) returns +(inf).
22636 </ul>
22638 <h5><a name="F.9.3.10" href="#F.9.3.10">F.9.3.10 The log2 functions</a></h5>
22639 <p><!--para 1 -->
22640 <ul>
22641 <li> log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
22642 <li> log2(1) returns +0.
22643 <li> log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
22644 <li> log2(+(inf)) returns +(inf).
22645 </ul>
22647 <h5><a name="F.9.3.11" href="#F.9.3.11">F.9.3.11 The logb functions</a></h5>
22648 <p><!--para 1 -->
22649 <ul>
22650 <li> logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
22651 <li> logb((+-)(inf)) returns +(inf).
22652 <!--page 472 -->
22653 </ul>
22655 <h5><a name="F.9.3.12" href="#F.9.3.12">F.9.3.12 The modf functions</a></h5>
22656 <p><!--para 1 -->
22657 <ul>
22658 <li> modf((+-)x, iptr) returns a result with the same sign as x.
22659 <li> modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
22660 <li> modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
22661 NaN).
22662 </ul>
22663 <p><!--para 2 -->
22664 modf behaves as though implemented by
22665 <pre>
22666 #include <a href="#7.12">&lt;math.h&gt;</a>
22667 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22668 #pragma STDC FENV_ACCESS ON
22669 double modf(double value, double *iptr)
22671 int save_round = fegetround();
22672 fesetround(FE_TOWARDZERO);
22673 *iptr = nearbyint(value);
22674 fesetround(save_round);
22675 return copysign(
22676 isinf(value) ? 0.0 :
22677 value - (*iptr), value);
22679 </pre>
22681 <h5><a name="F.9.3.13" href="#F.9.3.13">F.9.3.13 The scalbn and scalbln functions</a></h5>
22682 <p><!--para 1 -->
22683 <ul>
22684 <li> scalbn((+-)0, n) returns (+-)0.
22685 <li> scalbn(x, 0) returns x.
22686 <li> scalbn((+-)(inf), n) returns (+-)(inf).
22687 </ul>
22689 <h4><a name="F.9.4" href="#F.9.4">F.9.4 Power and absolute value functions</a></h4>
22691 <h5><a name="F.9.4.1" href="#F.9.4.1">F.9.4.1 The cbrt functions</a></h5>
22692 <p><!--para 1 -->
22693 <ul>
22694 <li> cbrt((+-)0) returns (+-)0.
22695 <li> cbrt((+-)(inf)) returns (+-)(inf).
22696 </ul>
22698 <h5><a name="F.9.4.2" href="#F.9.4.2">F.9.4.2 The fabs functions</a></h5>
22699 <p><!--para 1 -->
22700 <ul>
22701 <li> fabs((+-)0) returns +0.
22702 <li> fabs((+-)(inf)) returns +(inf).
22703 <!--page 473 -->
22704 </ul>
22706 <h5><a name="F.9.4.3" href="#F.9.4.3">F.9.4.3 The hypot functions</a></h5>
22707 <p><!--para 1 -->
22708 <ul>
22709 <li> hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
22710 <li> hypot(x, (+-)0) is equivalent to fabs(x).
22711 <li> hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
22712 </ul>
22714 <h5><a name="F.9.4.4" href="#F.9.4.4">F.9.4.4 The pow functions</a></h5>
22715 <p><!--para 1 -->
22716 <ul>
22717 <li> pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
22718 for y an odd integer &lt; 0.
22719 <li> pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
22720 for y &lt; 0 and not an odd integer.
22721 <li> pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
22722 <li> pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
22723 <li> pow(-1, (+-)(inf)) returns 1.
22724 <li> pow(+1, y) returns 1 for any y, even a NaN.
22725 <li> pow(x, (+-)0) returns 1 for any x, even a NaN.
22726 <li> pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
22727 finite x &lt; 0 and finite non-integer y.
22728 <li> pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
22729 <li> pow(x, -(inf)) returns +0 for | x | &gt; 1.
22730 <li> pow(x, +(inf)) returns +0 for | x | &lt; 1.
22731 <li> pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
22732 <li> pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
22733 <li> pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
22734 <li> pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
22735 <li> pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
22736 <li> pow(+(inf), y) returns +0 for y &lt; 0.
22737 <li> pow(+(inf), y) returns +(inf) for y &gt; 0.
22738 <!--page 474 -->
22739 </ul>
22741 <h5><a name="F.9.4.5" href="#F.9.4.5">F.9.4.5 The sqrt functions</a></h5>
22742 <p><!--para 1 -->
22743 sqrt is fully specified as a basic arithmetic operation in IEC 60559.
22745 <h4><a name="F.9.5" href="#F.9.5">F.9.5 Error and gamma functions</a></h4>
22747 <h5><a name="F.9.5.1" href="#F.9.5.1">F.9.5.1 The erf functions</a></h5>
22748 <p><!--para 1 -->
22749 <ul>
22750 <li> erf((+-)0) returns (+-)0.
22751 <li> erf((+-)(inf)) returns (+-)1.
22752 </ul>
22754 <h5><a name="F.9.5.2" href="#F.9.5.2">F.9.5.2 The erfc functions</a></h5>
22755 <p><!--para 1 -->
22756 <ul>
22757 <li> erfc(-(inf)) returns 2.
22758 <li> erfc(+(inf)) returns +0.
22759 </ul>
22761 <h5><a name="F.9.5.3" href="#F.9.5.3">F.9.5.3 The lgamma functions</a></h5>
22762 <p><!--para 1 -->
22763 <ul>
22764 <li> lgamma(1) returns +0.
22765 <li> lgamma(2) returns +0.
22766 <li> lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
22767 x a negative integer or zero.
22768 <li> lgamma(-(inf)) returns +(inf).
22769 <li> lgamma(+(inf)) returns +(inf).
22770 </ul>
22772 <h5><a name="F.9.5.4" href="#F.9.5.4">F.9.5.4 The tgamma functions</a></h5>
22773 <p><!--para 1 -->
22774 <ul>
22775 <li> tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
22776 <li> tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
22777 negative integer.
22778 <li> tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
22779 <li> tgamma(+(inf)) returns +(inf).
22780 </ul>
22782 <h4><a name="F.9.6" href="#F.9.6">F.9.6 Nearest integer functions</a></h4>
22784 <h5><a name="F.9.6.1" href="#F.9.6.1">F.9.6.1 The ceil functions</a></h5>
22785 <p><!--para 1 -->
22786 <ul>
22787 <li> ceil((+-)0) returns (+-)0.
22788 <li> ceil((+-)(inf)) returns (+-)(inf).
22789 </ul>
22790 <p><!--para 2 -->
22791 The double version of ceil behaves as though implemented by
22792 <!--page 475 -->
22793 <pre>
22794 #include <a href="#7.12">&lt;math.h&gt;</a>
22795 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22796 #pragma STDC FENV_ACCESS ON
22797 double ceil(double x)
22799 double result;
22800 int save_round = fegetround();
22801 fesetround(FE_UPWARD);
22802 result = rint(x); // or nearbyint instead of rint
22803 fesetround(save_round);
22804 return result;
22806 </pre>
22808 <h5><a name="F.9.6.2" href="#F.9.6.2">F.9.6.2 The floor functions</a></h5>
22809 <p><!--para 1 -->
22810 <ul>
22811 <li> floor((+-)0) returns (+-)0.
22812 <li> floor((+-)(inf)) returns (+-)(inf).
22813 </ul>
22814 <p><!--para 2 -->
22815 See the sample implementation for ceil in <a href="#F.9.6.1">F.9.6.1</a>.
22817 <h5><a name="F.9.6.3" href="#F.9.6.3">F.9.6.3 The nearbyint functions</a></h5>
22818 <p><!--para 1 -->
22819 The nearbyint functions use IEC 60559 rounding according to the current rounding
22820 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
22821 value from the argument.
22822 <ul>
22823 <li> nearbyint((+-)0) returns (+-)0 (for all rounding directions).
22824 <li> nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
22825 </ul>
22827 <h5><a name="F.9.6.4" href="#F.9.6.4">F.9.6.4 The rint functions</a></h5>
22828 <p><!--para 1 -->
22829 The rint functions differ from the nearbyint functions only in that they do raise the
22830 ''inexact'' floating-point exception if the result differs in value from the argument.
22832 <h5><a name="F.9.6.5" href="#F.9.6.5">F.9.6.5 The lrint and llrint functions</a></h5>
22833 <p><!--para 1 -->
22834 The lrint and llrint functions provide floating-to-integer conversion as prescribed
22835 by IEC 60559. They round according to the current rounding direction. If the rounded
22836 value is outside the range of the return type, the numeric result is unspecified and the
22837 ''invalid'' floating-point exception is raised. When they raise no other floating-point
22838 exception and the result differs from the argument, they raise the ''inexact'' floating-point
22839 exception.
22840 <!--page 476 -->
22842 <h5><a name="F.9.6.6" href="#F.9.6.6">F.9.6.6 The round functions</a></h5>
22843 <p><!--para 1 -->
22844 <ul>
22845 <li> round((+-)0) returns (+-)0.
22846 <li> round((+-)(inf)) returns (+-)(inf).
22847 </ul>
22848 <p><!--para 2 -->
22849 The double version of round behaves as though implemented by
22850 <pre>
22851 #include <a href="#7.12">&lt;math.h&gt;</a>
22852 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22853 #pragma STDC FENV_ACCESS ON
22854 double round(double x)
22856 double result;
22857 fenv_t save_env;
22858 feholdexcept(&amp;save_env);
22859 result = rint(x);
22860 if (fetestexcept(FE_INEXACT)) {
22861 fesetround(FE_TOWARDZERO);
22862 result = rint(copysign(0.5 + fabs(x), x));
22864 feupdateenv(&amp;save_env);
22865 return result;
22867 </pre>
22868 The round functions may, but are not required to, raise the ''inexact'' floating-point
22869 exception for non-integer numeric arguments, as this implementation does.
22871 <h5><a name="F.9.6.7" href="#F.9.6.7">F.9.6.7 The lround and llround functions</a></h5>
22872 <p><!--para 1 -->
22873 The lround and llround functions differ from the lrint and llrint functions
22874 with the default rounding direction just in that the lround and llround functions
22875 round halfway cases away from zero and need not raise the ''inexact'' floating-point
22876 exception for non-integer arguments that round to within the range of the return type.
22878 <h5><a name="F.9.6.8" href="#F.9.6.8">F.9.6.8 The trunc functions</a></h5>
22879 <p><!--para 1 -->
22880 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
22881 rounding direction).
22882 <ul>
22883 <li> trunc((+-)0) returns (+-)0.
22884 <li> trunc((+-)(inf)) returns (+-)(inf).
22885 <!--page 477 -->
22886 </ul>
22888 <h4><a name="F.9.7" href="#F.9.7">F.9.7 Remainder functions</a></h4>
22890 <h5><a name="F.9.7.1" href="#F.9.7.1">F.9.7.1 The fmod functions</a></h5>
22891 <p><!--para 1 -->
22892 <ul>
22893 <li> fmod((+-)0, y) returns (+-)0 for y not zero.
22894 <li> fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
22895 infinite or y zero.
22896 <li> fmod(x, (+-)(inf)) returns x for x not infinite.
22897 </ul>
22898 <p><!--para 2 -->
22899 The double version of fmod behaves as though implemented by
22900 <pre>
22901 #include <a href="#7.12">&lt;math.h&gt;</a>
22902 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22903 #pragma STDC FENV_ACCESS ON
22904 double fmod(double x, double y)
22906 double result;
22907 result = remainder(fabs(x), (y = fabs(y)));
22908 if (signbit(result)) result += y;
22909 return copysign(result, x);
22911 </pre>
22913 <h5><a name="F.9.7.2" href="#F.9.7.2">F.9.7.2 The remainder functions</a></h5>
22914 <p><!--para 1 -->
22915 The remainder functions are fully specified as a basic arithmetic operation in
22916 IEC 60559.
22918 <h5><a name="F.9.7.3" href="#F.9.7.3">F.9.7.3 The remquo functions</a></h5>
22919 <p><!--para 1 -->
22920 The remquo functions follow the specifications for the remainder functions. They
22921 have no further specifications special to IEC 60559 implementations.
22923 <h4><a name="F.9.8" href="#F.9.8">F.9.8 Manipulation functions</a></h4>
22925 <h5><a name="F.9.8.1" href="#F.9.8.1">F.9.8.1 The copysign functions</a></h5>
22926 <p><!--para 1 -->
22927 copysign is specified in the Appendix to IEC 60559.
22929 <h5><a name="F.9.8.2" href="#F.9.8.2">F.9.8.2 The nan functions</a></h5>
22930 <p><!--para 1 -->
22931 All IEC 60559 implementations support quiet NaNs, in all floating formats.
22932 <!--page 478 -->
22934 <h5><a name="F.9.8.3" href="#F.9.8.3">F.9.8.3 The nextafter functions</a></h5>
22935 <p><!--para 1 -->
22936 <ul>
22937 <li> nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
22938 for x finite and the function value infinite.
22939 <li> nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
22940 exceptions for the function value subnormal or zero and x != y.
22941 </ul>
22943 <h5><a name="F.9.8.4" href="#F.9.8.4">F.9.8.4 The nexttoward functions</a></h5>
22944 <p><!--para 1 -->
22945 No additional requirements beyond those on nextafter.
22947 <h4><a name="F.9.9" href="#F.9.9">F.9.9 Maximum, minimum, and positive difference functions</a></h4>
22949 <h5><a name="F.9.9.1" href="#F.9.9.1">F.9.9.1 The fdim functions</a></h5>
22950 <p><!--para 1 -->
22951 No additional requirements.
22953 <h5><a name="F.9.9.2" href="#F.9.9.2">F.9.9.2 The fmax functions</a></h5>
22954 <p><!--para 1 -->
22955 If just one argument is a NaN, the fmax functions return the other argument (if both
22956 arguments are NaNs, the functions return a NaN).
22957 <p><!--para 2 -->
22958 The body of the fmax function might be<sup><a href="#note323"><b>323)</b></a></sup>
22959 <pre>
22960 { return (isgreaterequal(x, y) ||
22961 isnan(y)) ? x : y; }
22962 </pre>
22964 <h6>footnotes</h6>
22965 <p><small><a name="note323" href="#note323">323)</a> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
22966 return +0; however, implementation in software might be impractical.
22967 </small>
22969 <h5><a name="F.9.9.3" href="#F.9.9.3">F.9.9.3 The fmin functions</a></h5>
22970 <p><!--para 1 -->
22971 The fmin functions are analogous to the fmax functions (see <a href="#F.9.9.2">F.9.9.2</a>).
22973 <h4><a name="F.9.10" href="#F.9.10">F.9.10 Floating multiply-add</a></h4>
22975 <h5><a name="F.9.10.1" href="#F.9.10.1">F.9.10.1 The fma functions</a></h5>
22976 <p><!--para 1 -->
22977 <ul>
22978 <li> fma(x, y, z) computes xy + z, correctly rounded once.
22979 <li> fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
22980 exception if one of x and y is infinite, the other is zero, and z is a NaN.
22981 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
22982 one of x and y is infinite, the other is zero, and z is not a NaN.
22983 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
22984 times y is an exact infinity and z is also an infinity but with the opposite sign.
22989 <!--page 479 -->
22990 </ul>
22992 <h2><a name="G" href="#G">Annex G</a></h2>
22993 <pre>
22994 (informative)
22995 IEC 60559-compatible complex arithmetic
22996 </pre>
22998 <h3><a name="G.1" href="#G.1">G.1 Introduction</a></h3>
22999 <p><!--para 1 -->
23000 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
23001 IEC 60559 real floating-point arithmetic. Although these specifications have been
23002 carefully designed, there is little existing practice to validate the design decisions.
23003 Therefore, these specifications are not normative, but should be viewed more as
23004 recommended practice. An implementation that defines
23005 __STDC_IEC_559_COMPLEX__ should conform to the specifications in this annex.
23007 <h3><a name="G.2" href="#G.2">G.2 Types</a></h3>
23008 <p><!--para 1 -->
23009 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
23010 used as a type specifier within declaration specifiers in the same way as _Complex is
23011 (thus, _Imaginary float is a valid type name).
23012 <p><!--para 2 -->
23013 There are three imaginary types, designated as float _Imaginary, double
23014 _Imaginary, and long double _Imaginary. The imaginary types (along with
23015 the real floating and complex types) are floating types.
23016 <p><!--para 3 -->
23017 For imaginary types, the corresponding real type is given by deleting the keyword
23018 _Imaginary from the type name.
23019 <p><!--para 4 -->
23020 Each imaginary type has the same representation and alignment requirements as the
23021 corresponding real type. The value of an object of imaginary type is the value of the real
23022 representation times the imaginary unit.
23023 <p><!--para 5 -->
23024 The imaginary type domain comprises the imaginary types.
23026 <h3><a name="G.3" href="#G.3">G.3 Conventions</a></h3>
23027 <p><!--para 1 -->
23028 A complex or imaginary value with at least one infinite part is regarded as an infinity
23029 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
23030 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
23031 a zero if each of its parts is a zero.
23032 <!--page 480 -->
23034 <h3><a name="G.4" href="#G.4">G.4 Conversions</a></h3>
23036 <h4><a name="G.4.1" href="#G.4.1">G.4.1 Imaginary types</a></h4>
23037 <p><!--para 1 -->
23038 Conversions among imaginary types follow rules analogous to those for real floating
23039 types.
23041 <h4><a name="G.4.2" href="#G.4.2">G.4.2 Real and imaginary</a></h4>
23042 <p><!--para 1 -->
23043 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
23044 result is a positive zero.
23045 <p><!--para 2 -->
23046 When a value of real type is converted to an imaginary type, the result is a positive
23047 imaginary zero.
23049 <h6>footnotes</h6>
23050 <p><small><a name="note324" href="#note324">324)</a> See <a href="#6.3.1.2">6.3.1.2</a>.
23051 </small>
23053 <h4><a name="G.4.3" href="#G.4.3">G.4.3 Imaginary and complex</a></h4>
23054 <p><!--para 1 -->
23055 When a value of imaginary type is converted to a complex type, the real part of the
23056 complex result value is a positive zero and the imaginary part of the complex result value
23057 is determined by the conversion rules for the corresponding real types.
23058 <p><!--para 2 -->
23059 When a value of complex type is converted to an imaginary type, the real part of the
23060 complex value is discarded and the value of the imaginary part is converted according to
23061 the conversion rules for the corresponding real types.
23063 <h3><a name="G.5" href="#G.5">G.5 Binary operators</a></h3>
23064 <p><!--para 1 -->
23065 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
23066 operation with an imaginary operand.
23067 <p><!--para 2 -->
23068 For most operand types, the value of the result of a binary operator with an imaginary or
23069 complex operand is completely determined, with reference to real arithmetic, by the usual
23070 mathematical formula. For some operand types, the usual mathematical formula is
23071 problematic because of its treatment of infinities and because of undue overflow or
23072 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
23073 not completely determined.
23078 <!--page 481 -->
23080 <h4><a name="G.5.1" href="#G.5.1">G.5.1 Multiplicative operators</a></h4>
23081 <h6>Semantics</h6>
23082 <p><!--para 1 -->
23083 If one operand has real type and the other operand has imaginary type, then the result has
23084 imaginary type. If both operands have imaginary type, then the result has real type. (If
23085 either operand has complex type, then the result has complex type.)
23086 <p><!--para 2 -->
23087 If the operands are not both complex, then the result and floating-point exception
23088 behavior of the * operator is defined by the usual mathematical formula:
23089 <pre>
23090 * u iv u + iv
23091 </pre>
23093 <pre>
23094 x xu i(xv) (xu) + i(xv)
23095 </pre>
23097 <pre>
23098 iy i(yu) -yv (-yv) + i(yu)
23099 </pre>
23101 <p><!--para 3 -->
23102 <pre>
23103 x + iy (xu) + i(yu) (-yv) + i(xv)
23104 </pre>
23105 If the second operand is not complex, then the result and floating-point exception
23106 behavior of the / operator is defined by the usual mathematical formula:
23107 <pre>
23108 / u iv
23109 </pre>
23111 <pre>
23112 x x/u i(-x/v)
23113 </pre>
23115 <pre>
23116 iy i(y/u) y/v
23117 </pre>
23119 <p><!--para 4 -->
23120 <pre>
23121 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
23122 </pre>
23123 The * and / operators satisfy the following infinity properties for all real, imaginary, and
23124 complex operands:<sup><a href="#note325"><b>325)</b></a></sup>
23125 <ul>
23126 <li> if one operand is an infinity and the other operand is a nonzero finite number or an
23127 infinity, then the result of the * operator is an infinity;
23128 <li> if the first operand is an infinity and the second operand is a finite number, then the
23129 result of the / operator is an infinity;
23130 <li> if the first operand is a finite number and the second operand is an infinity, then the
23131 result of the / operator is a zero;
23136 <!--page 482 -->
23137 <li> if the first operand is a nonzero finite number or an infinity and the second operand is
23138 a zero, then the result of the / operator is an infinity.
23139 </ul>
23140 <p><!--para 5 -->
23141 If both operands of the * operator are complex or if the second operand of the / operator
23142 is complex, the operator raises floating-point exceptions if appropriate for the calculation
23143 of the parts of the result, and may raise spurious floating-point exceptions.
23144 <p><!--para 6 -->
23145 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
23146 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
23147 <!--page 483 -->
23148 <p><!--para 7 -->
23149 <pre>
23150 #include <a href="#7.12">&lt;math.h&gt;</a>
23151 #include <a href="#7.3">&lt;complex.h&gt;</a>
23152 /* Multiply z * w ... */
23153 double complex _Cmultd(double complex z, double complex w)
23155 #pragma STDC FP_CONTRACT OFF
23156 double a, b, c, d, ac, bd, ad, bc, x, y;
23157 a = creal(z); b = cimag(z);
23158 c = creal(w); d = cimag(w);
23159 ac = a * c; bd = b * d;
23160 ad = a * d; bc = b * c;
23161 x = ac - bd; y = ad + bc;
23162 if (isnan(x) &amp;&amp; isnan(y)) {
23163 /* Recover infinities that computed as NaN+iNaN ... */
23164 int recalc = 0;
23165 if ( isinf(a) || isinf(b) ) { // z is infinite
23166 /* "Box" the infinity and change NaNs in the other factor to 0 */
23167 a = copysign(isinf(a) ? 1.0 : 0.0, a);
23168 b = copysign(isinf(b) ? 1.0 : 0.0, b);
23169 if (isnan(c)) c = copysign(0.0, c);
23170 if (isnan(d)) d = copysign(0.0, d);
23171 recalc = 1;
23173 if ( isinf(c) || isinf(d) ) { // w is infinite
23174 /* "Box" the infinity and change NaNs in the other factor to 0 */
23175 c = copysign(isinf(c) ? 1.0 : 0.0, c);
23176 d = copysign(isinf(d) ? 1.0 : 0.0, d);
23177 if (isnan(a)) a = copysign(0.0, a);
23178 if (isnan(b)) b = copysign(0.0, b);
23179 recalc = 1;
23181 if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
23182 isinf(ad) || isinf(bc))) {
23183 /* Recover infinities from overflow by changing NaNs to 0 ... */
23184 if (isnan(a)) a = copysign(0.0, a);
23185 if (isnan(b)) b = copysign(0.0, b);
23186 if (isnan(c)) c = copysign(0.0, c);
23187 if (isnan(d)) d = copysign(0.0, d);
23188 recalc = 1;
23190 if (recalc) {
23191 x = INFINITY * ( a * c - b * d );
23192 y = INFINITY * ( a * d + b * c );
23195 return x + I * y;
23197 </pre>
23198 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
23199 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
23201 <p><!--para 8 -->
23202 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
23203 <!--page 484 -->
23204 <p><!--para 9 -->
23205 <pre>
23206 #include <a href="#7.12">&lt;math.h&gt;</a>
23207 #include <a href="#7.3">&lt;complex.h&gt;</a>
23208 /* Divide z / w ... */
23209 double complex _Cdivd(double complex z, double complex w)
23211 #pragma STDC FP_CONTRACT OFF
23212 double a, b, c, d, logbw, denom, x, y;
23213 int ilogbw = 0;
23214 a = creal(z); b = cimag(z);
23215 c = creal(w); d = cimag(w);
23216 logbw = logb(fmax(fabs(c), fabs(d)));
23217 if (isfinite(logbw)) {
23218 ilogbw = (int)logbw;
23219 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
23221 denom = c * c + d * d;
23222 x = scalbn((a * c + b * d) / denom, -ilogbw);
23223 y = scalbn((b * c - a * d) / denom, -ilogbw);
23224 /* Recover infinities and zeros that computed as NaN+iNaN; */
23225 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
23226 if (isnan(x) &amp;&amp; isnan(y)) {
23227 if ((denom == 0.0) &amp;&amp;
23228 (!isnan(a) || !isnan(b))) {
23229 x = copysign(INFINITY, c) * a;
23230 y = copysign(INFINITY, c) * b;
23232 else if ((isinf(a) || isinf(b)) &amp;&amp;
23233 isfinite(c) &amp;&amp; isfinite(d)) {
23234 a = copysign(isinf(a) ? 1.0 : 0.0, a);
23235 b = copysign(isinf(b) ? 1.0 : 0.0, b);
23236 x = INFINITY * ( a * c + b * d );
23237 y = INFINITY * ( b * c - a * d );
23239 else if (isinf(logbw) &amp;&amp;
23240 isfinite(a) &amp;&amp; isfinite(b)) {
23241 c = copysign(isinf(c) ? 1.0 : 0.0, c);
23242 d = copysign(isinf(d) ? 1.0 : 0.0, d);
23243 x = 0.0 * ( a * c + b * d );
23244 y = 0.0 * ( b * c - a * d );
23247 return x + I * y;
23249 </pre>
23250 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
23251 for multiplication. In the spirit of the multiplication example above, this code does not defend against
23252 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
23253 with division, provides better roundoff characteristics.
23256 <h6>footnotes</h6>
23257 <p><small><a name="note325" href="#note325">325)</a> These properties are already implied for those cases covered in the tables, but are required for all cases
23258 (at least where the state for CX_LIMITED_RANGE is ''off'').
23259 </small>
23261 <h4><a name="G.5.2" href="#G.5.2">G.5.2 Additive operators</a></h4>
23262 <h6>Semantics</h6>
23263 <p><!--para 1 -->
23264 If both operands have imaginary type, then the result has imaginary type. (If one operand
23265 has real type and the other operand has imaginary type, or if either operand has complex
23266 type, then the result has complex type.)
23267 <p><!--para 2 -->
23268 In all cases the result and floating-point exception behavior of a + or - operator is defined
23269 by the usual mathematical formula:
23270 <pre>
23271 + or - u iv u + iv
23272 </pre>
23274 <pre>
23275 x x(+-)u x (+-) iv (x (+-) u) (+-) iv
23276 </pre>
23278 <pre>
23279 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)
23280 </pre>
23282 <pre>
23283 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)
23284 </pre>
23286 <h3><a name="G.6" href="#G.6">G.6 Complex arithmetic <complex.h></a></h3>
23287 <p><!--para 1 -->
23288 The macros
23289 <pre>
23290 imaginary
23291 </pre>
23293 <pre>
23294 _Imaginary_I
23295 </pre>
23296 are defined, respectively, as _Imaginary and a constant expression of type const
23297 float _Imaginary with the value of the imaginary unit. The macro
23298 <pre>
23300 </pre>
23301 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
23302 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
23303 imaginary.
23304 <p><!--para 2 -->
23305 This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
23306 particularly suited to IEC 60559 implementations. For families of functions, the
23307 specifications apply to all of the functions even though only the principal function is
23308 <!--page 485 -->
23309 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
23310 and the result, the result has the same sign as the argument.
23311 <p><!--para 3 -->
23312 The functions are continuous onto both sides of their branch cuts, taking into account the
23313 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)2. ???
23314 <p><!--para 4 -->
23315 Since complex and imaginary values are composed of real values, each function may be
23316 regarded as computing real values from real values. Except as noted, the functions treat
23317 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
23318 manner consistent with the specifications for real functions in F.9.<sup><a href="#note326"><b>326)</b></a></sup>
23319 <p><!--para 5 -->
23320 The functions cimag, conj, cproj, and creal are fully specified for all
23321 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
23322 point exceptions.
23323 <p><!--para 6 -->
23324 Each of the functions cabs and carg is specified by a formula in terms of a real
23325 function (whose special cases are covered in <a href="#F">annex F</a>):
23326 <p><!--para 7 -->
23327 <pre>
23328 cabs(x + iy) = hypot(x, y)
23329 carg(x + iy) = atan2(y, x)
23330 </pre>
23331 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
23332 a formula in terms of other complex functions (whose special cases are specified below):
23333 <p><!--para 8 -->
23334 <pre>
23335 casin(z) = -i casinh(iz)
23336 catan(z) = -i catanh(iz)
23337 ccos(z) = ccosh(iz)
23338 csin(z) = -i csinh(iz)
23339 ctan(z) = -i ctanh(iz)
23340 </pre>
23341 For the other functions, the following subclauses specify behavior for special cases,
23342 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
23343 families of functions, the specifications apply to all of the functions even though only the
23344 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
23345 specifications for the upper half-plane imply the specifications for the lower half-plane; if
23346 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
23347 specifications for the first quadrant imply the specifications for the other three quadrants.
23348 <p><!--para 9 -->
23349 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
23354 <!--page 486 -->
23356 <h6>footnotes</h6>
23357 <p><small><a name="note326" href="#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
23358 other part is a NaN.
23359 </small>
23361 <h4><a name="G.6.1" href="#G.6.1">G.6.1 Trigonometric functions</a></h4>
23363 <h5><a name="G.6.1.1" href="#G.6.1.1">G.6.1.1 The cacos functions</a></h5>
23364 <p><!--para 1 -->
23365 <ul>
23366 <li> cacos(conj(z)) = conj(cacos(z)).
23367 <li> cacos((+-)0 + i0) returns pi /2 - i0.
23368 <li> cacos((+-)0 + iNaN) returns pi /2 + iNaN.
23369 <li> cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
23370 <li> cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23371 point exception, for nonzero finite x.
23372 <li> cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
23373 <li> cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
23374 <li> cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
23375 <li> cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
23376 <li> cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
23377 result is unspecified).
23378 <li> cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23379 point exception, for finite y.
23380 <li> cacos(NaN + i (inf)) returns NaN - i (inf).
23381 <li> cacos(NaN + iNaN) returns NaN + iNaN.
23382 </ul>
23384 <h4><a name="G.6.2" href="#G.6.2">G.6.2 Hyperbolic functions</a></h4>
23386 <h5><a name="G.6.2.1" href="#G.6.2.1">G.6.2.1 The cacosh functions</a></h5>
23387 <p><!--para 1 -->
23388 <ul>
23389 <li> cacosh(conj(z)) = conj(cacosh(z)).
23390 <li> cacosh((+-)0 + i0) returns +0 + ipi /2.
23391 <li> cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
23392 <li> cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
23393 floating-point exception, for finite x.
23394 <li> cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
23395 <li> cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
23396 <li> cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
23397 <li> cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
23398 <li> cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
23399 <!--page 487 -->
23400 <li> cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
23401 floating-point exception, for finite y.
23402 <li> cacosh(NaN + i (inf)) returns +(inf) + iNaN.
23403 <li> cacosh(NaN + iNaN) returns NaN + iNaN.
23404 </ul>
23406 <h5><a name="G.6.2.2" href="#G.6.2.2">G.6.2.2 The casinh functions</a></h5>
23407 <p><!--para 1 -->
23408 <ul>
23409 <li> casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
23410 <li> casinh(+0 + i0) returns 0 + i0.
23411 <li> casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
23412 <li> casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
23413 floating-point exception, for finite x.
23414 <li> casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
23415 <li> casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
23416 <li> casinh(+(inf) + iNaN) returns +(inf) + iNaN.
23417 <li> casinh(NaN + i0) returns NaN + i0.
23418 <li> casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
23419 floating-point exception, for finite nonzero y.
23420 <li> casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
23421 is unspecified).
23422 <li> casinh(NaN + iNaN) returns NaN + iNaN.
23423 </ul>
23425 <h5><a name="G.6.2.3" href="#G.6.2.3">G.6.2.3 The catanh functions</a></h5>
23426 <p><!--para 1 -->
23427 <ul>
23428 <li> catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
23429 <li> catanh(+0 + i0) returns +0 + i0.
23430 <li> catanh(+0 + iNaN) returns +0 + iNaN.
23431 <li> catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
23432 exception.
23433 <li> catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
23434 <li> catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
23435 floating-point exception, for nonzero finite x.
23436 <li> catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
23437 <li> catanh(+(inf) + i (inf)) returns +0 + ipi /2.
23438 <li> catanh(+(inf) + iNaN) returns +0 + iNaN.
23439 <!--page 488 -->
23440 <li> catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
23441 floating-point exception, for finite y.
23442 <li> catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
23443 unspecified).
23444 <li> catanh(NaN + iNaN) returns NaN + iNaN.
23445 </ul>
23447 <h5><a name="G.6.2.4" href="#G.6.2.4">G.6.2.4 The ccosh functions</a></h5>
23448 <p><!--para 1 -->
23449 <ul>
23450 <li> ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
23451 <li> ccosh(+0 + i0) returns 1 + i0.
23452 <li> ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
23453 result is unspecified) and raises the ''invalid'' floating-point exception.
23454 <li> ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
23455 result is unspecified).
23456 <li> ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
23457 exception, for finite nonzero x.
23458 <li> ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23459 point exception, for finite nonzero x.
23460 <li> ccosh(+(inf) + i0) returns +(inf) + i0.
23461 <li> ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
23462 <li> ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
23463 unspecified) and raises the ''invalid'' floating-point exception.
23464 <li> ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
23465 <li> ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
23466 result is unspecified).
23467 <li> ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23468 point exception, for all nonzero numbers y.
23469 <li> ccosh(NaN + iNaN) returns NaN + iNaN.
23470 </ul>
23472 <h5><a name="G.6.2.5" href="#G.6.2.5">G.6.2.5 The csinh functions</a></h5>
23473 <p><!--para 1 -->
23474 <ul>
23475 <li> csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
23476 <li> csinh(+0 + i0) returns +0 + i0.
23477 <li> csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
23478 unspecified) and raises the ''invalid'' floating-point exception.
23479 <li> csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
23480 unspecified).
23481 <!--page 489 -->
23482 <li> csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
23483 exception, for positive finite x.
23484 <li> csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23485 point exception, for finite nonzero x.
23486 <li> csinh(+(inf) + i0) returns +(inf) + i0.
23487 <li> csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
23488 <li> csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
23489 unspecified) and raises the ''invalid'' floating-point exception.
23490 <li> csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
23491 is unspecified).
23492 <li> csinh(NaN + i0) returns NaN + i0.
23493 <li> csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23494 point exception, for all nonzero numbers y.
23495 <li> csinh(NaN + iNaN) returns NaN + iNaN.
23496 </ul>
23498 <h5><a name="G.6.2.6" href="#G.6.2.6">G.6.2.6 The ctanh functions</a></h5>
23499 <p><!--para 1 -->
23500 <ul>
23501 <li> ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
23502 <li> ctanh(+0 + i0) returns +0 + i0.
23503 <li> ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
23504 exception, for finite x.
23505 <li> ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23506 point exception, for finite x.
23507 <li> ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
23508 <li> ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
23509 is unspecified).
23510 <li> ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
23511 result is unspecified).
23512 <li> ctanh(NaN + i0) returns NaN + i0.
23513 <li> ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23514 point exception, for all nonzero numbers y.
23515 <li> ctanh(NaN + iNaN) returns NaN + iNaN.
23516 <!--page 490 -->
23517 </ul>
23519 <h4><a name="G.6.3" href="#G.6.3">G.6.3 Exponential and logarithmic functions</a></h4>
23521 <h5><a name="G.6.3.1" href="#G.6.3.1">G.6.3.1 The cexp functions</a></h5>
23522 <p><!--para 1 -->
23523 <ul>
23524 <li> cexp(conj(z)) = conj(cexp(z)).
23525 <li> cexp((+-)0 + i0) returns 1 + i0.
23526 <li> cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
23527 exception, for finite x.
23528 <li> cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23529 point exception, for finite x.
23530 <li> cexp(+(inf) + i0) returns +(inf) + i0.
23531 <li> cexp(-(inf) + iy) returns +0 cis(y), for finite y.
23532 <li> cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
23533 <li> cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
23534 the result are unspecified).
23535 <li> cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
23536 exception (where the sign of the real part of the result is unspecified).
23537 <li> cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
23538 of the result are unspecified).
23539 <li> cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
23540 is unspecified).
23541 <li> cexp(NaN + i0) returns NaN + i0.
23542 <li> cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23543 point exception, for all nonzero numbers y.
23544 <li> cexp(NaN + iNaN) returns NaN + iNaN.
23545 </ul>
23547 <h5><a name="G.6.3.2" href="#G.6.3.2">G.6.3.2 The clog functions</a></h5>
23548 <p><!--para 1 -->
23549 <ul>
23550 <li> clog(conj(z)) = conj(clog(z)).
23551 <li> clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
23552 exception.
23553 <li> clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
23554 exception.
23555 <li> clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
23556 <li> clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23557 point exception, for finite x.
23558 <!--page 491 -->
23559 <li> clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
23560 <li> clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
23561 <li> clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
23562 <li> clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
23563 <li> clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
23564 <li> clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23565 point exception, for finite y.
23566 <li> clog(NaN + i (inf)) returns +(inf) + iNaN.
23567 <li> clog(NaN + iNaN) returns NaN + iNaN.
23568 </ul>
23570 <h4><a name="G.6.4" href="#G.6.4">G.6.4 Power and absolute-value functions</a></h4>
23572 <h5><a name="G.6.4.1" href="#G.6.4.1">G.6.4.1 The cpow functions</a></h5>
23573 <p><!--para 1 -->
23574 The cpow functions raise floating-point exceptions if appropriate for the calculation of
23575 the parts of the result, and may raise spurious exceptions.<sup><a href="#note327"><b>327)</b></a></sup>
23577 <h6>footnotes</h6>
23578 <p><small><a name="note327" href="#note327">327)</a> This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
23579 implementations that treat special cases more carefully.
23580 </small>
23582 <h5><a name="G.6.4.2" href="#G.6.4.2">G.6.4.2 The csqrt functions</a></h5>
23583 <p><!--para 1 -->
23584 <ul>
23585 <li> csqrt(conj(z)) = conj(csqrt(z)).
23586 <li> csqrt((+-)0 + i0) returns +0 + i0.
23587 <li> csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
23588 <li> csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23589 point exception, for finite x.
23590 <li> csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
23591 <li> csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
23592 <li> csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
23593 result is unspecified).
23594 <li> csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
23595 <li> csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
23596 point exception, for finite y.
23597 <li> csqrt(NaN + iNaN) returns NaN + iNaN.
23602 <!--page 492 -->
23603 </ul>
23605 <h3><a name="G.7" href="#G.7">G.7 Type-generic math <tgmath.h></a></h3>
23606 <p><!--para 1 -->
23607 Type-generic macros that accept complex arguments also accept imaginary arguments. If
23608 an argument is imaginary, the macro expands to an expression whose type is real,
23609 imaginary, or complex, as appropriate for the particular function: if the argument is
23610 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
23611 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
23612 the types of the others are complex.
23613 <p><!--para 2 -->
23614 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
23615 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
23616 functions:
23617 <!--page 493 -->
23618 <pre>
23619 cos(iy) = cosh(y)
23620 sin(iy) = i sinh(y)
23621 tan(iy) = i tanh(y)
23622 cosh(iy) = cos(y)
23623 sinh(iy) = i sin(y)
23624 tanh(iy) = i tan(y)
23625 asin(iy) = i asinh(y)
23626 atan(iy) = i atanh(y)
23627 asinh(iy) = i asin(y)
23628 atanh(iy) = i atan(y)
23629 </pre>
23631 <h2><a name="H" href="#H">Annex H</a></h2>
23632 <pre>
23633 (informative)
23634 Language independent arithmetic
23635 </pre>
23637 <h3><a name="H.1" href="#H.1">H.1 Introduction</a></h3>
23638 <p><!--para 1 -->
23639 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
23640 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
23641 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
23643 <h3><a name="H.2" href="#H.2">H.2 Types</a></h3>
23644 <p><!--para 1 -->
23645 The relevant C arithmetic types meet the requirements of LIA-1 types if an
23646 implementation adds notification of exceptional arithmetic operations and meets the 1
23647 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
23649 <h4><a name="H.2.1" href="#H.2.1">H.2.1 Boolean type</a></h4>
23650 <p><!--para 1 -->
23651 The LIA-1 data type Boolean is implemented by the C data type bool with values of
23652 true and false, all from <a href="#7.16">&lt;stdbool.h&gt;</a>.
23654 <h4><a name="H.2.2" href="#H.2.2">H.2.2 Integer types</a></h4>
23655 <p><!--para 1 -->
23656 The signed C integer types int, long int, long long int, and the corresponding
23657 unsigned types are compatible with LIA-1. If an implementation adds support for the
23658 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
23659 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
23660 in that overflows or out-of-bounds results silently wrap. An implementation that defines
23661 signed integer types as also being modulo need not detect integer overflow, in which case,
23662 only integer divide-by-zero need be detected.
23663 <p><!--para 2 -->
23664 The parameters for the integer data types can be accessed by the following:
23665 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
23666 <pre>
23667 ULLONG_MAX
23668 </pre>
23669 minint INT_MIN, LONG_MIN, LLONG_MIN
23670 <p><!--para 3 -->
23671 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
23672 is always 0 for the unsigned types, and is not provided for those types.
23673 <!--page 494 -->
23675 <h5><a name="H.2.2.1" href="#H.2.2.1">H.2.2.1 Integer operations</a></h5>
23676 <p><!--para 1 -->
23677 The integer operations on integer types are the following:
23678 addI x + y
23679 subI x - y
23680 mulI x * y
23681 divI, divtI x / y
23682 remI, remtI x % y
23683 negI -x
23684 absI abs(x), labs(x), llabs(x)
23685 eqI x == y
23686 neqI x != y
23687 lssI x &lt; y
23688 leqI x &lt;= y
23689 gtrI x &gt; y
23690 geqI x &gt;= y
23691 where x and y are expressions of the same integer type.
23693 <h4><a name="H.2.3" href="#H.2.3">H.2.3 Floating-point types</a></h4>
23694 <p><!--para 1 -->
23695 The C floating-point types float, double, and long double are compatible with
23696 LIA-1. If an implementation adds support for the LIA-1 exceptional values
23697 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
23698 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
23699 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
23700 conformant types.
23702 <h5><a name="H.2.3.1" href="#H.2.3.1">H.2.3.1 Floating-point parameters</a></h5>
23703 <p><!--para 1 -->
23704 The parameters for a floating point data type can be accessed by the following:
23705 r FLT_RADIX
23706 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
23707 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
23708 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
23709 <p><!--para 2 -->
23710 The derived constants for the floating point types are accessed by the following:
23711 <!--page 495 -->
23712 fmax FLT_MAX, DBL_MAX, LDBL_MAX
23713 fminN FLT_MIN, DBL_MIN, LDBL_MIN
23714 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
23715 rnd_style FLT_ROUNDS
23717 <h5><a name="H.2.3.2" href="#H.2.3.2">H.2.3.2 Floating-point operations</a></h5>
23718 <p><!--para 1 -->
23719 The floating-point operations on floating-point types are the following:
23720 addF x + y
23721 subF x - y
23722 mulF x * y
23723 divF x / y
23724 negF -x
23725 absF fabsf(x), fabs(x), fabsl(x)
23726 exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
23727 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
23728 <pre>
23729 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
23730 </pre>
23731 intpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
23732 fractpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
23733 eqF x == y
23734 neqF x != y
23735 lssF x &lt; y
23736 leqF x &lt;= y
23737 gtrF x &gt; y
23738 geqF x &gt;= y
23739 where x and y are expressions of the same floating point type, n is of type int, and li
23740 is of type long int.
23742 <h5><a name="H.2.3.3" href="#H.2.3.3">H.2.3.3 Rounding styles</a></h5>
23743 <p><!--para 1 -->
23744 The C Standard requires all floating types to use the same radix and rounding style, so
23745 that only one identifier for each is provided to map to LIA-1.
23746 <p><!--para 2 -->
23747 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
23748 truncate FLT_ROUNDS == 0
23749 <!--page 496 -->
23750 nearest FLT_ROUNDS == 1
23751 other FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
23752 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
23753 in all relevant LIA-1 operations, not just addition as in C.
23755 <h4><a name="H.2.4" href="#H.2.4">H.2.4 Type conversions</a></h4>
23756 <p><!--para 1 -->
23757 The LIA-1 type conversions are the following type casts:
23758 cvtI' -&gt; I (int)i, (long int)i, (long long int)i,
23759 <pre>
23760 (unsigned int)i, (unsigned long int)i,
23761 (unsigned long long int)i
23762 </pre>
23763 cvtF -&gt; I (int)x, (long int)x, (long long int)x,
23764 <pre>
23765 (unsigned int)x, (unsigned long int)x,
23766 (unsigned long long int)x
23767 </pre>
23768 cvtI -&gt; F (float)i, (double)i, (long double)i
23769 cvtF' -&gt; F (float)x, (double)x, (long double)x
23770 <p><!--para 2 -->
23771 In the above conversions from floating to integer, the use of (cast)x can be replaced with
23772 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
23773 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
23774 conversion functions, lrint(), llrint(), lround(), and llround(), can be
23775 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
23776 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
23777 <p><!--para 3 -->
23778 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
23779 fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
23780 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
23781 to 65535.0 which can then be cast to unsigned short int. But, the
23782 remainder() function is not useful for doing silent wrapping to signed integer types,
23783 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
23784 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
23785 int.
23786 <p><!--para 4 -->
23787 C's conversions (casts) from floating-point to floating-point can meet LIA-1
23788 requirements if an implementation uses round-to-nearest (IEC 60559 default).
23789 <p><!--para 5 -->
23790 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
23791 implementation uses round-to-nearest.
23792 <!--page 497 -->
23794 <h3><a name="H.3" href="#H.3">H.3 Notification</a></h3>
23795 <p><!--para 1 -->
23796 Notification is the process by which a user or program is informed that an exceptional
23797 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
23798 allows an implementation to cause a notification to occur when any arithmetic operation
23799 returns an exceptional value as defined in LIA-1 clause 5.
23801 <h4><a name="H.3.1" href="#H.3.1">H.3.1 Notification alternatives</a></h4>
23802 <p><!--para 1 -->
23803 LIA-1 requires at least the following two alternatives for handling of notifications:
23804 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
23805 resume.
23806 <p><!--para 2 -->
23807 An implementation need only support a given notification alternative for the entire
23808 program. An implementation may support the ability to switch between notification
23809 alternatives during execution, but is not required to do so. An implementation can
23810 provide separate selection for each kind of notification, but this is not required.
23811 <p><!--para 3 -->
23812 C allows an implementation to provide notification. C's SIGFPE (for traps) and
23813 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
23814 can provide LIA-1 notification.
23815 <p><!--para 4 -->
23816 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
23817 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
23818 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
23819 and-resume behavior with the same constraint.
23821 <h5><a name="H.3.1.1" href="#H.3.1.1">H.3.1.1 Indicators</a></h5>
23822 <p><!--para 1 -->
23823 C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
23824 <p><!--para 2 -->
23825 The following mapping is for floating-point types:
23826 undefined FE_INVALID, FE_DIVBYZERO
23827 floating_overflow FE_OVERFLOW
23828 underflow FE_UNDERFLOW
23829 <p><!--para 3 -->
23830 The floating-point indicator interrogation and manipulation operations are:
23831 set_indicators feraiseexcept(i)
23832 clear_indicators feclearexcept(i)
23833 test_indicators fetestexcept(i)
23834 current_indicators fetestexcept(FE_ALL_EXCEPT)
23835 where i is an expression of type int representing a subset of the LIA-1 indicators.
23836 <p><!--para 4 -->
23837 C allows an implementation to provide the following LIA-1 required behavior: at
23838 program termination if any indicator is set the implementation shall send an unambiguous
23839 <!--page 498 -->
23840 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
23841 <p><!--para 5 -->
23842 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
23843 This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
23844 point indicators.
23846 <h5><a name="H.3.1.2" href="#H.3.1.2">H.3.1.2 Traps</a></h5>
23847 <p><!--para 1 -->
23848 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
23849 math library functions (which are not permitted to generate any externally visible
23850 exceptional conditions). An implementation can provide an alternative of notification
23851 through termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
23852 <p><!--para 2 -->
23853 LIA-1 does not require that traps be precise.
23854 <p><!--para 3 -->
23855 C does require that SIGFPE be the signal corresponding to arithmetic exceptions, if there
23856 is any signal raised for them.
23857 <p><!--para 4 -->
23858 C supports signal handlers for SIGFPE and allows trapping of arithmetic exceptions.
23859 When arithmetic exceptions do trap, C's signal-handler mechanism allows trap-and-
23860 terminate (either default implementation behavior or user replacement for it) or trap-and-
23861 resume, at the programmer's option.
23862 <!--page 499 -->
23864 <h2><a name="I" href="#I">Annex I</a></h2>
23865 <p><!--para 1 -->
23866 <pre>
23867 (informative)
23868 Common warnings
23869 </pre>
23870 An implementation may generate warnings in many situations, none of which are
23871 specified as part of this International Standard. The following are a few of the more
23872 common situations.
23873 <p><!--para 2 -->
23874 <ul>
23875 <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>).
23876 <li> A block with initialization of an object that has automatic storage duration is jumped
23877 into (<a href="#6.2.4">6.2.4</a>).
23878 <li> An implicit narrowing conversion is encountered, such as the assignment of a long
23879 int or a double to an int, or a pointer to void to a pointer to any type other than
23880 a character type (<a href="#6.3">6.3</a>).
23881 <li> A hexadecimal floating constant cannot be represented exactly in its evaluation format
23882 (<a href="#6.4.4.2">6.4.4.2</a>).
23883 <li> An integer character constant includes more than one character or a wide character
23884 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
23885 <li> The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
23886 <li> An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
23887 lvalue in one operand, and a side effect to, or an access to the value of, the identical
23888 lvalue in the other operand (<a href="#6.5">6.5</a>).
23889 <li> A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
23890 <li> The arguments in a function call do not agree in number and type with those of the
23891 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
23892 <li> An object is defined but not used (<a href="#6.7">6.7</a>).
23893 <li> A value is given to an object of an enumerated type other than by assignment of an
23894 enumeration constant that is a member of that type, or an enumeration object that has
23895 the same type, or the value of a function that returns the same enumerated type
23896 (<a href="#6.7.2.2">6.7.2.2</a>).
23897 <li> An aggregate has a partly bracketed initialization (<a href="#6.7.7">6.7.7</a>).
23898 <li> A statement cannot be reached (<a href="#6.8">6.8</a>).
23899 <li> A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
23900 <li> A constant expression is used as the controlling expression of a selection statement
23901 (<a href="#6.8.4">6.8.4</a>).
23902 <!--page 500 -->
23903 <li> An incorrectly formed preprocessing group is encountered while skipping a
23904 preprocessing group (<a href="#6.10.1">6.10.1</a>).
23905 <li> An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
23906 <!--page 501 -->
23907 </ul>
23909 <h2><a name="J" href="#J">Annex J</a></h2>
23910 <p><!--para 1 -->
23911 <pre>
23912 (informative)
23913 Portability issues
23914 </pre>
23915 This annex collects some information about portability that appears in this International
23916 Standard.
23918 <h3><a name="J.1" href="#J.1">J.1 Unspecified behavior</a></h3>
23919 <p><!--para 1 -->
23920 The following are unspecified:
23921 <ul>
23922 <li> The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
23923 <li> The termination status returned to the hosted environment if the return type of main
23924 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
23925 <li> The behavior of the display device if a printing character is written when the active
23926 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
23927 <li> The behavior of the display device if a backspace character is written when the active
23928 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
23929 <li> The behavior of the display device if a horizontal tab character is written when the
23930 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
23931 <li> The behavior of the display device if a vertical tab character is written when the active
23932 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
23933 <li> How an extended source character that does not correspond to a universal character
23934 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
23935 <li> Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
23936 <li> The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
23937 <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>).
23938 <li> The representation used when storing a value in an object that has more than one
23939 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
23940 <li> The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
23941 <li> Whether certain operators can generate negative zeros and whether a negative zero
23942 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
23943 <li> Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
23944 <li> The order in which subexpressions are evaluated and the order in which side effects
23945 take place, except as specified for the function-call (), &amp;&amp;, ||, ?:, and comma
23946 operators (<a href="#6.5">6.5</a>).
23947 <!--page 502 -->
23948 <li> The order in which the function designator, arguments, and subexpressions within the
23949 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
23950 <li> The order of side effects among compound literal initialization list expressions
23951 (<a href="#6.5.2.5">6.5.2.5</a>).
23952 <li> The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
23953 <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>).
23954 <li> Whether a call to an inline function uses the inline definition or the external definition
23955 of the function (<a href="#6.7.4">6.7.4</a>).
23956 <li> Whether or not a size expression is evaluated when it is part of the operand of a
23957 sizeof operator and changing the value of the size expression would not affect the
23958 result of the operator (<a href="#6.7.5.2">6.7.5.2</a>).
23959 <li> The order in which any side effects occur among the initialization list expressions in
23960 an initializer (<a href="#6.7.8">6.7.8</a>).
23961 <li> The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
23962 <li> When a fully expanded macro replacement list contains a function-like macro name
23963 as its last preprocessing token and the next preprocessing token from the source file is
23964 a (, and the fully expanded replacement of that macro ends with the name of the first
23965 macro and the next preprocessing token from the source file is again a (, whether that
23966 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
23967 <li> The order in which # and ## operations are evaluated during macro substitution
23968 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
23969 <li> Whether errno is a macro or an identifier with external linkage (<a href="#7.5">7.5</a>).
23970 <li> The state of the floating-point status flags when execution passes from a part of the
23971 program translated with FENV_ACCESS ''off'' to a part translated with
23972 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
23973 <li> The order in which feraiseexcept raises floating-point exceptions, except as
23974 stated in <a href="#F.7.6">F.7.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
23975 <li> Whether math_errhandling is a macro or an identifier with external linkage
23976 (<a href="#7.12">7.12</a>).
23977 <li> The results of the frexp functions when the specified value is not a floating-point
23978 number (<a href="#7.12.6.4">7.12.6.4</a>).
23979 <li> The numeric result of the ilogb functions when the correct value is outside the
23980 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>).
23981 <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>).
23982 <!--page 503 -->
23983 <li> The value stored by the remquo functions in the object pointed to by quo when y is
23984 zero (<a href="#7.12.10.3">7.12.10.3</a>).
23985 <li> Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
23986 <li> Whether va_copy and va_end are macros or identifiers with external linkage
23987 (<a href="#7.15.1">7.15.1</a>).
23988 <li> The hexadecimal digit before the decimal point when a non-normalized floating-point
23989 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>).
23990 <li> The value of the file position indicator after a successful call to the ungetc function
23991 for a text stream, or the ungetwc function for any stream, until all pushed-back
23992 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>).
23993 <li> The details of the value stored by the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>).
23994 <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>).
23995 <li> Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
23996 functions convert a minus-signed sequence to a negative number directly or by
23997 negating the value resulting from converting the corresponding unsigned sequence
23998 (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
23999 <li> The order and contiguity of storage allocated by successive calls to the calloc,
24000 malloc, and realloc functions (<a href="#7.20.3">7.20.3</a>).
24001 <li> The amount of storage allocated by a successful call to the calloc, malloc, or
24002 realloc function when 0 bytes was requested (<a href="#7.20.3">7.20.3</a>).
24003 <li> Which of two elements that compare as equal is matched by the bsearch function
24004 (<a href="#7.20.5.1">7.20.5.1</a>).
24005 <li> The order of two elements that compare as equal in an array sorted by the qsort
24006 function (<a href="#7.20.5.2">7.20.5.2</a>).
24007 <li> The encoding of the calendar time returned by the time function (<a href="#7.23.2.4">7.23.2.4</a>).
24008 <li> The characters stored by the strftime or wcsftime function if any of the time
24009 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>).
24010 <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>,
24011 <a href="#7.24.6.4.2">7.24.6.4.2</a>,
24012 <li> The resulting value when the ''invalid'' floating-point exception is raised during
24013 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
24014 <li> Whether conversion of non-integer IEC 60559 floating values to integer raises the
24015 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
24016 <!--page 504 -->
24017 <li> Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
24018 exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
24019 <li> Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
24020 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
24021 <li> The exponent value stored by frexp for a NaN or infinity (<a href="#F.9.3.4">F.9.3.4</a>).
24022 <li> The numeric result returned by the lrint, llrint, lround, and llround
24023 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>).
24024 <li> The sign of one part of the complex result of several math functions for certain
24025 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>,
24026 <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>).
24027 </ul>
24029 <h3><a name="J.2" href="#J.2">J.2 Undefined behavior</a></h3>
24030 <p><!--para 1 -->
24031 The behavior is undefined in the following circumstances:
24032 <ul>
24033 <li> A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
24034 (clause 4).
24035 <li> A nonempty source file does not end in a new-line character which is not immediately
24036 preceded by a backslash character or ends in a partial preprocessing token or
24037 comment (<a href="#5.1.1.2">5.1.1.2</a>).
24038 <li> Token concatenation produces a character sequence matching the syntax of a
24039 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
24040 <li> A program in a hosted environment does not define a function named main using one
24041 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
24042 <li> A character not in the basic source character set is encountered in a source file, except
24043 in an identifier, a character constant, a string literal, a header name, a comment, or a
24044 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
24045 <li> An identifier, comment, string literal, character constant, or header name contains an
24046 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>).
24047 <li> The same identifier has both internal and external linkage in the same translation unit
24048 (<a href="#6.2.2">6.2.2</a>).
24049 <li> An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
24050 <li> The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
24051 <li> The value of an object with automatic storage duration is used while it is
24052 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>).
24053 <li> A trap representation is read by an lvalue expression that does not have character type
24054 (<a href="#6.2.6.1">6.2.6.1</a>).
24055 <!--page 505 -->
24056 <li> A trap representation is produced by a side effect that modifies any part of the object
24057 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
24058 <li> The arguments to certain operators are such that could produce a negative zero result,
24059 but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
24060 <li> Two declarations of the same object or function specify types that are not compatible
24061 (<a href="#6.2.7">6.2.7</a>).
24062 <li> Conversion to or from an integer type produces a value outside the range that can be
24063 represented (<a href="#6.3.1.4">6.3.1.4</a>).
24064 <li> Demotion of one real floating type to another produces a value outside the range that
24065 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
24066 <li> An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
24067 <li> A non-array lvalue with an incomplete type is used in a context that requires the value
24068 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
24069 <li> An lvalue having array type is converted to a pointer to the initial element of the
24070 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
24071 <li> An attempt is made to use the value of a void expression, or an implicit or explicit
24072 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
24073 <li> Conversion of a pointer to an integer type produces a value outside the range that can
24074 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
24075 <li> Conversion between two pointer types produces a result that is incorrectly aligned
24076 (<a href="#6.3.2.3">6.3.2.3</a>).
24077 <li> A pointer is used to call a function whose type is not compatible with the pointed-to
24078 type (<a href="#6.3.2.3">6.3.2.3</a>).
24079 <li> An unmatched ' or " character is encountered on a logical source line during
24080 tokenization (<a href="#6.4">6.4</a>).
24081 <li> A reserved keyword token is used in translation phase 7 or 8 for some purpose other
24082 than as a keyword (<a href="#6.4.1">6.4.1</a>).
24083 <li> A universal character name in an identifier does not designate a character whose
24084 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
24085 <li> The initial character of an identifier is a universal character name designating a digit
24086 (<a href="#6.4.2.1">6.4.2.1</a>).
24087 <li> Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
24088 <li> The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
24089 <!--page 506 -->
24090 <li> The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
24091 <li> The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
24092 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
24093 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
24094 <li> Between two sequence points, an object is modified more than once, or is modified
24095 and the prior value is read other than to determine the value to be stored (<a href="#6.5">6.5</a>).
24096 <li> An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
24097 <li> An object has its stored value accessed other than by an lvalue of an allowable type
24098 (<a href="#6.5">6.5</a>).
24099 <li> An attempt is made to modify the result of a function call, a conditional operator, an
24100 assignment operator, or a comma operator, or to access it after the next sequence
24101 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>).
24102 <li> For a call to a function without a function prototype in scope, the number of
24103 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
24104 <li> For call to a function without a function prototype in scope where the function is
24105 defined with a function prototype, either the prototype ends with an ellipsis or the
24106 types of the arguments after promotion are not compatible with the types of the
24107 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
24108 <li> For a call to a function without a function prototype in scope where the function is not
24109 defined with a function prototype, the types of the arguments after promotion are not
24110 compatible with those of the parameters after promotion (with certain exceptions)
24111 (<a href="#6.5.2.2">6.5.2.2</a>).
24112 <li> A function is defined with a type that is not compatible with the type (of the
24113 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
24114 <li> The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
24115 <li> A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
24116 <li> The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
24117 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
24118 integer type produces a result that does not point into, or just beyond, the same array
24119 object (<a href="#6.5.6">6.5.6</a>).
24120 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
24121 integer type produces a result that points just beyond the array object and is used as
24122 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
24123 <li> Pointers that do not point into, or just beyond, the same array object are subtracted
24124 (<a href="#6.5.6">6.5.6</a>).
24125 <!--page 507 -->
24126 <li> An array subscript is out of range, even if an object is apparently accessible with the
24127 given subscript (as in the lvalue expression a[1][7] given the declaration int
24128 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
24129 <li> The result of subtracting two pointers is not representable in an object of type
24130 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
24131 <li> An expression is shifted by a negative number or by an amount greater than or equal
24132 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
24133 <li> An expression having signed promoted type is left-shifted and either the value of the
24134 expression is negative or the result of shifting would be not be representable in the
24135 promoted type (<a href="#6.5.7">6.5.7</a>).
24136 <li> Pointers that do not point to the same aggregate or union (nor just beyond the same
24137 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
24138 <li> An object is assigned to an inexactly overlapping object or to an exactly overlapping
24139 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
24140 <li> An expression that is required to be an integer constant expression does not have an
24141 integer type; has operands that are not integer constants, enumeration constants,
24142 character constants, sizeof expressions whose results are integer constants, or
24143 immediately-cast floating constants; or contains casts (outside operands to sizeof
24144 operators) other than conversions of arithmetic types to integer types (<a href="#6.6">6.6</a>).
24145 <li> A constant expression in an initializer is not, or does not evaluate to, one of the
24146 following: an arithmetic constant expression, a null pointer constant, an address
24147 constant, or an address constant for an object type plus or minus an integer constant
24148 expression (<a href="#6.6">6.6</a>).
24149 <li> An arithmetic constant expression does not have arithmetic type; has operands that
24150 are not integer constants, floating constants, enumeration constants, character
24151 constants, or sizeof expressions; or contains casts (outside operands to sizeof
24152 operators) other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
24153 <li> The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
24154 address &amp;, or indirection * operator or a pointer cast in creating an address constant
24155 (<a href="#6.6">6.6</a>).
24156 <li> An identifier for an object is declared with no linkage and the type of the object is
24157 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
24158 <li> A function is declared at block scope with an explicit storage-class specifier other
24159 than extern (<a href="#6.7.1">6.7.1</a>).
24160 <li> A structure or union is defined as containing no named members (<a href="#6.7.2.1">6.7.2.1</a>).
24161 <!--page 508 -->
24162 <li> An attempt is made to access, or generate a pointer to just past, a flexible array
24163 member of a structure when the referenced object provides no elements for that array
24164 (<a href="#6.7.2.1">6.7.2.1</a>).
24165 <li> When the complete type is needed, an incomplete structure or union type is not
24166 completed in the same scope by another declaration of the tag that defines the content
24167 (<a href="#6.7.2.3">6.7.2.3</a>).
24168 <li> An attempt is made to modify an object defined with a const-qualified type through
24169 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
24170 <li> An attempt is made to refer to an object defined with a volatile-qualified type through
24171 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
24172 <li> The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
24173 <li> Two qualified types that are required to be compatible do not have the identically
24174 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
24175 <li> An object which has been modified is accessed through a restrict-qualified pointer to
24176 a const-qualified type, or through a restrict-qualified pointer and another pointer that
24177 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
24178 <li> A restrict-qualified pointer is assigned a value based on another restricted pointer
24179 whose associated block neither began execution before the block associated with this
24180 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
24181 <li> A function with external linkage is declared with an inline function specifier, but is
24182 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
24183 <li> Two pointer types that are required to be compatible are not identically qualified, or
24184 are not pointers to compatible types (<a href="#6.7.5.1">6.7.5.1</a>).
24185 <li> The size expression in an array declaration is not a constant expression and evaluates
24186 at program execution time to a nonpositive value (<a href="#6.7.5.2">6.7.5.2</a>).
24187 <li> In a context requiring two array types to be compatible, they do not have compatible
24188 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.5.2">6.7.5.2</a>).
24189 <li> A declaration of an array parameter includes the keyword static within the [ and
24190 ] and the corresponding argument does not provide access to the first element of an
24191 array with at least the specified number of elements (<a href="#6.7.5.3">6.7.5.3</a>).
24192 <li> A storage-class specifier or type qualifier modifies the keyword void as a function
24193 parameter type list (<a href="#6.7.5.3">6.7.5.3</a>).
24194 <li> In a context requiring two function types to be compatible, they do not have
24195 compatible return types, or their parameters disagree in use of the ellipsis terminator
24196 or the number and type of parameters (after default argument promotion, when there
24197 is no parameter type list or when one type is specified by a function definition with an
24198 <!--page 509 -->
24199 identifier list) (<a href="#6.7.5.3">6.7.5.3</a>).
24200 <li> The value of an unnamed member of a structure or union is used (<a href="#6.7.8">6.7.8</a>).
24201 <li> The initializer for a scalar is neither a single expression nor a single expression
24202 enclosed in braces (<a href="#6.7.8">6.7.8</a>).
24203 <li> The initializer for a structure or union object that has automatic storage duration is
24204 neither an initializer list nor a single expression that has compatible structure or union
24205 type (<a href="#6.7.8">6.7.8</a>).
24206 <li> The initializer for an aggregate or union, other than an array initialized by a string
24207 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.8">6.7.8</a>).
24208 <li> An identifier with external linkage is used, but in the program there does not exist
24209 exactly one external definition for the identifier, or the identifier is not used and there
24210 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
24211 <li> A function definition includes an identifier list, but the types of the parameters are not
24212 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
24213 <li> An adjusted parameter type in a function definition is not an object type (<a href="#6.9.1">6.9.1</a>).
24214 <li> A function that accepts a variable number of arguments is defined without a
24215 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
24216 <li> The } that terminates a function is reached, and the value of the function call is used
24217 by the caller (<a href="#6.9.1">6.9.1</a>).
24218 <li> An identifier for an object with internal linkage and an incomplete type is declared
24219 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
24220 <li> The token defined is generated during the expansion of a #if or #elif
24221 preprocessing directive, or the use of the defined unary operator does not match
24222 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
24223 <li> The #include preprocessing directive that results after expansion does not match
24224 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
24225 <li> The character sequence in an #include preprocessing directive does not start with a
24226 letter (<a href="#6.10.2">6.10.2</a>).
24227 <li> There are sequences of preprocessing tokens within the list of macro arguments that
24228 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
24229 <li> The result of the preprocessing operator # is not a valid character string literal
24230 (<a href="#6.10.3.2">6.10.3.2</a>).
24231 <li> The result of the preprocessing operator ## is not a valid preprocessing token
24232 (<a href="#6.10.3.3">6.10.3.3</a>).
24233 <!--page 510 -->
24234 <li> The #line preprocessing directive that results after expansion does not match one of
24235 the two well-defined forms, or its digit sequence specifies zero or a number greater
24236 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
24237 <li> A non-STDC #pragma preprocessing directive that is documented as causing
24238 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
24239 <li> A #pragma STDC preprocessing directive does not match one of the well-defined
24240 forms (<a href="#6.10.6">6.10.6</a>).
24241 <li> The name of a predefined macro, or the identifier defined, is the subject of a
24242 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
24243 <li> An attempt is made to copy an object to an overlapping object by use of a library
24244 function, other than as explicitly allowed (e.g., memmove) (clause 7).
24245 <li> A file with the same name as one of the standard headers, not provided as part of the
24246 implementation, is placed in any of the standard places that are searched for included
24247 source files (<a href="#7.1.2">7.1.2</a>).
24248 <li> A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
24249 <li> A function, object, type, or macro that is specified as being declared or defined by
24250 some standard header is used before any header that declares or defines it is included
24251 (<a href="#7.1.2">7.1.2</a>).
24252 <li> A standard header is included while a macro is defined with the same name as a
24253 keyword (<a href="#7.1.2">7.1.2</a>).
24254 <li> The program attempts to declare a library function itself, rather than via a standard
24255 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
24256 <li> The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
24257 (<a href="#7.1.3">7.1.3</a>).
24258 <li> The program removes the definition of a macro whose name begins with an
24259 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
24260 <li> An argument to a library function has an invalid value or a type not expected by a
24261 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
24262 <li> The pointer passed to a library function array parameter does not have a value such
24263 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
24264 <li> The macro definition of assert is suppressed in order to access an actual function
24265 (<a href="#7.2">7.2</a>).
24266 <li> The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
24267 <li> The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
24268 any context other than outside all external declarations or preceding all explicit
24269 <!--page 511 -->
24270 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>).
24271 <li> The value of an argument to a character handling function is neither equal to the value
24272 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
24273 <li> A macro definition of errno is suppressed in order to access an actual object, or the
24274 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
24275 <li> Part of the program tests floating-point status flags, sets floating-point control modes,
24276 or runs under non-default mode settings, but was translated with the state for the
24277 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
24278 <li> The exception-mask argument for one of the functions that provide access to the
24279 floating-point status flags has a nonzero value not obtained by bitwise OR of the
24280 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
24281 <li> The fesetexceptflag function is used to set floating-point status flags that were
24282 not specified in the call to the fegetexceptflag function that provided the value
24283 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
24284 <li> The argument to fesetenv or feupdateenv is neither an object set by a call to
24285 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>).
24286 <li> The value of the result of an integer arithmetic or conversion function cannot be
24287 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>).
24288 <li> The program modifies the string pointed to by the value returned by the setlocale
24289 function (<a href="#7.11.1.1">7.11.1.1</a>).
24290 <li> The program modifies the structure pointed to by the value returned by the
24291 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
24292 <li> A macro definition of math_errhandling is suppressed or the program defines
24293 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
24294 <li> An argument to a floating-point classification or comparison macro is not of real
24295 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
24296 <li> A macro definition of setjmp is suppressed in order to access an actual function, or
24297 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
24298 <li> An invocation of the setjmp macro occurs other than in an allowed context
24299 (<a href="#7.13.2.1">7.13.2.1</a>).
24300 <li> The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
24301 <li> After a longjmp, there is an attempt to access the value of an object of automatic
24302 storage class with non-volatile-qualified type, local to the function containing the
24303 invocation of the corresponding setjmp macro, that was changed between the
24304 setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
24305 <!--page 512 -->
24306 <li> The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
24307 <li> A signal handler returns when the signal corresponded to a computational exception
24308 (<a href="#7.14.1.1">7.14.1.1</a>).
24309 <li> A signal occurs as the result of calling the abort or raise function, and the signal
24310 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
24311 <li> A signal occurs other than as the result of calling the abort or raise function, and
24312 the signal handler refers to an object with static storage duration other than by
24313 assigning a value to an object declared as volatile sig_atomic_t, or calls any
24314 function in the standard library other than the abort function, the _Exit function,
24315 or the signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
24316 <li> The value of errno is referred to after a signal occurred other than as the result of
24317 calling the abort or raise function and the corresponding signal handler obtained
24318 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
24319 <li> A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
24320 <li> A function with a variable number of arguments attempts to access its varying
24321 arguments other than through a properly declared and initialized va_list object, or
24322 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>).
24323 <li> The macro va_arg is invoked using the parameter ap that was passed to a function
24324 that invoked the macro va_arg with the same parameter (<a href="#7.15">7.15</a>).
24325 <li> A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
24326 order to access an actual function, or the program defines an external identifier with
24327 the name va_copy or va_end (<a href="#7.15.1">7.15.1</a>).
24328 <li> The va_start or va_copy macro is invoked without a corresponding invocation
24329 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>,
24330 <a href="#7.15.1.4">7.15.1.4</a>).
24331 <li> The type parameter to the va_arg macro is not such that a pointer to an object of
24332 that type can be obtained simply by postfixing a * (<a href="#7.15.1.1">7.15.1.1</a>).
24333 <li> The va_arg macro is invoked when there is no actual next argument, or with a
24334 specified type that is not compatible with the promoted type of the actual next
24335 argument, with certain exceptions (<a href="#7.15.1.1">7.15.1.1</a>).
24336 <li> The va_copy or va_start macro is called to initialize a va_list that was
24337 previously initialized by either macro without an intervening invocation of the
24338 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>).
24339 <li> The parameter parmN of a va_start macro is declared with the register
24340 storage class, with a function or array type, or with a type that is not compatible with
24341 the type that results after application of the default argument promotions (<a href="#7.15.1.4">7.15.1.4</a>).
24342 <!--page 513 -->
24343 <li> The member designator parameter of an offsetof macro is an invalid right
24344 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.17">7.17</a>).
24345 <li> The argument in an instance of one of the integer-constant macros is not a decimal,
24346 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
24347 corresponding type (<a href="#7.18.4">7.18.4</a>).
24348 <li> A byte input/output function is applied to a wide-oriented stream, or a wide character
24349 input/output function is applied to a byte-oriented stream (<a href="#7.19.2">7.19.2</a>).
24350 <li> Use is made of any portion of a file beyond the most recent wide character written to
24351 a wide-oriented stream (<a href="#7.19.2">7.19.2</a>).
24352 <li> The value of a pointer to a FILE object is used after the associated file is closed
24353 (<a href="#7.19.3">7.19.3</a>).
24354 <li> The stream for the fflush function points to an input stream or to an update stream
24355 in which the most recent operation was input (<a href="#7.19.5.2">7.19.5.2</a>).
24356 <li> The string pointed to by the mode argument in a call to the fopen function does not
24357 exactly match one of the specified character sequences (<a href="#7.19.5.3">7.19.5.3</a>).
24358 <li> An output operation on an update stream is followed by an input operation without an
24359 intervening call to the fflush function or a file positioning function, or an input
24360 operation on an update stream is followed by an output operation with an intervening
24361 call to a file positioning function (<a href="#7.19.5.3">7.19.5.3</a>).
24362 <li> An attempt is made to use the contents of the array that was supplied in a call to the
24363 setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
24364 <li> There are insufficient arguments for the format in a call to one of the formatted
24365 input/output functions, or an argument does not have an appropriate type (<a href="#7.19.6.1">7.19.6.1</a>,
24366 <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>).
24367 <li> The format in a call to one of the formatted input/output functions or to the
24368 strftime or wcsftime function is not a valid multibyte character sequence that
24369 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>,
24370 <a href="#7.24.5.1">7.24.5.1</a>).
24371 <li> In a call to one of the formatted output functions, a precision appears with a
24372 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>).
24373 <li> A conversion specification for a formatted output function uses an asterisk to denote
24374 an argument-supplied field width or precision, but the corresponding argument is not
24375 provided (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
24376 <li> A conversion specification for a formatted output function uses a # or 0 flag with a
24377 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>).
24378 <!--page 514 -->
24379 <li> A conversion specification for one of the formatted input/output functions uses a
24380 length modifier with a conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>,
24381 <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>).
24382 <li> An s conversion specifier is encountered by one of the formatted output functions,
24383 and the argument is missing the null terminator (unless a precision is specified that
24384 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>).
24385 <li> An n conversion specification for one of the formatted input/output functions includes
24386 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.19.6.1">7.19.6.1</a>,
24387 <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>).
24388 <li> A % conversion specifier is encountered by one of the formatted input/output
24389 functions, but the complete conversion specification is not exactly %% (<a href="#7.19.6.1">7.19.6.1</a>,
24390 <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>).
24391 <li> An invalid conversion specification is found in the format for one of the formatted
24392 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>,
24393 <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>).
24394 <li> The number of characters transmitted by a formatted output function is greater than
24395 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>).
24396 <li> The result of a conversion by one of the formatted input functions cannot be
24397 represented in the corresponding object, or the receiving object does not have an
24398 appropriate type (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
24399 <li> A c, s, or [ conversion specifier is encountered by one of the formatted input
24400 functions, and the array pointed to by the corresponding argument is not large enough
24401 to accept the input sequence (and a null terminator if the conversion specifier is s or
24402 [) (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
24403 <li> A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
24404 formatted input functions, but the input is not a valid multibyte character sequence
24405 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>).
24406 <li> The input item for a %p conversion by one of the formatted input functions is not a
24407 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>).
24408 <li> The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
24409 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
24410 vwscanf function is called with an improperly initialized va_list argument, or
24411 the argument is used (other than in an invocation of va_end) after the function
24412 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>,
24413 <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>).
24414 <li> The contents of the array supplied in a call to the fgets, gets, or fgetws function
24415 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>).
24416 <!--page 515 -->
24417 <li> The file position indicator for a binary stream is used after a call to the ungetc
24418 function where its value was zero before the call (<a href="#7.19.7.11">7.19.7.11</a>).
24419 <li> The file position indicator for a stream is used after an error occurred during a call to
24420 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>).
24421 <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>).
24422 <li> The fseek function is called for a text stream with a nonzero offset and either the
24423 offset was not returned by a previous successful call to the ftell function on a
24424 stream associated with the same file or whence is not SEEK_SET (<a href="#7.19.9.2">7.19.9.2</a>).
24425 <li> The fsetpos function is called to set a position that was not returned by a previous
24426 successful call to the fgetpos function on a stream associated with the same file
24427 (<a href="#7.19.9.3">7.19.9.3</a>).
24428 <li> A non-null pointer returned by a call to the calloc, malloc, or realloc function
24429 with a zero requested size is used to access an object (<a href="#7.20.3">7.20.3</a>).
24430 <li> The value of a pointer that refers to space deallocated by a call to the free or
24431 realloc function is used (<a href="#7.20.3">7.20.3</a>).
24432 <li> The pointer argument to the free or realloc function does not match a pointer
24433 earlier returned by calloc, malloc, or realloc, or the space has been
24434 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>).
24435 <li> The value of the object allocated by the malloc function is used (<a href="#7.20.3.3">7.20.3.3</a>).
24436 <li> The value of any bytes in a new object allocated by the realloc function beyond
24437 the size of the old object are used (<a href="#7.20.3.4">7.20.3.4</a>).
24438 <li> The program executes more than one call to the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
24439 <li> During the call to a function registered with the atexit function, a call is made to
24440 the longjmp function that would terminate the call to the registered function
24441 (<a href="#7.20.4.3">7.20.4.3</a>).
24442 <li> The string set up by the getenv or strerror function is modified by the program
24443 (<a href="#7.20.4.5">7.20.4.5</a>, <a href="#7.21.6.2">7.21.6.2</a>).
24444 <li> A command is executed through the system function in a way that is documented as
24445 causing termination or some other form of undefined behavior (<a href="#7.20.4.6">7.20.4.6</a>).
24446 <li> A searching or sorting utility function is called with an invalid pointer argument, even
24447 if the number of elements is zero (<a href="#7.20.5">7.20.5</a>).
24448 <li> The comparison function called by a searching or sorting utility function alters the
24449 contents of the array being searched or sorted, or returns ordering values
24450 inconsistently (<a href="#7.20.5">7.20.5</a>).
24451 <!--page 516 -->
24452 <li> The array being searched by the bsearch function does not have its elements in
24453 proper order (<a href="#7.20.5.1">7.20.5.1</a>).
24454 <li> The current conversion state is used by a multibyte/wide character conversion
24455 function after changing the LC_CTYPE category (<a href="#7.20.7">7.20.7</a>).
24456 <li> A string or wide string utility function is instructed to access an array beyond the end
24457 of an object (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
24458 <li> A string or wide string utility function is called with an invalid pointer argument, even
24459 if the length is zero (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
24460 <li> The contents of the destination array are used after a call to the strxfrm,
24461 strftime, wcsxfrm, or wcsftime function in which the specified length was
24462 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>,
24463 <a href="#7.24.5.1">7.24.5.1</a>).
24464 <li> The first argument in the very first call to the strtok or wcstok is a null pointer
24465 (<a href="#7.21.5.8">7.21.5.8</a>, <a href="#7.24.4.5.7">7.24.4.5.7</a>).
24466 <li> The type of an argument to a type-generic macro is not compatible with the type of
24467 the corresponding parameter of the selected function (<a href="#7.22">7.22</a>).
24468 <li> A complex argument is supplied for a generic parameter of a type-generic macro that
24469 has no corresponding complex function (<a href="#7.22">7.22</a>).
24470 <li> The argument corresponding to an s specifier without an l qualifier in a call to the
24471 fwprintf function does not point to a valid multibyte character sequence that
24472 begins in the initial shift state (<a href="#7.24.2.11">7.24.2.11</a>).
24473 <li> In a call to the wcstok function, the object pointed to by ptr does not have the
24474 value stored by the previous call for the same wide string (<a href="#7.24.4.5.7">7.24.4.5.7</a>).
24475 <li> An mbstate_t object is used inappropriately (<a href="#7.24.6">7.24.6</a>).
24476 <li> The value of an argument of type wint_t to a wide character classification or case
24477 mapping function is neither equal to the value of WEOF nor representable as a
24478 wchar_t (<a href="#7.25.1">7.25.1</a>).
24479 <li> The iswctype function is called using a different LC_CTYPE category from the
24480 one in effect for the call to the wctype function that returned the description
24481 (<a href="#7.25.2.2.1">7.25.2.2.1</a>).
24482 <li> The towctrans function is called using a different LC_CTYPE category from the
24483 one in effect for the call to the wctrans function that returned the description
24484 (<a href="#7.25.3.2.1">7.25.3.2.1</a>).
24485 <!--page 517 -->
24486 </ul>
24488 <h3><a name="J.3" href="#J.3">J.3 Implementation-defined behavior</a></h3>
24489 <p><!--para 1 -->
24490 A conforming implementation is required to document its choice of behavior in each of
24491 the areas listed in this subclause. The following are implementation-defined:
24493 <h4><a name="J.3.1" href="#J.3.1">J.3.1 Translation</a></h4>
24494 <p><!--para 1 -->
24495 <ul>
24496 <li> How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
24497 <li> Whether each nonempty sequence of white-space characters other than new-line is
24498 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
24499 </ul>
24501 <h4><a name="J.3.2" href="#J.3.2">J.3.2 Environment</a></h4>
24502 <p><!--para 1 -->
24503 <ul>
24504 <li> The mapping between physical source file multibyte characters and the source
24505 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
24506 <li> The name and type of the function called at program startup in a freestanding
24507 environment (<a href="#5.1.2.1">5.1.2.1</a>).
24508 <li> The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
24509 <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>).
24510 <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>).
24511 <li> What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
24512 <li> The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
24513 <li> Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
24514 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
24515 <li> Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
24516 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
24517 <li> The set of environment names and the method for altering the environment list used
24518 by the getenv function (<a href="#7.20.4.5">7.20.4.5</a>).
24519 <li> The manner of execution of the string by the system function (<a href="#7.20.4.6">7.20.4.6</a>).
24520 </ul>
24522 <h4><a name="J.3.3" href="#J.3.3">J.3.3 Identifiers</a></h4>
24523 <p><!--para 1 -->
24524 <ul>
24525 <li> Which additional multibyte characters may appear in identifiers and their
24526 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
24527 <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>).
24528 <!--page 518 -->
24529 </ul>
24531 <h4><a name="J.3.4" href="#J.3.4">J.3.4 Characters</a></h4>
24532 <p><!--para 1 -->
24533 <ul>
24534 <li> The number of bits in a byte (<a href="#3.6">3.6</a>).
24535 <li> The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
24536 <li> The unique value of the member of the execution character set produced for each of
24537 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
24538 <li> The value of a char object into which has been stored any character other than a
24539 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
24540 <li> Which of signed char or unsigned char has the same range, representation,
24541 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>).
24542 <li> The mapping of members of the source character set (in character constants and string
24543 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>).
24544 <li> The value of an integer character constant containing more than one character or
24545 containing a character or escape sequence that does not map to a single-byte
24546 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
24547 <li> The value of a wide character constant containing more than one multibyte character,
24548 or containing a multibyte character or escape sequence not represented in the
24549 extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
24550 <li> The current locale used to convert a wide character constant consisting of a single
24551 multibyte character that maps to a member of the extended execution character set
24552 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
24553 <li> The current locale used to convert a wide string literal into corresponding wide
24554 character codes (<a href="#6.4.5">6.4.5</a>).
24555 <li> The value of a string literal containing a multibyte character or escape sequence not
24556 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
24557 </ul>
24559 <h4><a name="J.3.5" href="#J.3.5">J.3.5 Integers</a></h4>
24560 <p><!--para 1 -->
24561 <ul>
24562 <li> Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
24563 <li> Whether signed integer types are represented using sign and magnitude, two's
24564 complement, or ones' complement, and whether the extraordinary value is a trap
24565 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
24566 <li> The rank of any extended integer type relative to another extended integer type with
24567 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
24568 <li> The result of, or the signal raised by, converting an integer to a signed integer type
24569 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
24570 <!--page 519 -->
24571 <li> The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
24572 </ul>
24574 <h4><a name="J.3.6" href="#J.3.6">J.3.6 Floating point</a></h4>
24575 <p><!--para 1 -->
24576 <ul>
24577 <li> The accuracy of the floating-point operations and of the library functions in
24578 <a href="#7.12">&lt;math.h&gt;</a> and <a href="#7.3">&lt;complex.h&gt;</a> that return floating-point results (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
24579 <li> The accuracy of the conversions between floating-point internal representations and
24580 string representations performed by the library functions in <a href="#7.19">&lt;stdio.h&gt;</a>,
24581 <a href="#7.20">&lt;stdlib.h&gt;</a>, and <a href="#7.24">&lt;wchar.h&gt;</a> (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
24582 <li> The rounding behaviors characterized by non-standard values of FLT_ROUNDS
24583 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
24584 <li> The evaluation methods characterized by non-standard negative values of
24585 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
24586 <li> The direction of rounding when an integer is converted to a floating-point number that
24587 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
24588 <li> The direction of rounding when a floating-point number is converted to a narrower
24589 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
24590 <li> How the nearest representable value or the larger or smaller representable value
24591 immediately adjacent to the nearest representable value is chosen for certain floating
24592 constants (<a href="#6.4.4.2">6.4.4.2</a>).
24593 <li> Whether and how floating expressions are contracted when not disallowed by the
24594 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
24595 <li> The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
24596 <li> Additional floating-point exceptions, rounding modes, environments, and
24597 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
24598 <li> The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>). *
24599 </ul>
24601 <h4><a name="J.3.7" href="#J.3.7">J.3.7 Arrays and pointers</a></h4>
24602 <p><!--para 1 -->
24603 <ul>
24604 <li> The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
24605 <li> The size of the result of subtracting two pointers to elements of the same array
24606 (<a href="#6.5.6">6.5.6</a>).
24607 <!--page 520 -->
24608 </ul>
24610 <h4><a name="J.3.8" href="#J.3.8">J.3.8 Hints</a></h4>
24611 <p><!--para 1 -->
24612 <ul>
24613 <li> The extent to which suggestions made by using the register storage-class
24614 specifier are effective (<a href="#6.7.1">6.7.1</a>).
24615 <li> The extent to which suggestions made by using the inline function specifier are
24616 effective (<a href="#6.7.4">6.7.4</a>).
24617 </ul>
24619 <h4><a name="J.3.9" href="#J.3.9">J.3.9 Structures, unions, enumerations, and bit-fields</a></h4>
24620 <p><!--para 1 -->
24621 <ul>
24622 <li> Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
24623 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
24624 <li> Allowable bit-field types other than _Bool, signed int, and unsigned int
24625 (<a href="#6.7.2.1">6.7.2.1</a>).
24626 <li> Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
24627 <li> The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
24628 <li> The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
24629 no problem unless binary data written by one implementation is read by another.
24630 <li> The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
24631 </ul>
24633 <h4><a name="J.3.10" href="#J.3.10">J.3.10 Qualifiers</a></h4>
24634 <p><!--para 1 -->
24635 <ul>
24636 <li> What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
24637 </ul>
24639 <h4><a name="J.3.11" href="#J.3.11">J.3.11 Preprocessing directives</a></h4>
24640 <p><!--para 1 -->
24641 <ul>
24642 <li> The locations within #pragma directives where header name preprocessing tokens
24643 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
24644 <li> How sequences in both forms of header names are mapped to headers or external
24645 source file names (<a href="#6.4.7">6.4.7</a>).
24646 <li> Whether the value of a character constant in a constant expression that controls
24647 conditional inclusion matches the value of the same character constant in the
24648 execution character set (<a href="#6.10.1">6.10.1</a>).
24649 <li> Whether the value of a single-character character constant in a constant expression
24650 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
24651 <li> The places that are searched for an included &lt; &gt; delimited header, and how the places
24652 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
24653 <li> How the named source file is searched for in an included " " delimited header
24654 (<a href="#6.10.2">6.10.2</a>).
24655 <li> The method by which preprocessing tokens (possibly resulting from macro
24656 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
24657 <!--page 521 -->
24658 <li> The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
24659 <li> Whether the # operator inserts a \ character before the \ character that begins a
24660 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
24661 <li> The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
24662 <li> The definitions for __DATE__ and __TIME__ when respectively, the date and
24663 time of translation are not available (<a href="#6.10.8">6.10.8</a>).
24664 </ul>
24666 <h4><a name="J.3.12" href="#J.3.12">J.3.12 Library functions</a></h4>
24667 <p><!--para 1 -->
24668 <ul>
24669 <li> Any library facilities available to a freestanding program, other than the minimal set
24670 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
24671 <li> The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
24672 <li> The representation of the floating-point status flags stored by the
24673 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
24674 <li> Whether the feraiseexcept function raises the ''inexact'' floating-point
24675 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
24676 (<a href="#7.6.2.3">7.6.2.3</a>).
24677 <li> Strings other than "C" and "" that may be passed as the second argument to the
24678 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
24679 <li> The types defined for float_t and double_t when the value of the
24680 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
24681 <li> Domain errors for the mathematics functions, other than those required by this
24682 International Standard (<a href="#7.12.1">7.12.1</a>).
24683 <li> The values returned by the mathematics functions on domain errors (<a href="#7.12.1">7.12.1</a>).
24684 <li> The values returned by the mathematics functions on underflow range errors, whether
24685 errno is set to the value of the macro ERANGE when the integer expression
24686 math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
24687 floating-point exception is raised when the integer expression math_errhandling
24688 &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
24689 <li> Whether a domain error occurs or zero is returned when an fmod function has a
24690 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
24691 <li> Whether a domain error occurs or zero is returned when a remainder function has
24692 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
24693 <li> The base-2 logarithm of the modulus used by the remquo functions in reducing the
24694 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
24695 <!--page 522 -->
24696 <li> Whether a domain error occurs or zero is returned when a remquo function has a
24697 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
24698 <li> Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
24699 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>).
24700 <li> The null pointer constant to which the macro NULL expands (<a href="#7.17">7.17</a>).
24701 <li> Whether the last line of a text stream requires a terminating new-line character
24702 (<a href="#7.19.2">7.19.2</a>).
24703 <li> Whether space characters that are written out to a text stream immediately before a
24704 new-line character appear when read in (<a href="#7.19.2">7.19.2</a>).
24705 <li> The number of null characters that may be appended to data written to a binary
24706 stream (<a href="#7.19.2">7.19.2</a>).
24707 <li> Whether the file position indicator of an append-mode stream is initially positioned at
24708 the beginning or end of the file (<a href="#7.19.3">7.19.3</a>).
24709 <li> Whether a write on a text stream causes the associated file to be truncated beyond that
24710 point (<a href="#7.19.3">7.19.3</a>).
24711 <li> The characteristics of file buffering (<a href="#7.19.3">7.19.3</a>).
24712 <li> Whether a zero-length file actually exists (<a href="#7.19.3">7.19.3</a>).
24713 <li> The rules for composing valid file names (<a href="#7.19.3">7.19.3</a>).
24714 <li> Whether the same file can be simultaneously open multiple times (<a href="#7.19.3">7.19.3</a>).
24715 <li> The nature and choice of encodings used for multibyte characters in files (<a href="#7.19.3">7.19.3</a>).
24716 <li> The effect of the remove function on an open file (<a href="#7.19.4.1">7.19.4.1</a>).
24717 <li> The effect if a file with the new name exists prior to a call to the rename function
24718 (<a href="#7.19.4.2">7.19.4.2</a>).
24719 <li> Whether an open temporary file is removed upon abnormal program termination
24720 (<a href="#7.19.4.3">7.19.4.3</a>).
24721 <li> Which changes of mode are permitted (if any), and under what circumstances
24722 (<a href="#7.19.5.4">7.19.5.4</a>).
24723 <li> The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
24724 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>).
24725 <li> The output for %p conversion in the fprintf or fwprintf function (<a href="#7.19.6.1">7.19.6.1</a>,
24726 <a href="#7.24.2.1">7.24.2.1</a>).
24727 <li> The interpretation of a - character that is neither the first nor the last character, nor
24728 the second where a ^ character is the first, in the scanlist for %[ conversion in the
24729 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>).
24730 <!--page 523 -->
24731 <li> The set of sequences matched by a %p conversion and the interpretation of the
24732 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>).
24733 <li> The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
24734 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>).
24735 <li> The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
24736 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
24737 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>).
24738 <li> Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
24739 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>).
24740 <li> Whether the calloc, malloc, and realloc functions return a null pointer or a
24741 pointer to an allocated object when the size requested is zero (<a href="#7.20.3">7.20.3</a>).
24742 <li> Whether open streams with unwritten buffered data are flushed, open streams are
24743 closed, or temporary files are removed when the abort or _Exit function is called
24744 (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.4">7.20.4.4</a>).
24745 <li> The termination status returned to the host environment by the abort, exit, or
24746 _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>).
24747 <li> The value returned by the system function when its argument is not a null pointer
24748 (<a href="#7.20.4.6">7.20.4.6</a>).
24749 <li> The local time zone and Daylight Saving Time (<a href="#7.23.1">7.23.1</a>).
24750 <li> The range and precision of times representable in clock_t and time_t (<a href="#7.23">7.23</a>).
24751 <li> The era for the clock function (<a href="#7.23.2.1">7.23.2.1</a>).
24752 <li> The replacement string for the %Z specifier to the strftime, and wcsftime
24753 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>).
24754 <li> Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
24755 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.9">F.9</a>).
24756 </ul>
24758 <h4><a name="J.3.13" href="#J.3.13">J.3.13 Architecture</a></h4>
24759 <p><!--para 1 -->
24760 <ul>
24761 <li> The values or expressions assigned to the macros specified in the headers
24762 <a href="#7.7">&lt;float.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, and <a href="#7.18">&lt;stdint.h&gt;</a> (<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>).
24763 <li> The number, order, and encoding of bytes in any object (when not explicitly specified
24764 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
24765 <li> The value of the result of the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>).
24766 <!--page 524 -->
24767 </ul>
24769 <h3><a name="J.4" href="#J.4">J.4 Locale-specific behavior</a></h3>
24770 <p><!--para 1 -->
24771 The following characteristics of a hosted environment are locale-specific and are required
24772 to be documented by the implementation:
24773 <ul>
24774 <li> Additional members of the source and execution character sets beyond the basic
24775 character set (<a href="#5.2.1">5.2.1</a>).
24776 <li> The presence, meaning, and representation of additional multibyte characters in the
24777 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
24778 <li> The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
24779 <li> The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
24780 <li> The decimal-point character (<a href="#7.1.1">7.1.1</a>).
24781 <li> The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
24782 <li> The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
24783 <li> The sets of characters tested for by the isalpha, isblank, islower, ispunct,
24784 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
24785 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>,
24786 <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>).
24787 <li> The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
24788 <li> Additional subject sequences accepted by the numeric conversion functions (<a href="#7.20.1">7.20.1</a>,
24789 <a href="#7.24.4.1">7.24.4.1</a>).
24790 <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>).
24791 <li> The contents of the error message strings set up by the strerror function
24792 (<a href="#7.21.6.2">7.21.6.2</a>).
24793 <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>).
24794 <li> Character mappings that are supported by the towctrans function (<a href="#7.25.1">7.25.1</a>).
24795 <li> Character classifications that are supported by the iswctype function (<a href="#7.25.1">7.25.1</a>).
24796 <!--page 525 -->
24797 </ul>
24799 <h3><a name="J.5" href="#J.5">J.5 Common extensions</a></h3>
24800 <p><!--para 1 -->
24801 The following extensions are widely used in many systems, but are not portable to all
24802 implementations. The inclusion of any extension that may cause a strictly conforming
24803 program to become invalid renders an implementation nonconforming. Examples of such
24804 extensions are new keywords, extra library functions declared in standard headers, or
24805 predefined macros with names that do not begin with an underscore.
24807 <h4><a name="J.5.1" href="#J.5.1">J.5.1 Environment arguments</a></h4>
24808 <p><!--para 1 -->
24809 In a hosted environment, the main function receives a third argument, char *envp[],
24810 that points to a null-terminated array of pointers to char, each of which points to a string
24811 that provides information about the environment for this execution of the program
24812 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
24814 <h4><a name="J.5.2" href="#J.5.2">J.5.2 Specialized identifiers</a></h4>
24815 <p><!--para 1 -->
24816 Characters other than the underscore _, letters, and digits, that are not part of the basic
24817 source character set (such as the dollar sign $, or characters in national character sets)
24818 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
24820 <h4><a name="J.5.3" href="#J.5.3">J.5.3 Lengths and cases of identifiers</a></h4>
24821 <p><!--para 1 -->
24822 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
24824 <h4><a name="J.5.4" href="#J.5.4">J.5.4 Scopes of identifiers</a></h4>
24825 <p><!--para 1 -->
24826 A function identifier, or the identifier of an object the declaration of which contains the
24827 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
24829 <h4><a name="J.5.5" href="#J.5.5">J.5.5 Writable string literals</a></h4>
24830 <p><!--para 1 -->
24831 String literals are modifiable (in which case, identical string literals should denote distinct
24832 objects) (<a href="#6.4.5">6.4.5</a>).
24834 <h4><a name="J.5.6" href="#J.5.6">J.5.6 Other arithmetic types</a></h4>
24835 <p><!--para 1 -->
24836 Additional arithmetic types, such as __int128 or double double, and their
24837 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
24838 more range or precision than long double, may be used for evaluating expressions of
24839 other floating types, and may be used to define float_t or double_t.
24840 <!--page 526 -->
24842 <h4><a name="J.5.7" href="#J.5.7">J.5.7 Function pointer casts</a></h4>
24843 <p><!--para 1 -->
24844 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
24845 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
24846 <p><!--para 2 -->
24847 A pointer to a function may be cast to a pointer to an object or to void, allowing a
24848 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
24850 <h4><a name="J.5.8" href="#J.5.8">J.5.8 Extended bit-field types</a></h4>
24851 <p><!--para 1 -->
24852 A bit-field may be declared with a type other than _Bool, unsigned int, or
24853 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
24855 <h4><a name="J.5.9" href="#J.5.9">J.5.9 The fortran keyword</a></h4>
24856 <p><!--para 1 -->
24857 The fortran function specifier may be used in a function declaration to indicate that
24858 calls suitable for FORTRAN should be generated, or that a different representation for the
24859 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
24861 <h4><a name="J.5.10" href="#J.5.10">J.5.10 The asm keyword</a></h4>
24862 <p><!--para 1 -->
24863 The asm keyword may be used to insert assembly language directly into the translator
24864 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
24865 <pre>
24866 asm ( character-string-literal );
24867 </pre>
24869 <h4><a name="J.5.11" href="#J.5.11">J.5.11 Multiple external definitions</a></h4>
24870 <p><!--para 1 -->
24871 There may be more than one external definition for the identifier of an object, with or
24872 without the explicit use of the keyword extern; if the definitions disagree, or more than
24873 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
24875 <h4><a name="J.5.12" href="#J.5.12">J.5.12 Predefined macro names</a></h4>
24876 <p><!--para 1 -->
24877 Macro names that do not begin with an underscore, describing the translation and
24878 execution environments, are defined by the implementation before translation begins
24879 (<a href="#6.10.8">6.10.8</a>).
24881 <h4><a name="J.5.13" href="#J.5.13">J.5.13 Floating-point status flags</a></h4>
24882 <p><!--para 1 -->
24883 If any floating-point status flags are set on normal termination after all calls to functions
24884 registered by the atexit function have been made (see <a href="#7.20.4.3">7.20.4.3</a>), the implementation
24885 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
24886 <!--page 527 -->
24888 <h4><a name="J.5.14" href="#J.5.14">J.5.14 Extra arguments for signal handlers</a></h4>
24889 <p><!--para 1 -->
24890 Handlers for specific signals are called with extra arguments in addition to the signal
24891 number (<a href="#7.14.1.1">7.14.1.1</a>).
24893 <h4><a name="J.5.15" href="#J.5.15">J.5.15 Additional stream types and file-opening modes</a></h4>
24894 <p><!--para 1 -->
24895 Additional mappings from files to streams are supported (<a href="#7.19.2">7.19.2</a>).
24896 <p><!--para 2 -->
24897 Additional file-opening modes may be specified by characters appended to the mode
24898 argument of the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
24900 <h4><a name="J.5.16" href="#J.5.16">J.5.16 Defined file position indicator</a></h4>
24901 <p><!--para 1 -->
24902 The file position indicator is decremented by each successful call to the ungetc or
24903 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>,
24904 <a href="#7.24.3.10">7.24.3.10</a>).
24906 <h4><a name="J.5.17" href="#J.5.17">J.5.17 Math error reporting</a></h4>
24907 <p><!--para 1 -->
24908 Functions declared in <a href="#7.3">&lt;complex.h&gt;</a> and <a href="#7.12">&lt;math.h&gt;</a> raise SIGFPE to report errors
24909 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
24910 <a href="#7.12">7.12</a>).
24911 <!--page 528 -->
24913 <h2><a name="Bibliography" href="#Bibliography">Bibliography</a></h2>
24914 <ol>
24915 <li> ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
24916 published in The C Programming Language by Brian W. Kernighan and Dennis
24917 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
24918 <li> 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
24919 California, USA, November 1984.
24920 <li> ANSI X3/TR-1-82 (1982), American National Dictionary for Information
24921 Processing Systems, Information Processing Systems Technical Report.
24922 <li> ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
24923 Arithmetic.
24924 <li> ANSI/IEEE 854-1988, American National Standard for Radix-Independent
24925 Floating-Point Arithmetic.
24926 <li> IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
24927 second edition (previously designated IEC 559:1989).
24928 <li> ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
24929 symbols for use in the physical sciences and technology.
24930 <li> ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
24931 information interchange.
24932 <li> ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
24933 Fundamental terms.
24934 <li> ISO 4217:1995, Codes for the representation of currencies and funds.
24935 <li> ISO 8601:1988, Data elements and interchange formats -- Information
24936 interchange -- Representation of dates and times.
24937 <li> ISO/IEC 9899:1990, Programming languages -- C.
24938 <li> ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
24939 <li> ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
24940 <li> ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
24941 <li> ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
24942 Interface (POSIX) -- Part 2: Shell and Utilities.
24943 <li> ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
24944 preparation of programming language standards.
24945 <li> ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
24946 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
24947 <!--page 529 -->
24948 <li> ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
24949 ISO/IEC 10646-1:1993.
24950 <li> ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
24951 ISO/IEC 10646-1:1993.
24952 <li> ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
24953 Transformation Format for 16 planes of group 00 (UTF-16).
24954 <li> ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
24955 Transformation Format 8 (UTF-8).
24956 <li> ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
24957 <li> ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
24958 <li> ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
24959 syllables.
24960 <li> ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993 Tibetan.
24961 <li> ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
24962 additional characters.
24963 <li> ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
24964 <li> ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
24965 Identifiers for characters.
24966 <li> ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
24967 Ethiopic.
24968 <li> ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
24969 Unified Canadian Aboriginal Syllabics.
24970 <li> ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
24971 Cherokee.
24972 <li> ISO/IEC 10967-1:1994, Information technology -- Language independent
24973 arithmetic -- Part 1: Integer and floating point arithmetic.
24974 <!--page 530 -->
24975 <!--page 531 -->
24976 </ol>
24978 <h2><a name="Index" href="#Index">Index</a></h2>
24979 <pre>
24980 ??? 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>,
24981 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>
24982 ??? 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>
24983 ! (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>
24984 != (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>
24985 # 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>
24986 # 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>
24987 # punctuator, <a href="#6.10">6.10</a> -&gt; (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
24988 ## 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>,
24989 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> <a href="#6.5.2.3">6.5.2.3</a>
24990 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.8">6.7.8</a>
24991 #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>
24992 #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>
24993 #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>
24994 #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>
24995 <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>
24996 #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>
24997 #ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> :&gt; (alternative spelling of ]), <a href="#6.4.6">6.4.6</a>
24998 #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>,
24999 <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>
25000 #line preprocessing directive, <a href="#6.10.4">6.10.4</a> &lt; (less-than operator), <a href="#6.5.8">6.5.8</a>
25001 #pragma preprocessing directive, <a href="#6.10.6">6.10.6</a> &lt;% (alternative spelling of {), <a href="#6.4.6">6.4.6</a>
25002 #undef preprocessing directive, <a href="#6.10.3.5">6.10.3.5</a>, <a href="#7.1.3">7.1.3</a>, &lt;: (alternative spelling of [), <a href="#6.4.6">6.4.6</a>
25003 <a href="#7.1.4">7.1.4</a> &lt;&lt; (left-shift operator), <a href="#6.5.7">6.5.7</a>
25004 % (remainder operator), <a href="#6.5.5">6.5.5</a> &lt;&lt;= (left-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25005 %: (alternative spelling of #), <a href="#6.4.6">6.4.6</a> &lt;= (less-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a>
25006 %:%: (alternative spelling of ##), <a href="#6.4.6">6.4.6</a> <a href="#7.2">&lt;assert.h&gt;</a> header, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
25007 %= (remainder assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.3">&lt;complex.h&gt;</a> 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>,
25008 %&gt; (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>
25009 &amp; (address operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#7.4">&lt;ctype.h&gt;</a> header, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
25010 &amp; (bitwise AND operator), <a href="#6.5.10">6.5.10</a> <a href="#7.5">&lt;errno.h&gt;</a> header, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
25011 &amp;&amp; (logical AND operator), <a href="#6.5.13">6.5.13</a> <a href="#7.6">&lt;fenv.h&gt;</a> 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>,
25012 &amp;= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#H">H</a>
25013 ' ' (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>, <a href="#7.7">&lt;float.h&gt;</a> 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>,
25014 <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>
25015 ( ) (cast operator), <a href="#6.5.4">6.5.4</a> <a href="#7.8">&lt;inttypes.h&gt;</a> header, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a>
25016 ( ) (function-call operator), <a href="#6.5.2.2">6.5.2.2</a> <a href="#7.9">&lt;iso646.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.9">7.9</a>
25017 ( ) (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> <a href="#7.10">&lt;limits.h&gt;</a> 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>
25018 ( ){ } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a> <a href="#7.11">&lt;locale.h&gt;</a> header, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
25019 * (asterisk punctuator), <a href="#6.7.5.1">6.7.5.1</a>, <a href="#6.7.5.2">6.7.5.2</a> <a href="#7.12">&lt;math.h&gt;</a> 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>,
25020 * (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>
25021 * (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> <a href="#7.13">&lt;setjmp.h&gt;</a> header, <a href="#7.13">7.13</a>
25022 *= (multiplication assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.14">&lt;signal.h&gt;</a> header, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a>
25023 + (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>, <a href="#7.15">&lt;stdarg.h&gt;</a> header, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a>
25024 <a href="#G.5.2">G.5.2</a> <a href="#7.16">&lt;stdbool.h&gt;</a> 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>
25025 + (unary plus operator), <a href="#6.5.3.3">6.5.3.3</a> <a href="#7.17">&lt;stddef.h&gt;</a> 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>,
25026 ++ (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>
25027 ++ (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> <a href="#7.18">&lt;stdint.h&gt;</a> 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>,
25028 += (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>
25029 , (comma operator), <a href="#6.5.17">6.5.17</a>
25030 <!--page 532 -->
25031 <a href="#7.19">&lt;stdio.h&gt;</a> 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>
25032 <a href="#7.20">&lt;stdlib.h&gt;</a> 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>
25033 <a href="#7.21">&lt;string.h&gt;</a> 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>
25034 <a href="#7.22">&lt;tgmath.h&gt;</a> 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>
25035 <a href="#7.23">&lt;time.h&gt;</a> 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>
25036 <a href="#7.24">&lt;wchar.h&gt;</a> 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>
25037 <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>
25038 <a href="#7.25">&lt;wctype.h&gt;</a> 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>
25039 = (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>
25040 = (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>
25041 == (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>
25042 &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
25043 &gt;= (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>
25044 &gt;&gt; (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>
25045 &gt;&gt;= (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>,
25046 ? : (conditional operator), <a href="#6.5.15">6.5.15</a> <a href="#7.18.3">7.18.3</a>
25047 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
25048 [ ] (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>
25049 [ ] (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>
25050 \ (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>
25051 \ (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>
25052 \" (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>
25053 <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>
25054 \\ (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>
25055 \' (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>
25056 \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>
25057 padding of binary stream, <a href="#7.19.2">7.19.2</a> _Imaginary keyword, <a href="#G.2">G.2</a>
25058 \? (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>
25059 \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>
25060 \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>
25061 \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>
25062 <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>
25063 \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>
25064 <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>,
25065 \octal digits (octal-character escape sequence), <a href="#6.8.2">6.8.2</a>
25066 <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>
25067 \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>
25068 <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),
25069 \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>
25070 <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>
25071 \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>
25072 \u (universal character names), <a href="#6.4.3">6.4.3</a>
25073 \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>,
25074 <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.20.4.1">7.20.4.1</a>
25075 \x hexadecimal digits (hexadecimal-character abs function, <a href="#7.20.6.1">7.20.6.1</a>
25076 escape sequence), <a href="#6.4.4.4">6.4.4.4</a> absolute-value functions
25077 ^ (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>
25078 ^= (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>
25079 <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>
25080 __bool_true_false_are_defined abstract declarator, <a href="#6.7.6">6.7.6</a>
25081 macro, <a href="#7.16">7.16</a> abstract machine, <a href="#5.1.2.3">5.1.2.3</a>
25082 <!--page 533 -->
25083 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a> array
25084 accuracy, see floating-point accuracy argument, <a href="#6.9.1">6.9.1</a>
25085 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>
25086 acos type-generic macro, <a href="#7.22">7.22</a> initialization, <a href="#6.7.8">6.7.8</a>
25087 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>
25088 acosh type-generic macro, <a href="#7.22">7.22</a> parameter, <a href="#6.9.1">6.9.1</a>
25089 active position, <a href="#5.2.2">5.2.2</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
25090 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>
25091 actual parameter (deprecated), <a href="#3.3">3.3</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
25092 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> type, <a href="#6.2.5">6.2.5</a>
25093 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>
25094 <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>
25095 additive expressions, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
25096 address constant, <a href="#6.6">6.6</a> as-if rule, <a href="#5.1.2.3">5.1.2.3</a>
25097 address operator (&amp;), <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>
25098 aggregate initialization, <a href="#6.7.8">6.7.8</a> asctime function, <a href="#7.23.3.1">7.23.3.1</a>
25099 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>
25100 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>
25101 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>
25102 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>
25103 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>
25104 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>
25105 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>
25106 and macro, <a href="#7.9">7.9</a> assignment
25107 AND operators compound, <a href="#6.5.16.2">6.5.16.2</a>
25108 bitwise (&amp;), <a href="#6.5.10">6.5.10</a> conversion, <a href="#6.5.16.1">6.5.16.1</a>
25109 bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a> expression, <a href="#6.5.16">6.5.16</a>
25110 logical (&amp;&amp;), <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>
25111 and_eq macro, <a href="#7.9">7.9</a> simple, <a href="#6.5.16.1">6.5.16.1</a>
25112 ANSI/IEEE 754, <a href="#F.1">F.1</a> associativity of operators, <a href="#6.5">6.5</a>
25113 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>
25114 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>
25115 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>
25116 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>
25117 default promotions, <a href="#6.5.2.2">6.5.2.2</a> atan2 type-generic macro, <a href="#7.22">7.22</a>
25118 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>
25119 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>
25120 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>,
25121 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>
25122 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>
25123 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>
25124 conversions atol function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
25125 arithmetic operators atoll function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
25126 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>
25127 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>
25128 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>
25129 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>
25130 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>
25131 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>
25132 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>
25133 arithmetic, pointer, <a href="#6.5.6">6.5.6</a> basic types, <a href="#6.2.5">6.2.5</a>
25134 <!--page 534 -->
25135 behavior, <a href="#3.4">3.4</a> call by value, <a href="#6.5.2.2">6.5.2.2</a>
25136 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>,
25137 <a href="#7.19.9.4">7.19.9.4</a> <a href="#7.20.3.4">7.20.3.4</a>
25138 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>
25139 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>
25140 low order, <a href="#3.6">3.6</a> carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>,
25141 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>
25142 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>
25143 bitor macro, <a href="#7.9">7.9</a> case mapping functions
25144 bitwise operators, <a href="#6.5">6.5</a> character, <a href="#7.4.2">7.4.2</a>
25145 AND, <a href="#6.5.10">6.5.10</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
25146 AND assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
25147 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>
25148 exclusive OR, <a href="#6.5.11">6.5.11</a> type-generic macro for, <a href="#7.22">7.22</a>
25149 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>
25150 inclusive OR, <a href="#6.5.12">6.5.12</a> type-generic macro for, <a href="#7.22">7.22</a>
25151 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>
25152 shift, <a href="#6.5.7">6.5.7</a> cast operator (( )), <a href="#6.5.4">6.5.4</a>
25153 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>
25154 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>
25155 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>
25156 block structure, <a href="#6.2.1">6.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
25157 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>
25158 bool macro, <a href="#7.16">7.16</a> cbrt type-generic macro, <a href="#7.22">7.22</a>
25159 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>
25160 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>
25161 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>
25162 <a href="#6.8.2">6.8.2</a> type-generic macro for, <a href="#7.22">7.22</a>
25163 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>
25164 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>
25165 branch cuts, <a href="#7.3.3">7.3.3</a> cerf function, <a href="#7.26.1">7.26.1</a>
25166 break statement, <a href="#6.8.6.3">6.8.6.3</a> cerfc function, <a href="#7.26.1">7.26.1</a>
25167 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>
25168 <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>
25169 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>
25170 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>
25171 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>
25172 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>,
25173 byte input/output functions, <a href="#7.19.1">7.19.1</a> <a href="#6.3.1.8">6.3.1.8</a>
25174 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>
25175 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>
25176 <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>
25177 <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>
25178 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>
25179 type-generic macro for, <a href="#7.22">7.22</a> character case mapping functions, <a href="#7.4.2">7.4.2</a>
25180 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>
25181 type-generic macro for, <a href="#7.22">7.22</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
25182 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>
25183 type-generic macro for, <a href="#7.22">7.22</a> wide character, <a href="#7.25.2.1">7.25.2.1</a>
25184 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>
25185 <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>
25186 <!--page 535 -->
25187 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>,
25188 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>
25189 character input/output functions, <a href="#7.19.7">7.19.7</a> compliance, see conformance
25190 wide character, <a href="#7.24.3">7.24.3</a> components of time, <a href="#7.23.1">7.23.1</a>
25191 character sets, <a href="#5.2.1">5.2.1</a> composite type, <a href="#6.2.7">6.2.7</a>
25192 character string literal, see string literal compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
25193 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>
25194 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>
25195 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>
25196 cimag type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> concatenation functions
25197 cis function, <a href="#G.6">G.6</a> string, <a href="#7.21.3">7.21.3</a>
25198 classification functions wide string, <a href="#7.24.4.3">7.24.4.3</a>
25199 character, <a href="#7.4.1">7.4.1</a> concatenation, preprocessing, see preprocessing
25200 floating-point, <a href="#7.12.3">7.12.3</a> concatenation
25201 wide character, <a href="#7.25.2.1">7.25.2.1</a> conceptual models, <a href="#5.1">5.1</a>
25202 extensible, <a href="#7.25.2.2">7.25.2.2</a> conditional inclusion, <a href="#6.10.1">6.10.1</a>
25203 clearerr function, <a href="#7.19.10.1">7.19.10.1</a> conditional operator (? :), <a href="#6.5.15">6.5.15</a>
25204 clgamma function, <a href="#7.26.1">7.26.1</a> conformance, <a href="#4">4</a>
25205 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>
25206 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>
25207 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>
25208 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>
25209 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>
25210 clog10 function, <a href="#7.26.1">7.26.1</a> constants, <a href="#6.4.4">6.4.4</a>
25211 clog1p function, <a href="#7.26.1">7.26.1</a> as primary expression, <a href="#6.5.1">6.5.1</a>
25212 clog2 function, <a href="#7.26.1">7.26.1</a> character, <a href="#6.4.4.4">6.4.4.4</a>
25213 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>
25214 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>
25215 comma operator (,), <a href="#6.5.17">6.5.17</a> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
25216 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>
25217 <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>
25218 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>
25219 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>
25220 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>
25221 common extensions, <a href="#J.5">J.5</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
25222 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>
25223 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>
25224 common warnings, <a href="#I">I</a> control wide character, <a href="#7.25.2">7.25.2</a>
25225 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>
25226 string, <a href="#7.21.4">7.21.4</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
25227 wide string, <a href="#7.24.4.4">7.24.4.4</a> array argument, <a href="#6.9.1">6.9.1</a> *
25228 comparison macros, <a href="#7.12.14">7.12.14</a> array parameter, <a href="#6.9.1">6.9.1</a>
25229 comparison, pointer, <a href="#6.5.8">6.5.8</a> arrays, <a href="#6.3.2.1">6.3.2.1</a>
25230 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>
25231 compl macro, <a href="#7.9">7.9</a> boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>
25232 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>
25233 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>
25234 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>
25235 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>
25236 complex type domain, <a href="#6.2.5">6.2.5</a> function, <a href="#6.3.2.1">6.3.2.1</a>
25237 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>
25238 <!--page 536 -->
25239 function designators, <a href="#6.3.2.1">6.3.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
25240 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>
25241 imaginary, <a href="#G.4.1">G.4.1</a> type-generic macro for, <a href="#7.22">7.22</a>
25242 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>
25243 implicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.22">7.22</a>
25244 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>
25245 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>
25246 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>
25247 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.22">7.22</a>
25248 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>
25249 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>
25250 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>
25251 usual arithmetic, see usual arithmetic current object, <a href="#6.7.8">6.7.8</a>
25252 conversions CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
25253 void type, <a href="#6.3.2.2">6.3.2.2</a>
25254 conversion functions data stream, see streams
25255 multibyte/wide character, <a href="#7.20.7">7.20.7</a> date and time header, <a href="#7.23">7.23</a>
25256 extended, <a href="#7.24.6">7.24.6</a> Daylight Saving Time, <a href="#7.23.1">7.23.1</a>
25257 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>
25258 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>
25259 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>
25260 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>
25261 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>
25262 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>
25263 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>
25264 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>
25265 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>
25266 <a href="#7.24.2.2">7.24.2.2</a> decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
25267 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>
25268 <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>
25269 <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>,
25270 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>
25271 copying functions declaration specifiers, <a href="#6.7">6.7</a>
25272 string, <a href="#7.21.2">7.21.2</a> declarations, <a href="#6.7">6.7</a>
25273 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>
25274 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>
25275 <a href="#F.9.8.1">F.9.8.1</a> structure/union, <a href="#6.7.2.1">6.7.2.1</a>
25276 copysign type-generic macro, <a href="#7.22">7.22</a> typedef, <a href="#6.7.7">6.7.7</a>
25277 correctly rounded result, <a href="#3.9">3.9</a> declarator, <a href="#6.7.5">6.7.5</a>
25278 corresponding real type, <a href="#6.2.5">6.2.5</a> abstract, <a href="#6.7.6">6.7.6</a>
25279 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>
25280 cos type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> decrement operators, see arithmetic operators,
25281 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
25282 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>
25283 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>
25284 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>
25285 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>
25286 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>
25287 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>
25288 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>
25289 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>
25290 <!--page 537 -->
25291 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>,
25292 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>,
25293 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>,
25294 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>
25295 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
25296 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>
25297 diagnostics header, <a href="#7.2">7.2</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
25298 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>
25299 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>
25300 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>
25301 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>
25302 display device, <a href="#5.2.2">5.2.2</a> enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
25303 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>
25304 div_t type, <a href="#7.20">7.20</a> enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
25305 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>
25306 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>
25307 do statement, <a href="#6.8.5.2">6.8.5.2</a> environment, <a href="#5">5</a>
25308 documentation of implementation, <a href="#4">4</a> environment functions, <a href="#7.20.4">7.20.4</a>
25309 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>
25310 <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>
25311 <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>,
25312 <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>,
25313 <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>
25314 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>,
25315 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>,
25316 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>,
25317 <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>,
25318 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>,
25319 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>,
25320 <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>
25321 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>
25322 <a href="#6.3.1.8">6.3.1.8</a> equal-to operator, see equality operator
25323 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>
25324 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>
25325 <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>,
25326 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
25327 also range error
25328 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>
25329 effective type, <a href="#6.5">6.5</a> erf type-generic macro, <a href="#7.22">7.22</a>
25330 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>
25331 <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>
25332 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>,
25333 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>,
25334 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>,
25335 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>,
25336 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>
25337 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>
25338 empty statement, <a href="#6.8.3">6.8.3</a> error
25339 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
25340 <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
25341 end-of-file, <a href="#7.24.1">7.24.1</a> range, see range error
25342 <!--page 538 -->
25343 error conditions, <a href="#7.12.1">7.12.1</a> extended characters, <a href="#5.2.1">5.2.1</a>
25344 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>,
25345 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>
25346 <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
25347 <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>
25348 <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,
25349 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>
25350 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,
25351 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.25.2.2">7.25.2.2</a>
25352 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>
25353 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>
25354 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>
25355 evaluation order, <a href="#6.5">6.5</a> external linkage, <a href="#6.2.2">6.2.2</a>
25356 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>
25357 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>
25358 <a href="#6.8.6.4">6.8.6.4</a>
25359 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>
25360 exclusive OR operators fabs type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25361 bitwise (^), <a href="#6.5.11">6.5.11</a> false macro, <a href="#7.16">7.16</a>
25362 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>
25363 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>
25364 execution character set, <a href="#5.2.1">5.2.1</a> fdim type-generic macro, <a href="#7.22">7.22</a>
25365 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>
25366 environmental limits FE_DFL_ENV macro, <a href="#7.6">7.6</a>
25367 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>
25368 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>
25369 <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>
25370 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>
25371 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>
25372 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>
25373 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>
25374 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>
25375 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>
25376 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>
25377 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>
25378 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>
25379 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>
25380 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>,
25381 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>
25382 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>
25383 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>,
25384 assignment, <a href="#6.5.16">6.5.16</a> <a href="#F.9">F.9</a>
25385 cast, <a href="#6.5.4">6.5.4</a> fenv_t type, <a href="#7.6">7.6</a>
25386 constant, <a href="#6.6">6.6</a> feof function, <a href="#7.19.10.2">7.19.10.2</a>
25387 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>
25388 order of evaluation, <a href="#6.5">6.5</a> ferror function, <a href="#7.19.10.3">7.19.10.3</a>
25389 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>
25390 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>
25391 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>
25392 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>
25393 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>
25394 <!--page 539 -->
25395 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>
25396 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>
25397 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>
25398 <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>
25399 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>
25400 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>,
25401 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>
25402 <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>
25403 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>
25404 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>
25405 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>
25406 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>
25407 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>
25408 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>
25409 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>,
25410 <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>
25411 <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>
25412 <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>
25413 <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>
25414 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>
25415 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>
25416 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>
25417 FILENAME_MAX macro, <a href="#7.19.1">7.19.1</a> fmin type-generic macro, <a href="#7.22">7.22</a>
25418 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>
25419 floating-point status, see floating-point status fmod type-generic macro, <a href="#7.22">7.22</a>
25420 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>
25421 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>
25422 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>
25423 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>
25424 <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>,
25425 float _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.4.1.10">7.4.1.10</a>
25426 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>
25427 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>
25428 <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>
25429 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>
25430 <a href="#7.24.4.1.1">7.24.4.1.1</a> fortran keyword, <a href="#J.5.9">J.5.9</a>
25431 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>
25432 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
25433 floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a> also contracted expression
25434 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>
25435 <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>
25436 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>
25437 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>
25438 <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>
25439 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>
25440 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>
25441 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>
25442 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>
25443 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>
25444 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>
25445 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>
25446 <!--page 540 -->
25447 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>
25448 <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>
25449 <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>
25450 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>,
25451 <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>,
25452 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>
25453 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>
25454 <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>,
25455 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>
25456 fread function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.1">7.19.8.1</a>
25457 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>
25458 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>
25459 <a href="#5.1.2.1">5.1.2.1</a> wide string, <a href="#7.24.4">7.24.4</a>
25460 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>
25461 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>
25462 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>
25463 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>
25464 <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>
25465 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>
25466 <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>
25467 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>
25468 <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>
25469 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>
25470 full declarator, <a href="#6.7.5">6.7.5</a> graphic characters, <a href="#5.2.1">5.2.1</a>
25471 full expression, <a href="#6.8">6.8</a> greater-than operator (&gt;), <a href="#6.5.8">6.5.8</a>
25472 fully buffered stream, <a href="#7.19.3">7.19.3</a> greater-than-or-equal-to operator (&gt;=), <a href="#6.5.8">6.5.8</a>
25473 function
25474 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
25475 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>
25476 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>
25477 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>
25478 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>
25479 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
25480 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>
25481 image, <a href="#5.2.3">5.2.3</a> high-order bit, <a href="#3.6">3.6</a>
25482 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>
25483 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>
25484 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>,
25485 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>
25486 <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>
25487 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>,
25488 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>
25489 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>,
25490 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>
25491 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>,
25492 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>
25493 function specifiers, <a href="#6.7.4">6.7.4</a> hyperbolic functions
25494 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>
25495 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>
25496 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>
25497 future directions hypot type-generic macro, <a href="#7.22">7.22</a>
25498 <!--page 541 -->
25499 <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>
25500 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>
25501 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>,
25502 maximum length, <a href="#6.4.2.1">6.4.2.1</a> <a href="#F.7.5">F.7.5</a>
25503 name spaces, <a href="#6.2.3">6.2.3</a> in blocks, <a href="#6.8">6.8</a>
25504 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>
25505 scope, <a href="#6.2.1">6.2.1</a> permitted form, <a href="#6.6">6.6</a>
25506 type, <a href="#6.2.5">6.2.5</a> string literal, <a href="#6.3.2.1">6.3.2.1</a>
25507 identifier list, <a href="#6.7.5">6.7.5</a> inline, <a href="#6.7.4">6.7.4</a>
25508 identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a> inner scope, <a href="#6.2.1">6.2.1</a>
25509 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>
25510 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
25511 <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>
25512 IEEE 754, <a href="#F.1">F.1</a> direct, <a href="#7.19.8">7.19.8</a>
25513 IEEE 854, <a href="#F.1">F.1</a> formatted, <a href="#7.19.6">7.19.6</a>
25514 IEEE floating-point arithmetic standard, see wide character, <a href="#7.24.2">7.24.2</a>
25515 IEC 60559, ANSI/IEEE 754, wide character, <a href="#7.24.3">7.24.3</a>
25516 ANSI/IEEE 854 formatted, <a href="#7.24.2">7.24.2</a>
25517 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>
25518 <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>
25519 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>
25520 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>,
25521 ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.3.1.8">6.3.1.8</a>
25522 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>
25523 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>
25524 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>
25525 imaginary numbers, <a href="#G">G</a> INT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
25526 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>
25527 imaginary types, <a href="#G">G</a> int_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
25528 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>
25529 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>
25530 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>,
25531 implementation, <a href="#3.12">3.12</a> <a href="#7.20.6">7.20.6</a>
25532 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>
25533 <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>
25534 limits integer constant expression, <a href="#6.6">6.6</a>
25535 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>
25536 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>,
25537 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>,
25538 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>
25539 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>
25540 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>,
25541 bitwise (|), <a href="#6.5.12">6.5.12</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
25542 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>
25543 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>
25544 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>
25545 increment and decrement internal linkage, <a href="#6.2.2">6.2.2</a>
25546 indeterminate value, <a href="#3.17.2">3.17.2</a> internal name, <a href="#6.4.2.1">6.4.2.1</a>
25547 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>
25548 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>
25549 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>
25550 <!--page 542 -->
25551 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>,
25552 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>
25553 <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>
25554 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>,
25555 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>
25556 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>
25557 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>,
25558 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>
25559 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>,
25560 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>
25561 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>,
25562 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>
25563 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>,
25564 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>
25565 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>,
25566 <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>,
25567 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>
25568 <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>,
25569 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>,
25570 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>,
25571 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>
25572 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>,
25573 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>
25574 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>
25575 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>
25576 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>
25577 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>
25578 <a href="#7.4.2.2">7.4.2.2</a>
25579 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>
25580 isnormal macro, <a href="#7.12.3.5">7.12.3.5</a> jump statements, <a href="#6.8.6">6.8.6</a>
25581 ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>
25582 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>
25583 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>
25584 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>
25585 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>
25586 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>
25587 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>
25588 ISO/IEC 9945-2, <a href="#7.11">7.11</a> labs function, <a href="#7.20.6.1">7.20.6.1</a>
25589 ISO/IEC TR 10176, <a href="#D">D</a> language, <a href="#6">6</a>
25590 iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> future directions, <a href="#6.11">6.11</a>
25591 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>
25592 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>
25593 <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>
25594 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>,
25595 <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>
25596 <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>,
25597 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>,
25598 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>
25599 <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>
25600 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>
25601 <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>
25602 <!--page 543 -->
25603 lconv structure type, <a href="#7.11">7.11</a> llabs function, <a href="#7.20.6.1">7.20.6.1</a>
25604 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>
25605 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>
25606 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>,
25607 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>
25608 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>,
25609 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>
25610 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>
25611 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>
25612 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>
25613 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>
25614 ldexp type-generic macro, <a href="#7.22">7.22</a> local time, <a href="#7.23.1">7.23.1</a>
25615 ldiv function, <a href="#7.20.6.2">7.20.6.2</a> locale, <a href="#3.4.2">3.4.2</a>
25616 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>
25617 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>
25618 left-shift assignment operator (&lt;&lt;=), <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>
25619 left-shift operator (&lt;&lt;), <a href="#6.5.7">6.5.7</a> localization, <a href="#7.11">7.11</a>
25620 length localtime function, <a href="#7.23.3.4">7.23.3.4</a>
25621 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>
25622 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>
25623 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>
25624 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>
25625 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>
25626 <a href="#7.24.6.3.1">7.24.6.3.1</a> log1p type-generic macro, <a href="#7.22">7.22</a>
25627 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>
25628 <a href="#7.24.2.2">7.24.2.2</a> log2 type-generic macro, <a href="#7.22">7.22</a>
25629 less-than operator (&lt;), <a href="#6.5.8">6.5.8</a> logarithmic functions
25630 less-than-or-equal-to operator (&lt;=), <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>
25631 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>
25632 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>
25633 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>
25634 lgamma type-generic macro, <a href="#7.22">7.22</a> logical operators
25635 library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7">7</a> AND (&amp;&amp;), <a href="#6.5.13">6.5.13</a>
25636 future directions, <a href="#7.26">7.26</a> negation (!), <a href="#6.5.3.3">6.5.3.3</a>
25637 summary, <a href="#B">B</a> OR (||), <a href="#6.5.14">6.5.14</a>
25638 terms, <a href="#7.1.1">7.1.1</a> logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
25639 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>
25640 lifetime, <a href="#6.2.4">6.2.4</a> long double _Complex type conversion,
25641 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>
25642 environmental, see environmental limits long double _Imaginary type, <a href="#G.2">G.2</a>
25643 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>
25644 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>,
25645 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>
25646 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>,
25647 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>
25648 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>,
25649 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>
25650 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>,
25651 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>
25652 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>
25653 <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>,
25654 <!--page 544 -->
25655 <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>
25656 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>
25657 <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>,
25658 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>,
25659 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>
25660 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>
25661 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>,
25662 loop body, <a href="#6.8.5">6.8.5</a> <a href="#7.24.6.3">7.24.6.3</a>
25663 low-order bit, <a href="#3.6">3.6</a> member access operators (. and -&gt;), <a href="#6.5.2.3">6.5.2.3</a>
25664 lowercase letter, <a href="#5.2.1">5.2.1</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
25665 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>
25666 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>
25667 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>
25668 lround type-generic macro, <a href="#7.22">7.22</a> memmove function, <a href="#7.21.2.2">7.21.2.2</a>
25669 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>
25670 memset function, <a href="#7.21.6.1">7.21.6.1</a>
25671 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>
25672 macro definition minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
25673 library function, <a href="#7.1.4">7.1.4</a> miscellaneous functions
25674 macro invocation, <a href="#6.10.3">6.10.3</a> string, <a href="#7.21.6">7.21.6</a>
25675 macro name, <a href="#6.10.3">6.10.3</a> wide string, <a href="#7.24.4.6">7.24.4.6</a>
25676 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>
25677 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>
25678 redefinition, <a href="#6.10.3">6.10.3</a> modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
25679 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>
25680 macro parameter, <a href="#6.10.3">6.10.3</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
25681 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>
25682 macro replacement, <a href="#6.10.3">6.10.3</a> multibyte conversion functions
25683 magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a> wide character, <a href="#7.20.7">7.20.7</a>
25684 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>
25685 <a href="#7.19.3">7.19.3</a> restartable, <a href="#7.24.6.3">7.24.6.3</a>
25686 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>
25687 <a href="#7.20.3.4">7.20.3.4</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
25688 manipulation functions multibyte string, <a href="#7.1.1">7.1.1</a>
25689 complex, <a href="#7.3.9">7.3.9</a> multibyte/wide character conversion functions,
25690 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>
25691 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>
25692 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>
25693 <a href="#J.5.17">J.5.17</a> multibyte/wide string conversion functions, <a href="#7.20.8">7.20.8</a>
25694 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>
25695 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>
25696 MATH_ERRNO macro, <a href="#7.12">7.12</a> multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>
25697 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>
25698 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>
25699 <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>
25700 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>
25701 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>
25702 mbrlen function, <a href="#7.24.6.3.1">7.24.6.3.1</a> name
25703 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>
25704 <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>
25705 <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>
25706 <!--page 545 -->
25707 label, <a href="#6.2.3">6.2.3</a> octal-character escape sequence (\octal digits),
25708 structure/union member, <a href="#6.2.3">6.2.3</a> <a href="#6.4.4.4">6.4.4.4</a>
25709 name spaces, <a href="#6.2.3">6.2.3</a> offsetof macro, <a href="#7.17">7.17</a>
25710 named label, <a href="#6.8.1">6.8.1</a> on-off switch, <a href="#6.10.6">6.10.6</a>
25711 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>
25712 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>
25713 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>
25714 NDEBUG macro, <a href="#7.2">7.2</a> operations on files, <a href="#7.19.4">7.19.4</a>
25715 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>
25716 <a href="#F.9.6.3">F.9.6.3</a> operators, <a href="#6.5">6.5</a>
25717 nearbyint type-generic macro, <a href="#7.22">7.22</a> assignment, <a href="#6.5.16">6.5.16</a>
25718 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>
25719 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> equality, <a href="#6.5.9">6.5.9</a>
25720 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>
25721 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>
25722 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>
25723 <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>
25724 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>
25725 <a href="#F.9.8.3">F.9.8.3</a> shift, <a href="#6.5.7">6.5.7</a>
25726 nextafter type-generic macro, <a href="#7.22">7.22</a> unary, <a href="#6.5.3">6.5.3</a>
25727 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>
25728 nexttoward type-generic macro, <a href="#7.22">7.22</a> or macro, <a href="#7.9">7.9</a>
25729 no linkage, <a href="#6.2.2">6.2.2</a> OR operators
25730 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>
25731 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>
25732 nonlocal jumps header, <a href="#7.13">7.13</a> bitwise inclusive (|), <a href="#6.5.12">6.5.12</a>
25733 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>
25734 not macro, <a href="#7.9">7.9</a> logical (||), <a href="#6.5.14">6.5.14</a>
25735 not-equal-to operator, see inequality operator or_eq macro, <a href="#7.9">7.9</a>
25736 not_eq macro, <a href="#7.9">7.9</a> order of allocated storage, <a href="#7.20.3">7.20.3</a>
25737 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>
25738 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>
25739 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>
25740 <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>
25741 null pointer, <a href="#6.3.2.3">6.3.2.3</a>
25742 null pointer constant, <a href="#6.3.2.3">6.3.2.3</a> padding
25743 null preprocessing directive, <a href="#6.10.7">6.10.7</a> binary stream, <a href="#7.19.2">7.19.2</a>
25744 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>
25745 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>
25746 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>
25747 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>
25748 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>
25749 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>
25750 macro, <a href="#6.10.3">6.10.3</a>
25751 object, <a href="#3.14">3.14</a> main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>
25752 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>
25753 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>
25754 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>
25755 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>
25756 octal constant, <a href="#6.4.4.1">6.4.4.1</a> parse state, <a href="#7.19.2">7.19.2</a>
25757 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>
25758 <!--page 546 -->
25759 perror function, <a href="#7.19.10.4">7.19.10.4</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
25760 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>
25761 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>
25762 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>
25763 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>
25764 pointer arithmetic, <a href="#6.5.6">6.5.6</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
25765 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>
25766 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>
25767 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> program image, <a href="#5.1.1.2">5.1.1.2</a>
25768 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>
25769 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>
25770 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>
25771 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>
25772 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>,
25773 position indicator, file, see file position indicator <a href="#5.1.2.3">5.1.2.3</a>
25774 positive difference, <a href="#7.12.12.1">7.12.12.1</a> program, conforming, <a href="#4">4</a>
25775 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>
25776 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
25777 postfix expressions, <a href="#6.5.2">6.5.2</a> default argument, <a href="#6.5.2.2">6.5.2.2</a>
25778 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>
25779 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
25780 pow type-generic macro, <a href="#7.22">7.22</a> pseudo-random sequence functions, <a href="#7.20.2">7.20.2</a>
25781 power functions PTRDIFF_MAX macro, <a href="#7.18.3">7.18.3</a>
25782 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>
25783 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>,
25784 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>
25785 pragma operator, <a href="#6.10.9">6.10.9</a> punctuators, <a href="#6.4.6">6.4.6</a>
25786 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>
25787 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>
25788 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>
25789 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>
25790 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>
25791 predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
25792 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>
25793 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>
25794 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>
25795 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>
25796 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>
25797 preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
25798 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>
25799 #, <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>
25800 ##, <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>
25801 _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> range
25802 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>
25803 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>,
25804 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>,
25805 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>,
25806 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>,
25807 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>,
25808 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>,
25809 PRIcN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.13.1">7.12.13.1</a>
25810 <!--page 547 -->
25811 rank, see integer conversion rank same scope, <a href="#6.2.1">6.2.1</a>
25812 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>
25813 <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>
25814 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>
25815 real type domain, <a href="#6.2.5">6.2.5</a> scalbln type-generic macro, <a href="#7.22">7.22</a>
25816 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>
25817 real-floating, <a href="#7.12.3">7.12.3</a> scalbn type-generic macro, <a href="#7.22">7.22</a>
25818 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>
25819 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>
25820 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>
25821 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>
25822 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>
25823 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>
25824 library functions, <a href="#7.1.4">7.1.4</a> SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>
25825 referenced type, <a href="#6.2.5">6.2.5</a> SCNcMAX macros, <a href="#7.8.1">7.8.1</a>
25826 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>
25827 relational expressions, <a href="#6.5.8">6.5.8</a> SCNcPTR macros, <a href="#7.8.1">7.8.1</a>
25828 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>
25829 remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a> search functions
25830 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>
25831 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>
25832 <a href="#F.9.7.2">F.9.7.2</a> wide string, <a href="#7.24.4.5">7.24.4.5</a>
25833 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>
25834 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>
25835 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>
25836 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>
25837 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>
25838 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>,
25839 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>
25840 pointer, <a href="#6.2.5">6.2.5</a> separate compilation, <a href="#5.1.1.1">5.1.1.1</a>
25841 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>
25842 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>,
25843 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>
25844 functions, <a href="#7.24.6.3">7.24.6.3</a> sequencing of statements, <a href="#6.8">6.8</a>
25845 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>
25846 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>
25847 restore calling environment function, <a href="#7.13.2">7.13.2</a> setjmp.h header, <a href="#7.13">7.13</a>
25848 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>
25849 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>,
25850 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>
25851 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>
25852 <a href="#7.24.3.10">7.24.3.10</a> shift expressions, <a href="#6.5.7">6.5.7</a>
25853 right-shift assignment operator (&gt;&gt;=), <a href="#6.5.16.2">6.5.16.2</a> shift sequence, <a href="#7.1.1">7.1.1</a>
25854 right-shift operator (&gt;&gt;), <a href="#6.5.7">6.5.7</a> shift states, <a href="#5.2.1.2">5.2.1.2</a>
25855 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>
25856 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>,
25857 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>
25858 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>,
25859 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>
25860 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>
25861 SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
25862 <!--page 548 -->
25863 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>
25864 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>
25865 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>,
25866 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>
25867 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>
25868 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>
25869 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>
25870 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>
25871 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>
25872 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>
25873 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>
25874 sign and magnitude, <a href="#6.2.6.2">6.2.6.2</a> <a href="#7.2">&lt;assert.h&gt;</a>, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
25875 sign bit, <a href="#6.2.6.2">6.2.6.2</a> <a href="#7.3">&lt;complex.h&gt;</a>, <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>,
25876 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>
25877 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> <a href="#7.4">&lt;ctype.h&gt;</a>, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
25878 signal handling functions, <a href="#7.14.1">7.14.1</a> <a href="#7.5">&lt;errno.h&gt;</a>, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
25879 signal.h header, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a> <a href="#7.6">&lt;fenv.h&gt;</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="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>, <a href="#H">H</a>
25880 signaling NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#F.2.1">F.2.1</a> <a href="#7.7">&lt;float.h&gt;</a>, <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>,
25881 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>
25882 signbit macro, <a href="#7.12.3.6">7.12.3.6</a>, <a href="#F.3">F.3</a> <a href="#7.8">&lt;inttypes.h&gt;</a>, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a>
25883 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>, <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#4">4</a>, <a href="#7.9">7.9</a>
25884 <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.10">&lt;limits.h&gt;</a>, <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>
25885 signed character, <a href="#6.3.1.1">6.3.1.1</a> <a href="#7.11">&lt;locale.h&gt;</a>, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
25886 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> <a href="#7.12">&lt;math.h&gt;</a>, <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>,
25887 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>
25888 <a href="#6.3.1.8">6.3.1.8</a> <a href="#7.13">&lt;setjmp.h&gt;</a>, <a href="#7.13">7.13</a>
25889 signed types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a> <a href="#7.14">&lt;signal.h&gt;</a>, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a>
25890 significand part, <a href="#6.4.4.2">6.4.4.2</a> <a href="#7.15">&lt;stdarg.h&gt;</a>, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a>
25891 SIGSEGV macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> <a href="#7.16">&lt;stdbool.h&gt;</a>, <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>
25892 SIGTERM macro, <a href="#7.14">7.14</a> <a href="#7.17">&lt;stddef.h&gt;</a>, <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>,
25893 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>
25894 sin functions, <a href="#7.12.4.6">7.12.4.6</a>, <a href="#F.9.1.6">F.9.1.6</a> <a href="#7.18">&lt;stdint.h&gt;</a>, <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>,
25895 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>
25896 single-byte character, <a href="#3.7.1">3.7.1</a>, <a href="#5.2.1.2">5.2.1.2</a> <a href="#7.19">&lt;stdio.h&gt;</a>, <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>
25897 single-byte/wide character conversion functions, <a href="#7.20">&lt;stdlib.h&gt;</a>, <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>
25898 <a href="#7.24.6.1">7.24.6.1</a> <a href="#7.21">&lt;string.h&gt;</a>, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a>
25899 single-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.22">&lt;tgmath.h&gt;</a>, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25900 single-quote escape sequence (\'), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> <a href="#7.23">&lt;time.h&gt;</a>, <a href="#7.23">7.23</a>
25901 sinh functions, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#F.9.2.5">F.9.2.5</a> <a href="#7.24">&lt;wchar.h&gt;</a>, <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>,
25902 sinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#F">F</a>
25903 SIZE_MAX macro, <a href="#7.18.3">7.18.3</a> <a href="#7.25">&lt;wctype.h&gt;</a>, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a>
25904 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>
25905 <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>
25906 <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>
25907 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>
25908 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>
25909 sorting utility functions, <a href="#7.20.5">7.20.5</a> statements, <a href="#6.8">6.8</a>
25910 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>
25911 source file, <a href="#5.1.1.1">5.1.1.1</a> compound, <a href="#6.8.2">6.8.2</a>
25912 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>
25913 source file inclusion, <a href="#6.10.2">6.10.2</a> do, <a href="#6.8.5.2">6.8.5.2</a>
25914 <!--page 549 -->
25915 else, <a href="#6.8.4.1">6.8.4.1</a> strictly conforming program, <a href="#4">4</a>
25916 expression, <a href="#6.8.3">6.8.3</a> string, <a href="#7.1.1">7.1.1</a>
25917 for, <a href="#6.8.5.3">6.8.5.3</a> comparison functions, <a href="#7.21.4">7.21.4</a>
25918 goto, <a href="#6.8.6.1">6.8.6.1</a> concatenation functions, <a href="#7.21.3">7.21.3</a>
25919 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>
25920 iteration, <a href="#6.8.5">6.8.5</a> copying functions, <a href="#7.21.2">7.21.2</a>
25921 jump, <a href="#6.8.6">6.8.6</a> library function conventions, <a href="#7.21.1">7.21.1</a>
25922 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>
25923 null, <a href="#6.8.3">6.8.3</a> miscellaneous functions, <a href="#7.21.6">7.21.6</a>
25924 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>
25925 selection, <a href="#6.8.4">6.8.4</a> search functions, <a href="#7.21.5">7.21.5</a>
25926 sequencing, <a href="#6.8">6.8</a> string handling header, <a href="#7.21">7.21</a>
25927 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>
25928 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>
25929 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>
25930 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>
25931 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>
25932 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>
25933 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>
25934 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>
25935 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>
25936 <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>
25937 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>,
25938 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>
25939 <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>
25940 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>
25941 <a href="#7.26.8">7.26.8</a> strtok function, <a href="#7.21.5.8">7.21.5.8</a>
25942 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>,
25943 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>
25944 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>
25945 <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>
25946 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>,
25947 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>
25948 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>
25949 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>
25950 strchr function, <a href="#7.21.5.2">7.21.5.2</a> struct hack, see flexible array member
25951 strcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.2">7.21.4.2</a> structure
25952 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 (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
25953 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>
25954 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>
25955 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>
25956 fully buffered, <a href="#7.19.3">7.19.3</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
25957 line buffered, <a href="#7.19.3">7.19.3</a> member name space, <a href="#6.2.3">6.2.3</a>
25958 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>
25959 standard error, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
25960 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>
25961 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>
25962 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>
25963 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>
25964 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>
25965 <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>
25966 <!--page 550 -->
25967 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>
25968 suffix toupper function, <a href="#7.4.2.2">7.4.2.2</a>
25969 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>
25970 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>
25971 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>
25972 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>
25973 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>
25974 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>
25975 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>
25976 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>,
25977 symbols, <a href="#3">3</a> <a href="#6.5.2.3">6.5.2.3</a>
25978 syntactic categories, <a href="#6.1">6.1</a> trigonometric functions
25979 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>
25980 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>
25981 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>
25982 system function, <a href="#7.20.4.6">7.20.4.6</a> true macro, <a href="#7.16">7.16</a>
25983 trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.9.6.8">F.9.6.8</a>
25984 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>
25985 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>
25986 tag name space, <a href="#6.2.3">6.2.3</a> truncation toward zero, <a href="#6.5.5">6.5.5</a>
25987 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>
25988 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>
25989 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>
25990 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>
25991 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>
25992 tentative definition, <a href="#6.9.2">6.9.2</a> type names, <a href="#6.7.6">6.7.6</a>
25993 terms, <a href="#3">3</a> type punning, <a href="#6.5.2.3">6.5.2.3</a>
25994 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>
25995 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>
25996 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>
25997 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>
25998 time typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.7">6.7.7</a>
25999 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>
26000 <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>
26001 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>
26002 <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>
26003 components, <a href="#7.23.1">7.23.1</a> composite, <a href="#6.2.7">6.2.7</a>
26004 conversion functions, <a href="#7.23.3">7.23.3</a> const qualified, <a href="#6.7.3">6.7.3</a>
26005 wide character, <a href="#7.24.5">7.24.5</a> conversions, <a href="#6.3">6.3</a>
26006 local, <a href="#7.23.1">7.23.1</a> imaginary, <a href="#G">G</a>
26007 manipulation functions, <a href="#7.23.2">7.23.2</a> restrict qualified, <a href="#6.7.3">6.7.3</a>
26008 time function, <a href="#7.23.2.4">7.23.2.4</a> volatile qualified, <a href="#6.7.3">6.7.3</a>
26009 time.h header, <a href="#7.23">7.23</a>
26010 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>
26011 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>
26012 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>
26013 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>
26014 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>
26015 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>
26016 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>
26017 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>
26018 <!--page 551 -->
26019 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>
26020 <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>,
26021 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>
26022 UINTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> utilities, general, <a href="#7.20">7.20</a>
26023 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>
26024 UINTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a>
26025 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>,
26026 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>,
26027 <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>,
26028 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>,
26029 <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>
26030 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>,
26031 unary expression, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.3">7.15.1.3</a>
26032 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>,
26033 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>,
26034 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>,
26035 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>,
26036 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>
26037 <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>
26038 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>,
26039 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>,
26040 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>,
26041 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>,
26042 <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>
26043 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>
26044 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>
26045 union variable arguments, <a href="#6.10.3">6.10.3</a>, <a href="#7.15">7.15</a>
26046 arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> variable arguments header, <a href="#7.15">7.15</a>
26047 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>
26048 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>
26049 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>
26050 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>,
26051 member name space, <a href="#6.2.3">6.2.3</a> <a href="#7.4.1.10">7.4.1.10</a>
26052 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>
26053 pointer operator (-&gt;), <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>
26054 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>
26055 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>
26056 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>
26057 universal character name, <a href="#6.4.3">6.4.3</a> VLA, see variable length array
26058 unqualified type, <a href="#6.2.5">6.2.5</a> void expression, <a href="#6.3.2.2">6.3.2.2</a>
26059 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>
26060 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>
26061 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>
26062 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>
26063 <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>
26064 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>
26065 <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>
26066 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>
26067 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>
26068 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>
26069 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>
26070 <!--page 552 -->
26071 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>
26072 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>
26073 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>,
26074 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>,
26075 <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.25.1">7.25.1</a>
26076 warnings, <a href="#I">I</a> while statement, <a href="#6.8.5.1">6.8.5.1</a>
26077 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>,
26078 <a href="#F">F</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>
26079 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>
26080 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>
26081 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>
26082 <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>
26083 <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>
26084 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>
26085 <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>
26086 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>
26087 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>
26088 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>
26089 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>
26090 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>
26091 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>
26092 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>
26093 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>
26094 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>
26095 wcsncmp function, <a href="#7.24.4.4.3">7.24.4.4.3</a> wide string literal, see string literal
26096 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>
26097 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>,
26098 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>
26099 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>
26100 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>
26101 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>
26102 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>
26103 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>
26104 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>,
26105 wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a> <a href="#7.25.1">7.25.1</a>
26106 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>
26107 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>
26108 <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>
26109 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>
26110 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>
26111 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>
26112 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>,
26113 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.3.10">7.24.3.10</a>
26114 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>
26115 wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a> xor macro, <a href="#7.9">7.9</a>
26116 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>
26117 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>
26118 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>
26119 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>
26120 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>
26121 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>
26122 </pre>
26123 </body></html>