readme fix, +ann2html todo
[c-standard.git] / n1548.html
blob47d9b1b214e2787172520addc23891ffd0f0a154
1 <html><head><title>N1548 December 2, 2010 ISO/IEC 9899:201x</title></head><body>
2 <pre><!--page 1 -->
3 N1548 Committee Draft -- December 2, 2010 ISO/IEC 9899:201x
8 INTERNATIONAL STANDARD (C)ISO/IEC ISO/IEC 9899:201x
13 </pre>
15 <h1>Programming languages -- C</h1>
16 <pre>
19 ABSTRACT
23 (Cover sheet to be provided by ISO Secretariat.)
25 This International Standard specifies the form and establishes the interpretation of
26 programs expressed in the programming language C. Its purpose is to promote
27 portability, reliability, maintainability, and efficient execution of C language programs on
28 a variety of computing systems.
30 Clauses are included that detail the C language itself and the contents of the C language
31 execution library. Annexes summarize aspects of both of them, and enumerate factors
32 that influence the portability of C programs.
34 Although this International Standard is intended to guide knowledgeable C language
35 programmers as well as implementors of C language translation systems, the document
36 itself is not designed to serve as a tutorial.
38 Recipients of this draft are invited to submit, with their comments, notification of any
39 relevant patent rights of which they are aware and to provide supporting documentation.
41 Changes from the previous draft (N1256) are indicated by ''diff marks'' in the right
42 margin: deleted text is marked with ''*'', new or changed text with '' ''.
43 <!--page 2 -->
44 <!--page 3 -->
45 </pre>
47 <h2><a name="Contents" href="#Contents">Contents</a></h2>
48 <ul>
49 <li><a href="#Foreword">Foreword</a>
50 <li><a href="#Introduction">Introduction</a>
51 <li><a href="#1">1. Scope</a>
52 <li><a href="#2">2. Normative references</a>
53 <li><a href="#3">3. Terms, definitions, and symbols</a>
54 <li><a href="#4">4. Conformance</a>
55 <li><a href="#5">5. Environment</a>
56 <ul>
57 <li><a href="#5.1"> 5.1 Conceptual models</a>
58 <ul>
59 <li><a href="#5.1.1"> 5.1.1 Translation environment</a>
60 <li><a href="#5.1.2"> 5.1.2 Execution environments</a>
61 </ul>
62 <li><a href="#5.2"> 5.2 Environmental considerations</a>
63 <ul>
64 <li><a href="#5.2.1"> 5.2.1 Character sets</a>
65 <li><a href="#5.2.2"> 5.2.2 Character display semantics</a>
66 <li><a href="#5.2.3"> 5.2.3 Signals and interrupts</a>
67 <li><a href="#5.2.4"> 5.2.4 Environmental limits</a>
68 </ul>
69 </ul>
70 <li><a href="#6">6. Language</a>
71 <ul>
72 <li><a href="#6.1"> 6.1 Notation</a>
73 <li><a href="#6.2"> 6.2 Concepts</a>
74 <ul>
75 <li><a href="#6.2.1"> 6.2.1 Scopes of identifiers</a>
76 <li><a href="#6.2.2"> 6.2.2 Linkages of identifiers</a>
77 <li><a href="#6.2.3"> 6.2.3 Name spaces of identifiers</a>
78 <li><a href="#6.2.4"> 6.2.4 Storage durations of objects</a>
79 <li><a href="#6.2.5"> 6.2.5 Types</a>
80 <li><a href="#6.2.6"> 6.2.6 Representations of types</a>
81 <li><a href="#6.2.7"> 6.2.7 Compatible type and composite type</a>
82 <li><a href="#6.2.8"> 6.2.8 Alignment of objects</a>
83 </ul>
84 <li><a href="#6.3"> 6.3 Conversions</a>
85 <ul>
86 <li><a href="#6.3.1"> 6.3.1 Arithmetic operands</a>
87 <li><a href="#6.3.2"> 6.3.2 Other operands</a>
88 </ul>
89 <li><a href="#6.4"> 6.4 Lexical elements</a>
90 <ul>
91 <li><a href="#6.4.1"> 6.4.1 Keywords</a>
92 <li><a href="#6.4.2"> 6.4.2 Identifiers</a>
93 <li><a href="#6.4.3"> 6.4.3 Universal character names</a>
94 <li><a href="#6.4.4"> 6.4.4 Constants</a>
95 <li><a href="#6.4.5"> 6.4.5 String literals</a>
96 <li><a href="#6.4.6"> 6.4.6 Punctuators</a>
97 <li><a href="#6.4.7"> 6.4.7 Header names</a>
98 <li><a href="#6.4.8"> 6.4.8 Preprocessing numbers</a>
99 <li><a href="#6.4.9"> 6.4.9 Comments</a>
100 <!--page 4 -->
101 </ul>
102 <li><a href="#6.5"> 6.5 Expressions</a>
103 <ul>
104 <li><a href="#6.5.1"> 6.5.1 Primary expressions</a>
105 <li><a href="#6.5.2"> 6.5.2 Postfix operators</a>
106 <li><a href="#6.5.3"> 6.5.3 Unary operators</a>
107 <li><a href="#6.5.4"> 6.5.4 Cast operators</a>
108 <li><a href="#6.5.5"> 6.5.5 Multiplicative operators</a>
109 <li><a href="#6.5.6"> 6.5.6 Additive operators</a>
110 <li><a href="#6.5.7"> 6.5.7 Bitwise shift operators</a>
111 <li><a href="#6.5.8"> 6.5.8 Relational operators</a>
112 <li><a href="#6.5.9"> 6.5.9 Equality operators</a>
113 <li><a href="#6.5.10"> 6.5.10 Bitwise AND operator</a>
114 <li><a href="#6.5.11"> 6.5.11 Bitwise exclusive OR operator</a>
115 <li><a href="#6.5.12"> 6.5.12 Bitwise inclusive OR operator</a>
116 <li><a href="#6.5.13"> 6.5.13 Logical AND operator</a>
117 <li><a href="#6.5.14"> 6.5.14 Logical OR operator</a>
118 <li><a href="#6.5.15"> 6.5.15 Conditional operator</a>
119 <li><a href="#6.5.16"> 6.5.16 Assignment operators</a>
120 <li><a href="#6.5.17"> 6.5.17 Comma operator</a>
121 </ul>
122 <li><a href="#6.6"> 6.6 Constant expressions</a>
123 <li><a href="#6.7"> 6.7 Declarations</a>
124 <ul>
125 <li><a href="#6.7.1"> 6.7.1 Storage-class specifiers</a>
126 <li><a href="#6.7.2"> 6.7.2 Type specifiers</a>
127 <li><a href="#6.7.3"> 6.7.3 Type qualifiers</a>
128 <li><a href="#6.7.4"> 6.7.4 Function specifiers</a>
129 <li><a href="#6.7.5"> 6.7.5 Alignment specifier</a>
130 <li><a href="#6.7.6"> 6.7.6 Declarators</a>
131 <li><a href="#6.7.7"> 6.7.7 Type names</a>
132 <li><a href="#6.7.8"> 6.7.8 Type definitions</a>
133 <li><a href="#6.7.9"> 6.7.9 Initialization</a>
134 <li><a href="#6.7.10"> 6.7.10 Static assertions</a>
135 </ul>
136 <li><a href="#6.8"> 6.8 Statements and blocks</a>
137 <ul>
138 <li><a href="#6.8.1"> 6.8.1 Labeled statements</a>
139 <li><a href="#6.8.2"> 6.8.2 Compound statement</a>
140 <li><a href="#6.8.3"> 6.8.3 Expression and null statements</a>
141 <li><a href="#6.8.4"> 6.8.4 Selection statements</a>
142 <li><a href="#6.8.5"> 6.8.5 Iteration statements</a>
143 <li><a href="#6.8.6"> 6.8.6 Jump statements</a>
144 </ul>
145 <li><a href="#6.9"> 6.9 External definitions</a>
146 <ul>
147 <li><a href="#6.9.1"> 6.9.1 Function definitions</a>
148 <li><a href="#6.9.2"> 6.9.2 External object definitions</a>
149 </ul>
150 <li><a href="#6.10"> 6.10 Preprocessing directives</a>
151 <ul>
152 <li><a href="#6.10.1"> 6.10.1 Conditional inclusion</a>
153 <li><a href="#6.10.2"> 6.10.2 Source file inclusion</a>
154 <li><a href="#6.10.3"> 6.10.3 Macro replacement</a>
155 <!--page 5 -->
156 <li><a href="#6.10.4"> 6.10.4 Line control</a>
157 <li><a href="#6.10.5"> 6.10.5 Error directive</a>
158 <li><a href="#6.10.6"> 6.10.6 Pragma directive</a>
159 <li><a href="#6.10.7"> 6.10.7 Null directive</a>
160 <li><a href="#6.10.8"> 6.10.8 Predefined macro names</a>
161 <li><a href="#6.10.9"> 6.10.9 Pragma operator</a>
162 </ul>
163 <li><a href="#6.11"> 6.11 Future language directions</a>
164 <ul>
165 <li><a href="#6.11.1"> 6.11.1 Floating types</a>
166 <li><a href="#6.11.2"> 6.11.2 Linkages of identifiers</a>
167 <li><a href="#6.11.3"> 6.11.3 External names</a>
168 <li><a href="#6.11.4"> 6.11.4 Character escape sequences</a>
169 <li><a href="#6.11.5"> 6.11.5 Storage-class specifiers</a>
170 <li><a href="#6.11.6"> 6.11.6 Function declarators</a>
171 <li><a href="#6.11.7"> 6.11.7 Function definitions</a>
172 <li><a href="#6.11.8"> 6.11.8 Pragma directives</a>
173 <li><a href="#6.11.9"> 6.11.9 Predefined macro names</a>
174 </ul>
175 </ul>
176 <li><a href="#7">7. Library</a>
177 <ul>
178 <li><a href="#7.1"> 7.1 Introduction</a>
179 <ul>
180 <li><a href="#7.1.1"> 7.1.1 Definitions of terms</a>
181 <li><a href="#7.1.2"> 7.1.2 Standard headers</a>
182 <li><a href="#7.1.3"> 7.1.3 Reserved identifiers</a>
183 <li><a href="#7.1.4"> 7.1.4 Use of library functions</a>
184 </ul>
185 <li><a href="#7.2"> 7.2 Diagnostics &lt;assert.h&gt;</a>
186 <ul>
187 <li><a href="#7.2.1"> 7.2.1 Program diagnostics</a>
188 </ul>
189 <li><a href="#7.3"> 7.3 Complex arithmetic &lt;complex.h&gt;</a>
190 <ul>
191 <li><a href="#7.3.1"> 7.3.1 Introduction</a>
192 <li><a href="#7.3.2"> 7.3.2 Conventions</a>
193 <li><a href="#7.3.3"> 7.3.3 Branch cuts</a>
194 <li><a href="#7.3.4"> 7.3.4 The CX_LIMITED_RANGE pragma</a>
195 <li><a href="#7.3.5"> 7.3.5 Trigonometric functions</a>
196 <li><a href="#7.3.6"> 7.3.6 Hyperbolic functions</a>
197 <li><a href="#7.3.7"> 7.3.7 Exponential and logarithmic functions</a>
198 <li><a href="#7.3.8"> 7.3.8 Power and absolute-value functions</a>
199 <li><a href="#7.3.9"> 7.3.9 Manipulation functions</a>
200 </ul>
201 <li><a href="#7.4"> 7.4 Character handling &lt;ctype.h&gt;</a>
202 <ul>
203 <li><a href="#7.4.1"> 7.4.1 Character classification functions</a>
204 <li><a href="#7.4.2"> 7.4.2 Character case mapping functions</a>
205 </ul>
206 <li><a href="#7.5"> 7.5 Errors &lt;errno.h&gt;</a>
207 <li><a href="#7.6"> 7.6 Floating-point environment &lt;fenv.h&gt;</a>
208 <ul>
209 <li><a href="#7.6.1"> 7.6.1 The FENV_ACCESS pragma</a>
210 <li><a href="#7.6.2"> 7.6.2 Floating-point exceptions</a>
211 <li><a href="#7.6.3"> 7.6.3 Rounding</a>
212 <li><a href="#7.6.4"> 7.6.4 Environment</a>
213 </ul>
214 <li><a href="#7.7"> 7.7 Characteristics of floating types &lt;float.h&gt;</a>
215 <!--page 6 -->
216 <li><a href="#7.8"> 7.8 Format conversion of integer types &lt;inttypes.h&gt;</a>
217 <ul>
218 <li><a href="#7.8.1"> 7.8.1 Macros for format specifiers</a>
219 <li><a href="#7.8.2"> 7.8.2 Functions for greatest-width integer types</a>
220 </ul>
221 <li><a href="#7.9"> 7.9 Alternative spellings &lt;iso646.h&gt;</a>
222 <li><a href="#7.10"> 7.10 Sizes of integer types &lt;limits.h&gt;</a>
223 <li><a href="#7.11"> 7.11 Localization &lt;locale.h&gt;</a>
224 <ul>
225 <li><a href="#7.11.1"> 7.11.1 Locale control</a>
226 <li><a href="#7.11.2"> 7.11.2 Numeric formatting convention inquiry</a>
227 </ul>
228 <li><a href="#7.12"> 7.12 Mathematics &lt;math.h&gt;</a>
229 <ul>
230 <li><a href="#7.12.1"> 7.12.1 Treatment of error conditions</a>
231 <li><a href="#7.12.2"> 7.12.2 The FP_CONTRACT pragma</a>
232 <li><a href="#7.12.3"> 7.12.3 Classification macros</a>
233 <li><a href="#7.12.4"> 7.12.4 Trigonometric functions</a>
234 <li><a href="#7.12.5"> 7.12.5 Hyperbolic functions</a>
235 <li><a href="#7.12.6"> 7.12.6 Exponential and logarithmic functions</a>
236 <li><a href="#7.12.7"> 7.12.7 Power and absolute-value functions</a>
237 <li><a href="#7.12.8"> 7.12.8 Error and gamma functions</a>
238 <li><a href="#7.12.9"> 7.12.9 Nearest integer functions</a>
239 <li><a href="#7.12.10"> 7.12.10 Remainder functions</a>
240 <li><a href="#7.12.11"> 7.12.11 Manipulation functions</a>
241 <li><a href="#7.12.12"> 7.12.12 Maximum, minimum, and positive difference functions</a>
242 <li><a href="#7.12.13"> 7.12.13 Floating multiply-add</a>
243 <li><a href="#7.12.14"> 7.12.14 Comparison macros</a>
244 </ul>
245 <li><a href="#7.13"> 7.13 Nonlocal jumps &lt;setjmp.h&gt;</a>
246 <ul>
247 <li><a href="#7.13.1"> 7.13.1 Save calling environment</a>
248 <li><a href="#7.13.2"> 7.13.2 Restore calling environment</a>
249 </ul>
250 <li><a href="#7.14"> 7.14 Signal handling &lt;signal.h&gt;</a>
251 <ul>
252 <li><a href="#7.14.1"> 7.14.1 Specify signal handling</a>
253 <li><a href="#7.14.2"> 7.14.2 Send signal</a>
254 </ul>
255 <li><a href="#7.15"> 7.15 Alignment &lt;stdalign.h&gt;</a>
256 <li><a href="#7.16"> 7.16 Variable arguments &lt;stdarg.h&gt;</a>
257 <ul>
258 <li><a href="#7.16.1"> 7.16.1 Variable argument list access macros</a>
259 </ul>
260 <li><a href="#7.17"> 7.17 Atomics &lt;stdatomic.h&gt;</a>
261 <ul>
262 <li><a href="#7.17.1"> 7.17.1 Introduction</a>
263 <li><a href="#7.17.2"> 7.17.2 Initialization</a>
264 <li><a href="#7.17.3"> 7.17.3 Order and consistency</a>
265 <li><a href="#7.17.4"> 7.17.4 Fences</a>
266 <li><a href="#7.17.5"> 7.17.5 Lock-free property</a>
267 <li><a href="#7.17.6"> 7.17.6 Atomic integer and address types</a>
268 <li><a href="#7.17.7"> 7.17.7 Operations on atomic types</a>
269 <li><a href="#7.17.8"> 7.17.8 Atomic flag type and operations</a>
270 </ul>
271 <li><a href="#7.18"> 7.18 Boolean type and values &lt;stdbool.h&gt;</a>
272 <li><a href="#7.19"> 7.19 Common definitions &lt;stddef.h&gt;</a>
273 <li><a href="#7.20"> 7.20 Integer types &lt;stdint.h&gt;</a>
274 <!--page 7 -->
275 <ul>
276 <li><a href="#7.20.1"> 7.20.1 Integer types</a>
277 <li><a href="#7.20.2"> 7.20.2 Limits of specified-width integer types</a>
278 <li><a href="#7.20.3"> 7.20.3 Limits of other integer types</a>
279 <li><a href="#7.20.4"> 7.20.4 Macros for integer constants</a>
280 </ul>
281 <li><a href="#7.21"> 7.21 Input/output &lt;stdio.h&gt;</a>
282 <ul>
283 <li><a href="#7.21.1"> 7.21.1 Introduction</a>
284 <li><a href="#7.21.2"> 7.21.2 Streams</a>
285 <li><a href="#7.21.3"> 7.21.3 Files</a>
286 <li><a href="#7.21.4"> 7.21.4 Operations on files</a>
287 <li><a href="#7.21.5"> 7.21.5 File access functions</a>
288 <li><a href="#7.21.6"> 7.21.6 Formatted input/output functions</a>
289 <li><a href="#7.21.7"> 7.21.7 Character input/output functions</a>
290 <li><a href="#7.21.8"> 7.21.8 Direct input/output functions</a>
291 <li><a href="#7.21.9"> 7.21.9 File positioning functions</a>
292 <li><a href="#7.21.10"> 7.21.10 Error-handling functions</a>
293 </ul>
294 <li><a href="#7.22"> 7.22 General utilities &lt;stdlib.h&gt;</a>
295 <ul>
296 <li><a href="#7.22.1"> 7.22.1 Numeric conversion functions</a>
297 <li><a href="#7.22.2"> 7.22.2 Pseudo-random sequence generation functions</a>
298 <li><a href="#7.22.3"> 7.22.3 Memory management functions</a>
299 <li><a href="#7.22.4"> 7.22.4 Communication with the environment</a>
300 <li><a href="#7.22.5"> 7.22.5 Searching and sorting utilities</a>
301 <li><a href="#7.22.6"> 7.22.6 Integer arithmetic functions</a>
302 <li><a href="#7.22.7"> 7.22.7 Multibyte/wide character conversion functions</a>
303 <li><a href="#7.22.8"> 7.22.8 Multibyte/wide string conversion functions</a>
304 </ul>
305 <li><a href="#7.23"> 7.23 String handling &lt;string.h&gt;</a>
306 <ul>
307 <li><a href="#7.23.1"> 7.23.1 String function conventions</a>
308 <li><a href="#7.23.2"> 7.23.2 Copying functions</a>
309 <li><a href="#7.23.3"> 7.23.3 Concatenation functions</a>
310 <li><a href="#7.23.4"> 7.23.4 Comparison functions</a>
311 <li><a href="#7.23.5"> 7.23.5 Search functions</a>
312 <li><a href="#7.23.6"> 7.23.6 Miscellaneous functions</a>
313 </ul>
314 <li><a href="#7.24"> 7.24 Type-generic math &lt;tgmath.h&gt;</a>
315 <li><a href="#7.25"> 7.25 Threads &lt;threads.h&gt;</a>
316 <ul>
317 <li><a href="#7.25.1"> 7.25.1 Introduction</a>
318 <li><a href="#7.25.2"> 7.25.2 Initialization functions</a>
319 <li><a href="#7.25.3"> 7.25.3 Condition variable functions</a>
320 <li><a href="#7.25.4"> 7.25.4 Mutex functions</a>
321 <li><a href="#7.25.5"> 7.25.5 Thread functions</a>
322 <li><a href="#7.25.6"> 7.25.6 Thread-specific storage functions</a>
323 <li><a href="#7.25.7"> 7.25.7 Time functions</a>
324 </ul>
325 <li><a href="#7.26"> 7.26 Date and time &lt;time.h&gt;</a>
326 <ul>
327 <li><a href="#7.26.1"> 7.26.1 Components of time</a>
328 <li><a href="#7.26.2"> 7.26.2 Time manipulation functions</a>
329 <li><a href="#7.26.3"> 7.26.3 Time conversion functions</a>
330 <!--page 8 -->
331 </ul>
332 <li><a href="#7.27"> 7.27 Unicode utilities &lt;uchar.h&gt;</a>
333 <ul>
334 <li><a href="#7.27.1"> 7.27.1 Restartable multibyte/wide character conversion functions</a>
335 </ul>
336 <li><a href="#7.28"> 7.28 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
337 <ul>
338 <li><a href="#7.28.1"> 7.28.1 Introduction</a>
339 <li><a href="#7.28.2"> 7.28.2 Formatted wide character input/output functions</a>
340 <li><a href="#7.28.3"> 7.28.3 Wide character input/output functions</a>
341 <li><a href="#7.28.4"> 7.28.4 General wide string utilities</a>
342 <ul>
343 <li><a href="#7.28.4.1"> 7.28.4.1 Wide string numeric conversion functions</a>
344 <li><a href="#7.28.4.2"> 7.28.4.2 Wide string copying functions</a>
345 <li><a href="#7.28.4.3"> 7.28.4.3 Wide string concatenation functions</a>
346 <li><a href="#7.28.4.4"> 7.28.4.4 Wide string comparison functions</a>
347 <li><a href="#7.28.4.5"> 7.28.4.5 Wide string search functions</a>
348 <li><a href="#7.28.4.6"> 7.28.4.6 Miscellaneous functions</a>
349 </ul>
350 <li><a href="#7.28.5"> 7.28.5 Wide character time conversion functions</a>
351 <li><a href="#7.28.6"> 7.28.6 Extended multibyte/wide character conversion utilities</a>
352 <ul>
353 <li><a href="#7.28.6.1"> 7.28.6.1 Single-byte/wide character conversion functions</a>
354 <li><a href="#7.28.6.2"> 7.28.6.2 Conversion state functions</a>
355 <li><a href="#7.28.6.3"> 7.28.6.3 Restartable multibyte/wide character conversion functions</a>
356 <li><a href="#7.28.6.4"> 7.28.6.4 Restartable multibyte/wide string conversion functions</a>
357 </ul>
358 </ul>
359 <li><a href="#7.29"> 7.29 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
360 <ul>
361 <li><a href="#7.29.1"> 7.29.1 Introduction</a>
362 <li><a href="#7.29.2"> 7.29.2 Wide character classification utilities</a>
363 <ul>
364 <li><a href="#7.29.2.1"> 7.29.2.1 Wide character classification functions</a>
365 <li><a href="#7.29.2.2"> 7.29.2.2 Extensible wide character classification functions</a>
366 </ul>
367 <li><a href="#7.29.3"> 7.29.3 Wide character case mapping utilities</a>
368 <ul>
369 <li><a href="#7.29.3.1"> 7.29.3.1 Wide character case mapping functions</a>
370 <li><a href="#7.29.3.2"> 7.29.3.2 Extensible wide character case mapping functions</a>
371 </ul>
372 </ul>
373 <li><a href="#7.30"> 7.30 Future library directions</a>
374 <ul>
375 <li><a href="#7.30.1"> 7.30.1 Complex arithmetic &lt;complex.h&gt;</a>
376 <li><a href="#7.30.2"> 7.30.2 Character handling &lt;ctype.h&gt;</a>
377 <li><a href="#7.30.3"> 7.30.3 Errors &lt;errno.h&gt;</a>
378 <li><a href="#7.30.4"> 7.30.4 Format conversion of integer types &lt;inttypes.h&gt;</a>
379 <li><a href="#7.30.5"> 7.30.5 Localization &lt;locale.h&gt;</a>
380 <li><a href="#7.30.6"> 7.30.6 Signal handling &lt;signal.h&gt;</a>
381 <li><a href="#7.30.7"> 7.30.7 Boolean type and values &lt;stdbool.h&gt;</a>
382 <li><a href="#7.30.8"> 7.30.8 Integer types &lt;stdint.h&gt;</a>
383 <li><a href="#7.30.9"> 7.30.9 Input/output &lt;stdio.h&gt;</a>
384 <li><a href="#7.30.10"> 7.30.10 General utilities &lt;stdlib.h&gt;</a>
385 <li><a href="#7.30.11"> 7.30.11 String handling &lt;string.h&gt;</a>
386 <!--page 9 -->
387 <li><a href="#7.30.12"> 7.30.12 Extended multibyte and wide character utilities <wchar.h></a>
388 <li><a href="#7.30.13"> 7.30.13 Wide character classification and mapping utilities <wctype.h></a>
389 </ul>
390 </ul>
391 <li><a href="#A">Annex A (informative) Language syntax summary</a>
392 <ul>
393 <li><a href="#A.1"> A.1 Lexical grammar</a>
394 <li><a href="#A.2"> A.2 Phrase structure grammar</a>
395 <li><a href="#A.3"> A.3 Preprocessing directives</a>
396 </ul>
397 <li><a href="#B">Annex B (informative) Library summary</a>
398 <ul>
399 <li><a href="#B.1"> B.1 Diagnostics &lt;assert.h&gt;</a>
400 <li><a href="#B.2"> B.2 Complex &lt;complex.h&gt;</a>
401 <li><a href="#B.3"> B.3 Character handling &lt;ctype.h&gt;</a>
402 <li><a href="#B.4"> B.4 Errors &lt;errno.h&gt;</a>
403 <li><a href="#B.5"> B.5 Floating-point environment &lt;fenv.h&gt;</a>
404 <li><a href="#B.6"> B.6 Characteristics of floating types &lt;float.h&gt;</a>
405 <li><a href="#B.7"> B.7 Format conversion of integer types &lt;inttypes.h&gt;</a>
406 <li><a href="#B.8"> B.8 Alternative spellings &lt;iso646.h&gt;</a>
407 <li><a href="#B.9"> B.9 Sizes of integer types &lt;limits.h&gt;</a>
408 <li><a href="#B.10"> B.10 Localization &lt;locale.h&gt;</a>
409 <li><a href="#B.11"> B.11 Mathematics &lt;math.h&gt;</a>
410 <li><a href="#B.12"> B.12 Nonlocal jumps &lt;setjmp.h&gt;</a>
411 <li><a href="#B.13"> B.13 Signal handling &lt;signal.h&gt;</a>
412 <li><a href="#B.14"> B.14 Alignment &lt;stdalign.h&gt;</a>
413 <li><a href="#B.15"> B.15 Variable arguments &lt;stdarg.h&gt;</a>
414 <li><a href="#B.16"> B.16 Atomics &lt;stdatomic.h&gt;</a>
415 <li><a href="#B.17"> B.17 Boolean type and values &lt;stdbool.h&gt;</a>
416 <li><a href="#B.18"> B.18 Common definitions &lt;stddef.h&gt;</a>
417 <li><a href="#B.19"> B.19 Integer types &lt;stdint.h&gt;</a>
418 <li><a href="#B.20"> B.20 Input/output &lt;stdio.h&gt;</a>
419 <li><a href="#B.21"> B.21 General utilities &lt;stdlib.h&gt;</a>
420 <li><a href="#B.22"> B.22 String handling &lt;string.h&gt;</a>
421 <li><a href="#B.23"> B.23 Type-generic math &lt;tgmath.h&gt;</a>
422 <li><a href="#B.24"> B.24 Threads &lt;threads.h&gt;</a>
423 <li><a href="#B.25"> B.25 Date and time &lt;time.h&gt;</a>
424 <li><a href="#B.26"> B.26 Unicode utilities &lt;uchar.h&gt;</a>
425 <li><a href="#B.27"> B.27 Extended multibyte/wide character utilities &lt;wchar.h&gt;</a>
426 <li><a href="#B.28"> B.28 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
427 </ul>
428 <li><a href="#C">Annex C (informative) Sequence points</a>
429 <li><a href="#D">Annex D (normative) Universal character names for identifiers</a>
430 <ul>
431 <li><a href="#D.1"> D.1 Ranges of characters allowed</a>
432 <li><a href="#D.2"> D.2 Ranges of characters disallowed initially</a>
433 </ul>
434 <li><a href="#E">Annex E (informative) Implementation limits</a>
435 <!--page 10 -->
436 <li><a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic</a>
437 <ul>
438 <li><a href="#F.1"> F.1 Introduction</a>
439 <li><a href="#F.2"> F.2 Types</a>
440 <li><a href="#F.3"> F.3 Operators and functions</a>
441 <li><a href="#F.4"> F.4 Floating to integer conversion</a>
442 <li><a href="#F.5"> F.5 Binary-decimal conversion</a>
443 <li><a href="#F.6"> F.6 The return statement</a>
444 <li><a href="#F.7"> F.7 Contracted expressions</a>
445 <li><a href="#F.8"> F.8 Floating-point environment</a>
446 <li><a href="#F.9"> F.9 Optimization</a>
447 <li><a href="#F.10"> F.10 Mathematics &lt;math.h&gt;</a>
448 <ul>
449 <li><a href="#F.10.1"> F.10.1 Trigonometric functions</a>
450 <li><a href="#F.10.2"> F.10.2 Hyperbolic functions</a>
451 <li><a href="#F.10.3"> F.10.3 Exponential and logarithmic functions</a>
452 <li><a href="#F.10.4"> F.10.4 Power and absolute value functions</a>
453 <li><a href="#F.10.5"> F.10.5 Error and gamma functions</a>
454 <li><a href="#F.10.6"> F.10.6 Nearest integer functions</a>
455 <li><a href="#F.10.7"> F.10.7 Remainder functions</a>
456 <li><a href="#F.10.8"> F.10.8 Manipulation functions</a>
457 <li><a href="#F.10.9"> F.10.9 Maximum, minimum, and positive difference functions</a>
458 <li><a href="#F.10.10"> F.10.10 Floating multiply-add</a>
459 <li><a href="#F.10.11"> F.10.11 Comparison macros</a>
460 </ul>
461 </ul>
462 <li><a href="#G">Annex G (normative) IEC 60559-compatible complex arithmetic</a>
463 <ul>
464 <li><a href="#G.1"> G.1 Introduction</a>
465 <li><a href="#G.2"> G.2 Types</a>
466 <li><a href="#G.3"> G.3 Conventions</a>
467 <li><a href="#G.4"> G.4 Conversions</a>
468 <ul>
469 <li><a href="#G.4.1"> G.4.1 Imaginary types</a>
470 <li><a href="#G.4.2"> G.4.2 Real and imaginary</a>
471 <li><a href="#G.4.3"> G.4.3 Imaginary and complex</a>
472 </ul>
473 <li><a href="#G.5"> G.5 Binary operators</a>
474 <ul>
475 <li><a href="#G.5.1"> G.5.1 Multiplicative operators</a>
476 <li><a href="#G.5.2"> G.5.2 Additive operators</a>
477 </ul>
478 <li><a href="#G.6"> G.6 Complex arithmetic &lt;complex.h&gt;</a>
479 <ul>
480 <li><a href="#G.6.1"> G.6.1 Trigonometric functions</a>
481 <li><a href="#G.6.2"> G.6.2 Hyperbolic functions</a>
482 <li><a href="#G.6.3"> G.6.3 Exponential and logarithmic functions</a>
483 <li><a href="#G.6.4"> G.6.4 Power and absolute-value functions</a>
484 </ul>
485 <li><a href="#G.7"> G.7 Type-generic math &lt;tgmath.h&gt;</a>
486 </ul>
487 <li><a href="#H">Annex H (informative) Language independent arithmetic</a>
488 <ul>
489 <li><a href="#H.1"> H.1 Introduction</a>
490 <li><a href="#H.2"> H.2 Types</a>
491 <li><a href="#H.3"> H.3 Notification</a>
492 <!--page 11 -->
493 </ul>
494 <li><a href="#I">Annex I (informative) Common warnings</a>
495 <li><a href="#J">Annex J (informative) Portability issues</a>
496 <ul>
497 <li><a href="#J.1"> J.1 Unspecified behavior</a>
498 <li><a href="#J.2"> J.2 Undefined behavior</a>
499 <li><a href="#J.3"> J.3 Implementation-defined behavior</a>
500 <li><a href="#J.4"> J.4 Locale-specific behavior</a>
501 <li><a href="#J.5"> J.5 Common extensions</a>
502 </ul>
503 <li><a href="#K">Annex K (normative) Bounds-checking interfaces</a>
504 <ul>
505 <li><a href="#K.1"> K.1 Background</a>
506 <li><a href="#K.2"> K.2 Scope</a>
507 <li><a href="#K.3"> K.3 Library</a>
508 <ul>
509 <li><a href="#K.3.1"> K.3.1 Introduction</a>
510 <ul>
511 <li><a href="#K.3.1.1"> K.3.1.1 Standard headers</a>
512 <li><a href="#K.3.1.2"> K.3.1.2 Reserved identifiers</a>
513 <li><a href="#K.3.1.3"> K.3.1.3 Use of errno</a>
514 <li><a href="#K.3.1.4"> K.3.1.4 Runtime-constraint violations</a>
515 </ul>
516 <li><a href="#K.3.2"> K.3.2 Errors &lt;errno.h&gt;</a>
517 <li><a href="#K.3.3"> K.3.3 Common definitions &lt;stddef.h&gt;</a>
518 <li><a href="#K.3.4"> K.3.4 Integer types &lt;stdint.h&gt;</a>
519 <li><a href="#K.3.5"> K.3.5 Input/output &lt;stdio.h&gt;</a>
520 <ul>
521 <li><a href="#K.3.5.1"> K.3.5.1 Operations on files</a>
522 <li><a href="#K.3.5.2"> K.3.5.2 File access functions</a>
523 <li><a href="#K.3.5.3"> K.3.5.3 Formatted input/output functions</a>
524 <li><a href="#K.3.5.4"> K.3.5.4 Character input/output functions</a>
525 </ul>
526 <li><a href="#K.3.6"> K.3.6 General utilities &lt;stdlib.h&gt;</a>
527 <ul>
528 <li><a href="#K.3.6.1"> K.3.6.1 Runtime-constraint handling</a>
529 <li><a href="#K.3.6.2"> K.3.6.2 Communication with the environment</a>
530 <li><a href="#K.3.6.3"> K.3.6.3 Searching and sorting utilities</a>
531 <li><a href="#K.3.6.4"> K.3.6.4 Multibyte/wide character conversion functions</a>
532 <li><a href="#K.3.6.5"> K.3.6.5 Multibyte/wide string conversion functions</a>
533 </ul>
534 <li><a href="#K.3.7"> K.3.7 String handling &lt;string.h&gt;</a>
535 <ul>
536 <li><a href="#K.3.7.1"> K.3.7.1 Copying functions</a>
537 <li><a href="#K.3.7.2"> K.3.7.2 Concatenation functions</a>
538 <li><a href="#K.3.7.3"> K.3.7.3 Search functions</a>
539 <li><a href="#K.3.7.4"> K.3.7.4 Miscellaneous functions</a>
540 </ul>
541 <li><a href="#K.3.8"> K.3.8 Date and time &lt;time.h&gt;</a>
542 <ul>
543 <li><a href="#K.3.8.1"> K.3.8.1 Components of time</a>
544 <li><a href="#K.3.8.2"> K.3.8.2 Time conversion functions</a>
545 </ul>
546 <li><a href="#K.3.9"> K.3.9 Extended multibyte and wide character utilities <wchar.h></a>
547 <ul>
548 <li><a href="#K.3.9.1"> K.3.9.1 Formatted wide character input/output functions</a>
549 <li><a href="#K.3.9.2"> K.3.9.2 General wide string utilities</a>
550 <!--page 12 -->
551 <li><a href="#K.3.9.3"> K.3.9.3 Extended multibyte/wide character conversion utilities</a>
552 </ul>
553 </ul>
554 </ul>
555 <li><a href="#L">Annex L (normative) Analyzability</a>
556 <ul>
557 <li><a href="#L.1"> L.1 Scope</a>
558 <li><a href="#L.2"> L.2 Definitions</a>
559 <li><a href="#L.3"> L.3 Requirements</a>
560 </ul>
561 <li><a href="#Bibliography">Bibliography</a>
562 <li><a href="#Index">Index</a>
563 <!--page 13 -->
564 </ul>
566 <h2><a name="Foreword" href="#Foreword">Foreword</a></h2>
567 <p><!--para 1 -->
568 ISO (the International Organization for Standardization) and IEC (the International
569 Electrotechnical Commission) form the specialized system for worldwide
570 standardization. National bodies that are member of ISO or IEC participate in the
571 development of International Standards through technical committees established by the
572 respective organization to deal with particular fields of technical activity. ISO and IEC
573 technical committees collaborate in fields of mutual interest. Other international
574 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
575 take part in the work.
576 <p><!--para 2 -->
577 International Standards are drafted in accordance with the rules given in the ISO/IEC
578 Directives, Part 2. This International Standard was drafted in accordance with the fifth
579 edition (2004).
580 <p><!--para 3 -->
581 In the field of information technology, ISO and IEC have established a joint technical
582 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
583 committee are circulated to national bodies for voting. Publication as an International
584 Standard requires approval by at least 75% of the national bodies casting a vote.
585 <p><!--para 4 -->
586 Attention is drawn to the possibility that some of the elements of this document may be
587 the subject of patent rights. ISO and IEC shall not be held responsible for identifying any
588 or all such patent rights.
589 <p><!--para 5 -->
590 This International Standard was prepared by Joint Technical Committee ISO/IEC JTC 1,
591 Information technology, Subcommittee SC 22, Programming languages, their
592 environments and system software interfaces. The Working Group responsible for this
593 standard (WG 14) maintains a site on the World Wide Web at http://www.open-
594 std.org/JTC1/SC22/WG14/ containing additional information relevant to this
595 standard such as a Rationale for many of the decisions made during its preparation and a
596 log of Defect Reports and Responses.
597 <p><!--para 6 -->
598 This third edition cancels and replaces the second edition, ISO/IEC 9899:1999, as
599 corrected by ISO/IEC 9899:1999/Cor 1:2001, ISO/IEC 9899:1999/Cor 2:2004, and
600 ISO/IEC 9899:1999/Cor 3:2007. Major changes from the previous edition include:
601 <ul>
602 <li> conditional (optional) features (including some that were previously mandatory)
603 <li> support for multiple threads of execution including an improved memory sequencing
604 model, atomic objects, and thread-local storage (<a href="#7.17">&lt;stdatomic.h&gt;</a> and
605 <a href="#7.25">&lt;threads.h&gt;</a>)
606 <li> additional floating-point characteristic macros (<a href="#7.7">&lt;float.h&gt;</a>)
607 <li> querying and specifying alignment of objects (<a href="#7.15">&lt;stdalign.h&gt;</a>, <a href="#7.22">&lt;stdlib.h&gt;</a>)
608 <li> Unicode characters and strings (<a href="#7.27">&lt;uchar.h&gt;</a>) (originally specified in
609 ISO/IEC TR 19769:2004)
610 <li> type-generic expressions
611 <!--page 14 -->
612 <li> static assertions
613 <li> anonymous structures and unions
614 <li> no-return functions
615 <li> macros to create complex numbers (<a href="#7.3">&lt;complex.h&gt;</a>)
616 <li> support for opening files for exclusive access
617 <li> removed the gets function (<a href="#7.21">&lt;stdio.h&gt;</a>)
618 <li> added the aligned_alloc, at_quick_exit, and quick_exit functions
619 (<a href="#7.22">&lt;stdlib.h&gt;</a>)
620 <li> (conditional) support for bounds-checking interfaces (originally specified in
621 ISO/IEC TR 24731-1:2007)
622 <li> (conditional) support for analyzability
623 </ul>
624 <p><!--para 7 -->
625 Major changes in the second edition included:
626 <ul>
627 <li> restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
628 in AMD1)
629 <li> wide character library support in <a href="#7.28">&lt;wchar.h&gt;</a> and <a href="#7.29">&lt;wctype.h&gt;</a> (originally
630 specified in AMD1)
631 <li> more precise aliasing rules via effective type
632 <li> restricted pointers
633 <li> variable length arrays
634 <li> flexible array members
635 <li> static and type qualifiers in parameter array declarators
636 <li> complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
637 <li> type-generic math macros in <a href="#7.24">&lt;tgmath.h&gt;</a>
638 <li> the long long int type and library functions
639 <li> increased minimum translation limits
640 <li> additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
641 <li> remove implicit int
642 <li> reliable integer division
643 <li> universal character names (\u and \U)
644 <li> extended identifiers
645 <li> hexadecimal floating-point constants and %a and %A printf/scanf conversion
646 specifiers
647 <!--page 15 -->
648 <li> compound literals
649 <li> designated initializers
650 <li> // comments
651 <li> extended integer types and library functions in <a href="#7.8">&lt;inttypes.h&gt;</a> and <a href="#7.20">&lt;stdint.h&gt;</a>
652 <li> remove implicit function declaration
653 <li> preprocessor arithmetic done in intmax_t/uintmax_t
654 <li> mixed declarations and code
655 <li> new block scopes for selection and iteration statements
656 <li> integer constant type rules
657 <li> integer promotion rules
658 <li> macros with a variable number of arguments
659 <li> the vscanf family of functions in <a href="#7.21">&lt;stdio.h&gt;</a> and <a href="#7.28">&lt;wchar.h&gt;</a>
660 <li> additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
661 <li> treatment of error conditions by math library functions (math_errhandling)
662 <li> floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
663 <li> IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
664 <li> trailing comma allowed in enum declaration
665 <li> %lf conversion specifier allowed in printf
666 <li> inline functions
667 <li> the snprintf family of functions in <a href="#7.21">&lt;stdio.h&gt;</a>
668 <li> boolean type in <a href="#7.18">&lt;stdbool.h&gt;</a>
669 <li> idempotent type qualifiers
670 <li> empty macro arguments
671 <li> new structure type compatibility rules (tag compatibility)
672 <li> additional predefined macro names
673 <li> _Pragma preprocessing operator
674 <li> standard pragmas
675 <li> __func__ predefined identifier
676 <li> va_copy macro
677 <li> additional strftime conversion specifiers
678 <li> LIA compatibility annex
679 <!--page 16 -->
680 <li> deprecate ungetc at the beginning of a binary file
681 <li> remove deprecation of aliased array parameters
682 <li> conversion of array to pointer not limited to lvalues
683 <li> relaxed constraints on aggregate and union initialization
684 <li> relaxed restrictions on portable header names
685 <li> return without expression not permitted in function that returns a value (and vice
686 versa)
687 </ul>
688 <p><!--para 8 -->
689 Annexes D, F, G, K, and L form a normative part of this standard; annexes A, B, C, E, H, *
690 I, J, the bibliography, and the index are for information only. In accordance with Part 2 of
691 the ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples
692 are also for information only.
693 <!--page 17 -->
695 <h2><a name="Introduction" href="#Introduction">Introduction</a></h2>
696 <p><!--para 1 -->
697 With the introduction of new devices and extended character sets, new features may be
698 added to this International Standard. Subclauses in the language and library clauses warn
699 implementors and programmers of usages which, though valid in themselves, may
700 conflict with future additions.
701 <p><!--para 2 -->
702 Certain features are obsolescent, which means that they may be considered for
703 withdrawal in future revisions of this International Standard. They are retained because
704 of their widespread use, but their use in new implementations (for implementation
705 features) or new programs (for language [<a href="#6.11">6.11</a>] or library features [<a href="#7.30">7.30</a>]) is discouraged.
706 <p><!--para 3 -->
707 This International Standard is divided into four major subdivisions:
708 <ul>
709 <li> preliminary elements (clauses 1-4);
710 <li> the characteristics of environments that translate and execute C programs (clause 5);
711 <li> the language syntax, constraints, and semantics (clause 6);
712 <li> the library facilities (clause 7).
713 </ul>
714 <p><!--para 4 -->
715 Examples are provided to illustrate possible forms of the constructions described.
716 Footnotes are provided to emphasize consequences of the rules described in that
717 subclause or elsewhere in this International Standard. References are used to refer to
718 other related subclauses. Recommendations are provided to give advice or guidance to
719 implementors. Annexes provide additional information and summarize the information
720 contained in this International Standard. A bibliography lists documents that were
721 referred to during the preparation of the standard.
722 <p><!--para 5 -->
723 The language clause (clause 6) is derived from ''The C Reference Manual''.
724 <p><!--para 6 -->
725 The library clause (clause 7) is based on the 1984 /usr/group Standard.
726 <!--page 18 -->
727 <!--page 19 -->
729 <h1>Programming languages -- C</h1>
734 <h2><a name="1" href="#1">1. Scope</a></h2>
735 <p><!--para 1 -->
736 This International Standard specifies the form and establishes the interpretation of
737 programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
738 <ul>
739 <li> the representation of C programs;
740 <li> the syntax and constraints of the C language;
741 <li> the semantic rules for interpreting C programs;
742 <li> the representation of input data to be processed by C programs;
743 <li> the representation of output data produced by C programs;
744 <li> the restrictions and limits imposed by a conforming implementation of C.
745 </ul>
746 <p><!--para 2 -->
747 This International Standard does not specify
748 <ul>
749 <li> the mechanism by which C programs are transformed for use by a data-processing
750 system;
751 <li> the mechanism by which C programs are invoked for use by a data-processing
752 system;
753 <li> the mechanism by which input data are transformed for use by a C program;
754 <li> the mechanism by which output data are transformed after being produced by a C
755 program;
756 <li> the size or complexity of a program and its data that will exceed the capacity of any
757 specific data-processing system or the capacity of a particular processor;
758 <li> all minimal requirements of a data-processing system that is capable of supporting a
759 conforming implementation.
762 <!--page 20 -->
763 </ul>
765 <h6>footnotes</h6>
766 <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
767 data-processing systems. It is intended for use by implementors and programmers.
768 </small>
770 <h2><a name="2" href="#2">2. Normative references</a></h2>
771 <p><!--para 1 -->
772 The following referenced documents are indispensable for the application of this
773 document. For dated references, only the edition cited applies. For undated references,
774 the latest edition of the referenced document (including any amendments) applies.
775 <p><!--para 2 -->
776 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
777 use in the physical sciences and technology.
778 <p><!--para 3 -->
779 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
780 interchange.
781 <p><!--para 4 -->
782 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
783 terms.
784 <p><!--para 5 -->
785 ISO 4217, Codes for the representation of currencies and funds.
786 <p><!--para 6 -->
787 ISO 8601, Data elements and interchange formats -- Information interchange --
788 Representation of dates and times.
789 <p><!--para 7 -->
790 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
791 Character Set (UCS).
792 <p><!--para 8 -->
793 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
794 designated IEC 559:1989).
795 <!--page 21 -->
797 <h2><a name="3" href="#3">3. Terms, definitions, and symbols</a></h2>
798 <p><!--para 1 -->
799 For the purposes of this International Standard, the following definitions apply. Other
800 terms are defined where they appear in italic type or on the left side of a syntax rule.
801 Terms explicitly defined in this International Standard are not to be presumed to refer
802 implicitly to similar terms defined elsewhere. Terms not defined in this International
803 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
804 defined in this International Standard are to be interpreted according to ISO 31-11.
806 <h3><a name="3.1" href="#3.1">3.1</a></h3>
807 <p><!--para 1 -->
808 <b> access</b><br>
809 &lt;execution-time action&gt; to read or modify the value of an object
810 <p><!--para 2 -->
811 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
813 <p><!--para 3 -->
814 NOTE 2 ''Modify'' includes the case where the new value being stored is the same as the previous value.
816 <p><!--para 4 -->
817 NOTE 3 Expressions that are not evaluated do not access objects.
820 <h3><a name="3.2" href="#3.2">3.2</a></h3>
821 <p><!--para 1 -->
822 <b> alignment</b><br>
823 requirement that objects of a particular type be located on storage boundaries with
824 addresses that are particular multiples of a byte address
826 <h3><a name="3.3" href="#3.3">3.3</a></h3>
827 <p><!--para 1 -->
828 <b> argument</b><br>
829 actual argument
830 actual parameter (deprecated)
831 expression in the comma-separated list bounded by the parentheses in a function call
832 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
833 by the parentheses in a function-like macro invocation
835 <h3><a name="3.4" href="#3.4">3.4</a></h3>
836 <p><!--para 1 -->
837 <b> behavior</b><br>
838 external appearance or action
840 <h4><a name="3.4.1" href="#3.4.1">3.4.1</a></h4>
841 <p><!--para 1 -->
842 <b> implementation-defined behavior</b><br>
843 unspecified behavior where each implementation documents how the choice is made
844 <p><!--para 2 -->
845 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
846 when a signed integer is shifted right.
849 <h4><a name="3.4.2" href="#3.4.2">3.4.2</a></h4>
850 <p><!--para 1 -->
851 <b> locale-specific behavior</b><br>
852 behavior that depends on local conventions of nationality, culture, and language that each
853 implementation documents
854 <!--page 22 -->
855 <p><!--para 2 -->
856 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
857 characters other than the 26 lowercase Latin letters.
860 <h4><a name="3.4.3" href="#3.4.3">3.4.3</a></h4>
861 <p><!--para 1 -->
862 <b> undefined behavior</b><br>
863 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
864 for which this International Standard imposes no requirements
865 <p><!--para 2 -->
866 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
867 results, to behaving during translation or program execution in a documented manner characteristic of the
868 environment (with or without the issuance of a diagnostic message), to terminating a translation or
869 execution (with the issuance of a diagnostic message).
871 <p><!--para 3 -->
872 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
875 <h4><a name="3.4.4" href="#3.4.4">3.4.4</a></h4>
876 <p><!--para 1 -->
877 <b> unspecified behavior</b><br>
878 use of an unspecified value, or other behavior where this International Standard provides
879 two or more possibilities and imposes no further requirements on which is chosen in any
880 instance
881 <p><!--para 2 -->
882 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
883 evaluated.
886 <h3><a name="3.5" href="#3.5">3.5</a></h3>
887 <p><!--para 1 -->
888 <b> bit</b><br>
889 unit of data storage in the execution environment large enough to hold an object that may
890 have one of two values
891 <p><!--para 2 -->
892 NOTE It need not be possible to express the address of each individual bit of an object.
895 <h3><a name="3.6" href="#3.6">3.6</a></h3>
896 <p><!--para 1 -->
897 <b> byte</b><br>
898 addressable unit of data storage large enough to hold any member of the basic character
899 set of the execution environment
900 <p><!--para 2 -->
901 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
903 <p><!--para 3 -->
904 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
905 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
906 bit.
909 <h3><a name="3.7" href="#3.7">3.7</a></h3>
910 <p><!--para 1 -->
911 <b> character</b><br>
912 &lt;abstract&gt; member of a set of elements used for the organization, control, or
913 representation of data
915 <h4><a name="3.7.1" href="#3.7.1">3.7.1</a></h4>
916 <p><!--para 1 -->
917 <b> character</b><br>
918 single-byte character
919 &lt;C&gt; bit representation that fits in a byte
920 <!--page 23 -->
922 <h4><a name="3.7.2" href="#3.7.2">3.7.2</a></h4>
923 <p><!--para 1 -->
924 <b> multibyte character</b><br>
925 sequence of one or more bytes representing a member of the extended character set of
926 either the source or the execution environment
927 <p><!--para 2 -->
928 NOTE The extended character set is a superset of the basic character set.
931 <h4><a name="3.7.3" href="#3.7.3">3.7.3</a></h4>
932 <p><!--para 1 -->
933 <b> wide character</b><br>
934 bit representation that fits in an object of type wchar_t, capable of representing any
935 character in the current locale
937 <h3><a name="3.8" href="#3.8">3.8</a></h3>
938 <p><!--para 1 -->
939 <b> constraint</b><br>
940 restriction, either syntactic or semantic, by which the exposition of language elements is
941 to be interpreted
943 <h3><a name="3.9" href="#3.9">3.9</a></h3>
944 <p><!--para 1 -->
945 <b> correctly rounded result</b><br>
946 representation in the result format that is nearest in value, subject to the current rounding
947 mode, to what the result would be given unlimited range and precision
949 <h3><a name="3.10" href="#3.10">3.10</a></h3>
950 <p><!--para 1 -->
951 <b> diagnostic message</b><br>
952 message belonging to an implementation-defined subset of the implementation's message
953 output
955 <h3><a name="3.11" href="#3.11">3.11</a></h3>
956 <p><!--para 1 -->
957 <b> forward reference</b><br>
958 reference to a later subclause of this International Standard that contains additional
959 information relevant to this subclause
961 <h3><a name="3.12" href="#3.12">3.12</a></h3>
962 <p><!--para 1 -->
963 <b> implementation</b><br>
964 particular set of software, running in a particular translation environment under particular
965 control options, that performs translation of programs for, and supports execution of
966 functions in, a particular execution environment
968 <h3><a name="3.13" href="#3.13">3.13</a></h3>
969 <p><!--para 1 -->
970 <b> implementation limit</b><br>
971 restriction imposed upon programs by the implementation
973 <h3><a name="3.14" href="#3.14">3.14</a></h3>
974 <p><!--para 1 -->
975 <b> memory location</b><br>
976 either an object of scalar type, or a maximal sequence of adjacent bit-fields all having
977 nonzero width
978 <!--page 24 -->
979 <p><!--para 2 -->
980 NOTE 1 Two threads of execution can update and access separate memory locations without interfering
981 with each other.
983 <p><!--para 3 -->
984 NOTE 2 A bit-field and an adjacent non-bit-field member are in separate memory locations. The same
985 applies to two bit-fields, if one is declared inside a nested structure declaration and the other is not, or if the
986 two are separated by a zero-length bit-field declaration, or if they are separated by a non-bit-field member
987 declaration. It is not safe to concurrently update two non-atomic bit-fields in the same structure if all
988 members declared between them are also (non-zero-length) bit-fields, no matter what the sizes of those
989 intervening bit-fields happen to be.
991 <p><!--para 4 -->
992 EXAMPLE A structure declared as
993 <pre>
994 struct {
995 char a;
996 int b:5, c:11, :0, d:8;
997 struct { int ee:8; } e;
998 }</pre>
999 contains four separate memory locations: The member a, and bit-fields d and e.ee are each separate
1000 memory locations, and can be modified concurrently without interfering with each other. The bit-fields b
1001 and c together constitute the fourth memory location. The bit-fields b and c cannot be concurrently
1002 modified, but b and a, for example, can be.
1005 <h3><a name="3.15" href="#3.15">3.15</a></h3>
1006 <p><!--para 1 -->
1007 <b> object</b><br>
1008 region of data storage in the execution environment, the contents of which can represent
1009 values
1010 <p><!--para 2 -->
1011 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>.
1014 <h3><a name="3.16" href="#3.16">3.16</a></h3>
1015 <p><!--para 1 -->
1016 <b> parameter</b><br>
1017 formal parameter
1018 formal argument (deprecated)
1019 object declared as part of a function declaration or definition that acquires a value on
1020 entry to the function, or an identifier from the comma-separated list bounded by the
1021 parentheses immediately following the macro name in a function-like macro definition
1023 <h3><a name="3.17" href="#3.17">3.17</a></h3>
1024 <p><!--para 1 -->
1025 <b> recommended practice</b><br>
1026 specification that is strongly recommended as being in keeping with the intent of the
1027 standard, but that may be impractical for some implementations
1029 <h3><a name="3.18" href="#3.18">3.18</a></h3>
1030 <p><!--para 1 -->
1031 <b> runtime-constraint</b><br>
1032 requirement on a program when calling a library function
1033 <p><!--para 2 -->
1034 NOTE 1 Despite the similar terms, a runtime-constraint is not a kind of constraint as defined by <a href="#3.8">3.8</a>, and
1035 need not be diagnosed at translation time.
1037 <p><!--para 3 -->
1038 NOTE 2 Implementations that support the extensions in <a href="#K">annex K</a> are required to verify that the runtime-
1039 constraints for a library function are not violated by the program; see <a href="#K.3.1.4">K.3.1.4</a>.
1040 <!--page 25 -->
1042 <h3><a name="3.19" href="#3.19">3.19</a></h3>
1043 <p><!--para 1 -->
1044 <b> value</b><br>
1045 precise meaning of the contents of an object when interpreted as having a specific type
1047 <h4><a name="3.19.1" href="#3.19.1">3.19.1</a></h4>
1048 <p><!--para 1 -->
1049 <b> implementation-defined value</b><br>
1050 unspecified value where each implementation documents how the choice is made
1052 <h4><a name="3.19.2" href="#3.19.2">3.19.2</a></h4>
1053 <p><!--para 1 -->
1054 <b> indeterminate value</b><br>
1055 either an unspecified value or a trap representation
1057 <h4><a name="3.19.3" href="#3.19.3">3.19.3</a></h4>
1058 <p><!--para 1 -->
1059 <b> unspecified value</b><br>
1060 valid value of the relevant type where this International Standard imposes no
1061 requirements on which value is chosen in any instance
1062 <p><!--para 2 -->
1063 NOTE An unspecified value cannot be a trap representation.
1066 <h4><a name="3.19.4" href="#3.19.4">3.19.4</a></h4>
1067 <p><!--para 1 -->
1068 <b> trap representation</b><br>
1069 an object representation that need not represent a value of the object type
1071 <h4><a name="3.19.5" href="#3.19.5">3.19.5</a></h4>
1072 <p><!--para 1 -->
1073 <b> perform a trap</b><br>
1074 interrupt execution of the program such that no further operations are performed
1075 <p><!--para 2 -->
1076 NOTE In this International Standard, when the word ''trap'' is not immediately followed by
1077 ''representation'', this is the intended usage.<sup><a href="#note2"><b>2)</b></a></sup>
1080 <h6>footnotes</h6>
1081 <p><small><a name="note2" href="#note2">2)</a> For example, ''Trapping or stopping (if supported) is disabled...'' (<a href="#F.8.2">F.8.2</a>). Note that fetching a trap
1082 representation might perform a trap but is not required to (see <a href="#6.2.6.1">6.2.6.1</a>).
1083 </small>
1085 <h3><a name="3.20" href="#3.20">3.20</a></h3>
1086 <p><!--para 1 -->
1087 <b> [^ x^]</b><br>
1088 ceiling of x: the least integer greater than or equal to x
1089 <p><!--para 2 -->
1090 EXAMPLE [^2.4^] is 3, [^-2.4^] is -2.
1093 <h3><a name="3.21" href="#3.21">3.21</a></h3>
1094 <p><!--para 1 -->
1095 <b> [_ x_]</b><br>
1096 floor of x: the greatest integer less than or equal to x
1097 <p><!--para 2 -->
1098 EXAMPLE [_2.4_] is 2, [_-2.4_] is -3.
1103 <!--page 26 -->
1105 <h2><a name="4" href="#4">4. Conformance</a></h2>
1106 <p><!--para 1 -->
1107 In this International Standard, ''shall'' is to be interpreted as a requirement on an
1108 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
1109 prohibition.
1110 <p><!--para 2 -->
1111 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint or runtime-
1112 constraint is violated, the behavior is undefined. Undefined behavior is otherwise
1113 indicated in this International Standard by the words ''undefined behavior'' or by the
1114 omission of any explicit definition of behavior. There is no difference in emphasis among
1115 these three; they all describe ''behavior that is undefined''.
1116 <p><!--para 3 -->
1117 A program that is correct in all other aspects, operating on correct data, containing
1118 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
1119 <p><!--para 4 -->
1120 The implementation shall not successfully translate a preprocessing translation unit
1121 containing a #error preprocessing directive unless it is part of a group skipped by
1122 conditional inclusion.
1123 <p><!--para 5 -->
1124 A strictly conforming program shall use only those features of the language and library
1125 specified in this International Standard.<sup><a href="#note3"><b>3)</b></a></sup> It shall not produce output dependent on any
1126 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
1127 minimum implementation limit.
1128 <p><!--para 6 -->
1129 The two forms of conforming implementation are hosted and freestanding. A conforming
1130 hosted implementation shall accept any strictly conforming program. A conforming
1131 freestanding implementation shall accept any strictly conforming program that does not
1132 use complex types and in which the use of the features specified in the library clause
1133 (clause 7) is confined to the contents of the standard headers <a href="#7.7">&lt;float.h&gt;</a>,
1134 <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#7.15">&lt;stdalign.h&gt;</a>, <a href="#7.16">&lt;stdarg.h&gt;</a>, <a href="#7.18">&lt;stdbool.h&gt;</a>,
1135 <a href="#7.19">&lt;stddef.h&gt;</a>, and <a href="#7.20">&lt;stdint.h&gt;</a>. A conforming implementation may have extensions
1136 (including additional library functions), provided they do not alter the behavior of any
1137 strictly conforming program.<sup><a href="#note4"><b>4)</b></a></sup>
1141 <!--page 27 -->
1142 <p><!--para 7 -->
1143 A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note5"><b>5)</b></a></sup>
1144 <p><!--para 8 -->
1145 An implementation shall be accompanied by a document that defines all implementation-
1146 defined and locale-specific characteristics and all extensions.
1147 <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>),
1148 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>
1149 (<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>), alignment <a href="#7.15">&lt;stdalign.h&gt;</a> (<a href="#7.15">7.15</a>),
1150 variable arguments <a href="#7.16">&lt;stdarg.h&gt;</a> (<a href="#7.16">7.16</a>), boolean type and values <a href="#7.18">&lt;stdbool.h&gt;</a>
1151 (<a href="#7.18">7.18</a>), common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>).
1156 <!--page 28 -->
1158 <h6>footnotes</h6>
1159 <p><small><a name="note3" href="#note3">3)</a> A strictly conforming program can use conditional features (see <a href="#6.10.8.3">6.10.8.3</a>) provided the use is guarded
1160 by an appropriate conditional inclusion preprocessing directive using the related macro. For example:
1162 <pre>
1163 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
1164 /* ... */
1165 fesetround(FE_UPWARD);
1166 /* ... */
1167 #endif</pre>
1169 </small>
1170 <p><small><a name="note4" href="#note4">4)</a> This implies that a conforming implementation reserves no identifiers other than those explicitly
1171 reserved in this International Standard.
1172 </small>
1173 <p><small><a name="note5" href="#note5">5)</a> Strictly conforming programs are intended to be maximally portable among conforming
1174 implementations. Conforming programs may depend upon nonportable features of a conforming
1175 implementation.
1176 </small>
1178 <h2><a name="5" href="#5">5. Environment</a></h2>
1179 <p><!--para 1 -->
1180 An implementation translates C source files and executes C programs in two data-
1181 processing-system environments, which will be called the translation environment and
1182 the execution environment in this International Standard. Their characteristics define and
1183 constrain the results of executing conforming C programs constructed according to the
1184 syntactic and semantic rules for conforming implementations.
1185 <p><b> Forward references</b>: In this clause, only a few of many possible forward references
1186 have been noted.
1188 <h3><a name="5.1" href="#5.1">5.1 Conceptual models</a></h3>
1190 <h4><a name="5.1.1" href="#5.1.1">5.1.1 Translation environment</a></h4>
1192 <h5><a name="5.1.1.1" href="#5.1.1.1">5.1.1.1 Program structure</a></h5>
1193 <p><!--para 1 -->
1194 A C program need not all be translated at the same time. The text of the program is kept
1195 in units called source files, (or preprocessing files) in this International Standard. A
1196 source file together with all the headers and source files included via the preprocessing
1197 directive #include is known as a preprocessing translation unit. After preprocessing, a
1198 preprocessing translation unit is called a translation unit. Previously translated translation
1199 units may be preserved individually or in libraries. The separate translation units of a
1200 program communicate by (for example) calls to functions whose identifiers have external
1201 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
1202 of data files. Translation units may be separately translated and then later linked to
1203 produce an executable program.
1204 <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>),
1205 preprocessing directives (<a href="#6.10">6.10</a>).
1207 <h5><a name="5.1.1.2" href="#5.1.1.2">5.1.1.2 Translation phases</a></h5>
1208 <p><!--para 1 -->
1209 The precedence among the syntax rules of translation is specified by the following
1210 phases.<sup><a href="#note6"><b>6)</b></a></sup>
1211 <ol>
1212 <li> Physical source file multibyte characters are mapped, in an implementation-
1213 defined manner, to the source character set (introducing new-line characters for
1214 end-of-line indicators) if necessary. Trigraph sequences are replaced by
1215 corresponding single-character internal representations.
1219 <!--page 29 -->
1220 <li> Each instance of a backslash character (\) immediately followed by a new-line
1221 character is deleted, splicing physical source lines to form logical source lines.
1222 Only the last backslash on any physical source line shall be eligible for being part
1223 of such a splice. A source file that is not empty shall end in a new-line character,
1224 which shall not be immediately preceded by a backslash character before any such
1225 splicing takes place.
1226 <li> The source file is decomposed into preprocessing tokens<sup><a href="#note7"><b>7)</b></a></sup> and sequences of
1227 white-space characters (including comments). A source file shall not end in a
1228 partial preprocessing token or in a partial comment. Each comment is replaced by
1229 one space character. New-line characters are retained. Whether each nonempty
1230 sequence of white-space characters other than new-line is retained or replaced by
1231 one space character is implementation-defined.
1232 <li> Preprocessing directives are executed, macro invocations are expanded, and
1233 _Pragma unary operator expressions are executed. If a character sequence that
1234 matches the syntax of a universal character name is produced by token
1235 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
1236 directive causes the named header or source file to be processed from phase 1
1237 through phase 4, recursively. All preprocessing directives are then deleted.
1238 <li> Each source character set member and escape sequence in character constants and
1239 string literals is converted to the corresponding member of the execution character
1240 set; if there is no corresponding member, it is converted to an implementation-
1241 defined member other than the null (wide) character.<sup><a href="#note8"><b>8)</b></a></sup>
1242 <li> Adjacent string literal tokens are concatenated.
1243 <li> White-space characters separating tokens are no longer significant. Each
1244 preprocessing token is converted into a token. The resulting tokens are
1245 syntactically and semantically analyzed and translated as a translation unit.
1246 <li> All external object and function references are resolved. Library components are
1247 linked to satisfy external references to functions and objects not defined in the
1248 current translation. All such translator output is collected into a program image
1249 which contains information needed for execution in its execution environment.
1250 </ol>
1251 <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>),
1252 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>).
1256 <!--page 30 -->
1258 <h6>footnotes</h6>
1259 <p><small><a name="note6" href="#note6">6)</a> Implementations shall behave as if these separate phases occur, even though many are typically folded
1260 together in practice. Source files, translation units, and translated translation units need not
1261 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
1262 and any external representation. The description is conceptual only, and does not specify any
1263 particular implementation.
1264 </small>
1265 <p><small><a name="note7" href="#note7">7)</a> As described in <a href="#6.4">6.4</a>, the process of dividing a source file's characters into preprocessing tokens is
1266 context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
1267 </small>
1268 <p><small><a name="note8" href="#note8">8)</a> An implementation need not convert all non-corresponding source characters to the same execution
1269 character.
1270 </small>
1272 <h5><a name="5.1.1.3" href="#5.1.1.3">5.1.1.3 Diagnostics</a></h5>
1273 <p><!--para 1 -->
1274 A conforming implementation shall produce at least one diagnostic message (identified in
1275 an implementation-defined manner) if a preprocessing translation unit or translation unit
1276 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
1277 specified as undefined or implementation-defined. Diagnostic messages need not be
1278 produced in other circumstances.<sup><a href="#note9"><b>9)</b></a></sup>
1279 <p><!--para 2 -->
1280 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
1281 <pre>
1282 char i;
1283 int i;</pre>
1284 because in those cases where wording in this International Standard describes the behavior for a construct
1285 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
1288 <h6>footnotes</h6>
1289 <p><small><a name="note9" href="#note9">9)</a> The intent is that an implementation should identify the nature of, and where possible localize, each
1290 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
1291 valid program is still correctly translated. It may also successfully translate an invalid program.
1292 </small>
1294 <h4><a name="5.1.2" href="#5.1.2">5.1.2 Execution environments</a></h4>
1295 <p><!--para 1 -->
1296 Two execution environments are defined: freestanding and hosted. In both cases,
1297 program startup occurs when a designated C function is called by the execution
1298 environment. All objects with static storage duration shall be initialized (set to their
1299 initial values) before program startup. The manner and timing of such initialization are
1300 otherwise unspecified. Program termination returns control to the execution
1301 environment.
1302 <p><b> Forward references</b>: storage durations of objects (<a href="#6.2.4">6.2.4</a>), initialization (<a href="#6.7.9">6.7.9</a>).
1304 <h5><a name="5.1.2.1" href="#5.1.2.1">5.1.2.1 Freestanding environment</a></h5>
1305 <p><!--para 1 -->
1306 In a freestanding environment (in which C program execution may take place without any
1307 benefit of an operating system), the name and type of the function called at program
1308 startup are implementation-defined. Any library facilities available to a freestanding
1309 program, other than the minimal set required by clause 4, are implementation-defined.
1310 <p><!--para 2 -->
1311 The effect of program termination in a freestanding environment is implementation-
1312 defined.
1314 <h5><a name="5.1.2.2" href="#5.1.2.2">5.1.2.2 Hosted environment</a></h5>
1315 <p><!--para 1 -->
1316 A hosted environment need not be provided, but shall conform to the following
1317 specifications if present.
1322 <!--page 31 -->
1324 <h5><a name="5.1.2.2.1" href="#5.1.2.2.1">5.1.2.2.1 Program startup</a></h5>
1325 <p><!--para 1 -->
1326 The function called at program startup is named main. The implementation declares no
1327 prototype for this function. It shall be defined with a return type of int and with no
1328 parameters:
1329 <pre>
1330 int main(void) { /* ... */ }</pre>
1331 or with two parameters (referred to here as argc and argv, though any names may be
1332 used, as they are local to the function in which they are declared):
1333 <pre>
1334 int main(int argc, char *argv[]) { /* ... */ }</pre>
1335 or equivalent;<sup><a href="#note10"><b>10)</b></a></sup> or in some other implementation-defined manner.
1336 <p><!--para 2 -->
1337 If they are declared, the parameters to the main function shall obey the following
1338 constraints:
1339 <ul>
1340 <li> The value of argc shall be nonnegative.
1341 <li> argv[argc] shall be a null pointer.
1342 <li> If the value of argc is greater than zero, the array members argv[0] through
1343 argv[argc-1] inclusive shall contain pointers to strings, which are given
1344 implementation-defined values by the host environment prior to program startup. The
1345 intent is to supply to the program information determined prior to program startup
1346 from elsewhere in the hosted environment. If the host environment is not capable of
1347 supplying strings with letters in both uppercase and lowercase, the implementation
1348 shall ensure that the strings are received in lowercase.
1349 <li> If the value of argc is greater than zero, the string pointed to by argv[0]
1350 represents the program name; argv[0][0] shall be the null character if the
1351 program name is not available from the host environment. If the value of argc is
1352 greater than one, the strings pointed to by argv[1] through argv[argc-1]
1353 represent the program parameters.
1354 <li> The parameters argc and argv and the strings pointed to by the argv array shall
1355 be modifiable by the program, and retain their last-stored values between program
1356 startup and program termination.
1357 </ul>
1359 <h6>footnotes</h6>
1360 <p><small><a name="note10" href="#note10">10)</a> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
1361 char ** argv, and so on.
1362 </small>
1364 <h5><a name="5.1.2.2.2" href="#5.1.2.2.2">5.1.2.2.2 Program execution</a></h5>
1365 <p><!--para 1 -->
1366 In a hosted environment, a program may use all the functions, macros, type definitions,
1367 and objects described in the library clause (clause 7).
1372 <!--page 32 -->
1374 <h5><a name="5.1.2.2.3" href="#5.1.2.2.3">5.1.2.2.3 Program termination</a></h5>
1375 <p><!--para 1 -->
1376 If the return type of the main function is a type compatible with int, a return from the
1377 initial call to the main function is equivalent to calling the exit function with the value
1378 returned by the main function as its argument;<sup><a href="#note11"><b>11)</b></a></sup> reaching the } that terminates the
1379 main function returns a value of 0. If the return type is not compatible with int, the
1380 termination status returned to the host environment is unspecified.
1381 <p><b> Forward references</b>: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.22.4.4">7.22.4.4</a>).
1383 <h6>footnotes</h6>
1384 <p><small><a name="note11" href="#note11">11)</a> In accordance with <a href="#6.2.4">6.2.4</a>, the lifetimes of objects with automatic storage duration declared in main
1385 will have ended in the former case, even where they would not have in the latter.
1386 </small>
1388 <h5><a name="5.1.2.3" href="#5.1.2.3">5.1.2.3 Program execution</a></h5>
1389 <p><!--para 1 -->
1390 The semantic descriptions in this International Standard describe the behavior of an
1391 abstract machine in which issues of optimization are irrelevant.
1392 <p><!--para 2 -->
1393 Accessing a volatile object, modifying an object, modifying a file, or calling a function
1394 that does any of those operations are all side effects,<sup><a href="#note12"><b>12)</b></a></sup> which are changes in the state of
1395 the execution environment. Evaluation of an expression in general includes both value
1396 computations and initiation of side effects. Value computation for an lvalue expression
1397 includes determining the identity of the designated object.
1398 <p><!--para 3 -->
1399 Sequenced before is an asymmetric, transitive, pair-wise relation between evaluations
1400 executed by a single thread, which induces a partial order among those evaluations.
1401 Given any two evaluations A and B, if A is sequenced before B, then the execution of A
1402 shall precede the execution of B. (Conversely, if A is sequenced before B, then B is
1403 sequenced after A.) If A is not sequenced before or after B, then A and B are
1404 unsequenced. Evaluations A and B are indeterminately sequenced when A is sequenced
1405 either before or after B, but it is unspecified which.<sup><a href="#note13"><b>13)</b></a></sup> The presence of a sequence point
1406 between the evaluation of expressions A and B implies that every value computation and
1407 side effect associated with A is sequenced before every value computation and side effect
1408 associated with B. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
1409 <p><!--para 4 -->
1410 In the abstract machine, all expressions are evaluated as specified by the semantics. An
1411 actual implementation need not evaluate part of an expression if it can deduce that its
1412 value is not used and that no needed side effects are produced (including any caused by
1414 <!--page 33 -->
1415 calling a function or accessing a volatile object).
1416 <p><!--para 5 -->
1417 When the processing of the abstract machine is interrupted by receipt of a signal, the
1418 values of objects that are neither lock-free atomic objects nor of type volatile
1419 sig_atomic_t are unspecified, and the value of any object that is modified by the
1420 handler that is neither a lock-free atomic object nor of type volatile
1421 sig_atomic_t becomes undefined.
1422 <p><!--para 6 -->
1423 The least requirements on a conforming implementation are:
1424 <ul>
1425 <li> Accesses to volatile objects are evaluated strictly according to the rules of the abstract
1426 machine.
1427 <li> At program termination, all data written into files shall be identical to the result that
1428 execution of the program according to the abstract semantics would have produced.
1429 <li> The input and output dynamics of interactive devices shall take place as specified in
1430 <a href="#7.21.3">7.21.3</a>. The intent of these requirements is that unbuffered or line-buffered output
1431 appear as soon as possible, to ensure that prompting messages actually appear prior to
1432 a program waiting for input.
1433 </ul>
1434 This is the observable behavior of the program.
1435 <p><!--para 7 -->
1436 What constitutes an interactive device is implementation-defined.
1437 <p><!--para 8 -->
1438 More stringent correspondences between abstract and actual semantics may be defined by
1439 each implementation.
1440 <p><!--para 9 -->
1441 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
1442 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
1443 abstract semantics. The keyword volatile would then be redundant.
1444 <p><!--para 10 -->
1445 Alternatively, an implementation might perform various optimizations within each translation unit, such
1446 that the actual semantics would agree with the abstract semantics only when making function calls across
1447 translation unit boundaries. In such an implementation, at the time of each function entry and function
1448 return where the calling function and the called function are in different translation units, the values of all
1449 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
1450 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
1451 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
1452 type of implementation, objects referred to by interrupt service routines activated by the signal function
1453 would require explicit specification of volatile storage, as well as other implementation-defined
1454 restrictions.
1456 <p><!--para 11 -->
1457 EXAMPLE 2 In executing the fragment
1458 <pre>
1459 char c1, c2;
1460 /* ... */
1461 c1 = c1 + c2;</pre>
1462 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
1463 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
1464 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
1465 produce the same result, possibly omitting the promotions.
1466 <!--page 34 -->
1467 <p><!--para 12 -->
1468 EXAMPLE 3 Similarly, in the fragment
1469 <pre>
1470 float f1, f2;
1471 double d;
1472 /* ... */
1473 f1 = f2 * d;</pre>
1474 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
1475 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
1476 were replaced by the constant 2.0, which has type double).
1478 <p><!--para 13 -->
1479 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1480 semantics. Values are independent of whether they are represented in a register or in memory. For
1481 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1482 is required to round to the precision of the storage type. In particular, casts and assignments are required to
1483 perform their specified conversion. For the fragment
1484 <pre>
1485 double d1, d2;
1486 float f;
1487 d1 = f = expression;
1488 d2 = (float) expression;</pre>
1489 the values assigned to d1 and d2 are required to have been converted to float.
1491 <p><!--para 14 -->
1492 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1493 precision as well as range. The implementation cannot generally apply the mathematical associative rules
1494 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1495 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1496 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1497 numbers are often not valid (see <a href="#F.9">F.9</a>).
1498 <pre>
1499 double x, y, z;
1500 /* ... */
1501 x = (x * y) * z; // not equivalent to x *= y * z;
1502 z = (x - y) + y ; // not equivalent to z = x;
1503 z = x + x * y; // not equivalent to z = x * (1.0 + y);
1504 y = x / 5.0; // not equivalent to y = x * 0.2;</pre>
1506 <p><!--para 15 -->
1507 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1508 <pre>
1509 int a, b;
1510 /* ... */
1511 a = a + 32760 + b + 5;</pre>
1512 the expression statement behaves exactly the same as
1513 <pre>
1514 a = (((a + 32760) + b) + 5);</pre>
1515 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1516 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1517 which overflows produce an explicit trap and in which the range of values representable by an int is
1518 [-32768, +32767], the implementation cannot rewrite this expression as
1519 <pre>
1520 a = ((a + b) + 32765);</pre>
1521 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1522 while the original expression would not; nor can the expression be rewritten either as
1523 <!--page 35 -->
1524 <pre>
1525 a = ((a + 32765) + b);</pre>
1527 <pre>
1528 a = (a + (b + 32765));</pre>
1529 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1530 in which overflow silently generates some value and where positive and negative overflows cancel, the
1531 above expression statement can be rewritten by the implementation in any of the above ways because the
1532 same result will occur.
1534 <p><!--para 16 -->
1535 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1536 following fragment
1537 <pre>
1538 #include <a href="#7.21">&lt;stdio.h&gt;</a>
1539 int sum;
1540 char *p;
1541 /* ... */
1542 sum = sum * 10 - '0' + (*p++ = getchar());</pre>
1543 the expression statement is grouped as if it were written as
1544 <pre>
1545 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));</pre>
1546 but the actual increment of p can occur at any time between the previous sequence point and the next
1547 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1548 value.
1550 <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
1551 signal function (<a href="#7.14">7.14</a>), files (<a href="#7.21.3">7.21.3</a>).
1553 <h6>footnotes</h6>
1554 <p><small><a name="note12" href="#note12">12)</a> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
1555 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
1556 values of floating-point operations. Implementations that support such floating-point state are
1557 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
1558 environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
1559 effects matter, freeing the implementations in other cases.
1560 </small>
1561 <p><small><a name="note13" href="#note13">13)</a> The executions of unsequenced evaluations can interleave. Indeterminately sequenced evaluations
1562 cannot interleave, but can be executed in any order.
1563 </small>
1565 <h5><a name="5.1.2.4" href="#5.1.2.4">5.1.2.4 Multi-threaded executions and data races</a></h5>
1566 <p><!--para 1 -->
1567 Under a hosted implementation, a program can have more than one thread of execution
1568 (or thread) running concurrently. The execution of each thread proceeds as defined by
1569 the remainder of this standard. The execution of the entire program consists of an
1570 execution of all of its threads.<sup><a href="#note14"><b>14)</b></a></sup> Under a freestanding implementation, it is
1571 implementation-defined whether a program can have more than one thread of execution.
1572 <p><!--para 2 -->
1573 The value of an object visible to a thread T at a particular point is the initial value of the
1574 object, a value stored in the object by T , or a value stored in the object by another thread,
1575 according to the rules below.
1576 <p><!--para 3 -->
1577 NOTE 1 In some cases, there may instead be undefined behavior. Much of this section is motivated by
1578 the desire to support atomic operations with explicit and detailed visibility constraints. However, it also
1579 implicitly supports a simpler view for more restricted programs.
1581 <p><!--para 4 -->
1582 Two expression evaluations conflict if one of them modifies a memory location and the
1583 other one reads or modifies the same memory location.
1588 <!--page 36 -->
1589 <p><!--para 5 -->
1590 The library defines a number of atomic operations (<a href="#7.17">7.17</a>) and operations on mutexes
1591 (<a href="#7.25.4">7.25.4</a>) that are specially identified as synchronization operations. These operations play
1592 a special role in making assignments in one thread visible to another. A synchronization
1593 operation on one or more memory locations is either an acquire operation, a release
1594 operation, both an acquire and release operation, or a consume operation. A
1595 synchronization operation without an associated memory location is a fence and can be
1596 either an acquire fence, a release fence, or both an acquire and release fence. In addition,
1597 there are relaxed atomic operations, which are not synchronization operations, and
1598 atomic read-modify-write operations, which have special characteristics.
1599 <p><!--para 6 -->
1600 NOTE 2 For example, a call that acquires a mutex will perform an acquire operation on the locations
1601 composing the mutex. Correspondingly, a call that releases the same mutex will perform a release
1602 operation on those same locations. Informally, performing a release operation on A forces prior side effects
1603 on other memory locations to become visible to other threads that later perform an acquire or consume
1604 operation on A. We do not include relaxed atomic operations as synchronization operations although, like
1605 synchronization operations, they cannot contribute to data races.
1607 <p><!--para 7 -->
1608 All modifications to a particular atomic object M occur in some particular total order,
1609 called the modification order of M. If A and B are modifications of an atomic object M,
1610 and A happens before B, then A shall precede B in the modification order of M, which is
1611 defined below.
1612 <p><!--para 8 -->
1613 NOTE 3 This states that the modification orders must respect the ''happens before'' relation.
1615 <p><!--para 9 -->
1616 NOTE 4 There is a separate order for each atomic object. There is no requirement that these can be
1617 combined into a single total order for all objects. In general this will be impossible since different threads
1618 may observe modifications to different variables in inconsistent orders.
1620 <p><!--para 10 -->
1621 A release sequence on an atomic object M is a maximal contiguous sub-sequence of side
1622 effects in the modification order of M, where the first operation is a release and every
1623 subsequent operation either is performed by the same thread that performed the release or
1624 is an atomic read-modify-write operation.
1625 <p><!--para 11 -->
1626 Certain library calls synchronize with other library calls performed by another thread. In
1627 particular, an atomic operation A that performs a release operation on an object M
1628 synchronizes with an atomic operation B that performs an acquire operation on M and
1629 reads a value written by any side effect in the release sequence headed by A.
1630 <p><!--para 12 -->
1631 NOTE 5 Except in the specified cases, reading a later value does not necessarily ensure visibility as
1632 described below. Such a requirement would sometimes interfere with efficient implementation.
1634 <p><!--para 13 -->
1635 NOTE 6 The specifications of the synchronization operations define when one reads the value written by
1636 another. For atomic variables, the definition is clear. All operations on a given mutex occur in a single total
1637 order. Each mutex acquisition ''reads the value written'' by the last mutex release.
1639 <p><!--para 14 -->
1640 An evaluation A carries a dependency <sup><a href="#note15"><b>15)</b></a></sup> to an evaluation B if:
1643 <!--page 37 -->
1644 <ul>
1645 <li> the value of A is used as an operand of B, unless:
1646 <ul>
1647 <li> B is an invocation of the kill_dependency macro,
1649 <li> A is the left operand of a &amp;&amp; or || operator,
1651 <li> A is the left operand of a ? : operator, or
1653 <li> A is the left operand of a , operator;
1654 </ul>
1656 <li> A writes a scalar object or bit-field M, B reads from M the value written by A, and A
1657 is sequenced before B, or
1658 <li> for some evaluation X, A carries a dependency to X and X carries a dependency to B.
1659 </ul>
1660 <p><!--para 15 -->
1661 An evaluation A is dependency-ordered before<sup><a href="#note16"><b>16)</b></a></sup> an evaluation B if:
1662 <ul>
1663 <li> A performs a release operation on an atomic object M, and B performs a consume
1664 operation on M and reads a value written by any side effect in the release sequence
1665 headed by A, or
1666 <li> for some evaluation X, A is dependency-ordered before X and X carries a
1667 dependency to B.
1668 </ul>
1669 <p><!--para 16 -->
1670 An evaluation A inter-thread happens before an evaluation B if A synchronizes with B, A
1671 is dependency-ordered before B, or, for some evaluation X:
1672 <ul>
1673 <li> A synchronizes with X and X is sequenced before B,
1674 <li> A is sequenced before X and X inter-thread happens before B, or
1675 <li> A inter-thread happens before X and X inter-thread happens before B.
1676 </ul>
1677 <p><!--para 17 -->
1678 NOTE 7 The ''inter-thread happens before'' relation describes arbitrary concatenations of ''sequenced
1679 before'', ''synchronizes with'', and ''dependency-ordered before'' relationships, with two exceptions. The
1680 first exception is that a concatenation is not permitted to end with ''dependency-ordered before'' followed
1681 by ''sequenced before''. The reason for this limitation is that a consume operation participating in a
1682 ''dependency-ordered before'' relationship provides ordering only with respect to operations to which this
1683 consume operation actually carries a dependency. The reason that this limitation applies only to the end of
1684 such a concatenation is that any subsequent release operation will provide the required ordering for a prior
1685 consume operation. The second exception is that a concatenation is not permitted to consist entirely of
1686 ''sequenced before''. The reasons for this limitation are (1) to permit ''inter-thread happens before'' to be
1687 transitively closed and (2) the ''happens before'' relation, defined below, provides for relationships
1688 consisting entirely of ''sequenced before''.
1690 <p><!--para 18 -->
1691 An evaluation A happens before an evaluation B if A is sequenced before B or A inter-
1692 thread happens before B.
1696 <!--page 38 -->
1697 <p><!--para 19 -->
1698 A visible side effect A on an object M with respect to a value computation B of M
1699 satisfies the conditions:
1700 <ul>
1701 <li> A happens before B, and
1702 <li> there is no other side effect X to M such that A happens before X and X happens
1703 before B.
1704 </ul>
1705 The value of a non-atomic scalar object M, as determined by evaluation B, shall be the
1706 value stored by the visible side effect A.
1707 <p><!--para 20 -->
1708 NOTE 8 If there is ambiguity about which side effect to a non-atomic object is visible, then there is a data
1709 race and the behavior is undefined.
1711 <p><!--para 21 -->
1712 NOTE 9 This states that operations on ordinary variables are not visibly reordered. This is not actually
1713 detectable without data races, but it is necessary to ensure that data races, as defined here, and with suitable
1714 restrictions on the use of atomics, correspond to data races in a simple interleaved (sequentially consistent)
1715 execution.
1717 <p><!--para 22 -->
1718 The visible sequence of side effects on an atomic object M, with respect to a value
1719 computation B of M, is a maximal contiguous sub-sequence of side effects in the
1720 modification order of M, where the first side effect is visible with respect to B, and for
1721 every subsequent side effect, it is not the case that B happens before it. The value of an
1722 atomic object M, as determined by evaluation B, shall be the value stored by some
1723 operation in the visible sequence of M with respect to B. Furthermore, if a value
1724 computation A of an atomic object M happens before a value computation B of M, and
1725 the value computed by A corresponds to the value stored by side effect X, then the value
1726 computed by B shall either equal the value computed by A, or be the value stored by side
1727 effect Y , where Y follows X in the modification order of M.
1728 <p><!--para 23 -->
1729 NOTE 10 This effectively disallows compiler reordering of atomic operations to a single object, even if
1730 both operations are ''relaxed'' loads. By doing so, we effectively make the ''cache coherence'' guarantee
1731 provided by most hardware available to C atomic operations.
1733 <p><!--para 24 -->
1734 NOTE 11 The visible sequence depends on the ''happens before'' relation, which in turn depends on the
1735 values observed by loads of atomics, which we are restricting here. The intended reading is that there must
1736 exist an association of atomic loads with modifications they observe that, together with suitably chosen
1737 modification orders and the ''happens before'' relation derived as described above, satisfy the resulting
1738 constraints as imposed here.
1740 <p><!--para 25 -->
1741 The execution of a program contains a data race if it contains two conflicting actions in
1742 different threads, at least one of which is not atomic, and neither happens before the
1743 other. Any such data race results in undefined behavior.
1744 <p><!--para 26 -->
1745 NOTE 12 It can be shown that programs that correctly use simple mutexes and
1746 memory_order_seq_cst operations to prevent all data races, and use no other synchronization
1747 operations, behave as though the operations executed by their constituent threads were simply interleaved,
1748 with each value computation of an object being the last value stored in that interleaving. This is normally
1749 referred to as ''sequential consistency''. However, this applies only to data-race-free programs, and data-
1750 race-free programs cannot observe most program transformations that do not change single-threaded
1751 program semantics. In fact, most single-threaded program transformations continue to be allowed, since
1752 any program that behaves differently as a result must contain undefined behavior.
1753 <!--page 39 -->
1754 <p><!--para 27 -->
1755 NOTE 13 Compiler transformations that introduce assignments to a potentially shared memory location
1756 that would not be modified by the abstract machine are generally precluded by this standard, since such an
1757 assignment might overwrite another assignment by a different thread in cases in which an abstract machine
1758 execution would not have encountered a data race. This includes implementations of data member
1759 assignment that overwrite adjacent members in separate memory locations. We also generally preclude
1760 reordering of atomic loads in cases in which the atomics in question may alias, since this may violate the
1761 "visible sequence" rules.
1763 <p><!--para 28 -->
1764 NOTE 14 Transformations that introduce a speculative read of a potentially shared memory location may
1765 not preserve the semantics of the program as defined in this standard, since they potentially introduce a data
1766 race. However, they are typically valid in the context of an optimizing compiler that targets a specific
1767 machine with well-defined semantics for data races. They would be invalid for a hypothetical machine that
1768 is not tolerant of races or provides hardware race detection.
1769 <!--page 40 -->
1771 <h6>footnotes</h6>
1772 <p><small><a name="note14" href="#note14">14)</a> The execution can usually be viewed as an interleaving of all of the threads. However, some kinds of
1773 atomic operations, for example, allow executions inconsistent with a simple interleaving as described
1774 below.
1775 </small>
1776 <p><small><a name="note15" href="#note15">15)</a> The ''carries a dependency'' relation is a subset of the ''sequenced before'' relation, and is similarly
1777 strictly intra-thread.
1778 </small>
1779 <p><small><a name="note16" href="#note16">16)</a> The ''dependency-ordered before'' relation is analogous to the ''synchronizes with'' relation, but uses
1780 release/consume in place of release/acquire.
1781 </small>
1783 <h3><a name="5.2" href="#5.2">5.2 Environmental considerations</a></h3>
1785 <h4><a name="5.2.1" href="#5.2.1">5.2.1 Character sets</a></h4>
1786 <p><!--para 1 -->
1787 Two sets of characters and their associated collating sequences shall be defined: the set in
1788 which source files are written (the source character set), and the set interpreted in the
1789 execution environment (the execution character set). Each set is further divided into a
1790 basic character set, whose contents are given by this subclause, and a set of zero or more
1791 locale-specific members (which are not members of the basic character set) called
1792 extended characters. The combined set is also called the extended character set. The
1793 values of the members of the execution character set are implementation-defined.
1794 <p><!--para 2 -->
1795 In a character constant or string literal, members of the execution character set shall be
1796 represented by corresponding members of the source character set or by escape
1797 sequences consisting of the backslash \ followed by one or more characters. A byte with
1798 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1799 is used to terminate a character string.
1800 <p><!--para 3 -->
1801 Both the basic source and basic execution character sets shall have the following
1802 members: the 26 uppercase letters of the Latin alphabet
1803 <pre>
1804 A B C D E F G H I J K L M
1805 N O P Q R S T U V W X Y Z</pre>
1806 the 26 lowercase letters of the Latin alphabet
1807 <pre>
1808 a b c d e f g h i j k l m
1809 n o p q r s t u v w x y z</pre>
1810 the 10 decimal digits
1811 <pre>
1812 0 1 2 3 4 5 6 7 8 9</pre>
1813 the following 29 graphic characters
1814 <pre>
1815 ! " # % &amp; ' ( ) * + , - . / :
1816 ; &lt; = &gt; ? [ \ ] ^ _ { | } ~</pre>
1817 the space character, and control characters representing horizontal tab, vertical tab, and
1818 form feed. The representation of each member of the source and execution basic
1819 character sets shall fit in a byte. In both the source and execution basic character sets, the
1820 value of each character after 0 in the above list of decimal digits shall be one greater than
1821 the value of the previous. In source files, there shall be some way of indicating the end of
1822 each line of text; this International Standard treats such an end-of-line indicator as if it
1823 were a single new-line character. In the basic execution character set, there shall be
1824 control characters representing alert, backspace, carriage return, and new line. If any
1825 other characters are encountered in a source file (except in an identifier, a character
1826 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1827 <!--page 41 -->
1828 converted to a token), the behavior is undefined.
1829 <p><!--para 4 -->
1830 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1831 Standard the term does not include other characters that are letters in other alphabets.
1832 <p><!--para 5 -->
1833 The universal character name construct provides a way to name other characters.
1834 <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>),
1835 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>).
1837 <h5><a name="5.2.1.1" href="#5.2.1.1">5.2.1.1 Trigraph sequences</a></h5>
1838 <p><!--para 1 -->
1839 Before any other processing takes place, each occurrence of one of the following
1840 sequences of three characters (called trigraph sequences<sup><a href="#note17"><b>17)</b></a></sup>) is replaced with the
1841 corresponding single character.
1842 <pre>
1843 ??= # ??) ] ??! |
1844 ??( [ ??' ^ ??&gt; }
1845 ??/ \ ??&lt; { ??- ~</pre>
1846 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1847 above is not changed.
1848 <p><!--para 2 -->
1849 EXAMPLE 1
1850 <pre>
1851 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)</pre>
1852 becomes
1853 <pre>
1854 #define arraycheck(a, b) a[b] || b[a]</pre>
1856 <p><!--para 3 -->
1857 EXAMPLE 2 The following source line
1858 <pre>
1859 printf("Eh???/n");</pre>
1860 becomes (after replacement of the trigraph sequence ??/)
1861 <pre>
1862 printf("Eh?\n");</pre>
1865 <h6>footnotes</h6>
1866 <p><small><a name="note17" href="#note17">17)</a> The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1867 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1868 </small>
1870 <h5><a name="5.2.1.2" href="#5.2.1.2">5.2.1.2 Multibyte characters</a></h5>
1871 <p><!--para 1 -->
1872 The source character set may contain multibyte characters, used to represent members of
1873 the extended character set. The execution character set may also contain multibyte
1874 characters, which need not have the same encoding as for the source character set. For
1875 both character sets, the following shall hold:
1876 <ul>
1877 <li> The basic character set shall be present and each character shall be encoded as a
1878 single byte.
1879 <li> The presence, meaning, and representation of any additional members is locale-
1880 specific.
1882 <!--page 42 -->
1883 <li> A multibyte character set may have a state-dependent encoding, wherein each
1884 sequence of multibyte characters begins in an initial shift state and enters other
1885 locale-specific shift states when specific multibyte characters are encountered in the
1886 sequence. While in the initial shift state, all single-byte characters retain their usual
1887 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1888 in the sequence is a function of the current shift state.
1889 <li> A byte with all bits zero shall be interpreted as a null character independent of shift
1890 state. Such a byte shall not occur as part of any other multibyte character.
1891 </ul>
1892 <p><!--para 2 -->
1893 For source files, the following shall hold:
1894 <ul>
1895 <li> An identifier, comment, string literal, character constant, or header name shall begin
1896 and end in the initial shift state.
1897 <li> An identifier, comment, string literal, character constant, or header name shall consist
1898 of a sequence of valid multibyte characters.
1899 </ul>
1901 <h4><a name="5.2.2" href="#5.2.2">5.2.2 Character display semantics</a></h4>
1902 <p><!--para 1 -->
1903 The active position is that location on a display device where the next character output by
1904 the fputc function would appear. The intent of writing a printing character (as defined
1905 by the isprint function) to a display device is to display a graphic representation of
1906 that character at the active position and then advance the active position to the next
1907 position on the current line. The direction of writing is locale-specific. If the active
1908 position is at the final position of a line (if there is one), the behavior of the display device
1909 is unspecified.
1910 <p><!--para 2 -->
1911 Alphabetic escape sequences representing nongraphic characters in the execution
1912 character set are intended to produce actions on display devices as follows:
1913 \a (alert) Produces an audible or visible alert without changing the active position.
1914 \b (backspace) Moves the active position to the previous position on the current line. If
1915 <pre>
1916 the active position is at the initial position of a line, the behavior of the display
1917 device is unspecified.</pre>
1918 \f ( form feed) Moves the active position to the initial position at the start of the next
1919 <pre>
1920 logical page.</pre>
1921 \n (new line) Moves the active position to the initial position of the next line.
1922 \r (carriage return) Moves the active position to the initial position of the current line.
1923 \t (horizontal tab) Moves the active position to the next horizontal tabulation position
1924 <pre>
1925 on the current line. If the active position is at or past the last defined horizontal
1926 tabulation position, the behavior of the display device is unspecified.</pre>
1927 \v (vertical tab) Moves the active position to the initial position of the next vertical
1928 <!--page 43 -->
1929 <p><!--para 3 -->
1930 <pre>
1931 tabulation position. If the active position is at or past the last defined vertical
1932 tabulation position, the behavior of the display device is unspecified.</pre>
1933 Each of these escape sequences shall produce a unique implementation-defined value
1934 which can be stored in a single char object. The external representations in a text file
1935 need not be identical to the internal representations, and are outside the scope of this
1936 International Standard.
1937 <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.21.7.3">7.21.7.3</a>).
1939 <h4><a name="5.2.3" href="#5.2.3">5.2.3 Signals and interrupts</a></h4>
1940 <p><!--para 1 -->
1941 Functions shall be implemented such that they may be interrupted at any time by a signal,
1942 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1943 invocations' control flow (after the interruption), function return values, or objects with
1944 automatic storage duration. All such objects shall be maintained outside the function
1945 image (the instructions that compose the executable representation of a function) on a
1946 per-invocation basis.
1948 <h4><a name="5.2.4" href="#5.2.4">5.2.4 Environmental limits</a></h4>
1949 <p><!--para 1 -->
1950 Both the translation and execution environments constrain the implementation of
1951 language translators and libraries. The following summarizes the language-related
1952 environmental limits on a conforming implementation; the library-related limits are
1953 discussed in clause 7.
1955 <h5><a name="5.2.4.1" href="#5.2.4.1">5.2.4.1 Translation limits</a></h5>
1956 <p><!--para 1 -->
1957 The implementation shall be able to translate and execute at least one program that
1958 contains at least one instance of every one of the following limits:<sup><a href="#note18"><b>18)</b></a></sup>
1959 <ul>
1960 <li> 127 nesting levels of blocks
1961 <li> 63 nesting levels of conditional inclusion
1962 <li> 12 pointer, array, and function declarators (in any combinations) modifying an
1963 arithmetic, structure, union, or void type in a declaration
1964 <li> 63 nesting levels of parenthesized declarators within a full declarator
1965 <li> 63 nesting levels of parenthesized expressions within a full expression
1966 <li> 63 significant initial characters in an internal identifier or a macro name (each
1967 universal character name or extended source character is considered a single
1968 character)
1969 <li> 31 significant initial characters in an external identifier (each universal character name
1970 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1973 <!--page 44 -->
1974 <pre>
1975 universal character name specifying a short identifier of 00010000 or more is
1976 considered 10 characters, and each extended source character is considered the same
1977 number of characters as the corresponding universal character name, if any)<sup><a href="#note19"><b>19)</b></a></sup></pre>
1978 <li> 4095 external identifiers in one translation unit
1979 <li> 511 identifiers with block scope declared in one block
1980 <li> 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1981 <li> 127 parameters in one function definition
1982 <li> 127 arguments in one function call
1983 <li> 127 parameters in one macro definition
1984 <li> 127 arguments in one macro invocation
1985 <li> 4095 characters in a logical source line
1986 <li> 4095 characters in a string literal (after concatenation)
1987 <li> 65535 bytes in an object (in a hosted environment only)
1988 <li> 15 nesting levels for #included files
1989 <li> 1023 case labels for a switch statement (excluding those for any nested switch
1990 statements)
1991 <li> 1023 members in a single structure or union
1992 <li> 1023 enumeration constants in a single enumeration
1993 <li> 63 levels of nested structure or union definitions in a single struct-declaration-list
1994 </ul>
1996 <h6>footnotes</h6>
1997 <p><small><a name="note18" href="#note18">18)</a> Implementations should avoid imposing fixed translation limits whenever possible.
1998 </small>
1999 <p><small><a name="note19" href="#note19">19)</a> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
2000 </small>
2002 <h5><a name="5.2.4.2" href="#5.2.4.2">5.2.4.2 Numerical limits</a></h5>
2003 <p><!--para 1 -->
2004 An implementation is required to document all the limits specified in this subclause,
2005 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
2006 specified in <a href="#7.20">&lt;stdint.h&gt;</a>.
2007 <p><b> Forward references</b>: integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>).
2009 <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>
2010 <p><!--para 1 -->
2011 The values given below shall be replaced by constant expressions suitable for use in #if
2012 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
2013 following shall be replaced by expressions that have the same type as would an
2014 expression that is an object of the corresponding type converted according to the integer
2015 promotions. Their implementation-defined values shall be equal or greater in magnitude
2018 <!--page 45 -->
2019 (absolute value) to those shown, with the same sign.
2020 <ul>
2021 <li> number of bits for smallest object that is not a bit-field (byte)
2022 CHAR_BIT 8
2023 <li> minimum value for an object of type signed char
2024 SCHAR_MIN -127 // -(27 - 1)
2025 <li> maximum value for an object of type signed char
2026 SCHAR_MAX +127 // 27 - 1
2027 <li> maximum value for an object of type unsigned char
2028 UCHAR_MAX 255 // 28 - 1
2029 <li> minimum value for an object of type char
2030 CHAR_MIN see below
2031 <li> maximum value for an object of type char
2032 CHAR_MAX see below
2033 <li> maximum number of bytes in a multibyte character, for any supported locale
2034 MB_LEN_MAX 1
2035 <li> minimum value for an object of type short int
2036 SHRT_MIN -32767 // -(215 - 1)
2037 <li> maximum value for an object of type short int
2038 SHRT_MAX +32767 // 215 - 1
2039 <li> maximum value for an object of type unsigned short int
2040 USHRT_MAX 65535 // 216 - 1
2041 <li> minimum value for an object of type int
2042 INT_MIN -32767 // -(215 - 1)
2043 <li> maximum value for an object of type int
2044 INT_MAX +32767 // 215 - 1
2045 <li> maximum value for an object of type unsigned int
2046 UINT_MAX 65535 // 216 - 1
2047 <li> minimum value for an object of type long int
2048 LONG_MIN -2147483647 // -(231 - 1)
2049 <li> maximum value for an object of type long int
2050 LONG_MAX +2147483647 // 231 - 1
2051 <li> maximum value for an object of type unsigned long int
2052 ULONG_MAX 4294967295 // 232 - 1
2053 <!--page 46 -->
2054 <li> minimum value for an object of type long long int
2055 LLONG_MIN -9223372036854775807 // -(263 - 1)
2056 <li> maximum value for an object of type long long int
2057 LLONG_MAX +9223372036854775807 // 263 - 1
2058 <li> maximum value for an object of type unsigned long long int
2059 ULLONG_MAX 18446744073709551615 // 264 - 1
2060 </ul>
2061 <p><!--para 2 -->
2062 If the value of an object of type char is treated as a signed integer when used in an
2063 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
2064 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
2065 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
2066 UCHAR_MAX.<sup><a href="#note20"><b>20)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
2067 <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>).
2069 <h6>footnotes</h6>
2070 <p><small><a name="note20" href="#note20">20)</a> See <a href="#6.2.5">6.2.5</a>.
2071 </small>
2073 <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>
2074 <p><!--para 1 -->
2075 The characteristics of floating types are defined in terms of a model that describes a
2076 representation of floating-point numbers and values that provide information about an
2077 implementation's floating-point arithmetic.<sup><a href="#note21"><b>21)</b></a></sup> The following parameters are used to
2078 define the model for each floating-point type:
2079 <p><!--para 2 -->
2080 <pre>
2081 s sign ((+-)1)
2082 b base or radix of exponent representation (an integer &gt; 1)
2083 e exponent (an integer between a minimum emin and a maximum emax )
2084 p precision (the number of base-b digits in the significand)
2085 fk nonnegative integers less than b (the significand digits)</pre>
2086 A floating-point number (x) is defined by the following model:
2087 <pre>
2089 x = sb e (Sum) f k b-k ,
2091 emin &lt;= e &lt;= emax</pre>
2093 <p><!--para 3 -->
2094 In addition to normalized floating-point numbers ( f 1 &gt; 0 if x != 0), floating types may be
2095 able to contain other kinds of floating-point numbers, such as subnormal floating-point
2096 numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
2097 e &gt; emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
2098 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
2099 through almost every arithmetic operation without raising a floating-point exception; a
2100 signaling NaN generally raises a floating-point exception when occurring as an
2103 <!--page 47 -->
2104 arithmetic operand.<sup><a href="#note22"><b>22)</b></a></sup>
2105 <p><!--para 4 -->
2106 An implementation may give zero and values that are not floating-point numbers (such as
2107 infinities and NaNs) a sign or may leave them unsigned. Wherever such values are
2108 unsigned, any requirement in this International Standard to retrieve the sign shall produce
2109 an unspecified sign, and any requirement to set the sign shall be ignored.
2110 <p><!--para 5 -->
2111 The minimum range of representable values for a floating type is the most negative finite
2112 floating-point number representable in that type through the most positive finite floating-
2113 point number representable in that type. In addition, if negative infinity is representable
2114 in a type, the range of that type is extended to all negative real numbers; likewise, if
2115 positive infinity is representable in a type, the range of that type is extended to all positive
2116 real numbers.
2117 <p><!--para 6 -->
2118 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
2119 <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-
2120 defined, as is the accuracy of the conversion between floating-point internal
2121 representations and string representations performed by the library functions in
2122 <a href="#7.21">&lt;stdio.h&gt;</a>, <a href="#7.22">&lt;stdlib.h&gt;</a>, and <a href="#7.28">&lt;wchar.h&gt;</a>. The implementation may state that the
2123 accuracy is unknown.
2124 <p><!--para 7 -->
2125 All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
2126 expressions suitable for use in #if preprocessing directives; all floating values shall be
2127 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
2128 and FLT_ROUNDS have separate names for all three floating-point types. The floating-
2129 point model representation is provided for all values except FLT_EVAL_METHOD and
2130 FLT_ROUNDS.
2131 <p><!--para 8 -->
2132 The rounding mode for floating-point addition is characterized by the implementation-
2133 defined value of FLT_ROUNDS:<sup><a href="#note23"><b>23)</b></a></sup>
2134 <pre>
2135 -1 indeterminable
2136 0 toward zero
2137 1 to nearest
2138 2 toward positive infinity
2139 3 toward negative infinity</pre>
2140 All other values for FLT_ROUNDS characterize implementation-defined rounding
2141 behavior.
2144 <!--page 48 -->
2145 <p><!--para 9 -->
2146 Except for assignment and cast (which remove all extra range and precision), the values
2147 yielded by operators with floating operands and values subject to the usual arithmetic
2148 conversions and of floating constants are evaluated to a format whose range and precision
2149 may be greater than required by the type. The use of evaluation formats is characterized
2150 by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note24"><b>24)</b></a></sup>
2151 <pre>
2152 -1 indeterminable;
2153 0 evaluate all operations and constants just to the range and precision of the
2154 type;
2155 1 evaluate operations and constants of type float and double to the
2156 range and precision of the double type, evaluate long double
2157 operations and constants to the range and precision of the long double
2158 type;
2159 2 evaluate all operations and constants to the range and precision of the
2160 long double type.</pre>
2161 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
2162 behavior.
2163 <p><!--para 10 -->
2164 The presence or absence of subnormal numbers is characterized by the implementation-
2165 defined values of FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, and
2166 LDBL_HAS_SUBNORM:
2167 <p><!--para 11 -->
2168 <pre>
2169 -1 indeterminable<sup><a href="#note25"><b>25)</b></a></sup>
2170 0 absent<sup><a href="#note26"><b>26)</b></a></sup> (type does not support subnormal numbers)
2171 1 present (type does support subnormal numbers)</pre>
2172 The values given in the following list shall be replaced by constant expressions with
2173 implementation-defined values that are greater or equal in magnitude (absolute value) to
2174 those shown, with the same sign:
2175 <ul>
2176 <li> radix of exponent representation, b
2177 FLT_RADIX 2
2182 <!--page 49 -->
2183 <li> number of base-FLT_RADIX digits in the floating-point significand, p
2184 FLT_MANT_DIG
2185 DBL_MANT_DIG
2186 LDBL_MANT_DIG
2187 <li> number of decimal digits, n, such that any floating-point number with p radix b digits
2188 can be rounded to a floating-point number with n decimal digits and back again
2189 without change to the value,
2190 <pre>
2191 { p log10 b if b is a power of 10
2193 { [^1 + p log10 b^] otherwise</pre>
2194 FLT_DECIMAL_DIG 6
2195 DBL_DECIMAL_DIG 10
2196 LDBL_DECIMAL_DIG 10
2197 <li> number of decimal digits, n, such that any floating-point number in the widest
2198 supported floating type with pmax radix b digits can be rounded to a floating-point
2199 number with n decimal digits and back again without change to the value,
2200 <pre>
2201 { pmax log10 b if b is a power of 10
2203 { [^1 + pmax log10 b^] otherwise</pre>
2204 DECIMAL_DIG 10
2205 <li> number of decimal digits, q, such that any floating-point number with q decimal digits
2206 can be rounded into a floating-point number with p radix b digits and back again
2207 without change to the q decimal digits,
2208 <pre>
2209 { p log10 b if b is a power of 10
2211 { [_( p - 1) log10 b_] otherwise</pre>
2212 FLT_DIG 6
2213 DBL_DIG 10
2214 LDBL_DIG 10
2215 <li> minimum negative integer such that FLT_RADIX raised to one less than that power is
2216 a normalized floating-point number, emin
2217 FLT_MIN_EXP
2218 DBL_MIN_EXP
2219 LDBL_MIN_EXP
2220 <!--page 50 -->
2221 <li> minimum negative integer such that 10 raised to that power is in the range of
2222 normalized floating-point numbers, [^log10 b emin -1 ^]
2223 <pre>
2224 [ ]</pre>
2225 FLT_MIN_10_EXP -37
2226 DBL_MIN_10_EXP -37
2227 LDBL_MIN_10_EXP -37
2228 <li> maximum integer such that FLT_RADIX raised to one less than that power is a
2229 representable finite floating-point number, emax
2230 <pre>
2231 FLT_MAX_EXP
2232 DBL_MAX_EXP
2233 LDBL_MAX_EXP</pre>
2234 <li> maximum integer such that 10 raised to that power is in the range of representable
2235 finite floating-point numbers, [_log10 ((1 - b- p )b emax )_]
2236 </ul>
2237 <p><!--para 12 -->
2238 <pre>
2239 FLT_MAX_10_EXP +37
2240 DBL_MAX_10_EXP +37
2241 LDBL_MAX_10_EXP +37</pre>
2242 The values given in the following list shall be replaced by constant expressions with
2243 implementation-defined values that are greater than or equal to those shown:
2244 <ul>
2245 <li> maximum representable finite floating-point number, (1 - b- p )b emax
2246 </ul>
2247 <p><!--para 13 -->
2248 <pre>
2249 FLT_MAX 1E+37
2250 DBL_MAX 1E+37
2251 LDBL_MAX 1E+37</pre>
2252 The values given in the following list shall be replaced by constant expressions with
2253 implementation-defined (positive) values that are less than or equal to those shown:
2254 <ul>
2255 <li> the difference between 1 and the least value greater than 1 that is representable in the
2256 given floating point type, b1- p
2257 <pre>
2258 FLT_EPSILON 1E-5
2259 DBL_EPSILON 1E-9
2260 LDBL_EPSILON 1E-9</pre>
2261 <li> minimum normalized positive floating-point number, b emin -1
2262 <!--page 51 -->
2263 <pre>
2264 FLT_MIN 1E-37
2265 DBL_MIN 1E-37
2266 LDBL_MIN 1E-37</pre>
2267 <li> minimum positive floating-point number<sup><a href="#note27"><b>27)</b></a></sup>
2268 FLT_TRUE_MIN 1E-37
2269 DBL_TRUE_MIN 1E-37
2270 LDBL_TRUE_MIN 1E-37
2271 </ul>
2272 <h6>Recommended practice</h6>
2273 <p><!--para 14 -->
2274 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
2275 should be the identity function.
2276 <p><!--para 15 -->
2277 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
2278 requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
2279 float:
2280 <pre>
2282 x = s16e (Sum) f k 16-k ,
2284 -31 &lt;= e &lt;= +32</pre>
2286 <pre>
2287 FLT_RADIX 16
2288 FLT_MANT_DIG 6
2289 FLT_EPSILON 9.53674316E-07F
2290 FLT_DECIMAL_DIG 9
2291 FLT_DIG 6
2292 FLT_MIN_EXP -31
2293 FLT_MIN 2.93873588E-39F
2294 FLT_MIN_10_EXP -38
2295 FLT_MAX_EXP +32
2296 FLT_MAX 3.40282347E+38F
2297 FLT_MAX_10_EXP +38</pre>
2299 <p><!--para 16 -->
2300 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
2301 single-precision and double-precision numbers in IEC 60559,<sup><a href="#note28"><b>28)</b></a></sup> and the appropriate values in a
2302 <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
2303 <pre>
2305 x f = s2e (Sum) f k 2-k ,
2307 -125 &lt;= e &lt;= +128</pre>
2309 <pre>
2311 x d = s2e (Sum) f k 2-k ,
2313 -1021 &lt;= e &lt;= +1024</pre>
2315 <pre>
2316 FLT_RADIX 2
2317 DECIMAL_DIG 17
2318 FLT_MANT_DIG 24
2319 FLT_EPSILON 1.19209290E-07F // decimal constant
2320 FLT_EPSILON 0X1P-23F // hex constant
2321 FLT_DECIMAL_DIG 9</pre>
2324 <!--page 52 -->
2325 <pre>
2326 FLT_DIG 6
2327 FLT_MIN_EXP -125
2328 FLT_MIN 1.17549435E-38F // decimal constant
2329 FLT_MIN 0X1P-126F // hex constant
2330 FLT_TRUE_MIN 1.40129846E-45F // decimal constant
2331 FLT_TRUE_MIN 0X1P-149F // hex constant
2332 FLT_HAS_SUBNORM 1
2333 FLT_MIN_10_EXP -37
2334 FLT_MAX_EXP +128
2335 FLT_MAX 3.40282347E+38F // decimal constant
2336 FLT_MAX 0X1.fffffeP127F // hex constant
2337 FLT_MAX_10_EXP +38
2338 DBL_MANT_DIG 53
2339 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
2340 DBL_EPSILON 0X1P-52 // hex constant
2341 DBL_DECIMAL_DIG 17
2342 DBL_DIG 15
2343 DBL_MIN_EXP -1021
2344 DBL_MIN 2.2250738585072014E-308 // decimal constant
2345 DBL_MIN 0X1P-1022 // hex constant
2346 DBL_TRUE_MIN 4.9406564584124654E-324 // decimal constant
2347 DBL_TRUE_MIN 0X1P-1074 // hex constant
2348 DBL_HAS_SUBNORM 1
2349 DBL_MIN_10_EXP -307
2350 DBL_MAX_EXP +1024
2351 DBL_MAX 1.7976931348623157E+308 // decimal constant
2352 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
2353 DBL_MAX_10_EXP +308</pre>
2354 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
2355 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
2356 precision), then DECIMAL_DIG would be 21.
2358 <p><b> Forward references</b>: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
2359 <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.28">&lt;wchar.h&gt;</a>
2360 (<a href="#7.28">7.28</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.22">&lt;stdlib.h&gt;</a>
2361 (<a href="#7.22">7.22</a>), input/output <a href="#7.21">&lt;stdio.h&gt;</a> (<a href="#7.21">7.21</a>), mathematics <a href="#7.12">&lt;math.h&gt;</a> (<a href="#7.12">7.12</a>).
2362 <!--page 53 -->
2364 <h6>footnotes</h6>
2365 <p><small><a name="note21" href="#note21">21)</a> The floating-point model is intended to clarify the description of each floating-point characteristic and
2366 does not require the floating-point arithmetic of the implementation to be identical.
2367 </small>
2368 <p><small><a name="note22" href="#note22">22)</a> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
2369 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
2370 similar behavior.
2371 </small>
2372 <p><small><a name="note23" href="#note23">23)</a> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
2373 the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
2374 </small>
2375 <p><small><a name="note24" href="#note24">24)</a> The evaluation method determines evaluation formats of expressions involving all floating types, not
2376 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
2377 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
2378 double.
2379 </small>
2380 <p><small><a name="note25" href="#note25">25)</a> Characterization as indeterminable is intended if floating-point operations do not consistently interpret
2381 subnormal representations as zero, nor as nonzero.
2382 </small>
2383 <p><small><a name="note26" href="#note26">26)</a> Characterization as absent is intended if no floating-point operations produce subnormal results from
2384 non-subnormal inputs, even if the type format includes representations of subnormal numbers.
2385 </small>
2386 <p><small><a name="note27" href="#note27">27)</a> If the presence or absence of subnormal numbers is indeterminable, then the value is intended to be a
2387 positive number no greater than the minimum normalized positive number for the type.
2388 </small>
2389 <p><small><a name="note28" href="#note28">28)</a> The floating-point model in that standard sums powers of b from zero, so the values of the exponent
2390 limits are one less than shown here.
2391 </small>
2393 <h2><a name="6" href="#6">6. Language</a></h2>
2395 <h3><a name="6.1" href="#6.1">6.1 Notation</a></h3>
2396 <p><!--para 1 -->
2397 In the syntax notation used in this clause, syntactic categories (nonterminals) are
2398 indicated by italic type, and literal words and character set members (terminals) by bold
2399 type. A colon (:) following a nonterminal introduces its definition. Alternative
2400 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
2401 optional symbol is indicated by the subscript ''opt'', so that
2402 <pre>
2403 { expressionopt }</pre>
2404 indicates an optional expression enclosed in braces.
2405 <p><!--para 2 -->
2406 When syntactic categories are referred to in the main text, they are not italicized and
2407 words are separated by spaces instead of hyphens.
2408 <p><!--para 3 -->
2409 A summary of the language syntax is given in <a href="#A">annex A</a>.
2411 <h3><a name="6.2" href="#6.2">6.2 Concepts</a></h3>
2413 <h4><a name="6.2.1" href="#6.2.1">6.2.1 Scopes of identifiers</a></h4>
2414 <p><!--para 1 -->
2415 An identifier can denote an object; a function; a tag or a member of a structure, union, or
2416 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
2417 same identifier can denote different entities at different points in the program. A member
2418 of an enumeration is called an enumeration constant. Macro names and macro
2419 parameters are not considered further here, because prior to the semantic phase of
2420 program translation any occurrences of macro names in the source file are replaced by the
2421 preprocessing token sequences that constitute their macro definitions.
2422 <p><!--para 2 -->
2423 For each different entity that an identifier designates, the identifier is visible (i.e., can be
2424 used) only within a region of program text called its scope. Different entities designated
2425 by the same identifier either have different scopes, or are in different name spaces. There
2426 are four kinds of scopes: function, file, block, and function prototype. (A function
2427 prototype is a declaration of a function that declares the types of its parameters.)
2428 <p><!--para 3 -->
2429 A label name is the only kind of identifier that has function scope. It can be used (in a
2430 goto statement) anywhere in the function in which it appears, and is declared implicitly
2431 by its syntactic appearance (followed by a : and a statement).
2432 <p><!--para 4 -->
2433 Every other identifier has scope determined by the placement of its declaration (in a
2434 declarator or type specifier). If the declarator or type specifier that declares the identifier
2435 appears outside of any block or list of parameters, the identifier has file scope, which
2436 terminates at the end of the translation unit. If the declarator or type specifier that
2437 declares the identifier appears inside a block or within the list of parameter declarations in
2438 a function definition, the identifier has block scope, which terminates at the end of the
2439 associated block. If the declarator or type specifier that declares the identifier appears
2440 <!--page 54 -->
2441 within the list of parameter declarations in a function prototype (not part of a function
2442 definition), the identifier has function prototype scope, which terminates at the end of the
2443 function declarator. If an identifier designates two different entities in the same name
2444 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will end
2445 strictly before the scope of the other entity (the outer scope). Within the inner scope, the
2446 identifier designates the entity declared in the inner scope; the entity declared in the outer
2447 scope is hidden (and not visible) within the inner scope.
2448 <p><!--para 5 -->
2449 Unless explicitly stated otherwise, where this International Standard uses the term
2450 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
2451 entity in the relevant name space whose declaration is visible at the point the identifier
2452 occurs.
2453 <p><!--para 6 -->
2454 Two identifiers have the same scope if and only if their scopes terminate at the same
2455 point.
2456 <p><!--para 7 -->
2457 Structure, union, and enumeration tags have scope that begins just after the appearance of
2458 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
2459 begins just after the appearance of its defining enumerator in an enumerator list. Any
2460 other identifier has scope that begins just after the completion of its declarator.
2461 <p><!--para 8 -->
2462 As a special case, a type name (which is not a declaration of an identifier) is considered to
2463 have a scope that begins just after the place within the type name where the omitted
2464 identifier would appear were it not omitted.
2465 <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
2466 (<a href="#6.9.1">6.9.1</a>), identifiers (<a href="#6.4.2">6.4.2</a>), macro replacement (<a href="#6.10.3">6.10.3</a>), name spaces of identifiers (<a href="#6.2.3">6.2.3</a>),
2467 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
2469 <h4><a name="6.2.2" href="#6.2.2">6.2.2 Linkages of identifiers</a></h4>
2470 <p><!--para 1 -->
2471 An identifier declared in different scopes or in the same scope more than once can be
2472 made to refer to the same object or function by a process called linkage.<sup><a href="#note29"><b>29)</b></a></sup> There are
2473 three kinds of linkage: external, internal, and none.
2474 <p><!--para 2 -->
2475 In the set of translation units and libraries that constitutes an entire program, each
2476 declaration of a particular identifier with external linkage denotes the same object or
2477 function. Within one translation unit, each declaration of an identifier with internal
2478 linkage denotes the same object or function. Each declaration of an identifier with no
2479 linkage denotes a unique entity.
2480 <p><!--para 3 -->
2481 If the declaration of a file scope identifier for an object or a function contains the storage-
2482 class specifier static, the identifier has internal linkage.<sup><a href="#note30"><b>30)</b></a></sup>
2486 <!--page 55 -->
2487 <p><!--para 4 -->
2488 For an identifier declared with the storage-class specifier extern in a scope in which a
2489 prior declaration of that identifier is visible,<sup><a href="#note31"><b>31)</b></a></sup> if the prior declaration specifies internal or
2490 external linkage, the linkage of the identifier at the later declaration is the same as the
2491 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
2492 declaration specifies no linkage, then the identifier has external linkage.
2493 <p><!--para 5 -->
2494 If the declaration of an identifier for a function has no storage-class specifier, its linkage
2495 is determined exactly as if it were declared with the storage-class specifier extern. If
2496 the declaration of an identifier for an object has file scope and no storage-class specifier,
2497 its linkage is external.
2498 <p><!--para 6 -->
2499 The following identifiers have no linkage: an identifier declared to be anything other than
2500 an object or a function; an identifier declared to be a function parameter; a block scope
2501 identifier for an object declared without the storage-class specifier extern.
2502 <p><!--para 7 -->
2503 If, within a translation unit, the same identifier appears with both internal and external
2504 linkage, the behavior is undefined.
2505 <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>),
2506 statements (<a href="#6.8">6.8</a>).
2508 <h6>footnotes</h6>
2509 <p><small><a name="note29" href="#note29">29)</a> There is no linkage between different identifiers.
2510 </small>
2511 <p><small><a name="note30" href="#note30">30)</a> A function declaration can contain the storage-class specifier static only if it is at file scope; see
2512 <a href="#6.7.1">6.7.1</a>.
2513 </small>
2514 <p><small><a name="note31" href="#note31">31)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2515 </small>
2517 <h4><a name="6.2.3" href="#6.2.3">6.2.3 Name spaces of identifiers</a></h4>
2518 <p><!--para 1 -->
2519 If more than one declaration of a particular identifier is visible at any point in a
2520 translation unit, the syntactic context disambiguates uses that refer to different entities.
2521 Thus, there are separate name spaces for various categories of identifiers, as follows:
2522 <ul>
2523 <li> label names (disambiguated by the syntax of the label declaration and use);
2524 <li> the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note32"><b>32)</b></a></sup>
2525 of the keywords struct, union, or enum);
2526 <li> the members of structures or unions; each structure or union has a separate name
2527 space for its members (disambiguated by the type of the expression used to access the
2528 member via the . or -&gt; operator);
2529 <li> all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
2530 enumeration constants).
2531 </ul>
2532 <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>),
2533 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
2534 (<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>).
2536 <!--page 56 -->
2538 <h6>footnotes</h6>
2539 <p><small><a name="note32" href="#note32">32)</a> There is only one name space for tags even though three are possible.
2540 </small>
2542 <h4><a name="6.2.4" href="#6.2.4">6.2.4 Storage durations of objects</a></h4>
2543 <p><!--para 1 -->
2544 An object has a storage duration that determines its lifetime. There are four storage
2545 durations: static, thread, automatic, and allocated. Allocated storage is described in
2546 <a href="#7.22.3">7.22.3</a>.
2547 <p><!--para 2 -->
2548 The lifetime of an object is the portion of program execution during which storage is
2549 guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note33"><b>33)</b></a></sup> and retains
2550 its last-stored value throughout its lifetime.<sup><a href="#note34"><b>34)</b></a></sup> If an object is referred to outside of its
2551 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
2552 the object it points to (or just past) reaches the end of its lifetime.
2553 <p><!--para 3 -->
2554 An object whose identifier is declared without the storage-class specifier
2555 _Thread_local, and either with external or internal linkage or with the storage-class
2556 specifier static, has static storage duration. Its lifetime is the entire execution of the
2557 program and its stored value is initialized only once, prior to program startup.
2558 <p><!--para 4 -->
2559 An object whose identifier is declared with the storage-class specifier _Thread_local
2560 has thread storage duration. Its lifetime is the entire execution of the thread for which it
2561 is created, and its stored value is initialized when the thread is started. There is a distinct
2562 object per thread, and use of the declared name in an expression refers to the object
2563 associated with the thread evaluating the expression. The result of attempting to
2564 indirectly access an object with thread storage duration from a thread other than the one
2565 with which the object is associated is implementation-defined.
2566 <p><!--para 5 -->
2567 An object whose identifier is declared with no linkage and without the storage-class
2568 specifier static has automatic storage duration, as do some compound literals. The
2569 result of attempting to indirectly access an object with automatic storage duration from a
2570 thread other than the one with which the object is associated is implementation-defined.
2571 <p><!--para 6 -->
2572 For such an object that does not have a variable length array type, its lifetime extends
2573 from entry into the block with which it is associated until execution of that block ends in
2574 any way. (Entering an enclosed block or calling a function suspends, but does not end,
2575 execution of the current block.) If the block is entered recursively, a new instance of the
2576 object is created each time. The initial value of the object is indeterminate. If an
2577 initialization is specified for the object, it is performed each time the declaration or
2578 compound literal is reached in the execution of the block; otherwise, the value becomes
2579 indeterminate each time the declaration is reached.
2583 <!--page 57 -->
2584 <p><!--para 7 -->
2585 For such an object that does have a variable length array type, its lifetime extends from
2586 the declaration of the object until execution of the program leaves the scope of the
2587 declaration.<sup><a href="#note35"><b>35)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
2588 each time. The initial value of the object is indeterminate.
2589 <p><!--para 8 -->
2590 A non-lvalue expression with structure or union type, where the structure or union
2591 contains a member with array type (including, recursively, members of all contained
2592 structures and unions) refers to an object with automatic storage duration and temporary
2593 lifetime.<sup><a href="#note36"><b>36)</b></a></sup> Its lifetime begins when the expression is evaluated and its initial value is the
2594 value of the expression. Its lifetime ends when the evaluation of the containing full
2595 expression or full declarator ends. Any attempt to modify an object with temporary
2596 lifetime results in undefined behavior.
2597 <p><b> Forward references</b>: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), compound literals (<a href="#6.5.2.5">6.5.2.5</a>), declarators
2598 (<a href="#6.7.6">6.7.6</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), initialization (<a href="#6.7.9">6.7.9</a>), statements (<a href="#6.8">6.8</a>).
2600 <h6>footnotes</h6>
2601 <p><small><a name="note33" href="#note33">33)</a> The term ''constant address'' means that two pointers to the object constructed at possibly different
2602 times will compare equal. The address may be different during two different executions of the same
2603 program.
2604 </small>
2605 <p><small><a name="note34" href="#note34">34)</a> In the case of a volatile object, the last store need not be explicit in the program.
2606 </small>
2607 <p><small><a name="note35" href="#note35">35)</a> Leaving the innermost block containing the declaration, or jumping to a point in that block or an
2608 embedded block prior to the declaration, leaves the scope of the declaration.
2609 </small>
2610 <p><small><a name="note36" href="#note36">36)</a> The address of such an object is taken implicitly when an array member is accessed.
2611 </small>
2613 <h4><a name="6.2.5" href="#6.2.5">6.2.5 Types</a></h4>
2614 <p><!--para 1 -->
2615 The meaning of a value stored in an object or returned by a function is determined by the
2616 type of the expression used to access it. (An identifier declared to be an object is the
2617 simplest such expression; the type is specified in the declaration of the identifier.) Types
2618 are partitioned into object types (types that describe objects) and function types (types
2619 that describe functions). At various points within a translation unit an object type may be
2620 incomplete (lacking sufficient information to determine the size of objects of that type) or
2621 complete (having sufficient information).<sup><a href="#note37"><b>37)</b></a></sup>
2622 <p><!--para 2 -->
2623 An object declared as type _Bool is large enough to store the values 0 and 1.
2624 <p><!--para 3 -->
2625 An object declared as type char is large enough to store any member of the basic
2626 execution character set. If a member of the basic execution character set is stored in a
2627 char object, its value is guaranteed to be nonnegative. If any other character is stored in
2628 a char object, the resulting value is implementation-defined but shall be within the range
2629 of values that can be represented in that type.
2630 <p><!--para 4 -->
2631 There are five standard signed integer types, designated as signed char, short
2632 int, int, long int, and long long int. (These and other types may be
2633 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
2634 implementation-defined extended signed integer types.<sup><a href="#note38"><b>38)</b></a></sup> The standard and extended
2635 signed integer types are collectively called signed integer types.<sup><a href="#note39"><b>39)</b></a></sup>
2637 <!--page 58 -->
2638 <p><!--para 5 -->
2639 An object declared as type signed char occupies the same amount of storage as a
2640 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
2641 architecture of the execution environment (large enough to contain any value in the range
2642 INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
2643 <p><!--para 6 -->
2644 For each of the signed integer types, there is a corresponding (but different) unsigned
2645 integer type (designated with the keyword unsigned) that uses the same amount of
2646 storage (including sign information) and has the same alignment requirements. The type
2647 _Bool and the unsigned integer types that correspond to the standard signed integer
2648 types are the standard unsigned integer types. The unsigned integer types that
2649 correspond to the extended signed integer types are the extended unsigned integer types.
2650 The standard and extended unsigned integer types are collectively called unsigned integer
2651 types.<sup><a href="#note40"><b>40)</b></a></sup>
2652 <p><!--para 7 -->
2653 The standard signed integer types and standard unsigned integer types are collectively
2654 called the standard integer types, the extended signed integer types and extended
2655 unsigned integer types are collectively called the extended integer types.
2656 <p><!--para 8 -->
2657 For any two integer types with the same signedness and different integer conversion rank
2658 (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
2659 subrange of the values of the other type.
2660 <p><!--para 9 -->
2661 The range of nonnegative values of a signed integer type is a subrange of the
2662 corresponding unsigned integer type, and the representation of the same value in each
2663 type is the same.<sup><a href="#note41"><b>41)</b></a></sup> A computation involving unsigned operands can never overflow,
2664 because a result that cannot be represented by the resulting unsigned integer type is
2665 reduced modulo the number that is one greater than the largest value that can be
2666 represented by the resulting type.
2667 <p><!--para 10 -->
2668 There are three real floating types, designated as float, double, and long
2669 double.<sup><a href="#note42"><b>42)</b></a></sup> The set of values of the type float is a subset of the set of values of the
2670 type double; the set of values of the type double is a subset of the set of values of the
2671 type long double.
2674 <!--page 59 -->
2675 <p><!--para 11 -->
2676 There are three complex types, designated as float _Complex, double
2677 _Complex, and long double _Complex.<sup><a href="#note43"><b>43)</b></a></sup> (Complex types are a conditional
2678 feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.) The real floating and
2679 complex types are collectively called the floating types.
2680 <p><!--para 12 -->
2681 For each floating type there is a corresponding real type, which is always a real floating
2682 type. For real floating types, it is the same type. For complex types, it is the type given
2683 by deleting the keyword _Complex from the type name.
2684 <p><!--para 13 -->
2685 Each complex type has the same representation and alignment requirements as an array
2686 type containing exactly two elements of the corresponding real type; the first element is
2687 equal to the real part, and the second element to the imaginary part, of the complex
2688 number.
2689 <p><!--para 14 -->
2690 The type char, the signed and unsigned integer types, and the floating types are
2691 collectively called the basic types. The basic types are complete object types. Even if the
2692 implementation defines two or more basic types to have the same representation, they are
2693 nevertheless different types.<sup><a href="#note44"><b>44)</b></a></sup>
2694 <p><!--para 15 -->
2695 The three types char, signed char, and unsigned char are collectively called
2696 the character types. The implementation shall define char to have the same range,
2697 representation, and behavior as either signed char or unsigned char.<sup><a href="#note45"><b>45)</b></a></sup>
2698 <p><!--para 16 -->
2699 An enumeration comprises a set of named integer constant values. Each distinct
2700 enumeration constitutes a different enumerated type.
2701 <p><!--para 17 -->
2702 The type char, the signed and unsigned integer types, and the enumerated types are
2703 collectively called integer types. The integer and real floating types are collectively called
2704 real types.
2705 <p><!--para 18 -->
2706 Integer and floating types are collectively called arithmetic types. Each arithmetic type
2707 belongs to one type domain: the real type domain comprises the real types, the complex
2708 type domain comprises the complex types.
2709 <p><!--para 19 -->
2710 The void type comprises an empty set of values; it is an incomplete object type that
2711 cannot be completed.
2715 <!--page 60 -->
2716 <p><!--para 20 -->
2717 Any number of derived types can be constructed from the object and function types, as
2718 follows:
2719 <ul>
2720 <li> An array type describes a contiguously allocated nonempty set of objects with a
2721 particular member object type, called the element type. The element type shall be
2722 complete whenever the array type is specified. Array types are characterized by their
2723 element type and by the number of elements in the array. An array type is said to be
2724 derived from its element type, and if its element type is T , the array type is sometimes
2725 called ''array of T ''. The construction of an array type from an element type is called
2726 ''array type derivation''.
2727 <li> A structure type describes a sequentially allocated nonempty set of member objects
2728 (and, in certain circumstances, an incomplete array), each of which has an optionally
2729 specified name and possibly distinct type.
2730 <li> A union type describes an overlapping nonempty set of member objects, each of
2731 which has an optionally specified name and possibly distinct type.
2732 <li> A function type describes a function with specified return type. A function type is
2733 characterized by its return type and the number and types of its parameters. A
2734 function type is said to be derived from its return type, and if its return type is T , the
2735 function type is sometimes called ''function returning T ''. The construction of a
2736 function type from a return type is called ''function type derivation''.
2737 <li> A pointer type may be derived from a function type or an object type, called the
2738 referenced type. A pointer type describes an object whose value provides a reference
2739 to an entity of the referenced type. A pointer type derived from the referenced type T
2740 is sometimes called ''pointer to T ''. The construction of a pointer type from a
2741 referenced type is called ''pointer type derivation''. A pointer type is a complete
2742 object type.
2743 <li> An atomic type describes the type designated by the construct _Atomic ( type-
2744 name ). (Atomic types are a conditional feature that implementations need not
2745 support; see <a href="#6.10.8.3">6.10.8.3</a>.)
2746 </ul>
2747 These methods of constructing derived types can be applied recursively.
2748 <p><!--para 21 -->
2749 Arithmetic types and pointer types are collectively called scalar types. Array and
2750 structure types are collectively called aggregate types.<sup><a href="#note46"><b>46)</b></a></sup>
2751 <p><!--para 22 -->
2752 An array type of unknown size is an incomplete type. It is completed, for an identifier of
2753 that type, by specifying the size in a later declaration (with internal or external linkage).
2754 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
2757 <!--page 61 -->
2758 type. It is completed, for all declarations of that type, by declaring the same structure or
2759 union tag with its defining content later in the same scope.
2760 <p><!--para 23 -->
2761 A type has known constant size if the type is not incomplete and is not a variable length
2762 array type.
2763 <p><!--para 24 -->
2764 Array, function, and pointer types are collectively called derived declarator types. A
2765 declarator type derivation from a type T is the construction of a derived declarator type
2766 from T by the application of an array-type, a function-type, or a pointer-type derivation to
2768 <p><!--para 25 -->
2769 A type is characterized by its type category, which is either the outermost derivation of a
2770 derived type (as noted above in the construction of derived types), or the type itself if the
2771 type consists of no derived types.
2772 <p><!--para 26 -->
2773 Any type so far mentioned is an unqualified type. Each unqualified type has several
2774 qualified versions of its type,<sup><a href="#note47"><b>47)</b></a></sup> corresponding to the combinations of one, two, or all
2775 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
2776 versions of a type are distinct types that belong to the same type category and have the
2777 same representation and alignment requirements.<sup><a href="#note48"><b>48)</b></a></sup> A derived type is not qualified by the
2778 qualifiers (if any) of the type from which it is derived.
2779 <p><!--para 27 -->
2780 Further, there is the _Atomic qualifier. The presence of the _Atomic qualifier
2781 designates an atomic type. The size, representation, and alignment of an atomic type
2782 need not be the same as those of the corresponding unqualified type. Therefore, this
2783 Standard explicitly uses the phrase ''atomic, qualified or unqualified type'' whenever the
2784 atomic version of a type is permitted along with the other qualified versions of a type.
2785 The phrase ''qualified or unqualified type'', without specific mention of atomic, does not
2786 include the atomic types.
2787 <p><!--para 28 -->
2788 A pointer to void shall have the same representation and alignment requirements as a
2789 pointer to a character type.<sup><a href="#note48"><b>48)</b></a></sup> Similarly, pointers to qualified or unqualified versions of
2790 compatible types shall have the same representation and alignment requirements. All
2791 pointers to structure types shall have the same representation and alignment requirements
2792 as each other. All pointers to union types shall have the same representation and
2793 alignment requirements as each other. Pointers to other types need not have the same
2794 representation or alignment requirements.
2795 <p><!--para 29 -->
2796 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
2797 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
2798 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
2801 <!--page 62 -->
2802 qualified float'' and is a pointer to a qualified type.
2804 <p><!--para 30 -->
2805 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
2806 function returning struct tag''. The array has length five and the function has a single parameter of type
2807 float. Its type category is array.
2809 <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>).
2811 <h6>footnotes</h6>
2812 <p><small><a name="note37" href="#note37">37)</a> A type may be incomplete or complete throughout an entire translation unit, or it may change states at
2813 different points within a translation unit.
2814 </small>
2815 <p><small><a name="note38" href="#note38">38)</a> Implementation-defined keywords shall have the form of an identifier reserved for any use as
2816 described in <a href="#7.1.3">7.1.3</a>.
2817 </small>
2818 <p><small><a name="note39" href="#note39">39)</a> Therefore, any statement in this Standard about signed integer types also applies to the extended
2819 signed integer types.
2820 </small>
2821 <p><small><a name="note40" href="#note40">40)</a> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
2822 unsigned integer types.
2823 </small>
2824 <p><small><a name="note41" href="#note41">41)</a> The same representation and alignment requirements are meant to imply interchangeability as
2825 arguments to functions, return values from functions, and members of unions.
2826 </small>
2827 <p><small><a name="note42" href="#note42">42)</a> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
2828 </small>
2829 <p><small><a name="note43" href="#note43">43)</a> A specification for imaginary types is in <a href="#G">annex G</a>.
2830 </small>
2831 <p><small><a name="note44" href="#note44">44)</a> An implementation may define new keywords that provide alternative ways to designate a basic (or
2832 any other) type; this does not violate the requirement that all basic types be different.
2833 Implementation-defined keywords shall have the form of an identifier reserved for any use as
2834 described in <a href="#7.1.3">7.1.3</a>.
2835 </small>
2836 <p><small><a name="note45" href="#note45">45)</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
2837 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
2838 other two and is not compatible with either.
2839 </small>
2840 <p><small><a name="note46" href="#note46">46)</a> Note that aggregate type does not include union type because an object with union type can only
2841 contain one member at a time.
2842 </small>
2843 <p><small><a name="note47" href="#note47">47)</a> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
2844 </small>
2845 <p><small><a name="note48" href="#note48">48)</a> The same representation and alignment requirements are meant to imply interchangeability as
2846 arguments to functions, return values from functions, and members of unions.
2847 </small>
2849 <h4><a name="6.2.6" href="#6.2.6">6.2.6 Representations of types</a></h4>
2851 <h5><a name="6.2.6.1" href="#6.2.6.1">6.2.6.1 General</a></h5>
2852 <p><!--para 1 -->
2853 The representations of all types are unspecified except as stated in this subclause.
2854 <p><!--para 2 -->
2855 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
2856 the number, order, and encoding of which are either explicitly specified or
2857 implementation-defined.
2858 <p><!--para 3 -->
2859 Values stored in unsigned bit-fields and objects of type unsigned char shall be
2860 represented using a pure binary notation.<sup><a href="#note49"><b>49)</b></a></sup>
2861 <p><!--para 4 -->
2862 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
2863 bits, where n is the size of an object of that type, in bytes. The value may be copied into
2864 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
2865 called the object representation of the value. Values stored in bit-fields consist of m bits,
2866 where m is the size specified for the bit-field. The object representation is the set of m
2867 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
2868 than NaNs) with the same object representation compare equal, but values that compare
2869 equal may have different object representations.
2870 <p><!--para 5 -->
2871 Certain object representations need not represent a value of the object type. If the stored
2872 value of an object has such a representation and is read by an lvalue expression that does
2873 not have character type, the behavior is undefined. If such a representation is produced
2874 by a side effect that modifies all or any part of the object by an lvalue expression that
2875 does not have character type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup> Such a representation is called
2876 a trap representation.
2877 <p><!--para 6 -->
2878 When a value is stored in an object of structure or union type, including in a member
2879 object, the bytes of the object representation that correspond to any padding bytes take
2880 unspecified values.<sup><a href="#note51"><b>51)</b></a></sup> The value of a structure or union object is never a trap
2883 <!--page 63 -->
2884 representation, even though the value of a member of the structure or union object may be
2885 a trap representation.
2886 <p><!--para 7 -->
2887 When a value is stored in a member of an object of union type, the bytes of the object
2888 representation that do not correspond to that member but do correspond to other members
2889 take unspecified values.
2890 <p><!--para 8 -->
2891 Where an operator is applied to a value that has more than one object representation,
2892 which object representation is used shall not affect the value of the result.<sup><a href="#note52"><b>52)</b></a></sup> Where a
2893 value is stored in an object using a type that has more than one object representation for
2894 that value, it is unspecified which representation is used, but a trap representation shall
2895 not be generated.
2896 <p><!--para 9 -->
2897 Loads and stores of objects with atomic types are done with
2898 memory_order_seq_cst semantics.
2899 <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
2900 designators (<a href="#6.3.2.1">6.3.2.1</a>), order and consistency (<a href="#7.17.3">7.17.3</a>).
2902 <h6>footnotes</h6>
2903 <p><small><a name="note49" href="#note49">49)</a> A positional representation for integers that uses the binary digits 0 and 1, in which the values
2904 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
2905 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
2906 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
2907 type unsigned char range from 0 to 2
2909 <pre>
2910 CHAR_BIT
2911 - 1.</pre>
2912 </small>
2913 <p><small><a name="note50" href="#note50">50)</a> Thus, an automatic variable can be initialized to a trap representation without causing undefined
2914 behavior, but the value of the variable cannot be used until a proper value is stored in it.
2915 </small>
2916 <p><small><a name="note51" href="#note51">51)</a> Thus, for example, structure assignment need not copy any padding bits.
2917 </small>
2918 <p><small><a name="note52" href="#note52">52)</a> It is possible for objects x and y with the same effective type T to have the same value when they are
2919 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
2920 defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
2921 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
2922 on values of type T may distinguish between them.
2923 </small>
2925 <h5><a name="6.2.6.2" href="#6.2.6.2">6.2.6.2 Integer types</a></h5>
2926 <p><!--para 1 -->
2927 For unsigned integer types other than unsigned char, the bits of the object
2928 representation shall be divided into two groups: value bits and padding bits (there need
2929 not be any of the latter). If there are N value bits, each bit shall represent a different
2930 power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
2931 representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
2932 known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note53"><b>53)</b></a></sup>
2933 <p><!--para 2 -->
2934 For signed integer types, the bits of the object representation shall be divided into three
2935 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
2936 signed char shall not have any padding bits. There shall be exactly one sign bit.
2937 Each bit that is a value bit shall have the same value as the same bit in the object
2938 representation of the corresponding unsigned type (if there are M value bits in the signed
2939 type and N in the unsigned type, then M &lt;= N ). If the sign bit is zero, it shall not affect
2941 <!--page 64 -->
2942 the resulting value. If the sign bit is one, the value shall be modified in one of the
2943 following ways:
2944 <ul>
2945 <li> the corresponding value with sign bit 0 is negated (sign and magnitude);
2946 <li> the sign bit has the value -(2 M ) (two's complement);
2947 <li> the sign bit has the value -(2 M - 1) (ones' complement).
2948 </ul>
2949 Which of these applies is implementation-defined, as is whether the value with sign bit 1
2950 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
2951 complement), is a trap representation or a normal value. In the case of sign and
2952 magnitude and ones' complement, if this representation is a normal value it is called a
2953 negative zero.
2954 <p><!--para 3 -->
2955 If the implementation supports negative zeros, they shall be generated only by:
2956 <ul>
2957 <li> the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with operands that produce such a value;
2958 <li> the +, -, *, /, and % operators where one operand is a negative zero and the result is
2959 zero;
2960 <li> compound assignment operators based on the above cases.
2961 </ul>
2962 It is unspecified whether these cases actually generate a negative zero or a normal zero,
2963 and whether a negative zero becomes a normal zero when stored in an object.
2964 <p><!--para 4 -->
2965 If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
2966 and &gt;&gt; operators with operands that would produce such a value is undefined.
2967 <p><!--para 5 -->
2968 The values of any padding bits are unspecified.<sup><a href="#note54"><b>54)</b></a></sup> A valid (non-trap) object representation
2969 of a signed integer type where the sign bit is zero is a valid object representation of the
2970 corresponding unsigned type, and shall represent the same value. For any integer type,
2971 the object representation where all the bits are zero shall be a representation of the value
2972 zero in that type.
2973 <p><!--para 6 -->
2974 The precision of an integer type is the number of bits it uses to represent values,
2975 excluding any sign and padding bits. The width of an integer type is the same but
2976 including any sign bit; thus for unsigned integer types the two values are the same, while
2977 for signed integer types the width is one greater than the precision.
2982 <!--page 65 -->
2984 <h6>footnotes</h6>
2985 <p><small><a name="note53" href="#note53">53)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2986 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2987 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
2988 with unsigned types. All other combinations of padding bits are alternative object representations of
2989 the value specified by the value bits.
2990 </small>
2991 <p><small><a name="note54" href="#note54">54)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2992 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2993 representation other than as part of an exceptional condition such as an overflow. All other
2994 combinations of padding bits are alternative object representations of the value specified by the value
2995 bits.
2996 </small>
2998 <h4><a name="6.2.7" href="#6.2.7">6.2.7 Compatible type and composite type</a></h4>
2999 <p><!--para 1 -->
3000 Two types have compatible type if their types are the same. Additional rules for
3001 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
3002 in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.6">6.7.6</a> for declarators.<sup><a href="#note55"><b>55)</b></a></sup> Moreover, two structure,
3003 union, or enumerated types declared in separate translation units are compatible if their
3004 tags and members satisfy the following requirements: If one is declared with a tag, the
3005 other shall be declared with the same tag. If both are completed anywhere within their
3006 respective translation units, then the following additional requirements apply: there shall
3007 be a one-to-one correspondence between their members such that each pair of
3008 corresponding members are declared with compatible types; if one member of the pair is
3009 declared with an alignment specifier, the other is declared with an equivalent alignment
3010 specifier; and if one member of the pair is declared with a name, the other is declared
3011 with the same name. For two structures, corresponding members shall be declared in the
3012 same order. For two structures or unions, corresponding bit-fields shall have the same
3013 widths. For two enumerations, corresponding members shall have the same values.
3014 <p><!--para 2 -->
3015 All declarations that refer to the same object or function shall have compatible type;
3016 otherwise, the behavior is undefined.
3017 <p><!--para 3 -->
3018 A composite type can be constructed from two types that are compatible; it is a type that
3019 is compatible with both of the two types and satisfies the following conditions:
3020 <ul>
3021 <li> If both types are array types, the following rules are applied:
3022 <ul>
3023 <li> If one type is an array of known constant size, the composite type is an array of
3024 that size.
3025 <li> Otherwise, if one type is a variable length array whose size is specified by an
3026 expression that is not evaluated, the behavior is undefined.
3027 <li> Otherwise, if one type is a variable length array whose size is specified, the
3028 composite type is a variable length array of that size.
3029 <li> Otherwise, if one type is a variable length array of unspecified size, the composite
3030 type is a variable length array of unspecified size.
3031 <li> Otherwise, both types are arrays of unknown size and the composite type is an
3032 array of unknown size.
3033 </ul>
3034 The element type of the composite type is the composite type of the two element
3035 types.
3036 <li> If only one type is a function type with a parameter type list (a function prototype),
3037 the composite type is a function prototype with the parameter type list.
3040 <!--page 66 -->
3041 <li> If both types are function types with parameter type lists, the type of each parameter
3042 in the composite parameter type list is the composite type of the corresponding
3043 parameters.
3044 </ul>
3045 These rules apply recursively to the types from which the two types are derived.
3046 <p><!--para 4 -->
3047 For an identifier with internal or external linkage declared in a scope in which a prior
3048 declaration of that identifier is visible,<sup><a href="#note56"><b>56)</b></a></sup> if the prior declaration specifies internal or
3049 external linkage, the type of the identifier at the later declaration becomes the composite
3050 type.
3051 <p><b> Forward references</b>: array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
3052 <p><!--para 5 -->
3053 EXAMPLE Given the following two file scope declarations:
3054 <pre>
3055 int f(int (*)(), double (*)[3]);
3056 int f(int (*)(char *), double (*)[]);</pre>
3057 The resulting composite type for the function is:
3058 <pre>
3059 int f(int (*)(char *), double (*)[3]);</pre>
3062 <h6>footnotes</h6>
3063 <p><small><a name="note55" href="#note55">55)</a> Two types need not be identical to be compatible.
3064 </small>
3065 <p><small><a name="note56" href="#note56">56)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
3066 </small>
3068 <h4><a name="6.2.8" href="#6.2.8">6.2.8 Alignment of objects</a></h4>
3069 <p><!--para 1 -->
3070 Complete object types have alignment requirements which place restrictions on the
3071 addresses at which objects of that type may be allocated. An alignment is an
3072 implementation-defined integer value representing the number of bytes between
3073 successive addresses at which a given object can be allocated. An object type imposes an
3074 alignment requirement on every object of that type: stricter alignment can be requested
3075 using the _Alignas keyword.
3076 <p><!--para 2 -->
3077 A fundamental alignment is represented by an alignment less than or equal to the greatest
3078 alignment supported by the implementation in all contexts, which is equal to
3079 alignof(max_align_t).
3080 <p><!--para 3 -->
3081 An extended alignment is represented by an alignment greater than
3082 alignof(max_align_t). It is implementation-defined whether any extended
3083 alignments are supported and the contexts in which they are supported. A type having an
3084 extended alignment requirement is an over-aligned type.<sup><a href="#note57"><b>57)</b></a></sup>
3085 <p><!--para 4 -->
3086 Alignments are represented as values of the type size_t. Valid alignments include only
3087 those values returned by an alignof expression for fundamental types, plus an
3088 additional implementation-defined set of values, which may be empty. Every valid
3089 alignment value shall be a nonnegative integral power of two.
3092 <!--page 67 -->
3093 <p><!--para 5 -->
3094 Alignments have an order from weaker to stronger or stricter alignments. Stricter
3095 alignments have larger alignment values. An address that satisfies an alignment
3096 requirement also satisfies any weaker valid alignment requirement.
3097 <p><!--para 6 -->
3098 The alignment requirement of a complete type can be queried using an alignof
3099 expression. The types char, signed char, and unsigned char shall have the
3100 weakest alignment requirement.
3101 <p><!--para 7 -->
3102 Comparing alignments is meaningful and provides the obvious results:
3103 <ul>
3104 <li> Two alignments are equal when their numeric values are equal.
3105 <li> Two alignments are different when their numeric values are not equal.
3106 <li> When an alignment is larger than another it represents a stricter alignment.
3107 <!--page 68 -->
3108 </ul>
3110 <h6>footnotes</h6>
3111 <p><small><a name="note57" href="#note57">57)</a> Every over-aligned type is, or contains, a structure or union type with a member to which an extended
3112 alignment has been applied.
3113 </small>
3115 <h3><a name="6.3" href="#6.3">6.3 Conversions</a></h3>
3116 <p><!--para 1 -->
3117 Several operators convert operand values from one type to another automatically. This
3118 subclause specifies the result required from such an implicit conversion, as well as those
3119 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
3120 the conversions performed by most ordinary operators; it is supplemented as required by
3121 the discussion of each operator in <a href="#6.5">6.5</a>.
3122 <p><!--para 2 -->
3123 Conversion of an operand value to a compatible type causes no change to the value or the
3124 representation.
3125 <p><b> Forward references</b>: cast operators (<a href="#6.5.4">6.5.4</a>).
3127 <h4><a name="6.3.1" href="#6.3.1">6.3.1 Arithmetic operands</a></h4>
3129 <h5><a name="6.3.1.1" href="#6.3.1.1">6.3.1.1 Boolean, characters, and integers</a></h5>
3130 <p><!--para 1 -->
3131 Every integer type has an integer conversion rank defined as follows:
3132 <ul>
3133 <li> No two signed integer types shall have the same rank, even if they have the same
3134 representation.
3135 <li> The rank of a signed integer type shall be greater than the rank of any signed integer
3136 type with less precision.
3137 <li> The rank of long long int shall be greater than the rank of long int, which
3138 shall be greater than the rank of int, which shall be greater than the rank of short
3139 int, which shall be greater than the rank of signed char.
3140 <li> The rank of any unsigned integer type shall equal the rank of the corresponding
3141 signed integer type, if any.
3142 <li> The rank of any standard integer type shall be greater than the rank of any extended
3143 integer type with the same width.
3144 <li> The rank of char shall equal the rank of signed char and unsigned char.
3145 <li> The rank of _Bool shall be less than the rank of all other standard integer types.
3146 <li> The rank of any enumerated type shall equal the rank of the compatible integer type
3147 (see <a href="#6.7.2.2">6.7.2.2</a>).
3148 <li> The rank of any extended signed integer type relative to another extended signed
3149 integer type with the same precision is implementation-defined, but still subject to the
3150 other rules for determining the integer conversion rank.
3151 <li> For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
3152 greater rank than T3, then T1 has greater rank than T3.
3153 </ul>
3154 <p><!--para 2 -->
3155 The following may be used in an expression wherever an int or unsigned int may
3156 be used:
3157 <!--page 69 -->
3158 <ul>
3159 <li> An object or expression with an integer type (other than int or unsigned int)
3160 whose integer conversion rank is less than or equal to the rank of int and
3161 unsigned int.
3162 <li> A bit-field of type _Bool, int, signed int, or unsigned int.
3163 </ul>
3164 If an int can represent all values of the original type (as restricted by the width, for a
3165 bit-field), the value is converted to an int; otherwise, it is converted to an unsigned
3166 int. These are called the integer promotions.<sup><a href="#note58"><b>58)</b></a></sup> All other types are unchanged by the
3167 integer promotions.
3168 <p><!--para 3 -->
3169 The integer promotions preserve value including sign. As discussed earlier, whether a
3170 ''plain'' char is treated as signed is implementation-defined.
3171 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
3172 (<a href="#6.7.2.1">6.7.2.1</a>).
3174 <h6>footnotes</h6>
3175 <p><small><a name="note58" href="#note58">58)</a> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
3176 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
3177 shift operators, as specified by their respective subclauses.
3178 </small>
3180 <h5><a name="6.3.1.2" href="#6.3.1.2">6.3.1.2 Boolean type</a></h5>
3181 <p><!--para 1 -->
3182 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
3183 to 0; otherwise, the result is 1.<sup><a href="#note59"><b>59)</b></a></sup>
3185 <h6>footnotes</h6>
3186 <p><small><a name="note59" href="#note59">59)</a> NaNs do not compare equal to 0 and thus convert to 1.
3187 </small>
3189 <h5><a name="6.3.1.3" href="#6.3.1.3">6.3.1.3 Signed and unsigned integers</a></h5>
3190 <p><!--para 1 -->
3191 When a value with integer type is converted to another integer type other than _Bool, if
3192 the value can be represented by the new type, it is unchanged.
3193 <p><!--para 2 -->
3194 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
3195 subtracting one more than the maximum value that can be represented in the new type
3196 until the value is in the range of the new type.<sup><a href="#note60"><b>60)</b></a></sup>
3197 <p><!--para 3 -->
3198 Otherwise, the new type is signed and the value cannot be represented in it; either the
3199 result is implementation-defined or an implementation-defined signal is raised.
3201 <h6>footnotes</h6>
3202 <p><small><a name="note60" href="#note60">60)</a> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
3203 </small>
3205 <h5><a name="6.3.1.4" href="#6.3.1.4">6.3.1.4 Real floating and integer</a></h5>
3206 <p><!--para 1 -->
3207 When a finite value of real floating type is converted to an integer type other than _Bool,
3208 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
3209 the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note61"><b>61)</b></a></sup>
3212 <!--page 70 -->
3213 <p><!--para 2 -->
3214 When a value of integer type is converted to a real floating type, if the value being
3215 converted can be represented exactly in the new type, it is unchanged. If the value being
3216 converted is in the range of values that can be represented but cannot be represented
3217 exactly, the result is either the nearest higher or nearest lower representable value, chosen
3218 in an implementation-defined manner. If the value being converted is outside the range of
3219 values that can be represented, the behavior is undefined. Results of some implicit
3220 conversions (<a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>) may be represented in greater precision and range than that
3221 required by the new type.
3223 <h6>footnotes</h6>
3224 <p><small><a name="note61" href="#note61">61)</a> The remaindering operation performed when a value of integer type is converted to unsigned type
3225 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
3226 range of portable real floating values is (-1, Utype_MAX+1).
3227 </small>
3229 <h5><a name="6.3.1.5" href="#6.3.1.5">6.3.1.5 Real floating types</a></h5>
3230 <p><!--para 1 -->
3231 When a value of real floating type is converted to a real floating type, if the value being
3232 converted can be represented exactly in the new type, it is unchanged. If the value being
3233 converted is in the range of values that can be represented but cannot be represented
3234 exactly, the result is either the nearest higher or nearest lower representable value, chosen
3235 in an implementation-defined manner. If the value being converted is outside the range of
3236 values that can be represented, the behavior is undefined. Results of some implicit
3237 conversions (<a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>) may be represented in greater precision and range than that
3238 required by the new type.
3240 <h5><a name="6.3.1.6" href="#6.3.1.6">6.3.1.6 Complex types</a></h5>
3241 <p><!--para 1 -->
3242 When a value of complex type is converted to another complex type, both the real and
3243 imaginary parts follow the conversion rules for the corresponding real types.
3245 <h5><a name="6.3.1.7" href="#6.3.1.7">6.3.1.7 Real and complex</a></h5>
3246 <p><!--para 1 -->
3247 When a value of real type is converted to a complex type, the real part of the complex
3248 result value is determined by the rules of conversion to the corresponding real type and
3249 the imaginary part of the complex result value is a positive zero or an unsigned zero.
3250 <p><!--para 2 -->
3251 When a value of complex type is converted to a real type, the imaginary part of the
3252 complex value is discarded and the value of the real part is converted according to the
3253 conversion rules for the corresponding real type.
3255 <h5><a name="6.3.1.8" href="#6.3.1.8">6.3.1.8 Usual arithmetic conversions</a></h5>
3256 <p><!--para 1 -->
3257 Many operators that expect operands of arithmetic type cause conversions and yield result
3258 types in a similar way. The purpose is to determine a common real type for the operands
3259 and result. For the specified operands, each operand is converted, without change of type
3260 domain, to a type whose corresponding real type is the common real type. Unless
3261 explicitly stated otherwise, the common real type is also the corresponding real type of
3262 the result, whose type domain is the type domain of the operands if they are the same,
3263 and complex otherwise. This pattern is called the usual arithmetic conversions:
3264 <!--page 71 -->
3265 <p><!--para 2 -->
3266 <pre>
3267 First, if the corresponding real type of either operand is long double, the other
3268 operand is converted, without change of type domain, to a type whose
3269 corresponding real type is long double.
3270 Otherwise, if the corresponding real type of either operand is double, the other
3271 operand is converted, without change of type domain, to a type whose
3272 corresponding real type is double.
3273 Otherwise, if the corresponding real type of either operand is float, the other
3274 operand is converted, without change of type domain, to a type whose
3275 corresponding real type is float.<sup><a href="#note62"><b>62)</b></a></sup>
3276 Otherwise, the integer promotions are performed on both operands. Then the
3277 following rules are applied to the promoted operands:
3278 If both operands have the same type, then no further conversion is needed.
3279 Otherwise, if both operands have signed integer types or both have unsigned
3280 integer types, the operand with the type of lesser integer conversion rank is
3281 converted to the type of the operand with greater rank.
3282 Otherwise, if the operand that has unsigned integer type has rank greater or
3283 equal to the rank of the type of the other operand, then the operand with
3284 signed integer type is converted to the type of the operand with unsigned
3285 integer type.
3286 Otherwise, if the type of the operand with signed integer type can represent
3287 all of the values of the type of the operand with unsigned integer type, then
3288 the operand with unsigned integer type is converted to the type of the
3289 operand with signed integer type.
3290 Otherwise, both operands are converted to the unsigned integer type
3291 corresponding to the type of the operand with signed integer type.</pre>
3292 The values of floating operands and of the results of floating expressions may be
3293 represented in greater precision and range than that required by the type; the types are not
3294 changed thereby.<sup><a href="#note63"><b>63)</b></a></sup>
3299 <!--page 72 -->
3301 <h6>footnotes</h6>
3302 <p><small><a name="note62" href="#note62">62)</a> For example, addition of a double _Complex and a float entails just the conversion of the
3303 float operand to double (and yields a double _Complex result).
3304 </small>
3305 <p><small><a name="note63" href="#note63">63)</a> The cast and assignment operators are still required to remove extra range and precision.
3306 </small>
3308 <h4><a name="6.3.2" href="#6.3.2">6.3.2 Other operands</a></h4>
3310 <h5><a name="6.3.2.1" href="#6.3.2.1">6.3.2.1 Lvalues, arrays, and function designators</a></h5>
3311 <p><!--para 1 -->
3312 An lvalue is an expression (with an object type other than void) that potentially
3313 designates an object;<sup><a href="#note64"><b>64)</b></a></sup> if an lvalue does not designate an object when it is evaluated, the
3314 behavior is undefined. When an object is said to have a particular type, the type is
3315 specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that
3316 does not have array type, does not have an incomplete type, does not have a const-
3317 qualified type, and if it is a structure or union, does not have any member (including,
3318 recursively, any member or element of all contained aggregates or unions) with a const-
3319 qualified type.
3320 <p><!--para 2 -->
3321 Except when it is the operand of the sizeof operator, the unary &amp; operator, the ++
3322 operator, the -- operator, or the left operand of the . operator or an assignment operator,
3323 an lvalue that does not have array type is converted to the value stored in the designated
3324 object (and is no longer an lvalue); this is called lvalue conversion. If the lvalue has
3325 qualified type, the value has the unqualified version of the type of the lvalue; additionally,
3326 if the lvalue has atomic type, the value has the non-atomic version of the type of the
3327 lvalue; otherwise, the value has the type of the lvalue. If the lvalue has an incomplete
3328 type and does not have array type, the behavior is undefined. If the lvalue designates an
3329 object of automatic storage duration that could have been declared with the register
3330 storage class (never had its address taken), and that object is uninitialized (not declared
3331 with an initializer and no assignment to it has been performed prior to use), the behavior
3332 is undefined.
3333 <p><!--para 3 -->
3334 Except when it is the operand of the sizeof operator or the unary &amp; operator, or is a
3335 string literal used to initialize an array, an expression that has type ''array of type'' is
3336 converted to an expression with type ''pointer to type'' that points to the initial element of
3337 the array object and is not an lvalue. If the array object has register storage class, the
3338 behavior is undefined.
3339 <p><!--para 4 -->
3340 A function designator is an expression that has function type. Except when it is the
3341 operand of the sizeof operator<sup><a href="#note65"><b>65)</b></a></sup> or the unary &amp; operator, a function designator with
3342 type ''function returning type'' is converted to an expression that has type ''pointer to
3345 <!--page 73 -->
3346 function returning type''.
3347 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
3348 (<a href="#6.5.16">6.5.16</a>), common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), initialization (<a href="#6.7.9">6.7.9</a>), postfix
3349 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
3350 (<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>).
3352 <h6>footnotes</h6>
3353 <p><small><a name="note64" href="#note64">64)</a> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
3354 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
3355 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
3356 as the ''value of an expression''.
3357 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
3358 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
3359 </small>
3360 <p><small><a name="note65" href="#note65">65)</a> Because this conversion does not occur, the operand of the sizeof operator remains a function
3361 designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
3362 </small>
3364 <h5><a name="6.3.2.2" href="#6.3.2.2">6.3.2.2 void</a></h5>
3365 <p><!--para 1 -->
3366 The (nonexistent) value of a void expression (an expression that has type void) shall not
3367 be used in any way, and implicit or explicit conversions (except to void) shall not be
3368 applied to such an expression. If an expression of any other type is evaluated as a void
3369 expression, its value or designator is discarded. (A void expression is evaluated for its
3370 side effects.)
3372 <h5><a name="6.3.2.3" href="#6.3.2.3">6.3.2.3 Pointers</a></h5>
3373 <p><!--para 1 -->
3374 A pointer to void may be converted to or from a pointer to any object type. A pointer to
3375 any object type may be converted to a pointer to void and back again; the result shall
3376 compare equal to the original pointer.
3377 <p><!--para 2 -->
3378 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
3379 the q-qualified version of the type; the values stored in the original and converted pointers
3380 shall compare equal.
3381 <p><!--para 3 -->
3382 An integer constant expression with the value 0, or such an expression cast to type
3383 void *, is called a null pointer constant.<sup><a href="#note66"><b>66)</b></a></sup> If a null pointer constant is converted to a
3384 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
3385 to a pointer to any object or function.
3386 <p><!--para 4 -->
3387 Conversion of a null pointer to another pointer type yields a null pointer of that type.
3388 Any two null pointers shall compare equal.
3389 <p><!--para 5 -->
3390 An integer may be converted to any pointer type. Except as previously specified, the
3391 result is implementation-defined, might not be correctly aligned, might not point to an
3392 entity of the referenced type, and might be a trap representation.<sup><a href="#note67"><b>67)</b></a></sup>
3393 <p><!--para 6 -->
3394 Any pointer type may be converted to an integer type. Except as previously specified, the
3395 result is implementation-defined. If the result cannot be represented in the integer type,
3396 the behavior is undefined. The result need not be in the range of values of any integer
3397 type.
3402 <!--page 74 -->
3403 <p><!--para 7 -->
3404 A pointer to an object type may be converted to a pointer to a different object type. If the
3405 resulting pointer is not correctly aligned<sup><a href="#note68"><b>68)</b></a></sup> for the referenced type, the behavior is
3406 undefined. Otherwise, when converted back again, the result shall compare equal to the
3407 original pointer. When a pointer to an object is converted to a pointer to a character type,
3408 the result points to the lowest addressed byte of the object. Successive increments of the
3409 result, up to the size of the object, yield pointers to the remaining bytes of the object.
3410 <p><!--para 8 -->
3411 A pointer to a function of one type may be converted to a pointer to a function of another
3412 type and back again; the result shall compare equal to the original pointer. If a converted
3413 pointer is used to call a function whose type is not compatible with the referenced type,
3414 the behavior is undefined.
3415 <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
3416 capable of holding object pointers (<a href="#7.20.1.4">7.20.1.4</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>).
3421 <!--page 75 -->
3423 <h6>footnotes</h6>
3424 <p><small><a name="note66" href="#note66">66)</a> The macro NULL is defined in <a href="#7.19">&lt;stddef.h&gt;</a> (and other headers) as a null pointer constant; see <a href="#7.19">7.19</a>.
3425 </small>
3426 <p><small><a name="note67" href="#note67">67)</a> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
3427 be consistent with the addressing structure of the execution environment.
3428 </small>
3429 <p><small><a name="note68" href="#note68">68)</a> In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
3430 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
3431 correctly aligned for a pointer to type C.
3432 </small>
3434 <h3><a name="6.4" href="#6.4">6.4 Lexical elements</a></h3>
3435 <h6>Syntax</h6>
3436 <p><!--para 1 -->
3437 <pre>
3438 token:
3439 keyword
3440 identifier
3441 constant
3442 string-literal
3443 punctuator
3444 preprocessing-token:
3445 header-name
3446 identifier
3447 pp-number
3448 character-constant
3449 string-literal
3450 punctuator
3451 each non-white-space character that cannot be one of the above</pre>
3452 <h6>Constraints</h6>
3453 <p><!--para 2 -->
3454 Each preprocessing token that is converted to a token shall have the lexical form of a
3455 keyword, an identifier, a constant, a string literal, or a punctuator.
3456 <h6>Semantics</h6>
3457 <p><!--para 3 -->
3458 A token is the minimal lexical element of the language in translation phases 7 and 8. The
3459 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
3460 A preprocessing token is the minimal lexical element of the language in translation
3461 phases 3 through 6. The categories of preprocessing tokens are: header names,
3462 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
3463 single non-white-space characters that do not lexically match the other preprocessing
3464 token categories.<sup><a href="#note69"><b>69)</b></a></sup> If a ' or a " character matches the last category, the behavior is
3465 undefined. Preprocessing tokens can be separated by white space; this consists of
3466 comments (described later), or white-space characters (space, horizontal tab, new-line,
3467 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
3468 during translation phase 4, white space (or the absence thereof) serves as more than
3469 preprocessing token separation. White space may appear within a preprocessing token
3470 only as part of a header name or between the quotation characters in a character constant
3471 or string literal.
3475 <!--page 76 -->
3476 <p><!--para 4 -->
3477 If the input stream has been parsed into preprocessing tokens up to a given character, the
3478 next preprocessing token is the longest sequence of characters that could constitute a
3479 preprocessing token. There is one exception to this rule: header name preprocessing
3480 tokens are recognized only within #include preprocessing directives and in
3481 implementation-defined locations within #pragma directives. In such contexts, a
3482 sequence of characters that could be either a header name or a string literal is recognized
3483 as the former.
3484 <p><!--para 5 -->
3485 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
3486 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
3487 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
3488 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
3489 not E is a macro name.
3491 <p><!--para 6 -->
3492 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
3493 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
3495 <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>),
3496 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
3497 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
3498 (<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
3499 (<a href="#6.4.5">6.4.5</a>).
3501 <h6>footnotes</h6>
3502 <p><small><a name="note69" href="#note69">69)</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
3503 occur in source files.
3504 </small>
3506 <h4><a name="6.4.1" href="#6.4.1">6.4.1 Keywords</a></h4>
3507 <h6>Syntax</h6>
3508 <p><!--para 1 -->
3509 <pre>
3510 keyword: one of
3511 alignof goto union
3512 auto if unsigned
3513 break inline void
3514 case int volatile
3515 char long while
3516 const register _Alignas
3517 continue restrict _Atomic
3518 default return _Bool
3519 do short _Complex
3520 double signed _Generic
3521 else sizeof _Imaginary
3522 enum static _Noreturn
3523 extern struct _Static_assert
3524 float switch _Thread_local
3525 for typedef</pre>
3526 <h6>Semantics</h6>
3527 <p><!--para 2 -->
3528 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
3529 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
3530 <!--page 77 -->
3531 specifying imaginary types.<sup><a href="#note70"><b>70)</b></a></sup>
3533 <h6>footnotes</h6>
3534 <p><small><a name="note70" href="#note70">70)</a> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
3535 </small>
3537 <h4><a name="6.4.2" href="#6.4.2">6.4.2 Identifiers</a></h4>
3539 <h5><a name="6.4.2.1" href="#6.4.2.1">6.4.2.1 General</a></h5>
3540 <h6>Syntax</h6>
3541 <p><!--para 1 -->
3542 <pre>
3543 identifier:
3544 identifier-nondigit
3545 identifier identifier-nondigit
3546 identifier digit
3547 identifier-nondigit:
3548 nondigit
3549 universal-character-name
3550 other implementation-defined characters
3551 nondigit: one of
3552 _ a b c d e f g h i j k l m
3553 n o p q r s t u v w x y z
3554 A B C D E F G H I J K L M
3555 N O P Q R S T U V W X Y Z
3556 digit: one of
3557 0 1 2 3 4 5 6 7 8 9</pre>
3558 <h6>Semantics</h6>
3559 <p><!--para 2 -->
3560 An identifier is a sequence of nondigit characters (including the underscore _, the
3561 lowercase and uppercase Latin letters, and other characters) and digits, which designates
3562 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
3563 There is no specific limit on the maximum length of an identifier.
3564 <p><!--para 3 -->
3565 Each universal character name in an identifier shall designate a character whose encoding
3566 in ISO/IEC 10646 falls into one of the ranges specified in D.1.<sup><a href="#note71"><b>71)</b></a></sup> The initial character
3567 shall not be a universal character name designating a character whose encoding falls into
3568 one of the ranges specified in <a href="#D.2">D.2</a>. An implementation may allow multibyte characters
3569 that are not part of the basic source character set to appear in identifiers; which characters
3570 and their correspondence to universal character names is implementation-defined.
3574 <!--page 78 -->
3575 <p><!--para 4 -->
3576 When preprocessing tokens are converted to tokens during translation phase 7, if a
3577 preprocessing token could be converted to either a keyword or an identifier, it is converted
3578 to a keyword.
3579 <h6>Implementation limits</h6>
3580 <p><!--para 5 -->
3581 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
3582 characters in an identifier; the limit for an external name (an identifier that has external
3583 linkage) may be more restrictive than that for an internal name (a macro name or an
3584 identifier that does not have external linkage). The number of significant characters in an
3585 identifier is implementation-defined.
3586 <p><!--para 6 -->
3587 Any identifiers that differ in a significant character are different identifiers. If two
3588 identifiers differ only in nonsignificant characters, the behavior is undefined.
3589 <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>).
3591 <h6>footnotes</h6>
3592 <p><small><a name="note71" href="#note71">71)</a> On systems in which linkers cannot accept extended characters, an encoding of the universal character
3593 name may be used in forming valid external identifiers. For example, some otherwise unused
3594 character or sequence of characters may be used to encode the \u in a universal character name.
3595 Extended characters may produce a long external identifier.
3596 </small>
3598 <h5><a name="6.4.2.2" href="#6.4.2.2">6.4.2.2 Predefined identifiers</a></h5>
3599 <h6>Semantics</h6>
3600 <p><!--para 1 -->
3601 The identifier __func__ shall be implicitly declared by the translator as if,
3602 immediately following the opening brace of each function definition, the declaration
3603 <pre>
3604 static const char __func__[] = "function-name";</pre>
3605 appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note72"><b>72)</b></a></sup>
3606 <p><!--para 2 -->
3607 This name is encoded as if the implicit declaration had been written in the source
3608 character set and then translated into the execution character set as indicated in translation
3609 phase 5.
3610 <p><!--para 3 -->
3611 EXAMPLE Consider the code fragment:
3612 <pre>
3613 #include <a href="#7.21">&lt;stdio.h&gt;</a>
3614 void myfunc(void)
3616 printf("%s\n", __func__);
3617 /* ... */
3618 }</pre>
3619 Each time the function is called, it will print to the standard output stream:
3620 <pre>
3621 myfunc</pre>
3623 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
3628 <!--page 79 -->
3630 <h6>footnotes</h6>
3631 <p><small><a name="note72" href="#note72">72)</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
3632 identifier is explicitly declared using the name __func__, the behavior is undefined.
3633 </small>
3635 <h4><a name="6.4.3" href="#6.4.3">6.4.3 Universal character names</a></h4>
3636 <h6>Syntax</h6>
3637 <p><!--para 1 -->
3638 <pre>
3639 universal-character-name:
3640 \u hex-quad
3641 \U hex-quad hex-quad
3642 hex-quad:
3643 hexadecimal-digit hexadecimal-digit
3644 hexadecimal-digit hexadecimal-digit</pre>
3645 <h6>Constraints</h6>
3646 <p><!--para 2 -->
3647 A universal character name shall not specify a character whose short identifier is less than
3648 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
3649 DFFF inclusive.<sup><a href="#note73"><b>73)</b></a></sup>
3650 <h6>Description</h6>
3651 <p><!--para 3 -->
3652 Universal character names may be used in identifiers, character constants, and string
3653 literals to designate characters that are not in the basic character set.
3654 <h6>Semantics</h6>
3655 <p><!--para 4 -->
3656 The universal character name \Unnnnnnnn designates the character whose eight-digit
3657 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note74"><b>74)</b></a></sup> Similarly, the universal
3658 character name \unnnn designates the character whose four-digit short identifier is nnnn
3659 (and whose eight-digit short identifier is 0000nnnn).
3664 <!--page 80 -->
3666 <h6>footnotes</h6>
3667 <p><small><a name="note73" href="#note73">73)</a> The disallowed characters are the characters in the basic character set and the code positions reserved
3668 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
3669 UTF-16).
3671 </small>
3672 <p><small><a name="note74" href="#note74">74)</a> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
3673 </small>
3675 <h4><a name="6.4.4" href="#6.4.4">6.4.4 Constants</a></h4>
3676 <h6>Syntax</h6>
3677 <p><!--para 1 -->
3678 <pre>
3679 constant:
3680 integer-constant
3681 floating-constant
3682 enumeration-constant
3683 character-constant</pre>
3684 <h6>Constraints</h6>
3685 <p><!--para 2 -->
3686 Each constant shall have a type and the value of a constant shall be in the range of
3687 representable values for its type.
3688 <h6>Semantics</h6>
3689 <p><!--para 3 -->
3690 Each constant has a type, determined by its form and value, as detailed later.
3692 <h5><a name="6.4.4.1" href="#6.4.4.1">6.4.4.1 Integer constants</a></h5>
3693 <h6>Syntax</h6>
3694 <p><!--para 1 -->
3695 <!--page 81 -->
3696 <pre>
3697 integer-constant:
3698 decimal-constant integer-suffixopt
3699 octal-constant integer-suffixopt
3700 hexadecimal-constant integer-suffixopt
3701 decimal-constant:
3702 nonzero-digit
3703 decimal-constant digit
3704 octal-constant:
3706 octal-constant octal-digit
3707 hexadecimal-constant:
3708 hexadecimal-prefix hexadecimal-digit
3709 hexadecimal-constant hexadecimal-digit
3710 hexadecimal-prefix: one of
3711 0x 0X
3712 nonzero-digit: one of
3713 1 2 3 4 5 6 7 8 9
3714 octal-digit: one of
3715 0 1 2 3 4 5 6 7
3716 hexadecimal-digit: one of
3717 0 1 2 3 4 5 6 7 8 9
3718 a b c d e f
3719 A B C D E F
3720 integer-suffix:
3721 unsigned-suffix long-suffixopt
3722 unsigned-suffix long-long-suffix
3723 long-suffix unsigned-suffixopt
3724 long-long-suffix unsigned-suffixopt
3725 unsigned-suffix: one of
3727 long-suffix: one of
3729 long-long-suffix: one of
3730 ll LL</pre>
3731 <h6>Description</h6>
3732 <p><!--para 2 -->
3733 An integer constant begins with a digit, but has no period or exponent part. It may have a
3734 prefix that specifies its base and a suffix that specifies its type.
3735 <p><!--para 3 -->
3736 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
3737 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
3738 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
3739 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
3740 10 through 15 respectively.
3741 <h6>Semantics</h6>
3742 <p><!--para 4 -->
3743 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
3744 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
3745 <p><!--para 5 -->
3746 The type of an integer constant is the first of the corresponding list in which its value can
3747 be represented.
3748 <!--page 82 -->
3749 <pre>
3750 Octal or Hexadecimal</pre>
3751 Suffix Decimal Constant Constant
3753 none int int
3754 <pre>
3755 long int unsigned int
3756 long long int long int
3757 unsigned long int
3758 long long int
3759 unsigned long long int</pre>
3761 u or U unsigned int unsigned int
3762 <pre>
3763 unsigned long int unsigned long int
3764 unsigned long long int unsigned long long int</pre>
3766 l or L long int long int
3767 <pre>
3768 long long int unsigned long int
3769 long long int
3770 unsigned long long int</pre>
3772 Both u or U unsigned long int unsigned long int
3773 and l or L unsigned long long int unsigned long long int
3775 ll or LL long long int long long int
3776 <pre>
3777 unsigned long long int</pre>
3779 Both u or U unsigned long long int unsigned long long int
3780 and ll or LL
3781 <p><!--para 6 -->
3782 If an integer constant cannot be represented by any type in its list, it may have an
3783 extended integer type, if the extended integer type can represent its value. If all of the
3784 types in the list for the constant are signed, the extended integer type shall be signed. If
3785 all of the types in the list for the constant are unsigned, the extended integer type shall be
3786 unsigned. If the list contains both signed and unsigned types, the extended integer type
3787 may be signed or unsigned. If an integer constant cannot be represented by any type in
3788 its list and has no extended integer type, then the integer constant has no type.
3789 <!--page 83 -->
3791 <h5><a name="6.4.4.2" href="#6.4.4.2">6.4.4.2 Floating constants</a></h5>
3792 <h6>Syntax</h6>
3793 <p><!--para 1 -->
3794 <!--page 84 -->
3795 <pre>
3796 floating-constant:
3797 decimal-floating-constant
3798 hexadecimal-floating-constant
3799 decimal-floating-constant:
3800 fractional-constant exponent-partopt floating-suffixopt
3801 digit-sequence exponent-part floating-suffixopt
3802 hexadecimal-floating-constant:
3803 hexadecimal-prefix hexadecimal-fractional-constant
3804 binary-exponent-part floating-suffixopt
3805 hexadecimal-prefix hexadecimal-digit-sequence
3806 binary-exponent-part floating-suffixopt
3807 fractional-constant:
3808 digit-sequenceopt . digit-sequence
3809 digit-sequence .
3810 exponent-part:
3811 e signopt digit-sequence
3812 E signopt digit-sequence
3813 sign: one of
3815 digit-sequence:
3816 digit
3817 digit-sequence digit
3818 hexadecimal-fractional-constant:
3819 hexadecimal-digit-sequenceopt .
3820 hexadecimal-digit-sequence
3821 hexadecimal-digit-sequence .
3822 binary-exponent-part:
3823 p signopt digit-sequence
3824 P signopt digit-sequence
3825 hexadecimal-digit-sequence:
3826 hexadecimal-digit
3827 hexadecimal-digit-sequence hexadecimal-digit
3828 floating-suffix: one of
3829 f l F L</pre>
3830 <h6>Description</h6>
3831 <p><!--para 2 -->
3832 A floating constant has a significand part that may be followed by an exponent part and a
3833 suffix that specifies its type. The components of the significand part may include a digit
3834 sequence representing the whole-number part, followed by a period (.), followed by a
3835 digit sequence representing the fraction part. The components of the exponent part are an
3836 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
3837 Either the whole-number part or the fraction part has to be present; for decimal floating
3838 constants, either the period or the exponent part has to be present.
3839 <h6>Semantics</h6>
3840 <p><!--para 3 -->
3841 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
3842 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
3843 floating constants, the exponent indicates the power of 10 by which the significand part is
3844 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
3845 by which the significand part is to be scaled. For decimal floating constants, and also for
3846 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
3847 the nearest representable value, or the larger or smaller representable value immediately
3848 adjacent to the nearest representable value, chosen in an implementation-defined manner.
3849 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
3850 correctly rounded.
3851 <p><!--para 4 -->
3852 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
3853 type float. If suffixed by the letter l or L, it has type long double.
3854 <p><!--para 5 -->
3855 Floating constants are converted to internal format as if at translation-time. The
3856 conversion of a floating constant shall not raise an exceptional condition or a floating-
3857 point exception at execution time. All floating constants of the same source form<sup><a href="#note75"><b>75)</b></a></sup> shall
3858 convert to the same internal format with the same value.
3859 <h6>Recommended practice</h6>
3860 <p><!--para 6 -->
3861 The implementation should produce a diagnostic message if a hexadecimal constant
3862 cannot be represented exactly in its evaluation format; the implementation should then
3863 proceed with the translation of the program.
3864 <p><!--para 7 -->
3865 The translation-time conversion of floating constants should match the execution-time
3866 conversion of character strings by library functions, such as strtod, given matching
3867 inputs suitable for both conversions, the same result format, and default execution-time
3868 rounding.<sup><a href="#note76"><b>76)</b></a></sup>
3870 <!--page 85 -->
3872 <h6>footnotes</h6>
3873 <p><small><a name="note75" href="#note75">75)</a> <a href="#1.23">1.23</a>, 1.230, 123e-2, 123e-02, and 1.23L are all different source forms and thus need not
3874 convert to the same internal format and value.
3875 </small>
3876 <p><small><a name="note76" href="#note76">76)</a> The specification for the library functions recommends more accurate conversion than required for
3877 floating constants (see <a href="#7.22.1.3">7.22.1.3</a>).
3878 </small>
3880 <h5><a name="6.4.4.3" href="#6.4.4.3">6.4.4.3 Enumeration constants</a></h5>
3881 <h6>Syntax</h6>
3882 <p><!--para 1 -->
3883 <pre>
3884 enumeration-constant:
3885 identifier</pre>
3886 <h6>Semantics</h6>
3887 <p><!--para 2 -->
3888 An identifier declared as an enumeration constant has type int.
3889 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
3891 <h5><a name="6.4.4.4" href="#6.4.4.4">6.4.4.4 Character constants</a></h5>
3892 <h6>Syntax</h6>
3893 <p><!--para 1 -->
3894 <!--page 86 -->
3895 <pre>
3896 character-constant:
3897 ' c-char-sequence '
3898 L' c-char-sequence '
3899 u' c-char-sequence '
3900 U' c-char-sequence '
3901 c-char-sequence:
3902 c-char
3903 c-char-sequence c-char
3904 c-char:
3905 any member of the source character set except
3906 the single-quote ', backslash \, or new-line character
3907 escape-sequence
3908 escape-sequence:
3909 simple-escape-sequence
3910 octal-escape-sequence
3911 hexadecimal-escape-sequence
3912 universal-character-name
3913 simple-escape-sequence: one of
3914 \' \" \? \\
3915 \a \b \f \n \r \t \v
3916 octal-escape-sequence:
3917 \ octal-digit
3918 \ octal-digit octal-digit
3919 \ octal-digit octal-digit octal-digit
3920 hexadecimal-escape-sequence:
3921 \x hexadecimal-digit
3922 hexadecimal-escape-sequence hexadecimal-digit</pre>
3923 <h6>Description</h6>
3924 <p><!--para 2 -->
3925 An integer character constant is a sequence of one or more multibyte characters enclosed
3926 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
3927 letter L, u, or U. With a few exceptions detailed later, the elements of the sequence are
3928 any members of the source character set; they are mapped in an implementation-defined
3929 manner to members of the execution character set.
3930 <p><!--para 3 -->
3931 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
3932 arbitrary integer values are representable according to the following table of escape
3933 sequences:
3934 <p><!--para 4 -->
3935 <pre>
3936 single quote ' \'
3937 double quote " \"
3938 question mark ? \?
3939 backslash \ \\
3940 octal character \octal digits
3941 hexadecimal character \x hexadecimal digits</pre>
3942 The double-quote " and question-mark ? are representable either by themselves or by the
3943 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
3944 shall be represented, respectively, by the escape sequences \' and \\.
3945 <p><!--para 5 -->
3946 The octal digits that follow the backslash in an octal escape sequence are taken to be part
3947 of the construction of a single character for an integer character constant or of a single
3948 wide character for a wide character constant. The numerical value of the octal integer so
3949 formed specifies the value of the desired character or wide character.
3950 <p><!--para 6 -->
3951 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
3952 sequence are taken to be part of the construction of a single character for an integer
3953 character constant or of a single wide character for a wide character constant. The
3954 numerical value of the hexadecimal integer so formed specifies the value of the desired
3955 character or wide character.
3956 <p><!--para 7 -->
3957 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
3958 constitute the escape sequence.
3959 <p><!--para 8 -->
3960 In addition, characters not in the basic character set are representable by universal
3961 character names and certain nongraphic characters are representable by escape sequences
3962 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
3963 and \v.<sup><a href="#note77"><b>77)</b></a></sup>
3964 <!--page 87 -->
3965 <h6>Constraints</h6>
3966 <p><!--para 9 -->
3967 The value of an octal or hexadecimal escape sequence shall be in the range of
3968 representable values for the corresponding type:
3969 <pre>
3970 Prefix Corresponding Type
3971 none unsigned char
3972 L the unsigned type corresponding to wchar_t
3973 u char16_t
3974 U char32_t</pre>
3975 <h6>Semantics</h6>
3976 <p><!--para 10 -->
3977 An integer character constant has type int. The value of an integer character constant
3978 containing a single character that maps to a single-byte execution character is the
3979 numerical value of the representation of the mapped character interpreted as an integer.
3980 The value of an integer character constant containing more than one character (e.g.,
3981 'ab'), or containing a character or escape sequence that does not map to a single-byte
3982 execution character, is implementation-defined. If an integer character constant contains
3983 a single character or escape sequence, its value is the one that results when an object with
3984 type char whose value is that of the single character or escape sequence is converted to
3985 type int.
3986 <p><!--para 11 -->
3987 A wide character constant prefixed by the letter L has type wchar_t, an integer type
3988 defined in the <a href="#7.19">&lt;stddef.h&gt;</a> header; a wide character constant prefixed by the letter u or
3989 U has type char16_t or char32_t, respectively, unsigned integer types defined in the
3990 <a href="#7.27">&lt;uchar.h&gt;</a> header. The value of a wide character constant containing a single
3991 multibyte character that maps to a single member of the extended execution character set
3992 is the wide character corresponding to that multibyte character, as defined by the
3993 mbtowc, mbrtoc16, or mbrtoc32 function as appropriate for its type, with an
3994 implementation-defined current locale. The value of a wide character constant containing
3995 more than one multibyte character or a single multibyte character that maps to multiple
3996 members of the extended execution character set, or containing a multibyte character or
3997 escape sequence not represented in the extended execution character set, is
3998 implementation-defined.
3999 <p><!--para 12 -->
4000 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
4002 <p><!--para 13 -->
4003 EXAMPLE 2 Consider implementations that use two's complement representation for integers and eight
4004 bits for objects that have type char. In an implementation in which type char has the same range of
4005 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
4006 same range of values as unsigned char, the character constant '\xFF' has the value +255.
4011 <!--page 88 -->
4012 <p><!--para 14 -->
4013 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
4014 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
4015 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
4016 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
4017 escape sequence is terminated after three octal digits. (The value of this two-character integer character
4018 constant is implementation-defined.)
4020 <p><!--para 15 -->
4021 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
4022 L'\1234' specifies the implementation-defined value that results from the combination of the values
4023 0123 and '4'.
4025 <p><b> Forward references</b>: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), the mbtowc function
4026 (<a href="#7.22.7.2">7.22.7.2</a>), Unicode utilities <a href="#7.27">&lt;uchar.h&gt;</a> (<a href="#7.27">7.27</a>).
4028 <h6>footnotes</h6>
4029 <p><small><a name="note77" href="#note77">77)</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,
4030 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
4031 </small>
4033 <h4><a name="6.4.5" href="#6.4.5">6.4.5 String literals</a></h4>
4034 <h6>Syntax</h6>
4035 <p><!--para 1 -->
4036 <pre>
4037 string-literal:
4038 encoding-prefixopt " s-char-sequenceopt "
4039 encoding-prefix:
4044 s-char-sequence:
4045 s-char
4046 s-char-sequence s-char
4047 s-char:
4048 any member of the source character set except
4049 the double-quote ", backslash \, or new-line character
4050 escape-sequence</pre>
4051 <h6>Constraints</h6>
4052 <p><!--para 2 -->
4053 A sequence of adjacent string literal tokens shall not include both a wide string literal and
4054 a UTF-8 string literal.
4055 <h6>Description</h6>
4056 <p><!--para 3 -->
4057 A character string literal is a sequence of zero or more multibyte characters enclosed in
4058 double-quotes, as in "xyz". A UTF-8 string literal is the same, except prefixed by u8.
4059 A wide string literal is the same, except prefixed by the letter L, u, or U.
4060 <p><!--para 4 -->
4061 The same considerations apply to each element of the sequence in a string literal as if it
4062 were in an integer character constant (for a character or UTF-8 string literal) or a wide
4063 character constant (for a wide string literal), except that the single-quote ' is
4064 representable either by itself or by the escape sequence \', but the double-quote " shall
4065 <!--page 89 -->
4066 be represented by the escape sequence \".
4067 <h6>Semantics</h6>
4068 <p><!--para 5 -->
4069 In translation phase 6, the multibyte character sequences specified by any sequence of
4070 adjacent character and identically-prefixed string literal tokens are concatenated into a
4071 single multibyte character sequence. If any of the tokens has an encoding prefix, the
4072 resulting multibyte character sequence is treated as having the same prefix; otherwise, it
4073 is treated as a character string literal. Whether differently-prefixed wide string literal
4074 tokens can be concatenated and, if so, the treatment of the resulting multibyte character
4075 sequence are implementation-defined.
4076 <p><!--para 6 -->
4077 In translation phase 7, a byte or code of value zero is appended to each multibyte
4078 character sequence that results from a string literal or literals.<sup><a href="#note78"><b>78)</b></a></sup> The multibyte character
4079 sequence is then used to initialize an array of static storage duration and length just
4080 sufficient to contain the sequence. For character string literals, the array elements have
4081 type char, and are initialized with the individual bytes of the multibyte character
4082 sequence. For UTF-8 string literals, the array elements have type char, and are
4083 initialized with the characters of the multibyte character sequence, as encoded in UTF-8.
4084 For wide string literals prefixed by the letter L, the array elements have type wchar_t
4085 and are initialized with the sequence of wide characters corresponding to the multibyte
4086 character sequence, as defined by the mbstowcs function with an implementation-
4087 defined current locale. For wide string literals prefixed by the letter u or U, the array
4088 elements have type char16_t or char32_t, respectively, and are initialized with the
4089 sequence of wide characters corresponding to the multibyte character sequence, as
4090 defined by successive calls to the mbrtoc16, or mbrtoc32 function as appropriate for
4091 its type, with an implementation-defined current locale. The value of a string literal
4092 containing a multibyte character or escape sequence not represented in the execution
4093 character set is implementation-defined.
4094 <p><!--para 7 -->
4095 It is unspecified whether these arrays are distinct provided their elements have the
4096 appropriate values. If the program attempts to modify such an array, the behavior is
4097 undefined.
4098 <p><!--para 8 -->
4099 EXAMPLE 1 This pair of adjacent character string literals
4100 <pre>
4101 "\x12" "3"</pre>
4102 produces a single character string literal containing the two characters whose values are '\x12' and '3',
4103 because escape sequences are converted into single members of the execution character set just prior to
4104 adjacent string literal concatenation.
4106 <p><!--para 9 -->
4107 EXAMPLE 2 Each of the sequences of adjacent string literal tokens
4111 <!--page 90 -->
4112 <pre>
4113 "a" "b" L"c"
4114 "a" L"b" "c"
4115 L"a" "b" L"c"
4116 L"a" L"b" L"c"</pre>
4117 is equivalent to the string literal
4118 <pre>
4119 L"abc"</pre>
4120 Likewise, each of the sequences
4121 <pre>
4122 "a" "b" u"c"
4123 "a" u"b" "c"
4124 u"a" "b" u"c"
4125 u"a" u"b" u"c"</pre>
4126 is equivalent to
4127 <pre>
4128 u"abc"</pre>
4130 <p><b> Forward references</b>: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), the mbstowcs
4131 function (<a href="#7.22.8.1">7.22.8.1</a>), Unicode utilities <a href="#7.27">&lt;uchar.h&gt;</a> (<a href="#7.27">7.27</a>).
4133 <h6>footnotes</h6>
4134 <p><small><a name="note78" href="#note78">78)</a> A 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 it by a
4135 \0 escape sequence.
4136 </small>
4138 <h4><a name="6.4.6" href="#6.4.6">6.4.6 Punctuators</a></h4>
4139 <h6>Syntax</h6>
4140 <p><!--para 1 -->
4141 <pre>
4142 punctuator: one of
4143 [ ] ( ) { } . -&gt;
4144 ++ -- &amp; * + - ~ !
4145 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
4146 ? : ; ...
4147 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
4148 , # ##
4149 &lt;: :&gt; &lt;% %&gt; %: %:%:</pre>
4150 <h6>Semantics</h6>
4151 <p><!--para 2 -->
4152 A punctuator is a symbol that has independent syntactic and semantic significance.
4153 Depending on context, it may specify an operation to be performed (which in turn may
4154 yield a value or a function designator, produce a side effect, or some combination thereof)
4155 in which case it is known as an operator (other forms of operator also exist in some
4156 contexts). An operand is an entity on which an operator acts.
4157 <!--page 91 -->
4158 <p><!--para 3 -->
4159 In all aspects of the language, the six tokens<sup><a href="#note79"><b>79)</b></a></sup>
4160 <pre>
4161 &lt;: :&gt; &lt;% %&gt; %: %:%:</pre>
4162 behave, respectively, the same as the six tokens
4163 <pre>
4164 [ ] { } # ##</pre>
4165 except for their spelling.<sup><a href="#note80"><b>80)</b></a></sup>
4166 <p><b> Forward references</b>: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
4167 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
4169 <h6>footnotes</h6>
4170 <p><small><a name="note79" href="#note79">79)</a> These tokens are sometimes called ''digraphs''.
4171 </small>
4172 <p><small><a name="note80" href="#note80">80)</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
4173 interchanged.
4174 </small>
4176 <h4><a name="6.4.7" href="#6.4.7">6.4.7 Header names</a></h4>
4177 <h6>Syntax</h6>
4178 <p><!--para 1 -->
4179 <pre>
4180 header-name:
4181 &lt; h-char-sequence &gt;
4182 " q-char-sequence "
4183 h-char-sequence:
4184 h-char
4185 h-char-sequence h-char
4186 h-char:
4187 any member of the source character set except
4188 the new-line character and &gt;
4189 q-char-sequence:
4190 q-char
4191 q-char-sequence q-char
4192 q-char:
4193 any member of the source character set except
4194 the new-line character and "</pre>
4195 <h6>Semantics</h6>
4196 <p><!--para 2 -->
4197 The sequences in both forms of header names are mapped in an implementation-defined
4198 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
4199 <p><!--para 3 -->
4200 If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
4201 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
4206 <!--page 92 -->
4207 sequence between the " delimiters, the behavior is undefined.<sup><a href="#note81"><b>81)</b></a></sup> Header name
4208 preprocessing tokens are recognized only within #include preprocessing directives and
4209 in implementation-defined locations within #pragma directives.<sup><a href="#note82"><b>82)</b></a></sup>
4210 <p><!--para 4 -->
4211 EXAMPLE The following sequence of characters:
4212 <pre>
4213 0x3&lt;1/a.h&gt;1e2
4214 #include &lt;1/a.h&gt;
4215 #define const.member@$</pre>
4216 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
4217 by a { on the left and a } on the right).
4218 <pre>
4219 {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
4220 {#}{include} {&lt;1/a.h&gt;}
4221 {#}{define} {const}{.}{member}{@}{$}</pre>
4223 <p><b> Forward references</b>: source file inclusion (<a href="#6.10.2">6.10.2</a>).
4225 <h6>footnotes</h6>
4226 <p><small><a name="note81" href="#note81">81)</a> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
4227 </small>
4228 <p><small><a name="note82" href="#note82">82)</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>.
4229 </small>
4231 <h4><a name="6.4.8" href="#6.4.8">6.4.8 Preprocessing numbers</a></h4>
4232 <h6>Syntax</h6>
4233 <p><!--para 1 -->
4234 <pre>
4235 pp-number:
4236 digit
4237 . digit
4238 pp-number digit
4239 pp-number identifier-nondigit
4240 pp-number e sign
4241 pp-number E sign
4242 pp-number p sign
4243 pp-number P sign
4244 pp-number .</pre>
4245 <h6>Description</h6>
4246 <p><!--para 2 -->
4247 A preprocessing number begins with a digit optionally preceded by a period (.) and may
4248 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
4249 p+, p-, P+, or P-.
4250 <p><!--para 3 -->
4251 Preprocessing number tokens lexically include all floating and integer constant tokens.
4252 <h6>Semantics</h6>
4253 <p><!--para 4 -->
4254 A preprocessing number does not have type or a value; it acquires both after a successful
4255 conversion (as part of translation phase 7) to a floating constant token or an integer
4256 constant token.
4259 <!--page 93 -->
4261 <h4><a name="6.4.9" href="#6.4.9">6.4.9 Comments</a></h4>
4262 <p><!--para 1 -->
4263 Except within a character constant, a string literal, or a comment, the characters /*
4264 introduce a comment. The contents of such a comment are examined only to identify
4265 multibyte characters and to find the characters */ that terminate it.<sup><a href="#note83"><b>83)</b></a></sup>
4266 <p><!--para 2 -->
4267 Except within a character constant, a string literal, or a comment, the characters //
4268 introduce a comment that includes all multibyte characters up to, but not including, the
4269 next new-line character. The contents of such a comment are examined only to identify
4270 multibyte characters and to find the terminating new-line character.
4271 <p><!--para 3 -->
4272 EXAMPLE
4273 <pre>
4274 "a//b" // four-character string literal
4275 #include "//e" // undefined behavior
4276 // */ // comment, not syntax error
4277 f = g/**//h; // equivalent to f = g / h;
4279 i(); // part of a two-line comment
4281 / j(); // part of a two-line comment
4282 #define glue(x,y) x##y
4283 glue(/,/) k(); // syntax error, not comment
4284 /*//*/ l(); // equivalent to l();
4285 m = n//**/o
4286 + p; // equivalent to m = n + p;</pre>
4291 <!--page 94 -->
4293 <h6>footnotes</h6>
4294 <p><small><a name="note83" href="#note83">83)</a> Thus, /* ... */ comments do not nest.
4295 </small>
4297 <h3><a name="6.5" href="#6.5">6.5 Expressions</a></h3>
4298 <p><!--para 1 -->
4299 An expression is a sequence of operators and operands that specifies computation of a
4300 value, or that designates an object or a function, or that generates side effects, or that
4301 performs a combination thereof. The value computations of the operands of an operator
4302 are sequenced before the value computation of the result of the operator.
4303 <p><!--para 2 -->
4304 If a side effect on a scalar object is unsequenced relative to either a different side effect
4305 on the same scalar object or a value computation using the value of the same scalar
4306 object, the behavior is undefined. If there are multiple allowable orderings of the
4307 subexpressions of an expression, the behavior is undefined if such an unsequenced side
4308 effect occurs in any of the orderings.<sup><a href="#note84"><b>84)</b></a></sup>
4309 <p><!--para 3 -->
4310 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note85"><b>85)</b></a></sup> Except as specified
4311 later, side effects and value computations of subexpressions are unsequenced.<sup><a href="#note86"><b>86)</b></a></sup> *
4312 <p><!--para 4 -->
4313 Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
4314 collectively described as bitwise operators) are required to have operands that have
4315 integer type. These operators yield values that depend on the internal representations of
4316 integers, and have implementation-defined and undefined aspects for signed types.
4317 <p><!--para 5 -->
4318 If an exceptional condition occurs during the evaluation of an expression (that is, if the
4319 result is not mathematically defined or not in the range of representable values for its
4320 type), the behavior is undefined.
4324 <!--page 95 -->
4325 <p><!--para 6 -->
4326 The effective type of an object for an access to its stored value is the declared type of the
4327 object, if any.<sup><a href="#note87"><b>87)</b></a></sup> If a value is stored into an object having no declared type through an
4328 lvalue having a type that is not a character type, then the type of the lvalue becomes the
4329 effective type of the object for that access and for subsequent accesses that do not modify
4330 the stored value. If a value is copied into an object having no declared type using
4331 memcpy or memmove, or is copied as an array of character type, then the effective type
4332 of the modified object for that access and for subsequent accesses that do not modify the
4333 value is the effective type of the object from which the value is copied, if it has one. For
4334 all other accesses to an object having no declared type, the effective type of the object is
4335 simply the type of the lvalue used for the access.
4336 <p><!--para 7 -->
4337 An object shall have its stored value accessed only by an lvalue expression that has one of
4338 the following types:<sup><a href="#note88"><b>88)</b></a></sup>
4339 <ul>
4340 <li> a type compatible with the effective type of the object,
4341 <li> a qualified version of a type compatible with the effective type of the object,
4342 <li> a type that is the signed or unsigned type corresponding to the effective type of the
4343 object,
4344 <li> a type that is the signed or unsigned type corresponding to a qualified version of the
4345 effective type of the object,
4346 <li> an aggregate or union type that includes one of the aforementioned types among its
4347 members (including, recursively, a member of a subaggregate or contained union), or
4348 <li> a character type.
4349 </ul>
4350 <p><!--para 8 -->
4351 A floating expression may be contracted, that is, evaluated as though it were a single
4352 operation, thereby omitting rounding errors implied by the source code and the
4353 expression evaluation method.<sup><a href="#note89"><b>89)</b></a></sup> The FP_CONTRACT pragma in <a href="#7.12">&lt;math.h&gt;</a> provides a
4354 way to disallow contracted expressions. Otherwise, whether and how expressions are
4355 contracted is implementation-defined.<sup><a href="#note90"><b>90)</b></a></sup>
4356 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.23.2">7.23.2</a>).
4359 <!--page 96 -->
4361 <h6>footnotes</h6>
4362 <p><small><a name="note84" href="#note84">84)</a> This paragraph renders undefined statement expressions such as
4364 <pre>
4365 i = ++i + 1;
4366 a[i++] = i;</pre>
4367 while allowing
4369 <pre>
4370 i = i + 1;
4371 a[i] = i;</pre>
4373 </small>
4374 <p><small><a name="note85" href="#note85">85)</a> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
4375 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
4376 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
4377 <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
4378 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
4379 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
4380 the conditional operator ? : (<a href="#6.5.15">6.5.15</a>).
4381 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
4382 indicated in each subclause by the syntax for the expressions discussed therein.
4383 </small>
4384 <p><small><a name="note86" href="#note86">86)</a> In an expression that is evaluated more than once during the execution of a program, unsequenced and
4385 indeterminately sequenced evaluations of its subexpressions need not be performed consistently in
4386 different evaluations.
4387 </small>
4388 <p><small><a name="note87" href="#note87">87)</a> Allocated objects have no declared type.
4389 </small>
4390 <p><small><a name="note88" href="#note88">88)</a> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
4391 </small>
4392 <p><small><a name="note89" href="#note89">89)</a> The intermediate operations in the contracted expression are evaluated as if to infinite precision and
4393 range, while the final operation is rounded to the format determined by the expression evaluation
4394 method. A contracted expression might also omit the raising of floating-point exceptions.
4395 </small>
4396 <p><small><a name="note90" href="#note90">90)</a> This license is specifically intended to allow implementations to exploit fast machine instructions that
4397 combine multiple C operators. As contractions potentially undermine predictability, and can even
4398 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
4399 documented.
4400 </small>
4402 <h4><a name="6.5.1" href="#6.5.1">6.5.1 Primary expressions</a></h4>
4403 <h6>Syntax</h6>
4404 <p><!--para 1 -->
4405 <pre>
4406 primary-expression:
4407 identifier
4408 constant
4409 string-literal
4410 ( expression )
4411 generic-selection</pre>
4412 <h6>Semantics</h6>
4413 <p><!--para 2 -->
4414 An identifier is a primary expression, provided it has been declared as designating an
4415 object (in which case it is an lvalue) or a function (in which case it is a function
4416 designator).<sup><a href="#note91"><b>91)</b></a></sup>
4417 <p><!--para 3 -->
4418 A constant is a primary expression. Its type depends on its form and value, as detailed in
4419 <a href="#6.4.4">6.4.4</a>.
4420 <p><!--para 4 -->
4421 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>.
4422 <p><!--para 5 -->
4423 A parenthesized expression is a primary expression. Its type and value are identical to
4424 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
4425 expression if the unparenthesized expression is, respectively, an lvalue, a function
4426 designator, or a void expression.
4427 <p><b> Forward references</b>: declarations (<a href="#6.7">6.7</a>).
4429 <h6>footnotes</h6>
4430 <p><small><a name="note91" href="#note91">91)</a> Thus, an undeclared identifier is a violation of the syntax.
4431 </small>
4433 <h5><a name="6.5.1.1" href="#6.5.1.1">6.5.1.1 Generic selection</a></h5>
4434 <h6>Syntax</h6>
4435 <p><!--para 1 -->
4436 <pre>
4437 generic-selection:
4438 _Generic ( assignment-expression , generic-assoc-list )
4439 generic-assoc-list:
4440 generic-association
4441 generic-assoc-list , generic-association
4442 generic-association:
4443 type-name : assignment-expression
4444 default : assignment-expression</pre>
4445 <h6>Constraints</h6>
4446 <p><!--para 2 -->
4447 A generic selection shall have no more than one default generic association. The type
4448 name in a generic association shall specify a complete object type other than a variably
4450 <!--page 97 -->
4451 modified type. No two generic associations in the same generic selection shall specify
4452 compatible types. The controlling expression of a generic selection shall have type
4453 compatible with at most one of the types named in its generic association list. If a
4454 generic selection has no default generic association, its controlling expression shall
4455 have type compatible with exactly one of the types named in its generic association list.
4456 <h6>Semantics</h6>
4457 <p><!--para 3 -->
4458 The controlling expression of a generic selection is not evaluated. If a generic selection
4459 has a generic association with a type name that is compatible with the type of the
4460 controlling expression, then the result expression of the generic selection is the
4461 expression in that generic association. Otherwise, the result expression of the generic
4462 selection is the expression in the default generic association. None of the expressions
4463 from any other generic association of the generic selection is evaluated.
4464 <p><!--para 4 -->
4465 The type and value of a generic selection are identical to those of its result expression. It
4466 is an lvalue, a function designator, or a void expression if its result expression is,
4467 respectively, an lvalue, a function designator, or a void expression.
4468 <p><!--para 5 -->
4469 EXAMPLE The cbrt type-generic macro could be implemented as follows:
4470 <pre>
4471 #define cbrt(X) _Generic((X), \
4472 long double: cbrtl, \
4473 default: cbrt, \
4474 float: cbrtf \
4475 )(X)</pre>
4478 <h4><a name="6.5.2" href="#6.5.2">6.5.2 Postfix operators</a></h4>
4479 <h6>Syntax</h6>
4480 <p><!--para 1 -->
4481 <!--page 98 -->
4482 <pre>
4483 postfix-expression:
4484 primary-expression
4485 postfix-expression [ expression ]
4486 postfix-expression ( argument-expression-listopt )
4487 postfix-expression . identifier
4488 postfix-expression -&gt; identifier
4489 postfix-expression ++
4490 postfix-expression --
4491 ( type-name ) { initializer-list }
4492 ( type-name ) { initializer-list , }
4493 argument-expression-list:
4494 assignment-expression
4495 argument-expression-list , assignment-expression</pre>
4497 <h5><a name="6.5.2.1" href="#6.5.2.1">6.5.2.1 Array subscripting</a></h5>
4498 <h6>Constraints</h6>
4499 <p><!--para 1 -->
4500 One of the expressions shall have type ''pointer to complete object type'', the other
4501 expression shall have integer type, and the result has type ''type''.
4502 <h6>Semantics</h6>
4503 <p><!--para 2 -->
4504 A postfix expression followed by an expression in square brackets [] is a subscripted
4505 designation of an element of an array object. The definition of the subscript operator []
4506 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
4507 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
4508 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
4509 element of E1 (counting from zero).
4510 <p><!--para 3 -->
4511 Successive subscript operators designate an element of a multidimensional array object.
4512 If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
4513 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
4514 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
4515 implicitly as a result of subscripting, the result is the referenced (n - 1)-dimensional
4516 array, which itself is converted into a pointer if used as other than an lvalue. It follows
4517 from this that arrays are stored in row-major order (last subscript varies fastest).
4518 <p><!--para 4 -->
4519 EXAMPLE Consider the array object defined by the declaration
4520 <pre>
4521 int x[3][5];</pre>
4522 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
4523 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
4524 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
4525 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
4526 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
4527 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
4528 yields an int.
4530 <p><b> Forward references</b>: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
4531 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
4533 <h5><a name="6.5.2.2" href="#6.5.2.2">6.5.2.2 Function calls</a></h5>
4534 <h6>Constraints</h6>
4535 <p><!--para 1 -->
4536 The expression that denotes the called function<sup><a href="#note92"><b>92)</b></a></sup> shall have type pointer to function
4537 returning void or returning a complete object type other than an array type.
4538 <p><!--para 2 -->
4539 If the expression that denotes the called function has a type that includes a prototype, the
4540 number of arguments shall agree with the number of parameters. Each argument shall
4543 <!--page 99 -->
4544 have a type such that its value may be assigned to an object with the unqualified version
4545 of the type of its corresponding parameter.
4546 <h6>Semantics</h6>
4547 <p><!--para 3 -->
4548 A postfix expression followed by parentheses () containing a possibly empty, comma-
4549 separated list of expressions is a function call. The postfix expression denotes the called
4550 function. The list of expressions specifies the arguments to the function.
4551 <p><!--para 4 -->
4552 An argument may be an expression of any complete object type. In preparing for the call
4553 to a function, the arguments are evaluated, and each parameter is assigned the value of the
4554 corresponding argument.<sup><a href="#note93"><b>93)</b></a></sup>
4555 <p><!--para 5 -->
4556 If the expression that denotes the called function has type pointer to function returning an
4557 object type, the function call expression has the same type as that object type, and has the
4558 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. *
4559 <p><!--para 6 -->
4560 If the expression that denotes the called function has a type that does not include a
4561 prototype, the integer promotions are performed on each argument, and arguments that
4562 have type float are promoted to double. These are called the default argument
4563 promotions. If the number of arguments does not equal the number of parameters, the
4564 behavior is undefined. If the function is defined with a type that includes a prototype, and
4565 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
4566 promotion are not compatible with the types of the parameters, the behavior is undefined.
4567 If the function is defined with a type that does not include a prototype, and the types of
4568 the arguments after promotion are not compatible with those of the parameters after
4569 promotion, the behavior is undefined, except for the following cases:
4570 <ul>
4571 <li> one promoted type is a signed integer type, the other promoted type is the
4572 corresponding unsigned integer type, and the value is representable in both types;
4573 <li> both types are pointers to qualified or unqualified versions of a character type or
4574 void.
4575 </ul>
4576 <p><!--para 7 -->
4577 If the expression that denotes the called function has a type that does include a prototype,
4578 the arguments are implicitly converted, as if by assignment, to the types of the
4579 corresponding parameters, taking the type of each parameter to be the unqualified version
4580 of its declared type. The ellipsis notation in a function prototype declarator causes
4581 argument type conversion to stop after the last declared parameter. The default argument
4582 promotions are performed on trailing arguments.
4586 <!--page 100 -->
4587 <p><!--para 8 -->
4588 No other conversions are performed implicitly; in particular, the number and types of
4589 arguments are not compared with those of the parameters in a function definition that
4590 does not include a function prototype declarator.
4591 <p><!--para 9 -->
4592 If the function is defined with a type that is not compatible with the type (of the
4593 expression) pointed to by the expression that denotes the called function, the behavior is
4594 undefined.
4595 <p><!--para 10 -->
4596 There is a sequence point after the evaluations of the function designator and the actual
4597 arguments but before the actual call. Every evaluation in the calling function (including
4598 other function calls) that is not otherwise specifically sequenced before or after the
4599 execution of the body of the called function is indeterminately sequenced with respect to
4600 the execution of the called function.<sup><a href="#note94"><b>94)</b></a></sup>
4601 <p><!--para 11 -->
4602 Recursive function calls shall be permitted, both directly and indirectly through any chain
4603 of other functions.
4604 <p><!--para 12 -->
4605 EXAMPLE In the function call
4606 <pre>
4607 (*pf[f1()]) (f2(), f3() + f4())</pre>
4608 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
4609 the function pointed to by pf[f1()] is called.
4611 <p><b> Forward references</b>: function declarators (including prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), function
4612 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>).
4614 <h6>footnotes</h6>
4615 <p><small><a name="note92" href="#note92">92)</a> Most often, this is the result of converting an identifier that is a function designator.
4616 </small>
4617 <p><small><a name="note93" href="#note93">93)</a> A function may change the values of its parameters, but these changes cannot affect the values of the
4618 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
4619 change the value of the object pointed to. A parameter declared to have array or function type is
4620 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
4621 </small>
4622 <p><small><a name="note94" href="#note94">94)</a> In other words, function executions do not ''interleave'' with each other.
4623 </small>
4625 <h5><a name="6.5.2.3" href="#6.5.2.3">6.5.2.3 Structure and union members</a></h5>
4626 <h6>Constraints</h6>
4627 <p><!--para 1 -->
4628 The first operand of the . operator shall have an atomic, qualified, or unqualified
4629 structure or union type, and the second operand shall name a member of that type.
4630 <p><!--para 2 -->
4631 The first operand of the -&gt; operator shall have type ''pointer to atomic, qualified, or
4632 unqualified structure'' or ''pointer to atomic, qualified, or unqualified union'', and the
4633 second operand shall name a member of the type pointed to.
4634 <h6>Semantics</h6>
4635 <p><!--para 3 -->
4636 A postfix expression followed by the . operator and an identifier designates a member of
4637 a structure or union object. The value is that of the named member,<sup><a href="#note95"><b>95)</b></a></sup> and is an lvalue if
4638 the first expression is an lvalue. If the first expression has qualified type, the result has
4639 the so-qualified version of the type of the designated member.
4641 <!--page 101 -->
4642 <p><!--para 4 -->
4643 A postfix expression followed by the -&gt; operator and an identifier designates a member
4644 of a structure or union object. The value is that of the named member of the object to
4645 which the first expression points, and is an lvalue.<sup><a href="#note96"><b>96)</b></a></sup> If the first expression is a pointer to
4646 a qualified type, the result has the so-qualified version of the type of the designated
4647 member.
4648 <p><!--para 5 -->
4649 Accessing a member of an atomic structure or union object results in undefined
4650 behavior.<sup><a href="#note97"><b>97)</b></a></sup>
4651 <p><!--para 6 -->
4652 One special guarantee is made in order to simplify the use of unions: if a union contains
4653 several structures that share a common initial sequence (see below), and if the union
4654 object currently contains one of these structures, it is permitted to inspect the common
4655 initial part of any of them anywhere that a declaration of the completed type of the union
4656 is visible. Two structures share a common initial sequence if corresponding members
4657 have compatible types (and, for bit-fields, the same widths) for a sequence of one or more
4658 initial members.
4659 <p><!--para 7 -->
4660 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
4661 union, f().x is a valid postfix expression but is not an lvalue.
4663 <p><!--para 8 -->
4664 EXAMPLE 2 In:
4665 <pre>
4666 struct s { int i; const int ci; };
4667 struct s s;
4668 const struct s cs;
4669 volatile struct s vs;</pre>
4670 the various members have the types:
4671 <pre>
4672 s.i int
4673 s.ci const int
4674 cs.i const int
4675 cs.ci const int
4676 vs.i volatile int
4677 vs.ci volatile const int</pre>
4682 <!--page 102 -->
4683 <p><!--para 9 -->
4684 EXAMPLE 3 The following is a valid fragment:
4685 <pre>
4686 union {
4687 struct {
4688 int alltypes;
4689 } n;
4690 struct {
4691 int type;
4692 int intnode;
4693 } ni;
4694 struct {
4695 int type;
4696 double doublenode;
4697 } nf;
4698 } u;
4699 u.nf.type = 1;
4700 u.nf.doublenode = <a href="#3.14">3.14</a>;
4701 /* ... */
4702 if (u.n.alltypes == 1)
4703 if (sin(u.nf.doublenode) == 0.0)
4704 /* ... */</pre>
4705 The following is not a valid fragment (because the union type is not visible within function f):
4706 <pre>
4707 struct t1 { int m; };
4708 struct t2 { int m; };
4709 int f(struct t1 *p1, struct t2 *p2)
4711 if (p1-&gt;m &lt; 0)
4712 p2-&gt;m = -p2-&gt;m;
4713 return p1-&gt;m;
4715 int g()
4717 union {
4718 struct t1 s1;
4719 struct t2 s2;
4720 } u;
4721 /* ... */
4722 return f(&amp;u.s1, &amp;u.s2);
4723 }</pre>
4725 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
4726 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
4727 <!--page 103 -->
4729 <h6>footnotes</h6>
4730 <p><small><a name="note95" href="#note95">95)</a> If the member used to read the contents of a union object is not the same as the member last used to
4731 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
4732 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
4733 punning''). This might be a trap representation.
4734 </small>
4735 <p><small><a name="note96" href="#note96">96)</a> If &amp;E is a valid pointer expression (where &amp; is the ''address-of '' operator, which generates a pointer to
4736 its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
4737 </small>
4738 <p><small><a name="note97" href="#note97">97)</a> For example, a data race would occur if access to the entire structure or union in one thread conflicts
4739 with access to a member from another thread, where at least one access is a modification. Members
4740 can be safely accessed using a non-atomic object which is assigned to or from the atomic object.
4741 </small>
4743 <h5><a name="6.5.2.4" href="#6.5.2.4">6.5.2.4 Postfix increment and decrement operators</a></h5>
4744 <h6>Constraints</h6>
4745 <p><!--para 1 -->
4746 The operand of the postfix increment or decrement operator shall have atomic, qualified,
4747 or unqualified real or pointer type, and shall be a modifiable lvalue.
4748 <h6>Semantics</h6>
4749 <p><!--para 2 -->
4750 The result of the postfix ++ operator is the value of the operand. As a side effect, the
4751 value of the operand object is incremented (that is, the value 1 of the appropriate type is
4752 added to it). See the discussions of additive operators and compound assignment for
4753 information on constraints, types, and conversions and the effects of operations on
4754 pointers. The value computation of the result is sequenced before the side effect of
4755 updating the stored value of the operand. With respect to an indeterminately-sequenced
4756 function call, the operation of postfix ++ is a single evaluation. Postfix ++ on an object
4757 with atomic type is a read-modify-write operation with memory_order_seq_cst
4758 memory order semantics.<sup><a href="#note98"><b>98)</b></a></sup>
4759 <p><!--para 3 -->
4760 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
4761 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
4762 it).
4763 <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>).
4765 <h6>footnotes</h6>
4766 <p><small><a name="note98" href="#note98">98)</a> Where a pointer to an atomic object can be formed, this is equivalent to the following code sequence
4767 where T is the type of E:
4769 <pre>
4770 T tmp;
4771 T result = E;
4772 do {
4773 tmp = result + 1;
4774 } while (!atomic_compare_exchange_strong(&amp;E, &amp;result, tmp));</pre>
4775 with result being the result of the operation.
4776 </small>
4778 <h5><a name="6.5.2.5" href="#6.5.2.5">6.5.2.5 Compound literals</a></h5>
4779 <h6>Constraints</h6>
4780 <p><!--para 1 -->
4781 The type name shall specify a complete object type or an array of unknown size, but not a
4782 variable length array type.
4783 <p><!--para 2 -->
4784 All the constraints for initializer lists in <a href="#6.7.9">6.7.9</a> also apply to compound literals.
4785 <h6>Semantics</h6>
4786 <p><!--para 3 -->
4787 A postfix expression that consists of a parenthesized type name followed by a brace-
4788 enclosed list of initializers is a compound literal. It provides an unnamed object whose
4789 value is given by the initializer list.<sup><a href="#note99"><b>99)</b></a></sup>
4792 <!--page 104 -->
4793 <p><!--para 4 -->
4794 If the type name specifies an array of unknown size, the size is determined by the
4795 initializer list as specified in <a href="#6.7.9">6.7.9</a>, and the type of the compound literal is that of the
4796 completed array type. Otherwise (when the type name specifies an object type), the type
4797 of the compound literal is that specified by the type name. In either case, the result is an
4798 lvalue.
4799 <p><!--para 5 -->
4800 The value of the compound literal is that of an unnamed object initialized by the
4801 initializer list. If the compound literal occurs outside the body of a function, the object
4802 has static storage duration; otherwise, it has automatic storage duration associated with
4803 the enclosing block.
4804 <p><!--para 6 -->
4805 All the semantic rules for initializer lists in <a href="#6.7.9">6.7.9</a> also apply to compound literals.<sup><a href="#note100"><b>100)</b></a></sup>
4806 <p><!--para 7 -->
4807 String literals, and compound literals with const-qualified types, need not designate
4808 distinct objects.<sup><a href="#note101"><b>101)</b></a></sup>
4809 <p><!--para 8 -->
4810 EXAMPLE 1 The file scope definition
4811 <pre>
4812 int *p = (int []){2, 4};</pre>
4813 initializes p to point to the first element of an array of two ints, the first having the value two and the
4814 second, four. The expressions in this compound literal are required to be constant. The unnamed object
4815 has static storage duration.
4817 <p><!--para 9 -->
4818 EXAMPLE 2 In contrast, in
4819 <pre>
4820 void f(void)
4822 int *p;
4823 /*...*/
4824 p = (int [2]){*p};
4825 /*...*/
4826 }</pre>
4827 p is assigned the address of the first element of an array of two ints, the first having the value previously
4828 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
4829 unnamed object has automatic storage duration.
4831 <p><!--para 10 -->
4832 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
4833 created using compound literals can be passed to functions without depending on member order:
4834 <pre>
4835 drawline((struct point){.x=1, .y=1},
4836 (struct point){.x=3, .y=4});</pre>
4837 Or, if drawline instead expected pointers to struct point:
4841 <!--page 105 -->
4842 <pre>
4843 drawline(&amp;(struct point){.x=1, .y=1},
4844 &amp;(struct point){.x=3, .y=4});</pre>
4846 <p><!--para 11 -->
4847 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
4848 <pre>
4849 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}</pre>
4851 <p><!--para 12 -->
4852 EXAMPLE 5 The following three expressions have different meanings:
4853 <pre>
4854 "/tmp/fileXXXXXX"
4855 (char []){"/tmp/fileXXXXXX"}
4856 (const char []){"/tmp/fileXXXXXX"}</pre>
4857 The first always has static storage duration and has type array of char, but need not be modifiable; the last
4858 two have automatic storage duration when they occur within the body of a function, and the first of these
4859 two is modifiable.
4861 <p><!--para 13 -->
4862 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
4863 and can even be shared. For example,
4864 <pre>
4865 (const char []){"abc"} == "abc"</pre>
4866 might yield 1 if the literals' storage is shared.
4868 <p><!--para 14 -->
4869 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
4870 linked object. For example, there is no way to write a self-referential compound literal that could be used
4871 as the function argument in place of the named object endless_zeros below:
4872 <pre>
4873 struct int_list { int car; struct int_list *cdr; };
4874 struct int_list endless_zeros = {0, &amp;endless_zeros};
4875 eval(endless_zeros);</pre>
4877 <p><!--para 15 -->
4878 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
4879 <pre>
4880 struct s { int i; };
4881 int f (void)
4883 struct s *p = 0, *q;
4884 int j = 0;
4885 again:
4886 q = p, p = &amp;((struct s){ j++ });
4887 if (j &lt; 2) goto again;
4888 return p == q &amp;&amp; q-&gt;i == 1;
4889 }</pre>
4890 The function f() always returns the value 1.
4891 <p><!--para 16 -->
4892 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
4893 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
4894 have an indeterminate value, which would result in undefined behavior.
4896 <p><b> Forward references</b>: type names (<a href="#6.7.7">6.7.7</a>), initialization (<a href="#6.7.9">6.7.9</a>).
4897 <!--page 106 -->
4899 <h6>footnotes</h6>
4900 <p><small><a name="note99" href="#note99">99)</a> Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
4901 or void only, and the result of a cast expression is not an lvalue.
4902 </small>
4903 <p><small><a name="note100" href="#note100">100)</a> For example, subobjects without explicit initializers are initialized to zero.
4904 </small>
4905 <p><small><a name="note101" href="#note101">101)</a> This allows implementations to share storage for string literals and constant compound literals with
4906 the same or overlapping representations.
4907 </small>
4909 <h4><a name="6.5.3" href="#6.5.3">6.5.3 Unary operators</a></h4>
4910 <h6>Syntax</h6>
4911 <p><!--para 1 -->
4912 <pre>
4913 unary-expression:
4914 postfix-expression
4915 ++ unary-expression
4916 -- unary-expression
4917 unary-operator cast-expression
4918 sizeof unary-expression
4919 sizeof ( type-name )
4920 alignof ( type-name )
4921 unary-operator: one of
4922 &amp; * + - ~ !</pre>
4924 <h5><a name="6.5.3.1" href="#6.5.3.1">6.5.3.1 Prefix increment and decrement operators</a></h5>
4925 <h6>Constraints</h6>
4926 <p><!--para 1 -->
4927 The operand of the prefix increment or decrement operator shall have atomic, qualified,
4928 or unqualified real or pointer type, and shall be a modifiable lvalue.
4929 <h6>Semantics</h6>
4930 <p><!--para 2 -->
4931 The value of the operand of the prefix ++ operator is incremented. The result is the new
4932 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
4933 See the discussions of additive operators and compound assignment for information on
4934 constraints, types, side effects, and conversions and the effects of operations on pointers.
4935 <p><!--para 3 -->
4936 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
4937 operand is decremented.
4938 <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>).
4940 <h5><a name="6.5.3.2" href="#6.5.3.2">6.5.3.2 Address and indirection operators</a></h5>
4941 <h6>Constraints</h6>
4942 <p><!--para 1 -->
4943 The operand of the unary &amp; operator shall be either a function designator, the result of a
4944 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
4945 not declared with the register storage-class specifier.
4946 <p><!--para 2 -->
4947 The operand of the unary * operator shall have pointer type.
4948 <h6>Semantics</h6>
4949 <p><!--para 3 -->
4950 The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
4951 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
4952 neither that operator nor the &amp; operator is evaluated and the result is as if both were
4953 omitted, except that the constraints on the operators still apply and the result is not an
4954 <!--page 107 -->
4955 lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
4956 the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
4957 were removed and the [] operator were changed to a + operator. Otherwise, the result is
4958 a pointer to the object or function designated by its operand.
4959 <p><!--para 4 -->
4960 The unary * operator denotes indirection. If the operand points to a function, the result is
4961 a function designator; if it points to an object, the result is an lvalue designating the
4962 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
4963 invalid value has been assigned to the pointer, the behavior of the unary * operator is
4964 undefined.<sup><a href="#note102"><b>102)</b></a></sup>
4965 <p><b> Forward references</b>: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
4966 (<a href="#6.7.2.1">6.7.2.1</a>).
4968 <h6>footnotes</h6>
4969 <p><small><a name="note102" href="#note102">102)</a> Thus, &amp;*E is equivalent to E (even if E is a null pointer), and &amp;(E1[E2]) to ((E1)+(E2)). It is
4970 always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
4971 operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
4972 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
4973 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
4974 address inappropriately aligned for the type of object pointed to, and the address of an object after the
4975 end of its lifetime.
4976 </small>
4978 <h5><a name="6.5.3.3" href="#6.5.3.3">6.5.3.3 Unary arithmetic operators</a></h5>
4979 <h6>Constraints</h6>
4980 <p><!--para 1 -->
4981 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
4982 integer type; of the ! operator, scalar type.
4983 <h6>Semantics</h6>
4984 <p><!--para 2 -->
4985 The result of the unary + operator is the value of its (promoted) operand. The integer
4986 promotions are performed on the operand, and the result has the promoted type.
4987 <p><!--para 3 -->
4988 The result of the unary - operator is the negative of its (promoted) operand. The integer
4989 promotions are performed on the operand, and the result has the promoted type.
4990 <p><!--para 4 -->
4991 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
4992 each bit in the result is set if and only if the corresponding bit in the converted operand is
4993 not set). The integer promotions are performed on the operand, and the result has the
4994 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
4995 to the maximum value representable in that type minus E.
4996 <p><!--para 5 -->
4997 The result of the logical negation operator ! is 0 if the value of its operand compares
4998 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
4999 The expression !E is equivalent to (0==E).
5003 <!--page 108 -->
5005 <h5><a name="6.5.3.4" href="#6.5.3.4">6.5.3.4 The sizeof and alignof operators</a></h5>
5006 <h6>Constraints</h6>
5007 <p><!--para 1 -->
5008 The sizeof operator shall not be applied to an expression that has function type or an
5009 incomplete type, to the parenthesized name of such a type, or to an expression that
5010 designates a bit-field member. The alignof operator shall not be applied to a function
5011 type or an incomplete type.
5012 <h6>Semantics</h6>
5013 <p><!--para 2 -->
5014 The sizeof operator yields the size (in bytes) of its operand, which may be an
5015 expression or the parenthesized name of a type. The size is determined from the type of
5016 the operand. The result is an integer. If the type of the operand is a variable length array
5017 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
5018 integer constant.
5019 <p><!--para 3 -->
5020 The alignof operator yields the alignment requirement of its operand type. The result
5021 is an integer constant. When applied to an array type, the result is the alignment
5022 requirement of the element type.
5023 <p><!--para 4 -->
5024 When sizeof is applied to an operand that has type char, unsigned char, or
5025 signed char, (or a qualified version thereof) the result is 1. When applied to an
5026 operand that has array type, the result is the total number of bytes in the array.<sup><a href="#note103"><b>103)</b></a></sup> When
5027 applied to an operand that has structure or union type, the result is the total number of
5028 bytes in such an object, including internal and trailing padding.
5029 <p><!--para 5 -->
5030 The value of the result of both operators is implementation-defined, and its type (an
5031 unsigned integer type) is size_t, defined in <a href="#7.19">&lt;stddef.h&gt;</a> (and other headers).
5032 <p><!--para 6 -->
5033 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
5034 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
5035 allocate and return a pointer to void. For example:
5036 <pre>
5037 extern void *alloc(size_t);
5038 double *dp = alloc(sizeof *dp);</pre>
5039 The implementation of the alloc function should ensure that its return value is aligned suitably for
5040 conversion to a pointer to double.
5042 <p><!--para 7 -->
5043 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
5044 <pre>
5045 sizeof array / sizeof array[0]</pre>
5047 <p><!--para 8 -->
5048 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
5049 function:
5050 <pre>
5051 #include <a href="#7.19">&lt;stddef.h&gt;</a></pre>
5055 <!--page 109 -->
5056 <pre>
5057 size_t fsize3(int n)
5059 char b[n+3]; // variable length array
5060 return sizeof b; // execution time sizeof
5062 int main()
5064 size_t size;
5065 size = fsize3(10); // fsize3 returns 13
5066 return 0;
5067 }</pre>
5069 <p><b> Forward references</b>: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), declarations (<a href="#6.7">6.7</a>),
5070 structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), type names (<a href="#6.7.7">6.7.7</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
5072 <h6>footnotes</h6>
5073 <p><small><a name="note103" href="#note103">103)</a> When applied to a parameter declared to have array or function type, the sizeof operator yields the
5074 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
5075 </small>
5077 <h4><a name="6.5.4" href="#6.5.4">6.5.4 Cast operators</a></h4>
5078 <h6>Syntax</h6>
5079 <p><!--para 1 -->
5080 <pre>
5081 cast-expression:
5082 unary-expression
5083 ( type-name ) cast-expression</pre>
5084 <h6>Constraints</h6>
5085 <p><!--para 2 -->
5086 Unless the type name specifies a void type, the type name shall specify atomic, qualified,
5087 or unqualified scalar type, and the operand shall have scalar type.
5088 <p><!--para 3 -->
5089 Conversions that involve pointers, other than where permitted by the constraints of
5090 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
5091 <p><!--para 4 -->
5092 A pointer type shall not be converted to any floating type. A floating type shall not be
5093 converted to any pointer type.
5094 <h6>Semantics</h6>
5095 <p><!--para 5 -->
5096 Preceding an expression by a parenthesized type name converts the value of the
5097 expression to the named type. This construction is called a cast.<sup><a href="#note104"><b>104)</b></a></sup> A cast that specifies
5098 no conversion has no effect on the type or value of an expression.
5099 <p><!--para 6 -->
5100 If the value of the expression is represented with greater precision or range than required
5101 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
5102 type of the expression is the same as the named type and removes any extra range and
5103 precision.
5104 <p><b> Forward references</b>: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
5105 prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>), type names (<a href="#6.7.7">6.7.7</a>).
5107 <!--page 110 -->
5109 <h6>footnotes</h6>
5110 <p><small><a name="note104" href="#note104">104)</a> A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
5111 unqualified version of the type.
5112 </small>
5114 <h4><a name="6.5.5" href="#6.5.5">6.5.5 Multiplicative operators</a></h4>
5115 <h6>Syntax</h6>
5116 <p><!--para 1 -->
5117 <pre>
5118 multiplicative-expression:
5119 cast-expression
5120 multiplicative-expression * cast-expression
5121 multiplicative-expression / cast-expression
5122 multiplicative-expression % cast-expression</pre>
5123 <h6>Constraints</h6>
5124 <p><!--para 2 -->
5125 Each of the operands shall have arithmetic type. The operands of the % operator shall
5126 have integer type.
5127 <h6>Semantics</h6>
5128 <p><!--para 3 -->
5129 The usual arithmetic conversions are performed on the operands.
5130 <p><!--para 4 -->
5131 The result of the binary * operator is the product of the operands.
5132 <p><!--para 5 -->
5133 The result of the / operator is the quotient from the division of the first operand by the
5134 second; the result of the % operator is the remainder. In both operations, if the value of
5135 the second operand is zero, the behavior is undefined.
5136 <p><!--para 6 -->
5137 When integers are divided, the result of the / operator is the algebraic quotient with any
5138 fractional part discarded.<sup><a href="#note105"><b>105)</b></a></sup> If the quotient a/b is representable, the expression
5139 (a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is
5140 undefined.
5142 <h6>footnotes</h6>
5143 <p><small><a name="note105" href="#note105">105)</a> This is often called ''truncation toward zero''.
5144 </small>
5146 <h4><a name="6.5.6" href="#6.5.6">6.5.6 Additive operators</a></h4>
5147 <h6>Syntax</h6>
5148 <p><!--para 1 -->
5149 <pre>
5150 additive-expression:
5151 multiplicative-expression
5152 additive-expression + multiplicative-expression
5153 additive-expression - multiplicative-expression</pre>
5154 <h6>Constraints</h6>
5155 <p><!--para 2 -->
5156 For addition, either both operands shall have arithmetic type, or one operand shall be a
5157 pointer to a complete object type and the other shall have integer type. (Incrementing is
5158 equivalent to adding 1.)
5159 <p><!--para 3 -->
5160 For subtraction, one of the following shall hold:
5165 <!--page 111 -->
5166 <ul>
5167 <li> both operands have arithmetic type;
5168 <li> both operands are pointers to qualified or unqualified versions of compatible complete
5169 object types; or
5170 <li> the left operand is a pointer to a complete object type and the right operand has
5171 integer type.
5172 </ul>
5173 (Decrementing is equivalent to subtracting 1.)
5174 <h6>Semantics</h6>
5175 <p><!--para 4 -->
5176 If both operands have arithmetic type, the usual arithmetic conversions are performed on
5177 them.
5178 <p><!--para 5 -->
5179 The result of the binary + operator is the sum of the operands.
5180 <p><!--para 6 -->
5181 The result of the binary - operator is the difference resulting from the subtraction of the
5182 second operand from the first.
5183 <p><!--para 7 -->
5184 For the purposes of these operators, a pointer to an object that is not an element of an
5185 array behaves the same as a pointer to the first element of an array of length one with the
5186 type of the object as its element type.
5187 <p><!--para 8 -->
5188 When an expression that has integer type is added to or subtracted from a pointer, the
5189 result has the type of the pointer operand. If the pointer operand points to an element of
5190 an array object, and the array is large enough, the result points to an element offset from
5191 the original element such that the difference of the subscripts of the resulting and original
5192 array elements equals the integer expression. In other words, if the expression P points to
5193 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
5194 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
5195 the array object, provided they exist. Moreover, if the expression P points to the last
5196 element of an array object, the expression (P)+1 points one past the last element of the
5197 array object, and if the expression Q points one past the last element of an array object,
5198 the expression (Q)-1 points to the last element of the array object. If both the pointer
5199 operand and the result point to elements of the same array object, or one past the last
5200 element of the array object, the evaluation shall not produce an overflow; otherwise, the
5201 behavior is undefined. If the result points one past the last element of the array object, it
5202 shall not be used as the operand of a unary * operator that is evaluated.
5203 <p><!--para 9 -->
5204 When two pointers are subtracted, both shall point to elements of the same array object,
5205 or one past the last element of the array object; the result is the difference of the
5206 subscripts of the two array elements. The size of the result is implementation-defined,
5207 and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.19">&lt;stddef.h&gt;</a> header.
5208 If the result is not representable in an object of that type, the behavior is undefined. In
5209 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
5210 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
5211 <!--page 112 -->
5212 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
5213 an array object or one past the last element of an array object, and the expression Q points
5214 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
5215 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
5216 expression P points one past the last element of the array object, even though the
5217 expression (Q)+1 does not point to an element of the array object.<sup><a href="#note106"><b>106)</b></a></sup>
5218 <p><!--para 10 -->
5219 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
5220 <p><!--para 11 -->
5221 <pre>
5223 int n = 4, m = 3;
5224 int a[n][m];
5225 int (*p)[m] = a; // p == &amp;a[0]
5226 p += 1; // p == &amp;a[1]
5227 (*p)[2] = 99; // a[1][2] == 99
5228 n = p - a; // n == 1
5229 }</pre>
5230 If array a in the above example were declared to be an array of known constant size, and pointer p were
5231 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
5232 the same.
5234 <p><b> Forward references</b>: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), common definitions <a href="#7.19">&lt;stddef.h&gt;</a>
5235 (<a href="#7.19">7.19</a>).
5237 <h6>footnotes</h6>
5238 <p><small><a name="note106" href="#note106">106)</a> Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
5239 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
5240 by the size of the object originally pointed to, and the resulting pointer is converted back to the
5241 original type. For pointer subtraction, the result of the difference between the character pointers is
5242 similarly divided by the size of the object originally pointed to.
5243 When viewed in this way, an implementation need only provide one extra byte (which may overlap
5244 another object in the program) just after the end of the object in order to satisfy the ''one past the last
5245 element'' requirements.
5246 </small>
5248 <h4><a name="6.5.7" href="#6.5.7">6.5.7 Bitwise shift operators</a></h4>
5249 <h6>Syntax</h6>
5250 <p><!--para 1 -->
5251 <pre>
5252 shift-expression:
5253 additive-expression
5254 shift-expression &lt;&lt; additive-expression
5255 shift-expression &gt;&gt; additive-expression</pre>
5256 <h6>Constraints</h6>
5257 <p><!--para 2 -->
5258 Each of the operands shall have integer type.
5259 <h6>Semantics</h6>
5260 <p><!--para 3 -->
5261 The integer promotions are performed on each of the operands. The type of the result is
5262 that of the promoted left operand. If the value of the right operand is negative or is
5264 <!--page 113 -->
5265 greater than or equal to the width of the promoted left operand, the behavior is undefined.
5266 <p><!--para 4 -->
5267 The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
5268 zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
5269 one more than the maximum value representable in the result type. If E1 has a signed
5270 type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
5271 the resulting value; otherwise, the behavior is undefined.
5272 <p><!--para 5 -->
5273 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
5274 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
5275 part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
5276 resulting value is implementation-defined.
5278 <h4><a name="6.5.8" href="#6.5.8">6.5.8 Relational operators</a></h4>
5279 <h6>Syntax</h6>
5280 <p><!--para 1 -->
5281 <pre>
5282 relational-expression:
5283 shift-expression
5284 relational-expression &lt; shift-expression
5285 relational-expression &gt; shift-expression
5286 relational-expression &lt;= shift-expression
5287 relational-expression &gt;= shift-expression</pre>
5288 <h6>Constraints</h6>
5289 <p><!--para 2 -->
5290 One of the following shall hold:
5291 <ul>
5292 <li> both operands have real type; or *
5293 <li> both operands are pointers to qualified or unqualified versions of compatible object
5294 types.
5295 </ul>
5296 <h6>Semantics</h6>
5297 <p><!--para 3 -->
5298 If both of the operands have arithmetic type, the usual arithmetic conversions are
5299 performed.
5300 <p><!--para 4 -->
5301 For the purposes of these operators, a pointer to an object that is not an element of an
5302 array behaves the same as a pointer to the first element of an array of length one with the
5303 type of the object as its element type.
5304 <p><!--para 5 -->
5305 When two pointers are compared, the result depends on the relative locations in the
5306 address space of the objects pointed to. If two pointers to object types both point to the
5307 same object, or both point one past the last element of the same array object, they
5308 compare equal. If the objects pointed to are members of the same aggregate object,
5309 pointers to structure members declared later compare greater than pointers to members
5310 declared earlier in the structure, and pointers to array elements with larger subscript
5311 values compare greater than pointers to elements of the same array with lower subscript
5312 <!--page 114 -->
5313 values. All pointers to members of the same union object compare equal. If the
5314 expression P points to an element of an array object and the expression Q points to the
5315 last element of the same array object, the pointer expression Q+1 compares greater than
5316 P. In all other cases, the behavior is undefined.
5317 <p><!--para 6 -->
5318 Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
5319 (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is
5320 false.<sup><a href="#note107"><b>107)</b></a></sup> The result has type int.
5322 <h6>footnotes</h6>
5323 <p><small><a name="note107" href="#note107">107)</a> The expression a&lt;b&lt;c is not interpreted as in ordinary mathematics. As the syntax indicates, it
5324 means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
5325 </small>
5327 <h4><a name="6.5.9" href="#6.5.9">6.5.9 Equality operators</a></h4>
5328 <h6>Syntax</h6>
5329 <p><!--para 1 -->
5330 <pre>
5331 equality-expression:
5332 relational-expression
5333 equality-expression == relational-expression
5334 equality-expression != relational-expression</pre>
5335 <h6>Constraints</h6>
5336 <p><!--para 2 -->
5337 One of the following shall hold:
5338 <ul>
5339 <li> both operands have arithmetic type;
5340 <li> both operands are pointers to qualified or unqualified versions of compatible types;
5341 <li> one operand is a pointer to an object type and the other is a pointer to a qualified or
5342 unqualified version of void; or
5343 <li> one operand is a pointer and the other is a null pointer constant.
5344 </ul>
5345 <h6>Semantics</h6>
5346 <p><!--para 3 -->
5347 The == (equal to) and != (not equal to) operators are analogous to the relational
5348 operators except for their lower precedence.<sup><a href="#note108"><b>108)</b></a></sup> Each of the operators yields 1 if the
5349 specified relation is true and 0 if it is false. The result has type int. For any pair of
5350 operands, exactly one of the relations is true.
5351 <p><!--para 4 -->
5352 If both of the operands have arithmetic type, the usual arithmetic conversions are
5353 performed. Values of complex types are equal if and only if both their real parts are equal
5354 and also their imaginary parts are equal. Any two values of arithmetic types from
5355 different type domains are equal if and only if the results of their conversions to the
5356 (complex) result type determined by the usual arithmetic conversions are equal.
5360 <!--page 115 -->
5361 <p><!--para 5 -->
5362 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
5363 null pointer constant, the null pointer constant is converted to the type of the pointer. If
5364 one operand is a pointer to an object type and the other is a pointer to a qualified or
5365 unqualified version of void, the former is converted to the type of the latter.
5366 <p><!--para 6 -->
5367 Two pointers compare equal if and only if both are null pointers, both are pointers to the
5368 same object (including a pointer to an object and a subobject at its beginning) or function,
5369 both are pointers to one past the last element of the same array object, or one is a pointer
5370 to one past the end of one array object and the other is a pointer to the start of a different
5371 array object that happens to immediately follow the first array object in the address
5372 space.<sup><a href="#note109"><b>109)</b></a></sup>
5373 <p><!--para 7 -->
5374 For the purposes of these operators, a pointer to an object that is not an element of an
5375 array behaves the same as a pointer to the first element of an array of length one with the
5376 type of the object as its element type.
5378 <h6>footnotes</h6>
5379 <p><small><a name="note108" href="#note108">108)</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.
5380 </small>
5381 <p><small><a name="note109" href="#note109">109)</a> Two objects may be adjacent in memory because they are adjacent elements of a larger array or
5382 adjacent members of a structure with no padding between them, or because the implementation chose
5383 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
5384 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
5385 behavior.
5386 </small>
5388 <h4><a name="6.5.10" href="#6.5.10">6.5.10 Bitwise AND operator</a></h4>
5389 <h6>Syntax</h6>
5390 <p><!--para 1 -->
5391 <pre>
5392 AND-expression:
5393 equality-expression
5394 AND-expression &amp; equality-expression</pre>
5395 <h6>Constraints</h6>
5396 <p><!--para 2 -->
5397 Each of the operands shall have integer type.
5398 <h6>Semantics</h6>
5399 <p><!--para 3 -->
5400 The usual arithmetic conversions are performed on the operands.
5401 <p><!--para 4 -->
5402 The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
5403 the result is set if and only if each of the corresponding bits in the converted operands is
5404 set).
5409 <!--page 116 -->
5411 <h4><a name="6.5.11" href="#6.5.11">6.5.11 Bitwise exclusive OR operator</a></h4>
5412 <h6>Syntax</h6>
5413 <p><!--para 1 -->
5414 <pre>
5415 exclusive-OR-expression:
5416 AND-expression
5417 exclusive-OR-expression ^ AND-expression</pre>
5418 <h6>Constraints</h6>
5419 <p><!--para 2 -->
5420 Each of the operands shall have integer type.
5421 <h6>Semantics</h6>
5422 <p><!--para 3 -->
5423 The usual arithmetic conversions are performed on the operands.
5424 <p><!--para 4 -->
5425 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
5426 in the result is set if and only if exactly one of the corresponding bits in the converted
5427 operands is set).
5429 <h4><a name="6.5.12" href="#6.5.12">6.5.12 Bitwise inclusive OR operator</a></h4>
5430 <h6>Syntax</h6>
5431 <p><!--para 1 -->
5432 <pre>
5433 inclusive-OR-expression:
5434 exclusive-OR-expression
5435 inclusive-OR-expression | exclusive-OR-expression</pre>
5436 <h6>Constraints</h6>
5437 <p><!--para 2 -->
5438 Each of the operands shall have integer type.
5439 <h6>Semantics</h6>
5440 <p><!--para 3 -->
5441 The usual arithmetic conversions are performed on the operands.
5442 <p><!--para 4 -->
5443 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
5444 the result is set if and only if at least one of the corresponding bits in the converted
5445 operands is set).
5446 <!--page 117 -->
5448 <h4><a name="6.5.13" href="#6.5.13">6.5.13 Logical AND operator</a></h4>
5449 <h6>Syntax</h6>
5450 <p><!--para 1 -->
5451 <pre>
5452 logical-AND-expression:
5453 inclusive-OR-expression
5454 logical-AND-expression &amp;&amp; inclusive-OR-expression</pre>
5455 <h6>Constraints</h6>
5456 <p><!--para 2 -->
5457 Each of the operands shall have scalar type.
5458 <h6>Semantics</h6>
5459 <p><!--para 3 -->
5460 The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
5461 yields 0. The result has type int.
5462 <p><!--para 4 -->
5463 Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
5464 if the second operand is evaluated, there is a sequence point between the evaluations of
5465 the first and second operands. If the first operand compares equal to 0, the second
5466 operand is not evaluated.
5468 <h4><a name="6.5.14" href="#6.5.14">6.5.14 Logical OR operator</a></h4>
5469 <h6>Syntax</h6>
5470 <p><!--para 1 -->
5471 <pre>
5472 logical-OR-expression:
5473 logical-AND-expression
5474 logical-OR-expression || logical-AND-expression</pre>
5475 <h6>Constraints</h6>
5476 <p><!--para 2 -->
5477 Each of the operands shall have scalar type.
5478 <h6>Semantics</h6>
5479 <p><!--para 3 -->
5480 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
5481 yields 0. The result has type int.
5482 <p><!--para 4 -->
5483 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; if the
5484 second operand is evaluated, there is a sequence point between the evaluations of the first
5485 and second operands. If the first operand compares unequal to 0, the second operand is
5486 not evaluated.
5487 <!--page 118 -->
5489 <h4><a name="6.5.15" href="#6.5.15">6.5.15 Conditional operator</a></h4>
5490 <h6>Syntax</h6>
5491 <p><!--para 1 -->
5492 <pre>
5493 conditional-expression:
5494 logical-OR-expression
5495 logical-OR-expression ? expression : conditional-expression</pre>
5496 <h6>Constraints</h6>
5497 <p><!--para 2 -->
5498 The first operand shall have scalar type.
5499 <p><!--para 3 -->
5500 One of the following shall hold for the second and third operands:
5501 <ul>
5502 <li> both operands have arithmetic type;
5503 <li> both operands have the same structure or union type;
5504 <li> both operands have void type;
5505 <li> both operands are pointers to qualified or unqualified versions of compatible types;
5506 <li> one operand is a pointer and the other is a null pointer constant; or
5507 <li> one operand is a pointer to an object type and the other is a pointer to a qualified or
5508 unqualified version of void.
5509 </ul>
5510 <h6>Semantics</h6>
5511 <p><!--para 4 -->
5512 The first operand is evaluated; there is a sequence point between its evaluation and the
5513 evaluation of the second or third operand (whichever is evaluated). The second operand
5514 is evaluated only if the first compares unequal to 0; the third operand is evaluated only if
5515 the first compares equal to 0; the result is the value of the second or third operand
5516 (whichever is evaluated), converted to the type described below.<sup><a href="#note110"><b>110)</b></a></sup> *
5517 <p><!--para 5 -->
5518 If both the second and third operands have arithmetic type, the result type that would be
5519 determined by the usual arithmetic conversions, were they applied to those two operands,
5520 is the type of the result. If both the operands have structure or union type, the result has
5521 that type. If both operands have void type, the result has void type.
5522 <p><!--para 6 -->
5523 If both the second and third operands are pointers or one is a null pointer constant and the
5524 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
5525 of the types referenced by both operands. Furthermore, if both operands are pointers to
5526 compatible types or to differently qualified versions of compatible types, the result type is
5527 a pointer to an appropriately qualified version of the composite type; if one operand is a
5528 null pointer constant, the result has the type of the other operand; otherwise, one operand
5529 is a pointer to void or a qualified version of void, in which case the result type is a
5530 pointer to an appropriately qualified version of void.
5532 <!--page 119 -->
5533 <p><!--para 7 -->
5534 EXAMPLE The common type that results when the second and third operands are pointers is determined
5535 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
5536 pointers have compatible types.
5537 <p><!--para 8 -->
5538 Given the declarations
5539 <pre>
5540 const void *c_vp;
5541 void *vp;
5542 const int *c_ip;
5543 volatile int *v_ip;
5544 int *ip;
5545 const char *c_cp;</pre>
5546 the third column in the following table is the common type that is the result of a conditional expression in
5547 which the first two columns are the second and third operands (in either order):
5548 <pre>
5549 c_vp c_ip const void *
5550 v_ip 0 volatile int *
5551 c_ip v_ip const volatile int *
5552 vp c_cp const void *
5553 ip c_ip const int *
5554 vp ip void *</pre>
5557 <h6>footnotes</h6>
5558 <p><small><a name="note110" href="#note110">110)</a> A conditional expression does not yield an lvalue.
5559 </small>
5561 <h4><a name="6.5.16" href="#6.5.16">6.5.16 Assignment operators</a></h4>
5562 <h6>Syntax</h6>
5563 <p><!--para 1 -->
5564 <pre>
5565 assignment-expression:
5566 conditional-expression
5567 unary-expression assignment-operator assignment-expression
5568 assignment-operator: one of
5569 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</pre>
5570 <h6>Constraints</h6>
5571 <p><!--para 2 -->
5572 An assignment operator shall have a modifiable lvalue as its left operand.
5573 <h6>Semantics</h6>
5574 <p><!--para 3 -->
5575 An assignment operator stores a value in the object designated by the left operand. An
5576 assignment expression has the value of the left operand after the assignment,<sup><a href="#note111"><b>111)</b></a></sup> but is not
5577 an lvalue. The type of an assignment expression is the type the left operand would have
5578 after lvalue conversion. The side effect of updating the stored value of the left operand is
5579 sequenced after the value computations of the left and right operands. The evaluations of
5580 the operands are unsequenced.
5585 <!--page 120 -->
5587 <h6>footnotes</h6>
5588 <p><small><a name="note111" href="#note111">111)</a> The implementation is permitted to read the object to determine the value but is not required to, even
5589 when the object has volatile-qualified type.
5590 </small>
5592 <h5><a name="6.5.16.1" href="#6.5.16.1">6.5.16.1 Simple assignment</a></h5>
5593 <h6>Constraints</h6>
5594 <p><!--para 1 -->
5595 One of the following shall hold:<sup><a href="#note112"><b>112)</b></a></sup>
5596 <ul>
5597 <li> the left operand has atomic, qualified, or unqualified arithmetic type, and the right has
5598 arithmetic type;
5599 <li> the left operand has an atomic, qualified, or unqualified version of a structure or union
5600 type compatible with the type of the right;
5601 <li> the left operand has atomic, qualified, or unqualified pointer type, and (considering
5602 the type the left operand would have after lvalue conversion) both operands are
5603 pointers to qualified or unqualified versions of compatible types, and the type pointed
5604 to by the left has all the qualifiers of the type pointed to by the right;
5605 <li> the left operand has atomic, qualified, or unqualified pointer type, and (considering
5606 the type the left operand would have after lvalue conversion) one operand is a pointer
5607 to an object type, and the other is a pointer to a qualified or unqualified version of
5608 void, and the type pointed to by the left has all the qualifiers of the type pointed to
5609 by the right;
5610 <li> the left operand is an atomic, qualified, or unqualified pointer, and the right is a null
5611 pointer constant; or
5612 <li> the left operand has type atomic, qualified, or unqualified _Bool, and the right is a
5613 pointer.
5614 </ul>
5615 <h6>Semantics</h6>
5616 <p><!--para 2 -->
5617 In simple assignment (=), the value of the right operand is converted to the type of the
5618 assignment expression and replaces the value stored in the object designated by the left
5619 operand.
5620 <p><!--para 3 -->
5621 If the value being stored in an object is read from another object that overlaps in any way
5622 the storage of the first object, then the overlap shall be exact and the two objects shall
5623 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
5624 undefined.
5625 <p><!--para 4 -->
5626 EXAMPLE 1 In the program fragment
5631 <!--page 121 -->
5632 <pre>
5633 int f(void);
5634 char c;
5635 /* ... */
5636 if ((c = f()) == -1)
5637 /* ... */</pre>
5638 the int value returned by the function may be truncated when stored in the char, and then converted back
5639 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
5640 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
5641 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
5642 variable c should be declared as int.
5644 <p><!--para 5 -->
5645 EXAMPLE 2 In the fragment:
5646 <pre>
5647 char c;
5648 int i;
5649 long l;
5650 l = (c = i);</pre>
5651 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
5652 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
5653 that is, long int type.
5655 <p><!--para 6 -->
5656 EXAMPLE 3 Consider the fragment:
5657 <pre>
5658 const char **cpp;
5659 char *p;
5660 const char c = 'A';
5661 cpp = &amp;p; // constraint violation
5662 *cpp = &amp;c; // valid
5663 *p = 0; // valid</pre>
5664 The first assignment is unsafe because it would allow the following valid code to attempt to change the
5665 value of the const object c.
5668 <h6>footnotes</h6>
5669 <p><small><a name="note112" href="#note112">112)</a> The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
5670 (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
5671 qualifiers that were applied to the type category of the expression (for example, it removes const but
5672 not volatile from the type int volatile * const).
5673 </small>
5675 <h5><a name="6.5.16.2" href="#6.5.16.2">6.5.16.2 Compound assignment</a></h5>
5676 <h6>Constraints</h6>
5677 <p><!--para 1 -->
5678 For the operators += and -= only, either the left operand shall be an atomic, qualified, or
5679 unqualified pointer to a complete object type, and the right shall have integer type; or the
5680 left operand shall have atomic, qualified, or unqualified arithmetic type, and the right
5681 shall have arithmetic type.
5682 <p><!--para 2 -->
5683 For the other operators, the left operand shall have atomic, qualified, or unqualified
5684 arithmetic type, and (considering the type the left operand would have after lvalue
5685 conversion) each operand shall have arithmetic type consistent with those allowed by the
5686 corresponding binary operator.
5687 <h6>Semantics</h6>
5688 <p><!--para 3 -->
5689 A compound assignment of the form E1 op = E2 is equivalent to the simple assignment
5690 expression E1 = E1 op (E2), except that the lvalue E1 is evaluated only once, and with
5691 respect to an indeterminately-sequenced function call, the operation of a compound
5692 <!--page 122 -->
5693 assignment is a single evaluation. If E1 has an atomic type, compound assignment is a
5694 read-modify-write operation with memory_order_seq_cst memory order
5695 semantics.<sup><a href="#note113"><b>113)</b></a></sup>
5697 <h6>footnotes</h6>
5698 <p><small><a name="note113" href="#note113">113)</a> Where a pointer to an atomic object can be formed, this is equivalent to the following code sequence
5699 where T is the type of E1:
5701 <pre>
5702 T tmp = E1;
5703 T result;
5704 do {
5705 result = tmp op (E2);
5706 } while (!atomic_compare_exchange_strong(&amp;E1, &amp;tmp, result));</pre>
5707 with result being the result of the operation.
5708 </small>
5710 <h4><a name="6.5.17" href="#6.5.17">6.5.17 Comma operator</a></h4>
5711 <h6>Syntax</h6>
5712 <p><!--para 1 -->
5713 <pre>
5714 expression:
5715 assignment-expression
5716 expression , assignment-expression</pre>
5717 <h6>Semantics</h6>
5718 <p><!--para 2 -->
5719 The left operand of a comma operator is evaluated as a void expression; there is a
5720 sequence point between its evaluation and that of the right operand. Then the right
5721 operand is evaluated; the result has its type and value.<sup><a href="#note114"><b>114)</b></a></sup> *
5722 <p><!--para 3 -->
5723 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
5724 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
5725 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
5726 expression of a conditional operator in such contexts. In the function call
5727 <pre>
5728 f(a, (t=3, t+2), c)</pre>
5729 the function has three arguments, the second of which has the value 5.
5731 <p><b> Forward references</b>: initialization (<a href="#6.7.9">6.7.9</a>).
5736 <!--page 123 -->
5738 <h6>footnotes</h6>
5739 <p><small><a name="note114" href="#note114">114)</a> A comma operator does not yield an lvalue.
5740 </small>
5742 <h3><a name="6.6" href="#6.6">6.6 Constant expressions</a></h3>
5743 <h6>Syntax</h6>
5744 <p><!--para 1 -->
5745 <pre>
5746 constant-expression:
5747 conditional-expression</pre>
5748 <h6>Description</h6>
5749 <p><!--para 2 -->
5750 A constant expression can be evaluated during translation rather than runtime, and
5751 accordingly may be used in any place that a constant may be.
5752 <h6>Constraints</h6>
5753 <p><!--para 3 -->
5754 Constant expressions shall not contain assignment, increment, decrement, function-call,
5755 or comma operators, except when they are contained within a subexpression that is not
5756 evaluated.<sup><a href="#note115"><b>115)</b></a></sup>
5757 <p><!--para 4 -->
5758 Each constant expression shall evaluate to a constant that is in the range of representable
5759 values for its type.
5760 <h6>Semantics</h6>
5761 <p><!--para 5 -->
5762 An expression that evaluates to a constant is required in several contexts. If a floating
5763 expression is evaluated in the translation environment, the arithmetic precision and range
5764 shall be at least as great as if the expression were being evaluated in the execution
5765 environment.<sup><a href="#note116"><b>116)</b></a></sup>
5766 <p><!--para 6 -->
5767 An integer constant expression<sup><a href="#note117"><b>117)</b></a></sup> shall have integer type and shall only have operands
5768 that are integer constants, enumeration constants, character constants, sizeof
5769 expressions whose results are integer constants, and floating constants that are the
5770 immediate operands of casts. Cast operators in an integer constant expression shall only
5771 convert arithmetic types to integer types, except as part of an operand to the sizeof
5772 operator.
5773 <p><!--para 7 -->
5774 More latitude is permitted for constant expressions in initializers. Such a constant
5775 expression shall be, or evaluate to, one of the following:
5776 <ul>
5777 <li> an arithmetic constant expression,
5781 <!--page 124 -->
5782 <li> a null pointer constant,
5783 <li> an address constant, or
5784 <li> an address constant for a complete object type plus or minus an integer constant
5785 expression.
5786 </ul>
5787 <p><!--para 8 -->
5788 An arithmetic constant expression shall have arithmetic type and shall only have
5789 operands that are integer constants, floating constants, enumeration constants, character
5790 constants, and sizeof expressions. Cast operators in an arithmetic constant expression
5791 shall only convert arithmetic types to arithmetic types, except as part of an operand to a
5792 sizeof operator whose result is an integer constant.
5793 <p><!--para 9 -->
5794 An address constant is a null pointer, a pointer to an lvalue designating an object of static
5795 storage duration, or a pointer to a function designator; it shall be created explicitly using
5796 the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
5797 an expression of array or function type. The array-subscript [] and member-access .
5798 and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
5799 be used in the creation of an address constant, but the value of an object shall not be
5800 accessed by use of these operators.
5801 <p><!--para 10 -->
5802 An implementation may accept other forms of constant expressions.
5803 <p><!--para 11 -->
5804 The semantic rules for the evaluation of a constant expression are the same as for
5805 nonconstant expressions.<sup><a href="#note118"><b>118)</b></a></sup>
5806 <p><b> Forward references</b>: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), initialization (<a href="#6.7.9">6.7.9</a>).
5811 <!--page 125 -->
5813 <h6>footnotes</h6>
5814 <p><small><a name="note115" href="#note115">115)</a> The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
5815 </small>
5816 <p><small><a name="note116" href="#note116">116)</a> The use of evaluation formats as characterized by FLT_EVAL_METHOD also applies to evaluation in
5817 the translation environment.
5818 </small>
5819 <p><small><a name="note117" href="#note117">117)</a> An integer constant expression is required in a number of contexts such as the size of a bit-field
5820 member of a structure, the value of an enumeration constant, and the size of a non-variable length
5821 array. Further constraints that apply to the integer constant expressions used in conditional-inclusion
5822 preprocessing directives are discussed in <a href="#6.10.1">6.10.1</a>.
5823 </small>
5824 <p><small><a name="note118" href="#note118">118)</a> Thus, in the following initialization,
5826 <pre>
5827 static int i = 2 || 1 / 0;</pre>
5828 the expression is a valid integer constant expression with value one.
5829 </small>
5831 <h3><a name="6.7" href="#6.7">6.7 Declarations</a></h3>
5832 <h6>Syntax</h6>
5833 <p><!--para 1 -->
5834 <pre>
5835 declaration:
5836 declaration-specifiers init-declarator-listopt ;
5837 static_assert-declaration
5838 declaration-specifiers:
5839 storage-class-specifier declaration-specifiersopt
5840 type-specifier declaration-specifiersopt
5841 type-qualifier declaration-specifiersopt
5842 function-specifier declaration-specifiersopt
5843 alignment-specifier declaration-specifiersopt
5844 init-declarator-list:
5845 init-declarator
5846 init-declarator-list , init-declarator
5847 init-declarator:
5848 declarator
5849 declarator = initializer</pre>
5850 <h6>Constraints</h6>
5851 <p><!--para 2 -->
5852 A declaration other than a static_assert declaration shall declare at least a declarator
5853 (other than the parameters of a function or the members of a structure or union), a tag, or
5854 the members of an enumeration.
5855 <p><!--para 3 -->
5856 If an identifier has no linkage, there shall be no more than one declaration of the identifier
5857 (in a declarator or type specifier) with the same scope and in the same name space, except
5858 that a typedef name can be redefined to denote the same type as it currently does and tags
5859 may be redeclared as specified in <a href="#6.7.2.3">6.7.2.3</a>.
5860 <p><!--para 4 -->
5861 All declarations in the same scope that refer to the same object or function shall specify
5862 compatible types.
5863 <h6>Semantics</h6>
5864 <p><!--para 5 -->
5865 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
5866 of an identifier is a declaration for that identifier that:
5867 <ul>
5868 <li> for an object, causes storage to be reserved for that object;
5869 <li> for a function, includes the function body;<sup><a href="#note119"><b>119)</b></a></sup>
5873 <!--page 126 -->
5874 <li> for an enumeration constant or typedef name, is the (only) declaration of the
5875 identifier.
5876 </ul>
5877 <p><!--para 6 -->
5878 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
5879 storage duration, and part of the type of the entities that the declarators denote. The init-
5880 declarator-list is a comma-separated sequence of declarators, each of which may have
5881 additional type information, or an initializer, or both. The declarators contain the
5882 identifiers (if any) being declared.
5883 <p><!--para 7 -->
5884 If an identifier for an object is declared with no linkage, the type for the object shall be
5885 complete by the end of its declarator, or by the end of its init-declarator if it has an
5886 initializer; in the case of function parameters (including in prototypes), it is the adjusted
5887 type (see <a href="#6.7.6.3">6.7.6.3</a>) that is required to be complete.
5888 <p><b> Forward references</b>: declarators (<a href="#6.7.6">6.7.6</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
5889 (<a href="#6.7.9">6.7.9</a>), type names (<a href="#6.7.7">6.7.7</a>), type qualifiers (<a href="#6.7.3">6.7.3</a>).
5891 <h6>footnotes</h6>
5892 <p><small><a name="note119" href="#note119">119)</a> Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
5893 </small>
5895 <h4><a name="6.7.1" href="#6.7.1">6.7.1 Storage-class specifiers</a></h4>
5896 <h6>Syntax</h6>
5897 <p><!--para 1 -->
5898 <pre>
5899 storage-class-specifier:
5900 typedef
5901 extern
5902 static
5903 _Thread_local
5904 auto
5905 register</pre>
5906 <h6>Constraints</h6>
5907 <p><!--para 2 -->
5908 At most, one storage-class specifier may be given in the declaration specifiers in a
5909 declaration, except that _Thread_local may appear with static or extern.<sup><a href="#note120"><b>120)</b></a></sup>
5910 <p><!--para 3 -->
5911 In the declaration of an object with block scope, if the declaration specifiers include
5912 _Thread_local, they shall also include either static or extern. If
5913 _Thread_local appears in any declaration of an object, it shall be present in every
5914 declaration of that object.
5915 <h6>Semantics</h6>
5916 <p><!--para 4 -->
5917 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
5918 only; it is discussed in <a href="#6.7.8">6.7.8</a>. The meanings of the various linkages and storage durations
5919 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
5923 <!--page 127 -->
5924 <p><!--para 5 -->
5925 A declaration of an identifier for an object with storage-class specifier register
5926 suggests that access to the object be as fast as possible. The extent to which such
5927 suggestions are effective is implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
5928 <p><!--para 6 -->
5929 The declaration of an identifier for a function that has block scope shall have no explicit
5930 storage-class specifier other than extern.
5931 <p><!--para 7 -->
5932 If an aggregate or union object is declared with a storage-class specifier other than
5933 typedef, the properties resulting from the storage-class specifier, except with respect to
5934 linkage, also apply to the members of the object, and so on recursively for any aggregate
5935 or union member objects.
5936 <p><b> Forward references</b>: type definitions (<a href="#6.7.8">6.7.8</a>).
5938 <h6>footnotes</h6>
5939 <p><small><a name="note120" href="#note120">120)</a> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
5940 </small>
5941 <p><small><a name="note121" href="#note121">121)</a> The implementation may treat any register declaration simply as an auto declaration. However,
5942 whether or not addressable storage is actually used, the address of any part of an object declared with
5943 storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
5944 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
5945 <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
5946 register is sizeof.
5947 </small>
5949 <h4><a name="6.7.2" href="#6.7.2">6.7.2 Type specifiers</a></h4>
5950 <h6>Syntax</h6>
5951 <p><!--para 1 -->
5952 <pre>
5953 type-specifier:
5954 void
5955 char
5956 short
5958 long
5959 float
5960 double
5961 signed
5962 unsigned
5963 _Bool
5964 _Complex
5965 atomic-type-specifier
5966 struct-or-union-specifier
5967 enum-specifier
5968 typedef-name</pre>
5969 <h6>Constraints</h6>
5970 <p><!--para 2 -->
5971 At least one type specifier shall be given in the declaration specifiers in each declaration,
5972 and in the specifier-qualifier list in each struct declaration and type name. Each list of
5975 <!--page 128 -->
5976 type specifiers shall be one of the following multisets (delimited by commas, when there
5977 is more than one multiset per item); the type specifiers may occur in any order, possibly
5978 intermixed with the other declaration specifiers.
5979 <ul>
5980 <li> void
5981 <li> char
5982 <li> signed char
5983 <li> unsigned char
5984 <li> short, signed short, short int, or signed short int
5985 <li> unsigned short, or unsigned short int
5986 <li> int, signed, or signed int
5987 <li> unsigned, or unsigned int
5988 <li> long, signed long, long int, or signed long int
5989 <li> unsigned long, or unsigned long int
5990 <li> long long, signed long long, long long int, or
5991 signed long long int
5992 <li> unsigned long long, or unsigned long long int
5993 <li> float
5994 <li> double
5995 <li> long double
5996 <li> _Bool
5997 <li> float _Complex
5998 <li> double _Complex
5999 <li> long double _Complex
6000 <li> atomic type specifier
6001 <li> struct or union specifier
6002 <li> enum specifier
6003 <li> typedef name
6004 </ul>
6005 <p><!--para 3 -->
6006 The type specifier _Complex shall not be used if the implementation does not support
6007 complex types (see <a href="#6.10.8.3">6.10.8.3</a>).
6008 <!--page 129 -->
6009 <h6>Semantics</h6>
6010 <p><!--para 4 -->
6011 Specifiers for structures, unions, enumerations, and atomic types are discussed in <a href="#6.7.2.1">6.7.2.1</a>
6012 through <a href="#6.7.2.4">6.7.2.4</a>. Declarations of typedef names are discussed in <a href="#6.7.8">6.7.8</a>. The
6013 characteristics of the other types are discussed in <a href="#6.2.5">6.2.5</a>.
6014 <p><!--para 5 -->
6015 Each of the comma-separated multisets designates the same type, except that for bit-
6016 fields, it is implementation-defined whether the specifier int designates the same type as
6017 signed int or the same type as unsigned int.
6018 <p><b> Forward references</b>: atomic type specifiers (<a href="#6.7.2.4">6.7.2.4</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>),
6019 structure and union specifiers (<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.8">6.7.8</a>).
6021 <h5><a name="6.7.2.1" href="#6.7.2.1">6.7.2.1 Structure and union specifiers</a></h5>
6022 <h6>Syntax</h6>
6023 <p><!--para 1 -->
6024 <pre>
6025 struct-or-union-specifier:
6026 struct-or-union identifieropt { struct-declaration-list }
6027 struct-or-union identifier
6028 struct-or-union:
6029 struct
6030 union
6031 struct-declaration-list:
6032 struct-declaration
6033 struct-declaration-list struct-declaration
6034 struct-declaration:
6035 specifier-qualifier-list struct-declarator-listopt ;
6036 static_assert-declaration
6037 specifier-qualifier-list:
6038 type-specifier specifier-qualifier-listopt
6039 type-qualifier specifier-qualifier-listopt
6040 struct-declarator-list:
6041 struct-declarator
6042 struct-declarator-list , struct-declarator
6043 struct-declarator:
6044 declarator
6045 declaratoropt : constant-expression</pre>
6046 <h6>Constraints</h6>
6047 <p><!--para 2 -->
6048 A struct-declaration that does not declare an anonymous structure or anonymous union
6049 shall contain a struct-declarator-list.
6050 <!--page 130 -->
6051 <p><!--para 3 -->
6052 A structure or union shall not contain a member with incomplete or function type (hence,
6053 a structure shall not contain an instance of itself, but may contain a pointer to an instance
6054 of itself), except that the last member of a structure with more than one named member
6055 may have incomplete array type; such a structure (and any union containing, possibly
6056 recursively, a member that is such a structure) shall not be a member of a structure or an
6057 element of an array.
6058 <p><!--para 4 -->
6059 The expression that specifies the width of a bit-field shall be an integer constant
6060 expression with a nonnegative value that does not exceed the width of an object of the
6061 type that would be specified were the colon and expression omitted.<sup><a href="#note122"><b>122)</b></a></sup> If the value is
6062 zero, the declaration shall have no declarator.
6063 <p><!--para 5 -->
6064 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
6065 int, unsigned int, or some other implementation-defined type. It is
6066 implementation-defined whether atomic types are permitted.
6067 <h6>Semantics</h6>
6068 <p><!--para 6 -->
6069 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
6070 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
6071 of members whose storage overlap.
6072 <p><!--para 7 -->
6073 Structure and union specifiers have the same form. The keywords struct and union
6074 indicate that the type being specified is, respectively, a structure type or a union type.
6075 <p><!--para 8 -->
6076 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
6077 within a translation unit. The struct-declaration-list is a sequence of declarations for the
6078 members of the structure or union. If the struct-declaration-list contains no named
6079 members, no anonymous structures, and no anonymous unions, the behavior is undefined.
6080 The type is incomplete until immediately after the } that terminates the list, and complete
6081 thereafter.
6082 <p><!--para 9 -->
6083 A member of a structure or union may have any complete object type other than a
6084 variably modified type.<sup><a href="#note123"><b>123)</b></a></sup> In addition, a member may be declared to consist of a
6085 specified number of bits (including a sign bit, if any). Such a member is called a
6086 bit-field;<sup><a href="#note124"><b>124)</b></a></sup> its width is preceded by a colon.
6087 <p><!--para 10 -->
6088 A bit-field is interpreted as having a signed or unsigned integer type consisting of the
6089 specified number of bits.<sup><a href="#note125"><b>125)</b></a></sup> If the value 0 or 1 is stored into a nonzero-width bit-field of
6091 <!--page 131 -->
6092 type _Bool, the value of the bit-field shall compare equal to the value stored; a _Bool
6093 bit-field has the semantics of a _Bool.
6094 <p><!--para 11 -->
6095 An implementation may allocate any addressable storage unit large enough to hold a bit-
6096 field. If enough space remains, a bit-field that immediately follows another bit-field in a
6097 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
6098 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
6099 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
6100 low-order or low-order to high-order) is implementation-defined. The alignment of the
6101 addressable storage unit is unspecified.
6102 <p><!--para 12 -->
6103 A bit-field declaration with no declarator, but only a colon and a width, indicates an
6104 unnamed bit-field.<sup><a href="#note126"><b>126)</b></a></sup> As a special case, a bit-field structure member with a width of 0
6105 indicates that no further bit-field is to be packed into the unit in which the previous bit-
6106 field, if any, was placed.
6107 <p><!--para 13 -->
6108 An unnamed member of structure type with no tag is called an anonymous structure; an
6109 unnamed member of union type with no tag is called an anonymous union. The members
6110 of an anonymous structure or union are considered to be members of the containing
6111 structure or union. This applies recursively if the containing structure or union is also
6112 anonymous.
6113 <p><!--para 14 -->
6114 Each non-bit-field member of a structure or union object is aligned in an implementation-
6115 defined manner appropriate to its type.
6116 <p><!--para 15 -->
6117 Within a structure object, the non-bit-field members and the units in which bit-fields
6118 reside have addresses that increase in the order in which they are declared. A pointer to a
6119 structure object, suitably converted, points to its initial member (or if that member is a
6120 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
6121 padding within a structure object, but not at its beginning.
6122 <p><!--para 16 -->
6123 The size of a union is sufficient to contain the largest of its members. The value of at
6124 most one of the members can be stored in a union object at any time. A pointer to a
6125 union object, suitably converted, points to each of its members (or if a member is a bit-
6126 field, then to the unit in which it resides), and vice versa.
6127 <p><!--para 17 -->
6128 There may be unnamed padding at the end of a structure or union.
6129 <p><!--para 18 -->
6130 As a special case, the last element of a structure with more than one named member may
6131 have an incomplete array type; this is called a flexible array member. In most situations,
6134 <!--page 132 -->
6135 the flexible array member is ignored. In particular, the size of the structure is as if the
6136 flexible array member were omitted except that it may have more trailing padding than
6137 the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
6138 (a pointer to) a structure with a flexible array member and the right operand names that
6139 member, it behaves as if that member were replaced with the longest array (with the same
6140 element type) that would not make the structure larger than the object being accessed; the
6141 offset of the array shall remain that of the flexible array member, even if this would differ
6142 from that of the replacement array. If this array would have no elements, it behaves as if
6143 it had one element but the behavior is undefined if any attempt is made to access that
6144 element or to generate a pointer one past it.
6145 <p><!--para 19 -->
6146 EXAMPLE 1 The following illustrates anonymous structures and unions:
6147 <pre>
6148 struct v {
6149 union { // anonymous union
6150 struct { int i, j; }; // anonymous structure
6151 struct { long k, l; } w;
6153 int m;
6154 } v1;
6155 v1.i = 2; // valid
6156 v1.k = 3; // invalid: inner structure is not anonymous
6157 v1.w.k = 5; // valid</pre>
6159 <p><!--para 20 -->
6160 EXAMPLE 2 After the declaration:
6161 <pre>
6162 struct s { int n; double d[]; };</pre>
6163 the structure struct s has a flexible array member d. A typical way to use this is:
6164 <pre>
6165 int m = /* some value */;
6166 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));</pre>
6167 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
6168 p had been declared as:
6169 <pre>
6170 struct { int n; double d[m]; } *p;</pre>
6171 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
6172 not be the same).
6173 <p><!--para 21 -->
6174 Following the above declaration:
6175 <pre>
6176 struct s t1 = { 0 }; // valid
6177 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
6178 t1.n = 4; // valid
6179 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior</pre>
6180 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
6181 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
6182 <pre>
6183 sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)</pre>
6184 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
6185 code.
6186 <!--page 133 -->
6187 <p><!--para 22 -->
6188 After the further declaration:
6189 <pre>
6190 struct ss { int n; };</pre>
6191 the expressions:
6192 <pre>
6193 sizeof (struct s) &gt;= sizeof (struct ss)
6194 sizeof (struct s) &gt;= offsetof(struct s, d)</pre>
6195 are always equal to 1.
6196 <p><!--para 23 -->
6197 If sizeof (double) is 8, then after the following code is executed:
6198 <pre>
6199 struct s *s1;
6200 struct s *s2;
6201 s1 = malloc(sizeof (struct s) + 64);
6202 s2 = malloc(sizeof (struct s) + 46);</pre>
6203 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
6204 purposes, as if the identifiers had been declared as:
6205 <p><!--para 24 -->
6206 <pre>
6207 struct { int n; double d[8]; } *s1;
6208 struct { int n; double d[5]; } *s2;</pre>
6209 Following the further successful assignments:
6210 <pre>
6211 s1 = malloc(sizeof (struct s) + 10);
6212 s2 = malloc(sizeof (struct s) + 6);</pre>
6213 they then behave as if the declarations were:
6214 <pre>
6215 struct { int n; double d[1]; } *s1, *s2;</pre>
6216 and:
6217 <p><!--para 25 -->
6218 <pre>
6219 double *dp;
6220 dp = &amp;(s1-&gt;d[0]); // valid
6221 *dp = 42; // valid
6222 dp = &amp;(s2-&gt;d[0]); // valid
6223 *dp = 42; // undefined behavior</pre>
6224 The assignment:
6225 <pre>
6226 *s1 = *s2;</pre>
6227 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
6228 of the structure, they might be copied or simply overwritten with indeterminate values.
6230 <p><b> Forward references</b>: declarators (<a href="#6.7.6">6.7.6</a>), tags (<a href="#6.7.2.3">6.7.2.3</a>).
6231 <!--page 134 -->
6233 <h6>footnotes</h6>
6234 <p><small><a name="note122" href="#note122">122)</a> While the number of bits in a _Bool object is at least CHAR_BIT, the width (number of sign and
6235 value bits) of a _Bool may be just 1 bit.
6236 </small>
6237 <p><small><a name="note123" href="#note123">123)</a> A structure or union cannot contain a member with a variably modified type because member names
6238 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
6239 </small>
6240 <p><small><a name="note124" href="#note124">124)</a> The unary &amp; (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
6241 or arrays of bit-field objects.
6242 </small>
6243 <p><small><a name="note125" href="#note125">125)</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,
6244 then it is implementation-defined whether the bit-field is signed or unsigned.
6245 </small>
6246 <p><small><a name="note126" href="#note126">126)</a> An unnamed bit-field structure member is useful for padding to conform to externally imposed
6247 layouts.
6248 </small>
6250 <h5><a name="6.7.2.2" href="#6.7.2.2">6.7.2.2 Enumeration specifiers</a></h5>
6251 <h6>Syntax</h6>
6252 <p><!--para 1 -->
6253 <pre>
6254 enum-specifier:
6255 enum identifieropt { enumerator-list }
6256 enum identifieropt { enumerator-list , }
6257 enum identifier
6258 enumerator-list:
6259 enumerator
6260 enumerator-list , enumerator
6261 enumerator:
6262 enumeration-constant
6263 enumeration-constant = constant-expression</pre>
6264 <h6>Constraints</h6>
6265 <p><!--para 2 -->
6266 The expression that defines the value of an enumeration constant shall be an integer
6267 constant expression that has a value representable as an int.
6268 <h6>Semantics</h6>
6269 <p><!--para 3 -->
6270 The identifiers in an enumerator list are declared as constants that have type int and
6271 may appear wherever such are permitted.<sup><a href="#note127"><b>127)</b></a></sup> An enumerator with = defines its
6272 enumeration constant as the value of the constant expression. If the first enumerator has
6273 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
6274 defines its enumeration constant as the value of the constant expression obtained by
6275 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
6276 = may produce enumeration constants with values that duplicate other values in the same
6277 enumeration.) The enumerators of an enumeration are also known as its members.
6278 <p><!--para 4 -->
6279 Each enumerated type shall be compatible with char, a signed integer type, or an
6280 unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note128"><b>128)</b></a></sup> but shall be
6281 capable of representing the values of all the members of the enumeration. The
6282 enumerated type is incomplete until immediately after the } that terminates the list of
6283 enumerator declarations, and complete thereafter.
6288 <!--page 135 -->
6289 <p><!--para 5 -->
6290 EXAMPLE The following fragment:
6291 <pre>
6292 enum hue { chartreuse, burgundy, claret=20, winedark };
6293 enum hue col, *cp;
6294 col = claret;
6295 cp = &amp;col;
6296 if (*cp != burgundy)
6297 /* ... */</pre>
6298 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
6299 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
6301 <p><b> Forward references</b>: tags (<a href="#6.7.2.3">6.7.2.3</a>).
6303 <h6>footnotes</h6>
6304 <p><small><a name="note127" href="#note127">127)</a> Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
6305 each other and from other identifiers declared in ordinary declarators.
6306 </small>
6307 <p><small><a name="note128" href="#note128">128)</a> An implementation may delay the choice of which integer type until all enumeration constants have
6308 been seen.
6309 </small>
6311 <h5><a name="6.7.2.3" href="#6.7.2.3">6.7.2.3 Tags</a></h5>
6312 <h6>Constraints</h6>
6313 <p><!--para 1 -->
6314 A specific type shall have its content defined at most once.
6315 <p><!--para 2 -->
6316 Where two declarations that use the same tag declare the same type, they shall both use
6317 the same choice of struct, union, or enum.
6318 <p><!--para 3 -->
6319 A type specifier of the form
6320 <pre>
6321 enum identifier</pre>
6322 without an enumerator list shall only appear after the type it specifies is complete.
6323 <h6>Semantics</h6>
6324 <p><!--para 4 -->
6325 All declarations of structure, union, or enumerated types that have the same scope and
6326 use the same tag declare the same type. Irrespective of whether there is a tag or what
6327 other declarations of the type are in the same translation unit, the type is incomplete<sup><a href="#note129"><b>129)</b></a></sup>
6328 until immediately after the closing brace of the list defining the content, and complete
6329 thereafter.
6330 <p><!--para 5 -->
6331 Two declarations of structure, union, or enumerated types which are in different scopes or
6332 use different tags declare distinct types. Each declaration of a structure, union, or
6333 enumerated type which does not include a tag declares a distinct type.
6334 <p><!--para 6 -->
6335 A type specifier of the form
6340 <!--page 136 -->
6341 <pre>
6342 struct-or-union identifieropt { struct-declaration-list }</pre>
6344 <pre>
6345 enum identifieropt { enumerator-list }</pre>
6347 <pre>
6348 enum identifieropt { enumerator-list , }</pre>
6349 declares a structure, union, or enumerated type. The list defines the structure content,
6350 union content, or enumeration content. If an identifier is provided,<sup><a href="#note130"><b>130)</b></a></sup> the type specifier
6351 also declares the identifier to be the tag of that type.
6352 <p><!--para 7 -->
6353 A declaration of the form
6354 <pre>
6355 struct-or-union identifier ;</pre>
6356 specifies a structure or union type and declares the identifier as a tag of that type.<sup><a href="#note131"><b>131)</b></a></sup>
6357 <p><!--para 8 -->
6358 If a type specifier of the form
6359 <pre>
6360 struct-or-union identifier</pre>
6361 occurs other than as part of one of the above forms, and no other declaration of the
6362 identifier as a tag is visible, then it declares an incomplete structure or union type, and
6363 declares the identifier as the tag of that type.<sup><a href="#note131"><b>131)</b></a></sup>
6364 <p><!--para 9 -->
6365 If a type specifier of the form
6366 <pre>
6367 struct-or-union identifier</pre>
6369 <pre>
6370 enum identifier</pre>
6371 occurs other than as part of one of the above forms, and a declaration of the identifier as a
6372 tag is visible, then it specifies the same type as that other declaration, and does not
6373 redeclare the tag.
6374 <p><!--para 10 -->
6375 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
6376 <pre>
6377 struct tnode {
6378 int count;
6379 struct tnode *left, *right;
6380 };</pre>
6381 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
6382 declaration has been given, the declaration
6387 <!--page 137 -->
6388 <pre>
6389 struct tnode s, *sp;</pre>
6390 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
6391 these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
6392 which sp points; the expression s.right-&gt;count designates the count member of the right struct
6393 tnode pointed to from s.
6394 <p><!--para 11 -->
6395 The following alternative formulation uses the typedef mechanism:
6396 <pre>
6397 typedef struct tnode TNODE;
6398 struct tnode {
6399 int count;
6400 TNODE *left, *right;
6402 TNODE s, *sp;</pre>
6404 <p><!--para 12 -->
6405 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
6406 structures, the declarations
6407 <pre>
6408 struct s1 { struct s2 *s2p; /* ... */ }; // D1
6409 struct s2 { struct s1 *s1p; /* ... */ }; // D2</pre>
6410 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
6411 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
6412 D2. To eliminate this context sensitivity, the declaration
6413 <pre>
6414 struct s2;</pre>
6415 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
6416 completes the specification of the new type.
6418 <p><b> Forward references</b>: declarators (<a href="#6.7.6">6.7.6</a>), type definitions (<a href="#6.7.8">6.7.8</a>).
6420 <h6>footnotes</h6>
6421 <p><small><a name="note129" href="#note129">129)</a> An incomplete type may only by used when the size of an object of that type is not needed. It is not
6422 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
6423 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
6424 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
6425 </small>
6426 <p><small><a name="note130" href="#note130">130)</a> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
6427 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
6428 can make use of that typedef name to declare objects having the specified structure, union, or
6429 enumerated type.
6430 </small>
6431 <p><small><a name="note131" href="#note131">131)</a> A similar construction with enum does not exist.
6432 </small>
6434 <h5><a name="6.7.2.4" href="#6.7.2.4">6.7.2.4 Atomic type specifiers</a></h5>
6435 <h6>Syntax</h6>
6436 <p><!--para 1 -->
6437 <pre>
6438 atomic-type-specifier:
6439 _Atomic ( type-name )</pre>
6440 <h6>Constraints</h6>
6441 <p><!--para 2 -->
6442 Atomic type specifiers shall not be used if the implementation does not support atomic
6443 types (see <a href="#6.10.8.3">6.10.8.3</a>).
6444 <p><!--para 3 -->
6445 The type name in an atomic type specifier shall not refer to an array type, a function type,
6446 an atomic type, or a qualified type.
6447 <h6>Semantics</h6>
6448 <p><!--para 4 -->
6449 The properties associated with atomic types are meaningful only for expressions that are
6450 lvalues. If the _Atomic keyword is immediately followed by a left parenthesis, it is
6451 interpreted as a type specifier (with a type name), not as a type qualifier.
6452 <!--page 138 -->
6454 <h4><a name="6.7.3" href="#6.7.3">6.7.3 Type qualifiers</a></h4>
6455 <h6>Syntax</h6>
6456 <p><!--para 1 -->
6457 <pre>
6458 type-qualifier:
6459 const
6460 restrict
6461 volatile
6462 _Atomic</pre>
6463 <h6>Constraints</h6>
6464 <p><!--para 2 -->
6465 Types other than pointer types whose referenced type is an object type shall not be
6466 restrict-qualified.
6467 <p><!--para 3 -->
6468 The type modified by the _Atomic qualifier shall not be an array type or a function
6469 type.
6470 <h6>Semantics</h6>
6471 <p><!--para 4 -->
6472 The properties associated with qualified types are meaningful only for expressions that
6473 are lvalues.<sup><a href="#note132"><b>132)</b></a></sup>
6474 <p><!--para 5 -->
6475 If the same qualifier appears more than once in the same specifier-qualifier-list, either
6476 directly or via one or more typedefs, the behavior is the same as if it appeared only
6477 once. If other qualifiers appear along with the _Atomic qualifier in a specifier-qualifier-
6478 list, the resulting type is the so-qualified atomic type.
6479 <p><!--para 6 -->
6480 If an attempt is made to modify an object defined with a const-qualified type through use
6481 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
6482 made to refer to an object defined with a volatile-qualified type through use of an lvalue
6483 with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note133"><b>133)</b></a></sup>
6484 <p><!--para 7 -->
6485 An object that has volatile-qualified type may be modified in ways unknown to the
6486 implementation or have other unknown side effects. Therefore any expression referring
6487 to such an object shall be evaluated strictly according to the rules of the abstract machine,
6488 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
6489 object shall agree with that prescribed by the abstract machine, except as modified by the
6494 <!--page 139 -->
6495 unknown factors mentioned previously.<sup><a href="#note134"><b>134)</b></a></sup> What constitutes an access to an object that
6496 has volatile-qualified type is implementation-defined.
6497 <p><!--para 8 -->
6498 An object that is accessed through a restrict-qualified pointer has a special association
6499 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
6500 that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note135"><b>135)</b></a></sup> The intended
6501 use of the restrict qualifier (like the register storage class) is to promote
6502 optimization, and deleting all instances of the qualifier from all preprocessing translation
6503 units composing a conforming program does not change its meaning (i.e., observable
6504 behavior).
6505 <p><!--para 9 -->
6506 If the specification of an array type includes any type qualifiers, the element type is so-
6507 qualified, not the array type. If the specification of a function type includes any type
6508 qualifiers, the behavior is undefined.<sup><a href="#note136"><b>136)</b></a></sup>
6509 <p><!--para 10 -->
6510 For two qualified types to be compatible, both shall have the identically qualified version
6511 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
6512 does not affect the specified type.
6513 <p><!--para 11 -->
6514 EXAMPLE 1 An object declared
6515 <pre>
6516 extern const volatile int real_time_clock;</pre>
6517 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
6519 <p><!--para 12 -->
6520 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
6521 modify an aggregate type:
6522 <pre>
6523 const struct s { int mem; } cs = { 1 };
6524 struct s ncs; // the object ncs is modifiable
6525 typedef int A[2][3];
6526 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
6527 int *pi;
6528 const int *pci;
6529 ncs = cs; // valid
6530 cs = ncs; // violates modifiable lvalue constraint for =
6531 pi = &amp;ncs.mem; // valid
6532 pi = &amp;cs.mem; // violates type constraints for =
6533 pci = &amp;cs.mem; // valid
6534 pi = a[0]; // invalid: a[0] has type ''const int *''</pre>
6538 <!--page 140 -->
6539 <p><!--para 13 -->
6540 EXAMPLE 3 The declaration
6541 <pre>
6542 _Atomic volatile int *p;</pre>
6543 specifies that p has the type ''pointer to volatile atomic int'', a pointer to a volatile-qualified atomic type.
6546 <h6>footnotes</h6>
6547 <p><small><a name="note132" href="#note132">132)</a> The implementation may place a const object that is not volatile in a read-only region of
6548 storage. Moreover, the implementation need not allocate storage for such an object if its address is
6549 never used.
6550 </small>
6551 <p><small><a name="note133" href="#note133">133)</a> This applies to those objects that behave as if they were defined with qualified types, even if they are
6552 never actually defined as objects in the program (such as an object at a memory-mapped input/output
6553 address).
6554 </small>
6555 <p><small><a name="note134" href="#note134">134)</a> A volatile declaration may be used to describe an object corresponding to a memory-mapped
6556 input/output port or an object accessed by an asynchronously interrupting function. Actions on
6557 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
6558 permitted by the rules for evaluating expressions.
6559 </small>
6560 <p><small><a name="note135" href="#note135">135)</a> For example, a statement that assigns a value returned by malloc to a single pointer establishes this
6561 association between the allocated object and the pointer.
6562 </small>
6563 <p><small><a name="note136" href="#note136">136)</a> Both of these can occur through the use of typedefs.
6564 </small>
6566 <h5><a name="6.7.3.1" href="#6.7.3.1">6.7.3.1 Formal definition of restrict</a></h5>
6567 <p><!--para 1 -->
6568 Let D be a declaration of an ordinary identifier that provides a means of designating an
6569 object P as a restrict-qualified pointer to type T.
6570 <p><!--para 2 -->
6571 If D appears inside a block and does not have storage class extern, let B denote the
6572 block. If D appears in the list of parameter declarations of a function definition, let B
6573 denote the associated block. Otherwise, let B denote the block of main (or the block of
6574 whatever function is called at program startup in a freestanding environment).
6575 <p><!--para 3 -->
6576 In what follows, a pointer expression E is said to be based on object P if (at some
6577 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
6578 a copy of the array object into which it formerly pointed would change the value of E.<sup><a href="#note137"><b>137)</b></a></sup>
6579 Note that ''based'' is defined only for expressions with pointer types.
6580 <p><!--para 4 -->
6581 During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
6582 access the value of the object X that it designates, and X is also modified (by any means),
6583 then the following requirements apply: T shall not be const-qualified. Every other lvalue
6584 used to access the value of X shall also have its address based on P. Every access that
6585 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
6586 is assigned the value of a pointer expression E that is based on another restricted pointer
6587 object P2, associated with block B2, then either the execution of B2 shall begin before
6588 the execution of B, or the execution of B2 shall end prior to the assignment. If these
6589 requirements are not met, then the behavior is undefined.
6590 <p><!--para 5 -->
6591 Here an execution of B means that portion of the execution of the program that would
6592 correspond to the lifetime of an object with scalar type and automatic storage duration
6593 associated with B.
6594 <p><!--para 6 -->
6595 A translator is free to ignore any or all aliasing implications of uses of restrict.
6596 <p><!--para 7 -->
6597 EXAMPLE 1 The file scope declarations
6598 <pre>
6599 int * restrict a;
6600 int * restrict b;
6601 extern int c[];</pre>
6602 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
6603 program, then it is never accessed using either of the other two.
6606 <!--page 141 -->
6607 <p><!--para 8 -->
6608 EXAMPLE 2 The function parameter declarations in the following example
6609 <pre>
6610 void f(int n, int * restrict p, int * restrict q)
6612 while (n-- &gt; 0)
6613 *p++ = *q++;
6614 }</pre>
6615 assert that, during each execution of the function, if an object is accessed through one of the pointer
6616 parameters, then it is not also accessed through the other.
6617 <p><!--para 9 -->
6618 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
6619 analysis of function f without examining any of the calls of f in the program. The cost is that the
6620 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
6621 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
6622 both p and q.
6623 <pre>
6624 void g(void)
6626 extern int d[100];
6627 f(50, d + 50, d); // valid
6628 f(50, d + 1, d); // undefined behavior
6629 }</pre>
6631 <p><!--para 10 -->
6632 EXAMPLE 3 The function parameter declarations
6633 <pre>
6634 void h(int n, int * restrict p, int * restrict q, int * restrict r)
6636 int i;
6637 for (i = 0; i &lt; n; i++)
6638 p[i] = q[i] + r[i];
6639 }</pre>
6640 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
6641 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
6642 modified within function h.
6644 <p><!--para 11 -->
6645 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
6646 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
6647 between restricted pointers declared in nested blocks have defined behavior.
6648 <!--page 142 -->
6649 <p><!--para 12 -->
6650 <pre>
6652 int * restrict p1;
6653 int * restrict q1;
6654 p1 = q1; // undefined behavior
6656 int * restrict p2 = p1; // valid
6657 int * restrict q2 = q1; // valid
6658 p1 = q2; // undefined behavior
6659 p2 = q2; // undefined behavior
6661 }</pre>
6662 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
6663 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
6664 example, this permits new_vector to return a vector.
6665 <pre>
6666 typedef struct { int n; float * restrict v; } vector;
6667 vector new_vector(int n)
6669 vector t;
6670 t.n = n;
6671 t.v = malloc(n * sizeof (float));
6672 return t;
6673 }</pre>
6676 <h6>footnotes</h6>
6677 <p><small><a name="note137" href="#note137">137)</a> In other words, E depends on the value of P itself rather than on the value of an object referenced
6678 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
6679 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
6680 expressions *p and p[1] are not.
6681 </small>
6683 <h4><a name="6.7.4" href="#6.7.4">6.7.4 Function specifiers</a></h4>
6684 <h6>Syntax</h6>
6685 <p><!--para 1 -->
6686 <pre>
6687 function-specifier:
6688 inline
6689 _Noreturn</pre>
6690 <h6>Constraints</h6>
6691 <p><!--para 2 -->
6692 Function specifiers shall be used only in the declaration of an identifier for a function.
6693 <p><!--para 3 -->
6694 An inline definition of a function with external linkage shall not contain a definition of a
6695 modifiable object with static or thread storage duration, and shall not contain a reference
6696 to an identifier with internal linkage.
6697 <p><!--para 4 -->
6698 In a hosted environment, no function specifier(s) shall appear in a declaration of main.
6699 <h6>Semantics</h6>
6700 <p><!--para 5 -->
6701 A function specifier may appear more than once; the behavior is the same as if it
6702 appeared only once.
6703 <p><!--para 6 -->
6704 A function declared with an inline function specifier is an inline function. Making a *
6705 function an inline function suggests that calls to the function be as fast as possible.<sup><a href="#note138"><b>138)</b></a></sup>
6706 The extent to which such suggestions are effective is implementation-defined.<sup><a href="#note139"><b>139)</b></a></sup>
6711 <!--page 143 -->
6712 <p><!--para 7 -->
6713 Any function with internal linkage can be an inline function. For a function with external
6714 linkage, the following restrictions apply: If a function is declared with an inline
6715 function specifier, then it shall also be defined in the same translation unit. If all of the
6716 file scope declarations for a function in a translation unit include the inline function
6717 specifier without extern, then the definition in that translation unit is an inline
6718 definition. An inline definition does not provide an external definition for the function,
6719 and does not forbid an external definition in another translation unit. An inline definition
6720 provides an alternative to an external definition, which a translator may use to implement
6721 any call to the function in the same translation unit. It is unspecified whether a call to the
6722 function uses the inline definition or the external definition.<sup><a href="#note140"><b>140)</b></a></sup>
6723 <p><!--para 8 -->
6724 A function declared with a _Noreturn function specifier shall not return to its caller.
6725 <h6>Recommended practice</h6>
6726 <p><!--para 9 -->
6727 The implementation should produce a diagnostic message for a function declared with a
6728 _Noreturn function specifier that appears to be capable of returning to its caller.
6729 <p><!--para 10 -->
6730 EXAMPLE 1 The declaration of an inline function with external linkage can result in either an external
6731 definition, or a definition available for use only within the translation unit. A file scope declaration with
6732 extern creates an external definition. The following example shows an entire translation unit.
6733 <p><!--para 11 -->
6734 <pre>
6735 inline double fahr(double t)
6737 return (9.0 * t) / 5.0 + 32.0;
6739 inline double cels(double t)
6741 return (5.0 * (t - 32.0)) / 9.0;
6743 extern double fahr(double); // creates an external definition
6744 double convert(int is_fahr, double temp)
6746 /* A translator may perform inline substitutions */
6747 return is_fahr ? cels(temp) : fahr(temp);
6748 }</pre>
6749 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
6750 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
6751 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
6752 definition are distinct and either may be used for the call.
6754 <p><!--para 12 -->
6755 EXAMPLE 2
6760 <!--page 144 -->
6761 <pre>
6762 _Noreturn void f () {
6763 abort(); // ok
6765 _Noreturn void g (int i) { // causes undefined behavior if i &lt;= 0
6766 if (i &gt; 0) abort();
6767 }</pre>
6769 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
6771 <h6>footnotes</h6>
6772 <p><small><a name="note138" href="#note138">138)</a> By using, for example, an alternative to the usual function call mechanism, such as ''inline
6773 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
6774 Therefore, for example, the expansion of a macro used within the body of the function uses the
6775 definition it had at the point the function body appears, and not where the function is called; and
6776 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
6777 single address, regardless of the number of inline definitions that occur in addition to the external
6778 definition.
6779 </small>
6780 <p><small><a name="note139" href="#note139">139)</a> For example, an implementation might never perform inline substitution, or might only perform inline
6781 substitutions to calls in the scope of an inline declaration.
6782 </small>
6783 <p><small><a name="note140" href="#note140">140)</a> Since an inline definition is distinct from the corresponding external definition and from any other
6784 corresponding inline definitions in other translation units, all corresponding objects with static storage
6785 duration are also distinct in each of the definitions.
6786 </small>
6788 <h4><a name="6.7.5" href="#6.7.5">6.7.5 Alignment specifier</a></h4>
6789 <h6>Syntax</h6>
6790 <p><!--para 1 -->
6791 <pre>
6792 alignment-specifier:
6793 _Alignas ( type-name )
6794 _Alignas ( constant-expression )</pre>
6795 <h6>Constraints</h6>
6796 <p><!--para 2 -->
6797 An alignment attribute shall not be specified in a declaration of a typedef, or a bit-field, or
6798 a function, or a parameter, or an object declared with the register storage-class
6799 specifier.
6800 <p><!--para 3 -->
6801 The constant expression shall be an integer constant expression. It shall evaluate to a
6802 valid fundamental alignment, or to a valid extended alignment supported by the
6803 implementation in the context in which it appears, or to zero.
6804 <p><!--para 4 -->
6805 The combined effect of all alignment attributes in a declaration shall not specify an
6806 alignment that is less strict than the alignment that would otherwise be required for the
6807 type of the object or member being declared.
6808 <h6>Semantics</h6>
6809 <p><!--para 5 -->
6810 The first form is equivalent to _Alignas(alignof(type-name)).
6811 <p><!--para 6 -->
6812 The alignment requirement of the declared object or member is taken to be the specified
6813 alignment. An alignment specification of zero has no effect.<sup><a href="#note141"><b>141)</b></a></sup> When multiple
6814 alignment specifiers occur in a declaration, the effective alignment requirement is the
6815 strictest specified alignment.
6816 <p><!--para 7 -->
6817 If the definition of an object has an alignment specifier, any other declaration of that
6818 object shall either specify equivalent alignment or have no alignment specifier. If the
6819 definition of an object does not have an alignment specifier, any other declaration of that
6820 object shall also have no alignment specifier. If declarations of an object in different
6821 translation units have different alignment specifiers, the behavior is undefined.
6825 <!--page 145 -->
6827 <h6>footnotes</h6>
6828 <p><small><a name="note141" href="#note141">141)</a> An alignment specification of zero also does not affect other alignment specifications in the same
6829 declaration.
6830 </small>
6832 <h4><a name="6.7.6" href="#6.7.6">6.7.6 Declarators</a></h4>
6833 <h6>Syntax</h6>
6834 <p><!--para 1 -->
6835 <pre>
6836 declarator:
6837 pointeropt direct-declarator
6838 direct-declarator:
6839 identifier
6840 ( declarator )
6841 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
6842 direct-declarator [ static type-qualifier-listopt assignment-expression ]
6843 direct-declarator [ type-qualifier-list static assignment-expression ]
6844 direct-declarator [ type-qualifier-listopt * ]
6845 direct-declarator ( parameter-type-list )
6846 direct-declarator ( identifier-listopt )
6847 pointer:
6848 * type-qualifier-listopt
6849 * type-qualifier-listopt pointer
6850 type-qualifier-list:
6851 type-qualifier
6852 type-qualifier-list type-qualifier
6853 parameter-type-list:
6854 parameter-list
6855 parameter-list , ...
6856 parameter-list:
6857 parameter-declaration
6858 parameter-list , parameter-declaration
6859 parameter-declaration:
6860 declaration-specifiers declarator
6861 declaration-specifiers abstract-declaratoropt
6862 identifier-list:
6863 identifier
6864 identifier-list , identifier</pre>
6865 <h6>Semantics</h6>
6866 <p><!--para 2 -->
6867 Each declarator declares one identifier, and asserts that when an operand of the same
6868 form as the declarator appears in an expression, it designates a function or object with the
6869 scope, storage duration, and type indicated by the declaration specifiers.
6870 <p><!--para 3 -->
6871 A full declarator is a declarator that is not part of another declarator. The end of a full
6872 declarator is a sequence point. If, in the nested sequence of declarators in a full
6873 <!--page 146 -->
6874 declarator, there is a declarator specifying a variable length array type, the type specified
6875 by the full declarator is said to be variably modified. Furthermore, any type derived by
6876 declarator type derivation from a variably modified type is itself variably modified.
6877 <p><!--para 4 -->
6878 In the following subclauses, consider a declaration
6879 <pre>
6880 T D1</pre>
6881 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
6882 a declarator that contains an identifier ident. The type specified for the identifier ident in
6883 the various forms of declarator is described inductively using this notation.
6884 <p><!--para 5 -->
6885 If, in the declaration ''T D1'', D1 has the form
6886 <pre>
6887 identifier</pre>
6888 then the type specified for ident is T .
6889 <p><!--para 6 -->
6890 If, in the declaration ''T D1'', D1 has the form
6891 <pre>
6892 ( D )</pre>
6893 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
6894 parentheses is identical to the unparenthesized declarator, but the binding of complicated
6895 declarators may be altered by parentheses.
6896 <h6>Implementation limits</h6>
6897 <p><!--para 7 -->
6898 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
6899 function declarators that modify an arithmetic, structure, union, or void type, either
6900 directly or via one or more typedefs.
6901 <p><b> Forward references</b>: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), type definitions (<a href="#6.7.8">6.7.8</a>).
6903 <h5><a name="6.7.6.1" href="#6.7.6.1">6.7.6.1 Pointer declarators</a></h5>
6904 <h6>Semantics</h6>
6905 <p><!--para 1 -->
6906 If, in the declaration ''T D1'', D1 has the form
6907 <pre>
6908 * type-qualifier-listopt D</pre>
6909 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6910 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
6911 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
6912 <p><!--para 2 -->
6913 For two pointer types to be compatible, both shall be identically qualified and both shall
6914 be pointers to compatible types.
6915 <p><!--para 3 -->
6916 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
6917 to a constant value'' and a ''constant pointer to a variable value''.
6918 <!--page 147 -->
6919 <pre>
6920 const int *ptr_to_constant;
6921 int *const constant_ptr;</pre>
6922 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
6923 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
6924 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
6925 same location.
6926 <p><!--para 4 -->
6927 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
6928 type ''pointer to int''.
6929 <pre>
6930 typedef int *int_ptr;
6931 const int_ptr constant_ptr;</pre>
6932 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
6935 <h5><a name="6.7.6.2" href="#6.7.6.2">6.7.6.2 Array declarators</a></h5>
6936 <h6>Constraints</h6>
6937 <p><!--para 1 -->
6938 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
6939 an expression or *. If they delimit an expression (which specifies the size of an array), the
6940 expression shall have an integer type. If the expression is a constant expression, it shall
6941 have a value greater than zero. The element type shall not be an incomplete or function
6942 type. The optional type qualifiers and the keyword static shall appear only in a
6943 declaration of a function parameter with an array type, and then only in the outermost
6944 array type derivation.
6945 <p><!--para 2 -->
6946 If an identifier is declared as having a variably modified type, it shall be an ordinary
6947 identifier (as defined in <a href="#6.2.3">6.2.3</a>), have no linkage, and have either block scope or function
6948 prototype scope. If an identifier is declared to be an object with static or thread storage
6949 duration, it shall not have a variable length array type.
6950 <h6>Semantics</h6>
6951 <p><!--para 3 -->
6952 If, in the declaration ''T D1'', D1 has one of the forms:
6953 <pre>
6954 D[ type-qualifier-listopt assignment-expressionopt ]
6955 D[ static type-qualifier-listopt assignment-expression ]
6956 D[ type-qualifier-list static assignment-expression ]
6957 D[ type-qualifier-listopt * ]</pre>
6958 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6959 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note142"><b>142)</b></a></sup>
6960 (See <a href="#6.7.6.3">6.7.6.3</a> for the meaning of the optional type qualifiers and the keyword static.)
6961 <p><!--para 4 -->
6962 If the size is not present, the array type is an incomplete type. If the size is * instead of
6963 being an expression, the array type is a variable length array type of unspecified size,
6964 which can only be used in declarations or type names with function prototype scope;<sup><a href="#note143"><b>143)</b></a></sup>
6966 <!--page 148 -->
6967 such arrays are nonetheless complete types. If the size is an integer constant expression
6968 and the element type has a known constant size, the array type is not a variable length
6969 array type; otherwise, the array type is a variable length array type. (Variable length
6970 arrays are a conditional feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.)
6971 <p><!--para 5 -->
6972 If the size is an expression that is not an integer constant expression: if it occurs in a
6973 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
6974 each time it is evaluated it shall have a value greater than zero. The size of each instance
6975 of a variable length array type does not change during its lifetime. Where a size
6976 expression is part of the operand of a sizeof operator and changing the value of the
6977 size expression would not affect the result of the operator, it is unspecified whether or not
6978 the size expression is evaluated.
6979 <p><!--para 6 -->
6980 For two array types to be compatible, both shall have compatible element types, and if
6981 both size specifiers are present, and are integer constant expressions, then both size
6982 specifiers shall have the same constant value. If the two array types are used in a context
6983 which requires them to be compatible, it is undefined behavior if the two size specifiers
6984 evaluate to unequal values.
6985 <p><!--para 7 -->
6986 EXAMPLE 1
6987 <pre>
6988 float fa[11], *afp[17];</pre>
6989 declares an array of float numbers and an array of pointers to float numbers.
6991 <p><!--para 8 -->
6992 EXAMPLE 2 Note the distinction between the declarations
6993 <pre>
6994 extern int *x;
6995 extern int y[];</pre>
6996 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
6997 (an incomplete type), the storage for which is defined elsewhere.
6999 <p><!--para 9 -->
7000 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
7001 <pre>
7002 extern int n;
7003 extern int m;
7004 void fcompat(void)
7006 int a[n][6][m];
7007 int (*p)[4][n+1];
7008 int c[n][n][6][m];
7009 int (*r)[n][n][n+1];
7010 p = a; // invalid: not compatible because 4 != 6
7011 r = c; // compatible, but defined behavior only if
7012 // n == 6 and m == n+1
7013 }</pre>
7018 <!--page 149 -->
7019 <p><!--para 10 -->
7020 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
7021 function prototype scope. Array objects declared with the _Thread_local, static, or extern
7022 storage-class specifier cannot have a variable length array (VLA) type. However, an object declared with
7023 the static storage-class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all
7024 identifiers declared with a VM type have to be ordinary identifiers and cannot, therefore, be members of
7025 structures or unions.
7026 <pre>
7027 extern int n;
7028 int A[n]; // invalid: file scope VLA
7029 extern int (*p2)[n]; // invalid: file scope VM
7030 int B[100]; // valid: file scope but not VM
7031 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
7032 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
7034 typedef int VLA[m][m]; // valid: block scope typedef VLA
7035 struct tag {
7036 int (*y)[n]; // invalid: y not ordinary identifier
7037 int z[n]; // invalid: z not ordinary identifier
7039 int D[m]; // valid: auto VLA
7040 static int E[m]; // invalid: static block scope VLA
7041 extern int F[m]; // invalid: F has linkage and is VLA
7042 int (*s)[m]; // valid: auto pointer to VLA
7043 extern int (*r)[m]; // invalid: r has linkage and points to VLA
7044 static int (*q)[m] = &amp;B; // valid: q is a static block pointer to VLA
7045 }</pre>
7047 <p><b> Forward references</b>: function declarators (<a href="#6.7.6.3">6.7.6.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
7048 initialization (<a href="#6.7.9">6.7.9</a>).
7050 <h6>footnotes</h6>
7051 <p><small><a name="note142" href="#note142">142)</a> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
7052 </small>
7053 <p><small><a name="note143" href="#note143">143)</a> Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.6.3">6.7.6.3</a>).
7054 </small>
7056 <h5><a name="6.7.6.3" href="#6.7.6.3">6.7.6.3 Function declarators (including prototypes)</a></h5>
7057 <h6>Constraints</h6>
7058 <p><!--para 1 -->
7059 A function declarator shall not specify a return type that is a function type or an array
7060 type.
7061 <p><!--para 2 -->
7062 The only storage-class specifier that shall occur in a parameter declaration is register.
7063 <p><!--para 3 -->
7064 An identifier list in a function declarator that is not part of a definition of that function
7065 shall be empty.
7066 <p><!--para 4 -->
7067 After adjustment, the parameters in a parameter type list in a function declarator that is
7068 part of a definition of that function shall not have incomplete type.
7069 <h6>Semantics</h6>
7070 <p><!--para 5 -->
7071 If, in the declaration ''T D1'', D1 has the form
7072 <!--page 150 -->
7073 <pre>
7074 D( parameter-type-list )</pre>
7076 <pre>
7077 D( identifier-listopt )</pre>
7078 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
7079 T '', then the type specified for ident is ''derived-declarator-type-list function returning
7080 T ''.
7081 <p><!--para 6 -->
7082 A parameter type list specifies the types of, and may declare identifiers for, the
7083 parameters of the function.
7084 <p><!--para 7 -->
7085 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
7086 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
7087 array type derivation. If the keyword static also appears within the [ and ] of the
7088 array type derivation, then for each call to the function, the value of the corresponding
7089 actual argument shall provide access to the first element of an array with at least as many
7090 elements as specified by the size expression.
7091 <p><!--para 8 -->
7092 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
7093 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
7094 <p><!--para 9 -->
7095 If the list terminates with an ellipsis (, ...), no information about the number or types
7096 of the parameters after the comma is supplied.<sup><a href="#note144"><b>144)</b></a></sup>
7097 <p><!--para 10 -->
7098 The special case of an unnamed parameter of type void as the only item in the list
7099 specifies that the function has no parameters.
7100 <p><!--para 11 -->
7101 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
7102 parameter name, it shall be taken as a typedef name.
7103 <p><!--para 12 -->
7104 If the function declarator is not part of a definition of that function, parameters may have
7105 incomplete type and may use the [*] notation in their sequences of declarator specifiers
7106 to specify variable length array types.
7107 <p><!--para 13 -->
7108 The storage-class specifier in the declaration specifiers for a parameter declaration, if
7109 present, is ignored unless the declared parameter is one of the members of the parameter
7110 type list for a function definition.
7111 <p><!--para 14 -->
7112 An identifier list declares only the identifiers of the parameters of the function. An empty
7113 list in a function declarator that is part of a definition of that function specifies that the
7114 function has no parameters. The empty list in a function declarator that is not part of a
7115 definition of that function specifies that no information about the number or types of the
7116 parameters is supplied.<sup><a href="#note145"><b>145)</b></a></sup>
7120 <!--page 151 -->
7121 <p><!--para 15 -->
7122 For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note146"><b>146)</b></a></sup>
7123 Moreover, the parameter type lists, if both are present, shall agree in the number of
7124 parameters and in use of the ellipsis terminator; corresponding parameters shall have
7125 compatible types. If one type has a parameter type list and the other type is specified by a
7126 function declarator that is not part of a function definition and that contains an empty
7127 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
7128 parameter shall be compatible with the type that results from the application of the
7129 default argument promotions. If one type has a parameter type list and the other type is
7130 specified by a function definition that contains a (possibly empty) identifier list, both shall
7131 agree in the number of parameters, and the type of each prototype parameter shall be
7132 compatible with the type that results from the application of the default argument
7133 promotions to the type of the corresponding identifier. (In the determination of type
7134 compatibility and of a composite type, each parameter declared with function or array
7135 type is taken as having the adjusted type and each parameter declared with qualified type
7136 is taken as having the unqualified version of its declared type.)
7137 <p><!--para 16 -->
7138 EXAMPLE 1 The declaration
7139 <pre>
7140 int f(void), *fip(), (*pfi)();</pre>
7141 declares a function f with no parameters returning an int, a function fip with no parameter specification
7142 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
7143 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
7144 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
7145 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
7146 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
7147 designator, which is then used to call the function; it returns an int.
7148 <p><!--para 17 -->
7149 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
7150 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
7151 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
7152 the identifier of the pointer pfi has block scope and no linkage.
7154 <p><!--para 18 -->
7155 EXAMPLE 2 The declaration
7156 <pre>
7157 int (*apfi[3])(int *x, int *y);</pre>
7158 declares an array apfi of three pointers to functions returning int. Each of these functions has two
7159 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
7160 go out of scope at the end of the declaration of apfi.
7162 <p><!--para 19 -->
7163 EXAMPLE 3 The declaration
7164 <pre>
7165 int (*fpfi(int (*)(long), int))(int, ...);</pre>
7166 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
7167 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
7168 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
7171 <!--page 152 -->
7172 additional arguments of any type.
7174 <p><!--para 20 -->
7175 EXAMPLE 4 The following prototype has a variably modified parameter.
7176 <pre>
7177 void addscalar(int n, int m,
7178 double a[n][n*m+300], double x);
7179 int main()
7181 double b[4][308];
7182 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
7183 return 0;
7185 void addscalar(int n, int m,
7186 double a[n][n*m+300], double x)
7188 for (int i = 0; i &lt; n; i++)
7189 for (int j = 0, k = n*m+300; j &lt; k; j++)
7190 // a is a pointer to a VLA with n*m+300 elements
7191 a[i][j] += x;
7192 }</pre>
7194 <p><!--para 21 -->
7195 EXAMPLE 5 The following are all compatible function prototype declarators.
7196 <pre>
7197 double maximum(int n, int m, double a[n][m]);
7198 double maximum(int n, int m, double a[*][*]);
7199 double maximum(int n, int m, double a[ ][*]);
7200 double maximum(int n, int m, double a[ ][m]);</pre>
7201 as are:
7202 <pre>
7203 void f(double (* restrict a)[5]);
7204 void f(double a[restrict][5]);
7205 void f(double a[restrict 3][5]);
7206 void f(double a[restrict static 3][5]);</pre>
7207 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
7208 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
7210 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.7">6.7.7</a>).
7211 <!--page 153 -->
7213 <h6>footnotes</h6>
7214 <p><small><a name="note144" href="#note144">144)</a> The macros defined in the <a href="#7.16">&lt;stdarg.h&gt;</a> header (<a href="#7.16">7.16</a>) may be used to access arguments that
7215 correspond to the ellipsis.
7216 </small>
7217 <p><small><a name="note145" href="#note145">145)</a> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
7218 </small>
7219 <p><small><a name="note146" href="#note146">146)</a> If both function types are ''old style'', parameter types are not compared.
7220 </small>
7222 <h4><a name="6.7.7" href="#6.7.7">6.7.7 Type names</a></h4>
7223 <h6>Syntax</h6>
7224 <p><!--para 1 -->
7225 <pre>
7226 type-name:
7227 specifier-qualifier-list abstract-declaratoropt
7228 abstract-declarator:
7229 pointer
7230 pointeropt direct-abstract-declarator
7231 direct-abstract-declarator:
7232 ( abstract-declarator )
7233 direct-abstract-declaratoropt [ type-qualifier-listopt
7234 assignment-expressionopt ]
7235 direct-abstract-declaratoropt [ static type-qualifier-listopt
7236 assignment-expression ]
7237 direct-abstract-declaratoropt [ type-qualifier-list static
7238 assignment-expression ]
7239 direct-abstract-declaratoropt [ * ]
7240 direct-abstract-declaratoropt ( parameter-type-listopt )</pre>
7241 <h6>Semantics</h6>
7242 <p><!--para 2 -->
7243 In several contexts, it is necessary to specify a type. This is accomplished using a type
7244 name, which is syntactically a declaration for a function or an object of that type that
7245 omits the identifier.<sup><a href="#note147"><b>147)</b></a></sup>
7246 <p><!--para 3 -->
7247 EXAMPLE The constructions
7248 <pre>
7249 (a) int
7250 (b) int *
7251 (c) int *[3]
7252 (d) int (*)[3]
7253 (e) int (*)[*]
7254 (f) int *()
7255 (g) int (*)(void)
7256 (h) int (*const [])(unsigned int, ...)</pre>
7257 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
7258 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
7259 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
7260 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
7261 parameter that has type unsigned int and an unspecified number of other parameters, returning an
7262 int.
7267 <!--page 154 -->
7269 <h6>footnotes</h6>
7270 <p><small><a name="note147" href="#note147">147)</a> As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
7271 parameter specification'', rather than redundant parentheses around the omitted identifier.
7272 </small>
7274 <h4><a name="6.7.8" href="#6.7.8">6.7.8 Type definitions</a></h4>
7275 <h6>Syntax</h6>
7276 <p><!--para 1 -->
7277 <pre>
7278 typedef-name:
7279 identifier</pre>
7280 <h6>Constraints</h6>
7281 <p><!--para 2 -->
7282 If a typedef name specifies a variably modified type then it shall have block scope.
7283 <h6>Semantics</h6>
7284 <p><!--para 3 -->
7285 In a declaration whose storage-class specifier is typedef, each declarator defines an
7286 identifier to be a typedef name that denotes the type specified for the identifier in the way
7287 described in <a href="#6.7.6">6.7.6</a>. Any array size expressions associated with variable length array
7288 declarators are evaluated each time the declaration of the typedef name is reached in the
7289 order of execution. A typedef declaration does not introduce a new type, only a
7290 synonym for the type so specified. That is, in the following declarations:
7291 <pre>
7292 typedef T type_ident;
7293 type_ident D;</pre>
7294 type_ident is defined as a typedef name with the type specified by the declaration
7295 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
7296 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
7297 typedef name shares the same name space as other identifiers declared in ordinary
7298 declarators.
7299 <p><!--para 4 -->
7300 EXAMPLE 1 After
7301 <pre>
7302 typedef int MILES, KLICKSP();
7303 typedef struct { double hi, lo; } range;</pre>
7304 the constructions
7305 <pre>
7306 MILES distance;
7307 extern KLICKSP *metricp;
7308 range x;
7309 range z, *zp;</pre>
7310 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
7311 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
7312 such a structure. The object distance has a type compatible with any other int object.
7314 <p><!--para 5 -->
7315 EXAMPLE 2 After the declarations
7316 <pre>
7317 typedef struct s1 { int x; } t1, *tp1;
7318 typedef struct s2 { int x; } t2, *tp2;</pre>
7319 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
7320 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
7321 <!--page 155 -->
7322 <p><!--para 6 -->
7323 EXAMPLE 3 The following obscure constructions
7324 <pre>
7325 typedef signed int t;
7326 typedef int plain;
7327 struct tag {
7328 unsigned t:4;
7329 const t:5;
7330 plain r:5;
7331 };</pre>
7332 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
7333 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
7334 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
7335 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
7336 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
7337 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
7338 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
7339 in an inner scope by
7340 <pre>
7341 t f(t (t));
7342 long t;</pre>
7343 then a function f is declared with type ''function returning signed int with one unnamed parameter
7344 with type pointer to function returning signed int with one unnamed parameter with type signed
7345 int'', and an identifier t with type long int.
7347 <p><!--para 7 -->
7348 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
7349 following declarations of the signal function specify exactly the same type, the first without making use
7350 of any typedef names.
7351 <pre>
7352 typedef void fv(int), (*pfv)(int);
7353 void (*signal(int, void (*)(int)))(int);
7354 fv *signal(int, fv *);
7355 pfv signal(int, pfv);</pre>
7357 <p><!--para 8 -->
7358 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
7359 time the typedef name is defined, not each time it is used:
7360 <!--page 156 -->
7361 <pre>
7362 void copyt(int n)
7364 typedef int B[n]; // B is n ints, n evaluated now
7365 n += 1;
7366 B a; // a is n ints, n without += 1
7367 int b[n]; // a and b are different sizes
7368 for (int i = 1; i &lt; n; i++)
7369 a[i-1] = b[i];
7370 }</pre>
7372 <h4><a name="6.7.9" href="#6.7.9">6.7.9 Initialization</a></h4>
7373 <h6>Syntax</h6>
7374 <p><!--para 1 -->
7375 <pre>
7376 initializer:
7377 assignment-expression
7378 { initializer-list }
7379 { initializer-list , }
7380 initializer-list:
7381 designationopt initializer
7382 initializer-list , designationopt initializer
7383 designation:
7384 designator-list =
7385 designator-list:
7386 designator
7387 designator-list designator
7388 designator:
7389 [ constant-expression ]
7390 . identifier</pre>
7391 <h6>Constraints</h6>
7392 <p><!--para 2 -->
7393 No initializer shall attempt to provide a value for an object not contained within the entity
7394 being initialized.
7395 <p><!--para 3 -->
7396 The type of the entity to be initialized shall be an array of unknown size or a complete
7397 object type that is not a variable length array type.
7398 <p><!--para 4 -->
7399 All the expressions in an initializer for an object that has static or thread storage duration
7400 shall be constant expressions or string literals.
7401 <p><!--para 5 -->
7402 If the declaration of an identifier has block scope, and the identifier has external or
7403 internal linkage, the declaration shall have no initializer for the identifier.
7404 <p><!--para 6 -->
7405 If a designator has the form
7406 <pre>
7407 [ constant-expression ]</pre>
7408 then the current object (defined below) shall have array type and the expression shall be
7409 an integer constant expression. If the array is of unknown size, any nonnegative value is
7410 valid.
7411 <p><!--para 7 -->
7412 If a designator has the form
7413 <pre>
7414 . identifier</pre>
7415 then the current object (defined below) shall have structure or union type and the
7416 identifier shall be the name of a member of that type.
7417 <!--page 157 -->
7418 <h6>Semantics</h6>
7419 <p><!--para 8 -->
7420 An initializer specifies the initial value stored in an object.
7421 <p><!--para 9 -->
7422 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
7423 members of objects of structure and union type do not participate in initialization.
7424 Unnamed members of structure objects have indeterminate value even after initialization.
7425 <p><!--para 10 -->
7426 If an object that has automatic storage duration is not initialized explicitly, its value is
7427 indeterminate. If an object that has static or thread storage duration is not initialized
7428 explicitly, then:
7429 <ul>
7430 <li> if it has pointer type, it is initialized to a null pointer;
7431 <li> if it has arithmetic type, it is initialized to (positive or unsigned) zero;
7432 <li> if it is an aggregate, every member is initialized (recursively) according to these rules,
7433 and any padding is initialized to zero bits;
7434 <li> if it is a union, the first named member is initialized (recursively) according to these
7435 rules, and any padding is initialized to zero bits;
7436 </ul>
7437 <p><!--para 11 -->
7438 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
7439 initial value of the object is that of the expression (after conversion); the same type
7440 constraints and conversions as for simple assignment apply, taking the type of the scalar
7441 to be the unqualified version of its declared type.
7442 <p><!--para 12 -->
7443 The rest of this subclause deals with initializers for objects that have aggregate or union
7444 type.
7445 <p><!--para 13 -->
7446 The initializer for a structure or union object that has automatic storage duration shall be
7447 either an initializer list as described below, or a single expression that has compatible
7448 structure or union type. In the latter case, the initial value of the object, including
7449 unnamed members, is that of the expression.
7450 <p><!--para 14 -->
7451 An array of character type may be initialized by a character string literal or UTF-8 string
7452 literal, optionally enclosed in braces. Successive bytes of the string literal (including the
7453 terminating null character if there is room or if the array is of unknown size) initialize the
7454 elements of the array.
7455 <p><!--para 15 -->
7456 An array with element type compatible with a qualified or unqualified version of
7457 wchar_t may be initialized by a wide string literal, optionally enclosed in braces.
7458 Successive wide characters of the wide string literal (including the terminating null wide
7459 character if there is room or if the array is of unknown size) initialize the elements of the
7460 array.
7461 <p><!--para 16 -->
7462 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
7463 enclosed list of initializers for the elements or named members.
7464 <!--page 158 -->
7465 <p><!--para 17 -->
7466 Each brace-enclosed initializer list has an associated current object. When no
7467 designations are present, subobjects of the current object are initialized in order according
7468 to the type of the current object: array elements in increasing subscript order, structure
7469 members in declaration order, and the first named member of a union.<sup><a href="#note148"><b>148)</b></a></sup> In contrast, a
7470 designation causes the following initializer to begin initialization of the subobject
7471 described by the designator. Initialization then continues forward in order, beginning
7472 with the next subobject after that described by the designator.<sup><a href="#note149"><b>149)</b></a></sup>
7473 <p><!--para 18 -->
7474 Each designator list begins its description with the current object associated with the
7475 closest surrounding brace pair. Each item in the designator list (in order) specifies a
7476 particular member of its current object and changes the current object for the next
7477 designator (if any) to be that member.<sup><a href="#note150"><b>150)</b></a></sup> The current object that results at the end of the
7478 designator list is the subobject to be initialized by the following initializer.
7479 <p><!--para 19 -->
7480 The initialization shall occur in initializer list order, each initializer provided for a
7481 particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note151"><b>151)</b></a></sup>
7482 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
7483 objects that have static storage duration.
7484 <p><!--para 20 -->
7485 If the aggregate or union contains elements or members that are aggregates or unions,
7486 these rules apply recursively to the subaggregates or contained unions. If the initializer of
7487 a subaggregate or contained union begins with a left brace, the initializers enclosed by
7488 that brace and its matching right brace initialize the elements or members of the
7489 subaggregate or the contained union. Otherwise, only enough initializers from the list are
7490 taken to account for the elements or members of the subaggregate or the first member of
7491 the contained union; any remaining initializers are left to initialize the next element or
7492 member of the aggregate of which the current subaggregate or contained union is a part.
7493 <p><!--para 21 -->
7494 If there are fewer initializers in a brace-enclosed list than there are elements or members
7495 of an aggregate, or fewer characters in a string literal used to initialize an array of known
7496 size than there are elements in the array, the remainder of the aggregate shall be
7497 initialized implicitly the same as objects that have static storage duration.
7501 <!--page 159 -->
7502 <p><!--para 22 -->
7503 If an array of unknown size is initialized, its size is determined by the largest indexed
7504 element with an explicit initializer. The array type is completed at the end of its
7505 initializer list.
7506 <p><!--para 23 -->
7507 The evaluations of the initialization list expressions are indeterminately sequenced with
7508 respect to one another and thus the order in which any side effects occur is
7509 unspecified.<sup><a href="#note152"><b>152)</b></a></sup>
7510 <p><!--para 24 -->
7511 EXAMPLE 1 Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
7512 <pre>
7513 int i = <a href="#3.5">3.5</a>;
7514 double complex c = 5 + 3 * I;</pre>
7515 define and initialize i with the value 3 and c with the value 5.0 + i3.0.
7517 <p><!--para 25 -->
7518 EXAMPLE 2 The declaration
7519 <pre>
7520 int x[] = { 1, 3, 5 };</pre>
7521 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
7522 and there are three initializers.
7524 <p><!--para 26 -->
7525 EXAMPLE 3 The declaration
7526 <pre>
7527 int y[4][3] = {
7528 { 1, 3, 5 },
7529 { 2, 4, 6 },
7530 { 3, 5, 7 },
7531 };</pre>
7532 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
7533 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
7534 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
7535 been achieved by
7536 <pre>
7537 int y[4][3] = {
7538 1, 3, 5, 2, 4, 6, 3, 5, 7
7539 };</pre>
7540 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
7541 next three are taken successively for y[1] and y[2].
7543 <p><!--para 27 -->
7544 EXAMPLE 4 The declaration
7545 <pre>
7546 int z[4][3] = {
7547 { 1 }, { 2 }, { 3 }, { 4 }
7548 };</pre>
7549 initializes the first column of z as specified and initializes the rest with zeros.
7551 <p><!--para 28 -->
7552 EXAMPLE 5 The declaration
7553 <pre>
7554 struct { int a[3], b; } w[] = { { 1 }, 2 };</pre>
7555 is a definition with an inconsistently bracketed initialization. It defines an array with two element
7559 <!--page 160 -->
7560 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
7562 <p><!--para 29 -->
7563 EXAMPLE 6 The declaration
7564 <pre>
7565 short q[4][3][2] = {
7566 { 1 },
7567 { 2, 3 },
7568 { 4, 5, 6 }
7569 };</pre>
7570 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
7571 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
7572 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
7573 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
7574 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
7575 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
7576 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
7577 diagnostic message would have been issued. The same initialization result could have been achieved by:
7578 <pre>
7579 short q[4][3][2] = {
7580 1, 0, 0, 0, 0, 0,
7581 2, 3, 0, 0, 0, 0,
7582 4, 5, 6
7583 };</pre>
7584 or by:
7585 <pre>
7586 short q[4][3][2] = {
7588 { 1 },
7591 { 2, 3 },
7594 { 4, 5 },
7595 { 6 },
7597 };</pre>
7598 in a fully bracketed form.
7599 <p><!--para 30 -->
7600 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
7601 cause confusion.
7603 <p><!--para 31 -->
7604 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
7605 declaration
7606 <pre>
7607 typedef int A[]; // OK - declared with block scope</pre>
7608 the declaration
7609 <pre>
7610 A a = { 1, 2 }, b = { 3, 4, 5 };</pre>
7611 is identical to
7612 <pre>
7613 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };</pre>
7614 due to the rules for incomplete types.
7615 <!--page 161 -->
7616 <p><!--para 32 -->
7617 EXAMPLE 8 The declaration
7618 <pre>
7619 char s[] = "abc", t[3] = "abc";</pre>
7620 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
7621 This declaration is identical to
7622 <pre>
7623 char s[] = { 'a', 'b', 'c', '\0' },
7624 t[] = { 'a', 'b', 'c' };</pre>
7625 The contents of the arrays are modifiable. On the other hand, the declaration
7626 <pre>
7627 char *p = "abc";</pre>
7628 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
7629 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
7630 modify the contents of the array, the behavior is undefined.
7632 <p><!--para 33 -->
7633 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
7634 designators:
7635 <pre>
7636 enum { member_one, member_two };
7637 const char *nm[] = {
7638 [member_two] = "member two",
7639 [member_one] = "member one",
7640 };</pre>
7642 <p><!--para 34 -->
7643 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
7644 <pre>
7645 div_t answer = { .quot = 2, .rem = -1 };</pre>
7647 <p><!--para 35 -->
7648 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
7649 might be misunderstood:
7650 <pre>
7651 struct { int a[3], b; } w[] =
7652 { [0].a = {1}, [1].a[0] = 2 };</pre>
7654 <p><!--para 36 -->
7655 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
7656 <p><!--para 37 -->
7657 <pre>
7658 int a[MAX] = {
7659 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
7660 };</pre>
7661 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
7662 than ten, some of the values provided by the first five initializers will be overridden by the second five.
7664 <p><!--para 38 -->
7665 EXAMPLE 13 Any member of a union can be initialized:
7666 <pre>
7667 union { /* ... */ } u = { .any_member = 42 };</pre>
7669 <p><b> Forward references</b>: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>).
7670 <!--page 162 -->
7672 <h6>footnotes</h6>
7673 <p><small><a name="note148" href="#note148">148)</a> If the initializer list for a subaggregate or contained union does not begin with a left brace, its
7674 subobjects are initialized as usual, but the subaggregate or contained union does not become the
7675 current object: current objects are associated only with brace-enclosed initializer lists.
7676 </small>
7677 <p><small><a name="note149" href="#note149">149)</a> After a union member is initialized, the next object is not the next member of the union; instead, it is
7678 the next subobject of an object containing the union.
7679 </small>
7680 <p><small><a name="note150" href="#note150">150)</a> Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
7681 the surrounding brace pair. Note, too, that each separate designator list is independent.
7682 </small>
7683 <p><small><a name="note151" href="#note151">151)</a> Any initializer for the subobject which is overridden and so not used to initialize that subobject might
7684 not be evaluated at all.
7685 </small>
7686 <p><small><a name="note152" href="#note152">152)</a> In particular, the evaluation order need not be the same as the order of subobject initialization.
7687 </small>
7689 <h4><a name="6.7.10" href="#6.7.10">6.7.10 Static assertions</a></h4>
7690 <h6>Syntax</h6>
7691 <p><!--para 1 -->
7692 <pre>
7693 static_assert-declaration:
7694 _Static_assert ( constant-expression , string-literal ) ;</pre>
7695 <h6>Constraints</h6>
7696 <p><!--para 2 -->
7697 The constant expression shall compare unequal to 0.
7698 <h6>Semantics</h6>
7699 <p><!--para 3 -->
7700 The constant expression shall be an integer constant expression. If the value of the
7701 constant expression compares unequal to 0, the declaration has no effect. Otherwise, the
7702 constraint is violated and the implementation shall produce a diagnostic message that
7703 includes the text of the string literal, except that characters not in the basic source
7704 character set are not required to appear in the message.
7705 <p><b> Forward references</b>: diagnostics (<a href="#7.2">7.2</a>).
7706 <!--page 163 -->
7708 <h3><a name="6.8" href="#6.8">6.8 Statements and blocks</a></h3>
7709 <h6>Syntax</h6>
7710 <p><!--para 1 -->
7711 <pre>
7712 statement:
7713 labeled-statement
7714 compound-statement
7715 expression-statement
7716 selection-statement
7717 iteration-statement
7718 jump-statement</pre>
7719 <h6>Semantics</h6>
7720 <p><!--para 2 -->
7721 A statement specifies an action to be performed. Except as indicated, statements are
7722 executed in sequence.
7723 <p><!--para 3 -->
7724 A block allows a set of declarations and statements to be grouped into one syntactic unit.
7725 The initializers of objects that have automatic storage duration, and the variable length
7726 array declarators of ordinary identifiers with block scope, are evaluated and the values are
7727 stored in the objects (including storing an indeterminate value in objects without an
7728 initializer) each time the declaration is reached in the order of execution, as if it were a
7729 statement, and within each declaration in the order that declarators appear.
7730 <p><!--para 4 -->
7731 A full expression is an expression that is not part of another expression or of a declarator.
7732 Each of the following is a full expression: an initializer that is not part of a compound
7733 literal; the expression in an expression statement; the controlling expression of a selection
7734 statement (if or switch); the controlling expression of a while or do statement; each
7735 of the (optional) expressions of a for statement; the (optional) expression in a return
7736 statement. There is a sequence point between the evaluation of a full expression and the
7737 evaluation of the next full expression to be evaluated.
7738 <p><b> Forward references</b>: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
7739 (<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>).
7741 <h4><a name="6.8.1" href="#6.8.1">6.8.1 Labeled statements</a></h4>
7742 <h6>Syntax</h6>
7743 <p><!--para 1 -->
7744 <pre>
7745 labeled-statement:
7746 identifier : statement
7747 case constant-expression : statement
7748 default : statement</pre>
7749 <h6>Constraints</h6>
7750 <p><!--para 2 -->
7751 A case or default label shall appear only in a switch statement. Further
7752 constraints on such labels are discussed under the switch statement.
7753 <!--page 164 -->
7754 <p><!--para 3 -->
7755 Label names shall be unique within a function.
7756 <h6>Semantics</h6>
7757 <p><!--para 4 -->
7758 Any statement may be preceded by a prefix that declares an identifier as a label name.
7759 Labels in themselves do not alter the flow of control, which continues unimpeded across
7760 them.
7761 <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>).
7763 <h4><a name="6.8.2" href="#6.8.2">6.8.2 Compound statement</a></h4>
7764 <h6>Syntax</h6>
7765 <p><!--para 1 -->
7766 <pre>
7767 compound-statement:
7768 { block-item-listopt }
7769 block-item-list:
7770 block-item
7771 block-item-list block-item
7772 block-item:
7773 declaration
7774 statement</pre>
7775 <h6>Semantics</h6>
7776 <p><!--para 2 -->
7777 A compound statement is a block.
7779 <h4><a name="6.8.3" href="#6.8.3">6.8.3 Expression and null statements</a></h4>
7780 <h6>Syntax</h6>
7781 <p><!--para 1 -->
7782 <pre>
7783 expression-statement:
7784 expressionopt ;</pre>
7785 <h6>Semantics</h6>
7786 <p><!--para 2 -->
7787 The expression in an expression statement is evaluated as a void expression for its side
7788 effects.<sup><a href="#note153"><b>153)</b></a></sup>
7789 <p><!--para 3 -->
7790 A null statement (consisting of just a semicolon) performs no operations.
7791 <p><!--para 4 -->
7792 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
7793 discarding of its value may be made explicit by converting the expression to a void expression by means of
7794 a cast:
7795 <pre>
7796 int p(int);
7797 /* ... */
7798 (void)p(0);</pre>
7802 <!--page 165 -->
7803 <p><!--para 5 -->
7804 EXAMPLE 2 In the program fragment
7805 <pre>
7806 char *s;
7807 /* ... */
7808 while (*s++ != '\0')
7809 ;</pre>
7810 a null statement is used to supply an empty loop body to the iteration statement.
7812 <p><!--para 6 -->
7813 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
7814 statement.
7815 <pre>
7816 while (loop1) {
7817 /* ... */
7818 while (loop2) {
7819 /* ... */
7820 if (want_out)
7821 goto end_loop1;
7822 /* ... */
7824 /* ... */
7825 end_loop1: ;
7826 }</pre>
7828 <p><b> Forward references</b>: iteration statements (<a href="#6.8.5">6.8.5</a>).
7830 <h6>footnotes</h6>
7831 <p><small><a name="note153" href="#note153">153)</a> Such as assignments, and function calls which have side effects.
7832 </small>
7834 <h4><a name="6.8.4" href="#6.8.4">6.8.4 Selection statements</a></h4>
7835 <h6>Syntax</h6>
7836 <p><!--para 1 -->
7837 <pre>
7838 selection-statement:
7839 if ( expression ) statement
7840 if ( expression ) statement else statement
7841 switch ( expression ) statement</pre>
7842 <h6>Semantics</h6>
7843 <p><!--para 2 -->
7844 A selection statement selects among a set of statements depending on the value of a
7845 controlling expression.
7846 <p><!--para 3 -->
7847 A selection statement is a block whose scope is a strict subset of the scope of its
7848 enclosing block. Each associated substatement is also a block whose scope is a strict
7849 subset of the scope of the selection statement.
7851 <h5><a name="6.8.4.1" href="#6.8.4.1">6.8.4.1 The if statement</a></h5>
7852 <h6>Constraints</h6>
7853 <p><!--para 1 -->
7854 The controlling expression of an if statement shall have scalar type.
7855 <h6>Semantics</h6>
7856 <p><!--para 2 -->
7857 In both forms, the first substatement is executed if the expression compares unequal to 0.
7858 In the else form, the second substatement is executed if the expression compares equal
7859 <!--page 166 -->
7860 to 0. If the first substatement is reached via a label, the second substatement is not
7861 executed.
7862 <p><!--para 3 -->
7863 An else is associated with the lexically nearest preceding if that is allowed by the
7864 syntax.
7866 <h5><a name="6.8.4.2" href="#6.8.4.2">6.8.4.2 The switch statement</a></h5>
7867 <h6>Constraints</h6>
7868 <p><!--para 1 -->
7869 The controlling expression of a switch statement shall have integer type.
7870 <p><!--para 2 -->
7871 If a switch statement has an associated case or default label within the scope of an
7872 identifier with a variably modified type, the entire switch statement shall be within the
7873 scope of that identifier.<sup><a href="#note154"><b>154)</b></a></sup>
7874 <p><!--para 3 -->
7875 The expression of each case label shall be an integer constant expression and no two of
7876 the case constant expressions in the same switch statement shall have the same value
7877 after conversion. There may be at most one default label in a switch statement.
7878 (Any enclosed switch statement may have a default label or case constant
7879 expressions with values that duplicate case constant expressions in the enclosing
7880 switch statement.)
7881 <h6>Semantics</h6>
7882 <p><!--para 4 -->
7883 A switch statement causes control to jump to, into, or past the statement that is the
7884 switch body, depending on the value of a controlling expression, and on the presence of a
7885 default label and the values of any case labels on or in the switch body. A case or
7886 default label is accessible only within the closest enclosing switch statement.
7887 <p><!--para 5 -->
7888 The integer promotions are performed on the controlling expression. The constant
7889 expression in each case label is converted to the promoted type of the controlling
7890 expression. If a converted value matches that of the promoted controlling expression,
7891 control jumps to the statement following the matched case label. Otherwise, if there is
7892 a default label, control jumps to the labeled statement. If no converted case constant
7893 expression matches and there is no default label, no part of the switch body is
7894 executed.
7895 <h6>Implementation limits</h6>
7896 <p><!--para 6 -->
7897 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
7898 switch statement.
7903 <!--page 167 -->
7904 <p><!--para 7 -->
7905 EXAMPLE In the artificial program fragment
7906 <pre>
7907 switch (expr)
7909 int i = 4;
7910 f(i);
7911 case 0:
7912 i = 17;
7913 /* falls through into default code */
7914 default:
7915 printf("%d\n", i);
7916 }</pre>
7917 the object whose identifier is i exists with automatic storage duration (within the block) but is never
7918 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
7919 access an indeterminate value. Similarly, the call to the function f cannot be reached.
7922 <h6>footnotes</h6>
7923 <p><small><a name="note154" href="#note154">154)</a> That is, the declaration either precedes the switch statement, or it follows the last case or
7924 default label associated with the switch that is in the block containing the declaration.
7925 </small>
7927 <h4><a name="6.8.5" href="#6.8.5">6.8.5 Iteration statements</a></h4>
7928 <h6>Syntax</h6>
7929 <p><!--para 1 -->
7930 <pre>
7931 iteration-statement:
7932 while ( expression ) statement
7933 do statement while ( expression ) ;
7934 for ( expressionopt ; expressionopt ; expressionopt ) statement
7935 for ( declaration expressionopt ; expressionopt ) statement</pre>
7936 <h6>Constraints</h6>
7937 <p><!--para 2 -->
7938 The controlling expression of an iteration statement shall have scalar type.
7939 <p><!--para 3 -->
7940 The declaration part of a for statement shall only declare identifiers for objects having
7941 storage class auto or register.
7942 <h6>Semantics</h6>
7943 <p><!--para 4 -->
7944 An iteration statement causes a statement called the loop body to be executed repeatedly
7945 until the controlling expression compares equal to 0. The repetition occurs regardless of
7946 whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note155"><b>155)</b></a></sup>
7947 <p><!--para 5 -->
7948 An iteration statement is a block whose scope is a strict subset of the scope of its
7949 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
7950 of the iteration statement.
7951 <p><!--para 6 -->
7952 An iteration statement whose controlling expression is not a constant expression,<sup><a href="#note156"><b>156)</b></a></sup> that
7953 performs no input/output operations, does not access volatile objects, and performs no
7954 synchronization or atomic operations in its body, controlling expression, or (in the case of
7956 <!--page 168 -->
7957 a for statement) its expression-3, may be assumed by the implementation to
7958 terminate.<sup><a href="#note157"><b>157)</b></a></sup>
7960 <h6>footnotes</h6>
7961 <p><small><a name="note155" href="#note155">155)</a> Code jumped over is not executed. In particular, the controlling expression of a for or while
7962 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
7963 </small>
7964 <p><small><a name="note156" href="#note156">156)</a> An omitted controlling expression is replaced by a nonzero constant, which is a constant expression.
7965 </small>
7966 <p><small><a name="note157" href="#note157">157)</a> This is intended to allow compiler transformations such as removal of empty loops even when
7967 termination cannot be proven.
7968 </small>
7970 <h5><a name="6.8.5.1" href="#6.8.5.1">6.8.5.1 The while statement</a></h5>
7971 <p><!--para 1 -->
7972 The evaluation of the controlling expression takes place before each execution of the loop
7973 body.
7975 <h5><a name="6.8.5.2" href="#6.8.5.2">6.8.5.2 The do statement</a></h5>
7976 <p><!--para 1 -->
7977 The evaluation of the controlling expression takes place after each execution of the loop
7978 body.
7980 <h5><a name="6.8.5.3" href="#6.8.5.3">6.8.5.3 The for statement</a></h5>
7981 <p><!--para 1 -->
7982 The statement
7983 <pre>
7984 for ( clause-1 ; expression-2 ; expression-3 ) statement</pre>
7985 behaves as follows: The expression expression-2 is the controlling expression that is
7986 evaluated before each execution of the loop body. The expression expression-3 is
7987 evaluated as a void expression after each execution of the loop body. If clause-1 is a
7988 declaration, the scope of any identifiers it declares is the remainder of the declaration and
7989 the entire loop, including the other two expressions; it is reached in the order of execution
7990 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
7991 evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note158"><b>158)</b></a></sup>
7992 <p><!--para 2 -->
7993 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
7994 nonzero constant.
7996 <h6>footnotes</h6>
7997 <p><small><a name="note158" href="#note158">158)</a> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
7998 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
7999 such that execution of the loop continues until the expression compares equal to 0; and expression-3
8000 specifies an operation (such as incrementing) that is performed after each iteration.
8001 </small>
8003 <h4><a name="6.8.6" href="#6.8.6">6.8.6 Jump statements</a></h4>
8004 <h6>Syntax</h6>
8005 <p><!--para 1 -->
8006 <pre>
8007 jump-statement:
8008 goto identifier ;
8009 continue ;
8010 break ;
8011 return expressionopt ;</pre>
8016 <!--page 169 -->
8017 <h6>Semantics</h6>
8018 <p><!--para 2 -->
8019 A jump statement causes an unconditional jump to another place.
8021 <h5><a name="6.8.6.1" href="#6.8.6.1">6.8.6.1 The goto statement</a></h5>
8022 <h6>Constraints</h6>
8023 <p><!--para 1 -->
8024 The identifier in a goto statement shall name a label located somewhere in the enclosing
8025 function. A goto statement shall not jump from outside the scope of an identifier having
8026 a variably modified type to inside the scope of that identifier.
8027 <h6>Semantics</h6>
8028 <p><!--para 2 -->
8029 A goto statement causes an unconditional jump to the statement prefixed by the named
8030 label in the enclosing function.
8031 <p><!--para 3 -->
8032 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
8033 following outline presents one possible approach to a problem based on these three assumptions:
8034 <ol>
8035 <li> The general initialization code accesses objects only visible to the current function.
8036 <li> The general initialization code is too large to warrant duplication.
8037 <li> The code to determine the next operation is at the head of the loop. (To allow it to be reached by
8038 continue statements, for example.)
8039 <!--page 170 -->
8040 </ol>
8041 <p><!--para 4 -->
8042 <pre>
8043 /* ... */
8044 goto first_time;
8045 for (;;) {
8046 // determine next operation
8047 /* ... */
8048 if (need to reinitialize) {
8049 // reinitialize-only code
8050 /* ... */
8051 first_time:
8052 // general initialization code
8053 /* ... */
8054 continue;
8056 // handle other operations
8057 /* ... */
8058 }</pre>
8059 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
8060 modified types. A jump within the scope, however, is permitted.
8061 <pre>
8062 goto lab3; // invalid: going INTO scope of VLA.
8064 double a[n];
8065 a[j] = <a href="#4.4">4.4</a>;
8066 lab3:
8067 a[j] = <a href="#3.3">3.3</a>;
8068 goto lab4; // valid: going WITHIN scope of VLA.
8069 a[j] = <a href="#5.5">5.5</a>;
8070 lab4:
8071 a[j] = <a href="#6.6">6.6</a>;
8073 goto lab4; // invalid: going INTO scope of VLA.</pre>
8076 <h5><a name="6.8.6.2" href="#6.8.6.2">6.8.6.2 The continue statement</a></h5>
8077 <h6>Constraints</h6>
8078 <p><!--para 1 -->
8079 A continue statement shall appear only in or as a loop body.
8080 <h6>Semantics</h6>
8081 <p><!--para 2 -->
8082 A continue statement causes a jump to the loop-continuation portion of the smallest
8083 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
8084 of the statements
8085 while (/* ... */) { do { for (/* ... */) {
8086 <pre>
8087 /* ... */ /* ... */ /* ... */
8088 continue; continue; continue;
8089 /* ... */ /* ... */ /* ... */</pre>
8090 contin: ; contin: ; contin: ;
8091 } } while (/* ... */); }
8092 unless the continue statement shown is in an enclosed iteration statement (in which
8093 case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note159"><b>159)</b></a></sup>
8095 <h6>footnotes</h6>
8096 <p><small><a name="note159" href="#note159">159)</a> Following the contin: label is a null statement.
8097 </small>
8099 <h5><a name="6.8.6.3" href="#6.8.6.3">6.8.6.3 The break statement</a></h5>
8100 <h6>Constraints</h6>
8101 <p><!--para 1 -->
8102 A break statement shall appear only in or as a switch body or loop body.
8103 <h6>Semantics</h6>
8104 <p><!--para 2 -->
8105 A break statement terminates execution of the smallest enclosing switch or iteration
8106 statement.
8110 <!--page 171 -->
8112 <h5><a name="6.8.6.4" href="#6.8.6.4">6.8.6.4 The return statement</a></h5>
8113 <h6>Constraints</h6>
8114 <p><!--para 1 -->
8115 A return statement with an expression shall not appear in a function whose return type
8116 is void. A return statement without an expression shall only appear in a function
8117 whose return type is void.
8118 <h6>Semantics</h6>
8119 <p><!--para 2 -->
8120 A return statement terminates execution of the current function and returns control to
8121 its caller. A function may have any number of return statements.
8122 <p><!--para 3 -->
8123 If a return statement with an expression is executed, the value of the expression is
8124 returned to the caller as the value of the function call expression. If the expression has a
8125 type different from the return type of the function in which it appears, the value is
8126 converted as if by assignment to an object having the return type of the function.<sup><a href="#note160"><b>160)</b></a></sup>
8127 <p><!--para 4 -->
8128 EXAMPLE In:
8129 <pre>
8130 struct s { double i; } f(void);
8131 union {
8132 struct {
8133 int f1;
8134 struct s f2;
8135 } u1;
8136 struct {
8137 struct s f3;
8138 int f4;
8139 } u2;
8140 } g;
8141 struct s f(void)
8143 return g.u1.f2;
8145 /* ... */
8146 g.u2.f3 = f();</pre>
8147 there is no undefined behavior, although there would be if the assignment were done directly (without using
8148 a function call to fetch the value).
8153 <!--page 172 -->
8155 <h6>footnotes</h6>
8156 <p><small><a name="note160" href="#note160">160)</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
8157 apply to the case of function return. The representation of floating-point values may have wider range
8158 or precision than implied by the type; a cast may be used to remove this extra range and precision.
8159 </small>
8161 <h3><a name="6.9" href="#6.9">6.9 External definitions</a></h3>
8162 <h6>Syntax</h6>
8163 <p><!--para 1 -->
8164 <pre>
8165 translation-unit:
8166 external-declaration
8167 translation-unit external-declaration
8168 external-declaration:
8169 function-definition
8170 declaration</pre>
8171 <h6>Constraints</h6>
8172 <p><!--para 2 -->
8173 The storage-class specifiers auto and register shall not appear in the declaration
8174 specifiers in an external declaration.
8175 <p><!--para 3 -->
8176 There shall be no more than one external definition for each identifier declared with
8177 internal linkage in a translation unit. Moreover, if an identifier declared with internal
8178 linkage is used in an expression (other than as a part of the operand of a sizeof
8179 operator whose result is an integer constant), there shall be exactly one external definition
8180 for the identifier in the translation unit.
8181 <h6>Semantics</h6>
8182 <p><!--para 4 -->
8183 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,
8184 which consists of a sequence of external declarations. These are described as ''external''
8185 because they appear outside any function (and hence have file scope). As discussed in
8186 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
8187 by the identifier is a definition.
8188 <p><!--para 5 -->
8189 An external definition is an external declaration that is also a definition of a function
8190 (other than an inline definition) or an object. If an identifier declared with external
8191 linkage is used in an expression (other than as part of the operand of a sizeof operator
8192 whose result is an integer constant), somewhere in the entire program there shall be
8193 exactly one external definition for the identifier; otherwise, there shall be no more than
8194 one.<sup><a href="#note161"><b>161)</b></a></sup>
8199 <!--page 173 -->
8201 <h6>footnotes</h6>
8202 <p><small><a name="note161" href="#note161">161)</a> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
8203 external definition for it.
8204 </small>
8206 <h4><a name="6.9.1" href="#6.9.1">6.9.1 Function definitions</a></h4>
8207 <h6>Syntax</h6>
8208 <p><!--para 1 -->
8209 <pre>
8210 function-definition:
8211 declaration-specifiers declarator declaration-listopt compound-statement
8212 declaration-list:
8213 declaration
8214 declaration-list declaration</pre>
8215 <h6>Constraints</h6>
8216 <p><!--para 2 -->
8217 The identifier declared in a function definition (which is the name of the function) shall
8218 have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note162"><b>162)</b></a></sup>
8219 <p><!--para 3 -->
8220 The return type of a function shall be void or a complete object type other than array
8221 type.
8222 <p><!--para 4 -->
8223 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
8224 static.
8225 <p><!--para 5 -->
8226 If the declarator includes a parameter type list, the declaration of each parameter shall
8227 include an identifier, except for the special case of a parameter list consisting of a single
8228 parameter of type void, in which case there shall not be an identifier. No declaration list
8229 shall follow.
8230 <p><!--para 6 -->
8231 If the declarator includes an identifier list, each declaration in the declaration list shall
8232 have at least one declarator, those declarators shall declare only identifiers from the
8233 identifier list, and every identifier in the identifier list shall be declared. An identifier
8234 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
8235 declaration list shall contain no storage-class specifier other than register and no
8236 initializations.
8240 <!--page 174 -->
8241 <h6>Semantics</h6>
8242 <p><!--para 7 -->
8243 The declarator in a function definition specifies the name of the function being defined
8244 and the identifiers of its parameters. If the declarator includes a parameter type list, the
8245 list also specifies the types of all the parameters; such a declarator also serves as a
8246 function prototype for later calls to the same function in the same translation unit. If the
8247 declarator includes an identifier list,<sup><a href="#note163"><b>163)</b></a></sup> the types of the parameters shall be declared in a
8248 following declaration list. In either case, the type of each parameter is adjusted as
8249 described in <a href="#6.7.6.3">6.7.6.3</a> for a parameter type list; the resulting type shall be a complete object
8250 type.
8251 <p><!--para 8 -->
8252 If a function that accepts a variable number of arguments is defined without a parameter
8253 type list that ends with the ellipsis notation, the behavior is undefined.
8254 <p><!--para 9 -->
8255 Each parameter has automatic storage duration; its identifier is an lvalue.<sup><a href="#note164"><b>164)</b></a></sup> The layout
8256 of the storage for parameters is unspecified.
8257 <p><!--para 10 -->
8258 On entry to the function, the size expressions of each variably modified parameter are
8259 evaluated and the value of each argument expression is converted to the type of the
8260 corresponding parameter as if by assignment. (Array expressions and function
8261 designators as arguments were converted to pointers before the call.)
8262 <p><!--para 11 -->
8263 After all parameters have been assigned, the compound statement that constitutes the
8264 body of the function definition is executed.
8265 <p><!--para 12 -->
8266 If the } that terminates a function is reached, and the value of the function call is used by
8267 the caller, the behavior is undefined.
8268 <p><!--para 13 -->
8269 EXAMPLE 1 In the following:
8270 <pre>
8271 extern int max(int a, int b)
8273 return a &gt; b ? a : b;
8274 }</pre>
8275 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
8276 function declarator; and
8277 <pre>
8278 { return a &gt; b ? a : b; }</pre>
8279 is the function body. The following similar definition uses the identifier-list form for the parameter
8280 declarations:
8285 <!--page 175 -->
8286 <pre>
8287 extern int max(a, b)
8288 int a, b;
8290 return a &gt; b ? a : b;
8291 }</pre>
8292 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
8293 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
8294 to the function, whereas the second form does not.
8296 <p><!--para 14 -->
8297 EXAMPLE 2 To pass one function to another, one might say
8298 <pre>
8299 int f(void);
8300 /* ... */
8301 g(f);</pre>
8302 Then the definition of g might read
8303 <pre>
8304 void g(int (*funcp)(void))
8306 /* ... */
8307 (*funcp)(); /* or funcp(); ... */
8308 }</pre>
8309 or, equivalently,
8310 <pre>
8311 void g(int func(void))
8313 /* ... */
8314 func(); /* or (*func)(); ... */
8315 }</pre>
8318 <h6>footnotes</h6>
8319 <p><small><a name="note162" href="#note162">162)</a> The intent is that the type category in a function definition cannot be inherited from a typedef:
8321 <pre>
8322 typedef int F(void); // type F is ''function with no parameters
8323 // returning int''
8324 F f, g; // f and g both have type compatible with F
8325 F f { /* ... */ } // WRONG: syntax/constraint error
8326 F g() { /* ... */ } // WRONG: declares that g returns a function
8327 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
8328 int g() { /* ... */ } // RIGHT: g has type compatible with F
8329 F *e(void) { /* ... */ } // e returns a pointer to a function
8330 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
8331 int (*fp)(void); // fp points to a function that has type F
8332 F *Fp; // Fp points to a function that has type F</pre>
8333 </small>
8334 <p><small><a name="note163" href="#note163">163)</a> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
8335 </small>
8336 <p><small><a name="note164" href="#note164">164)</a> A parameter identifier cannot be redeclared in the function body except in an enclosed block.
8337 </small>
8339 <h4><a name="6.9.2" href="#6.9.2">6.9.2 External object definitions</a></h4>
8340 <h6>Semantics</h6>
8341 <p><!--para 1 -->
8342 If the declaration of an identifier for an object has file scope and an initializer, the
8343 declaration is an external definition for the identifier.
8344 <p><!--para 2 -->
8345 A declaration of an identifier for an object that has file scope without an initializer, and
8346 without a storage-class specifier or with the storage-class specifier static, constitutes a
8347 tentative definition. If a translation unit contains one or more tentative definitions for an
8348 identifier, and the translation unit contains no external definition for that identifier, then
8349 the behavior is exactly as if the translation unit contains a file scope declaration of that
8350 identifier, with the composite type as of the end of the translation unit, with an initializer
8351 equal to 0.
8352 <p><!--para 3 -->
8353 If the declaration of an identifier for an object is a tentative definition and has internal
8354 linkage, the declared type shall not be an incomplete type.
8355 <!--page 176 -->
8356 <p><!--para 4 -->
8357 EXAMPLE 1
8358 <pre>
8359 int i1 = 1; // definition, external linkage
8360 static int i2 = 2; // definition, internal linkage
8361 extern int i3 = 3; // definition, external linkage
8362 int i4; // tentative definition, external linkage
8363 static int i5; // tentative definition, internal linkage
8364 int i1; // valid tentative definition, refers to previous
8365 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
8366 int i3; // valid tentative definition, refers to previous
8367 int i4; // valid tentative definition, refers to previous
8368 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
8369 extern int i1; // refers to previous, whose linkage is external
8370 extern int i2; // refers to previous, whose linkage is internal
8371 extern int i3; // refers to previous, whose linkage is external
8372 extern int i4; // refers to previous, whose linkage is external
8373 extern int i5; // refers to previous, whose linkage is internal</pre>
8375 <p><!--para 5 -->
8376 EXAMPLE 2 If at the end of the translation unit containing
8377 <pre>
8378 int i[];</pre>
8379 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
8380 zero on program startup.
8381 <!--page 177 -->
8383 <h3><a name="6.10" href="#6.10">6.10 Preprocessing directives</a></h3>
8384 <h6>Syntax</h6>
8385 <p><!--para 1 -->
8386 <!--page 178 -->
8387 <pre>
8388 preprocessing-file:
8389 groupopt
8390 group:
8391 group-part
8392 group group-part
8393 group-part:
8394 if-section
8395 control-line
8396 text-line
8397 # non-directive
8398 if-section:
8399 if-group elif-groupsopt else-groupopt endif-line
8400 if-group:
8401 # if constant-expression new-line groupopt
8402 # ifdef identifier new-line groupopt
8403 # ifndef identifier new-line groupopt
8404 elif-groups:
8405 elif-group
8406 elif-groups elif-group
8407 elif-group:
8408 # elif constant-expression new-line groupopt
8409 else-group:
8410 # else new-line groupopt
8411 endif-line:
8412 # endif new-line
8413 control-line:
8414 # include pp-tokens new-line
8415 # define identifier replacement-list new-line
8416 # define identifier lparen identifier-listopt )
8417 replacement-list new-line
8418 # define identifier lparen ... ) replacement-list new-line
8419 # define identifier lparen identifier-list , ... )
8420 replacement-list new-line
8421 # undef identifier new-line
8422 # line pp-tokens new-line
8423 # error pp-tokensopt new-line
8424 # pragma pp-tokensopt new-line
8425 # new-line
8426 text-line:
8427 pp-tokensopt new-line
8428 non-directive:
8429 pp-tokens new-line
8430 lparen:
8431 a ( character not immediately preceded by white-space
8432 replacement-list:
8433 pp-tokensopt
8434 pp-tokens:
8435 preprocessing-token
8436 pp-tokens preprocessing-token
8437 new-line:
8438 the new-line character</pre>
8439 <h6>Description</h6>
8440 <p><!--para 2 -->
8441 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
8442 following constraints: The first token in the sequence is a # preprocessing token that (at
8443 the start of translation phase 4) is either the first character in the source file (optionally
8444 after white space containing no new-line characters) or that follows white space
8445 containing at least one new-line character. The last token in the sequence is the first new-
8446 line character that follows the first token in the sequence.<sup><a href="#note165"><b>165)</b></a></sup> A new-line character ends
8447 the preprocessing directive even if it occurs within what would otherwise be an
8449 <!--page 179 -->
8450 invocation of a function-like macro.
8451 <p><!--para 3 -->
8452 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
8453 with any of the directive names appearing in the syntax.
8454 <p><!--para 4 -->
8455 When in a group that is skipped (<a href="#6.10.1">6.10.1</a>), the directive syntax is relaxed to allow any
8456 sequence of preprocessing tokens to occur between the directive name and the following
8457 new-line character.
8458 <h6>Constraints</h6>
8459 <p><!--para 5 -->
8460 The only white-space characters that shall appear between preprocessing tokens within a
8461 preprocessing directive (from just after the introducing # preprocessing token through
8462 just before the terminating new-line character) are space and horizontal-tab (including
8463 spaces that have replaced comments or possibly other white-space characters in
8464 translation phase 3).
8465 <h6>Semantics</h6>
8466 <p><!--para 6 -->
8467 The implementation can process and skip sections of source files conditionally, include
8468 other source files, and replace macros. These capabilities are called preprocessing,
8469 because conceptually they occur before translation of the resulting translation unit.
8470 <p><!--para 7 -->
8471 The preprocessing tokens within a preprocessing directive are not subject to macro
8472 expansion unless otherwise stated.
8473 <p><!--para 8 -->
8474 EXAMPLE In:
8475 <pre>
8476 #define EMPTY
8477 EMPTY # include &lt;file.h&gt;</pre>
8478 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
8479 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
8480 replaced.
8483 <h6>footnotes</h6>
8484 <p><small><a name="note165" href="#note165">165)</a> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
8485 significance, as all white space is equivalent except in certain situations during preprocessing (see the
8486 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
8487 </small>
8489 <h4><a name="6.10.1" href="#6.10.1">6.10.1 Conditional inclusion</a></h4>
8490 <h6>Constraints</h6>
8491 <p><!--para 1 -->
8492 The expression that controls conditional inclusion shall be an integer constant expression
8493 except that: identifiers (including those lexically identical to keywords) are interpreted as *
8494 described below;<sup><a href="#note166"><b>166)</b></a></sup> and it may contain unary operator expressions of the form
8495 <pre>
8496 defined identifier</pre>
8498 <pre>
8499 defined ( identifier )</pre>
8500 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
8503 <!--page 180 -->
8504 predefined or if it has been the subject of a #define preprocessing directive without an
8505 intervening #undef directive with the same subject identifier), 0 if it is not.
8506 <p><!--para 2 -->
8507 Each preprocessing token that remains (in the list of preprocessing tokens that will
8508 become the controlling expression) after all macro replacements have occurred shall be in
8509 the lexical form of a token (<a href="#6.4">6.4</a>).
8510 <h6>Semantics</h6>
8511 <p><!--para 3 -->
8512 Preprocessing directives of the forms
8513 <pre>
8514 # if constant-expression new-line groupopt
8515 # elif constant-expression new-line groupopt</pre>
8516 check whether the controlling constant expression evaluates to nonzero.
8517 <p><!--para 4 -->
8518 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
8519 the controlling constant expression are replaced (except for those macro names modified
8520 by the defined unary operator), just as in normal text. If the token defined is
8521 generated as a result of this replacement process or use of the defined unary operator
8522 does not match one of the two specified forms prior to macro replacement, the behavior is
8523 undefined. After all replacements due to macro expansion and the defined unary
8524 operator have been performed, all remaining identifiers (including those lexically
8525 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
8526 token is converted into a token. The resulting tokens compose the controlling constant
8527 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
8528 token conversion and evaluation, all signed integer types and all unsigned integer types
8529 act as if they have the same representation as, respectively, the types intmax_t and
8530 uintmax_t defined in the header <a href="#7.20">&lt;stdint.h&gt;</a>.<sup><a href="#note167"><b>167)</b></a></sup> This includes interpreting
8531 character constants, which may involve converting escape sequences into execution
8532 character set members. Whether the numeric value for these character constants matches
8533 the value obtained when an identical character constant occurs in an expression (other
8534 than within a #if or #elif directive) is implementation-defined.<sup><a href="#note168"><b>168)</b></a></sup> Also, whether a
8535 single-character character constant may have a negative value is implementation-defined.
8540 <!--page 181 -->
8541 <p><!--para 5 -->
8542 Preprocessing directives of the forms
8543 <pre>
8544 # ifdef identifier new-line groupopt
8545 # ifndef identifier new-line groupopt</pre>
8546 check whether the identifier is or is not currently defined as a macro name. Their
8547 conditions are equivalent to #if defined identifier and #if !defined identifier
8548 respectively.
8549 <p><!--para 6 -->
8550 Each directive's condition is checked in order. If it evaluates to false (zero), the group
8551 that it controls is skipped: directives are processed only through the name that determines
8552 the directive in order to keep track of the level of nested conditionals; the rest of the
8553 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
8554 group. Only the first group whose control condition evaluates to true (nonzero) is
8555 processed. If none of the conditions evaluates to true, and there is a #else directive, the
8556 group controlled by the #else is processed; lacking a #else directive, all the groups
8557 until the #endif are skipped.<sup><a href="#note169"><b>169)</b></a></sup>
8558 <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
8559 integer types (<a href="#7.20.1.5">7.20.1.5</a>).
8561 <h6>footnotes</h6>
8562 <p><small><a name="note166" href="#note166">166)</a> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
8563 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
8564 </small>
8565 <p><small><a name="note167" href="#note167">167)</a> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
8566 0x8000 is signed and positive within a #if expression even though it would be unsigned in
8567 translation phase 7.
8568 </small>
8569 <p><small><a name="note168" href="#note168">168)</a> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
8570 evaluate to the same value in these two contexts.
8571 #if 'z' - 'a' == 25
8572 if ('z' - 'a' == 25)
8573 </small>
8574 <p><small><a name="note169" href="#note169">169)</a> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
8575 before the terminating new-line character. However, comments may appear anywhere in a source file,
8576 including within a preprocessing directive.
8577 </small>
8579 <h4><a name="6.10.2" href="#6.10.2">6.10.2 Source file inclusion</a></h4>
8580 <h6>Constraints</h6>
8581 <p><!--para 1 -->
8582 A #include directive shall identify a header or source file that can be processed by the
8583 implementation.
8584 <h6>Semantics</h6>
8585 <p><!--para 2 -->
8586 A preprocessing directive of the form
8587 <pre>
8588 # include &lt;h-char-sequence&gt; new-line</pre>
8589 searches a sequence of implementation-defined places for a header identified uniquely by
8590 the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
8591 directive by the entire contents of the header. How the places are specified or the header
8592 identified is implementation-defined.
8593 <p><!--para 3 -->
8594 A preprocessing directive of the form
8595 <pre>
8596 # include "q-char-sequence" new-line</pre>
8597 causes the replacement of that directive by the entire contents of the source file identified
8598 by the specified sequence between the " delimiters. The named source file is searched
8601 <!--page 182 -->
8602 for in an implementation-defined manner. If this search is not supported, or if the search
8603 fails, the directive is reprocessed as if it read
8604 <pre>
8605 # include &lt;h-char-sequence&gt; new-line</pre>
8606 with the identical contained sequence (including &gt; characters, if any) from the original
8607 directive.
8608 <p><!--para 4 -->
8609 A preprocessing directive of the form
8610 <pre>
8611 # include pp-tokens new-line</pre>
8612 (that does not match one of the two previous forms) is permitted. The preprocessing
8613 tokens after include in the directive are processed just as in normal text. (Each
8614 identifier currently defined as a macro name is replaced by its replacement list of
8615 preprocessing tokens.) The directive resulting after all replacements shall match one of
8616 the two previous forms.<sup><a href="#note170"><b>170)</b></a></sup> The method by which a sequence of preprocessing tokens
8617 between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
8618 single header name preprocessing token is implementation-defined.
8619 <p><!--para 5 -->
8620 The implementation shall provide unique mappings for sequences consisting of one or
8621 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
8622 first character shall not be a digit. The implementation may ignore distinctions of
8623 alphabetical case and restrict the mapping to eight significant characters before the
8624 period.
8625 <p><!--para 6 -->
8626 A #include preprocessing directive may appear in a source file that has been read
8627 because of a #include directive in another file, up to an implementation-defined
8628 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
8629 <p><!--para 7 -->
8630 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
8631 <pre>
8632 #include <a href="#7.21">&lt;stdio.h&gt;</a>
8633 #include "myprog.h"</pre>
8638 <!--page 183 -->
8639 <p><!--para 8 -->
8640 EXAMPLE 2 This illustrates macro-replaced #include directives:
8641 <pre>
8642 #if VERSION == 1
8643 #define INCFILE "vers1.h"
8644 #elif VERSION == 2
8645 #define INCFILE "vers2.h" // and so on
8646 #else
8647 #define INCFILE "versN.h"
8648 #endif
8649 #include INCFILE</pre>
8651 <p><b> Forward references</b>: macro replacement (<a href="#6.10.3">6.10.3</a>).
8653 <h6>footnotes</h6>
8654 <p><small><a name="note170" href="#note170">170)</a> Note that adjacent string literals are not concatenated into a single string literal (see the translation
8655 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.
8656 </small>
8658 <h4><a name="6.10.3" href="#6.10.3">6.10.3 Macro replacement</a></h4>
8659 <h6>Constraints</h6>
8660 <p><!--para 1 -->
8661 Two replacement lists are identical if and only if the preprocessing tokens in both have
8662 the same number, ordering, spelling, and white-space separation, where all white-space
8663 separations are considered identical.
8664 <p><!--para 2 -->
8665 An identifier currently defined as an object-like macro shall not be redefined by another
8666 #define preprocessing directive unless the second definition is an object-like macro
8667 definition and the two replacement lists are identical. Likewise, an identifier currently
8668 defined as a function-like macro shall not be redefined by another #define
8669 preprocessing directive unless the second definition is a function-like macro definition
8670 that has the same number and spelling of parameters, and the two replacement lists are
8671 identical.
8672 <p><!--para 3 -->
8673 There shall be white-space between the identifier and the replacement list in the definition
8674 of an object-like macro.
8675 <p><!--para 4 -->
8676 If the identifier-list in the macro definition does not end with an ellipsis, the number of
8677 arguments (including those arguments consisting of no preprocessing tokens) in an
8678 invocation of a function-like macro shall equal the number of parameters in the macro
8679 definition. Otherwise, there shall be more arguments in the invocation than there are
8680 parameters in the macro definition (excluding the ...). There shall exist a )
8681 preprocessing token that terminates the invocation.
8682 <p><!--para 5 -->
8683 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
8684 macro that uses the ellipsis notation in the parameters.
8685 <p><!--para 6 -->
8686 A parameter identifier in a function-like macro shall be uniquely declared within its
8687 scope.
8688 <h6>Semantics</h6>
8689 <p><!--para 7 -->
8690 The identifier immediately following the define is called the macro name. There is one
8691 name space for macro names. Any white-space characters preceding or following the
8692 replacement list of preprocessing tokens are not considered part of the replacement list
8693 <!--page 184 -->
8694 for either form of macro.
8695 <p><!--para 8 -->
8696 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
8697 a preprocessing directive could begin, the identifier is not subject to macro replacement.
8698 <p><!--para 9 -->
8699 A preprocessing directive of the form
8700 <pre>
8701 # define identifier replacement-list new-line</pre>
8702 defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note171"><b>171)</b></a></sup>
8703 to be replaced by the replacement list of preprocessing tokens that constitute the
8704 remainder of the directive. The replacement list is then rescanned for more macro names
8705 as specified below.
8706 <p><!--para 10 -->
8707 A preprocessing directive of the form
8708 <pre>
8709 # define identifier lparen identifier-listopt ) replacement-list new-line
8710 # define identifier lparen ... ) replacement-list new-line
8711 # define identifier lparen identifier-list , ... ) replacement-list new-line</pre>
8712 defines a function-like macro with parameters, whose use is similar syntactically to a
8713 function call. The parameters are specified by the optional list of identifiers, whose scope
8714 extends from their declaration in the identifier list until the new-line character that
8715 terminates the #define preprocessing directive. Each subsequent instance of the
8716 function-like macro name followed by a ( as the next preprocessing token introduces the
8717 sequence of preprocessing tokens that is replaced by the replacement list in the definition
8718 (an invocation of the macro). The replaced sequence of preprocessing tokens is
8719 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
8720 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
8721 tokens making up an invocation of a function-like macro, new-line is considered a normal
8722 white-space character.
8723 <p><!--para 11 -->
8724 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
8725 forms the list of arguments for the function-like macro. The individual arguments within
8726 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
8727 between matching inner parentheses do not separate arguments. If there are sequences of
8728 preprocessing tokens within the list of arguments that would otherwise act as
8729 preprocessing directives,<sup><a href="#note172"><b>172)</b></a></sup> the behavior is undefined.
8730 <p><!--para 12 -->
8731 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
8732 including any separating comma preprocessing tokens, are merged to form a single item:
8735 <!--page 185 -->
8736 the variable arguments. The number of arguments so combined is such that, following
8737 merger, the number of arguments is one more than the number of parameters in the macro
8738 definition (excluding the ...).
8740 <h6>footnotes</h6>
8741 <p><small><a name="note171" href="#note171">171)</a> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
8742 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
8743 are never scanned for macro names or parameters.
8744 </small>
8745 <p><small><a name="note172" href="#note172">172)</a> Despite the name, a non-directive is a preprocessing directive.
8746 </small>
8748 <h5><a name="6.10.3.1" href="#6.10.3.1">6.10.3.1 Argument substitution</a></h5>
8749 <p><!--para 1 -->
8750 After the arguments for the invocation of a function-like macro have been identified,
8751 argument substitution takes place. A parameter in the replacement list, unless preceded
8752 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
8753 replaced by the corresponding argument after all macros contained therein have been
8754 expanded. Before being substituted, each argument's preprocessing tokens are
8755 completely macro replaced as if they formed the rest of the preprocessing file; no other
8756 preprocessing tokens are available.
8757 <p><!--para 2 -->
8758 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
8759 were a parameter, and the variable arguments shall form the preprocessing tokens used to
8760 replace it.
8762 <h5><a name="6.10.3.2" href="#6.10.3.2">6.10.3.2 The # operator</a></h5>
8763 <h6>Constraints</h6>
8764 <p><!--para 1 -->
8765 Each # preprocessing token in the replacement list for a function-like macro shall be
8766 followed by a parameter as the next preprocessing token in the replacement list.
8767 <h6>Semantics</h6>
8768 <p><!--para 2 -->
8769 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
8770 token, both are replaced by a single character string literal preprocessing token that
8771 contains the spelling of the preprocessing token sequence for the corresponding
8772 argument. Each occurrence of white space between the argument's preprocessing tokens
8773 becomes a single space character in the character string literal. White space before the
8774 first preprocessing token and after the last preprocessing token composing the argument
8775 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
8776 is retained in the character string literal, except for special handling for producing the
8777 spelling of string literals and character constants: a \ character is inserted before each "
8778 and \ character of a character constant or string literal (including the delimiting "
8779 characters), except that it is implementation-defined whether a \ character is inserted
8780 before the \ character beginning a universal character name. If the replacement that
8781 results is not a valid character string literal, the behavior is undefined. The character
8782 string literal corresponding to an empty argument is "". The order of evaluation of # and
8783 ## operators is unspecified.
8784 <!--page 186 -->
8786 <h5><a name="6.10.3.3" href="#6.10.3.3">6.10.3.3 The ## operator</a></h5>
8787 <h6>Constraints</h6>
8788 <p><!--para 1 -->
8789 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
8790 list for either form of macro definition.
8791 <h6>Semantics</h6>
8792 <p><!--para 2 -->
8793 If, in the replacement list of a function-like macro, a parameter is immediately preceded
8794 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
8795 argument's preprocessing token sequence; however, if an argument consists of no
8796 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
8797 instead.<sup><a href="#note173"><b>173)</b></a></sup>
8798 <p><!--para 3 -->
8799 For both object-like and function-like macro invocations, before the replacement list is
8800 reexamined for more macro names to replace, each instance of a ## preprocessing token
8801 in the replacement list (not from an argument) is deleted and the preceding preprocessing
8802 token is concatenated with the following preprocessing token. Placemarker
8803 preprocessing tokens are handled specially: concatenation of two placemarkers results in
8804 a single placemarker preprocessing token, and concatenation of a placemarker with a
8805 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
8806 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
8807 token is available for further macro replacement. The order of evaluation of ## operators
8808 is unspecified.
8809 <p><!--para 4 -->
8810 EXAMPLE In the following fragment:
8811 <pre>
8812 #define hash_hash # ## #
8813 #define mkstr(a) # a
8814 #define in_between(a) mkstr(a)
8815 #define join(c, d) in_between(c hash_hash d)
8816 char p[] = join(x, y); // equivalent to
8817 // char p[] = "x ## y";</pre>
8818 The expansion produces, at various stages:
8819 <pre>
8820 join(x, y)
8821 in_between(x hash_hash y)
8822 in_between(x ## y)
8823 mkstr(x ## y)
8824 "x ## y"</pre>
8825 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
8826 this new token is not the ## operator.
8829 <!--page 187 -->
8831 <h6>footnotes</h6>
8832 <p><small><a name="note173" href="#note173">173)</a> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
8833 exist only within translation phase 4.
8834 </small>
8836 <h5><a name="6.10.3.4" href="#6.10.3.4">6.10.3.4 Rescanning and further replacement</a></h5>
8837 <p><!--para 1 -->
8838 After all parameters in the replacement list have been substituted and # and ##
8839 processing has taken place, all placemarker preprocessing tokens are removed. The
8840 resulting preprocessing token sequence is then rescanned, along with all subsequent
8841 preprocessing tokens of the source file, for more macro names to replace.
8842 <p><!--para 2 -->
8843 If the name of the macro being replaced is found during this scan of the replacement list
8844 (not including the rest of the source file's preprocessing tokens), it is not replaced.
8845 Furthermore, if any nested replacements encounter the name of the macro being replaced,
8846 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
8847 available for further replacement even if they are later (re)examined in contexts in which
8848 that macro name preprocessing token would otherwise have been replaced.
8849 <p><!--para 3 -->
8850 The resulting completely macro-replaced preprocessing token sequence is not processed
8851 as a preprocessing directive even if it resembles one, but all pragma unary operator
8852 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
8854 <h5><a name="6.10.3.5" href="#6.10.3.5">6.10.3.5 Scope of macro definitions</a></h5>
8855 <p><!--para 1 -->
8856 A macro definition lasts (independent of block structure) until a corresponding #undef
8857 directive is encountered or (if none is encountered) until the end of the preprocessing
8858 translation unit. Macro definitions have no significance after translation phase 4.
8859 <p><!--para 2 -->
8860 A preprocessing directive of the form
8861 <pre>
8862 # undef identifier new-line</pre>
8863 causes the specified identifier no longer to be defined as a macro name. It is ignored if
8864 the specified identifier is not currently defined as a macro name.
8865 <p><!--para 3 -->
8866 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
8867 <pre>
8868 #define TABSIZE 100
8869 int table[TABSIZE];</pre>
8871 <p><!--para 4 -->
8872 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
8873 It has the advantages of working for any compatible types of the arguments and of generating in-line code
8874 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
8875 arguments a second time (including side effects) and generating more code than a function if invoked
8876 several times. It also cannot have its address taken, as it has none.
8877 <pre>
8878 #define max(a, b) ((a) &gt; (b) ? (a) : (b))</pre>
8879 The parentheses ensure that the arguments and the resulting expression are bound properly.
8880 <!--page 188 -->
8881 <p><!--para 5 -->
8882 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
8883 <pre>
8884 #define x 3
8885 #define f(a) f(x * (a))
8886 #undef x
8887 #define x 2
8888 #define g f
8889 #define z z[0]
8890 #define h g(~
8891 #define m(a) a(w)
8892 #define w 0,1
8893 #define t(a) a
8894 #define p() int
8895 #define q(x) x
8896 #define r(x,y) x ## y
8897 #define str(x) # x
8898 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
8899 g(x+(3,4)-w) | h 5) &amp; m
8900 (f)^m(m);
8901 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
8902 char c[2][6] = { str(hello), str() };</pre>
8903 results in
8904 <pre>
8905 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
8906 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
8907 int i[] = { 1, 23, 4, 5, };
8908 char c[2][6] = { "hello", "" };</pre>
8910 <p><!--para 6 -->
8911 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
8912 sequence
8913 <pre>
8914 #define str(s) # s
8915 #define xstr(s) str(s)
8916 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
8917 x ## s, x ## t)
8918 #define INCFILE(n) vers ## n
8919 #define glue(a, b) a ## b
8920 #define xglue(a, b) glue(a, b)
8921 #define HIGHLOW "hello"
8922 #define LOW LOW ", world"
8923 debug(1, 2);
8924 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
8925 == 0) str(: @\n), s);
8926 #include xstr(INCFILE(2).h)
8927 glue(HIGH, LOW);
8928 xglue(HIGH, LOW)</pre>
8929 results in
8930 <!--page 189 -->
8931 <pre>
8932 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
8933 fputs(
8934 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
8936 #include "vers2.h" (after macro replacement, before file access)
8937 "hello";
8938 "hello" ", world"</pre>
8939 or, after concatenation of the character string literals,
8940 <pre>
8941 printf("x1= %d, x2= %s", x1, x2);
8942 fputs(
8943 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
8945 #include "vers2.h" (after macro replacement, before file access)
8946 "hello";
8947 "hello, world"</pre>
8948 Space around the # and ## tokens in the macro definition is optional.
8950 <p><!--para 7 -->
8951 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
8952 <pre>
8953 #define t(x,y,z) x ## y ## z
8954 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
8955 t(10,,), t(,11,), t(,,12), t(,,) };</pre>
8956 results in
8957 <pre>
8958 int j[] = { 123, 45, 67, 89,
8959 10, 11, 12, };</pre>
8961 <p><!--para 8 -->
8962 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
8963 <pre>
8964 #define OBJ_LIKE (1-1)
8965 #define OBJ_LIKE /* white space */ (1-1) /* other */
8966 #define FUNC_LIKE(a) ( a )
8967 #define FUNC_LIKE( a )( /* note the white space */ \
8968 a /* other stuff on this line
8969 */ )</pre>
8970 But the following redefinitions are invalid:
8971 <pre>
8972 #define OBJ_LIKE (0) // different token sequence
8973 #define OBJ_LIKE (1 - 1) // different white space
8974 #define FUNC_LIKE(b) ( a ) // different parameter usage
8975 #define FUNC_LIKE(b) ( b ) // different parameter spelling</pre>
8977 <p><!--para 9 -->
8978 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
8979 <!--page 190 -->
8980 <pre>
8981 #define debug(...) fprintf(stderr, __VA_ARGS__)
8982 #define showlist(...) puts(#__VA_ARGS__)
8983 #define report(test, ...) ((test)?puts(#test):\
8984 printf(__VA_ARGS__))
8985 debug("Flag");
8986 debug("X = %d\n", x);
8987 showlist(The first, second, and third items.);
8988 report(x&gt;y, "x is %d but y is %d", x, y);</pre>
8989 results in
8990 <pre>
8991 fprintf(stderr, "Flag" );
8992 fprintf(stderr, "X = %d\n", x );
8993 puts( "The first, second, and third items." );
8994 ((x&gt;y)?puts("x&gt;y"):
8995 printf("x is %d but y is %d", x, y));</pre>
8998 <h4><a name="6.10.4" href="#6.10.4">6.10.4 Line control</a></h4>
8999 <h6>Constraints</h6>
9000 <p><!--para 1 -->
9001 The string literal of a #line directive, if present, shall be a character string literal.
9002 <h6>Semantics</h6>
9003 <p><!--para 2 -->
9004 The line number of the current source line is one greater than the number of new-line
9005 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
9006 file to the current token.
9007 <p><!--para 3 -->
9008 A preprocessing directive of the form
9009 <pre>
9010 # line digit-sequence new-line</pre>
9011 causes the implementation to behave as if the following sequence of source lines begins
9012 with a source line that has a line number as specified by the digit sequence (interpreted as
9013 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
9014 2147483647.
9015 <p><!--para 4 -->
9016 A preprocessing directive of the form
9017 <pre>
9018 # line digit-sequence "s-char-sequenceopt" new-line</pre>
9019 sets the presumed line number similarly and changes the presumed name of the source
9020 file to be the contents of the character string literal.
9021 <p><!--para 5 -->
9022 A preprocessing directive of the form
9023 <pre>
9024 # line pp-tokens new-line</pre>
9025 (that does not match one of the two previous forms) is permitted. The preprocessing
9026 tokens after line on the directive are processed just as in normal text (each identifier
9027 currently defined as a macro name is replaced by its replacement list of preprocessing
9028 tokens). The directive resulting after all replacements shall match one of the two
9029 previous forms and is then processed as appropriate.
9030 <!--page 191 -->
9032 <h4><a name="6.10.5" href="#6.10.5">6.10.5 Error directive</a></h4>
9033 <h6>Semantics</h6>
9034 <p><!--para 1 -->
9035 A preprocessing directive of the form
9036 <pre>
9037 # error pp-tokensopt new-line</pre>
9038 causes the implementation to produce a diagnostic message that includes the specified
9039 sequence of preprocessing tokens.
9041 <h4><a name="6.10.6" href="#6.10.6">6.10.6 Pragma directive</a></h4>
9042 <h6>Semantics</h6>
9043 <p><!--para 1 -->
9044 A preprocessing directive of the form
9045 <pre>
9046 # pragma pp-tokensopt new-line</pre>
9047 where the preprocessing token STDC does not immediately follow pragma in the
9048 directive (prior to any macro replacement)<sup><a href="#note174"><b>174)</b></a></sup> causes the implementation to behave in an
9049 implementation-defined manner. The behavior might cause translation to fail or cause the
9050 translator or the resulting program to behave in a non-conforming manner. Any such
9051 pragma that is not recognized by the implementation is ignored.
9052 <p><!--para 2 -->
9053 If the preprocessing token STDC does immediately follow pragma in the directive (prior
9054 to any macro replacement), then no macro replacement is performed on the directive, and
9055 the directive shall have one of the following forms<sup><a href="#note175"><b>175)</b></a></sup> whose meanings are described
9056 elsewhere:
9057 <pre>
9058 #pragma STDC FP_CONTRACT on-off-switch
9059 #pragma STDC FENV_ACCESS on-off-switch
9060 #pragma STDC CX_LIMITED_RANGE on-off-switch
9061 on-off-switch: one of
9062 ON OFF DEFAULT</pre>
9063 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
9064 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
9069 <!--page 192 -->
9071 <h6>footnotes</h6>
9072 <p><small><a name="note174" href="#note174">174)</a> An implementation is not required to perform macro replacement in pragmas, but it is permitted
9073 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
9074 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
9075 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
9076 but is not required to.
9077 </small>
9078 <p><small><a name="note175" href="#note175">175)</a> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
9079 </small>
9081 <h4><a name="6.10.7" href="#6.10.7">6.10.7 Null directive</a></h4>
9082 <h6>Semantics</h6>
9083 <p><!--para 1 -->
9084 A preprocessing directive of the form
9085 <pre>
9086 # new-line</pre>
9087 has no effect.
9089 <h4><a name="6.10.8" href="#6.10.8">6.10.8 Predefined macro names</a></h4>
9090 <p><!--para 1 -->
9091 The values of the predefined macros listed in the following subclauses<sup><a href="#note176"><b>176)</b></a></sup> (except for
9092 __FILE__ and __LINE__) remain constant throughout the translation unit.
9093 <p><!--para 2 -->
9094 None of these macro names, nor the identifier defined, shall be the subject of a
9095 #define or a #undef preprocessing directive. Any other predefined macro names
9096 shall begin with a leading underscore followed by an uppercase letter or a second
9097 underscore.
9098 <p><!--para 3 -->
9099 The implementation shall not predefine the macro __cplusplus, nor shall it define it
9100 in any standard header.
9101 <p><b> Forward references</b>: standard headers (<a href="#7.1.2">7.1.2</a>).
9103 <h6>footnotes</h6>
9104 <p><small><a name="note176" href="#note176">176)</a> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
9105 </small>
9107 <h5><a name="6.10.8.1" href="#6.10.8.1">6.10.8.1 Mandatory macros</a></h5>
9108 <p><!--para 1 -->
9109 The following macro names shall be defined by the implementation:
9110 __DATE__ The date of translation of the preprocessing translation unit: a character
9111 <pre>
9112 string literal of the form "Mmm dd yyyy", where the names of the
9113 months are the same as those generated by the asctime function, and the
9114 first character of dd is a space character if the value is less than 10. If the
9115 date of translation is not available, an implementation-defined valid date
9116 shall be supplied.</pre>
9117 __FILE__ The presumed name of the current source file (a character string literal).<sup><a href="#note177"><b>177)</b></a></sup>
9118 __LINE__ The presumed line number (within the current source file) of the current
9119 <pre>
9120 source line (an integer constant).<sup><a href="#note177"><b>177)</b></a></sup></pre>
9121 __STDC__ The integer constant 1, intended to indicate a conforming implementation.
9122 __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
9123 <pre>
9124 implementation or the integer constant 0 if it is not.</pre>
9129 <!--page 193 -->
9130 __STDC_VERSION__ The integer constant 201ymmL.<sup><a href="#note178"><b>178)</b></a></sup>
9131 __TIME__ The time of translation of the preprocessing translation unit: a character
9132 <pre>
9133 string literal of the form "hh:mm:ss" as in the time generated by the
9134 asctime function. If the time of translation is not available, an
9135 implementation-defined valid time shall be supplied.</pre>
9136 <p><b> Forward references</b>: the asctime function (<a href="#7.26.3.1">7.26.3.1</a>).
9138 <h6>footnotes</h6>
9139 <p><small><a name="note177" href="#note177">177)</a> The presumed source file name and line number can be changed by the #line directive.
9140 </small>
9141 <p><small><a name="note178" href="#note178">178)</a> This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
9142 ISO/IEC 9899/AMD1:1995 and as 199901L in ISO/IEC 9899:1999. The intention is that this will
9143 remain an integer constant of type long int that is increased with each revision of this International
9144 Standard.
9145 </small>
9147 <h5><a name="6.10.8.2" href="#6.10.8.2">6.10.8.2 Environment macros</a></h5>
9148 <p><!--para 1 -->
9149 The following macro names are conditionally defined by the implementation:
9150 __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
9151 <pre>
9152 199712L). If this symbol is defined, then every character in the Unicode
9153 required set, when stored in an object of type wchar_t, has the same
9154 value as the short identifier of that character. The Unicode required set
9155 consists of all the characters that are defined by ISO/IEC 10646, along with
9156 all amendments and technical corrigenda, as of the specified year and
9157 month. If some other encoding is used, the macro shall not be defined and
9158 the actual encoding used is implementation-defined.</pre>
9159 __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
9160 <pre>
9161 the encoding for wchar_t, a member of the basic character set need not
9162 have a code value equal to its value when used as the lone character in an
9163 integer character constant.</pre>
9164 __STDC_UTF_16__ The integer constant 1, intended to indicate that values of type
9165 <pre>
9166 char16_t are UTF-16 encoded. If some other encoding is used, the
9167 macro shall not be defined and the actual encoding used is implementation-
9168 defined.</pre>
9169 __STDC_UTF_32__ The integer constant 1, intended to indicate that values of type
9170 <pre>
9171 char32_t are UTF-32 encoded. If some other encoding is used, the
9172 macro shall not be defined and the actual encoding used is implementation-
9173 defined.</pre>
9174 <p><b> Forward references</b>: common definitions (<a href="#7.19">7.19</a>), unicode utilities (<a href="#7.27">7.27</a>).
9179 <!--page 194 -->
9181 <h5><a name="6.10.8.3" href="#6.10.8.3">6.10.8.3 Conditional feature macros</a></h5>
9182 <p><!--para 1 -->
9183 The following macro names are conditionally defined by the implementation:
9184 __STDC_ANALYZABLE__ The integer constant 1, intended to indicate conformance to
9185 <pre>
9186 the specifications in <a href="#L">annex L</a> (Analyzability).</pre>
9187 __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
9188 <pre>
9189 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).</pre>
9190 __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
9191 <pre>
9192 adherence to the specifications in <a href="#G">annex G</a> (IEC 60559 compatible complex
9193 arithmetic).</pre>
9194 __STDC_LIB_EXT1__ The integer constant 201ymmL, intended to indicate support
9195 <pre>
9196 for the extensions defined in <a href="#K">annex K</a> (Bounds-checking interfaces).<sup><a href="#note179"><b>179)</b></a></sup></pre>
9197 __STDC_NO_COMPLEX__ The integer constant 1, intended to indicate that the
9198 <pre>
9199 implementation does not support complex types or the <a href="#7.3">&lt;complex.h&gt;</a>
9200 header.</pre>
9201 __STDC_NO_THREADS__ The integer constant 1, intended to indicate that the
9202 <pre>
9203 implementation does not support atomic types (including the _Atomic
9204 type qualifier and the <a href="#7.17">&lt;stdatomic.h&gt;</a> header) or the <a href="#7.25">&lt;threads.h&gt;</a>
9205 header.</pre>
9206 __STDC_NO_VLA__ The integer constant 1, intended to indicate that the
9207 <p><!--para 2 -->
9208 <pre>
9209 implementation does not support variable length arrays or variably
9210 modified types.</pre>
9211 An implementation that defines __STDC_NO_COMPLEX__ shall not define
9212 __STDC_IEC_559_COMPLEX__.
9214 <h6>footnotes</h6>
9215 <p><small><a name="note179" href="#note179">179)</a> The intention is that this will remain an integer constant of type long int that is increased with
9216 each revision of this International Standard.
9217 </small>
9219 <h4><a name="6.10.9" href="#6.10.9">6.10.9 Pragma operator</a></h4>
9220 <h6>Semantics</h6>
9221 <p><!--para 1 -->
9222 A unary operator expression of the form:
9223 <pre>
9224 _Pragma ( string-literal )</pre>
9225 is processed as follows: The string literal is destringized by deleting the L prefix, if
9226 present, deleting the leading and trailing double-quotes, replacing each escape sequence
9227 \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The
9228 resulting sequence of characters is processed through translation phase 3 to produce
9229 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
9232 <!--page 195 -->
9233 directive. The original four preprocessing tokens in the unary operator expression are
9234 removed.
9235 <p><!--para 2 -->
9236 EXAMPLE A directive of the form:
9237 <pre>
9238 #pragma listing on "..\listing.dir"</pre>
9239 can also be expressed as:
9240 <pre>
9241 _Pragma ( "listing on \"..\\listing.dir\"" )</pre>
9242 The latter form is processed in the same way whether it appears literally as shown, or results from macro
9243 replacement, as in:
9244 <!--page 196 -->
9245 <pre>
9246 #define LISTING(x) PRAGMA(listing on #x)
9247 #define PRAGMA(x) _Pragma(#x)
9248 LISTING ( ..\listing.dir )</pre>
9250 <h3><a name="6.11" href="#6.11">6.11 Future language directions</a></h3>
9252 <h4><a name="6.11.1" href="#6.11.1">6.11.1 Floating types</a></h4>
9253 <p><!--para 1 -->
9254 Future standardization may include additional floating-point types, including those with
9255 greater range, precision, or both than long double.
9257 <h4><a name="6.11.2" href="#6.11.2">6.11.2 Linkages of identifiers</a></h4>
9258 <p><!--para 1 -->
9259 Declaring an identifier with internal linkage at file scope without the static storage-
9260 class specifier is an obsolescent feature.
9262 <h4><a name="6.11.3" href="#6.11.3">6.11.3 External names</a></h4>
9263 <p><!--para 1 -->
9264 Restriction of the significance of an external name to fewer than 255 characters
9265 (considering each universal character name or extended source character as a single
9266 character) is an obsolescent feature that is a concession to existing implementations.
9268 <h4><a name="6.11.4" href="#6.11.4">6.11.4 Character escape sequences</a></h4>
9269 <p><!--para 1 -->
9270 Lowercase letters as escape sequences are reserved for future standardization. Other
9271 characters may be used in extensions.
9273 <h4><a name="6.11.5" href="#6.11.5">6.11.5 Storage-class specifiers</a></h4>
9274 <p><!--para 1 -->
9275 The placement of a storage-class specifier other than at the beginning of the declaration
9276 specifiers in a declaration is an obsolescent feature.
9278 <h4><a name="6.11.6" href="#6.11.6">6.11.6 Function declarators</a></h4>
9279 <p><!--para 1 -->
9280 The use of function declarators with empty parentheses (not prototype-format parameter
9281 type declarators) is an obsolescent feature.
9283 <h4><a name="6.11.7" href="#6.11.7">6.11.7 Function definitions</a></h4>
9284 <p><!--para 1 -->
9285 The use of function definitions with separate parameter identifier and declaration lists
9286 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
9288 <h4><a name="6.11.8" href="#6.11.8">6.11.8 Pragma directives</a></h4>
9289 <p><!--para 1 -->
9290 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
9292 <h4><a name="6.11.9" href="#6.11.9">6.11.9 Predefined macro names</a></h4>
9293 <p><!--para 1 -->
9294 Macro names beginning with __STDC_ are reserved for future standardization.
9295 <!--page 197 -->
9297 <h2><a name="7" href="#7">7. Library</a></h2>
9299 <h3><a name="7.1" href="#7.1">7.1 Introduction</a></h3>
9301 <h4><a name="7.1.1" href="#7.1.1">7.1.1 Definitions of terms</a></h4>
9302 <p><!--para 1 -->
9303 A string is a contiguous sequence of characters terminated by and including the first null
9304 character. The term multibyte string is sometimes used instead to emphasize special
9305 processing given to multibyte characters contained in the string or to avoid confusion
9306 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
9307 character. The length of a string is the number of bytes preceding the null character and
9308 the value of a string is the sequence of the values of the contained characters, in order.
9309 <p><!--para 2 -->
9310 The decimal-point character is the character used by functions that convert floating-point
9311 numbers to or from character sequences to denote the beginning of the fractional part of
9312 such character sequences.<sup><a href="#note180"><b>180)</b></a></sup> It is represented in the text and examples by a period, but
9313 may be changed by the setlocale function.
9314 <p><!--para 3 -->
9315 A null wide character is a wide character with code value zero.
9316 <p><!--para 4 -->
9317 A wide string is a contiguous sequence of wide characters terminated by and including
9318 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
9319 addressed) wide character. The length of a wide string is the number of wide characters
9320 preceding the null wide character and the value of a wide string is the sequence of code
9321 values of the contained wide characters, in order.
9322 <p><!--para 5 -->
9323 A shift sequence is a contiguous sequence of bytes within a multibyte string that
9324 (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
9325 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
9326 character.<sup><a href="#note181"><b>181)</b></a></sup>
9327 <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>).
9332 <!--page 198 -->
9334 <h6>footnotes</h6>
9335 <p><small><a name="note180" href="#note180">180)</a> The functions that make use of the decimal-point character are the numeric conversion functions
9336 (<a href="#7.22.1">7.22.1</a>, <a href="#7.28.4.1">7.28.4.1</a>) and the formatted input/output functions (<a href="#7.21.6">7.21.6</a>, <a href="#7.28.2">7.28.2</a>).
9337 </small>
9338 <p><small><a name="note181" href="#note181">181)</a> For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
9339 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
9340 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
9341 implementation's choice.
9342 </small>
9344 <h4><a name="7.1.2" href="#7.1.2">7.1.2 Standard headers</a></h4>
9345 <p><!--para 1 -->
9346 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note182"><b>182)</b></a></sup>
9347 whose contents are made available by the #include preprocessing directive. The
9348 header declares a set of related functions, plus any necessary types and additional macros
9349 needed to facilitate their use. Declarations of types described in this clause shall not
9350 include type qualifiers, unless explicitly stated otherwise.
9351 <p><!--para 2 -->
9352 The standard headers are<sup><a href="#note183"><b>183)</b></a></sup>
9353 <p><!--para 3 -->
9354 <pre>
9355 <a href="#7.2">&lt;assert.h&gt;</a> <a href="#7.9">&lt;iso646.h&gt;</a> <a href="#7.16">&lt;stdarg.h&gt;</a> <a href="#7.23">&lt;string.h&gt;</a>
9356 <a href="#7.3">&lt;complex.h&gt;</a> <a href="#7.10">&lt;limits.h&gt;</a> <a href="#7.17">&lt;stdatomic.h&gt;</a> <a href="#7.24">&lt;tgmath.h&gt;</a>
9357 <a href="#7.4">&lt;ctype.h&gt;</a> <a href="#7.11">&lt;locale.h&gt;</a> <a href="#7.18">&lt;stdbool.h&gt;</a> <a href="#7.25">&lt;threads.h&gt;</a>
9358 <a href="#7.5">&lt;errno.h&gt;</a> <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.19">&lt;stddef.h&gt;</a> <a href="#7.26">&lt;time.h&gt;</a>
9359 <a href="#7.6">&lt;fenv.h&gt;</a> <a href="#7.13">&lt;setjmp.h&gt;</a> <a href="#7.20">&lt;stdint.h&gt;</a> <a href="#7.27">&lt;uchar.h&gt;</a>
9360 <a href="#7.7">&lt;float.h&gt;</a> <a href="#7.14">&lt;signal.h&gt;</a> <a href="#7.21">&lt;stdio.h&gt;</a> <a href="#7.28">&lt;wchar.h&gt;</a>
9361 <a href="#7.8">&lt;inttypes.h&gt;</a> <a href="#7.15">&lt;stdalign.h&gt;</a> <a href="#7.22">&lt;stdlib.h&gt;</a> <a href="#7.29">&lt;wctype.h&gt;</a></pre>
9362 If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
9363 provided as part of the implementation, is placed in any of the standard places that are
9364 searched for included source files, the behavior is undefined.
9365 <p><!--para 4 -->
9366 Standard headers may be included in any order; each may be included more than once in
9367 a given scope, with no effect different from being included only once, except that the
9368 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
9369 used, a header shall be included outside of any external declaration or definition, and it
9370 shall first be included before the first reference to any of the functions or objects it
9371 declares, or to any of the types or macros it defines. However, if an identifier is declared
9372 or defined in more than one header, the second and subsequent associated headers may be
9373 included after the initial reference to the identifier. The program shall not have any
9374 macros with names lexically identical to keywords currently defined prior to the
9375 inclusion.
9376 <p><!--para 5 -->
9377 Any definition of an object-like macro described in this clause shall expand to code that is
9378 fully protected by parentheses where necessary, so that it groups in an arbitrary
9379 expression as if it were a single identifier.
9380 <p><!--para 6 -->
9381 Any declaration of a library function shall have external linkage.
9386 <!--page 199 -->
9387 <p><!--para 7 -->
9388 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
9389 <p><b> Forward references</b>: diagnostics (<a href="#7.2">7.2</a>).
9391 <h6>footnotes</h6>
9392 <p><small><a name="note182" href="#note182">182)</a> A header is not necessarily a source file, nor are the &lt; and &gt; delimited sequences in header names
9393 necessarily valid source file names.
9394 </small>
9395 <p><small><a name="note183" href="#note183">183)</a> The headers <a href="#7.3">&lt;complex.h&gt;</a>, <a href="#7.17">&lt;stdatomic.h&gt;</a>, and <a href="#7.25">&lt;threads.h&gt;</a> are conditional features that
9396 implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.
9397 </small>
9399 <h4><a name="7.1.3" href="#7.1.3">7.1.3 Reserved identifiers</a></h4>
9400 <p><!--para 1 -->
9401 Each header declares or defines all identifiers listed in its associated subclause, and
9402 optionally declares or defines identifiers listed in its associated future library directions
9403 subclause and identifiers which are always reserved either for any use or for use as file
9404 scope identifiers.
9405 <ul>
9406 <li> All identifiers that begin with an underscore and either an uppercase letter or another
9407 underscore are always reserved for any use.
9408 <li> All identifiers that begin with an underscore are always reserved for use as identifiers
9409 with file scope in both the ordinary and tag name spaces.
9410 <li> Each macro name in any of the following subclauses (including the future library
9411 directions) is reserved for use as specified if any of its associated headers is included;
9412 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
9413 <li> All identifiers with external linkage in any of the following subclauses (including the
9414 future library directions) and errno are always reserved for use as identifiers with
9415 external linkage.<sup><a href="#note184"><b>184)</b></a></sup>
9416 <li> Each identifier with file scope listed in any of the following subclauses (including the
9417 future library directions) is reserved for use as a macro name and as an identifier with
9418 file scope in the same name space if any of its associated headers is included.
9419 </ul>
9420 <p><!--para 2 -->
9421 No other identifiers are reserved. If the program declares or defines an identifier in a
9422 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
9423 identifier as a macro name, the behavior is undefined.
9424 <p><!--para 3 -->
9425 If the program removes (with #undef) any macro definition of an identifier in the first
9426 group listed above, the behavior is undefined.
9431 <!--page 200 -->
9433 <h6>footnotes</h6>
9434 <p><small><a name="note184" href="#note184">184)</a> The list of reserved identifiers with external linkage includes math_errhandling, setjmp,
9435 va_copy, and va_end.
9436 </small>
9438 <h4><a name="7.1.4" href="#7.1.4">7.1.4 Use of library functions</a></h4>
9439 <p><!--para 1 -->
9440 Each of the following statements applies unless explicitly stated otherwise in the detailed
9441 descriptions that follow: If an argument to a function has an invalid value (such as a value
9442 outside the domain of the function, or a pointer outside the address space of the program,
9443 or a null pointer, or a pointer to non-modifiable storage when the corresponding
9444 parameter is not const-qualified) or a type (after promotion) not expected by a function
9445 with variable number of arguments, the behavior is undefined. If a function argument is
9446 described as being an array, the pointer actually passed to the function shall have a value
9447 such that all address computations and accesses to objects (that would be valid if the
9448 pointer did point to the first element of such an array) are in fact valid. Any function
9449 declared in a header may be additionally implemented as a function-like macro defined in
9450 the header, so if a library function is declared explicitly when its header is included, one
9451 of the techniques shown below can be used to ensure the declaration is not affected by
9452 such a macro. Any macro definition of a function can be suppressed locally by enclosing
9453 the name of the function in parentheses, because the name is then not followed by the left
9454 parenthesis that indicates expansion of a macro function name. For the same syntactic
9455 reason, it is permitted to take the address of a library function even if it is also defined as
9456 a macro.<sup><a href="#note185"><b>185)</b></a></sup> The use of #undef to remove any macro definition will also ensure that an
9457 actual function is referred to. Any invocation of a library function that is implemented as
9458 a macro shall expand to code that evaluates each of its arguments exactly once, fully
9459 protected by parentheses where necessary, so it is generally safe to use arbitrary
9460 expressions as arguments.<sup><a href="#note186"><b>186)</b></a></sup> Likewise, those function-like macros described in the
9461 following subclauses may be invoked in an expression anywhere a function with a
9462 compatible return type could be called.<sup><a href="#note187"><b>187)</b></a></sup> All object-like macros listed as expanding to
9465 <!--page 201 -->
9466 integer constant expressions shall additionally be suitable for use in #if preprocessing
9467 directives.
9468 <p><!--para 2 -->
9469 Provided that a library function can be declared without reference to any type defined in a
9470 header, it is also permissible to declare the function and use it without including its
9471 associated header.
9472 <p><!--para 3 -->
9473 There is a sequence point immediately before a library function returns.
9474 <p><!--para 4 -->
9475 The functions in the standard library are not guaranteed to be reentrant and may modify
9476 objects with static or thread storage duration.<sup><a href="#note188"><b>188)</b></a></sup>
9477 <p><!--para 5 -->
9478 Unless explicitly stated otherwise in the detailed descriptions that follow, library
9479 functions shall prevent data races as follows: A library function shall not directly or
9480 indirectly access objects accessible by threads other than the current thread unless the
9481 objects are accessed directly or indirectly via the function's arguments. A library
9482 function shall not directly or indirectly modify objects accessible by threads other than
9483 the current thread unless the objects are accessed directly or indirectly via the function's
9484 non-const arguments.<sup><a href="#note189"><b>189)</b></a></sup> Implementations may share their own internal objects between
9485 threads if the objects are not visible to users and are protected against data races.
9486 <p><!--para 6 -->
9487 Unless otherwise specified, library functions shall perform all operations solely within the
9488 current thread if those operations have effects that are visible to users.<sup><a href="#note190"><b>190)</b></a></sup>
9489 <p><!--para 7 -->
9490 EXAMPLE The function atoi may be used in any of several ways:
9491 <ul>
9492 <li> by use of its associated header (possibly generating a macro expansion)
9493 <pre>
9494 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
9495 const char *str;
9496 /* ... */
9497 i = atoi(str);</pre>
9498 <li> by use of its associated header (assuredly generating a true function reference)
9503 <!--page 202 -->
9504 <pre>
9505 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
9506 #undef atoi
9507 const char *str;
9508 /* ... */
9509 i = atoi(str);</pre>
9511 <pre>
9512 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
9513 const char *str;
9514 /* ... */
9515 i = (atoi)(str);</pre>
9516 <li> by explicit declaration
9517 <!--page 203 -->
9518 <pre>
9519 extern int atoi(const char *);
9520 const char *str;
9521 /* ... */
9522 i = atoi(str);</pre>
9523 </ul>
9525 <h6>footnotes</h6>
9526 <p><small><a name="note185" href="#note185">185)</a> This means that an implementation shall provide an actual function for each library function, even if it
9527 also provides a macro for that function.
9528 </small>
9529 <p><small><a name="note186" href="#note186">186)</a> Such macros might not contain the sequence points that the corresponding function calls do.
9530 </small>
9531 <p><small><a name="note187" href="#note187">187)</a> Because external identifiers and some macro names beginning with an underscore are reserved,
9532 implementations may provide special semantics for such names. For example, the identifier
9533 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
9534 appropriate header could specify
9536 <pre>
9537 #define abs(x) _BUILTIN_abs(x)</pre>
9538 for a compiler whose code generator will accept it.
9539 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
9540 function may write
9542 <pre>
9543 #undef abs</pre>
9544 whether the implementation's header provides a macro implementation of abs or a built-in
9545 implementation. The prototype for the function, which precedes and is hidden by any macro
9546 definition, is thereby revealed also.
9547 </small>
9548 <p><small><a name="note188" href="#note188">188)</a> Thus, a signal handler cannot, in general, call standard library functions.
9549 </small>
9550 <p><small><a name="note189" href="#note189">189)</a> This means, for example, that an implementation is not permitted to use a static object for internal
9551 purposes without synchronization because it could cause a data race even in programs that do not
9552 explicitly share objects between threads.
9553 </small>
9554 <p><small><a name="note190" href="#note190">190)</a> This allows implementations to parallelize operations if there are no visible side effects.
9555 </small>
9557 <h3><a name="7.2" href="#7.2">7.2 Diagnostics <assert.h></a></h3>
9558 <p><!--para 1 -->
9559 The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert and static_assert macros and
9560 refers to another macro,
9561 <pre>
9562 NDEBUG</pre>
9563 which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
9564 point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
9565 simply as
9566 <pre>
9567 #define assert(ignore) ((void)0)</pre>
9568 The assert macro is redefined according to the current state of NDEBUG each time that
9569 <a href="#7.2">&lt;assert.h&gt;</a> is included.
9570 <p><!--para 2 -->
9571 The assert macro shall be implemented as a macro, not as an actual function. If the
9572 macro definition is suppressed in order to access an actual function, the behavior is
9573 undefined.
9574 <p><!--para 3 -->
9575 The macro
9576 <pre>
9577 static_assert</pre>
9578 expands to _Static_assert.
9580 <h4><a name="7.2.1" href="#7.2.1">7.2.1 Program diagnostics</a></h4>
9582 <h5><a name="7.2.1.1" href="#7.2.1.1">7.2.1.1 The assert macro</a></h5>
9583 <h6>Synopsis</h6>
9584 <p><!--para 1 -->
9585 <pre>
9586 #include <a href="#7.2">&lt;assert.h&gt;</a>
9587 void assert(scalar expression);</pre>
9588 <h6>Description</h6>
9589 <p><!--para 2 -->
9590 The assert macro puts diagnostic tests into programs; it expands to a void expression.
9591 When it is executed, if expression (which shall have a scalar type) is false (that is,
9592 compares equal to 0), the assert macro writes information about the particular call that
9593 failed (including the text of the argument, the name of the source file, the source line
9594 number, and the name of the enclosing function -- the latter are respectively the values of
9595 the preprocessing macros __FILE__ and __LINE__ and of the identifier
9596 __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note191"><b>191)</b></a></sup> It
9597 then calls the abort function.
9601 <!--page 204 -->
9602 <h6>Returns</h6>
9603 <p><!--para 3 -->
9604 The assert macro returns no value.
9605 <p><b> Forward references</b>: the abort function (<a href="#7.22.4.1">7.22.4.1</a>).
9606 <!--page 205 -->
9608 <h6>footnotes</h6>
9609 <p><small><a name="note191" href="#note191">191)</a> The message written might be of the form:
9610 Assertion failed: expression, function abc, file xyz, line nnn.
9611 </small>
9613 <h3><a name="7.3" href="#7.3">7.3 Complex arithmetic <complex.h></a></h3>
9615 <h4><a name="7.3.1" href="#7.3.1">7.3.1 Introduction</a></h4>
9616 <p><!--para 1 -->
9617 The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
9618 arithmetic.<sup><a href="#note192"><b>192)</b></a></sup>
9619 <p><!--para 2 -->
9620 Implementations that define the macro __STDC_NO_COMPLEX__ need not provide
9621 this header nor support any of its facilities.
9622 <p><!--para 3 -->
9623 Each synopsis specifies a family of functions consisting of a principal function with one
9624 or more double complex parameters and a double complex or double return
9625 value; and other functions with the same name but with f and l suffixes which are
9626 corresponding functions with float and long double parameters and return values.
9627 <p><!--para 4 -->
9628 The macro
9629 <pre>
9630 complex</pre>
9631 expands to _Complex; the macro
9632 <pre>
9633 _Complex_I</pre>
9634 expands to a constant expression of type const float _Complex, with the value of
9635 the imaginary unit.<sup><a href="#note193"><b>193)</b></a></sup>
9636 <p><!--para 5 -->
9637 The macros
9638 <pre>
9639 imaginary</pre>
9641 <pre>
9642 _Imaginary_I</pre>
9643 are defined if and only if the implementation supports imaginary types;<sup><a href="#note194"><b>194)</b></a></sup> if defined,
9644 they expand to _Imaginary and a constant expression of type const float
9645 _Imaginary with the value of the imaginary unit.
9646 <p><!--para 6 -->
9647 The macro
9648 <pre>
9649 I</pre>
9650 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
9651 defined, I shall expand to _Complex_I.
9652 <p><!--para 7 -->
9653 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
9654 redefine the macros complex, imaginary, and I.
9656 <!--page 206 -->
9657 <p><b> Forward references</b>: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
9659 <h6>footnotes</h6>
9660 <p><small><a name="note192" href="#note192">192)</a> See ''future library directions'' (<a href="#7.30.1">7.30.1</a>).
9661 </small>
9662 <p><small><a name="note193" href="#note193">193)</a> The imaginary unit is a number i such that i 2 = -1.
9663 </small>
9664 <p><small><a name="note194" href="#note194">194)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
9665 </small>
9667 <h4><a name="7.3.2" href="#7.3.2">7.3.2 Conventions</a></h4>
9668 <p><!--para 1 -->
9669 Values are interpreted as radians, not degrees. An implementation may set errno but is
9670 not required to.
9672 <h4><a name="7.3.3" href="#7.3.3">7.3.3 Branch cuts</a></h4>
9673 <p><!--para 1 -->
9674 Some of the functions below have branch cuts, across which the function is
9675 discontinuous. For implementations with a signed zero (including all IEC 60559
9676 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
9677 one side of a cut from another so the function is continuous (except for format
9678 limitations) as the cut is approached from either side. For example, for the square root
9679 function, which has a branch cut along the negative real axis, the top of the cut, with
9680 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
9681 imaginary part -0, maps to the negative imaginary axis.
9682 <p><!--para 2 -->
9683 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
9684 sides of branch cuts. These implementations shall map a cut so the function is continuous
9685 as the cut is approached coming around the finite endpoint of the cut in a counter
9686 clockwise direction. (Branch cuts for the functions specified here have just one finite
9687 endpoint.) For example, for the square root function, coming counter clockwise around
9688 the finite endpoint of the cut along the negative real axis approaches the cut from above,
9689 so the cut maps to the positive imaginary axis.
9691 <h4><a name="7.3.4" href="#7.3.4">7.3.4 The CX_LIMITED_RANGE pragma</a></h4>
9692 <h6>Synopsis</h6>
9693 <p><!--para 1 -->
9694 <pre>
9695 #include <a href="#7.3">&lt;complex.h&gt;</a>
9696 #pragma STDC CX_LIMITED_RANGE on-off-switch</pre>
9697 <h6>Description</h6>
9698 <p><!--para 2 -->
9699 The usual mathematical formulas for complex multiply, divide, and absolute value are
9700 problematic because of their treatment of infinities and because of undue overflow and
9701 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
9702 implementation that (where the state is ''on'') the usual mathematical formulas are
9703 acceptable.<sup><a href="#note195"><b>195)</b></a></sup> The pragma can occur either outside external declarations or preceding all
9704 explicit declarations and statements inside a compound statement. When outside external
9705 declarations, the pragma takes effect from its occurrence until another
9706 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
9707 When inside a compound statement, the pragma takes effect from its occurrence until
9708 another CX_LIMITED_RANGE pragma is encountered (including within a nested
9709 compound statement), or until the end of the compound statement; at the end of a
9710 compound statement the state for the pragma is restored to its condition just before the
9711 <!--page 207 -->
9712 compound statement. If this pragma is used in any other context, the behavior is
9713 undefined. The default state for the pragma is ''off''.
9715 <h6>footnotes</h6>
9716 <p><small><a name="note195" href="#note195">195)</a> The purpose of the pragma is to allow the implementation to use the formulas:
9718 <pre>
9719 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
9720 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
9721 | x + iy | = (sqrt) x 2 + y 2
9722 -----</pre>
9723 where the programmer can determine they are safe.
9724 </small>
9726 <h4><a name="7.3.5" href="#7.3.5">7.3.5 Trigonometric functions</a></h4>
9728 <h5><a name="7.3.5.1" href="#7.3.5.1">7.3.5.1 The cacos functions</a></h5>
9729 <h6>Synopsis</h6>
9730 <p><!--para 1 -->
9731 <pre>
9732 #include <a href="#7.3">&lt;complex.h&gt;</a>
9733 double complex cacos(double complex z);
9734 float complex cacosf(float complex z);
9735 long double complex cacosl(long double complex z);</pre>
9736 <h6>Description</h6>
9737 <p><!--para 2 -->
9738 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
9739 interval [-1, +1] along the real axis.
9740 <h6>Returns</h6>
9741 <p><!--para 3 -->
9742 The cacos functions return the complex arc cosine value, in the range of a strip
9743 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
9744 real axis.
9746 <h5><a name="7.3.5.2" href="#7.3.5.2">7.3.5.2 The casin functions</a></h5>
9747 <h6>Synopsis</h6>
9748 <p><!--para 1 -->
9749 <pre>
9750 #include <a href="#7.3">&lt;complex.h&gt;</a>
9751 double complex casin(double complex z);
9752 float complex casinf(float complex z);
9753 long double complex casinl(long double complex z);</pre>
9754 <h6>Description</h6>
9755 <p><!--para 2 -->
9756 The casin functions compute the complex arc sine of z, with branch cuts outside the
9757 interval [-1, +1] along the real axis.
9758 <h6>Returns</h6>
9759 <p><!--para 3 -->
9760 The casin functions return the complex arc sine value, in the range of a strip
9761 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
9763 <!--page 208 -->
9764 along the real axis.
9766 <h5><a name="7.3.5.3" href="#7.3.5.3">7.3.5.3 The catan functions</a></h5>
9767 <h6>Synopsis</h6>
9768 <p><!--para 1 -->
9769 <pre>
9770 #include <a href="#7.3">&lt;complex.h&gt;</a>
9771 double complex catan(double complex z);
9772 float complex catanf(float complex z);
9773 long double complex catanl(long double complex z);</pre>
9774 <h6>Description</h6>
9775 <p><!--para 2 -->
9776 The catan functions compute the complex arc tangent of z, with branch cuts outside the
9777 interval [-i, +i] along the imaginary axis.
9778 <h6>Returns</h6>
9779 <p><!--para 3 -->
9780 The catan functions return the complex arc tangent value, in the range of a strip
9781 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
9782 along the real axis.
9784 <h5><a name="7.3.5.4" href="#7.3.5.4">7.3.5.4 The ccos functions</a></h5>
9785 <h6>Synopsis</h6>
9786 <p><!--para 1 -->
9787 <pre>
9788 #include <a href="#7.3">&lt;complex.h&gt;</a>
9789 double complex ccos(double complex z);
9790 float complex ccosf(float complex z);
9791 long double complex ccosl(long double complex z);</pre>
9792 <h6>Description</h6>
9793 <p><!--para 2 -->
9794 The ccos functions compute the complex cosine of z.
9795 <h6>Returns</h6>
9796 <p><!--para 3 -->
9797 The ccos functions return the complex cosine value.
9799 <h5><a name="7.3.5.5" href="#7.3.5.5">7.3.5.5 The csin functions</a></h5>
9800 <h6>Synopsis</h6>
9801 <p><!--para 1 -->
9802 <pre>
9803 #include <a href="#7.3">&lt;complex.h&gt;</a>
9804 double complex csin(double complex z);
9805 float complex csinf(float complex z);
9806 long double complex csinl(long double complex z);</pre>
9807 <h6>Description</h6>
9808 <p><!--para 2 -->
9809 The csin functions compute the complex sine of z.
9810 <!--page 209 -->
9811 <h6>Returns</h6>
9812 <p><!--para 3 -->
9813 The csin functions return the complex sine value.
9815 <h5><a name="7.3.5.6" href="#7.3.5.6">7.3.5.6 The ctan functions</a></h5>
9816 <h6>Synopsis</h6>
9817 <p><!--para 1 -->
9818 <pre>
9819 #include <a href="#7.3">&lt;complex.h&gt;</a>
9820 double complex ctan(double complex z);
9821 float complex ctanf(float complex z);
9822 long double complex ctanl(long double complex z);</pre>
9823 <h6>Description</h6>
9824 <p><!--para 2 -->
9825 The ctan functions compute the complex tangent of z.
9826 <h6>Returns</h6>
9827 <p><!--para 3 -->
9828 The ctan functions return the complex tangent value.
9830 <h4><a name="7.3.6" href="#7.3.6">7.3.6 Hyperbolic functions</a></h4>
9832 <h5><a name="7.3.6.1" href="#7.3.6.1">7.3.6.1 The cacosh functions</a></h5>
9833 <h6>Synopsis</h6>
9834 <p><!--para 1 -->
9835 <pre>
9836 #include <a href="#7.3">&lt;complex.h&gt;</a>
9837 double complex cacosh(double complex z);
9838 float complex cacoshf(float complex z);
9839 long double complex cacoshl(long double complex z);</pre>
9840 <h6>Description</h6>
9841 <p><!--para 2 -->
9842 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
9843 cut at values less than 1 along the real axis.
9844 <h6>Returns</h6>
9845 <p><!--para 3 -->
9846 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
9847 half-strip of nonnegative values along the real axis and in the interval [-ipi , +ipi ] along the
9848 imaginary axis.
9850 <h5><a name="7.3.6.2" href="#7.3.6.2">7.3.6.2 The casinh functions</a></h5>
9851 <h6>Synopsis</h6>
9852 <p><!--para 1 -->
9853 <!--page 210 -->
9854 <pre>
9855 #include <a href="#7.3">&lt;complex.h&gt;</a>
9856 double complex casinh(double complex z);
9857 float complex casinhf(float complex z);
9858 long double complex casinhl(long double complex z);</pre>
9859 <h6>Description</h6>
9860 <p><!--para 2 -->
9861 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
9862 outside the interval [-i, +i] along the imaginary axis.
9863 <h6>Returns</h6>
9864 <p><!--para 3 -->
9865 The casinh functions return the complex arc hyperbolic sine value, in the range of a
9866 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
9867 along the imaginary axis.
9869 <h5><a name="7.3.6.3" href="#7.3.6.3">7.3.6.3 The catanh functions</a></h5>
9870 <h6>Synopsis</h6>
9871 <p><!--para 1 -->
9872 <pre>
9873 #include <a href="#7.3">&lt;complex.h&gt;</a>
9874 double complex catanh(double complex z);
9875 float complex catanhf(float complex z);
9876 long double complex catanhl(long double complex z);</pre>
9877 <h6>Description</h6>
9878 <p><!--para 2 -->
9879 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
9880 cuts outside the interval [-1, +1] along the real axis.
9881 <h6>Returns</h6>
9882 <p><!--para 3 -->
9883 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
9884 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
9885 along the imaginary axis.
9887 <h5><a name="7.3.6.4" href="#7.3.6.4">7.3.6.4 The ccosh functions</a></h5>
9888 <h6>Synopsis</h6>
9889 <p><!--para 1 -->
9890 <pre>
9891 #include <a href="#7.3">&lt;complex.h&gt;</a>
9892 double complex ccosh(double complex z);
9893 float complex ccoshf(float complex z);
9894 long double complex ccoshl(long double complex z);</pre>
9895 <h6>Description</h6>
9896 <p><!--para 2 -->
9897 The ccosh functions compute the complex hyperbolic cosine of z.
9898 <h6>Returns</h6>
9899 <p><!--para 3 -->
9900 The ccosh functions return the complex hyperbolic cosine value.
9901 <!--page 211 -->
9903 <h5><a name="7.3.6.5" href="#7.3.6.5">7.3.6.5 The csinh functions</a></h5>
9904 <h6>Synopsis</h6>
9905 <p><!--para 1 -->
9906 <pre>
9907 #include <a href="#7.3">&lt;complex.h&gt;</a>
9908 double complex csinh(double complex z);
9909 float complex csinhf(float complex z);
9910 long double complex csinhl(long double complex z);</pre>
9911 <h6>Description</h6>
9912 <p><!--para 2 -->
9913 The csinh functions compute the complex hyperbolic sine of z.
9914 <h6>Returns</h6>
9915 <p><!--para 3 -->
9916 The csinh functions return the complex hyperbolic sine value.
9918 <h5><a name="7.3.6.6" href="#7.3.6.6">7.3.6.6 The ctanh functions</a></h5>
9919 <h6>Synopsis</h6>
9920 <p><!--para 1 -->
9921 <pre>
9922 #include <a href="#7.3">&lt;complex.h&gt;</a>
9923 double complex ctanh(double complex z);
9924 float complex ctanhf(float complex z);
9925 long double complex ctanhl(long double complex z);</pre>
9926 <h6>Description</h6>
9927 <p><!--para 2 -->
9928 The ctanh functions compute the complex hyperbolic tangent of z.
9929 <h6>Returns</h6>
9930 <p><!--para 3 -->
9931 The ctanh functions return the complex hyperbolic tangent value.
9933 <h4><a name="7.3.7" href="#7.3.7">7.3.7 Exponential and logarithmic functions</a></h4>
9935 <h5><a name="7.3.7.1" href="#7.3.7.1">7.3.7.1 The cexp functions</a></h5>
9936 <h6>Synopsis</h6>
9937 <p><!--para 1 -->
9938 <pre>
9939 #include <a href="#7.3">&lt;complex.h&gt;</a>
9940 double complex cexp(double complex z);
9941 float complex cexpf(float complex z);
9942 long double complex cexpl(long double complex z);</pre>
9943 <h6>Description</h6>
9944 <p><!--para 2 -->
9945 The cexp functions compute the complex base-e exponential of z.
9946 <h6>Returns</h6>
9947 <p><!--para 3 -->
9948 The cexp functions return the complex base-e exponential value.
9949 <!--page 212 -->
9951 <h5><a name="7.3.7.2" href="#7.3.7.2">7.3.7.2 The clog functions</a></h5>
9952 <h6>Synopsis</h6>
9953 <p><!--para 1 -->
9954 <pre>
9955 #include <a href="#7.3">&lt;complex.h&gt;</a>
9956 double complex clog(double complex z);
9957 float complex clogf(float complex z);
9958 long double complex clogl(long double complex z);</pre>
9959 <h6>Description</h6>
9960 <p><!--para 2 -->
9961 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
9962 cut along the negative real axis.
9963 <h6>Returns</h6>
9964 <p><!--para 3 -->
9965 The clog functions return the complex natural logarithm value, in the range of a strip
9966 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
9967 imaginary axis.
9969 <h4><a name="7.3.8" href="#7.3.8">7.3.8 Power and absolute-value functions</a></h4>
9971 <h5><a name="7.3.8.1" href="#7.3.8.1">7.3.8.1 The cabs functions</a></h5>
9972 <h6>Synopsis</h6>
9973 <p><!--para 1 -->
9974 <pre>
9975 #include <a href="#7.3">&lt;complex.h&gt;</a>
9976 double cabs(double complex z);
9977 float cabsf(float complex z);
9978 long double cabsl(long double complex z);</pre>
9979 <h6>Description</h6>
9980 <p><!--para 2 -->
9981 The cabs functions compute the complex absolute value (also called norm, modulus, or
9982 magnitude) of z.
9983 <h6>Returns</h6>
9984 <p><!--para 3 -->
9985 The cabs functions return the complex absolute value.
9987 <h5><a name="7.3.8.2" href="#7.3.8.2">7.3.8.2 The cpow functions</a></h5>
9988 <h6>Synopsis</h6>
9989 <p><!--para 1 -->
9990 <!--page 213 -->
9991 <pre>
9992 #include <a href="#7.3">&lt;complex.h&gt;</a>
9993 double complex cpow(double complex x, double complex y);
9994 float complex cpowf(float complex x, float complex y);
9995 long double complex cpowl(long double complex x,
9996 long double complex y);</pre>
9997 <h6>Description</h6>
9998 <p><!--para 2 -->
9999 The cpow functions compute the complex power function xy , with a branch cut for the
10000 first parameter along the negative real axis.
10001 <h6>Returns</h6>
10002 <p><!--para 3 -->
10003 The cpow functions return the complex power function value.
10005 <h5><a name="7.3.8.3" href="#7.3.8.3">7.3.8.3 The csqrt functions</a></h5>
10006 <h6>Synopsis</h6>
10007 <p><!--para 1 -->
10008 <pre>
10009 #include <a href="#7.3">&lt;complex.h&gt;</a>
10010 double complex csqrt(double complex z);
10011 float complex csqrtf(float complex z);
10012 long double complex csqrtl(long double complex z);</pre>
10013 <h6>Description</h6>
10014 <p><!--para 2 -->
10015 The csqrt functions compute the complex square root of z, with a branch cut along the
10016 negative real axis.
10017 <h6>Returns</h6>
10018 <p><!--para 3 -->
10019 The csqrt functions return the complex square root value, in the range of the right half-
10020 plane (including the imaginary axis).
10022 <h4><a name="7.3.9" href="#7.3.9">7.3.9 Manipulation functions</a></h4>
10024 <h5><a name="7.3.9.1" href="#7.3.9.1">7.3.9.1 The carg functions</a></h5>
10025 <h6>Synopsis</h6>
10026 <p><!--para 1 -->
10027 <pre>
10028 #include <a href="#7.3">&lt;complex.h&gt;</a>
10029 double carg(double complex z);
10030 float cargf(float complex z);
10031 long double cargl(long double complex z);</pre>
10032 <h6>Description</h6>
10033 <p><!--para 2 -->
10034 The carg functions compute the argument (also called phase angle) of z, with a branch
10035 cut along the negative real axis.
10036 <h6>Returns</h6>
10037 <p><!--para 3 -->
10038 The carg functions return the value of the argument in the interval [-pi , +pi ].
10039 <!--page 214 -->
10041 <h5><a name="7.3.9.2" href="#7.3.9.2">7.3.9.2 The cimag functions</a></h5>
10042 <h6>Synopsis</h6>
10043 <p><!--para 1 -->
10044 <pre>
10045 #include <a href="#7.3">&lt;complex.h&gt;</a>
10046 double cimag(double complex z);
10047 float cimagf(float complex z);
10048 long double cimagl(long double complex z);</pre>
10049 <h6>Description</h6>
10050 <p><!--para 2 -->
10051 The cimag functions compute the imaginary part of z.<sup><a href="#note196"><b>196)</b></a></sup>
10052 <h6>Returns</h6>
10053 <p><!--para 3 -->
10054 The cimag functions return the imaginary part value (as a real).
10056 <h6>footnotes</h6>
10057 <p><small><a name="note196" href="#note196">196)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
10058 </small>
10060 <h5><a name="7.3.9.3" href="#7.3.9.3">7.3.9.3 The CMPLX macros</a></h5>
10061 <h6>Synopsis</h6>
10062 <p><!--para 1 -->
10063 <pre>
10064 #include <a href="#7.3">&lt;complex.h&gt;</a>
10065 double complex CMPLX(double x, double y);
10066 float complex CMPLXF(float x, float y);
10067 long double complex CMPLXL(long double x, long double y);</pre>
10068 <h6>Description</h6>
10069 <p><!--para 2 -->
10070 The CMPLX macros expand to an expression of the specified complex type, with the real
10071 part having the (converted) value of x and the imaginary part having the (converted)
10072 value of y.
10073 <h6>Recommended practice</h6>
10074 <p><!--para 3 -->
10075 The resulting expression should be suitable for use as an initializer for an object with
10076 static or thread storage duration, provided both arguments are likewise suitable.
10077 <h6>Returns</h6>
10078 <p><!--para 4 -->
10079 The CMPLX macros return the complex value x + i y.
10080 <p><!--para 5 -->
10081 NOTE These macros act as if the implementation supported imaginary types and the definitions were:
10082 <pre>
10083 #define CMPLX(x, y) ((double complex)((double)(x) + \
10084 _Imaginary_I * (double)(y)))
10085 #define CMPLXF(x, y) ((float complex)((float)(x) + \
10086 _Imaginary_I * (float)(y)))
10087 #define CMPLXL(x, y) ((long double complex)((long double)(x) + \
10088 _Imaginary_I * (long double)(y)))</pre>
10093 <!--page 215 -->
10095 <h5><a name="7.3.9.4" href="#7.3.9.4">7.3.9.4 The conj functions</a></h5>
10096 <h6>Synopsis</h6>
10097 <p><!--para 1 -->
10098 <pre>
10099 #include <a href="#7.3">&lt;complex.h&gt;</a>
10100 double complex conj(double complex z);
10101 float complex conjf(float complex z);
10102 long double complex conjl(long double complex z);</pre>
10103 <h6>Description</h6>
10104 <p><!--para 2 -->
10105 The conj functions compute the complex conjugate of z, by reversing the sign of its
10106 imaginary part.
10107 <h6>Returns</h6>
10108 <p><!--para 3 -->
10109 The conj functions return the complex conjugate value.
10111 <h5><a name="7.3.9.5" href="#7.3.9.5">7.3.9.5 The cproj functions</a></h5>
10112 <h6>Synopsis</h6>
10113 <p><!--para 1 -->
10114 <pre>
10115 #include <a href="#7.3">&lt;complex.h&gt;</a>
10116 double complex cproj(double complex z);
10117 float complex cprojf(float complex z);
10118 long double complex cprojl(long double complex z);</pre>
10119 <h6>Description</h6>
10120 <p><!--para 2 -->
10121 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
10122 z except that all complex infinities (even those with one infinite part and one NaN part)
10123 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
10124 equivalent to
10125 <pre>
10126 INFINITY + I * copysign(0.0, cimag(z))</pre>
10127 <h6>Returns</h6>
10128 <p><!--para 3 -->
10129 The cproj functions return the value of the projection onto the Riemann sphere.
10131 <h5><a name="7.3.9.6" href="#7.3.9.6">7.3.9.6 The creal functions</a></h5>
10132 <h6>Synopsis</h6>
10133 <p><!--para 1 -->
10134 <pre>
10135 #include <a href="#7.3">&lt;complex.h&gt;</a>
10136 double creal(double complex z);
10137 float crealf(float complex z);
10138 long double creall(long double complex z);</pre>
10139 <h6>Description</h6>
10140 <p><!--para 2 -->
10141 The creal functions compute the real part of z.<sup><a href="#note197"><b>197)</b></a></sup>
10142 <!--page 216 -->
10143 <h6>Returns</h6>
10144 <p><!--para 3 -->
10145 The creal functions return the real part value.
10150 <!--page 217 -->
10152 <h6>footnotes</h6>
10153 <p><small><a name="note197" href="#note197">197)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
10154 </small>
10156 <h3><a name="7.4" href="#7.4">7.4 Character handling <ctype.h></a></h3>
10157 <p><!--para 1 -->
10158 The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
10159 characters.<sup><a href="#note198"><b>198)</b></a></sup> In all cases the argument is an int, the value of which shall be
10160 representable as an unsigned char or shall equal the value of the macro EOF. If the
10161 argument has any other value, the behavior is undefined.
10162 <p><!--para 2 -->
10163 The behavior of these functions is affected by the current locale. Those functions that
10164 have locale-specific aspects only when not in the "C" locale are noted below.
10165 <p><!--para 3 -->
10166 The term printing character refers to a member of a locale-specific set of characters, each
10167 of which occupies one printing position on a display device; the term control character
10168 refers to a member of a locale-specific set of characters that are not printing
10169 characters.<sup><a href="#note199"><b>199)</b></a></sup> All letters and digits are printing characters.
10170 <p><b> Forward references</b>: EOF (<a href="#7.21.1">7.21.1</a>), localization (<a href="#7.11">7.11</a>).
10172 <h6>footnotes</h6>
10173 <p><small><a name="note198" href="#note198">198)</a> See ''future library directions'' (<a href="#7.30.2">7.30.2</a>).
10174 </small>
10175 <p><small><a name="note199" href="#note199">199)</a> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
10176 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
10177 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
10178 </small>
10180 <h4><a name="7.4.1" href="#7.4.1">7.4.1 Character classification functions</a></h4>
10181 <p><!--para 1 -->
10182 The functions in this subclause return nonzero (true) if and only if the value of the
10183 argument c conforms to that in the description of the function.
10185 <h5><a name="7.4.1.1" href="#7.4.1.1">7.4.1.1 The isalnum function</a></h5>
10186 <h6>Synopsis</h6>
10187 <p><!--para 1 -->
10188 <pre>
10189 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10190 int isalnum(int c);</pre>
10191 <h6>Description</h6>
10192 <p><!--para 2 -->
10193 The isalnum function tests for any character for which isalpha or isdigit is true.
10195 <h5><a name="7.4.1.2" href="#7.4.1.2">7.4.1.2 The isalpha function</a></h5>
10196 <h6>Synopsis</h6>
10197 <p><!--para 1 -->
10198 <pre>
10199 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10200 int isalpha(int c);</pre>
10201 <h6>Description</h6>
10202 <p><!--para 2 -->
10203 The isalpha function tests for any character for which isupper or islower is true,
10204 or any character that is one of a locale-specific set of alphabetic characters for which
10208 <!--page 218 -->
10209 none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note200"><b>200)</b></a></sup> In the "C" locale,
10210 isalpha returns true only for the characters for which isupper or islower is true.
10212 <h6>footnotes</h6>
10213 <p><small><a name="note200" href="#note200">200)</a> The functions islower and isupper test true or false separately for each of these additional
10214 characters; all four combinations are possible.
10215 </small>
10217 <h5><a name="7.4.1.3" href="#7.4.1.3">7.4.1.3 The isblank function</a></h5>
10218 <h6>Synopsis</h6>
10219 <p><!--para 1 -->
10220 <pre>
10221 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10222 int isblank(int c);</pre>
10223 <h6>Description</h6>
10224 <p><!--para 2 -->
10225 The isblank function tests for any character that is a standard blank character or is one
10226 of a locale-specific set of characters for which isspace is true and that is used to
10227 separate words within a line of text. The standard blank characters are the following:
10228 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
10229 for the standard blank characters.
10231 <h5><a name="7.4.1.4" href="#7.4.1.4">7.4.1.4 The iscntrl function</a></h5>
10232 <h6>Synopsis</h6>
10233 <p><!--para 1 -->
10234 <pre>
10235 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10236 int iscntrl(int c);</pre>
10237 <h6>Description</h6>
10238 <p><!--para 2 -->
10239 The iscntrl function tests for any control character.
10241 <h5><a name="7.4.1.5" href="#7.4.1.5">7.4.1.5 The isdigit function</a></h5>
10242 <h6>Synopsis</h6>
10243 <p><!--para 1 -->
10244 <pre>
10245 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10246 int isdigit(int c);</pre>
10247 <h6>Description</h6>
10248 <p><!--para 2 -->
10249 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
10251 <h5><a name="7.4.1.6" href="#7.4.1.6">7.4.1.6 The isgraph function</a></h5>
10252 <h6>Synopsis</h6>
10253 <p><!--para 1 -->
10254 <pre>
10255 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10256 int isgraph(int c);</pre>
10261 <!--page 219 -->
10262 <h6>Description</h6>
10263 <p><!--para 2 -->
10264 The isgraph function tests for any printing character except space (' ').
10266 <h5><a name="7.4.1.7" href="#7.4.1.7">7.4.1.7 The islower function</a></h5>
10267 <h6>Synopsis</h6>
10268 <p><!--para 1 -->
10269 <pre>
10270 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10271 int islower(int c);</pre>
10272 <h6>Description</h6>
10273 <p><!--para 2 -->
10274 The islower function tests for any character that is a lowercase letter or is one of a
10275 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
10276 isspace is true. In the "C" locale, islower returns true only for the lowercase
10277 letters (as defined in <a href="#5.2.1">5.2.1</a>).
10279 <h5><a name="7.4.1.8" href="#7.4.1.8">7.4.1.8 The isprint function</a></h5>
10280 <h6>Synopsis</h6>
10281 <p><!--para 1 -->
10282 <pre>
10283 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10284 int isprint(int c);</pre>
10285 <h6>Description</h6>
10286 <p><!--para 2 -->
10287 The isprint function tests for any printing character including space (' ').
10289 <h5><a name="7.4.1.9" href="#7.4.1.9">7.4.1.9 The ispunct function</a></h5>
10290 <h6>Synopsis</h6>
10291 <p><!--para 1 -->
10292 <pre>
10293 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10294 int ispunct(int c);</pre>
10295 <h6>Description</h6>
10296 <p><!--para 2 -->
10297 The ispunct function tests for any printing character that is one of a locale-specific set
10298 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
10299 locale, ispunct returns true for every printing character for which neither isspace
10300 nor isalnum is true.
10302 <h5><a name="7.4.1.10" href="#7.4.1.10">7.4.1.10 The isspace function</a></h5>
10303 <h6>Synopsis</h6>
10304 <p><!--para 1 -->
10305 <pre>
10306 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10307 int isspace(int c);</pre>
10308 <h6>Description</h6>
10309 <p><!--para 2 -->
10310 The isspace function tests for any character that is a standard white-space character or
10311 is one of a locale-specific set of characters for which isalnum is false. The standard
10312 <!--page 220 -->
10313 white-space characters are the following: space (' '), form feed ('\f'), new-line
10314 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
10315 "C" locale, isspace returns true only for the standard white-space characters.
10317 <h5><a name="7.4.1.11" href="#7.4.1.11">7.4.1.11 The isupper function</a></h5>
10318 <h6>Synopsis</h6>
10319 <p><!--para 1 -->
10320 <pre>
10321 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10322 int isupper(int c);</pre>
10323 <h6>Description</h6>
10324 <p><!--para 2 -->
10325 The isupper function tests for any character that is an uppercase letter or is one of a
10326 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
10327 isspace is true. In the "C" locale, isupper returns true only for the uppercase
10328 letters (as defined in <a href="#5.2.1">5.2.1</a>).
10330 <h5><a name="7.4.1.12" href="#7.4.1.12">7.4.1.12 The isxdigit function</a></h5>
10331 <h6>Synopsis</h6>
10332 <p><!--para 1 -->
10333 <pre>
10334 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10335 int isxdigit(int c);</pre>
10336 <h6>Description</h6>
10337 <p><!--para 2 -->
10338 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
10340 <h4><a name="7.4.2" href="#7.4.2">7.4.2 Character case mapping functions</a></h4>
10342 <h5><a name="7.4.2.1" href="#7.4.2.1">7.4.2.1 The tolower function</a></h5>
10343 <h6>Synopsis</h6>
10344 <p><!--para 1 -->
10345 <pre>
10346 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10347 int tolower(int c);</pre>
10348 <h6>Description</h6>
10349 <p><!--para 2 -->
10350 The tolower function converts an uppercase letter to a corresponding lowercase letter.
10351 <h6>Returns</h6>
10352 <p><!--para 3 -->
10353 If the argument is a character for which isupper is true and there are one or more
10354 corresponding characters, as specified by the current locale, for which islower is true,
10355 the tolower function returns one of the corresponding characters (always the same one
10356 for any given locale); otherwise, the argument is returned unchanged.
10357 <!--page 221 -->
10359 <h5><a name="7.4.2.2" href="#7.4.2.2">7.4.2.2 The toupper function</a></h5>
10360 <h6>Synopsis</h6>
10361 <p><!--para 1 -->
10362 <pre>
10363 #include <a href="#7.4">&lt;ctype.h&gt;</a>
10364 int toupper(int c);</pre>
10365 <h6>Description</h6>
10366 <p><!--para 2 -->
10367 The toupper function converts a lowercase letter to a corresponding uppercase letter.
10368 <h6>Returns</h6>
10369 <p><!--para 3 -->
10370 If the argument is a character for which islower is true and there are one or more
10371 corresponding characters, as specified by the current locale, for which isupper is true,
10372 the toupper function returns one of the corresponding characters (always the same one
10373 for any given locale); otherwise, the argument is returned unchanged.
10374 <!--page 222 -->
10376 <h3><a name="7.5" href="#7.5">7.5 Errors <errno.h></a></h3>
10377 <p><!--para 1 -->
10378 The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
10379 conditions.
10380 <p><!--para 2 -->
10381 The macros are
10382 <pre>
10383 EDOM
10384 EILSEQ
10385 ERANGE</pre>
10386 which expand to integer constant expressions with type int, distinct positive values, and
10387 which are suitable for use in #if preprocessing directives; and
10388 <pre>
10389 errno</pre>
10390 which expands to a modifiable lvalue<sup><a href="#note201"><b>201)</b></a></sup> that has type int and thread local storage
10391 duration, the value of which is set to a positive error number by several library functions.
10392 If a macro definition is suppressed in order to access an actual object, or a program
10393 defines an identifier with the name errno, the behavior is undefined.
10394 <p><!--para 3 -->
10395 The value of errno in the initial thread is zero at program startup (the initial value of
10396 errno in other threads is an indeterminate value), but is never set to zero by any library
10397 function.<sup><a href="#note202"><b>202)</b></a></sup> The value of errno may be set to nonzero by a library function call
10398 whether or not there is an error, provided the use of errno is not documented in the
10399 description of the function in this International Standard.
10400 <p><!--para 4 -->
10401 Additional macro definitions, beginning with E and a digit or E and an uppercase
10402 letter,<sup><a href="#note203"><b>203)</b></a></sup> may also be specified by the implementation.
10407 <!--page 223 -->
10409 <h6>footnotes</h6>
10410 <p><small><a name="note201" href="#note201">201)</a> The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
10411 resulting from a function call (for example, *errno()).
10412 </small>
10413 <p><small><a name="note202" href="#note202">202)</a> Thus, a program that uses errno for error checking should set it to zero before a library function call,
10414 then inspect it before a subsequent library function call. Of course, a library function can save the
10415 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
10416 value is still zero just before the return.
10417 </small>
10418 <p><small><a name="note203" href="#note203">203)</a> See ''future library directions'' (<a href="#7.30.3">7.30.3</a>).
10419 </small>
10421 <h3><a name="7.6" href="#7.6">7.6 Floating-point environment <fenv.h></a></h3>
10422 <p><!--para 1 -->
10423 The header <a href="#7.6">&lt;fenv.h&gt;</a> defines several macros, and declares types and functions that
10424 provide access to the floating-point environment. The floating-point environment refers
10425 collectively to any floating-point status flags and control modes supported by the
10426 implementation.<sup><a href="#note204"><b>204)</b></a></sup> A floating-point status flag is a system variable whose value is set
10427 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
10428 of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note205"><b>205)</b></a></sup> A floating-
10429 point control mode is a system variable whose value may be set by the user to affect the
10430 subsequent behavior of floating-point arithmetic.
10431 <p><!--para 2 -->
10432 The floating-point environment has thread storage duration. The initial state for a
10433 thread's floating-point environment is the current state of the floating-point environment
10434 of the thread that creates it at the time of creation.
10435 <p><!--para 3 -->
10436 Certain programming conventions support the intended model of use for the floating-
10437 point environment:<sup><a href="#note206"><b>206)</b></a></sup>
10438 <ul>
10439 <li> a function call does not alter its caller's floating-point control modes, clear its caller's
10440 floating-point status flags, nor depend on the state of its caller's floating-point status
10441 flags unless the function is so documented;
10442 <li> a function call is assumed to require default floating-point control modes, unless its
10443 documentation promises otherwise;
10444 <li> a function call is assumed to have the potential for raising floating-point exceptions,
10445 unless its documentation promises otherwise.
10446 </ul>
10447 <p><!--para 4 -->
10448 The type
10449 <pre>
10450 fenv_t</pre>
10451 represents the entire floating-point environment.
10452 <p><!--para 5 -->
10453 The type
10454 <pre>
10455 fexcept_t</pre>
10456 represents the floating-point status flags collectively, including any status the
10457 implementation associates with the flags.
10460 <!--page 224 -->
10461 <p><!--para 6 -->
10462 Each of the macros
10463 <pre>
10464 FE_DIVBYZERO
10465 FE_INEXACT
10466 FE_INVALID
10467 FE_OVERFLOW
10468 FE_UNDERFLOW</pre>
10469 is defined if and only if the implementation supports the floating-point exception by
10470 means of the functions in 7.6.2.<sup><a href="#note207"><b>207)</b></a></sup> Additional implementation-defined floating-point
10471 exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
10472 be specified by the implementation. The defined macros expand to integer constant
10473 expressions with values such that bitwise ORs of all combinations of the macros result in
10474 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
10475 zero.<sup><a href="#note208"><b>208)</b></a></sup>
10476 <p><!--para 7 -->
10477 The macro
10478 <pre>
10479 FE_ALL_EXCEPT</pre>
10480 is simply the bitwise OR of all floating-point exception macros defined by the
10481 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
10482 <p><!--para 8 -->
10483 Each of the macros
10484 <pre>
10485 FE_DOWNWARD
10486 FE_TONEAREST
10487 FE_TOWARDZERO
10488 FE_UPWARD</pre>
10489 is defined if and only if the implementation supports getting and setting the represented
10490 rounding direction by means of the fegetround and fesetround functions.
10491 Additional implementation-defined rounding directions, with macro definitions beginning
10492 with FE_ and an uppercase letter, may also be specified by the implementation. The
10493 defined macros expand to integer constant expressions whose values are distinct
10494 nonnegative values.<sup><a href="#note209"><b>209)</b></a></sup>
10495 <p><!--para 9 -->
10496 The macro
10500 <!--page 225 -->
10501 <pre>
10502 FE_DFL_ENV</pre>
10503 represents the default floating-point environment -- the one installed at program startup
10504 <ul>
10505 <li> and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
10506 </ul>
10507 <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
10508 <p><!--para 10 -->
10509 Additional implementation-defined environments, with macro definitions beginning with
10510 FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
10511 also be specified by the implementation.
10513 <h6>footnotes</h6>
10514 <p><small><a name="note204" href="#note204">204)</a> This header is designed to support the floating-point exception status flags and directed-rounding
10515 control modes required by IEC 60559, and other similar floating-point state information. It is also
10516 designed to facilitate code portability among all systems.
10517 </small>
10518 <p><small><a name="note205" href="#note205">205)</a> A floating-point status flag is not an object and can be set more than once within an expression.
10519 </small>
10520 <p><small><a name="note206" href="#note206">206)</a> With these conventions, a programmer can safely assume default floating-point control modes (or be
10521 unaware of them). The responsibilities associated with accessing the floating-point environment fall
10522 on the programmer or program that does so explicitly.
10523 </small>
10524 <p><small><a name="note207" href="#note207">207)</a> The implementation supports a floating-point exception if there are circumstances where a call to at
10525 least one of the functions in <a href="#7.6.2">7.6.2</a>, using the macro as the appropriate argument, will succeed. It is not
10526 necessary for all the functions to succeed all the time.
10527 </small>
10528 <p><small><a name="note208" href="#note208">208)</a> The macros should be distinct powers of two.
10529 </small>
10530 <p><small><a name="note209" href="#note209">209)</a> Even though the rounding direction macros may expand to constants corresponding to the values of
10531 FLT_ROUNDS, they are not required to do so.
10532 </small>
10534 <h4><a name="7.6.1" href="#7.6.1">7.6.1 The FENV_ACCESS pragma</a></h4>
10535 <h6>Synopsis</h6>
10536 <p><!--para 1 -->
10537 <pre>
10538 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10539 #pragma STDC FENV_ACCESS on-off-switch</pre>
10540 <h6>Description</h6>
10541 <p><!--para 2 -->
10542 The FENV_ACCESS pragma provides a means to inform the implementation when a
10543 program might access the floating-point environment to test floating-point status flags or
10544 run under non-default floating-point control modes.<sup><a href="#note210"><b>210)</b></a></sup> The pragma shall occur either
10545 outside external declarations or preceding all explicit declarations and statements inside a
10546 compound statement. When outside external declarations, the pragma takes effect from
10547 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
10548 the translation unit. When inside a compound statement, the pragma takes effect from its
10549 occurrence until another FENV_ACCESS pragma is encountered (including within a
10550 nested compound statement), or until the end of the compound statement; at the end of a
10551 compound statement the state for the pragma is restored to its condition just before the
10552 compound statement. If this pragma is used in any other context, the behavior is
10553 undefined. If part of a program tests floating-point status flags, sets floating-point control
10554 modes, or runs under non-default mode settings, but was translated with the state for the
10555 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
10556 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
10557 the program translated with FENV_ACCESS ''off'' to a part translated with
10558 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
10559 floating-point control modes have their default settings.)
10564 <!--page 226 -->
10565 <p><!--para 3 -->
10566 EXAMPLE
10567 <p><!--para 4 -->
10568 <pre>
10569 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10570 void f(double x)
10572 #pragma STDC FENV_ACCESS ON
10573 void g(double);
10574 void h(double);
10575 /* ... */
10576 g(x + 1);
10577 h(x + 1);
10578 /* ... */
10579 }</pre>
10580 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
10581 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
10582 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note211"><b>211)</b></a></sup>
10585 <h6>footnotes</h6>
10586 <p><small><a name="note210" href="#note210">210)</a> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
10587 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
10588 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
10589 modes are in effect and the flags are not tested.
10590 </small>
10591 <p><small><a name="note211" href="#note211">211)</a> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
10592 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
10593 ''off'', just one evaluation of x + 1 would suffice.
10594 </small>
10596 <h4><a name="7.6.2" href="#7.6.2">7.6.2 Floating-point exceptions</a></h4>
10597 <p><!--para 1 -->
10598 The following functions provide access to the floating-point status flags.<sup><a href="#note212"><b>212)</b></a></sup> The int
10599 input argument for the functions represents a subset of floating-point exceptions, and can
10600 be zero or the bitwise OR of one or more floating-point exception macros, for example
10601 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
10602 functions is undefined.
10604 <h6>footnotes</h6>
10605 <p><small><a name="note212" href="#note212">212)</a> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
10606 abstraction of flags that are either set or clear. An implementation may endow floating-point status
10607 flags with more information -- for example, the address of the code which first raised the floating-
10608 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
10609 content of flags.
10610 </small>
10612 <h5><a name="7.6.2.1" href="#7.6.2.1">7.6.2.1 The feclearexcept function</a></h5>
10613 <h6>Synopsis</h6>
10614 <p><!--para 1 -->
10615 <pre>
10616 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10617 int feclearexcept(int excepts);</pre>
10618 <h6>Description</h6>
10619 <p><!--para 2 -->
10620 The feclearexcept function attempts to clear the supported floating-point exceptions
10621 represented by its argument.
10622 <h6>Returns</h6>
10623 <p><!--para 3 -->
10624 The feclearexcept function returns zero if the excepts argument is zero or if all
10625 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
10628 <!--page 227 -->
10630 <h5><a name="7.6.2.2" href="#7.6.2.2">7.6.2.2 The fegetexceptflag function</a></h5>
10631 <h6>Synopsis</h6>
10632 <p><!--para 1 -->
10633 <pre>
10634 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10635 int fegetexceptflag(fexcept_t *flagp,
10636 int excepts);</pre>
10637 <h6>Description</h6>
10638 <p><!--para 2 -->
10639 The fegetexceptflag function attempts to store an implementation-defined
10640 representation of the states of the floating-point status flags indicated by the argument
10641 excepts in the object pointed to by the argument flagp.
10642 <h6>Returns</h6>
10643 <p><!--para 3 -->
10644 The fegetexceptflag function returns zero if the representation was successfully
10645 stored. Otherwise, it returns a nonzero value.
10647 <h5><a name="7.6.2.3" href="#7.6.2.3">7.6.2.3 The feraiseexcept function</a></h5>
10648 <h6>Synopsis</h6>
10649 <p><!--para 1 -->
10650 <pre>
10651 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10652 int feraiseexcept(int excepts);</pre>
10653 <h6>Description</h6>
10654 <p><!--para 2 -->
10655 The feraiseexcept function attempts to raise the supported floating-point exceptions
10656 represented by its argument.<sup><a href="#note213"><b>213)</b></a></sup> The order in which these floating-point exceptions are
10657 raised is unspecified, except as stated in <a href="#F.8.6">F.8.6</a>. Whether the feraiseexcept function
10658 additionally raises the ''inexact'' floating-point exception whenever it raises the
10659 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
10660 <h6>Returns</h6>
10661 <p><!--para 3 -->
10662 The feraiseexcept function returns zero if the excepts argument is zero or if all
10663 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
10668 <!--page 228 -->
10670 <h6>footnotes</h6>
10671 <p><small><a name="note213" href="#note213">213)</a> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
10672 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
10673 in <a href="#F.8.6">F.8.6</a> is in the same spirit.
10674 </small>
10676 <h5><a name="7.6.2.4" href="#7.6.2.4">7.6.2.4 The fesetexceptflag function</a></h5>
10677 <h6>Synopsis</h6>
10678 <p><!--para 1 -->
10679 <pre>
10680 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10681 int fesetexceptflag(const fexcept_t *flagp,
10682 int excepts);</pre>
10683 <h6>Description</h6>
10684 <p><!--para 2 -->
10685 The fesetexceptflag function attempts to set the floating-point status flags
10686 indicated by the argument excepts to the states stored in the object pointed to by
10687 flagp. The value of *flagp shall have been set by a previous call to
10688 fegetexceptflag whose second argument represented at least those floating-point
10689 exceptions represented by the argument excepts. This function does not raise floating-
10690 point exceptions, but only sets the state of the flags.
10691 <h6>Returns</h6>
10692 <p><!--para 3 -->
10693 The fesetexceptflag function returns zero if the excepts argument is zero or if
10694 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
10695 a nonzero value.
10697 <h5><a name="7.6.2.5" href="#7.6.2.5">7.6.2.5 The fetestexcept function</a></h5>
10698 <h6>Synopsis</h6>
10699 <p><!--para 1 -->
10700 <pre>
10701 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10702 int fetestexcept(int excepts);</pre>
10703 <h6>Description</h6>
10704 <p><!--para 2 -->
10705 The fetestexcept function determines which of a specified subset of the floating-
10706 point exception flags are currently set. The excepts argument specifies the floating-
10707 point status flags to be queried.<sup><a href="#note214"><b>214)</b></a></sup>
10708 <h6>Returns</h6>
10709 <p><!--para 3 -->
10710 The fetestexcept function returns the value of the bitwise OR of the floating-point
10711 exception macros corresponding to the currently set floating-point exceptions included in
10712 excepts.
10713 <p><!--para 4 -->
10714 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
10719 <!--page 229 -->
10720 <pre>
10721 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10722 /* ... */
10724 #pragma STDC FENV_ACCESS ON
10725 int set_excepts;
10726 feclearexcept(FE_INVALID | FE_OVERFLOW);
10727 // maybe raise exceptions
10728 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
10729 if (set_excepts &amp; FE_INVALID) f();
10730 if (set_excepts &amp; FE_OVERFLOW) g();
10731 /* ... */
10732 }</pre>
10735 <h6>footnotes</h6>
10736 <p><small><a name="note214" href="#note214">214)</a> This mechanism allows testing several floating-point exceptions with just one function call.
10737 </small>
10739 <h4><a name="7.6.3" href="#7.6.3">7.6.3 Rounding</a></h4>
10740 <p><!--para 1 -->
10741 The fegetround and fesetround functions provide control of rounding direction
10742 modes.
10744 <h5><a name="7.6.3.1" href="#7.6.3.1">7.6.3.1 The fegetround function</a></h5>
10745 <h6>Synopsis</h6>
10746 <p><!--para 1 -->
10747 <pre>
10748 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10749 int fegetround(void);</pre>
10750 <h6>Description</h6>
10751 <p><!--para 2 -->
10752 The fegetround function gets the current rounding direction.
10753 <h6>Returns</h6>
10754 <p><!--para 3 -->
10755 The fegetround function returns the value of the rounding direction macro
10756 representing the current rounding direction or a negative value if there is no such
10757 rounding direction macro or the current rounding direction is not determinable.
10759 <h5><a name="7.6.3.2" href="#7.6.3.2">7.6.3.2 The fesetround function</a></h5>
10760 <h6>Synopsis</h6>
10761 <p><!--para 1 -->
10762 <pre>
10763 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10764 int fesetround(int round);</pre>
10765 <h6>Description</h6>
10766 <p><!--para 2 -->
10767 The fesetround function establishes the rounding direction represented by its
10768 argument round. If the argument is not equal to the value of a rounding direction macro,
10769 the rounding direction is not changed.
10770 <h6>Returns</h6>
10771 <p><!--para 3 -->
10772 The fesetround function returns zero if and only if the requested rounding direction
10773 was established.
10774 <!--page 230 -->
10775 <p><!--para 4 -->
10776 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
10777 rounding direction fails.
10778 <pre>
10779 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10780 #include <a href="#7.2">&lt;assert.h&gt;</a>
10781 void f(int round_dir)
10783 #pragma STDC FENV_ACCESS ON
10784 int save_round;
10785 int setround_ok;
10786 save_round = fegetround();
10787 setround_ok = fesetround(round_dir);
10788 assert(setround_ok == 0);
10789 /* ... */
10790 fesetround(save_round);
10791 /* ... */
10792 }</pre>
10795 <h4><a name="7.6.4" href="#7.6.4">7.6.4 Environment</a></h4>
10796 <p><!--para 1 -->
10797 The functions in this section manage the floating-point environment -- status flags and
10798 control modes -- as one entity.
10800 <h5><a name="7.6.4.1" href="#7.6.4.1">7.6.4.1 The fegetenv function</a></h5>
10801 <h6>Synopsis</h6>
10802 <p><!--para 1 -->
10803 <pre>
10804 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10805 int fegetenv(fenv_t *envp);</pre>
10806 <h6>Description</h6>
10807 <p><!--para 2 -->
10808 The fegetenv function attempts to store the current floating-point environment in the
10809 object pointed to by envp.
10810 <h6>Returns</h6>
10811 <p><!--para 3 -->
10812 The fegetenv function returns zero if the environment was successfully stored.
10813 Otherwise, it returns a nonzero value.
10815 <h5><a name="7.6.4.2" href="#7.6.4.2">7.6.4.2 The feholdexcept function</a></h5>
10816 <h6>Synopsis</h6>
10817 <p><!--para 1 -->
10818 <pre>
10819 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10820 int feholdexcept(fenv_t *envp);</pre>
10821 <h6>Description</h6>
10822 <p><!--para 2 -->
10823 The feholdexcept function saves the current floating-point environment in the object
10824 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
10825 (continue on floating-point exceptions) mode, if available, for all floating-point
10826 exceptions.<sup><a href="#note215"><b>215)</b></a></sup>
10827 <!--page 231 -->
10828 <h6>Returns</h6>
10829 <p><!--para 3 -->
10830 The feholdexcept function returns zero if and only if non-stop floating-point
10831 exception handling was successfully installed.
10833 <h6>footnotes</h6>
10834 <p><small><a name="note215" href="#note215">215)</a> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
10835 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
10836 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
10837 function to write routines that hide spurious floating-point exceptions from their callers.
10838 </small>
10840 <h5><a name="7.6.4.3" href="#7.6.4.3">7.6.4.3 The fesetenv function</a></h5>
10841 <h6>Synopsis</h6>
10842 <p><!--para 1 -->
10843 <pre>
10844 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10845 int fesetenv(const fenv_t *envp);</pre>
10846 <h6>Description</h6>
10847 <p><!--para 2 -->
10848 The fesetenv function attempts to establish the floating-point environment represented
10849 by the object pointed to by envp. The argument envp shall point to an object set by a
10850 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
10851 Note that fesetenv merely installs the state of the floating-point status flags
10852 represented through its argument, and does not raise these floating-point exceptions.
10853 <h6>Returns</h6>
10854 <p><!--para 3 -->
10855 The fesetenv function returns zero if the environment was successfully established.
10856 Otherwise, it returns a nonzero value.
10858 <h5><a name="7.6.4.4" href="#7.6.4.4">7.6.4.4 The feupdateenv function</a></h5>
10859 <h6>Synopsis</h6>
10860 <p><!--para 1 -->
10861 <pre>
10862 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10863 int feupdateenv(const fenv_t *envp);</pre>
10864 <h6>Description</h6>
10865 <p><!--para 2 -->
10866 The feupdateenv function attempts to save the currently raised floating-point
10867 exceptions in its automatic storage, install the floating-point environment represented by
10868 the object pointed to by envp, and then raise the saved floating-point exceptions. The
10869 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
10870 or equal a floating-point environment macro.
10871 <h6>Returns</h6>
10872 <p><!--para 3 -->
10873 The feupdateenv function returns zero if all the actions were successfully carried out.
10874 Otherwise, it returns a nonzero value.
10879 <!--page 232 -->
10880 <p><!--para 4 -->
10881 EXAMPLE Hide spurious underflow floating-point exceptions:
10882 <!--page 233 -->
10883 <pre>
10884 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10885 double f(double x)
10887 #pragma STDC FENV_ACCESS ON
10888 double result;
10889 fenv_t save_env;
10890 if (feholdexcept(&amp;save_env))
10891 return /* indication of an environmental problem */;
10892 // compute result
10893 if (/* test spurious underflow */)
10894 if (feclearexcept(FE_UNDERFLOW))
10895 return /* indication of an environmental problem */;
10896 if (feupdateenv(&amp;save_env))
10897 return /* indication of an environmental problem */;
10898 return result;
10899 }</pre>
10901 <h3><a name="7.7" href="#7.7">7.7 Characteristics of floating types <float.h></a></h3>
10902 <p><!--para 1 -->
10903 The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
10904 parameters of the standard floating-point types.
10905 <p><!--para 2 -->
10906 The macros, their meanings, and the constraints (or restrictions) on their values are listed
10907 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
10908 <!--page 234 -->
10910 <h3><a name="7.8" href="#7.8">7.8 Format conversion of integer types <inttypes.h></a></h3>
10911 <p><!--para 1 -->
10912 The header <a href="#7.8">&lt;inttypes.h&gt;</a> includes the header <a href="#7.20">&lt;stdint.h&gt;</a> and extends it with
10913 additional facilities provided by hosted implementations.
10914 <p><!--para 2 -->
10915 It declares functions for manipulating greatest-width integers and converting numeric
10916 character strings to greatest-width integers, and it declares the type
10917 <pre>
10918 imaxdiv_t</pre>
10919 which is a structure type that is the type of the value returned by the imaxdiv function.
10920 For each type declared in <a href="#7.20">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
10921 specifiers for use with the formatted input/output functions.<sup><a href="#note216"><b>216)</b></a></sup>
10922 <p><b> Forward references</b>: integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>), formatted input/output
10923 functions (<a href="#7.21.6">7.21.6</a>), formatted wide character input/output functions (<a href="#7.28.2">7.28.2</a>).
10925 <h6>footnotes</h6>
10926 <p><small><a name="note216" href="#note216">216)</a> See ''future library directions'' (<a href="#7.30.4">7.30.4</a>).
10927 </small>
10929 <h4><a name="7.8.1" href="#7.8.1">7.8.1 Macros for format specifiers</a></h4>
10930 <p><!--para 1 -->
10931 Each of the following object-like macros expands to a character string literal containing a *
10932 conversion specifier, possibly modified by a length modifier, suitable for use within the
10933 format argument of a formatted input/output function when converting the corresponding
10934 integer type. These macro names have the general form of PRI (character string literals
10935 for the fprintf and fwprintf family) or SCN (character string literals for the
10936 fscanf and fwscanf family),<sup><a href="#note217"><b>217)</b></a></sup> followed by the conversion specifier, followed by a
10937 name corresponding to a similar type name in <a href="#7.20.1">7.20.1</a>. In these names, N represents the
10938 width of the type as described in <a href="#7.20.1">7.20.1</a>. For example, PRIdFAST32 can be used in a
10939 format string to print the value of an integer of type int_fast32_t.
10940 <p><!--para 2 -->
10941 The fprintf macros for signed integers are:
10942 <p><!--para 3 -->
10943 <pre>
10944 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
10945 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR</pre>
10946 The fprintf macros for unsigned integers are:
10947 <p><!--para 4 -->
10948 <pre>
10949 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
10950 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
10951 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
10952 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR</pre>
10953 The fscanf macros for signed integers are:
10957 <!--page 235 -->
10958 <p><!--para 5 -->
10959 <pre>
10960 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
10961 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR</pre>
10962 The fscanf macros for unsigned integers are:
10963 <p><!--para 6 -->
10964 <pre>
10965 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
10966 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
10967 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR</pre>
10968 For each type that the implementation provides in <a href="#7.20">&lt;stdint.h&gt;</a>, the corresponding
10969 fprintf macros shall be defined and the corresponding fscanf macros shall be
10970 defined unless the implementation does not have a suitable fscanf length modifier for
10971 the type.
10972 <p><!--para 7 -->
10973 EXAMPLE
10974 <pre>
10975 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10976 #include <a href="#7.28">&lt;wchar.h&gt;</a>
10977 int main(void)
10979 uintmax_t i = UINTMAX_MAX; // this type always exists
10980 wprintf(L"The largest integer value is %020"
10981 PRIxMAX "\n", i);
10982 return 0;
10983 }</pre>
10986 <h6>footnotes</h6>
10987 <p><small><a name="note217" href="#note217">217)</a> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
10988 different format specifiers may be required for fprintf and fscanf, even when the type is the
10989 same.
10990 </small>
10992 <h4><a name="7.8.2" href="#7.8.2">7.8.2 Functions for greatest-width integer types</a></h4>
10994 <h5><a name="7.8.2.1" href="#7.8.2.1">7.8.2.1 The imaxabs function</a></h5>
10995 <h6>Synopsis</h6>
10996 <p><!--para 1 -->
10997 <pre>
10998 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10999 intmax_t imaxabs(intmax_t j);</pre>
11000 <h6>Description</h6>
11001 <p><!--para 2 -->
11002 The imaxabs function computes the absolute value of an integer j. If the result cannot
11003 be represented, the behavior is undefined.<sup><a href="#note218"><b>218)</b></a></sup>
11004 <h6>Returns</h6>
11005 <p><!--para 3 -->
11006 The imaxabs function returns the absolute value.
11011 <!--page 236 -->
11013 <h6>footnotes</h6>
11014 <p><small><a name="note218" href="#note218">218)</a> The absolute value of the most negative number cannot be represented in two's complement.
11015 </small>
11017 <h5><a name="7.8.2.2" href="#7.8.2.2">7.8.2.2 The imaxdiv function</a></h5>
11018 <h6>Synopsis</h6>
11019 <p><!--para 1 -->
11020 <pre>
11021 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11022 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);</pre>
11023 <h6>Description</h6>
11024 <p><!--para 2 -->
11025 The imaxdiv function computes numer / denom and numer % denom in a single
11026 operation.
11027 <h6>Returns</h6>
11028 <p><!--para 3 -->
11029 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
11030 quotient and the remainder. The structure shall contain (in either order) the members
11031 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
11032 either part of the result cannot be represented, the behavior is undefined.
11034 <h5><a name="7.8.2.3" href="#7.8.2.3">7.8.2.3 The strtoimax and strtoumax functions</a></h5>
11035 <h6>Synopsis</h6>
11036 <p><!--para 1 -->
11037 <pre>
11038 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11039 intmax_t strtoimax(const char * restrict nptr,
11040 char ** restrict endptr, int base);
11041 uintmax_t strtoumax(const char * restrict nptr,
11042 char ** restrict endptr, int base);</pre>
11043 <h6>Description</h6>
11044 <p><!--para 2 -->
11045 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
11046 strtoul, and strtoull functions, except that the initial portion of the string is
11047 converted to intmax_t and uintmax_t representation, respectively.
11048 <h6>Returns</h6>
11049 <p><!--para 3 -->
11050 The strtoimax and strtoumax functions return the converted value, if any. If no
11051 conversion could be performed, zero is returned. If the correct value is outside the range
11052 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
11053 (according to the return type and sign of the value, if any), and the value of the macro
11054 ERANGE is stored in errno.
11055 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
11056 (<a href="#7.22.1.4">7.22.1.4</a>).
11057 <!--page 237 -->
11059 <h5><a name="7.8.2.4" href="#7.8.2.4">7.8.2.4 The wcstoimax and wcstoumax functions</a></h5>
11060 <h6>Synopsis</h6>
11061 <p><!--para 1 -->
11062 <pre>
11063 #include <a href="#7.19">&lt;stddef.h&gt;</a> // for wchar_t
11064 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11065 intmax_t wcstoimax(const wchar_t * restrict nptr,
11066 wchar_t ** restrict endptr, int base);
11067 uintmax_t wcstoumax(const wchar_t * restrict nptr,
11068 wchar_t ** restrict endptr, int base);</pre>
11069 <h6>Description</h6>
11070 <p><!--para 2 -->
11071 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
11072 wcstoul, and wcstoull functions except that the initial portion of the wide string is
11073 converted to intmax_t and uintmax_t representation, respectively.
11074 <h6>Returns</h6>
11075 <p><!--para 3 -->
11076 The wcstoimax function returns the converted value, if any. If no conversion could be
11077 performed, zero is returned. If the correct value is outside the range of representable
11078 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
11079 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
11080 errno.
11081 <p><b> Forward references</b>: the wcstol, wcstoll, wcstoul, and wcstoull functions
11082 (<a href="#7.28.4.1.2">7.28.4.1.2</a>).
11083 <!--page 238 -->
11085 <h3><a name="7.9" href="#7.9">7.9 Alternative spellings <iso646.h></a></h3>
11086 <p><!--para 1 -->
11087 The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
11088 to the corresponding tokens (on the right):
11089 <!--page 239 -->
11090 <pre>
11091 and &amp;&amp;
11092 and_eq &amp;=
11093 bitand &amp;
11094 bitor |
11095 compl ~
11096 not !
11097 not_eq !=
11098 or ||
11099 or_eq |=
11100 xor ^
11101 xor_eq ^=</pre>
11103 <h3><a name="7.10" href="#7.10">7.10 Sizes of integer types <limits.h></a></h3>
11104 <p><!--para 1 -->
11105 The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
11106 parameters of the standard integer types.
11107 <p><!--para 2 -->
11108 The macros, their meanings, and the constraints (or restrictions) on their values are listed
11109 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
11110 <!--page 240 -->
11112 <h3><a name="7.11" href="#7.11">7.11 Localization <locale.h></a></h3>
11113 <p><!--para 1 -->
11114 The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
11115 <p><!--para 2 -->
11116 The type is
11117 <pre>
11118 struct lconv</pre>
11119 which contains members related to the formatting of numeric values. The structure shall
11120 contain at least the following members, in any order. The semantics of the members and
11121 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
11122 the values specified in the comments.
11123 <!--page 241 -->
11124 <p><!--para 3 -->
11125 <pre>
11126 char *decimal_point; // "."
11127 char *thousands_sep; // ""
11128 char *grouping; // ""
11129 char *mon_decimal_point; // ""
11130 char *mon_thousands_sep; // ""
11131 char *mon_grouping; // ""
11132 char *positive_sign; // ""
11133 char *negative_sign; // ""
11134 char *currency_symbol; // ""
11135 char frac_digits; // CHAR_MAX
11136 char p_cs_precedes; // CHAR_MAX
11137 char n_cs_precedes; // CHAR_MAX
11138 char p_sep_by_space; // CHAR_MAX
11139 char n_sep_by_space; // CHAR_MAX
11140 char p_sign_posn; // CHAR_MAX
11141 char n_sign_posn; // CHAR_MAX
11142 char *int_curr_symbol; // ""
11143 char int_frac_digits; // CHAR_MAX
11144 char int_p_cs_precedes; // CHAR_MAX
11145 char int_n_cs_precedes; // CHAR_MAX
11146 char int_p_sep_by_space; // CHAR_MAX
11147 char int_n_sep_by_space; // CHAR_MAX
11148 char int_p_sign_posn; // CHAR_MAX
11149 char int_n_sign_posn; // CHAR_MAX</pre>
11150 The macros defined are NULL (described in <a href="#7.19">7.19</a>); and
11151 <pre>
11152 LC_ALL
11153 LC_COLLATE
11154 LC_CTYPE
11155 LC_MONETARY
11156 LC_NUMERIC
11157 LC_TIME</pre>
11158 which expand to integer constant expressions with distinct values, suitable for use as the
11159 first argument to the setlocale function.<sup><a href="#note219"><b>219)</b></a></sup> Additional macro definitions, beginning
11160 with the characters LC_ and an uppercase letter,<sup><a href="#note220"><b>220)</b></a></sup> may also be specified by the
11161 implementation.
11163 <h6>footnotes</h6>
11164 <p><small><a name="note219" href="#note219">219)</a> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
11165 </small>
11166 <p><small><a name="note220" href="#note220">220)</a> See ''future library directions'' (<a href="#7.30.5">7.30.5</a>).
11167 </small>
11169 <h4><a name="7.11.1" href="#7.11.1">7.11.1 Locale control</a></h4>
11171 <h5><a name="7.11.1.1" href="#7.11.1.1">7.11.1.1 The setlocale function</a></h5>
11172 <h6>Synopsis</h6>
11173 <p><!--para 1 -->
11174 <pre>
11175 #include <a href="#7.11">&lt;locale.h&gt;</a>
11176 char *setlocale(int category, const char *locale);</pre>
11177 <h6>Description</h6>
11178 <p><!--para 2 -->
11179 The setlocale function selects the appropriate portion of the program's locale as
11180 specified by the category and locale arguments. The setlocale function may be
11181 used to change or query the program's entire current locale or portions thereof. The value
11182 LC_ALL for category names the program's entire locale; the other values for
11183 category name only a portion of the program's locale. LC_COLLATE affects the
11184 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
11185 the character handling functions<sup><a href="#note221"><b>221)</b></a></sup> and the multibyte and wide character functions.
11186 LC_MONETARY affects the monetary formatting information returned by the
11187 localeconv function. LC_NUMERIC affects the decimal-point character for the
11188 formatted input/output functions and the string conversion functions, as well as the
11189 nonmonetary formatting information returned by the localeconv function. LC_TIME
11190 affects the behavior of the strftime and wcsftime functions.
11191 <p><!--para 3 -->
11192 A value of "C" for locale specifies the minimal environment for C translation; a value
11193 of "" for locale specifies the locale-specific native environment. Other
11194 implementation-defined strings may be passed as the second argument to setlocale.
11196 <!--page 242 -->
11197 <p><!--para 4 -->
11198 At program startup, the equivalent of
11199 <pre>
11200 setlocale(LC_ALL, "C");</pre>
11201 is executed.
11202 <p><!--para 5 -->
11203 A call to the setlocale function may introduce a data race with other calls to the
11204 setlocale function or with calls to functions that are affected by the current locale.
11205 The implementation shall behave as if no library function calls the setlocale function.
11206 <h6>Returns</h6>
11207 <p><!--para 6 -->
11208 If a pointer to a string is given for locale and the selection can be honored, the
11209 setlocale function returns a pointer to the string associated with the specified
11210 category for the new locale. If the selection cannot be honored, the setlocale
11211 function returns a null pointer and the program's locale is not changed.
11212 <p><!--para 7 -->
11213 A null pointer for locale causes the setlocale function to return a pointer to the
11214 string associated with the category for the program's current locale; the program's
11215 locale is not changed.<sup><a href="#note222"><b>222)</b></a></sup>
11216 <p><!--para 8 -->
11217 The pointer to string returned by the setlocale function is such that a subsequent call
11218 with that string value and its associated category will restore that part of the program's
11219 locale. The string pointed to shall not be modified by the program, but may be
11220 overwritten by a subsequent call to the setlocale function.
11221 <p><b> Forward references</b>: formatted input/output functions (<a href="#7.21.6">7.21.6</a>), multibyte/wide
11222 character conversion functions (<a href="#7.22.7">7.22.7</a>), multibyte/wide string conversion functions
11223 (<a href="#7.22.8">7.22.8</a>), numeric conversion functions (<a href="#7.22.1">7.22.1</a>), the strcoll function (<a href="#7.23.4.3">7.23.4.3</a>), the
11224 strftime function (<a href="#7.26.3.5">7.26.3.5</a>), the strxfrm function (<a href="#7.23.4.5">7.23.4.5</a>).
11226 <h6>footnotes</h6>
11227 <p><small><a name="note221" href="#note221">221)</a> The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
11228 isxdigit.
11229 </small>
11230 <p><small><a name="note222" href="#note222">222)</a> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
11231 locale when category has the value LC_ALL.
11232 </small>
11234 <h4><a name="7.11.2" href="#7.11.2">7.11.2 Numeric formatting convention inquiry</a></h4>
11236 <h5><a name="7.11.2.1" href="#7.11.2.1">7.11.2.1 The localeconv function</a></h5>
11237 <h6>Synopsis</h6>
11238 <p><!--para 1 -->
11239 <pre>
11240 #include <a href="#7.11">&lt;locale.h&gt;</a>
11241 struct lconv *localeconv(void);</pre>
11242 <h6>Description</h6>
11243 <p><!--para 2 -->
11244 The localeconv function sets the components of an object with type struct lconv
11245 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
11246 according to the rules of the current locale.
11250 <!--page 243 -->
11251 <p><!--para 3 -->
11252 The members of the structure with type char * are pointers to strings, any of which
11253 (except decimal_point) can point to "", to indicate that the value is not available in
11254 the current locale or is of zero length. Apart from grouping and mon_grouping, the
11255 strings shall start and end in the initial shift state. The members with type char are
11256 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
11257 available in the current locale. The members include the following:
11258 char *decimal_point
11259 <pre>
11260 The decimal-point character used to format nonmonetary quantities.</pre>
11261 char *thousands_sep
11262 <pre>
11263 The character used to separate groups of digits before the decimal-point
11264 character in formatted nonmonetary quantities.</pre>
11265 char *grouping
11266 <pre>
11267 A string whose elements indicate the size of each group of digits in
11268 formatted nonmonetary quantities.</pre>
11269 char *mon_decimal_point
11270 <pre>
11271 The decimal-point used to format monetary quantities.</pre>
11272 char *mon_thousands_sep
11273 <pre>
11274 The separator for groups of digits before the decimal-point in formatted
11275 monetary quantities.</pre>
11276 char *mon_grouping
11277 <pre>
11278 A string whose elements indicate the size of each group of digits in
11279 formatted monetary quantities.</pre>
11280 char *positive_sign
11281 <pre>
11282 The string used to indicate a nonnegative-valued formatted monetary
11283 quantity.</pre>
11284 char *negative_sign
11285 <pre>
11286 The string used to indicate a negative-valued formatted monetary quantity.</pre>
11287 char *currency_symbol
11288 <pre>
11289 The local currency symbol applicable to the current locale.</pre>
11290 char frac_digits
11291 <pre>
11292 The number of fractional digits (those after the decimal-point) to be
11293 displayed in a locally formatted monetary quantity.</pre>
11294 char p_cs_precedes
11295 <!--page 244 -->
11296 <pre>
11297 Set to 1 or 0 if the currency_symbol respectively precedes or
11298 succeeds the value for a nonnegative locally formatted monetary quantity.</pre>
11299 char n_cs_precedes
11300 <pre>
11301 Set to 1 or 0 if the currency_symbol respectively precedes or
11302 succeeds the value for a negative locally formatted monetary quantity.</pre>
11303 char p_sep_by_space
11304 <pre>
11305 Set to a value indicating the separation of the currency_symbol, the
11306 sign string, and the value for a nonnegative locally formatted monetary
11307 quantity.</pre>
11308 char n_sep_by_space
11309 <pre>
11310 Set to a value indicating the separation of the currency_symbol, the
11311 sign string, and the value for a negative locally formatted monetary
11312 quantity.</pre>
11313 char p_sign_posn
11314 <pre>
11315 Set to a value indicating the positioning of the positive_sign for a
11316 nonnegative locally formatted monetary quantity.</pre>
11317 char n_sign_posn
11318 <pre>
11319 Set to a value indicating the positioning of the negative_sign for a
11320 negative locally formatted monetary quantity.</pre>
11321 char *int_curr_symbol
11322 <pre>
11323 The international currency symbol applicable to the current locale. The
11324 first three characters contain the alphabetic international currency symbol
11325 in accordance with those specified in ISO 4217. The fourth character
11326 (immediately preceding the null character) is the character used to separate
11327 the international currency symbol from the monetary quantity.</pre>
11328 char int_frac_digits
11329 <pre>
11330 The number of fractional digits (those after the decimal-point) to be
11331 displayed in an internationally formatted monetary quantity.</pre>
11332 char int_p_cs_precedes
11333 <pre>
11334 Set to 1 or 0 if the int_curr_symbol respectively precedes or
11335 succeeds the value for a nonnegative internationally formatted monetary
11336 quantity.</pre>
11337 char int_n_cs_precedes
11338 <pre>
11339 Set to 1 or 0 if the int_curr_symbol respectively precedes or
11340 succeeds the value for a negative internationally formatted monetary
11341 quantity.</pre>
11342 char int_p_sep_by_space
11343 <!--page 245 -->
11344 <pre>
11345 Set to a value indicating the separation of the int_curr_symbol, the
11346 sign string, and the value for a nonnegative internationally formatted
11347 monetary quantity.</pre>
11348 char int_n_sep_by_space
11349 <pre>
11350 Set to a value indicating the separation of the int_curr_symbol, the
11351 sign string, and the value for a negative internationally formatted monetary
11352 quantity.</pre>
11353 char int_p_sign_posn
11354 <pre>
11355 Set to a value indicating the positioning of the positive_sign for a
11356 nonnegative internationally formatted monetary quantity.</pre>
11357 char int_n_sign_posn
11358 <p><!--para 4 -->
11359 <pre>
11360 Set to a value indicating the positioning of the negative_sign for a
11361 negative internationally formatted monetary quantity.</pre>
11362 The elements of grouping and mon_grouping are interpreted according to the
11363 following:
11364 CHAR_MAX No further grouping is to be performed.
11365 0 The previous element is to be repeatedly used for the remainder of the
11366 <pre>
11367 digits.</pre>
11368 other The integer value is the number of digits that compose the current group.
11369 <p><!--para 5 -->
11370 <pre>
11371 The next element is examined to determine the size of the next group of
11372 digits before the current group.</pre>
11373 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
11374 and int_n_sep_by_space are interpreted according to the following:
11375 0 No space separates the currency symbol and value.
11376 1 If the currency symbol and sign string are adjacent, a space separates them from the
11377 <pre>
11378 value; otherwise, a space separates the currency symbol from the value.</pre>
11379 2 If the currency symbol and sign string are adjacent, a space separates them;
11380 <pre>
11381 otherwise, a space separates the sign string from the value.</pre>
11382 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
11383 int_curr_symbol is used instead of a space.
11384 <p><!--para 6 -->
11385 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
11386 int_n_sign_posn are interpreted according to the following:
11387 0 Parentheses surround the quantity and currency symbol.
11388 1 The sign string precedes the quantity and currency symbol.
11389 2 The sign string succeeds the quantity and currency symbol.
11390 3 The sign string immediately precedes the currency symbol.
11391 4 The sign string immediately succeeds the currency symbol.
11392 <!--page 246 -->
11393 <p><!--para 7 -->
11394 The implementation shall behave as if no library function calls the localeconv
11395 function.
11396 <h6>Returns</h6>
11397 <p><!--para 8 -->
11398 The localeconv function returns a pointer to the filled-in object. The structure
11399 pointed to by the return value shall not be modified by the program, but may be
11400 overwritten by a subsequent call to the localeconv function. In addition, calls to the
11401 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
11402 overwrite the contents of the structure.
11403 <p><!--para 9 -->
11404 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
11405 monetary quantities.
11406 <pre>
11407 Local format International format</pre>
11409 Country Positive Negative Positive Negative
11411 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
11412 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
11413 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
11414 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
11415 <p><!--para 10 -->
11416 For these four countries, the respective values for the monetary members of the structure returned by
11417 localeconv could be:
11418 <pre>
11419 Country1 Country2 Country3 Country4</pre>
11421 mon_decimal_point "," "" "," "."
11422 mon_thousands_sep "." "." "." ","
11423 mon_grouping "\3" "\3" "\3" "\3"
11424 positive_sign "" "" "" ""
11425 negative_sign "-" "-" "-" "C"
11426 currency_symbol "mk" "L." "\u0192" "SFrs."
11427 frac_digits 2 0 2 2
11428 p_cs_precedes 0 1 1 1
11429 n_cs_precedes 0 1 1 1
11430 p_sep_by_space 1 0 1 0
11431 n_sep_by_space 1 0 2 0
11432 p_sign_posn 1 1 1 1
11433 n_sign_posn 1 1 4 2
11434 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
11435 int_frac_digits 2 0 2 2
11436 int_p_cs_precedes 1 1 1 1
11437 int_n_cs_precedes 1 1 1 1
11438 int_p_sep_by_space 1 1 1 1
11439 int_n_sep_by_space 2 1 2 1
11440 int_p_sign_posn 1 1 1 1
11441 int_n_sign_posn 4 1 4 2
11442 <!--page 247 -->
11443 <p><!--para 11 -->
11444 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
11445 affect the formatted value.
11446 <pre>
11447 p_sep_by_space</pre>
11449 p_cs_precedes p_sign_posn 0 1 2
11451 <pre>
11452 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
11453 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
11454 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
11455 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
11456 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +</pre>
11458 <!--page 248 -->
11459 <pre>
11460 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
11461 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
11462 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
11463 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
11464 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25</pre>
11466 <h3><a name="7.12" href="#7.12">7.12 Mathematics <math.h></a></h3>
11467 <p><!--para 1 -->
11468 The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
11469 several macros. Most synopses specify a family of functions consisting of a principal
11470 function with one or more double parameters, a double return value, or both; and
11471 other functions with the same name but with f and l suffixes, which are corresponding
11472 functions with float and long double parameters, return values, or both.<sup><a href="#note223"><b>223)</b></a></sup>
11473 Integer arithmetic functions and conversion functions are discussed later.
11474 <p><!--para 2 -->
11475 The types
11476 <pre>
11477 float_t
11478 double_t</pre>
11479 are floating types at least as wide as float and double, respectively, and such that
11480 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
11481 float_t and double_t are float and double, respectively; if
11482 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
11483 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
11484 otherwise implementation-defined.<sup><a href="#note224"><b>224)</b></a></sup>
11485 <p><!--para 3 -->
11486 The macro
11487 <pre>
11488 HUGE_VAL</pre>
11489 expands to a positive double constant expression, not necessarily representable as a
11490 float. The macros
11491 <pre>
11492 HUGE_VALF
11493 HUGE_VALL</pre>
11494 are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note225"><b>225)</b></a></sup>
11495 <p><!--para 4 -->
11496 The macro
11497 <pre>
11498 INFINITY</pre>
11499 expands to a constant expression of type float representing positive or unsigned
11500 infinity, if available; else to a positive constant of type float that overflows at
11504 <!--page 249 -->
11505 translation time.<sup><a href="#note226"><b>226)</b></a></sup>
11506 <p><!--para 5 -->
11507 The macro
11508 <pre>
11509 NAN</pre>
11510 is defined if and only if the implementation supports quiet NaNs for the float type. It
11511 expands to a constant expression of type float representing a quiet NaN.
11512 <p><!--para 6 -->
11513 The number classification macros
11514 <pre>
11515 FP_INFINITE
11516 FP_NAN
11517 FP_NORMAL
11518 FP_SUBNORMAL
11519 FP_ZERO</pre>
11520 represent the mutually exclusive kinds of floating-point values. They expand to integer
11521 constant expressions with distinct values. Additional implementation-defined floating-
11522 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
11523 may also be specified by the implementation.
11524 <p><!--para 7 -->
11525 The macro
11526 <pre>
11527 FP_FAST_FMA</pre>
11528 is optionally defined. If defined, it indicates that the fma function generally executes
11529 about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note227"><b>227)</b></a></sup> The
11530 macros
11531 <pre>
11532 FP_FAST_FMAF
11533 FP_FAST_FMAL</pre>
11534 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
11535 these macros expand to the integer constant 1.
11536 <p><!--para 8 -->
11537 The macros
11538 <pre>
11539 FP_ILOGB0
11540 FP_ILOGBNAN</pre>
11541 expand to integer constant expressions whose values are returned by ilogb(x) if x is
11542 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
11543 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
11546 <!--page 250 -->
11547 <p><!--para 9 -->
11548 The macros
11549 <pre>
11550 MATH_ERRNO
11551 MATH_ERREXCEPT</pre>
11552 expand to the integer constants 1 and 2, respectively; the macro
11553 <pre>
11554 math_errhandling</pre>
11555 expands to an expression that has type int and the value MATH_ERRNO,
11556 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
11557 constant for the duration of the program. It is unspecified whether
11558 math_errhandling is a macro or an identifier with external linkage. If a macro
11559 definition is suppressed or a program defines an identifier with the name
11560 math_errhandling, the behavior is undefined. If the expression
11561 math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
11562 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
11563 <a href="#7.6">&lt;fenv.h&gt;</a>.
11565 <h6>footnotes</h6>
11566 <p><small><a name="note223" href="#note223">223)</a> Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
11567 and return values in wider format than the synopsis prototype indicates.
11568 </small>
11569 <p><small><a name="note224" href="#note224">224)</a> The types float_t and double_t are intended to be the implementation's most efficient types at
11570 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
11571 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
11572 </small>
11573 <p><small><a name="note225" href="#note225">225)</a> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
11574 supports infinities.
11575 </small>
11576 <p><small><a name="note226" href="#note226">226)</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.
11577 </small>
11578 <p><small><a name="note227" href="#note227">227)</a> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
11579 directly with a hardware multiply-add instruction. Software implementations are expected to be
11580 substantially slower.
11581 </small>
11583 <h4><a name="7.12.1" href="#7.12.1">7.12.1 Treatment of error conditions</a></h4>
11584 <p><!--para 1 -->
11585 The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
11586 values of its input arguments, except where stated otherwise. Each function shall execute
11587 as if it were a single operation without raising SIGFPE and without generating any of the
11588 floating-point exceptions ''invalid'', ''divide-by-zero'', or ''overflow'' except to reflect
11589 the result of the function.
11590 <p><!--para 2 -->
11591 For all functions, a domain error occurs if an input argument is outside the domain over
11592 which the mathematical function is defined. The description of each function lists any
11593 required domain errors; an implementation may define additional domain errors, provided
11594 that such errors are consistent with the mathematical definition of the function.<sup><a href="#note228"><b>228)</b></a></sup> On a
11595 domain error, the function returns an implementation-defined value; if the integer
11596 expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
11597 errno acquires the value EDOM; if the integer expression math_errhandling &amp;
11598 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
11599 <p><!--para 3 -->
11600 Similarly, a pole error (also known as a singularity or infinitary) occurs if the
11601 mathematical function has an exact infinite result as the finite input argument(s) are
11602 approached in the limit (for example, log(0.0)). The description of each function lists
11603 any required pole errors; an implementation may define additional pole errors, provided
11604 that such errors are consistent with the mathematical definition of the function. On a pole
11605 error, the function returns an implementation-defined value; if the integer expression
11608 <!--page 251 -->
11609 math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression errno
11610 acquires the value ERANGE; if the integer expression math_errhandling &amp;
11611 MATH_ERREXCEPT is nonzero, the ''divide-by-zero'' floating-point exception is raised.
11612 <p><!--para 4 -->
11613 Likewise, a range error occurs if the mathematical result of the function cannot be
11614 represented in an object of the specified type, due to extreme magnitude.
11615 <p><!--para 5 -->
11616 A floating result overflows if the magnitude of the mathematical result is finite but so
11617 large that the mathematical result cannot be represented without extraordinary roundoff
11618 error in an object of the specified type. If a floating result overflows and default rounding
11619 is in effect, then the function returns the value of the macro HUGE_VAL, HUGE_VALF, or *
11620 HUGE_VALL according to the return type, with the same sign as the correct value of the
11621 function; if the integer expression math_errhandling &amp; MATH_ERRNO is nonzero,
11622 the integer expression errno acquires the value ERANGE; if the integer expression
11623 math_errhandling &amp; MATH_ERREXCEPT is nonzero, the ''overflow'' floating-
11624 point exception is raised.
11625 <p><!--para 6 -->
11626 The result underflows if the magnitude of the mathematical result is so small that the
11627 mathematical result cannot be represented, without extraordinary roundoff error, in an
11628 object of the specified type.<sup><a href="#note229"><b>229)</b></a></sup> If the result underflows, the function returns an
11629 implementation-defined value whose magnitude is no greater than the smallest
11630 normalized positive number in the specified type; if the integer expression
11631 math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
11632 value ERANGE is implementation-defined; if the integer expression
11633 math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
11634 floating-point exception is raised is implementation-defined.
11635 <p><!--para 7 -->
11636 If a domain, pole, or range error occurs and the integer expression
11637 math_errhandling &amp; MATH_ERRNO is zero,<sup><a href="#note230"><b>230)</b></a></sup> then errno shall either be set to
11638 the value corresponding to the error or left unmodified. If no such error occurs, errno
11639 shall be left unmodified regardless of the setting of math_errhandling.
11644 <!--page 252 -->
11646 <h6>footnotes</h6>
11647 <p><small><a name="note228" href="#note228">228)</a> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
11648 error if the mathematical domain of the function does not include the infinity.
11649 </small>
11650 <p><small><a name="note229" href="#note229">229)</a> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
11651 also ''flush-to-zero'' underflow.
11652 </small>
11653 <p><small><a name="note230" href="#note230">230)</a> Math errors are being indicated by the floating-point exception flags rather than by errno.
11654 </small>
11656 <h4><a name="7.12.2" href="#7.12.2">7.12.2 The FP_CONTRACT pragma</a></h4>
11657 <h6>Synopsis</h6>
11658 <p><!--para 1 -->
11659 <pre>
11660 #include <a href="#7.12">&lt;math.h&gt;</a>
11661 #pragma STDC FP_CONTRACT on-off-switch</pre>
11662 <h6>Description</h6>
11663 <p><!--para 2 -->
11664 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
11665 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
11666 either outside external declarations or preceding all explicit declarations and statements
11667 inside a compound statement. When outside external declarations, the pragma takes
11668 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
11669 the end of the translation unit. When inside a compound statement, the pragma takes
11670 effect from its occurrence until another FP_CONTRACT pragma is encountered
11671 (including within a nested compound statement), or until the end of the compound
11672 statement; at the end of a compound statement the state for the pragma is restored to its
11673 condition just before the compound statement. If this pragma is used in any other
11674 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
11675 implementation-defined.
11677 <h4><a name="7.12.3" href="#7.12.3">7.12.3 Classification macros</a></h4>
11678 <p><!--para 1 -->
11679 In the synopses in this subclause, real-floating indicates that the argument shall be an
11680 expression of real floating type.
11682 <h5><a name="7.12.3.1" href="#7.12.3.1">7.12.3.1 The fpclassify macro</a></h5>
11683 <h6>Synopsis</h6>
11684 <p><!--para 1 -->
11685 <pre>
11686 #include <a href="#7.12">&lt;math.h&gt;</a>
11687 int fpclassify(real-floating x);</pre>
11688 <h6>Description</h6>
11689 <p><!--para 2 -->
11690 The fpclassify macro classifies its argument value as NaN, infinite, normal,
11691 subnormal, zero, or into another implementation-defined category. First, an argument
11692 represented in a format wider than its semantic type is converted to its semantic type.
11693 Then classification is based on the type of the argument.<sup><a href="#note231"><b>231)</b></a></sup>
11694 <h6>Returns</h6>
11695 <p><!--para 3 -->
11696 The fpclassify macro returns the value of the number classification macro
11697 appropriate to the value of its argument. *
11700 <!--page 253 -->
11702 <h6>footnotes</h6>
11703 <p><small><a name="note231" href="#note231">231)</a> Since an expression can be evaluated with more range and precision than its type has, it is important to
11704 know the type that classification is based on. For example, a normal long double value might
11705 become subnormal when converted to double, and zero when converted to float.
11706 </small>
11708 <h5><a name="7.12.3.2" href="#7.12.3.2">7.12.3.2 The isfinite macro</a></h5>
11709 <h6>Synopsis</h6>
11710 <p><!--para 1 -->
11711 <pre>
11712 #include <a href="#7.12">&lt;math.h&gt;</a>
11713 int isfinite(real-floating x);</pre>
11714 <h6>Description</h6>
11715 <p><!--para 2 -->
11716 The isfinite macro determines whether its argument has a finite value (zero,
11717 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
11718 format wider than its semantic type is converted to its semantic type. Then determination
11719 is based on the type of the argument.
11720 <h6>Returns</h6>
11721 <p><!--para 3 -->
11722 The isfinite macro returns a nonzero value if and only if its argument has a finite
11723 value.
11725 <h5><a name="7.12.3.3" href="#7.12.3.3">7.12.3.3 The isinf macro</a></h5>
11726 <h6>Synopsis</h6>
11727 <p><!--para 1 -->
11728 <pre>
11729 #include <a href="#7.12">&lt;math.h&gt;</a>
11730 int isinf(real-floating x);</pre>
11731 <h6>Description</h6>
11732 <p><!--para 2 -->
11733 The isinf macro determines whether its argument value is an infinity (positive or
11734 negative). First, an argument represented in a format wider than its semantic type is
11735 converted to its semantic type. Then determination is based on the type of the argument.
11736 <h6>Returns</h6>
11737 <p><!--para 3 -->
11738 The isinf macro returns a nonzero value if and only if its argument has an infinite
11739 value.
11741 <h5><a name="7.12.3.4" href="#7.12.3.4">7.12.3.4 The isnan macro</a></h5>
11742 <h6>Synopsis</h6>
11743 <p><!--para 1 -->
11744 <pre>
11745 #include <a href="#7.12">&lt;math.h&gt;</a>
11746 int isnan(real-floating x);</pre>
11747 <h6>Description</h6>
11748 <p><!--para 2 -->
11749 The isnan macro determines whether its argument value is a NaN. First, an argument
11750 represented in a format wider than its semantic type is converted to its semantic type.
11751 Then determination is based on the type of the argument.<sup><a href="#note232"><b>232)</b></a></sup>
11754 <!--page 254 -->
11755 <h6>Returns</h6>
11756 <p><!--para 3 -->
11757 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
11759 <h6>footnotes</h6>
11760 <p><small><a name="note232" href="#note232">232)</a> For the isnan macro, the type for determination does not matter unless the implementation supports
11761 NaNs in the evaluation type but not in the semantic type.
11762 </small>
11764 <h5><a name="7.12.3.5" href="#7.12.3.5">7.12.3.5 The isnormal macro</a></h5>
11765 <h6>Synopsis</h6>
11766 <p><!--para 1 -->
11767 <pre>
11768 #include <a href="#7.12">&lt;math.h&gt;</a>
11769 int isnormal(real-floating x);</pre>
11770 <h6>Description</h6>
11771 <p><!--para 2 -->
11772 The isnormal macro determines whether its argument value is normal (neither zero,
11773 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
11774 semantic type is converted to its semantic type. Then determination is based on the type
11775 of the argument.
11776 <h6>Returns</h6>
11777 <p><!--para 3 -->
11778 The isnormal macro returns a nonzero value if and only if its argument has a normal
11779 value.
11781 <h5><a name="7.12.3.6" href="#7.12.3.6">7.12.3.6 The signbit macro</a></h5>
11782 <h6>Synopsis</h6>
11783 <p><!--para 1 -->
11784 <pre>
11785 #include <a href="#7.12">&lt;math.h&gt;</a>
11786 int signbit(real-floating x);</pre>
11787 <h6>Description</h6>
11788 <p><!--para 2 -->
11789 The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note233"><b>233)</b></a></sup>
11790 <h6>Returns</h6>
11791 <p><!--para 3 -->
11792 The signbit macro returns a nonzero value if and only if the sign of its argument value
11793 is negative.
11798 <!--page 255 -->
11800 <h6>footnotes</h6>
11801 <p><small><a name="note233" href="#note233">233)</a> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
11802 unsigned, it is treated as positive.
11803 </small>
11805 <h4><a name="7.12.4" href="#7.12.4">7.12.4 Trigonometric functions</a></h4>
11807 <h5><a name="7.12.4.1" href="#7.12.4.1">7.12.4.1 The acos functions</a></h5>
11808 <h6>Synopsis</h6>
11809 <p><!--para 1 -->
11810 <pre>
11811 #include <a href="#7.12">&lt;math.h&gt;</a>
11812 double acos(double x);
11813 float acosf(float x);
11814 long double acosl(long double x);</pre>
11815 <h6>Description</h6>
11816 <p><!--para 2 -->
11817 The acos functions compute the principal value of the arc cosine of x. A domain error
11818 occurs for arguments not in the interval [-1, +1].
11819 <h6>Returns</h6>
11820 <p><!--para 3 -->
11821 The acos functions return arccos x in the interval [0, pi ] radians.
11823 <h5><a name="7.12.4.2" href="#7.12.4.2">7.12.4.2 The asin functions</a></h5>
11824 <h6>Synopsis</h6>
11825 <p><!--para 1 -->
11826 <pre>
11827 #include <a href="#7.12">&lt;math.h&gt;</a>
11828 double asin(double x);
11829 float asinf(float x);
11830 long double asinl(long double x);</pre>
11831 <h6>Description</h6>
11832 <p><!--para 2 -->
11833 The asin functions compute the principal value of the arc sine of x. A domain error
11834 occurs for arguments not in the interval [-1, +1].
11835 <h6>Returns</h6>
11836 <p><!--para 3 -->
11837 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
11839 <h5><a name="7.12.4.3" href="#7.12.4.3">7.12.4.3 The atan functions</a></h5>
11840 <h6>Synopsis</h6>
11841 <p><!--para 1 -->
11842 <pre>
11843 #include <a href="#7.12">&lt;math.h&gt;</a>
11844 double atan(double x);
11845 float atanf(float x);
11846 long double atanl(long double x);</pre>
11847 <h6>Description</h6>
11848 <p><!--para 2 -->
11849 The atan functions compute the principal value of the arc tangent of x.
11850 <!--page 256 -->
11851 <h6>Returns</h6>
11852 <p><!--para 3 -->
11853 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
11855 <h5><a name="7.12.4.4" href="#7.12.4.4">7.12.4.4 The atan2 functions</a></h5>
11856 <h6>Synopsis</h6>
11857 <p><!--para 1 -->
11858 <pre>
11859 #include <a href="#7.12">&lt;math.h&gt;</a>
11860 double atan2(double y, double x);
11861 float atan2f(float y, float x);
11862 long double atan2l(long double y, long double x);</pre>
11863 <h6>Description</h6>
11864 <p><!--para 2 -->
11865 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
11866 arguments to determine the quadrant of the return value. A domain error may occur if
11867 both arguments are zero.
11868 <h6>Returns</h6>
11869 <p><!--para 3 -->
11870 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
11872 <h5><a name="7.12.4.5" href="#7.12.4.5">7.12.4.5 The cos functions</a></h5>
11873 <h6>Synopsis</h6>
11874 <p><!--para 1 -->
11875 <pre>
11876 #include <a href="#7.12">&lt;math.h&gt;</a>
11877 double cos(double x);
11878 float cosf(float x);
11879 long double cosl(long double x);</pre>
11880 <h6>Description</h6>
11881 <p><!--para 2 -->
11882 The cos functions compute the cosine of x (measured in radians).
11883 <h6>Returns</h6>
11884 <p><!--para 3 -->
11885 The cos functions return cos x.
11887 <h5><a name="7.12.4.6" href="#7.12.4.6">7.12.4.6 The sin functions</a></h5>
11888 <h6>Synopsis</h6>
11889 <p><!--para 1 -->
11890 <pre>
11891 #include <a href="#7.12">&lt;math.h&gt;</a>
11892 double sin(double x);
11893 float sinf(float x);
11894 long double sinl(long double x);</pre>
11895 <h6>Description</h6>
11896 <p><!--para 2 -->
11897 The sin functions compute the sine of x (measured in radians).
11898 <!--page 257 -->
11899 <h6>Returns</h6>
11900 <p><!--para 3 -->
11901 The sin functions return sin x.
11903 <h5><a name="7.12.4.7" href="#7.12.4.7">7.12.4.7 The tan functions</a></h5>
11904 <h6>Synopsis</h6>
11905 <p><!--para 1 -->
11906 <pre>
11907 #include <a href="#7.12">&lt;math.h&gt;</a>
11908 double tan(double x);
11909 float tanf(float x);
11910 long double tanl(long double x);</pre>
11911 <h6>Description</h6>
11912 <p><!--para 2 -->
11913 The tan functions return the tangent of x (measured in radians).
11914 <h6>Returns</h6>
11915 <p><!--para 3 -->
11916 The tan functions return tan x.
11918 <h4><a name="7.12.5" href="#7.12.5">7.12.5 Hyperbolic functions</a></h4>
11920 <h5><a name="7.12.5.1" href="#7.12.5.1">7.12.5.1 The acosh functions</a></h5>
11921 <h6>Synopsis</h6>
11922 <p><!--para 1 -->
11923 <pre>
11924 #include <a href="#7.12">&lt;math.h&gt;</a>
11925 double acosh(double x);
11926 float acoshf(float x);
11927 long double acoshl(long double x);</pre>
11928 <h6>Description</h6>
11929 <p><!--para 2 -->
11930 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
11931 error occurs for arguments less than 1.
11932 <h6>Returns</h6>
11933 <p><!--para 3 -->
11934 The acosh functions return arcosh x in the interval [0, +(inf)].
11936 <h5><a name="7.12.5.2" href="#7.12.5.2">7.12.5.2 The asinh functions</a></h5>
11937 <h6>Synopsis</h6>
11938 <p><!--para 1 -->
11939 <pre>
11940 #include <a href="#7.12">&lt;math.h&gt;</a>
11941 double asinh(double x);
11942 float asinhf(float x);
11943 long double asinhl(long double x);</pre>
11944 <h6>Description</h6>
11945 <p><!--para 2 -->
11946 The asinh functions compute the arc hyperbolic sine of x.
11947 <!--page 258 -->
11948 <h6>Returns</h6>
11949 <p><!--para 3 -->
11950 The asinh functions return arsinh x.
11952 <h5><a name="7.12.5.3" href="#7.12.5.3">7.12.5.3 The atanh functions</a></h5>
11953 <h6>Synopsis</h6>
11954 <p><!--para 1 -->
11955 <pre>
11956 #include <a href="#7.12">&lt;math.h&gt;</a>
11957 double atanh(double x);
11958 float atanhf(float x);
11959 long double atanhl(long double x);</pre>
11960 <h6>Description</h6>
11961 <p><!--para 2 -->
11962 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
11963 for arguments not in the interval [-1, +1]. A pole error may occur if the argument equals
11964 -1 or +1.
11965 <h6>Returns</h6>
11966 <p><!--para 3 -->
11967 The atanh functions return artanh x.
11969 <h5><a name="7.12.5.4" href="#7.12.5.4">7.12.5.4 The cosh functions</a></h5>
11970 <h6>Synopsis</h6>
11971 <p><!--para 1 -->
11972 <pre>
11973 #include <a href="#7.12">&lt;math.h&gt;</a>
11974 double cosh(double x);
11975 float coshf(float x);
11976 long double coshl(long double x);</pre>
11977 <h6>Description</h6>
11978 <p><!--para 2 -->
11979 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
11980 magnitude of x is too large.
11981 <h6>Returns</h6>
11982 <p><!--para 3 -->
11983 The cosh functions return cosh x.
11985 <h5><a name="7.12.5.5" href="#7.12.5.5">7.12.5.5 The sinh 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 sinh(double x);
11991 float sinhf(float x);
11992 long double sinhl(long double x);</pre>
11993 <h6>Description</h6>
11994 <p><!--para 2 -->
11995 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
11996 magnitude of x is too large.
11997 <!--page 259 -->
11998 <h6>Returns</h6>
11999 <p><!--para 3 -->
12000 The sinh functions return sinh x.
12002 <h5><a name="7.12.5.6" href="#7.12.5.6">7.12.5.6 The tanh functions</a></h5>
12003 <h6>Synopsis</h6>
12004 <p><!--para 1 -->
12005 <pre>
12006 #include <a href="#7.12">&lt;math.h&gt;</a>
12007 double tanh(double x);
12008 float tanhf(float x);
12009 long double tanhl(long double x);</pre>
12010 <h6>Description</h6>
12011 <p><!--para 2 -->
12012 The tanh functions compute the hyperbolic tangent of x.
12013 <h6>Returns</h6>
12014 <p><!--para 3 -->
12015 The tanh functions return tanh x.
12017 <h4><a name="7.12.6" href="#7.12.6">7.12.6 Exponential and logarithmic functions</a></h4>
12019 <h5><a name="7.12.6.1" href="#7.12.6.1">7.12.6.1 The exp functions</a></h5>
12020 <h6>Synopsis</h6>
12021 <p><!--para 1 -->
12022 <pre>
12023 #include <a href="#7.12">&lt;math.h&gt;</a>
12024 double exp(double x);
12025 float expf(float x);
12026 long double expl(long double x);</pre>
12027 <h6>Description</h6>
12028 <p><!--para 2 -->
12029 The exp functions compute the base-e exponential of x. A range error occurs if the
12030 magnitude of x is too large.
12031 <h6>Returns</h6>
12032 <p><!--para 3 -->
12033 The exp functions return ex .
12035 <h5><a name="7.12.6.2" href="#7.12.6.2">7.12.6.2 The exp2 functions</a></h5>
12036 <h6>Synopsis</h6>
12037 <p><!--para 1 -->
12038 <pre>
12039 #include <a href="#7.12">&lt;math.h&gt;</a>
12040 double exp2(double x);
12041 float exp2f(float x);
12042 long double exp2l(long double x);</pre>
12043 <h6>Description</h6>
12044 <p><!--para 2 -->
12045 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
12046 magnitude of x is too large.
12047 <!--page 260 -->
12048 <h6>Returns</h6>
12049 <p><!--para 3 -->
12050 The exp2 functions return 2x .
12052 <h5><a name="7.12.6.3" href="#7.12.6.3">7.12.6.3 The expm1 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 expm1(double x);
12058 float expm1f(float x);
12059 long double expm1l(long double x);</pre>
12060 <h6>Description</h6>
12061 <p><!--para 2 -->
12062 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
12063 error occurs if x is too large.<sup><a href="#note234"><b>234)</b></a></sup>
12064 <h6>Returns</h6>
12065 <p><!--para 3 -->
12066 The expm1 functions return ex - 1.
12068 <h6>footnotes</h6>
12069 <p><small><a name="note234" href="#note234">234)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
12070 </small>
12072 <h5><a name="7.12.6.4" href="#7.12.6.4">7.12.6.4 The frexp functions</a></h5>
12073 <h6>Synopsis</h6>
12074 <p><!--para 1 -->
12075 <pre>
12076 #include <a href="#7.12">&lt;math.h&gt;</a>
12077 double frexp(double value, int *exp);
12078 float frexpf(float value, int *exp);
12079 long double frexpl(long double value, int *exp);</pre>
12080 <h6>Description</h6>
12081 <p><!--para 2 -->
12082 The frexp functions break a floating-point number into a normalized fraction and an
12083 integral power of 2. They store the integer in the int object pointed to by exp.
12084 <h6>Returns</h6>
12085 <p><!--para 3 -->
12086 If value is not a floating-point number or if the integral power of 2 is outside the range
12087 of int, the results are unspecified. Otherwise, the frexp functions return the value x,
12088 such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x x 2*exp .
12089 If value is zero, both parts of the result are zero.
12094 <!--page 261 -->
12096 <h5><a name="7.12.6.5" href="#7.12.6.5">7.12.6.5 The ilogb functions</a></h5>
12097 <h6>Synopsis</h6>
12098 <p><!--para 1 -->
12099 <pre>
12100 #include <a href="#7.12">&lt;math.h&gt;</a>
12101 int ilogb(double x);
12102 int ilogbf(float x);
12103 int ilogbl(long double x);</pre>
12104 <h6>Description</h6>
12105 <p><!--para 2 -->
12106 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
12107 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
12108 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
12109 the corresponding logb function and casting the returned value to type int. A domain
12110 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
12111 the range of the return type, the numeric result is unspecified.
12112 <h6>Returns</h6>
12113 <p><!--para 3 -->
12114 The ilogb functions return the exponent of x as a signed int value.
12115 <p><b> Forward references</b>: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
12117 <h5><a name="7.12.6.6" href="#7.12.6.6">7.12.6.6 The ldexp functions</a></h5>
12118 <h6>Synopsis</h6>
12119 <p><!--para 1 -->
12120 <pre>
12121 #include <a href="#7.12">&lt;math.h&gt;</a>
12122 double ldexp(double x, int exp);
12123 float ldexpf(float x, int exp);
12124 long double ldexpl(long double x, int exp);</pre>
12125 <h6>Description</h6>
12126 <p><!--para 2 -->
12127 The ldexp functions multiply a floating-point number by an integral power of 2. A
12128 range error may occur.
12129 <h6>Returns</h6>
12130 <p><!--para 3 -->
12131 The ldexp functions return x x 2exp .
12133 <h5><a name="7.12.6.7" href="#7.12.6.7">7.12.6.7 The log functions</a></h5>
12134 <h6>Synopsis</h6>
12135 <p><!--para 1 -->
12136 <!--page 262 -->
12137 <pre>
12138 #include <a href="#7.12">&lt;math.h&gt;</a>
12139 double log(double x);
12140 float logf(float x);
12141 long double logl(long double x);</pre>
12142 <h6>Description</h6>
12143 <p><!--para 2 -->
12144 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
12145 the argument is negative. A pole error may occur if the argument is zero.
12146 <h6>Returns</h6>
12147 <p><!--para 3 -->
12148 The log functions return loge x.
12150 <h5><a name="7.12.6.8" href="#7.12.6.8">7.12.6.8 The log10 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 log10(double x);
12156 float log10f(float x);
12157 long double log10l(long double x);</pre>
12158 <h6>Description</h6>
12159 <p><!--para 2 -->
12160 The log10 functions compute the base-10 (common) logarithm of x. A domain error
12161 occurs if the argument is negative. A pole error may occur if the argument is zero.
12162 <h6>Returns</h6>
12163 <p><!--para 3 -->
12164 The log10 functions return log10 x.
12166 <h5><a name="7.12.6.9" href="#7.12.6.9">7.12.6.9 The log1p functions</a></h5>
12167 <h6>Synopsis</h6>
12168 <p><!--para 1 -->
12169 <pre>
12170 #include <a href="#7.12">&lt;math.h&gt;</a>
12171 double log1p(double x);
12172 float log1pf(float x);
12173 long double log1pl(long double x);</pre>
12174 <h6>Description</h6>
12175 <p><!--para 2 -->
12176 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note235"><b>235)</b></a></sup>
12177 A domain error occurs if the argument is less than -1. A pole error may occur if the
12178 argument equals -1.
12179 <h6>Returns</h6>
12180 <p><!--para 3 -->
12181 The log1p functions return loge (1 + x).
12186 <!--page 263 -->
12188 <h6>footnotes</h6>
12189 <p><small><a name="note235" href="#note235">235)</a> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
12190 </small>
12192 <h5><a name="7.12.6.10" href="#7.12.6.10">7.12.6.10 The log2 functions</a></h5>
12193 <h6>Synopsis</h6>
12194 <p><!--para 1 -->
12195 <pre>
12196 #include <a href="#7.12">&lt;math.h&gt;</a>
12197 double log2(double x);
12198 float log2f(float x);
12199 long double log2l(long double x);</pre>
12200 <h6>Description</h6>
12201 <p><!--para 2 -->
12202 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
12203 argument is less than zero. A pole error may occur if the argument is zero.
12204 <h6>Returns</h6>
12205 <p><!--para 3 -->
12206 The log2 functions return log2 x.
12208 <h5><a name="7.12.6.11" href="#7.12.6.11">7.12.6.11 The logb functions</a></h5>
12209 <h6>Synopsis</h6>
12210 <p><!--para 1 -->
12211 <pre>
12212 #include <a href="#7.12">&lt;math.h&gt;</a>
12213 double logb(double x);
12214 float logbf(float x);
12215 long double logbl(long double x);</pre>
12216 <h6>Description</h6>
12217 <p><!--para 2 -->
12218 The logb functions extract the exponent of x, as a signed integer value in floating-point
12219 format. If x is subnormal it is treated as though it were normalized; thus, for positive
12220 finite x,
12221 <pre>
12222 1 &lt;= x x FLT_RADIX-logb(x) &lt; FLT_RADIX</pre>
12223 A domain error or pole error may occur if the argument is zero.
12224 <h6>Returns</h6>
12225 <p><!--para 3 -->
12226 The logb functions return the signed exponent of x.
12228 <h5><a name="7.12.6.12" href="#7.12.6.12">7.12.6.12 The modf functions</a></h5>
12229 <h6>Synopsis</h6>
12230 <p><!--para 1 -->
12231 <pre>
12232 #include <a href="#7.12">&lt;math.h&gt;</a>
12233 double modf(double value, double *iptr);
12234 float modff(float value, float *iptr);
12235 long double modfl(long double value, long double *iptr);</pre>
12236 <h6>Description</h6>
12237 <p><!--para 2 -->
12238 The modf functions break the argument value into integral and fractional parts, each of
12239 which has the same type and sign as the argument. They store the integral part (in
12240 <!--page 264 -->
12241 floating-point format) in the object pointed to by iptr.
12242 <h6>Returns</h6>
12243 <p><!--para 3 -->
12244 The modf functions return the signed fractional part of value.
12246 <h5><a name="7.12.6.13" href="#7.12.6.13">7.12.6.13 The scalbn and scalbln functions</a></h5>
12247 <h6>Synopsis</h6>
12248 <p><!--para 1 -->
12249 <pre>
12250 #include <a href="#7.12">&lt;math.h&gt;</a>
12251 double scalbn(double x, int n);
12252 float scalbnf(float x, int n);
12253 long double scalbnl(long double x, int n);
12254 double scalbln(double x, long int n);
12255 float scalblnf(float x, long int n);
12256 long double scalblnl(long double x, long int n);</pre>
12257 <h6>Description</h6>
12258 <p><!--para 2 -->
12259 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
12260 normally by computing FLT_RADIXn explicitly. A range error may occur.
12261 <h6>Returns</h6>
12262 <p><!--para 3 -->
12263 The scalbn and scalbln functions return x x FLT_RADIXn .
12265 <h4><a name="7.12.7" href="#7.12.7">7.12.7 Power and absolute-value functions</a></h4>
12267 <h5><a name="7.12.7.1" href="#7.12.7.1">7.12.7.1 The cbrt functions</a></h5>
12268 <h6>Synopsis</h6>
12269 <p><!--para 1 -->
12270 <pre>
12271 #include <a href="#7.12">&lt;math.h&gt;</a>
12272 double cbrt(double x);
12273 float cbrtf(float x);
12274 long double cbrtl(long double x);</pre>
12275 <h6>Description</h6>
12276 <p><!--para 2 -->
12277 The cbrt functions compute the real cube root of x.
12278 <h6>Returns</h6>
12279 <p><!--para 3 -->
12280 The cbrt functions return x1/3 .
12281 <!--page 265 -->
12283 <h5><a name="7.12.7.2" href="#7.12.7.2">7.12.7.2 The fabs functions</a></h5>
12284 <h6>Synopsis</h6>
12285 <p><!--para 1 -->
12286 <pre>
12287 #include <a href="#7.12">&lt;math.h&gt;</a>
12288 double fabs(double x);
12289 float fabsf(float x);
12290 long double fabsl(long double x);</pre>
12291 <h6>Description</h6>
12292 <p><!--para 2 -->
12293 The fabs functions compute the absolute value of a floating-point number x.
12294 <h6>Returns</h6>
12295 <p><!--para 3 -->
12296 The fabs functions return | x |.
12298 <h5><a name="7.12.7.3" href="#7.12.7.3">7.12.7.3 The hypot functions</a></h5>
12299 <h6>Synopsis</h6>
12300 <p><!--para 1 -->
12301 <pre>
12302 #include <a href="#7.12">&lt;math.h&gt;</a>
12303 double hypot(double x, double y);
12304 float hypotf(float x, float y);
12305 long double hypotl(long double x, long double y);</pre>
12306 <h6>Description</h6>
12307 <p><!--para 2 -->
12308 The hypot functions compute the square root of the sum of the squares of x and y,
12309 without undue overflow or underflow. A range error may occur.
12310 <p><!--para 3 -->
12311 <h6>Returns</h6>
12312 <p><!--para 4 -->
12313 The hypot functions return (sqrt)x2 + y2 .
12314 <pre>
12316 -----</pre>
12318 <h5><a name="7.12.7.4" href="#7.12.7.4">7.12.7.4 The pow functions</a></h5>
12319 <h6>Synopsis</h6>
12320 <p><!--para 1 -->
12321 <pre>
12322 #include <a href="#7.12">&lt;math.h&gt;</a>
12323 double pow(double x, double y);
12324 float powf(float x, float y);
12325 long double powl(long double x, long double y);</pre>
12326 <h6>Description</h6>
12327 <p><!--para 2 -->
12328 The pow functions compute x raised to the power y. A domain error occurs if x is finite
12329 and negative and y is finite and not an integer value. A range error may occur. A domain
12330 error may occur if x is zero and y is zero. A domain error or pole error may occur if x is
12331 zero and y is less than zero.
12332 <!--page 266 -->
12333 <h6>Returns</h6>
12334 <p><!--para 3 -->
12335 The pow functions return xy .
12337 <h5><a name="7.12.7.5" href="#7.12.7.5">7.12.7.5 The sqrt functions</a></h5>
12338 <h6>Synopsis</h6>
12339 <p><!--para 1 -->
12340 <pre>
12341 #include <a href="#7.12">&lt;math.h&gt;</a>
12342 double sqrt(double x);
12343 float sqrtf(float x);
12344 long double sqrtl(long double x);</pre>
12345 <h6>Description</h6>
12346 <p><!--para 2 -->
12347 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
12348 the argument is less than zero.
12349 <h6>Returns</h6>
12350 <p><!--para 3 -->
12351 The sqrt functions return (sqrt)x.
12352 <pre>
12354 -</pre>
12356 <h4><a name="7.12.8" href="#7.12.8">7.12.8 Error and gamma functions</a></h4>
12358 <h5><a name="7.12.8.1" href="#7.12.8.1">7.12.8.1 The erf functions</a></h5>
12359 <h6>Synopsis</h6>
12360 <p><!--para 1 -->
12361 <pre>
12362 #include <a href="#7.12">&lt;math.h&gt;</a>
12363 double erf(double x);
12364 float erff(float x);
12365 long double erfl(long double x);</pre>
12366 <h6>Description</h6>
12367 <p><!--para 2 -->
12368 The erf functions compute the error function of x.
12369 <h6>Returns</h6>
12370 <p><!--para 3 -->
12371 <pre>
12373 (integral) e-t dt.
12374 2</pre>
12375 The erf functions return erf x =
12376 <pre>
12377 (sqrt)pi
12379 - 0</pre>
12382 <h5><a name="7.12.8.2" href="#7.12.8.2">7.12.8.2 The erfc functions</a></h5>
12383 <h6>Synopsis</h6>
12384 <p><!--para 1 -->
12385 <pre>
12386 #include <a href="#7.12">&lt;math.h&gt;</a>
12387 double erfc(double x);
12388 float erfcf(float x);
12389 long double erfcl(long double x);</pre>
12390 <h6>Description</h6>
12391 <p><!--para 2 -->
12392 The erfc functions compute the complementary error function of x. A range error
12393 occurs if x is too large.
12394 <!--page 267 -->
12395 <h6>Returns</h6>
12396 <p><!--para 3 -->
12397 <pre>
12398 2 (inf)
12399 (integral) e-t dt.
12400 2</pre>
12401 The erfc functions return erfc x = 1 - erf x =
12402 <pre>
12403 (sqrt)pi
12405 - x</pre>
12408 <h5><a name="7.12.8.3" href="#7.12.8.3">7.12.8.3 The lgamma functions</a></h5>
12409 <h6>Synopsis</h6>
12410 <p><!--para 1 -->
12411 <pre>
12412 #include <a href="#7.12">&lt;math.h&gt;</a>
12413 double lgamma(double x);
12414 float lgammaf(float x);
12415 long double lgammal(long double x);</pre>
12416 <h6>Description</h6>
12417 <p><!--para 2 -->
12418 The lgamma functions compute the natural logarithm of the absolute value of gamma of
12419 x. A range error occurs if x is too large. A pole error may occur if x is a negative integer
12420 or zero.
12421 <h6>Returns</h6>
12422 <p><!--para 3 -->
12423 The lgamma functions return loge | (Gamma)(x) |.
12425 <h5><a name="7.12.8.4" href="#7.12.8.4">7.12.8.4 The tgamma functions</a></h5>
12426 <h6>Synopsis</h6>
12427 <p><!--para 1 -->
12428 <pre>
12429 #include <a href="#7.12">&lt;math.h&gt;</a>
12430 double tgamma(double x);
12431 float tgammaf(float x);
12432 long double tgammal(long double x);</pre>
12433 <h6>Description</h6>
12434 <p><!--para 2 -->
12435 The tgamma functions compute the gamma function of x. A domain error or pole error
12436 may occur if x is a negative integer or zero. A range error occurs if the magnitude of x is
12437 too large and may occur if the magnitude of x is too small.
12438 <h6>Returns</h6>
12439 <p><!--para 3 -->
12440 The tgamma functions return (Gamma)(x).
12441 <!--page 268 -->
12443 <h4><a name="7.12.9" href="#7.12.9">7.12.9 Nearest integer functions</a></h4>
12445 <h5><a name="7.12.9.1" href="#7.12.9.1">7.12.9.1 The ceil functions</a></h5>
12446 <h6>Synopsis</h6>
12447 <p><!--para 1 -->
12448 <pre>
12449 #include <a href="#7.12">&lt;math.h&gt;</a>
12450 double ceil(double x);
12451 float ceilf(float x);
12452 long double ceill(long double x);</pre>
12453 <h6>Description</h6>
12454 <p><!--para 2 -->
12455 The ceil functions compute the smallest integer value not less than x.
12456 <h6>Returns</h6>
12457 <p><!--para 3 -->
12458 The ceil functions return [^x^], expressed as a floating-point number.
12460 <h5><a name="7.12.9.2" href="#7.12.9.2">7.12.9.2 The floor functions</a></h5>
12461 <h6>Synopsis</h6>
12462 <p><!--para 1 -->
12463 <pre>
12464 #include <a href="#7.12">&lt;math.h&gt;</a>
12465 double floor(double x);
12466 float floorf(float x);
12467 long double floorl(long double x);</pre>
12468 <h6>Description</h6>
12469 <p><!--para 2 -->
12470 The floor functions compute the largest integer value not greater than x.
12471 <h6>Returns</h6>
12472 <p><!--para 3 -->
12473 The floor functions return [_x_], expressed as a floating-point number.
12475 <h5><a name="7.12.9.3" href="#7.12.9.3">7.12.9.3 The nearbyint functions</a></h5>
12476 <h6>Synopsis</h6>
12477 <p><!--para 1 -->
12478 <pre>
12479 #include <a href="#7.12">&lt;math.h&gt;</a>
12480 double nearbyint(double x);
12481 float nearbyintf(float x);
12482 long double nearbyintl(long double x);</pre>
12483 <h6>Description</h6>
12484 <p><!--para 2 -->
12485 The nearbyint functions round their argument to an integer value in floating-point
12486 format, using the current rounding direction and without raising the ''inexact'' floating-
12487 point exception.
12488 <!--page 269 -->
12489 <h6>Returns</h6>
12490 <p><!--para 3 -->
12491 The nearbyint functions return the rounded integer value.
12493 <h5><a name="7.12.9.4" href="#7.12.9.4">7.12.9.4 The rint functions</a></h5>
12494 <h6>Synopsis</h6>
12495 <p><!--para 1 -->
12496 <pre>
12497 #include <a href="#7.12">&lt;math.h&gt;</a>
12498 double rint(double x);
12499 float rintf(float x);
12500 long double rintl(long double x);</pre>
12501 <h6>Description</h6>
12502 <p><!--para 2 -->
12503 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
12504 rint functions may raise the ''inexact'' floating-point exception if the result differs in
12505 value from the argument.
12506 <h6>Returns</h6>
12507 <p><!--para 3 -->
12508 The rint functions return the rounded integer value.
12510 <h5><a name="7.12.9.5" href="#7.12.9.5">7.12.9.5 The lrint and llrint functions</a></h5>
12511 <h6>Synopsis</h6>
12512 <p><!--para 1 -->
12513 <pre>
12514 #include <a href="#7.12">&lt;math.h&gt;</a>
12515 long int lrint(double x);
12516 long int lrintf(float x);
12517 long int lrintl(long double x);
12518 long long int llrint(double x);
12519 long long int llrintf(float x);
12520 long long int llrintl(long double x);</pre>
12521 <h6>Description</h6>
12522 <p><!--para 2 -->
12523 The lrint and llrint functions round their argument to the nearest integer value,
12524 rounding according to the current rounding direction. If the rounded value is outside the
12525 range of the return type, the numeric result is unspecified and a domain error or range
12526 error may occur.
12527 <h6>Returns</h6>
12528 <p><!--para 3 -->
12529 The lrint and llrint functions return the rounded integer value.
12530 <!--page 270 -->
12532 <h5><a name="7.12.9.6" href="#7.12.9.6">7.12.9.6 The round functions</a></h5>
12533 <h6>Synopsis</h6>
12534 <p><!--para 1 -->
12535 <pre>
12536 #include <a href="#7.12">&lt;math.h&gt;</a>
12537 double round(double x);
12538 float roundf(float x);
12539 long double roundl(long double x);</pre>
12540 <h6>Description</h6>
12541 <p><!--para 2 -->
12542 The round functions round their argument to the nearest integer value in floating-point
12543 format, rounding halfway cases away from zero, regardless of the current rounding
12544 direction.
12545 <h6>Returns</h6>
12546 <p><!--para 3 -->
12547 The round functions return the rounded integer value.
12549 <h5><a name="7.12.9.7" href="#7.12.9.7">7.12.9.7 The lround and llround functions</a></h5>
12550 <h6>Synopsis</h6>
12551 <p><!--para 1 -->
12552 <pre>
12553 #include <a href="#7.12">&lt;math.h&gt;</a>
12554 long int lround(double x);
12555 long int lroundf(float x);
12556 long int lroundl(long double x);
12557 long long int llround(double x);
12558 long long int llroundf(float x);
12559 long long int llroundl(long double x);</pre>
12560 <h6>Description</h6>
12561 <p><!--para 2 -->
12562 The lround and llround functions round their argument to the nearest integer value,
12563 rounding halfway cases away from zero, regardless of the current rounding direction. If
12564 the rounded value is outside the range of the return type, the numeric result is unspecified
12565 and a domain error or range error may occur.
12566 <h6>Returns</h6>
12567 <p><!--para 3 -->
12568 The lround and llround functions return the rounded integer value.
12570 <h5><a name="7.12.9.8" href="#7.12.9.8">7.12.9.8 The trunc functions</a></h5>
12571 <h6>Synopsis</h6>
12572 <p><!--para 1 -->
12573 <!--page 271 -->
12574 <pre>
12575 #include <a href="#7.12">&lt;math.h&gt;</a>
12576 double trunc(double x);
12577 float truncf(float x);
12578 long double truncl(long double x);</pre>
12579 <h6>Description</h6>
12580 <p><!--para 2 -->
12581 The trunc functions round their argument to the integer value, in floating format,
12582 nearest to but no larger in magnitude than the argument.
12583 <h6>Returns</h6>
12584 <p><!--para 3 -->
12585 The trunc functions return the truncated integer value.
12587 <h4><a name="7.12.10" href="#7.12.10">7.12.10 Remainder functions</a></h4>
12589 <h5><a name="7.12.10.1" href="#7.12.10.1">7.12.10.1 The fmod functions</a></h5>
12590 <h6>Synopsis</h6>
12591 <p><!--para 1 -->
12592 <pre>
12593 #include <a href="#7.12">&lt;math.h&gt;</a>
12594 double fmod(double x, double y);
12595 float fmodf(float x, float y);
12596 long double fmodl(long double x, long double y);</pre>
12597 <h6>Description</h6>
12598 <p><!--para 2 -->
12599 The fmod functions compute the floating-point remainder of x/y.
12600 <h6>Returns</h6>
12601 <p><!--para 3 -->
12602 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
12603 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
12604 whether a domain error occurs or the fmod functions return zero is implementation-
12605 defined.
12607 <h5><a name="7.12.10.2" href="#7.12.10.2">7.12.10.2 The remainder functions</a></h5>
12608 <h6>Synopsis</h6>
12609 <p><!--para 1 -->
12610 <pre>
12611 #include <a href="#7.12">&lt;math.h&gt;</a>
12612 double remainder(double x, double y);
12613 float remainderf(float x, float y);
12614 long double remainderl(long double x, long double y);</pre>
12615 <h6>Description</h6>
12616 <p><!--para 2 -->
12617 The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note236"><b>236)</b></a></sup>
12622 <!--page 272 -->
12623 <h6>Returns</h6>
12624 <p><!--para 3 -->
12625 The remainder functions return x REM y. If y is zero, whether a domain error occurs
12626 or the functions return zero is implementation defined.
12628 <h6>footnotes</h6>
12629 <p><small><a name="note236" href="#note236">236)</a> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
12630 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
12631 | n - x/y | = 1/2, then n is even. If r = 0, its sign shall be that of x.'' This definition is applicable for *
12632 all implementations.
12633 </small>
12635 <h5><a name="7.12.10.3" href="#7.12.10.3">7.12.10.3 The remquo functions</a></h5>
12636 <h6>Synopsis</h6>
12637 <p><!--para 1 -->
12638 <pre>
12639 #include <a href="#7.12">&lt;math.h&gt;</a>
12640 double remquo(double x, double y, int *quo);
12641 float remquof(float x, float y, int *quo);
12642 long double remquol(long double x, long double y,
12643 int *quo);</pre>
12644 <h6>Description</h6>
12645 <p><!--para 2 -->
12646 The remquo functions compute the same remainder as the remainder functions. In
12647 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
12648 magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
12649 n is an implementation-defined integer greater than or equal to 3.
12650 <h6>Returns</h6>
12651 <p><!--para 3 -->
12652 The remquo functions return x REM y. If y is zero, the value stored in the object
12653 pointed to by quo is unspecified and whether a domain error occurs or the functions
12654 return zero is implementation defined.
12656 <h4><a name="7.12.11" href="#7.12.11">7.12.11 Manipulation functions</a></h4>
12658 <h5><a name="7.12.11.1" href="#7.12.11.1">7.12.11.1 The copysign functions</a></h5>
12659 <h6>Synopsis</h6>
12660 <p><!--para 1 -->
12661 <pre>
12662 #include <a href="#7.12">&lt;math.h&gt;</a>
12663 double copysign(double x, double y);
12664 float copysignf(float x, float y);
12665 long double copysignl(long double x, long double y);</pre>
12666 <h6>Description</h6>
12667 <p><!--para 2 -->
12668 The copysign functions produce a value with the magnitude of x and the sign of y.
12669 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
12670 represent a signed zero but do not treat negative zero consistently in arithmetic
12671 operations, the copysign functions regard the sign of zero as positive.
12672 <h6>Returns</h6>
12673 <p><!--para 3 -->
12674 The copysign functions return a value with the magnitude of x and the sign of y.
12675 <!--page 273 -->
12677 <h5><a name="7.12.11.2" href="#7.12.11.2">7.12.11.2 The nan functions</a></h5>
12678 <h6>Synopsis</h6>
12679 <p><!--para 1 -->
12680 <pre>
12681 #include <a href="#7.12">&lt;math.h&gt;</a>
12682 double nan(const char *tagp);
12683 float nanf(const char *tagp);
12684 long double nanl(const char *tagp);</pre>
12685 <h6>Description</h6>
12686 <p><!--para 2 -->
12687 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
12688 sequence)", (char**) NULL); the call nan("") is equivalent to
12689 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
12690 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
12691 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
12692 and strtold.
12693 <h6>Returns</h6>
12694 <p><!--para 3 -->
12695 The nan functions return a quiet NaN, if available, with content indicated through tagp.
12696 If the implementation does not support quiet NaNs, the functions return zero.
12697 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>).
12699 <h5><a name="7.12.11.3" href="#7.12.11.3">7.12.11.3 The nextafter functions</a></h5>
12700 <h6>Synopsis</h6>
12701 <p><!--para 1 -->
12702 <pre>
12703 #include <a href="#7.12">&lt;math.h&gt;</a>
12704 double nextafter(double x, double y);
12705 float nextafterf(float x, float y);
12706 long double nextafterl(long double x, long double y);</pre>
12707 <h6>Description</h6>
12708 <p><!--para 2 -->
12709 The nextafter functions determine the next representable value, in the type of the
12710 function, after x in the direction of y, where x and y are first converted to the type of the
12711 function.<sup><a href="#note237"><b>237)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
12712 if the magnitude of x is the largest finite value representable in the type and the result is
12713 infinite or not representable in the type.
12714 <h6>Returns</h6>
12715 <p><!--para 3 -->
12716 The nextafter functions return the next representable value in the specified format
12717 after x in the direction of y.
12720 <!--page 274 -->
12722 <h6>footnotes</h6>
12723 <p><small><a name="note237" href="#note237">237)</a> The argument values are converted to the type of the function, even by a macro implementation of the
12724 function.
12725 </small>
12727 <h5><a name="7.12.11.4" href="#7.12.11.4">7.12.11.4 The nexttoward functions</a></h5>
12728 <h6>Synopsis</h6>
12729 <p><!--para 1 -->
12730 <pre>
12731 #include <a href="#7.12">&lt;math.h&gt;</a>
12732 double nexttoward(double x, long double y);
12733 float nexttowardf(float x, long double y);
12734 long double nexttowardl(long double x, long double y);</pre>
12735 <h6>Description</h6>
12736 <p><!--para 2 -->
12737 The nexttoward functions are equivalent to the nextafter functions except that the
12738 second parameter has type long double and the functions return y converted to the
12739 type of the function if x equals y.<sup><a href="#note238"><b>238)</b></a></sup>
12741 <h6>footnotes</h6>
12742 <p><small><a name="note238" href="#note238">238)</a> The result of the nexttoward functions is determined in the type of the function, without loss of
12743 range or precision in a floating second argument.
12744 </small>
12746 <h4><a name="7.12.12" href="#7.12.12">7.12.12 Maximum, minimum, and positive difference functions</a></h4>
12748 <h5><a name="7.12.12.1" href="#7.12.12.1">7.12.12.1 The fdim functions</a></h5>
12749 <h6>Synopsis</h6>
12750 <p><!--para 1 -->
12751 <pre>
12752 #include <a href="#7.12">&lt;math.h&gt;</a>
12753 double fdim(double x, double y);
12754 float fdimf(float x, float y);
12755 long double fdiml(long double x, long double y);</pre>
12756 <h6>Description</h6>
12757 <p><!--para 2 -->
12758 The fdim functions determine the positive difference between their arguments:
12759 <pre>
12760 {x - y if x &gt; y
12762 {+0 if x &lt;= y</pre>
12763 A range error may occur.
12764 <h6>Returns</h6>
12765 <p><!--para 3 -->
12766 The fdim functions return the positive difference value.
12768 <h5><a name="7.12.12.2" href="#7.12.12.2">7.12.12.2 The fmax functions</a></h5>
12769 <h6>Synopsis</h6>
12770 <p><!--para 1 -->
12771 <pre>
12772 #include <a href="#7.12">&lt;math.h&gt;</a>
12773 double fmax(double x, double y);
12774 float fmaxf(float x, float y);
12775 long double fmaxl(long double x, long double y);</pre>
12779 <!--page 275 -->
12780 <h6>Description</h6>
12781 <p><!--para 2 -->
12782 The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note239"><b>239)</b></a></sup>
12783 <h6>Returns</h6>
12784 <p><!--para 3 -->
12785 The fmax functions return the maximum numeric value of their arguments.
12787 <h6>footnotes</h6>
12788 <p><small><a name="note239" href="#note239">239)</a> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
12789 fmax functions choose the numeric value. See <a href="#F.10.9.2">F.10.9.2</a>.
12790 </small>
12792 <h5><a name="7.12.12.3" href="#7.12.12.3">7.12.12.3 The fmin functions</a></h5>
12793 <h6>Synopsis</h6>
12794 <p><!--para 1 -->
12795 <pre>
12796 #include <a href="#7.12">&lt;math.h&gt;</a>
12797 double fmin(double x, double y);
12798 float fminf(float x, float y);
12799 long double fminl(long double x, long double y);</pre>
12800 <h6>Description</h6>
12801 <p><!--para 2 -->
12802 The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note240"><b>240)</b></a></sup>
12803 <h6>Returns</h6>
12804 <p><!--para 3 -->
12805 The fmin functions return the minimum numeric value of their arguments.
12807 <h6>footnotes</h6>
12808 <p><small><a name="note240" href="#note240">240)</a> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
12809 </small>
12811 <h4><a name="7.12.13" href="#7.12.13">7.12.13 Floating multiply-add</a></h4>
12813 <h5><a name="7.12.13.1" href="#7.12.13.1">7.12.13.1 The fma functions</a></h5>
12814 <h6>Synopsis</h6>
12815 <p><!--para 1 -->
12816 <pre>
12817 #include <a href="#7.12">&lt;math.h&gt;</a>
12818 double fma(double x, double y, double z);
12819 float fmaf(float x, float y, float z);
12820 long double fmal(long double x, long double y,
12821 long double z);</pre>
12822 <h6>Description</h6>
12823 <p><!--para 2 -->
12824 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
12825 the value (as if) to infinite precision and round once to the result format, according to the
12826 current rounding mode. A range error may occur.
12827 <h6>Returns</h6>
12828 <p><!--para 3 -->
12829 The fma functions return (x x y) + z, rounded as one ternary operation.
12834 <!--page 276 -->
12836 <h4><a name="7.12.14" href="#7.12.14">7.12.14 Comparison macros</a></h4>
12837 <p><!--para 1 -->
12838 The relational and equality operators support the usual mathematical relationships
12839 between numeric values. For any ordered pair of numeric values exactly one of the
12840 relationships -- less, greater, and equal -- is true. Relational operators may raise the
12841 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
12842 numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note241"><b>241)</b></a></sup> The following
12843 subclauses provide macros that are quiet (non floating-point exception raising) versions
12844 of the relational operators, and other comparison macros that facilitate writing efficient
12845 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
12846 the synopses in this subclause, real-floating indicates that the argument shall be an
12847 expression of real floating type<sup><a href="#note242"><b>242)</b></a></sup> (both arguments need not have the same type).<sup><a href="#note243"><b>243)</b></a></sup>
12849 <h6>footnotes</h6>
12850 <p><small><a name="note241" href="#note241">241)</a> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
12851 the operands compare unordered, as an error indicator for programs written without consideration of
12852 NaNs; the result in these cases is false.
12853 </small>
12854 <p><small><a name="note242" href="#note242">242)</a> If any argument is of integer type, or any other type that is not a real floating type, the behavior is
12855 undefined.
12856 </small>
12857 <p><small><a name="note243" href="#note243">243)</a> Whether an argument represented in a format wider than its semantic type is converted to the semantic
12858 type is unspecified.
12859 </small>
12861 <h5><a name="7.12.14.1" href="#7.12.14.1">7.12.14.1 The isgreater macro</a></h5>
12862 <h6>Synopsis</h6>
12863 <p><!--para 1 -->
12864 <pre>
12865 #include <a href="#7.12">&lt;math.h&gt;</a>
12866 int isgreater(real-floating x, real-floating y);</pre>
12867 <h6>Description</h6>
12868 <p><!--para 2 -->
12869 The isgreater macro determines whether its first argument is greater than its second
12870 argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
12871 unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
12872 exception when x and y are unordered.
12873 <h6>Returns</h6>
12874 <p><!--para 3 -->
12875 The isgreater macro returns the value of (x) &gt; (y).
12877 <h5><a name="7.12.14.2" href="#7.12.14.2">7.12.14.2 The isgreaterequal macro</a></h5>
12878 <h6>Synopsis</h6>
12879 <p><!--para 1 -->
12880 <pre>
12881 #include <a href="#7.12">&lt;math.h&gt;</a>
12882 int isgreaterequal(real-floating x, real-floating y);</pre>
12887 <!--page 277 -->
12888 <h6>Description</h6>
12889 <p><!--para 2 -->
12890 The isgreaterequal macro determines whether its first argument is greater than or
12891 equal to its second argument. The value of isgreaterequal(x, y) is always equal
12892 to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
12893 not raise the ''invalid'' floating-point exception when x and y are unordered.
12894 <h6>Returns</h6>
12895 <p><!--para 3 -->
12896 The isgreaterequal macro returns the value of (x) &gt;= (y).
12898 <h5><a name="7.12.14.3" href="#7.12.14.3">7.12.14.3 The isless macro</a></h5>
12899 <h6>Synopsis</h6>
12900 <p><!--para 1 -->
12901 <pre>
12902 #include <a href="#7.12">&lt;math.h&gt;</a>
12903 int isless(real-floating x, real-floating y);</pre>
12904 <h6>Description</h6>
12905 <p><!--para 2 -->
12906 The isless macro determines whether its first argument is less than its second
12907 argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
12908 unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
12909 exception when x and y are unordered.
12910 <h6>Returns</h6>
12911 <p><!--para 3 -->
12912 The isless macro returns the value of (x) &lt; (y).
12914 <h5><a name="7.12.14.4" href="#7.12.14.4">7.12.14.4 The islessequal macro</a></h5>
12915 <h6>Synopsis</h6>
12916 <p><!--para 1 -->
12917 <pre>
12918 #include <a href="#7.12">&lt;math.h&gt;</a>
12919 int islessequal(real-floating x, real-floating y);</pre>
12920 <h6>Description</h6>
12921 <p><!--para 2 -->
12922 The islessequal macro determines whether its first argument is less than or equal to
12923 its second argument. The value of islessequal(x, y) is always equal to
12924 (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
12925 the ''invalid'' floating-point exception when x and y are unordered.
12926 <h6>Returns</h6>
12927 <p><!--para 3 -->
12928 The islessequal macro returns the value of (x) &lt;= (y).
12929 <!--page 278 -->
12931 <h5><a name="7.12.14.5" href="#7.12.14.5">7.12.14.5 The islessgreater macro</a></h5>
12932 <h6>Synopsis</h6>
12933 <p><!--para 1 -->
12934 <pre>
12935 #include <a href="#7.12">&lt;math.h&gt;</a>
12936 int islessgreater(real-floating x, real-floating y);</pre>
12937 <h6>Description</h6>
12938 <p><!--para 2 -->
12939 The islessgreater macro determines whether its first argument is less than or
12940 greater than its second argument. The islessgreater(x, y) macro is similar to
12941 (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
12942 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
12943 and y twice).
12944 <h6>Returns</h6>
12945 <p><!--para 3 -->
12946 The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
12948 <h5><a name="7.12.14.6" href="#7.12.14.6">7.12.14.6 The isunordered macro</a></h5>
12949 <h6>Synopsis</h6>
12950 <p><!--para 1 -->
12951 <pre>
12952 #include <a href="#7.12">&lt;math.h&gt;</a>
12953 int isunordered(real-floating x, real-floating y);</pre>
12954 <h6>Description</h6>
12955 <p><!--para 2 -->
12956 The isunordered macro determines whether its arguments are unordered.
12957 <h6>Returns</h6>
12958 <p><!--para 3 -->
12959 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
12960 <!--page 279 -->
12962 <h3><a name="7.13" href="#7.13">7.13 Nonlocal jumps <setjmp.h></a></h3>
12963 <p><!--para 1 -->
12964 The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
12965 one type, for bypassing the normal function call and return discipline.<sup><a href="#note244"><b>244)</b></a></sup>
12966 <p><!--para 2 -->
12967 The type declared is
12968 <pre>
12969 jmp_buf</pre>
12970 which is an array type suitable for holding the information needed to restore a calling
12971 environment. The environment of a call to the setjmp macro consists of information
12972 sufficient for a call to the longjmp function to return execution to the correct block and
12973 invocation of that block, were it called recursively. It does not include the state of the
12974 floating-point status flags, of open files, or of any other component of the abstract
12975 machine.
12976 <p><!--para 3 -->
12977 It is unspecified whether setjmp is a macro or an identifier declared with external
12978 linkage. If a macro definition is suppressed in order to access an actual function, or a
12979 program defines an external identifier with the name setjmp, the behavior is undefined.
12981 <h6>footnotes</h6>
12982 <p><small><a name="note244" href="#note244">244)</a> These functions are useful for dealing with unusual conditions encountered in a low-level function of
12983 a program.
12984 </small>
12986 <h4><a name="7.13.1" href="#7.13.1">7.13.1 Save calling environment</a></h4>
12988 <h5><a name="7.13.1.1" href="#7.13.1.1">7.13.1.1 The setjmp macro</a></h5>
12989 <h6>Synopsis</h6>
12990 <p><!--para 1 -->
12991 <pre>
12992 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12993 int setjmp(jmp_buf env);</pre>
12994 <h6>Description</h6>
12995 <p><!--para 2 -->
12996 The setjmp macro saves its calling environment in its jmp_buf argument for later use
12997 by the longjmp function.
12998 <h6>Returns</h6>
12999 <p><!--para 3 -->
13000 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
13001 return is from a call to the longjmp function, the setjmp macro returns a nonzero
13002 value.
13003 <h6>Environmental limits</h6>
13004 <p><!--para 4 -->
13005 An invocation of the setjmp macro shall appear only in one of the following contexts:
13006 <ul>
13007 <li> the entire controlling expression of a selection or iteration statement;
13008 <li> one operand of a relational or equality operator with the other operand an integer
13009 constant expression, with the resulting expression being the entire controlling
13012 <!--page 280 -->
13013 expression of a selection or iteration statement;
13014 <li> the operand of a unary ! operator with the resulting expression being the entire
13015 controlling expression of a selection or iteration statement; or
13016 <li> the entire expression of an expression statement (possibly cast to void).
13017 </ul>
13018 <p><!--para 5 -->
13019 If the invocation appears in any other context, the behavior is undefined.
13021 <h4><a name="7.13.2" href="#7.13.2">7.13.2 Restore calling environment</a></h4>
13023 <h5><a name="7.13.2.1" href="#7.13.2.1">7.13.2.1 The longjmp function</a></h5>
13024 <h6>Synopsis</h6>
13025 <p><!--para 1 -->
13026 <pre>
13027 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
13028 _Noreturn void longjmp(jmp_buf env, int val);</pre>
13029 <h6>Description</h6>
13030 <p><!--para 2 -->
13031 The longjmp function restores the environment saved by the most recent invocation of
13032 the setjmp macro in the same invocation of the program with the corresponding
13033 jmp_buf argument. If there has been no such invocation, or if the function containing
13034 the invocation of the setjmp macro has terminated execution<sup><a href="#note245"><b>245)</b></a></sup> in the interim, or if the
13035 invocation of the setjmp macro was within the scope of an identifier with variably
13036 modified type and execution has left that scope in the interim, the behavior is undefined.
13037 <p><!--para 3 -->
13038 All accessible objects have values, and all other components of the abstract machine<sup><a href="#note246"><b>246)</b></a></sup>
13039 have state, as of the time the longjmp function was called, except that the values of
13040 objects of automatic storage duration that are local to the function containing the
13041 invocation of the corresponding setjmp macro that do not have volatile-qualified type
13042 and have been changed between the setjmp invocation and longjmp call are
13043 indeterminate.
13044 <h6>Returns</h6>
13045 <p><!--para 4 -->
13046 After longjmp is completed, program execution continues as if the corresponding
13047 invocation of the setjmp macro had just returned the value specified by val. The
13048 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
13049 the setjmp macro returns the value 1.
13050 <p><!--para 5 -->
13051 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
13052 might cause memory associated with a variable length array object to be squandered.
13057 <!--page 281 -->
13058 <!--page 282 -->
13059 <pre>
13060 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
13061 jmp_buf buf;
13062 void g(int n);
13063 void h(int n);
13064 int n = 6;
13065 void f(void)
13067 int x[n]; // valid: f is not terminated
13068 setjmp(buf);
13069 g(n);
13071 void g(int n)
13073 int a[n]; // a may remain allocated
13074 h(n);
13076 void h(int n)
13078 int b[n]; // b may remain allocated
13079 longjmp(buf, 2); // might cause memory loss
13080 }</pre>
13082 <h6>footnotes</h6>
13083 <p><small><a name="note245" href="#note245">245)</a> For example, by executing a return statement or because another longjmp call has caused a
13084 transfer to a setjmp invocation in a function earlier in the set of nested calls.
13085 </small>
13086 <p><small><a name="note246" href="#note246">246)</a> This includes, but is not limited to, the floating-point status flags and the state of open files.
13087 </small>
13089 <h3><a name="7.14" href="#7.14">7.14 Signal handling <signal.h></a></h3>
13090 <p><!--para 1 -->
13091 The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
13092 for handling various signals (conditions that may be reported during program execution).
13093 <p><!--para 2 -->
13094 The type defined is
13095 <pre>
13096 sig_atomic_t</pre>
13097 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
13098 an atomic entity, even in the presence of asynchronous interrupts.
13099 <p><!--para 3 -->
13100 The macros defined are
13101 <pre>
13102 SIG_DFL
13103 SIG_ERR
13104 SIG_IGN</pre>
13105 which expand to constant expressions with distinct values that have type compatible with
13106 the second argument to, and the return value of, the signal function, and whose values
13107 compare unequal to the address of any declarable function; and the following, which
13108 expand to positive integer constant expressions with type int and distinct values that are
13109 the signal numbers, each corresponding to the specified condition:
13110 <p><!--para 4 -->
13111 <pre>
13112 SIGABRT abnormal termination, such as is initiated by the abort function
13113 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
13114 resulting in overflow
13115 SIGILL detection of an invalid function image, such as an invalid instruction
13116 SIGINT receipt of an interactive attention signal
13117 SIGSEGV an invalid access to storage
13118 SIGTERM a termination request sent to the program</pre>
13119 An implementation need not generate any of these signals, except as a result of explicit
13120 calls to the raise function. Additional signals and pointers to undeclarable functions,
13121 with macro definitions beginning, respectively, with the letters SIG and an uppercase
13122 letter or with SIG_ and an uppercase letter,<sup><a href="#note247"><b>247)</b></a></sup> may also be specified by the
13123 implementation. The complete set of signals, their semantics, and their default handling
13124 is implementation-defined; all signal numbers shall be positive.
13129 <!--page 283 -->
13131 <h6>footnotes</h6>
13132 <p><small><a name="note247" href="#note247">247)</a> See ''future library directions'' (<a href="#7.30.6">7.30.6</a>). The names of the signal numbers reflect the following terms
13133 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
13134 and termination.
13135 </small>
13137 <h4><a name="7.14.1" href="#7.14.1">7.14.1 Specify signal handling</a></h4>
13139 <h5><a name="7.14.1.1" href="#7.14.1.1">7.14.1.1 The signal function</a></h5>
13140 <h6>Synopsis</h6>
13141 <p><!--para 1 -->
13142 <pre>
13143 #include <a href="#7.14">&lt;signal.h&gt;</a>
13144 void (*signal(int sig, void (*func)(int)))(int);</pre>
13145 <h6>Description</h6>
13146 <p><!--para 2 -->
13147 The signal function chooses one of three ways in which receipt of the signal number
13148 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
13149 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
13150 Otherwise, func shall point to a function to be called when that signal occurs. An
13151 invocation of such a function because of a signal, or (recursively) of any further functions
13152 called by that invocation (other than functions in the standard library),<sup><a href="#note248"><b>248)</b></a></sup> is called a
13153 signal handler.
13154 <p><!--para 3 -->
13155 When a signal occurs and func points to a function, it is implementation-defined
13156 whether the equivalent of signal(sig, SIG_DFL); is executed or the
13157 implementation prevents some implementation-defined set of signals (at least including
13158 sig) from occurring until the current signal handling has completed; in the case of
13159 SIGILL, the implementation may alternatively define that no action is taken. Then the
13160 equivalent of (*func)(sig); is executed. If and when the function returns, if the
13161 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
13162 value corresponding to a computational exception, the behavior is undefined; otherwise
13163 the program will resume execution at the point it was interrupted.
13164 <p><!--para 4 -->
13165 If the signal occurs as the result of calling the abort or raise function, the signal
13166 handler shall not call the raise function.
13167 <p><!--para 5 -->
13168 If the signal occurs other than as the result of calling the abort or raise function, the
13169 behavior is undefined if the signal handler refers to any object with static or thread
13170 storage duration that is not a lock-free atomic object other than by assigning a value to an
13171 object declared as volatile sig_atomic_t, or the signal handler calls any function
13172 in the standard library other than the abort function, the _Exit function, the
13173 quick_exit function, or the signal function with the first argument equal to the
13174 signal number corresponding to the signal that caused the invocation of the handler.
13175 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
13176 value of errno is indeterminate.<sup><a href="#note249"><b>249)</b></a></sup>
13179 <!--page 284 -->
13180 <p><!--para 6 -->
13181 At program startup, the equivalent of
13182 <pre>
13183 signal(sig, SIG_IGN);</pre>
13184 may be executed for some signals selected in an implementation-defined manner; the
13185 equivalent of
13186 <pre>
13187 signal(sig, SIG_DFL);</pre>
13188 is executed for all other signals defined by the implementation.
13189 <p><!--para 7 -->
13190 The implementation shall behave as if no library function calls the signal function.
13191 <h6>Returns</h6>
13192 <p><!--para 8 -->
13193 If the request can be honored, the signal function returns the value of func for the
13194 most recent successful call to signal for the specified signal sig. Otherwise, a value of
13195 SIG_ERR is returned and a positive value is stored in errno.
13196 <p><b> Forward references</b>: the abort function (<a href="#7.22.4.1">7.22.4.1</a>), the exit function (<a href="#7.22.4.4">7.22.4.4</a>), the
13197 _Exit function (<a href="#7.22.4.5">7.22.4.5</a>), the quick_exit function (<a href="#7.22.4.7">7.22.4.7</a>).
13199 <h6>footnotes</h6>
13200 <p><small><a name="note248" href="#note248">248)</a> This includes functions called indirectly via standard library functions (e.g., a SIGABRT handler
13201 called via the abort function).
13202 </small>
13203 <p><small><a name="note249" href="#note249">249)</a> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
13204 </small>
13206 <h4><a name="7.14.2" href="#7.14.2">7.14.2 Send signal</a></h4>
13208 <h5><a name="7.14.2.1" href="#7.14.2.1">7.14.2.1 The raise function</a></h5>
13209 <h6>Synopsis</h6>
13210 <p><!--para 1 -->
13211 <pre>
13212 #include <a href="#7.14">&lt;signal.h&gt;</a>
13213 int raise(int sig);</pre>
13214 <h6>Description</h6>
13215 <p><!--para 2 -->
13216 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
13217 signal handler is called, the raise function shall not return until after the signal handler
13218 does.
13219 <h6>Returns</h6>
13220 <p><!--para 3 -->
13221 The raise function returns zero if successful, nonzero if unsuccessful.
13222 <!--page 285 -->
13224 <h3><a name="7.15" href="#7.15">7.15 Alignment <stdalign.h></a></h3>
13225 <p><!--para 1 -->
13226 The header <a href="#7.15">&lt;stdalign.h&gt;</a> defines two macros.
13227 <p><!--para 2 -->
13228 The macro
13229 <pre>
13230 alignas</pre>
13231 expands to _Alignas.
13232 <p><!--para 3 -->
13233 The remaining macro is suitable for use in #if preprocessing directives. It is
13234 <pre>
13235 __alignas_is_defined</pre>
13236 which expands to the integer constant 1.
13237 <!--page 286 -->
13239 <h3><a name="7.16" href="#7.16">7.16 Variable arguments <stdarg.h></a></h3>
13240 <p><!--para 1 -->
13241 The header <a href="#7.16">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
13242 through a list of arguments whose number and types are not known to the called function
13243 when it is translated.
13244 <p><!--para 2 -->
13245 A function may be called with a variable number of arguments of varying types. As
13246 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
13247 parameter plays a special role in the access mechanism, and will be designated parmN in
13248 this description.
13249 <p><!--para 3 -->
13250 The type declared is
13251 <pre>
13252 va_list</pre>
13253 which is a complete object type suitable for holding information needed by the macros
13254 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
13255 desired, the called function shall declare an object (generally referred to as ap in this
13256 subclause) having type va_list. The object ap may be passed as an argument to
13257 another function; if that function invokes the va_arg macro with parameter ap, the
13258 value of ap in the calling function is indeterminate and shall be passed to the va_end
13259 macro prior to any further reference to ap.<sup><a href="#note250"><b>250)</b></a></sup>
13261 <h6>footnotes</h6>
13262 <p><small><a name="note250" href="#note250">250)</a> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
13263 case the original function may make further use of the original list after the other function returns.
13264 </small>
13266 <h4><a name="7.16.1" href="#7.16.1">7.16.1 Variable argument list access macros</a></h4>
13267 <p><!--para 1 -->
13268 The va_start and va_arg macros described in this subclause shall be implemented
13269 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
13270 identifiers declared with external linkage. If a macro definition is suppressed in order to
13271 access an actual function, or a program defines an external identifier with the same name,
13272 the behavior is undefined. Each invocation of the va_start and va_copy macros
13273 shall be matched by a corresponding invocation of the va_end macro in the same
13274 function.
13276 <h5><a name="7.16.1.1" href="#7.16.1.1">7.16.1.1 The va_arg macro</a></h5>
13277 <h6>Synopsis</h6>
13278 <p><!--para 1 -->
13279 <pre>
13280 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13281 type va_arg(va_list ap, type);</pre>
13282 <h6>Description</h6>
13283 <p><!--para 2 -->
13284 The va_arg macro expands to an expression that has the specified type and the value of
13285 the next argument in the call. The parameter ap shall have been initialized by the
13286 va_start or va_copy macro (without an intervening invocation of the va_end
13288 <!--page 287 -->
13289 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
13290 values of successive arguments are returned in turn. The parameter type shall be a type
13291 name specified such that the type of a pointer to an object that has the specified type can
13292 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
13293 type is not compatible with the type of the actual next argument (as promoted according
13294 to the default argument promotions), the behavior is undefined, except for the following
13295 cases:
13296 <ul>
13297 <li> one type is a signed integer type, the other type is the corresponding unsigned integer
13298 type, and the value is representable in both types;
13299 <li> one type is pointer to void and the other is a pointer to a character type.
13300 </ul>
13301 <h6>Returns</h6>
13302 <p><!--para 3 -->
13303 The first invocation of the va_arg macro after that of the va_start macro returns the
13304 value of the argument after that specified by parmN . Successive invocations return the
13305 values of the remaining arguments in succession.
13307 <h5><a name="7.16.1.2" href="#7.16.1.2">7.16.1.2 The va_copy macro</a></h5>
13308 <h6>Synopsis</h6>
13309 <p><!--para 1 -->
13310 <pre>
13311 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13312 void va_copy(va_list dest, va_list src);</pre>
13313 <h6>Description</h6>
13314 <p><!--para 2 -->
13315 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
13316 been applied to dest followed by the same sequence of uses of the va_arg macro as
13317 had previously been used to reach the present state of src. Neither the va_copy nor
13318 va_start macro shall be invoked to reinitialize dest without an intervening
13319 invocation of the va_end macro for the same dest.
13320 <h6>Returns</h6>
13321 <p><!--para 3 -->
13322 The va_copy macro returns no value.
13324 <h5><a name="7.16.1.3" href="#7.16.1.3">7.16.1.3 The va_end macro</a></h5>
13325 <h6>Synopsis</h6>
13326 <p><!--para 1 -->
13327 <pre>
13328 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13329 void va_end(va_list ap);</pre>
13330 <h6>Description</h6>
13331 <p><!--para 2 -->
13332 The va_end macro facilitates a normal return from the function whose variable
13333 argument list was referred to by the expansion of the va_start macro, or the function
13334 containing the expansion of the va_copy macro, that initialized the va_list ap. The
13335 va_end macro may modify ap so that it is no longer usable (without being reinitialized
13336 <!--page 288 -->
13337 by the va_start or va_copy macro). If there is no corresponding invocation of the
13338 va_start or va_copy macro, or if the va_end macro is not invoked before the
13339 return, the behavior is undefined.
13340 <h6>Returns</h6>
13341 <p><!--para 3 -->
13342 The va_end macro returns no value.
13344 <h5><a name="7.16.1.4" href="#7.16.1.4">7.16.1.4 The va_start macro</a></h5>
13345 <h6>Synopsis</h6>
13346 <p><!--para 1 -->
13347 <pre>
13348 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13349 void va_start(va_list ap, parmN);</pre>
13350 <h6>Description</h6>
13351 <p><!--para 2 -->
13352 The va_start macro shall be invoked before any access to the unnamed arguments.
13353 <p><!--para 3 -->
13354 The va_start macro initializes ap for subsequent use by the va_arg and va_end
13355 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
13356 without an intervening invocation of the va_end macro for the same ap.
13357 <p><!--para 4 -->
13358 The parameter parmN is the identifier of the rightmost parameter in the variable
13359 parameter list in the function definition (the one just before the , ...). If the parameter
13360 parmN is declared with the register storage class, with a function or array type, or
13361 with a type that is not compatible with the type that results after application of the default
13362 argument promotions, the behavior is undefined.
13363 <h6>Returns</h6>
13364 <p><!--para 5 -->
13365 The va_start macro returns no value.
13366 <p><!--para 6 -->
13367 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
13368 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
13369 pointers is specified by the first argument to f1.
13370 <!--page 289 -->
13371 <pre>
13372 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13373 #define MAXARGS 31
13374 void f1(int n_ptrs, ...)
13376 va_list ap;
13377 char *array[MAXARGS];
13378 int ptr_no = 0;
13379 if (n_ptrs &gt; MAXARGS)
13380 n_ptrs = MAXARGS;
13381 va_start(ap, n_ptrs);
13382 while (ptr_no &lt; n_ptrs)
13383 array[ptr_no++] = va_arg(ap, char *);
13384 va_end(ap);
13385 f2(n_ptrs, array);
13386 }</pre>
13387 Each call to f1 is required to have visible the definition of the function or a declaration such as
13388 <pre>
13389 void f1(int, ...);</pre>
13391 <p><!--para 7 -->
13392 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
13393 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
13394 is gathered again and passed to function f4.
13395 <!--page 290 -->
13396 <pre>
13397 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13398 #define MAXARGS 31
13399 void f3(int n_ptrs, int f4_after, ...)
13401 va_list ap, ap_save;
13402 char *array[MAXARGS];
13403 int ptr_no = 0;
13404 if (n_ptrs &gt; MAXARGS)
13405 n_ptrs = MAXARGS;
13406 va_start(ap, f4_after);
13407 while (ptr_no &lt; n_ptrs) {
13408 array[ptr_no++] = va_arg(ap, char *);
13409 if (ptr_no == f4_after)
13410 va_copy(ap_save, ap);
13412 va_end(ap);
13413 f2(n_ptrs, array);
13414 // Now process the saved copy.
13415 n_ptrs -= f4_after;
13416 ptr_no = 0;
13417 while (ptr_no &lt; n_ptrs)
13418 array[ptr_no++] = va_arg(ap_save, char *);
13419 va_end(ap_save);
13420 f4(n_ptrs, array);
13421 }</pre>
13423 <h3><a name="7.17" href="#7.17">7.17 Atomics <stdatomic.h></a></h3>
13425 <h4><a name="7.17.1" href="#7.17.1">7.17.1 Introduction</a></h4>
13426 <p><!--para 1 -->
13427 The header <a href="#7.17">&lt;stdatomic.h&gt;</a> defines several macros and declares several types and
13428 functions for performing atomic operations on data shared between threads.
13429 <p><!--para 2 -->
13430 Implementations that define the macro __STDC_NO_THREADS__ need not provide
13431 this header nor support any of its facilities.
13432 <p><!--para 3 -->
13433 The macros defined are the atomic lock-free macros
13434 <pre>
13435 ATOMIC_CHAR_LOCK_FREE
13436 ATOMIC_CHAR16_T_LOCK_FREE
13437 ATOMIC_CHAR32_T_LOCK_FREE
13438 ATOMIC_WCHAR_T_LOCK_FREE
13439 ATOMIC_SHORT_LOCK_FREE
13440 ATOMIC_INT_LOCK_FREE
13441 ATOMIC_LONG_LOCK_FREE
13442 ATOMIC_LLONG_LOCK_FREE
13443 ATOMIC_ADDRESS_LOCK_FREE</pre>
13444 which indicate the lock-free property of the corresponding atomic types (both signed and
13445 unsigned); and
13446 <pre>
13447 ATOMIC_FLAG_INIT</pre>
13448 which expands to an initializer for an object of type atomic_flag.
13449 <p><!--para 4 -->
13450 The types include
13451 <pre>
13452 memory_order</pre>
13453 which is an enumerated type whose enumerators identify memory ordering constraints;
13454 <pre>
13455 atomic_flag</pre>
13456 which is a structure type representing a lock-free, primitive atomic flag;
13457 <pre>
13458 atomic_bool</pre>
13459 which is a structure type representing the atomic analog of the type _Bool;
13460 <pre>
13461 atomic_address</pre>
13462 which is a structure type representing the atomic analog of a pointer type; and several
13463 atomic analogs of integer types.
13464 <p><!--para 5 -->
13465 In the following operation definitions:
13466 <ul>
13467 <li> An A refers to one of the atomic types.
13468 <!--page 291 -->
13469 <li> A C refers to its corresponding non-atomic type. The atomic_address atomic
13470 type corresponds to the void * non-atomic type.
13471 <li> An M refers to the type of the other argument for arithmetic operations. For atomic
13472 integer types, M is C. For atomic address types, M is ptrdiff_t.
13473 <li> The functions not ending in _explicit have the same semantics as the
13474 corresponding _explicit function with memory_order_seq_cst for the
13475 memory_order argument.
13476 </ul>
13477 <p><!--para 6 -->
13478 NOTE Many operations are volatile-qualified. The ''volatile as device register'' semantics have not
13479 changed in the standard. This qualification means that volatility is preserved when applying these
13480 operations to volatile objects.
13483 <h4><a name="7.17.2" href="#7.17.2">7.17.2 Initialization</a></h4>
13485 <h5><a name="7.17.2.1" href="#7.17.2.1">7.17.2.1 The ATOMIC_VAR_INIT macro</a></h5>
13486 <h6>Synopsis</h6>
13487 <p><!--para 1 -->
13488 <pre>
13489 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13490 #define ATOMIC_VAR_INIT(C value)</pre>
13491 <h6>Description</h6>
13492 <p><!--para 2 -->
13493 The ATOMIC_VAR_INIT macro expands to a token sequence suitable for initializing an
13494 atomic object of a type that is initialization-compatible with value. An atomic object
13495 with automatic storage duration that is not explicitly initialized using
13496 ATOMIC_VAR_INIT is initially in an indeterminate state; however, the default (zero)
13497 initialization for objects with static or thread-local storage duration is guaranteed to
13498 produce a valid state.
13499 <p><!--para 3 -->
13500 Concurrent access to the variable being initialized, even via an atomic operation,
13501 constitutes a data race.
13502 <p><!--para 4 -->
13503 EXAMPLE
13504 <pre>
13505 atomic_int guide = ATOMIC_VAR_INIT(42);</pre>
13508 <h5><a name="7.17.2.2" href="#7.17.2.2">7.17.2.2 The atomic_init generic function</a></h5>
13509 <h6>Synopsis</h6>
13510 <p><!--para 1 -->
13511 <pre>
13512 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13513 void atomic_init(volatile A *obj, C value);</pre>
13514 <h6>Description</h6>
13515 <p><!--para 2 -->
13516 The atomic_init generic function initializes the atomic object pointed to by obj to
13517 the value value, while also initializing any additional state that the implementation
13518 might need to carry for the atomic object.
13519 <!--page 292 -->
13520 <p><!--para 3 -->
13521 Although this function initializes an atomic object, it does not avoid data races;
13522 concurrent access to the variable being initialized, even via an atomic operation,
13523 constitutes a data race.
13524 <h6>Returns</h6>
13525 <p><!--para 4 -->
13526 The atomic_init generic function returns no value.
13527 <p><!--para 5 -->
13528 EXAMPLE
13529 <pre>
13530 atomic_int guide;
13531 atomic_init(&amp;guide, 42);</pre>
13534 <h4><a name="7.17.3" href="#7.17.3">7.17.3 Order and consistency</a></h4>
13535 <p><!--para 1 -->
13536 The enumerated type memory_order specifies the detailed regular (non-atomic)
13537 memory synchronization operations as defined in <a href="#5.1.2.4">5.1.2.4</a> and may provide for operation
13538 ordering. Its enumeration constants are as follows:
13539 <p><!--para 2 -->
13540 <pre>
13541 memory_order_relaxed
13542 memory_order_consume
13543 memory_order_acquire
13544 memory_order_release
13545 memory_order_acq_rel
13546 memory_order_seq_cst</pre>
13547 For memory_order_relaxed, no operation orders memory.
13548 <p><!--para 3 -->
13549 For memory_order_release, memory_order_acq_rel, and
13550 memory_order_seq_cst, a store operation performs a release operation on the
13551 affected memory location.
13552 <p><!--para 4 -->
13553 For memory_order_acquire, memory_order_acq_rel, and
13554 memory_order_seq_cst, a load operation performs an acquire operation on the
13555 affected memory location.
13556 <p><!--para 5 -->
13557 For memory_order_consume, a load operation performs a consume operation on the
13558 affected memory location.
13559 <p><!--para 6 -->
13560 For memory_order_seq_cst, there shall be a single total order S on all operations,
13561 consistent with the ''happens before'' order and modification orders for all affected
13562 locations, such that each memory_order_seq_cst operation that loads a value
13563 observes either the last preceding modification according to this order S, or the result of
13564 an operation that is not memory_order_seq_cst.
13565 <p><!--para 7 -->
13566 NOTE 1 Although it is not explicitly required that S include lock operations, it can always be extended to
13567 an order that does include lock and unlock operations, since the ordering between those is already included
13568 in the ''happens before'' ordering.
13570 <p><!--para 8 -->
13571 NOTE 2 Atomic operations specifying memory_order_relaxed are relaxed only with respect to
13572 memory ordering. Implementations must still guarantee that any given atomic access to a particular atomic
13573 <!--page 293 -->
13574 object be indivisible with respect to all other atomic accesses to that object.
13576 <p><!--para 9 -->
13577 For an atomic operation B that reads the value of an atomic object M, if there is a
13578 memory_order_seq_cst fence X sequenced before B, then B observes either the
13579 last memory_order_seq_cst modification of M preceding X in the total order S or
13580 a later modification of M in its modification order.
13581 <p><!--para 10 -->
13582 For atomic operations A and B on an atomic object M, where A modifies M and B takes
13583 its value, if there is a memory_order_seq_cst fence X such that A is sequenced
13584 before X and B follows X in S, then B observes either the effects of A or a later
13585 modification of M in its modification order.
13586 <p><!--para 11 -->
13587 For atomic operations A and B on an atomic object M, where A modifies M and B takes
13588 its value, if there are memory_order_seq_cst fences X and Y such that A is
13589 sequenced before X, Y is sequenced before B, and X precedes Y in S, then B observes
13590 either the effects of A or a later modification of M in its modification order.
13591 <p><!--para 12 -->
13592 Atomic read-modify-write operations shall always read the last value (in the modification
13593 order) stored before the write associated with the read-modify-write operation.
13594 <p><!--para 13 -->
13595 An atomic store shall only store a value that has been computed from constants and
13596 program input values by a finite sequence of program evaluations, such that each
13597 evaluation observes the values of variables as computed by the last prior assignment in
13598 the sequence.<sup><a href="#note251"><b>251)</b></a></sup> The ordering of evaluations in this sequence shall be such that
13599 <ul>
13600 <li> If an evaluation B observes a value computed by A in a different thread, then B does
13601 not happen before A.
13602 <li> If an evaluation A is included in the sequence, then all evaluations that assign to the
13603 same variable and happen before A are also included.
13604 </ul>
13605 <p><!--para 14 -->
13606 NOTE 3 The second requirement disallows ''out-of-thin-air'', or ''speculative'' stores of atomics when
13607 relaxed atomics are used. Since unordered operations are involved, evaluations may appear in this
13608 sequence out of thread order. For example, with x and y initially zero,
13609 <pre>
13610 // Thread 1:
13611 r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
13612 atomic_store_explicit(&amp;x, r1, memory_order_relaxed);</pre>
13614 <pre>
13615 // Thread 2:
13616 r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
13617 atomic_store_explicit(&amp;y, 42, memory_order_relaxed);</pre>
13618 is allowed to produce r1 == 42 &amp;&amp; r2 == 42. The sequence of evaluations justifying this consists of:
13623 <!--page 294 -->
13624 <pre>
13625 atomic_store_explicit(&amp;y, 42, memory_order_relaxed);
13626 r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
13627 atomic_store_explicit(&amp;x, r1, memory_order_relaxed);
13628 r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);</pre>
13629 On the other hand,
13630 <pre>
13631 // Thread 1:
13632 r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
13633 atomic_store_explicit(&amp;x, r1, memory_order_relaxed);</pre>
13635 <pre>
13636 // Thread 2:
13637 r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
13638 atomic_store_explicit(&amp;y, r2, memory_order_relaxed);</pre>
13639 is not allowed to produce r1 == 42 &amp;&amp; r2 = 42, since there is no sequence of evaluations that results
13640 in the computation of 42. In the absence of ''relaxed'' operations and read-modify-write operations with
13641 weaker than memory_order_acq_rel ordering, the second requirement has no impact.
13643 <h6>Recommended practice</h6>
13644 <p><!--para 15 -->
13645 The requirements do not forbid r1 == 42 &amp;&amp; r2 == 42 in the following example,
13646 with x and y initially zero:
13647 <pre>
13648 // Thread 1:
13649 r1 = atomic_load_explicit(&amp;x, memory_order_relaxed);
13650 if (r1 == 42)
13651 atomic_store_explicit(&amp;y, r1, memory_order_relaxed);</pre>
13653 <pre>
13654 // Thread 2:
13655 r2 = atomic_load_explicit(&amp;y, memory_order_relaxed);
13656 if (r2 == 42)
13657 atomic_store_explicit(&amp;x, 42, memory_order_relaxed);</pre>
13658 However, this is not useful behavior, and implementations should not allow it.
13659 <p><!--para 16 -->
13660 Implementations should make atomic stores visible to atomic loads within a reasonable
13661 amount of time.
13663 <h6>footnotes</h6>
13664 <p><small><a name="note251" href="#note251">251)</a> Among other implications, atomic variables shall not decay.
13665 </small>
13667 <h5><a name="7.17.3.1" href="#7.17.3.1">7.17.3.1 The kill_dependency macro</a></h5>
13668 <h6>Synopsis</h6>
13669 <p><!--para 1 -->
13670 <pre>
13671 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13672 type kill_dependency(type y);</pre>
13673 <h6>Description</h6>
13674 <p><!--para 2 -->
13675 The kill_dependency macro terminates a dependency chain; the argument does not
13676 carry a dependency to the return value.
13677 <!--page 295 -->
13678 <h6>Returns</h6>
13679 <p><!--para 3 -->
13680 The kill_dependency macro returns the value of y.
13682 <h4><a name="7.17.4" href="#7.17.4">7.17.4 Fences</a></h4>
13683 <p><!--para 1 -->
13684 This subclause introduces synchronization primitives called fences. Fences can have
13685 acquire semantics, release semantics, or both. A fence with acquire semantics is called
13686 an acquire fence; a fence with release semantics is called a release fence.
13687 <p><!--para 2 -->
13688 A release fence A synchronizes with an acquire fence B if there exist atomic operations
13689 X and Y , both operating on some atomic object M, such that A is sequenced before X, X
13690 modifies M, Y is sequenced before B, and Y reads the value written by X or a value
13691 written by any side effect in the hypothetical release sequence X would head if it were a
13692 release operation.
13693 <p><!--para 3 -->
13694 A release fence A synchronizes with an atomic operation B that performs an acquire
13695 operation on an atomic object M if there exists an atomic operation X such that A is
13696 sequenced before X, X modifies M, and B reads the value written by X or a value written
13697 by any side effect in the hypothetical release sequence X would head if it were a release
13698 operation.
13699 <p><!--para 4 -->
13700 An atomic operation A that is a release operation on an atomic object M synchronizes
13701 with an acquire fence B if there exists some atomic operation X on M such that X is
13702 sequenced before B and reads the value written by A or a value written by any side effect
13703 in the release sequence headed by A.
13705 <h5><a name="7.17.4.1" href="#7.17.4.1">7.17.4.1 The atomic_thread_fence function</a></h5>
13706 <h6>Synopsis</h6>
13707 <p><!--para 1 -->
13708 <pre>
13709 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13710 void atomic_thread_fence(memory_order order);</pre>
13711 <h6>Description</h6>
13712 <p><!--para 2 -->
13713 Depending on the value of order, this operation:
13714 <ul>
13715 <li> has no effects, if order == memory_order_relaxed;
13716 <li> is an acquire fence, if order == memory_order_acquire or order ==
13717 memory_order_consume;
13718 <li> is a release fence, if order == memory_order_release;
13719 <li> is both an acquire fence and a release fence, if order ==
13720 memory_order_acq_rel;
13721 <li> is a sequentially consistent acquire and release fence, if order ==
13722 memory_order_seq_cst.
13723 <!--page 296 -->
13724 </ul>
13725 <h6>Returns</h6>
13726 <p><!--para 3 -->
13727 The atomic_thread_fence function returns no value.
13729 <h5><a name="7.17.4.2" href="#7.17.4.2">7.17.4.2 The atomic_signal_fence function</a></h5>
13730 <h6>Synopsis</h6>
13731 <p><!--para 1 -->
13732 <pre>
13733 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13734 void atomic_signal_fence(memory_order order);</pre>
13735 <h6>Description</h6>
13736 <p><!--para 2 -->
13737 Equivalent to atomic_thread_fence(order), except that ''synchronizes with''
13738 relationships are established only between a thread and a signal handler executed in the
13739 same thread.
13740 <p><!--para 3 -->
13741 NOTE 1 The atomic_signal_fence function can be used to specify the order in which actions
13742 performed by the thread become visible to the signal handler.
13744 <p><!--para 4 -->
13745 NOTE 2 Compiler optimizations and reorderings of loads and stores are inhibited in the same way as with
13746 atomic_thread_fence, but the hardware fence instructions that atomic_thread_fence would
13747 have inserted are not emitted.
13749 <h6>Returns</h6>
13750 <p><!--para 5 -->
13751 The atomic_signal_fence function returns no value.
13753 <h4><a name="7.17.5" href="#7.17.5">7.17.5 Lock-free property</a></h4>
13754 <p><!--para 1 -->
13755 The atomic lock-free macros indicate the lock-free property of integer and address atomic
13756 types. A value of 0 indicates that the type is never lock-free; a value of 1 indicates that
13757 the type is sometimes lock-free; a value of 2 indicates that the type is always lock-free.
13758 <p><!--para 2 -->
13759 NOTE Operations that are lock-free should also be address-free. That is, atomic operations on the same
13760 memory location via two different addresses will communicate atomically. The implementation should not
13761 depend on any per-process state. This restriction enables communication via memory mapped into a
13762 process more than once and memory shared between two processes.
13765 <h5><a name="7.17.5.1" href="#7.17.5.1">7.17.5.1 The atomic_is_lock_free generic function</a></h5>
13766 <h6>Synopsis</h6>
13767 <p><!--para 1 -->
13768 <pre>
13769 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13770 _Bool atomic_is_lock_free(atomic_type const volatile *obj);</pre>
13771 <h6>Description</h6>
13772 <p><!--para 2 -->
13773 The atomic_is_lock_free generic function indicates whether or not the object
13774 pointed to by obj is lock-free. atomic_type can be any atomic type.
13775 <h6>Returns</h6>
13776 <p><!--para 3 -->
13777 The atomic_is_lock_free generic function returns nonzero (true) if and only if the
13778 object's operations are lock-free. The result of a lock-free query on one object cannot be
13779 <!--page 297 -->
13780 inferred from the result of a lock-free query on another object.
13782 <h4><a name="7.17.6" href="#7.17.6">7.17.6 Atomic integer and address types</a></h4>
13783 <p><!--para 1 -->
13784 For each line in the following table, the atomic type name is declared as the
13785 corresponding direct type.
13786 <!--page 298 -->
13787 <p><!--para 2 -->
13788 <pre>
13789 Atomic type name Direct type
13790 atomic_char _Atomic char
13791 atomic_schar _Atomic signed char
13792 atomic_uchar _Atomic unsigned char
13793 atomic_short _Atomic short
13794 atomic_ushort _Atomic unsigned short
13795 atomic_int _Atomic int
13796 atomic_uint _Atomic unsigned int
13797 atomic_long _Atomic long
13798 atomic_ulong _Atomic unsigned long
13799 atomic_llong _Atomic long long
13800 atomic_ullong _Atomic unsigned long long
13801 atomic_char16_t _Atomic char16_t
13802 atomic_char32_t _Atomic char32_t
13803 atomic_wchar_t _Atomic wchar_t
13804 atomic_int_least8_t _Atomic int_least8_t
13805 atomic_uint_least8_t _Atomic uint_least8_t
13806 atomic_int_least16_t _Atomic int_least16_t
13807 atomic_uint_least16_t _Atomic uint_least16_t
13808 atomic_int_least32_t _Atomic int_least32_t
13809 atomic_uint_least32_t _Atomic uint_least32_t
13810 atomic_int_least64_t _Atomic int_least64_t
13811 atomic_uint_least64_t _Atomic uint_least64_t
13812 atomic_int_fast8_t _Atomic int_fast8_t
13813 atomic_uint_fast8_t _Atomic uint_fast8_t
13814 atomic_int_fast16_t _Atomic int_fast16_t
13815 atomic_uint_fast16_t _Atomic uint_fast16_t
13816 atomic_int_fast32_t _Atomic int_fast32_t
13817 atomic_uint_fast32_t _Atomic uint_fast32_t
13818 atomic_int_fast64_t _Atomic int_fast64_t
13819 atomic_uint_fast64_t _Atomic uint_fast64_t
13820 atomic_intptr_t _Atomic intptr_t
13821 atomic_uintptr_t _Atomic uintptr_t
13822 atomic_size_t _Atomic size_t
13823 atomic_ptrdiff_t _Atomic ptrdiff_t
13824 atomic_intmax_t _Atomic intmax_t
13825 atomic_uintmax_t _Atomic uintmax_t</pre>
13826 The semantics of the operations on these types are defined in <a href="#7.17.7">7.17.7</a>.
13827 <p><!--para 3 -->
13828 The atomic_bool type provides an atomic boolean.
13829 <!--page 299 -->
13830 <p><!--para 4 -->
13831 The atomic_address type provides atomic void * operations. The unit of
13832 addition/subtraction shall be one byte.
13833 <p><!--para 5 -->
13834 NOTE The representation of atomic integer and address types need not have the same size as their
13835 corresponding regular types. They should have the same size whenever possible, as it eases effort required
13836 to port existing code.
13839 <h4><a name="7.17.7" href="#7.17.7">7.17.7 Operations on atomic types</a></h4>
13840 <p><!--para 1 -->
13841 There are only a few kinds of operations on atomic types, though there are many
13842 instances of those kinds. This subclause specifies each general kind.
13844 <h5><a name="7.17.7.1" href="#7.17.7.1">7.17.7.1 The atomic_store generic functions</a></h5>
13845 <h6>Synopsis</h6>
13846 <p><!--para 1 -->
13847 <pre>
13848 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13849 void atomic_store(volatile A *object, C desired);
13850 void atomic_store_explicit(volatile A *object,
13851 C desired, memory_order order);</pre>
13852 <h6>Description</h6>
13853 <p><!--para 2 -->
13854 The order argument shall not be memory_order_acquire,
13855 memory_order_consume, nor memory_order_acq_rel. Atomically replace the
13856 value pointed to by object with the value of desired. Memory is affected according
13857 to the value of order.
13858 <h6>Returns</h6>
13859 <p><!--para 3 -->
13860 The atomic_store generic functions return no value.
13862 <h5><a name="7.17.7.2" href="#7.17.7.2">7.17.7.2 The atomic_load generic functions</a></h5>
13863 <h6>Synopsis</h6>
13864 <p><!--para 1 -->
13865 <pre>
13866 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13867 C atomic_load(volatile A *object);
13868 C atomic_load_explicit(volatile A *object,
13869 memory_order order);</pre>
13870 <h6>Description</h6>
13871 <p><!--para 2 -->
13872 The order argument shall not be memory_order_release nor
13873 memory_order_acq_rel. Memory is affected according to the value of order.
13874 <h6>Returns</h6>
13875 Atomically returns the value pointed to by object.
13876 <!--page 300 -->
13878 <h5><a name="7.17.7.3" href="#7.17.7.3">7.17.7.3 The atomic_exchange generic functions</a></h5>
13879 <h6>Synopsis</h6>
13880 <p><!--para 1 -->
13881 <pre>
13882 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13883 C atomic_exchange(volatile A *object, C desired);
13884 C atomic_exchange_explicit(volatile A *object,
13885 C desired, memory_order order);</pre>
13886 <h6>Description</h6>
13887 <p><!--para 2 -->
13888 Atomically replace the value pointed to by object with desired. Memory is affected
13889 according to the value of order. These operations are read-modify-write operations
13890 (<a href="#5.1.2.4">5.1.2.4</a>).
13891 <h6>Returns</h6>
13892 <p><!--para 3 -->
13893 Atomically returns the value pointed to by object immediately before the effects.
13895 <h5><a name="7.17.7.4" href="#7.17.7.4">7.17.7.4 The atomic_compare_exchange generic functions</a></h5>
13896 <h6>Synopsis</h6>
13897 <p><!--para 1 -->
13898 <pre>
13899 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13900 _Bool atomic_compare_exchange_strong(volatile A *object,
13901 C *expected, C desired);
13902 _Bool atomic_compare_exchange_strong_explicit(
13903 volatile A *object, C *expected, C desired,
13904 memory_order success, memory_order failure);
13905 _Bool atomic_compare_exchange_weak(volatile A *object,
13906 C *expected, C desired);
13907 _Bool atomic_compare_exchange_weak_explicit(
13908 volatile A *object, C *expected, C desired,
13909 memory_order success, memory_order failure);</pre>
13910 <h6>Description</h6>
13911 <p><!--para 2 -->
13912 The failure argument shall not be memory_order_release nor
13913 memory_order_acq_rel. The failure argument shall be no stronger than the
13914 success argument. Atomically, compares the value pointed to by object for equality
13915 with that in expected, and if true, replaces the value pointed to by object with
13916 desired, and if false, updates the value in expected with the value pointed to by
13917 object. Further, if the comparison is true, memory is affected according to the value of
13918 success, and if the comparison is false, memory is affected according to the value of
13919 failure. These operations are atomic read-modify-write operations (<a href="#5.1.2.4">5.1.2.4</a>).
13920 <p><!--para 3 -->
13921 NOTE 1 The effect of the compare-and-exchange operations is
13922 <!--page 301 -->
13923 <pre>
13924 if (*object == *expected)
13925 *object = desired;
13926 else
13927 *expected = *object;</pre>
13929 <p><!--para 4 -->
13930 The weak compare-and-exchange operations may fail spuriously, that is, return zero
13931 while leaving the value pointed to by expected unchanged.
13932 <p><!--para 5 -->
13933 NOTE 2 This spurious failure enables implementation of compare-and-exchange on a broader class of
13934 machines, e.g. load-locked store-conditional machines.
13936 <p><!--para 6 -->
13937 EXAMPLE A consequence of spurious failure is that nearly all uses of weak compare-and-exchange will
13938 be in a loop.
13939 <pre>
13940 exp = atomic_load(&amp;cur);
13941 do {
13942 des = function(exp);
13943 } while (!atomic_compare_exchange_weak(&amp;cur, &amp;exp, des));</pre>
13944 When a compare-and-exchange is in a loop, the weak version will yield better performance on some
13945 platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the
13946 strong one is preferable.
13948 <h6>Returns</h6>
13949 <p><!--para 7 -->
13950 The result of the comparison.
13952 <h5><a name="7.17.7.5" href="#7.17.7.5">7.17.7.5 The atomic_fetch and modify generic functions</a></h5>
13953 <p><!--para 1 -->
13954 The following operations perform arithmetic and bitwise computations. All of these
13955 operations are applicable to an object of any atomic integer type. Only addition and
13956 subtraction are applicable to atomic_address. None of these operations is applicable
13957 to atomic_bool. The key, operator, and computation correspondence is:
13958 key op computation
13959 add + addition
13960 sub - subtraction
13961 or | bitwise inclusive or
13962 xor ^ bitwise exclusive or
13963 and &amp; bitwise and
13964 <h6>Synopsis</h6>
13965 <p><!--para 2 -->
13966 <pre>
13967 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
13968 C atomic_fetch_key(volatile A *object, M operand);
13969 C atomic_fetch_key_explicit(volatile A *object,
13970 M operand, memory_order order);</pre>
13971 <h6>Description</h6>
13972 <p><!--para 3 -->
13973 Atomically replaces the value pointed to by object with the result of the computation
13974 applied to the value pointed to by object and the given operand. Memory is affected
13975 according to the value of order. These operations are atomic read-modify-write
13976 <!--page 302 -->
13977 operations (<a href="#5.1.2.4">5.1.2.4</a>). For signed integer types, arithmetic is defined to use two's
13978 complement representation with silent wrap-around on overflow; there are no undefined
13979 results. For address types, the result may be an undefined address, but the operations
13980 otherwise have no undefined behavior.
13981 <h6>Returns</h6>
13982 <p><!--para 4 -->
13983 Atomically, the value pointed to by object immediately before the effects.
13984 <p><!--para 5 -->
13985 NOTE The operation of the atomic_fetch and modify generic functions are nearly equivalent to the
13986 operation of the corresponding op= compound assignment operators. The only differences are that the
13987 compound assignment operators are not guaranteed to operate atomically, and the value yielded by a
13988 compound assignment operator is the updated value of the object, whereas the value returned by the
13989 atomic_fetch and modify generic functions is the previous value of the atomic object.
13992 <h4><a name="7.17.8" href="#7.17.8">7.17.8 Atomic flag type and operations</a></h4>
13993 <p><!--para 1 -->
13994 The atomic_flag type provides the classic test-and-set functionality. It has two
13995 states, set and clear.
13996 <p><!--para 2 -->
13997 Operations on an object of type atomic_flag shall be lock free.
13998 <p><!--para 3 -->
13999 NOTE Hence the operations should also be address-free. No other type requires lock-free operations, so
14000 the atomic_flag type is the minimum hardware-implemented type needed to conform to this
14001 International standard. The remaining types can be emulated with atomic_flag, though with less than
14002 ideal properties.
14004 <p><!--para 4 -->
14005 The macro ATOMIC_FLAG_INIT may be used to initialize an atomic_flag to the
14006 clear state. An atomic_flag that is not explicitly initialized with
14007 ATOMIC_FLAG_INIT is initially in an indeterminate state.
14008 <p><!--para 5 -->
14009 EXAMPLE
14010 <pre>
14011 atomic_flag guard = ATOMIC_FLAG_INIT;</pre>
14014 <h5><a name="7.17.8.1" href="#7.17.8.1">7.17.8.1 The atomic_flag_test_and_set functions</a></h5>
14015 <h6>Synopsis</h6>
14016 <p><!--para 1 -->
14017 <pre>
14018 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14019 bool atomic_flag_test_and_set(
14020 volatile atomic_flag *object);
14021 bool atomic_flag_test_and_set_explicit(
14022 volatile atomic_flag *object, memory_order order);</pre>
14023 <h6>Description</h6>
14024 <p><!--para 2 -->
14025 Atomically sets the value pointed to by object to true. Memory is affected according
14026 to the value of order. These operations are atomic read-modify-write operations
14027 (<a href="#5.1.2.4">5.1.2.4</a>).
14028 <!--page 303 -->
14029 <h6>Returns</h6>
14030 <p><!--para 3 -->
14031 Atomically, the value of the object immediately before the effects.
14033 <h5><a name="7.17.8.2" href="#7.17.8.2">7.17.8.2 The atomic_flag_clear functions</a></h5>
14034 <h6>Synopsis</h6>
14035 <p><!--para 1 -->
14036 <pre>
14037 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14038 void atomic_flag_clear(volatile atomic_flag *object);
14039 void atomic_flag_clear_explicit(
14040 volatile atomic_flag *object, memory_order order);</pre>
14041 <h6>Description</h6>
14042 <p><!--para 2 -->
14043 The order argument shall not be memory_order_acquire nor
14044 memory_order_acq_rel. Atomically sets the value pointed to by object to false.
14045 Memory is affected according to the value of order.
14046 <h6>Returns</h6>
14047 <p><!--para 3 -->
14048 The atomic_flag_clear functions return no value.
14049 <!--page 304 -->
14051 <h3><a name="7.18" href="#7.18">7.18 Boolean type and values <stdbool.h></a></h3>
14052 <p><!--para 1 -->
14053 The header <a href="#7.18">&lt;stdbool.h&gt;</a> defines four macros.
14054 <p><!--para 2 -->
14055 The macro
14056 <pre>
14057 bool</pre>
14058 expands to _Bool.
14059 <p><!--para 3 -->
14060 The remaining three macros are suitable for use in #if preprocessing directives. They
14062 <pre>
14063 true</pre>
14064 which expands to the integer constant 1,
14065 <pre>
14066 false</pre>
14067 which expands to the integer constant 0, and
14068 <pre>
14069 __bool_true_false_are_defined</pre>
14070 which expands to the integer constant 1.
14071 <p><!--para 4 -->
14072 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
14073 redefine the macros bool, true, and false.<sup><a href="#note252"><b>252)</b></a></sup>
14078 <!--page 305 -->
14080 <h6>footnotes</h6>
14081 <p><small><a name="note252" href="#note252">252)</a> See ''future library directions'' (<a href="#7.30.7">7.30.7</a>).
14082 </small>
14084 <h3><a name="7.19" href="#7.19">7.19 Common definitions <stddef.h></a></h3>
14085 <p><!--para 1 -->
14086 The header <a href="#7.19">&lt;stddef.h&gt;</a> defines the following macros and declares the following types.
14087 Some are also defined in other headers, as noted in their respective subclauses.
14088 <p><!--para 2 -->
14089 The types are
14090 <pre>
14091 ptrdiff_t</pre>
14092 which is the signed integer type of the result of subtracting two pointers;
14093 <pre>
14094 size_t</pre>
14095 which is the unsigned integer type of the result of the sizeof operator;
14096 <pre>
14097 max_align_t</pre>
14098 which is an object type whose alignment is as great as is supported by the implementation
14099 in all contexts; and
14100 <pre>
14101 wchar_t</pre>
14102 which is an integer type whose range of values can represent distinct codes for all
14103 members of the largest extended character set specified among the supported locales; the
14104 null character shall have the code value zero. Each member of the basic character set
14105 shall have a code value equal to its value when used as the lone character in an integer
14106 character constant if an implementation does not define
14107 __STDC_MB_MIGHT_NEQ_WC__.
14108 <p><!--para 3 -->
14109 The macros are
14110 <pre>
14111 NULL</pre>
14112 which expands to an implementation-defined null pointer constant; and
14113 <pre>
14114 offsetof(type, member-designator)</pre>
14115 which expands to an integer constant expression that has type size_t, the value of
14116 which is the offset in bytes, to the structure member (designated by member-designator),
14117 from the beginning of its structure (designated by type). The type and member designator
14118 shall be such that given
14119 <pre>
14120 static type t;</pre>
14121 then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
14122 specified member is a bit-field, the behavior is undefined.)
14123 <h6>Recommended practice</h6>
14124 <p><!--para 4 -->
14125 The types used for size_t and ptrdiff_t should not have an integer conversion rank
14126 greater than that of signed long int unless the implementation supports objects
14127 large enough to make this necessary.
14128 <!--page 306 -->
14129 <p><b> Forward references</b>: localization (<a href="#7.11">7.11</a>).
14130 <!--page 307 -->
14132 <h3><a name="7.20" href="#7.20">7.20 Integer types <stdint.h></a></h3>
14133 <p><!--para 1 -->
14134 The header <a href="#7.20">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
14135 defines corresponding sets of macros.<sup><a href="#note253"><b>253)</b></a></sup> It also defines macros that specify limits of
14136 integer types corresponding to types defined in other standard headers.
14137 <p><!--para 2 -->
14138 Types are defined in the following categories:
14139 <ul>
14140 <li> integer types having certain exact widths;
14141 <li> integer types having at least certain specified widths;
14142 <li> fastest integer types having at least certain specified widths;
14143 <li> integer types wide enough to hold pointers to objects;
14144 <li> integer types having greatest width.
14145 </ul>
14146 (Some of these types may denote the same type.)
14147 <p><!--para 3 -->
14148 Corresponding macros specify limits of the declared types and construct suitable
14149 constants.
14150 <p><!--para 4 -->
14151 For each type described herein that the implementation provides,<sup><a href="#note254"><b>254)</b></a></sup> <a href="#7.20">&lt;stdint.h&gt;</a> shall
14152 declare that typedef name and define the associated macros. Conversely, for each type
14153 described herein that the implementation does not provide, <a href="#7.20">&lt;stdint.h&gt;</a> shall not
14154 declare that typedef name nor shall it define the associated macros. An implementation
14155 shall provide those types described as ''required'', but need not provide any of the others
14156 (described as ''optional'').
14158 <h6>footnotes</h6>
14159 <p><small><a name="note253" href="#note253">253)</a> See ''future library directions'' (<a href="#7.30.8">7.30.8</a>).
14160 </small>
14161 <p><small><a name="note254" href="#note254">254)</a> Some of these types may denote implementation-defined extended integer types.
14162 </small>
14164 <h4><a name="7.20.1" href="#7.20.1">7.20.1 Integer types</a></h4>
14165 <p><!--para 1 -->
14166 When typedef names differing only in the absence or presence of the initial u are defined,
14167 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
14168 implementation providing one of these corresponding types shall also provide the other.
14169 <p><!--para 2 -->
14170 In the following descriptions, the symbol N represents an unsigned decimal integer with
14171 no leading zeros (e.g., 8 or 24, but not 04 or 048).
14176 <!--page 308 -->
14178 <h5><a name="7.20.1.1" href="#7.20.1.1">7.20.1.1 Exact-width integer types</a></h5>
14179 <p><!--para 1 -->
14180 The typedef name intN_t designates a signed integer type with width N , no padding
14181 bits, and a two's complement representation. Thus, int8_t denotes such a signed
14182 integer type with a width of exactly 8 bits.
14183 <p><!--para 2 -->
14184 The typedef name uintN_t designates an unsigned integer type with width N and no
14185 padding bits. Thus, uint24_t denotes such an unsigned integer type with a width of
14186 exactly 24 bits.
14187 <p><!--para 3 -->
14188 These types are optional. However, if an implementation provides integer types with
14189 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
14190 two's complement representation, it shall define the corresponding typedef names.
14192 <h5><a name="7.20.1.2" href="#7.20.1.2">7.20.1.2 Minimum-width integer types</a></h5>
14193 <p><!--para 1 -->
14194 The typedef name int_leastN_t designates a signed integer type with a width of at
14195 least N , such that no signed integer type with lesser size has at least the specified width.
14196 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
14197 <p><!--para 2 -->
14198 The typedef name uint_leastN_t designates an unsigned integer type with a width
14199 of at least N , such that no unsigned integer type with lesser size has at least the specified
14200 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
14201 least 16 bits.
14202 <p><!--para 3 -->
14203 The following types are required:
14204 <pre>
14205 int_least8_t uint_least8_t
14206 int_least16_t uint_least16_t
14207 int_least32_t uint_least32_t
14208 int_least64_t uint_least64_t</pre>
14209 All other types of this form are optional.
14211 <h5><a name="7.20.1.3" href="#7.20.1.3">7.20.1.3 Fastest minimum-width integer types</a></h5>
14212 <p><!--para 1 -->
14213 Each of the following types designates an integer type that is usually fastest<sup><a href="#note255"><b>255)</b></a></sup> to operate
14214 with among all integer types that have at least the specified width.
14215 <p><!--para 2 -->
14216 The typedef name int_fastN_t designates the fastest signed integer type with a width
14217 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
14218 type with a width of at least N .
14223 <!--page 309 -->
14224 <p><!--para 3 -->
14225 The following types are required:
14226 <pre>
14227 int_fast8_t uint_fast8_t
14228 int_fast16_t uint_fast16_t
14229 int_fast32_t uint_fast32_t
14230 int_fast64_t uint_fast64_t</pre>
14231 All other types of this form are optional.
14233 <h6>footnotes</h6>
14234 <p><small><a name="note255" href="#note255">255)</a> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
14235 grounds for choosing one type over another, it will simply pick some integer type satisfying the
14236 signedness and width requirements.
14237 </small>
14239 <h5><a name="7.20.1.4" href="#7.20.1.4">7.20.1.4 Integer types capable of holding object pointers</a></h5>
14240 <p><!--para 1 -->
14241 The following type designates a signed integer type with the property that any valid
14242 pointer to void can be converted to this type, then converted back to pointer to void,
14243 and the result will compare equal to the original pointer:
14244 <pre>
14245 intptr_t</pre>
14246 The following type designates an unsigned integer type with the property that any valid
14247 pointer to void can be converted to this type, then converted back to pointer to void,
14248 and the result will compare equal to the original pointer:
14249 <pre>
14250 uintptr_t</pre>
14251 These types are optional.
14253 <h5><a name="7.20.1.5" href="#7.20.1.5">7.20.1.5 Greatest-width integer types</a></h5>
14254 <p><!--para 1 -->
14255 The following type designates a signed integer type capable of representing any value of
14256 any signed integer type:
14257 <pre>
14258 intmax_t</pre>
14259 The following type designates an unsigned integer type capable of representing any value
14260 of any unsigned integer type:
14261 <pre>
14262 uintmax_t</pre>
14263 These types are required.
14265 <h4><a name="7.20.2" href="#7.20.2">7.20.2 Limits of specified-width integer types</a></h4>
14266 <p><!--para 1 -->
14267 The following object-like macros specify the minimum and maximum limits of the types *
14268 declared in <a href="#7.20">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
14269 <a href="#7.20.1">7.20.1</a>.
14270 <p><!--para 2 -->
14271 Each instance of any defined macro shall be replaced by a constant expression suitable
14272 for use in #if preprocessing directives, and this expression shall have the same type as
14273 would an expression that is an object of the corresponding type converted according to
14274 the integer promotions. Its implementation-defined value shall be equal to or greater in
14275 magnitude (absolute value) than the corresponding value given below, with the same sign,
14276 except where stated to be exactly the given value.
14277 <!--page 310 -->
14279 <h5><a name="7.20.2.1" href="#7.20.2.1">7.20.2.1 Limits of exact-width integer types</a></h5>
14280 <p><!--para 1 -->
14281 <ul>
14282 <li> minimum values of exact-width signed integer types
14283 <pre>
14284 INTN_MIN exactly -(2 N -1 )</pre>
14285 <li> maximum values of exact-width signed integer types
14286 <pre>
14287 INTN_MAX exactly 2 N -1 - 1</pre>
14288 <li> maximum values of exact-width unsigned integer types
14289 UINTN_MAX exactly 2 N - 1
14290 </ul>
14292 <h5><a name="7.20.2.2" href="#7.20.2.2">7.20.2.2 Limits of minimum-width integer types</a></h5>
14293 <p><!--para 1 -->
14294 <ul>
14295 <li> minimum values of minimum-width signed integer types
14296 <pre>
14297 INT_LEASTN_MIN -(2 N -1 - 1)</pre>
14298 <li> maximum values of minimum-width signed integer types
14299 <pre>
14300 INT_LEASTN_MAX 2 N -1 - 1</pre>
14301 <li> maximum values of minimum-width unsigned integer types
14302 UINT_LEASTN_MAX 2N - 1
14303 </ul>
14305 <h5><a name="7.20.2.3" href="#7.20.2.3">7.20.2.3 Limits of fastest minimum-width integer types</a></h5>
14306 <p><!--para 1 -->
14307 <ul>
14308 <li> minimum values of fastest minimum-width signed integer types
14309 <pre>
14310 INT_FASTN_MIN -(2 N -1 - 1)</pre>
14311 <li> maximum values of fastest minimum-width signed integer types
14312 INT_FASTN_MAX 2 N -1 - 1
14313 <li> maximum values of fastest minimum-width unsigned integer types
14314 UINT_FASTN_MAX 2N - 1
14315 </ul>
14317 <h5><a name="7.20.2.4" href="#7.20.2.4">7.20.2.4 Limits of integer types capable of holding object pointers</a></h5>
14318 <p><!--para 1 -->
14319 <ul>
14320 <li> minimum value of pointer-holding signed integer type
14321 <pre>
14322 INTPTR_MIN -(215 - 1)</pre>
14323 <li> maximum value of pointer-holding signed integer type
14324 INTPTR_MAX 215 - 1
14325 <li> maximum value of pointer-holding unsigned integer type
14326 UINTPTR_MAX 216 - 1
14327 <!--page 311 -->
14328 </ul>
14330 <h5><a name="7.20.2.5" href="#7.20.2.5">7.20.2.5 Limits of greatest-width integer types</a></h5>
14331 <p><!--para 1 -->
14332 <ul>
14333 <li> minimum value of greatest-width signed integer type
14334 INTMAX_MIN -(263 - 1)
14335 <li> maximum value of greatest-width signed integer type
14336 INTMAX_MAX 263 - 1
14337 <li> maximum value of greatest-width unsigned integer type
14338 UINTMAX_MAX 264 - 1
14339 </ul>
14341 <h4><a name="7.20.3" href="#7.20.3">7.20.3 Limits of other integer types</a></h4>
14342 <p><!--para 1 -->
14343 The following object-like macros specify the minimum and maximum limits of integer *
14344 types corresponding to types defined in other standard headers.
14345 <p><!--para 2 -->
14346 Each instance of these macros shall be replaced by a constant expression suitable for use
14347 in #if preprocessing directives, and this expression shall have the same type as would an
14348 expression that is an object of the corresponding type converted according to the integer
14349 promotions. Its implementation-defined value shall be equal to or greater in magnitude
14350 (absolute value) than the corresponding value given below, with the same sign. An
14351 implementation shall define only the macros corresponding to those typedef names it
14352 actually provides.<sup><a href="#note256"><b>256)</b></a></sup>
14353 <ul>
14354 <li> limits of ptrdiff_t
14355 PTRDIFF_MIN -65535
14356 PTRDIFF_MAX +65535
14357 <li> limits of sig_atomic_t
14358 SIG_ATOMIC_MIN see below
14359 SIG_ATOMIC_MAX see below
14360 <li> limit of size_t
14361 SIZE_MAX 65535
14362 <li> limits of wchar_t
14363 WCHAR_MIN see below
14364 WCHAR_MAX see below
14365 <li> limits of wint_t
14370 <!--page 312 -->
14371 WINT_MIN see below
14372 WINT_MAX see below
14373 </ul>
14374 <p><!--para 3 -->
14375 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
14376 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
14377 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
14378 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
14379 SIG_ATOMIC_MAX shall be no less than 255.
14380 <p><!--para 4 -->
14381 If wchar_t (see <a href="#7.19">7.19</a>) is defined as a signed integer type, the value of WCHAR_MIN
14382 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
14383 otherwise, wchar_t is defined as an unsigned integer type, and the value of
14384 WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.<sup><a href="#note257"><b>257)</b></a></sup>
14385 <p><!--para 5 -->
14386 If wint_t (see <a href="#7.28">7.28</a>) is defined as a signed integer type, the value of WINT_MIN shall
14387 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
14388 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
14389 shall be 0 and the value of WINT_MAX shall be no less than 65535.
14391 <h6>footnotes</h6>
14392 <p><small><a name="note256" href="#note256">256)</a> A freestanding implementation need not provide all of these types.
14393 </small>
14394 <p><small><a name="note257" href="#note257">257)</a> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
14395 character set.
14396 </small>
14398 <h4><a name="7.20.4" href="#7.20.4">7.20.4 Macros for integer constants</a></h4>
14399 <p><!--para 1 -->
14400 The following function-like macros expand to integer constants suitable for initializing *
14401 objects that have integer types corresponding to types defined in <a href="#7.20">&lt;stdint.h&gt;</a>. Each
14402 macro name corresponds to a similar type name in <a href="#7.20.1.2">7.20.1.2</a> or <a href="#7.20.1.5">7.20.1.5</a>.
14403 <p><!--para 2 -->
14404 The argument in any instance of these macros shall be an unsuffixed integer constant (as
14405 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.
14406 <p><!--para 3 -->
14407 Each invocation of one of these macros shall expand to an integer constant expression
14408 suitable for use in #if preprocessing directives. The type of the expression shall have
14409 the same type as would an expression of the corresponding type converted according to
14410 the integer promotions. The value of the expression shall be that of the argument.
14412 <h5><a name="7.20.4.1" href="#7.20.4.1">7.20.4.1 Macros for minimum-width integer constants</a></h5>
14413 <p><!--para 1 -->
14414 The macro INTN_C(value) shall expand to an integer constant expression
14415 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
14416 to an integer constant expression corresponding to the type uint_leastN_t. For
14417 example, if uint_least64_t is a name for the type unsigned long long int,
14418 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
14423 <!--page 313 -->
14425 <h5><a name="7.20.4.2" href="#7.20.4.2">7.20.4.2 Macros for greatest-width integer constants</a></h5>
14426 <p><!--para 1 -->
14427 The following macro expands to an integer constant expression having the value specified
14428 by its argument and the type intmax_t:
14429 <pre>
14430 INTMAX_C(value)</pre>
14431 The following macro expands to an integer constant expression having the value specified
14432 by its argument and the type uintmax_t:
14433 <!--page 314 -->
14434 <pre>
14435 UINTMAX_C(value)</pre>
14437 <h3><a name="7.21" href="#7.21">7.21 Input/output <stdio.h></a></h3>
14439 <h4><a name="7.21.1" href="#7.21.1">7.21.1 Introduction</a></h4>
14440 <p><!--para 1 -->
14441 The header <a href="#7.21">&lt;stdio.h&gt;</a> defines several macros, and declares three types and many
14442 functions for performing input and output.
14443 <p><!--para 2 -->
14444 The types declared are size_t (described in <a href="#7.19">7.19</a>);
14445 <pre>
14446 FILE</pre>
14447 which is an object type capable of recording all the information needed to control a
14448 stream, including its file position indicator, a pointer to its associated buffer (if any), an
14449 error indicator that records whether a read/write error has occurred, and an end-of-file
14450 indicator that records whether the end of the file has been reached; and
14451 <pre>
14452 fpos_t</pre>
14453 which is a complete object type other than an array type capable of recording all the
14454 information needed to specify uniquely every position within a file.
14455 <p><!--para 3 -->
14456 The macros are NULL (described in <a href="#7.19">7.19</a>);
14457 <pre>
14458 _IOFBF
14459 _IOLBF
14460 _IONBF</pre>
14461 which expand to integer constant expressions with distinct values, suitable for use as the
14462 third argument to the setvbuf function;
14463 <pre>
14464 BUFSIZ</pre>
14465 which expands to an integer constant expression that is the size of the buffer used by the
14466 setbuf function;
14467 <pre>
14468 EOF</pre>
14469 which expands to an integer constant expression, with type int and a negative value, that
14470 is returned by several functions to indicate end-of-file, that is, no more input from a
14471 stream;
14472 <pre>
14473 FOPEN_MAX</pre>
14474 which expands to an integer constant expression that is the minimum number of files that
14475 the implementation guarantees can be open simultaneously;
14476 <pre>
14477 FILENAME_MAX</pre>
14478 which expands to an integer constant expression that is the size needed for an array of
14479 char large enough to hold the longest file name string that the implementation
14480 <!--page 315 -->
14481 guarantees can be opened;<sup><a href="#note258"><b>258)</b></a></sup>
14482 <pre>
14483 L_tmpnam</pre>
14484 which expands to an integer constant expression that is the size needed for an array of
14485 char large enough to hold a temporary file name string generated by the tmpnam
14486 function;
14487 <pre>
14488 SEEK_CUR
14489 SEEK_END
14490 SEEK_SET</pre>
14491 which expand to integer constant expressions with distinct values, suitable for use as the
14492 third argument to the fseek function;
14493 <pre>
14494 TMP_MAX</pre>
14495 which expands to an integer constant expression that is the minimum number of unique
14496 file names that can be generated by the tmpnam function;
14497 <pre>
14498 stderr
14499 stdin
14500 stdout</pre>
14501 which are expressions of type ''pointer to FILE'' that point to the FILE objects
14502 associated, respectively, with the standard error, input, and output streams.
14503 <p><!--para 4 -->
14504 The header <a href="#7.28">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
14505 and output. The wide character input/output functions described in that subclause
14506 provide operations analogous to most of those described here, except that the
14507 fundamental units internal to the program are wide characters. The external
14508 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
14509 described further in <a href="#7.21.3">7.21.3</a>.
14510 <p><!--para 5 -->
14511 The input/output functions are given the following collective terms:
14512 <ul>
14513 <li> The wide character input functions -- those functions described in <a href="#7.28">7.28</a> that perform
14514 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
14515 fwscanf, wscanf, vfwscanf, and vwscanf.
14516 <li> The wide character output functions -- those functions described in <a href="#7.28">7.28</a> that perform
14517 output from wide characters and wide strings: fputwc, fputws, putwc,
14518 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
14521 <!--page 316 -->
14522 <li> The wide character input/output functions -- the union of the ungetwc function, the
14523 wide character input functions, and the wide character output functions.
14524 <li> The byte input/output functions -- those functions described in this subclause that
14525 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
14526 fscanf, fwrite, getc, getchar, printf, putc, putchar, puts, scanf, *
14527 ungetc, vfprintf, vfscanf, vprintf, and vscanf.
14528 </ul>
14529 <p><b> Forward references</b>: files (<a href="#7.21.3">7.21.3</a>), the fseek function (<a href="#7.21.9.2">7.21.9.2</a>), streams (<a href="#7.21.2">7.21.2</a>), the
14530 tmpnam function (<a href="#7.21.4.4">7.21.4.4</a>), <a href="#7.28">&lt;wchar.h&gt;</a> (<a href="#7.28">7.28</a>).
14532 <h6>footnotes</h6>
14533 <p><small><a name="note258" href="#note258">258)</a> If the implementation imposes no practical limit on the length of file name strings, the value of
14534 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
14535 string. Of course, file name string contents are subject to other system-specific constraints; therefore
14536 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
14537 </small>
14539 <h4><a name="7.21.2" href="#7.21.2">7.21.2 Streams</a></h4>
14540 <p><!--para 1 -->
14541 Input and output, whether to or from physical devices such as terminals and tape drives,
14542 or whether to or from files supported on structured storage devices, are mapped into
14543 logical data streams, whose properties are more uniform than their various inputs and
14544 outputs. Two forms of mapping are supported, for text streams and for binary
14545 streams.<sup><a href="#note259"><b>259)</b></a></sup>
14546 <p><!--para 2 -->
14547 A text stream is an ordered sequence of characters composed into lines, each line
14548 consisting of zero or more characters plus a terminating new-line character. Whether the
14549 last line requires a terminating new-line character is implementation-defined. Characters
14550 may have to be added, altered, or deleted on input and output to conform to differing
14551 conventions for representing text in the host environment. Thus, there need not be a one-
14552 to-one correspondence between the characters in a stream and those in the external
14553 representation. Data read in from a text stream will necessarily compare equal to the data
14554 that were earlier written out to that stream only if: the data consist only of printing
14555 characters and the control characters horizontal tab and new-line; no new-line character is
14556 immediately preceded by space characters; and the last character is a new-line character.
14557 Whether space characters that are written out immediately before a new-line character
14558 appear when read in is implementation-defined.
14559 <p><!--para 3 -->
14560 A binary stream is an ordered sequence of characters that can transparently record
14561 internal data. Data read in from a binary stream shall compare equal to the data that were
14562 earlier written out to that stream, under the same implementation. Such a stream may,
14563 however, have an implementation-defined number of null characters appended to the end
14564 of the stream.
14565 <p><!--para 4 -->
14566 Each stream has an orientation. After a stream is associated with an external file, but
14567 before any operations are performed on it, the stream is without orientation. Once a wide
14568 character input/output function has been applied to a stream without orientation, the
14571 <!--page 317 -->
14572 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
14573 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
14574 Only a call to the freopen function or the fwide function can otherwise alter the
14575 orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note260"><b>260)</b></a></sup>
14576 <p><!--para 5 -->
14577 Byte input/output functions shall not be applied to a wide-oriented stream and wide
14578 character input/output functions shall not be applied to a byte-oriented stream. The
14579 remaining stream operations do not affect, and are not affected by, a stream's orientation,
14580 except for the following additional restrictions:
14581 <ul>
14582 <li> Binary wide-oriented streams have the file-positioning restrictions ascribed to both
14583 text and binary streams.
14584 <li> For wide-oriented streams, after a successful call to a file-positioning function that
14585 leaves the file position indicator prior to the end-of-file, a wide character output
14586 function can overwrite a partial multibyte character; any file contents beyond the
14587 byte(s) written are henceforth indeterminate.
14588 </ul>
14589 <p><!--para 6 -->
14590 Each wide-oriented stream has an associated mbstate_t object that stores the current
14591 parse state of the stream. A successful call to fgetpos stores a representation of the
14592 value of this mbstate_t object as part of the value of the fpos_t object. A later
14593 successful call to fsetpos using the same stored fpos_t value restores the value of
14594 the associated mbstate_t object as well as the position within the controlled stream.
14595 <h6>Environmental limits</h6>
14596 <p><!--para 7 -->
14597 An implementation shall support text files with lines containing at least 254 characters,
14598 including the terminating new-line character. The value of the macro BUFSIZ shall be at
14599 least 256.
14600 <p><b> Forward references</b>: the freopen function (<a href="#7.21.5.4">7.21.5.4</a>), the fwide function (<a href="#7.28.3.5">7.28.3.5</a>),
14601 mbstate_t (<a href="#7.29.1">7.29.1</a>), the fgetpos function (<a href="#7.21.9.1">7.21.9.1</a>), the fsetpos function
14602 (<a href="#7.21.9.3">7.21.9.3</a>).
14607 <!--page 318 -->
14609 <h6>footnotes</h6>
14610 <p><small><a name="note259" href="#note259">259)</a> An implementation need not distinguish between text streams and binary streams. In such an
14611 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
14612 line.
14613 </small>
14614 <p><small><a name="note260" href="#note260">260)</a> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
14615 </small>
14617 <h4><a name="7.21.3" href="#7.21.3">7.21.3 Files</a></h4>
14618 <p><!--para 1 -->
14619 A stream is associated with an external file (which may be a physical device) by opening
14620 a file, which may involve creating a new file. Creating an existing file causes its former
14621 contents to be discarded, if necessary. If a file can support positioning requests (such as a
14622 disk file, as opposed to a terminal), then a file position indicator associated with the
14623 stream is positioned at the start (character number zero) of the file, unless the file is
14624 opened with append mode in which case it is implementation-defined whether the file
14625 position indicator is initially positioned at the beginning or the end of the file. The file
14626 position indicator is maintained by subsequent reads, writes, and positioning requests, to
14627 facilitate an orderly progression through the file.
14628 <p><!--para 2 -->
14629 Binary files are not truncated, except as defined in <a href="#7.21.5.3">7.21.5.3</a>. Whether a write on a text
14630 stream causes the associated file to be truncated beyond that point is implementation-
14631 defined.
14632 <p><!--para 3 -->
14633 When a stream is unbuffered, characters are intended to appear from the source or at the
14634 destination as soon as possible. Otherwise characters may be accumulated and
14635 transmitted to or from the host environment as a block. When a stream is fully buffered,
14636 characters are intended to be transmitted to or from the host environment as a block when
14637 a buffer is filled. When a stream is line buffered, characters are intended to be
14638 transmitted to or from the host environment as a block when a new-line character is
14639 encountered. Furthermore, characters are intended to be transmitted as a block to the host
14640 environment when a buffer is filled, when input is requested on an unbuffered stream, or
14641 when input is requested on a line buffered stream that requires the transmission of
14642 characters from the host environment. Support for these characteristics is
14643 implementation-defined, and may be affected via the setbuf and setvbuf functions.
14644 <p><!--para 4 -->
14645 A file may be disassociated from a controlling stream by closing the file. Output streams
14646 are flushed (any unwritten buffer contents are transmitted to the host environment) before
14647 the stream is disassociated from the file. The value of a pointer to a FILE object is
14648 indeterminate after the associated file is closed (including the standard text streams).
14649 Whether a file of zero length (on which no characters have been written by an output
14650 stream) actually exists is implementation-defined.
14651 <p><!--para 5 -->
14652 The file may be subsequently reopened, by the same or another program execution, and
14653 its contents reclaimed or modified (if it can be repositioned at its start). If the main
14654 function returns to its original caller, or if the exit function is called, all open files are
14655 closed (hence all output streams are flushed) before program termination. Other paths to
14656 program termination, such as calling the abort function, need not close all files
14657 properly.
14658 <p><!--para 6 -->
14659 The address of the FILE object used to control a stream may be significant; a copy of a
14660 FILE object need not serve in place of the original.
14661 <!--page 319 -->
14662 <p><!--para 7 -->
14663 At program startup, three text streams are predefined and need not be opened explicitly
14664 <ul>
14665 <li> standard input (for reading conventional input), standard output (for writing
14666 </ul>
14667 conventional output), and standard error (for writing diagnostic output). As initially
14668 opened, the standard error stream is not fully buffered; the standard input and standard
14669 output streams are fully buffered if and only if the stream can be determined not to refer
14670 to an interactive device.
14671 <p><!--para 8 -->
14672 Functions that open additional (nontemporary) files require a file name, which is a string.
14673 The rules for composing valid file names are implementation-defined. Whether the same
14674 file can be simultaneously open multiple times is also implementation-defined.
14675 <p><!--para 9 -->
14676 Although both text and binary wide-oriented streams are conceptually sequences of wide
14677 characters, the external file associated with a wide-oriented stream is a sequence of
14678 multibyte characters, generalized as follows:
14679 <ul>
14680 <li> Multibyte encodings within files may contain embedded null bytes (unlike multibyte
14681 encodings valid for use internal to the program).
14682 <li> A file need not begin nor end in the initial shift state.<sup><a href="#note261"><b>261)</b></a></sup>
14683 </ul>
14684 <p><!--para 10 -->
14685 Moreover, the encodings used for multibyte characters may differ among files. Both the
14686 nature and choice of such encodings are implementation-defined.
14687 <p><!--para 11 -->
14688 The wide character input functions read multibyte characters from the stream and convert
14689 them to wide characters as if they were read by successive calls to the fgetwc function.
14690 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
14691 described by the stream's own mbstate_t object. The byte input functions read
14692 characters from the stream as if by successive calls to the fgetc function.
14693 <p><!--para 12 -->
14694 The wide character output functions convert wide characters to multibyte characters and
14695 write them to the stream as if they were written by successive calls to the fputwc
14696 function. Each conversion occurs as if by a call to the wcrtomb function, with the
14697 conversion state described by the stream's own mbstate_t object. The byte output
14698 functions write characters to the stream as if by successive calls to the fputc function.
14699 <p><!--para 13 -->
14700 In some cases, some of the byte input/output functions also perform conversions between
14701 multibyte characters and wide characters. These conversions also occur as if by calls to
14702 the mbrtowc and wcrtomb functions.
14703 <p><!--para 14 -->
14704 An encoding error occurs if the character sequence presented to the underlying
14705 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
14706 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
14709 <!--page 320 -->
14710 multibyte character. The wide character input/output functions and the byte input/output
14711 functions store the value of the macro EILSEQ in errno if and only if an encoding error
14712 occurs.
14713 <h6>Environmental limits</h6>
14714 <p><!--para 15 -->
14715 The value of FOPEN_MAX shall be at least eight, including the three standard text
14716 streams.
14717 <p><b> Forward references</b>: the exit function (<a href="#7.22.4.4">7.22.4.4</a>), the fgetc function (<a href="#7.21.7.1">7.21.7.1</a>), the
14718 fopen function (<a href="#7.21.5.3">7.21.5.3</a>), the fputc function (<a href="#7.21.7.3">7.21.7.3</a>), the setbuf function
14719 (<a href="#7.21.5.5">7.21.5.5</a>), the setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>), the fgetwc function (<a href="#7.28.3.1">7.28.3.1</a>), the
14720 fputwc function (<a href="#7.28.3.3">7.28.3.3</a>), conversion state (<a href="#7.28.6">7.28.6</a>), the mbrtowc function
14721 (<a href="#7.28.6.3.2">7.28.6.3.2</a>), the wcrtomb function (<a href="#7.28.6.3.3">7.28.6.3.3</a>).
14723 <h6>footnotes</h6>
14724 <p><small><a name="note261" href="#note261">261)</a> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
14725 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
14726 with state-dependent encoding that does not assuredly end in the initial shift state.
14727 </small>
14729 <h4><a name="7.21.4" href="#7.21.4">7.21.4 Operations on files</a></h4>
14731 <h5><a name="7.21.4.1" href="#7.21.4.1">7.21.4.1 The remove function</a></h5>
14732 <h6>Synopsis</h6>
14733 <p><!--para 1 -->
14734 <pre>
14735 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14736 int remove(const char *filename);</pre>
14737 <h6>Description</h6>
14738 <p><!--para 2 -->
14739 The remove function causes the file whose name is the string pointed to by filename
14740 to be no longer accessible by that name. A subsequent attempt to open that file using that
14741 name will fail, unless it is created anew. If the file is open, the behavior of the remove
14742 function is implementation-defined.
14743 <h6>Returns</h6>
14744 <p><!--para 3 -->
14745 The remove function returns zero if the operation succeeds, nonzero if it fails.
14747 <h5><a name="7.21.4.2" href="#7.21.4.2">7.21.4.2 The rename function</a></h5>
14748 <h6>Synopsis</h6>
14749 <p><!--para 1 -->
14750 <pre>
14751 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14752 int rename(const char *old, const char *new);</pre>
14753 <h6>Description</h6>
14754 <p><!--para 2 -->
14755 The rename function causes the file whose name is the string pointed to by old to be
14756 henceforth known by the name given by the string pointed to by new. The file named
14757 old is no longer accessible by that name. If a file named by the string pointed to by new
14758 exists prior to the call to the rename function, the behavior is implementation-defined.
14759 <!--page 321 -->
14760 <h6>Returns</h6>
14761 <p><!--para 3 -->
14762 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note262"><b>262)</b></a></sup> in
14763 which case if the file existed previously it is still known by its original name.
14765 <h6>footnotes</h6>
14766 <p><small><a name="note262" href="#note262">262)</a> Among the reasons the implementation may cause the rename function to fail are that the file is open
14767 or that it is necessary to copy its contents to effectuate its renaming.
14768 </small>
14770 <h5><a name="7.21.4.3" href="#7.21.4.3">7.21.4.3 The tmpfile function</a></h5>
14771 <h6>Synopsis</h6>
14772 <p><!--para 1 -->
14773 <pre>
14774 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14775 FILE *tmpfile(void);</pre>
14776 <h6>Description</h6>
14777 <p><!--para 2 -->
14778 The tmpfile function creates a temporary binary file that is different from any other
14779 existing file and that will automatically be removed when it is closed or at program
14780 termination. If the program terminates abnormally, whether an open temporary file is
14781 removed is implementation-defined. The file is opened for update with "wb+" mode.
14782 <h6>Recommended practice</h6>
14783 <p><!--para 3 -->
14784 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
14785 program (this limit may be shared with tmpnam) and there should be no limit on the
14786 number simultaneously open other than this limit and any limit on the number of open
14787 files (FOPEN_MAX).
14788 <h6>Returns</h6>
14789 <p><!--para 4 -->
14790 The tmpfile function returns a pointer to the stream of the file that it created. If the file
14791 cannot be created, the tmpfile function returns a null pointer.
14792 <p><b> Forward references</b>: the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
14794 <h5><a name="7.21.4.4" href="#7.21.4.4">7.21.4.4 The tmpnam function</a></h5>
14795 <h6>Synopsis</h6>
14796 <p><!--para 1 -->
14797 <pre>
14798 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14799 char *tmpnam(char *s);</pre>
14800 <h6>Description</h6>
14801 <p><!--para 2 -->
14802 The tmpnam function generates a string that is a valid file name and that is not the same
14803 as the name of an existing file.<sup><a href="#note263"><b>263)</b></a></sup> The function is potentially capable of generating at
14806 <!--page 322 -->
14807 least TMP_MAX different strings, but any or all of them may already be in use by existing
14808 files and thus not be suitable return values.
14809 <p><!--para 3 -->
14810 The tmpnam function generates a different string each time it is called.
14811 <p><!--para 4 -->
14812 Calls to the tmpnam function with a null pointer argument may introduce data races with
14813 each other. The implementation shall behave as if no library function calls the tmpnam
14814 function.
14815 <h6>Returns</h6>
14816 <p><!--para 5 -->
14817 If no suitable string can be generated, the tmpnam function returns a null pointer.
14818 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
14819 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
14820 function may modify the same object). If the argument is not a null pointer, it is assumed
14821 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
14822 in that array and returns the argument as its value.
14823 <h6>Environmental limits</h6>
14824 <p><!--para 6 -->
14825 The value of the macro TMP_MAX shall be at least 25.
14827 <h6>footnotes</h6>
14828 <p><small><a name="note263" href="#note263">263)</a> Files created using strings generated by the tmpnam function are temporary only in the sense that
14829 their names should not collide with those generated by conventional naming rules for the
14830 implementation. It is still necessary to use the remove function to remove such files when their use
14831 is ended, and before program termination.
14832 </small>
14834 <h4><a name="7.21.5" href="#7.21.5">7.21.5 File access functions</a></h4>
14836 <h5><a name="7.21.5.1" href="#7.21.5.1">7.21.5.1 The fclose function</a></h5>
14837 <h6>Synopsis</h6>
14838 <p><!--para 1 -->
14839 <pre>
14840 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14841 int fclose(FILE *stream);</pre>
14842 <h6>Description</h6>
14843 <p><!--para 2 -->
14844 A successful call to the fclose function causes the stream pointed to by stream to be
14845 flushed and the associated file to be closed. Any unwritten buffered data for the stream
14846 are delivered to the host environment to be written to the file; any unread buffered data
14847 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
14848 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
14849 (and deallocated if it was automatically allocated).
14850 <h6>Returns</h6>
14851 <p><!--para 3 -->
14852 The fclose function returns zero if the stream was successfully closed, or EOF if any
14853 errors were detected.
14854 <!--page 323 -->
14856 <h5><a name="7.21.5.2" href="#7.21.5.2">7.21.5.2 The fflush function</a></h5>
14857 <h6>Synopsis</h6>
14858 <p><!--para 1 -->
14859 <pre>
14860 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14861 int fflush(FILE *stream);</pre>
14862 <h6>Description</h6>
14863 <p><!--para 2 -->
14864 If stream points to an output stream or an update stream in which the most recent
14865 operation was not input, the fflush function causes any unwritten data for that stream
14866 to be delivered to the host environment to be written to the file; otherwise, the behavior is
14867 undefined.
14868 <p><!--para 3 -->
14869 If stream is a null pointer, the fflush function performs this flushing action on all
14870 streams for which the behavior is defined above.
14871 <h6>Returns</h6>
14872 <p><!--para 4 -->
14873 The fflush function sets the error indicator for the stream and returns EOF if a write
14874 error occurs, otherwise it returns zero.
14875 <p><b> Forward references</b>: the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
14877 <h5><a name="7.21.5.3" href="#7.21.5.3">7.21.5.3 The fopen function</a></h5>
14878 <h6>Synopsis</h6>
14879 <p><!--para 1 -->
14880 <pre>
14881 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14882 FILE *fopen(const char * restrict filename,
14883 const char * restrict mode);</pre>
14884 <h6>Description</h6>
14885 <p><!--para 2 -->
14886 The fopen function opens the file whose name is the string pointed to by filename,
14887 and associates a stream with it.
14888 <p><!--para 3 -->
14889 The argument mode points to a string. If the string is one of the following, the file is
14890 open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note264"><b>264)</b></a></sup>
14891 r open text file for reading
14892 w truncate to zero length or create text file for writing
14893 wx create text file for writing
14894 a append; open or create text file for writing at end-of-file
14895 rb open binary file for reading
14896 wb truncate to zero length or create binary file for writing
14899 <!--page 324 -->
14900 wbx create binary file for writing
14901 ab append; open or create binary file for writing at end-of-file
14902 r+ open text file for update (reading and writing)
14903 w+ truncate to zero length or create text file for update
14904 w+x create text file for update
14905 a+ append; open or create text file for update, writing at end-of-file
14906 r+b or rb+ open binary file for update (reading and writing)
14907 w+b or wb+ truncate to zero length or create binary file for update
14908 w+bx or wb+x create binary file for update
14909 a+b or ab+ append; open or create binary file for update, writing at end-of-file
14910 <p><!--para 4 -->
14911 Opening a file with read mode ('r' as the first character in the mode argument) fails if
14912 the file does not exist or cannot be read.
14913 <p><!--para 5 -->
14914 Opening a file with exclusive mode ('x' as the last character in the mode argument)
14915 fails if the file already exists or cannot be created. Otherwise, the file is created with
14916 exclusive (also known as non-shared) access to the extent that the underlying system
14917 supports exclusive access.
14918 <p><!--para 6 -->
14919 Opening a file with append mode ('a' as the first character in the mode argument)
14920 causes all subsequent writes to the file to be forced to the then current end-of-file,
14921 regardless of intervening calls to the fseek function. In some implementations, opening
14922 a binary file with append mode ('b' as the second or third character in the above list of
14923 mode argument values) may initially position the file position indicator for the stream
14924 beyond the last data written, because of null character padding.
14925 <p><!--para 7 -->
14926 When a file is opened with update mode ('+' as the second or third character in the
14927 above list of mode argument values), both input and output may be performed on the
14928 associated stream. However, output shall not be directly followed by input without an
14929 intervening call to the fflush function or to a file positioning function (fseek,
14930 fsetpos, or rewind), and input shall not be directly followed by output without an
14931 intervening call to a file positioning function, unless the input operation encounters end-
14932 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
14933 binary stream in some implementations.
14934 <p><!--para 8 -->
14935 When opened, a stream is fully buffered if and only if it can be determined not to refer to
14936 an interactive device. The error and end-of-file indicators for the stream are cleared.
14937 <h6>Returns</h6>
14938 <p><!--para 9 -->
14939 The fopen function returns a pointer to the object controlling the stream. If the open
14940 operation fails, fopen returns a null pointer.
14941 <p><b> Forward references</b>: file positioning functions (<a href="#7.21.9">7.21.9</a>).
14942 <!--page 325 -->
14944 <h6>footnotes</h6>
14945 <p><small><a name="note264" href="#note264">264)</a> If the string begins with one of the above sequences, the implementation might choose to ignore the
14946 remaining characters, or it might use them to select different kinds of a file (some of which might not
14947 conform to the properties in <a href="#7.21.2">7.21.2</a>).
14948 </small>
14950 <h5><a name="7.21.5.4" href="#7.21.5.4">7.21.5.4 The freopen function</a></h5>
14951 <h6>Synopsis</h6>
14952 <p><!--para 1 -->
14953 <pre>
14954 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14955 FILE *freopen(const char * restrict filename,
14956 const char * restrict mode,
14957 FILE * restrict stream);</pre>
14958 <h6>Description</h6>
14959 <p><!--para 2 -->
14960 The freopen function opens the file whose name is the string pointed to by filename
14961 and associates the stream pointed to by stream with it. The mode argument is used just
14962 as in the fopen function.<sup><a href="#note265"><b>265)</b></a></sup>
14963 <p><!--para 3 -->
14964 If filename is a null pointer, the freopen function attempts to change the mode of
14965 the stream to that specified by mode, as if the name of the file currently associated with
14966 the stream had been used. It is implementation-defined which changes of mode are
14967 permitted (if any), and under what circumstances.
14968 <p><!--para 4 -->
14969 The freopen function first attempts to close any file that is associated with the specified
14970 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
14971 stream are cleared.
14972 <h6>Returns</h6>
14973 <p><!--para 5 -->
14974 The freopen function returns a null pointer if the open operation fails. Otherwise,
14975 freopen returns the value of stream.
14977 <h6>footnotes</h6>
14978 <p><small><a name="note265" href="#note265">265)</a> The primary use of the freopen function is to change the file associated with a standard text stream
14979 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
14980 returned by the fopen function may be assigned.
14981 </small>
14983 <h5><a name="7.21.5.5" href="#7.21.5.5">7.21.5.5 The setbuf function</a></h5>
14984 <h6>Synopsis</h6>
14985 <p><!--para 1 -->
14986 <pre>
14987 #include <a href="#7.21">&lt;stdio.h&gt;</a>
14988 void setbuf(FILE * restrict stream,
14989 char * restrict buf);</pre>
14990 <h6>Description</h6>
14991 <p><!--para 2 -->
14992 Except that it returns no value, the setbuf function is equivalent to the setvbuf
14993 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
14994 is a null pointer), with the value _IONBF for mode.
14999 <!--page 326 -->
15000 <h6>Returns</h6>
15001 <p><!--para 3 -->
15002 The setbuf function returns no value.
15003 <p><b> Forward references</b>: the setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>).
15005 <h5><a name="7.21.5.6" href="#7.21.5.6">7.21.5.6 The setvbuf function</a></h5>
15006 <h6>Synopsis</h6>
15007 <p><!--para 1 -->
15008 <pre>
15009 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15010 int setvbuf(FILE * restrict stream,
15011 char * restrict buf,
15012 int mode, size_t size);</pre>
15013 <h6>Description</h6>
15014 <p><!--para 2 -->
15015 The setvbuf function may be used only after the stream pointed to by stream has
15016 been associated with an open file and before any other operation (other than an
15017 unsuccessful call to setvbuf) is performed on the stream. The argument mode
15018 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
15019 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
15020 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
15021 used instead of a buffer allocated by the setvbuf function<sup><a href="#note266"><b>266)</b></a></sup> and the argument size
15022 specifies the size of the array; otherwise, size may determine the size of a buffer
15023 allocated by the setvbuf function. The contents of the array at any time are
15024 indeterminate.
15025 <h6>Returns</h6>
15026 <p><!--para 3 -->
15027 The setvbuf function returns zero on success, or nonzero if an invalid value is given
15028 for mode or if the request cannot be honored.
15033 <!--page 327 -->
15035 <h6>footnotes</h6>
15036 <p><small><a name="note266" href="#note266">266)</a> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
15037 before a buffer that has automatic storage duration is deallocated upon block exit.
15038 </small>
15040 <h4><a name="7.21.6" href="#7.21.6">7.21.6 Formatted input/output functions</a></h4>
15041 <p><!--para 1 -->
15042 The formatted input/output functions shall behave as if there is a sequence point after the
15043 actions associated with each specifier.<sup><a href="#note267"><b>267)</b></a></sup>
15045 <h6>footnotes</h6>
15046 <p><small><a name="note267" href="#note267">267)</a> The fprintf functions perform writes to memory for the %n specifier.
15047 </small>
15049 <h5><a name="7.21.6.1" href="#7.21.6.1">7.21.6.1 The fprintf function</a></h5>
15050 <h6>Synopsis</h6>
15051 <p><!--para 1 -->
15052 <pre>
15053 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15054 int fprintf(FILE * restrict stream,
15055 const char * restrict format, ...);</pre>
15056 <h6>Description</h6>
15057 <p><!--para 2 -->
15058 The fprintf function writes output to the stream pointed to by stream, under control
15059 of the string pointed to by format that specifies how subsequent arguments are
15060 converted for output. If there are insufficient arguments for the format, the behavior is
15061 undefined. If the format is exhausted while arguments remain, the excess arguments are
15062 evaluated (as always) but are otherwise ignored. The fprintf function returns when
15063 the end of the format string is encountered.
15064 <p><!--para 3 -->
15065 The format shall be a multibyte character sequence, beginning and ending in its initial
15066 shift state. The format is composed of zero or more directives: ordinary multibyte
15067 characters (not %), which are copied unchanged to the output stream; and conversion
15068 specifications, each of which results in fetching zero or more subsequent arguments,
15069 converting them, if applicable, according to the corresponding conversion specifier, and
15070 then writing the result to the output stream.
15071 <p><!--para 4 -->
15072 Each conversion specification is introduced by the character %. After the %, the following
15073 appear in sequence:
15074 <ul>
15075 <li> Zero or more flags (in any order) that modify the meaning of the conversion
15076 specification.
15077 <li> An optional minimum field width. If the converted value has fewer characters than the
15078 field width, it is padded with spaces (by default) on the left (or right, if the left
15079 adjustment flag, described later, has been given) to the field width. The field width
15080 takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note268"><b>268)</b></a></sup>
15081 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
15082 o, u, x, and X conversions, the number of digits to appear after the decimal-point
15083 character for a, A, e, E, f, and F conversions, the maximum number of significant
15084 digits for the g and G conversions, or the maximum number of bytes to be written for
15087 <!--page 328 -->
15088 s conversions. The precision takes the form of a period (.) followed either by an
15089 asterisk * (described later) or by an optional decimal integer; if only the period is
15090 specified, the precision is taken as zero. If a precision appears with any other
15091 conversion specifier, the behavior is undefined.
15092 <li> An optional length modifier that specifies the size of the argument.
15093 <li> A conversion specifier character that specifies the type of conversion to be applied.
15094 </ul>
15095 <p><!--para 5 -->
15096 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
15097 this case, an int argument supplies the field width or precision. The arguments
15098 specifying field width, or precision, or both, shall appear (in that order) before the
15099 argument (if any) to be converted. A negative field width argument is taken as a - flag
15100 followed by a positive field width. A negative precision argument is taken as if the
15101 precision were omitted.
15102 <p><!--para 6 -->
15103 The flag characters and their meanings are:
15104 - The result of the conversion is left-justified within the field. (It is right-justified if
15105 <pre>
15106 this flag is not specified.)</pre>
15107 + The result of a signed conversion always begins with a plus or minus sign. (It
15108 <pre>
15109 begins with a sign only when a negative value is converted if this flag is not
15110 specified.)<sup><a href="#note269"><b>269)</b></a></sup></pre>
15111 space If the first character of a signed conversion is not a sign, or if a signed conversion
15112 <pre>
15113 results in no characters, a space is prefixed to the result. If the space and + flags
15114 both appear, the space flag is ignored.</pre>
15115 # The result is converted to an ''alternative form''. For o conversion, it increases
15116 <pre>
15117 the precision, if and only if necessary, to force the first digit of the result to be a
15118 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
15119 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
15120 and G conversions, the result of converting a floating-point number always
15121 contains a decimal-point character, even if no digits follow it. (Normally, a
15122 decimal-point character appears in the result of these conversions only if a digit
15123 follows it.) For g and G conversions, trailing zeros are not removed from the
15124 result. For other conversions, the behavior is undefined.</pre>
15125 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
15126 <pre>
15127 (following any indication of sign or base) are used to pad to the field width rather
15128 than performing space padding, except when converting an infinity or NaN. If the
15129 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X</pre>
15132 <!--page 329 -->
15133 <p><!--para 7 -->
15134 <pre>
15135 conversions, if a precision is specified, the 0 flag is ignored. For other
15136 conversions, the behavior is undefined.</pre>
15137 The length modifiers and their meanings are:
15138 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15139 <pre>
15140 signed char or unsigned char argument (the argument will have
15141 been promoted according to the integer promotions, but its value shall be
15142 converted to signed char or unsigned char before printing); or that
15143 a following n conversion specifier applies to a pointer to a signed char
15144 argument.</pre>
15145 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15146 <pre>
15147 short int or unsigned short int argument (the argument will
15148 have been promoted according to the integer promotions, but its value shall
15149 be converted to short int or unsigned short int before printing);
15150 or that a following n conversion specifier applies to a pointer to a short
15151 int argument.</pre>
15152 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15153 <pre>
15154 long int or unsigned long int argument; that a following n
15155 conversion specifier applies to a pointer to a long int argument; that a
15156 following c conversion specifier applies to a wint_t argument; that a
15157 following s conversion specifier applies to a pointer to a wchar_t
15158 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
15159 specifier.</pre>
15160 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15161 <pre>
15162 long long int or unsigned long long int argument; or that a
15163 following n conversion specifier applies to a pointer to a long long int
15164 argument.</pre>
15165 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
15166 <pre>
15167 an intmax_t or uintmax_t argument; or that a following n conversion
15168 specifier applies to a pointer to an intmax_t argument.</pre>
15169 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15170 <pre>
15171 size_t or the corresponding signed integer type argument; or that a
15172 following n conversion specifier applies to a pointer to a signed integer type
15173 corresponding to size_t argument.</pre>
15174 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15175 <!--page 330 -->
15176 <pre>
15177 ptrdiff_t or the corresponding unsigned integer type argument; or that a
15178 following n conversion specifier applies to a pointer to a ptrdiff_t
15179 argument.</pre>
15180 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
15181 <pre>
15182 applies to a long double argument.</pre>
15183 If a length modifier appears with any conversion specifier other than as specified above,
15184 the behavior is undefined.
15185 <p><!--para 8 -->
15186 The conversion specifiers and their meanings are:
15187 d,i The int argument is converted to signed decimal in the style [-]dddd. The
15188 <pre>
15189 precision specifies the minimum number of digits to appear; if the value
15190 being converted can be represented in fewer digits, it is expanded with
15191 leading zeros. The default precision is 1. The result of converting a zero
15192 value with a precision of zero is no characters.</pre>
15193 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
15194 <pre>
15195 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
15196 letters abcdef are used for x conversion and the letters ABCDEF for X
15197 conversion. The precision specifies the minimum number of digits to appear;
15198 if the value being converted can be represented in fewer digits, it is expanded
15199 with leading zeros. The default precision is 1. The result of converting a
15200 zero value with a precision of zero is no characters.</pre>
15201 f,F A double argument representing a floating-point number is converted to
15202 <pre>
15203 decimal notation in the style [-]ddd.ddd, where the number of digits after
15204 the decimal-point character is equal to the precision specification. If the
15205 precision is missing, it is taken as 6; if the precision is zero and the # flag is
15206 not specified, no decimal-point character appears. If a decimal-point
15207 character appears, at least one digit appears before it. The value is rounded to
15208 the appropriate number of digits.
15209 A double argument representing an infinity is converted in one of the styles
15210 [-]inf or [-]infinity -- which style is implementation-defined. A
15211 double argument representing a NaN is converted in one of the styles
15212 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
15213 any n-char-sequence, is implementation-defined. The F conversion specifier
15214 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
15215 respectively.<sup><a href="#note270"><b>270)</b></a></sup></pre>
15216 e,E A double argument representing a floating-point number is converted in the
15217 <pre>
15218 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
15219 argument is nonzero) before the decimal-point character and the number of
15220 digits after it is equal to the precision; if the precision is missing, it is taken as</pre>
15223 <!--page 331 -->
15224 <pre>
15225 6; if the precision is zero and the # flag is not specified, no decimal-point
15226 character appears. The value is rounded to the appropriate number of digits.
15227 The E conversion specifier produces a number with E instead of e
15228 introducing the exponent. The exponent always contains at least two digits,
15229 and only as many more digits as necessary to represent the exponent. If the
15230 value is zero, the exponent is zero.
15231 A double argument representing an infinity or NaN is converted in the style
15232 of an f or F conversion specifier.</pre>
15233 g,G A double argument representing a floating-point number is converted in
15234 <pre>
15235 style f or e (or in style F or E in the case of a G conversion specifier),
15236 depending on the value converted and the precision. Let P equal the
15237 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
15238 Then, if a conversion with style E would have an exponent of X:
15239 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
15240 P - (X + 1).
15241 -- otherwise, the conversion is with style e (or E) and precision P - 1.
15242 Finally, unless the # flag is used, any trailing zeros are removed from the
15243 fractional portion of the result and the decimal-point character is removed if
15244 there is no fractional portion remaining.
15245 A double argument representing an infinity or NaN is converted in the style
15246 of an f or F conversion specifier.</pre>
15247 a,A A double argument representing a floating-point number is converted in the
15248 <pre>
15249 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
15250 nonzero if the argument is a normalized floating-point number and is
15251 otherwise unspecified) before the decimal-point character<sup><a href="#note271"><b>271)</b></a></sup> and the number
15252 of hexadecimal digits after it is equal to the precision; if the precision is
15253 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
15254 an exact representation of the value; if the precision is missing and
15255 FLT_RADIX is not a power of 2, then the precision is sufficient to</pre>
15260 <!--page 332 -->
15261 <pre>
15262 distinguish<sup><a href="#note272"><b>272)</b></a></sup> values of type double, except that trailing zeros may be
15263 omitted; if the precision is zero and the # flag is not specified, no decimal-
15264 point character appears. The letters abcdef are used for a conversion and
15265 the letters ABCDEF for A conversion. The A conversion specifier produces a
15266 number with X and P instead of x and p. The exponent always contains at
15267 least one digit, and only as many more digits as necessary to represent the
15268 decimal exponent of 2. If the value is zero, the exponent is zero.
15269 A double argument representing an infinity or NaN is converted in the style
15270 of an f or F conversion specifier.</pre>
15271 c If no l length modifier is present, the int argument is converted to an
15272 <pre>
15273 unsigned char, and the resulting character is written.
15274 If an l length modifier is present, the wint_t argument is converted as if by
15275 an ls conversion specification with no precision and an argument that points
15276 to the initial element of a two-element array of wchar_t, the first element
15277 containing the wint_t argument to the lc conversion specification and the
15278 second a null wide character.</pre>
15279 s If no l length modifier is present, the argument shall be a pointer to the initial
15280 <pre>
15281 element of an array of character type.<sup><a href="#note273"><b>273)</b></a></sup> Characters from the array are
15282 written up to (but not including) the terminating null character. If the
15283 precision is specified, no more than that many bytes are written. If the
15284 precision is not specified or is greater than the size of the array, the array shall
15285 contain a null character.
15286 If an l length modifier is present, the argument shall be a pointer to the initial
15287 element of an array of wchar_t type. Wide characters from the array are
15288 converted to multibyte characters (each as if by a call to the wcrtomb
15289 function, with the conversion state described by an mbstate_t object
15290 initialized to zero before the first wide character is converted) up to and
15291 including a terminating null wide character. The resulting multibyte
15292 characters are written up to (but not including) the terminating null character
15293 (byte). If no precision is specified, the array shall contain a null wide
15294 character. If a precision is specified, no more than that many bytes are
15295 written (including shift sequences, if any), and the array shall contain a null
15296 wide character if, to equal the multibyte character sequence length given by</pre>
15298 <!--page 333 -->
15299 <pre>
15300 the precision, the function would need to access a wide character one past the
15301 end of the array. In no case is a partial multibyte character written.<sup><a href="#note274"><b>274)</b></a></sup></pre>
15302 p The argument shall be a pointer to void. The value of the pointer is
15303 <pre>
15304 converted to a sequence of printing characters, in an implementation-defined
15305 manner.</pre>
15306 n The argument shall be a pointer to signed integer into which is written the
15307 <pre>
15308 number of characters written to the output stream so far by this call to
15309 fprintf. No argument is converted, but one is consumed. If the conversion
15310 specification includes any flags, a field width, or a precision, the behavior is
15311 undefined.</pre>
15312 % A % character is written. No argument is converted. The complete
15313 <p><!--para 9 -->
15314 <pre>
15315 conversion specification shall be %%.</pre>
15316 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note275"><b>275)</b></a></sup> If any argument is
15317 not the correct type for the corresponding conversion specification, the behavior is
15318 undefined.
15319 <p><!--para 10 -->
15320 In no case does a nonexistent or small field width cause truncation of a field; if the result
15321 of a conversion is wider than the field width, the field is expanded to contain the
15322 conversion result.
15323 <p><!--para 11 -->
15324 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
15325 to a hexadecimal floating number with the given precision.
15326 <h6>Recommended practice</h6>
15327 <p><!--para 12 -->
15328 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
15329 representable in the given precision, the result should be one of the two adjacent numbers
15330 in hexadecimal floating style with the given precision, with the extra stipulation that the
15331 error should have a correct sign for the current rounding direction.
15332 <p><!--para 13 -->
15333 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
15334 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note276"><b>276)</b></a></sup> If the number of
15335 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
15336 representable with DECIMAL_DIG digits, then the result should be an exact
15337 representation with trailing zeros. Otherwise, the source value is bounded by two
15338 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
15341 <!--page 334 -->
15342 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
15343 the error should have a correct sign for the current rounding direction.
15344 <h6>Returns</h6>
15345 <p><!--para 14 -->
15346 The fprintf function returns the number of characters transmitted, or a negative value
15347 if an output or encoding error occurred.
15348 <h6>Environmental limits</h6>
15349 <p><!--para 15 -->
15350 The number of characters that can be produced by any single conversion shall be at least
15351 4095.
15352 <p><!--para 16 -->
15353 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
15354 places:
15355 <pre>
15356 #include <a href="#7.12">&lt;math.h&gt;</a>
15357 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15358 /* ... */
15359 char *weekday, *month; // pointers to strings
15360 int day, hour, min;
15361 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
15362 weekday, month, day, hour, min);
15363 fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));</pre>
15365 <p><!--para 17 -->
15366 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
15367 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
15368 the first of which is denoted here by a and the second by an uppercase letter.
15369 <p><!--para 18 -->
15370 Given the following wide string with length seven,
15371 <pre>
15372 static wchar_t wstr[] = L" X Yabc Z W";</pre>
15373 the seven calls
15374 <pre>
15375 fprintf(stdout, "|1234567890123|\n");
15376 fprintf(stdout, "|%13ls|\n", wstr);
15377 fprintf(stdout, "|%-13.9ls|\n", wstr);
15378 fprintf(stdout, "|%13.10ls|\n", wstr);
15379 fprintf(stdout, "|%13.11ls|\n", wstr);
15380 fprintf(stdout, "|%13.15ls|\n", &amp;wstr[2]);
15381 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);</pre>
15382 will print the following seven lines:
15383 <pre>
15384 |1234567890123|
15385 | X Yabc Z W|
15386 | X Yabc Z |
15387 | X Yabc Z|
15388 | X Yabc Z W|
15389 | abc Z W|
15390 | Z|</pre>
15392 <p><b> Forward references</b>: conversion state (<a href="#7.28.6">7.28.6</a>), the wcrtomb function (<a href="#7.28.6.3.3">7.28.6.3.3</a>).
15393 <!--page 335 -->
15395 <h6>footnotes</h6>
15396 <p><small><a name="note268" href="#note268">268)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
15397 </small>
15398 <p><small><a name="note269" href="#note269">269)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
15399 include a minus sign.
15400 </small>
15401 <p><small><a name="note270" href="#note270">270)</a> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
15402 the # and 0 flag characters have no effect.
15403 </small>
15404 <p><small><a name="note271" href="#note271">271)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
15405 that subsequent digits align to nibble (4-bit) boundaries.
15406 </small>
15407 <p><small><a name="note272" href="#note272">272)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
15408 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
15409 might suffice depending on the implementation's scheme for determining the digit to the left of the
15410 decimal-point character.
15411 </small>
15412 <p><small><a name="note273" href="#note273">273)</a> No special provisions are made for multibyte characters.
15413 </small>
15414 <p><small><a name="note274" href="#note274">274)</a> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
15415 </small>
15416 <p><small><a name="note275" href="#note275">275)</a> See ''future library directions'' (<a href="#7.30.9">7.30.9</a>).
15417 </small>
15418 <p><small><a name="note276" href="#note276">276)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
15419 given format specifier. The number of significant digits is determined by the format specifier, and in
15420 the case of fixed-point conversion by the source value as well.
15421 </small>
15423 <h5><a name="7.21.6.2" href="#7.21.6.2">7.21.6.2 The fscanf function</a></h5>
15424 <h6>Synopsis</h6>
15425 <p><!--para 1 -->
15426 <pre>
15427 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15428 int fscanf(FILE * restrict stream,
15429 const char * restrict format, ...);</pre>
15430 <h6>Description</h6>
15431 <p><!--para 2 -->
15432 The fscanf function reads input from the stream pointed to by stream, under control
15433 of the string pointed to by format that specifies the admissible input sequences and how
15434 they are to be converted for assignment, using subsequent arguments as pointers to the
15435 objects to receive the converted input. If there are insufficient arguments for the format,
15436 the behavior is undefined. If the format is exhausted while arguments remain, the excess
15437 arguments are evaluated (as always) but are otherwise ignored.
15438 <p><!--para 3 -->
15439 The format shall be a multibyte character sequence, beginning and ending in its initial
15440 shift state. The format is composed of zero or more directives: one or more white-space
15441 characters, an ordinary multibyte character (neither % nor a white-space character), or a
15442 conversion specification. Each conversion specification is introduced by the character %.
15443 After the %, the following appear in sequence:
15444 <ul>
15445 <li> An optional assignment-suppressing character *.
15446 <li> An optional decimal integer greater than zero that specifies the maximum field width
15447 (in characters).
15448 <li> An optional length modifier that specifies the size of the receiving object.
15449 <li> A conversion specifier character that specifies the type of conversion to be applied.
15450 </ul>
15451 <p><!--para 4 -->
15452 The fscanf function executes each directive of the format in turn. When all directives
15453 have been executed, or if a directive fails (as detailed below), the function returns.
15454 Failures are described as input failures (due to the occurrence of an encoding error or the
15455 unavailability of input characters), or matching failures (due to inappropriate input).
15456 <p><!--para 5 -->
15457 A directive composed of white-space character(s) is executed by reading input up to the
15458 first non-white-space character (which remains unread), or until no more characters can
15459 be read.
15460 <p><!--para 6 -->
15461 A directive that is an ordinary multibyte character is executed by reading the next
15462 characters of the stream. If any of those characters differ from the ones composing the
15463 directive, the directive fails and the differing and subsequent characters remain unread.
15464 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
15465 read, the directive fails.
15466 <p><!--para 7 -->
15467 A directive that is a conversion specification defines a set of matching input sequences, as
15468 described below for each specifier. A conversion specification is executed in the
15469 <!--page 336 -->
15470 following steps:
15471 <p><!--para 8 -->
15472 Input white-space characters (as specified by the isspace function) are skipped, unless
15473 the specification includes a [, c, or n specifier.<sup><a href="#note277"><b>277)</b></a></sup>
15474 <p><!--para 9 -->
15475 An input item is read from the stream, unless the specification includes an n specifier. An
15476 input item is defined as the longest sequence of input characters which does not exceed
15477 any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note278"><b>278)</b></a></sup>
15478 The first character, if any, after the input item remains unread. If the length of the input
15479 item is zero, the execution of the directive fails; this condition is a matching failure unless
15480 end-of-file, an encoding error, or a read error prevented input from the stream, in which
15481 case it is an input failure.
15482 <p><!--para 10 -->
15483 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
15484 count of input characters) is converted to a type appropriate to the conversion specifier. If
15485 the input item is not a matching sequence, the execution of the directive fails: this
15486 condition is a matching failure. Unless assignment suppression was indicated by a *, the
15487 result of the conversion is placed in the object pointed to by the first argument following
15488 the format argument that has not already received a conversion result. If this object
15489 does not have an appropriate type, or if the result of the conversion cannot be represented
15490 in the object, the behavior is undefined.
15491 <p><!--para 11 -->
15492 The length modifiers and their meanings are:
15493 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15494 <pre>
15495 to an argument with type pointer to signed char or unsigned char.</pre>
15496 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15497 <pre>
15498 to an argument with type pointer to short int or unsigned short
15499 int.</pre>
15500 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15501 <pre>
15502 to an argument with type pointer to long int or unsigned long
15503 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
15504 an argument with type pointer to double; or that a following c, s, or [
15505 conversion specifier applies to an argument with type pointer to wchar_t.</pre>
15506 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15507 <pre>
15508 to an argument with type pointer to long long int or unsigned
15509 long long int.</pre>
15513 <!--page 337 -->
15514 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15515 <pre>
15516 to an argument with type pointer to intmax_t or uintmax_t.</pre>
15517 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15518 <pre>
15519 to an argument with type pointer to size_t or the corresponding signed
15520 integer type.</pre>
15521 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
15522 <pre>
15523 to an argument with type pointer to ptrdiff_t or the corresponding
15524 unsigned integer type.</pre>
15525 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
15526 <pre>
15527 applies to an argument with type pointer to long double.</pre>
15528 If a length modifier appears with any conversion specifier other than as specified above,
15529 the behavior is undefined.
15530 <p><!--para 12 -->
15531 The conversion specifiers and their meanings are:
15532 d Matches an optionally signed decimal integer, whose format is the same as
15533 <pre>
15534 expected for the subject sequence of the strtol function with the value 10
15535 for the base argument. The corresponding argument shall be a pointer to
15536 signed integer.</pre>
15537 i Matches an optionally signed integer, whose format is the same as expected
15538 <pre>
15539 for the subject sequence of the strtol function with the value 0 for the
15540 base argument. The corresponding argument shall be a pointer to signed
15541 integer.</pre>
15542 o Matches an optionally signed octal integer, whose format is the same as
15543 <pre>
15544 expected for the subject sequence of the strtoul function with the value 8
15545 for the base argument. The corresponding argument shall be a pointer to
15546 unsigned integer.</pre>
15547 u Matches an optionally signed decimal integer, whose format is the same as
15548 <pre>
15549 expected for the subject sequence of the strtoul function with the value 10
15550 for the base argument. The corresponding argument shall be a pointer to
15551 unsigned integer.</pre>
15552 x Matches an optionally signed hexadecimal integer, whose format is the same
15553 <pre>
15554 as expected for the subject sequence of the strtoul function with the value
15555 16 for the base argument. The corresponding argument shall be a pointer to
15556 unsigned integer.</pre>
15557 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
15558 <!--page 338 -->
15559 <pre>
15560 format is the same as expected for the subject sequence of the strtod
15561 function. The corresponding argument shall be a pointer to floating.</pre>
15562 c Matches a sequence of characters of exactly the number specified by the field
15563 <pre>
15564 width (1 if no field width is present in the directive).<sup><a href="#note279"><b>279)</b></a></sup>
15565 If no l length modifier is present, the corresponding argument shall be a
15566 pointer to the initial element of a character array large enough to accept the
15567 sequence. No null character is added.
15568 If an l length modifier is present, the input shall be a sequence of multibyte
15569 characters that begins in the initial shift state. Each multibyte character in the
15570 sequence is converted to a wide character as if by a call to the mbrtowc
15571 function, with the conversion state described by an mbstate_t object
15572 initialized to zero before the first multibyte character is converted. The
15573 corresponding argument shall be a pointer to the initial element of an array of
15574 wchar_t large enough to accept the resulting sequence of wide characters.
15575 No null wide character is added.</pre>
15576 s Matches a sequence of non-white-space characters.<sup><a href="#note279"><b>279)</b></a></sup>
15577 <pre>
15578 If no l length modifier is present, the corresponding argument shall be a
15579 pointer to the initial element of a character array large enough to accept the
15580 sequence and a terminating null character, which will be added automatically.
15581 If an l length modifier is present, the input shall be a sequence of multibyte
15582 characters that begins in the initial shift state. Each multibyte character is
15583 converted to a wide character as if by a call to the mbrtowc function, with
15584 the conversion state described by an mbstate_t object initialized to zero
15585 before the first multibyte character is converted. The corresponding argument
15586 shall be a pointer to the initial element of an array of wchar_t large enough
15587 to accept the sequence and the terminating null wide character, which will be
15588 added automatically.</pre>
15589 [ Matches a nonempty sequence of characters from a set of expected characters
15590 <pre>
15591 (the scanset).<sup><a href="#note279"><b>279)</b></a></sup>
15592 If no l length modifier is present, the corresponding argument shall be a
15593 pointer to the initial element of a character array large enough to accept the
15594 sequence and a terminating null character, which will be added automatically.
15595 If an l length modifier is present, the input shall be a sequence of multibyte
15596 characters that begins in the initial shift state. Each multibyte character is
15597 converted to a wide character as if by a call to the mbrtowc function, with
15598 the conversion state described by an mbstate_t object initialized to zero</pre>
15600 <!--page 339 -->
15601 <pre>
15602 before the first multibyte character is converted. The corresponding argument
15603 shall be a pointer to the initial element of an array of wchar_t large enough
15604 to accept the sequence and the terminating null wide character, which will be
15605 added automatically.
15606 The conversion specifier includes all subsequent characters in the format
15607 string, up to and including the matching right bracket (]). The characters
15608 between the brackets (the scanlist) compose the scanset, unless the character
15609 after the left bracket is a circumflex (^), in which case the scanset contains all
15610 characters that do not appear in the scanlist between the circumflex and the
15611 right bracket. If the conversion specifier begins with [] or [^], the right
15612 bracket character is in the scanlist and the next following right bracket
15613 character is the matching right bracket that ends the specification; otherwise
15614 the first following right bracket character is the one that ends the
15615 specification. If a - character is in the scanlist and is not the first, nor the
15616 second where the first character is a ^, nor the last character, the behavior is
15617 implementation-defined.</pre>
15618 p Matches an implementation-defined set of sequences, which should be the
15619 <pre>
15620 same as the set of sequences that may be produced by the %p conversion of
15621 the fprintf function. The corresponding argument shall be a pointer to a
15622 pointer to void. The input item is converted to a pointer value in an
15623 implementation-defined manner. If the input item is a value converted earlier
15624 during the same program execution, the pointer that results shall compare
15625 equal to that value; otherwise the behavior of the %p conversion is undefined.</pre>
15626 n No input is consumed. The corresponding argument shall be a pointer to
15627 <pre>
15628 signed integer into which is to be written the number of characters read from
15629 the input stream so far by this call to the fscanf function. Execution of a
15630 %n directive does not increment the assignment count returned at the
15631 completion of execution of the fscanf function. No argument is converted,
15632 but one is consumed. If the conversion specification includes an assignment-
15633 suppressing character or a field width, the behavior is undefined.</pre>
15634 % Matches a single % character; no conversion or assignment occurs. The
15635 <p><!--para 13 -->
15636 <pre>
15637 complete conversion specification shall be %%.</pre>
15638 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note280"><b>280)</b></a></sup>
15639 <p><!--para 14 -->
15640 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
15641 respectively, a, e, f, g, and x.
15645 <!--page 340 -->
15646 <p><!--para 15 -->
15647 Trailing white space (including new-line characters) is left unread unless matched by a
15648 directive. The success of literal matches and suppressed assignments is not directly
15649 determinable other than via the %n directive.
15650 <h6>Returns</h6>
15651 <p><!--para 16 -->
15652 The fscanf function returns the value of the macro EOF if an input failure occurs
15653 before the first conversion (if any) has completed. Otherwise, the function returns the
15654 number of input items assigned, which can be fewer than provided for, or even zero, in
15655 the event of an early matching failure.
15656 <p><!--para 17 -->
15657 EXAMPLE 1 The call:
15658 <pre>
15659 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15660 /* ... */
15661 int n, i; float x; char name[50];
15662 n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);</pre>
15663 with the input line:
15664 <pre>
15665 25 54.32E-1 thompson</pre>
15666 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
15667 thompson\0.
15669 <p><!--para 18 -->
15670 EXAMPLE 2 The call:
15671 <pre>
15672 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15673 /* ... */
15674 int i; float x; char name[50];
15675 fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);</pre>
15676 with input:
15677 <pre>
15678 56789 0123 56a72</pre>
15679 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
15680 sequence 56\0. The next character read from the input stream will be a.
15682 <p><!--para 19 -->
15683 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
15684 <p><!--para 20 -->
15685 <pre>
15686 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15687 /* ... */
15688 int count; float quant; char units[21], item[21];
15689 do {
15690 count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
15691 fscanf(stdin,"%*[^\n]");
15692 } while (!feof(stdin) &amp;&amp; !ferror(stdin));</pre>
15693 If the stdin stream contains the following lines:
15694 <!--page 341 -->
15695 <pre>
15696 2 quarts of oil
15697 -12.8degrees Celsius
15698 lots of luck
15699 10.0LBS of
15700 dirt
15701 100ergs of energy</pre>
15702 the execution of the above example will be analogous to the following assignments:
15703 <pre>
15704 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
15705 count = 3;
15706 quant = -12.8; strcpy(units, "degrees");
15707 count = 2; // "C" fails to match "o"
15708 count = 0; // "l" fails to match "%f"
15709 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
15710 count = 3;
15711 count = 0; // "100e" fails to match "%f"
15712 count = EOF;</pre>
15714 <p><!--para 21 -->
15715 EXAMPLE 4 In:
15716 <pre>
15717 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15718 /* ... */
15719 int d1, d2, n1, n2, i;
15720 i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);</pre>
15721 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure the value
15722 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
15724 <p><!--para 22 -->
15725 EXAMPLE 5 In these examples, multibyte characters do have a state-dependent encoding, and the
15726 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
15727 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
15728 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
15729 entry into the alternate shift state.
15730 <p><!--para 23 -->
15731 After the call:
15732 <pre>
15733 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15734 /* ... */
15735 char str[50];
15736 fscanf(stdin, "a%s", str);</pre>
15737 with the input line:
15738 <pre>
15739 a(uparrow) X Y(downarrow) bc</pre>
15740 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
15741 characters, in the more general case) appears to be a single-byte white-space character.
15742 <p><!--para 24 -->
15743 In contrast, after the call:
15744 <pre>
15745 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15746 #include <a href="#7.19">&lt;stddef.h&gt;</a>
15747 /* ... */
15748 wchar_t wstr[50];
15749 fscanf(stdin, "a%ls", wstr);</pre>
15750 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
15751 terminating null wide character.
15752 <p><!--para 25 -->
15753 However, the call:
15754 <!--page 342 -->
15755 <pre>
15756 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15757 #include <a href="#7.19">&lt;stddef.h&gt;</a>
15758 /* ... */
15759 wchar_t wstr[50];
15760 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);</pre>
15761 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
15762 string.
15763 <p><!--para 26 -->
15764 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
15765 character Y, after the call:
15766 <pre>
15767 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15768 #include <a href="#7.19">&lt;stddef.h&gt;</a>
15769 /* ... */
15770 wchar_t wstr[50];
15771 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);</pre>
15772 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
15773 multibyte character.
15775 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>), the
15776 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.22.1.4">7.22.1.4</a>), conversion state
15777 (<a href="#7.28.6">7.28.6</a>), the wcrtomb function (<a href="#7.28.6.3.3">7.28.6.3.3</a>).
15779 <h6>footnotes</h6>
15780 <p><small><a name="note277" href="#note277">277)</a> These white-space characters are not counted against a specified field width.
15781 </small>
15782 <p><small><a name="note278" href="#note278">278)</a> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
15783 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
15784 </small>
15785 <p><small><a name="note279" href="#note279">279)</a> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
15786 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
15787 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
15788 </small>
15789 <p><small><a name="note280" href="#note280">280)</a> See ''future library directions'' (<a href="#7.30.9">7.30.9</a>).
15790 </small>
15792 <h5><a name="7.21.6.3" href="#7.21.6.3">7.21.6.3 The printf function</a></h5>
15793 <h6>Synopsis</h6>
15794 <p><!--para 1 -->
15795 <pre>
15796 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15797 int printf(const char * restrict format, ...);</pre>
15798 <h6>Description</h6>
15799 <p><!--para 2 -->
15800 The printf function is equivalent to fprintf with the argument stdout interposed
15801 before the arguments to printf.
15802 <h6>Returns</h6>
15803 <p><!--para 3 -->
15804 The printf function returns the number of characters transmitted, or a negative value if
15805 an output or encoding error occurred.
15807 <h5><a name="7.21.6.4" href="#7.21.6.4">7.21.6.4 The scanf function</a></h5>
15808 <h6>Synopsis</h6>
15809 <p><!--para 1 -->
15810 <pre>
15811 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15812 int scanf(const char * restrict format, ...);</pre>
15813 <h6>Description</h6>
15814 <p><!--para 2 -->
15815 The scanf function is equivalent to fscanf with the argument stdin interposed
15816 before the arguments to scanf.
15817 <!--page 343 -->
15818 <h6>Returns</h6>
15819 <p><!--para 3 -->
15820 The scanf function returns the value of the macro EOF if an input failure occurs before
15821 the first conversion (if any) has completed. Otherwise, the scanf function returns the
15822 number of input items assigned, which can be fewer than provided for, or even zero, in
15823 the event of an early matching failure.
15825 <h5><a name="7.21.6.5" href="#7.21.6.5">7.21.6.5 The snprintf function</a></h5>
15826 <h6>Synopsis</h6>
15827 <p><!--para 1 -->
15828 <pre>
15829 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15830 int snprintf(char * restrict s, size_t n,
15831 const char * restrict format, ...);</pre>
15832 <h6>Description</h6>
15833 <p><!--para 2 -->
15834 The snprintf function is equivalent to fprintf, except that the output is written into
15835 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
15836 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
15837 discarded rather than being written to the array, and a null character is written at the end
15838 of the characters actually written into the array. If copying takes place between objects
15839 that overlap, the behavior is undefined.
15840 <h6>Returns</h6>
15841 <p><!--para 3 -->
15842 The snprintf function returns the number of characters that would have been written
15843 had n been sufficiently large, not counting the terminating null character, or a negative
15844 value if an encoding error occurred. Thus, the null-terminated output has been
15845 completely written if and only if the returned value is nonnegative and less than n.
15847 <h5><a name="7.21.6.6" href="#7.21.6.6">7.21.6.6 The sprintf function</a></h5>
15848 <h6>Synopsis</h6>
15849 <p><!--para 1 -->
15850 <pre>
15851 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15852 int sprintf(char * restrict s,
15853 const char * restrict format, ...);</pre>
15854 <h6>Description</h6>
15855 <p><!--para 2 -->
15856 The sprintf function is equivalent to fprintf, except that the output is written into
15857 an array (specified by the argument s) rather than to a stream. A null character is written
15858 at the end of the characters written; it is not counted as part of the returned value. If
15859 copying takes place between objects that overlap, the behavior is undefined.
15860 <h6>Returns</h6>
15861 <p><!--para 3 -->
15862 The sprintf function returns the number of characters written in the array, not
15863 counting the terminating null character, or a negative value if an encoding error occurred.
15864 <!--page 344 -->
15866 <h5><a name="7.21.6.7" href="#7.21.6.7">7.21.6.7 The sscanf function</a></h5>
15867 <h6>Synopsis</h6>
15868 <p><!--para 1 -->
15869 <pre>
15870 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15871 int sscanf(const char * restrict s,
15872 const char * restrict format, ...);</pre>
15873 <h6>Description</h6>
15874 <p><!--para 2 -->
15875 The sscanf function is equivalent to fscanf, except that input is obtained from a
15876 string (specified by the argument s) rather than from a stream. Reaching the end of the
15877 string is equivalent to encountering end-of-file for the fscanf function. If copying
15878 takes place between objects that overlap, the behavior is undefined.
15879 <h6>Returns</h6>
15880 <p><!--para 3 -->
15881 The sscanf function returns the value of the macro EOF if an input failure occurs
15882 before the first conversion (if any) has completed. Otherwise, the sscanf function
15883 returns the number of input items assigned, which can be fewer than provided for, or even
15884 zero, in the event of an early matching failure.
15886 <h5><a name="7.21.6.8" href="#7.21.6.8">7.21.6.8 The vfprintf function</a></h5>
15887 <h6>Synopsis</h6>
15888 <p><!--para 1 -->
15889 <pre>
15890 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
15891 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15892 int vfprintf(FILE * restrict stream,
15893 const char * restrict format,
15894 va_list arg);</pre>
15895 <h6>Description</h6>
15896 <p><!--para 2 -->
15897 The vfprintf function is equivalent to fprintf, with the variable argument list
15898 replaced by arg, which shall have been initialized by the va_start macro (and
15899 possibly subsequent va_arg calls). The vfprintf function does not invoke the
15900 va_end macro.<sup><a href="#note281"><b>281)</b></a></sup>
15901 <h6>Returns</h6>
15902 <p><!--para 3 -->
15903 The vfprintf function returns the number of characters transmitted, or a negative
15904 value if an output or encoding error occurred.
15905 <p><!--para 4 -->
15906 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
15911 <!--page 345 -->
15912 <pre>
15913 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
15914 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15915 void error(char *function_name, char *format, ...)
15917 va_list args;
15918 va_start(args, format);
15919 // print out name of function causing error
15920 fprintf(stderr, "ERROR in %s: ", function_name);
15921 // print out remainder of message
15922 vfprintf(stderr, format, args);
15923 va_end(args);
15924 }</pre>
15927 <h6>footnotes</h6>
15928 <p><small><a name="note281" href="#note281">281)</a> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
15929 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
15930 </small>
15932 <h5><a name="7.21.6.9" href="#7.21.6.9">7.21.6.9 The vfscanf function</a></h5>
15933 <h6>Synopsis</h6>
15934 <p><!--para 1 -->
15935 <pre>
15936 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
15937 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15938 int vfscanf(FILE * restrict stream,
15939 const char * restrict format,
15940 va_list arg);</pre>
15941 <h6>Description</h6>
15942 <p><!--para 2 -->
15943 The vfscanf function is equivalent to fscanf, with the variable argument list
15944 replaced by arg, which shall have been initialized by the va_start macro (and
15945 possibly subsequent va_arg calls). The vfscanf function does not invoke the
15946 va_end macro.<sup><a href="#note281"><b>281)</b></a></sup>
15947 <h6>Returns</h6>
15948 <p><!--para 3 -->
15949 The vfscanf function returns the value of the macro EOF if an input failure occurs
15950 before the first conversion (if any) has completed. Otherwise, the vfscanf function
15951 returns the number of input items assigned, which can be fewer than provided for, or even
15952 zero, in the event of an early matching failure.
15954 <h5><a name="7.21.6.10" href="#7.21.6.10">7.21.6.10 The vprintf function</a></h5>
15955 <h6>Synopsis</h6>
15956 <p><!--para 1 -->
15957 <pre>
15958 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
15959 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15960 int vprintf(const char * restrict format,
15961 va_list arg);</pre>
15962 <h6>Description</h6>
15963 <p><!--para 2 -->
15964 The vprintf function is equivalent to printf, with the variable argument list
15965 replaced by arg, which shall have been initialized by the va_start macro (and
15966 <!--page 346 -->
15967 possibly subsequent va_arg calls). The vprintf function does not invoke the
15968 va_end macro.<sup><a href="#note281"><b>281)</b></a></sup>
15969 <h6>Returns</h6>
15970 <p><!--para 3 -->
15971 The vprintf function returns the number of characters transmitted, or a negative value
15972 if an output or encoding error occurred.
15974 <h5><a name="7.21.6.11" href="#7.21.6.11">7.21.6.11 The vscanf function</a></h5>
15975 <h6>Synopsis</h6>
15976 <p><!--para 1 -->
15977 <pre>
15978 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
15979 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15980 int vscanf(const char * restrict format,
15981 va_list arg);</pre>
15982 <h6>Description</h6>
15983 <p><!--para 2 -->
15984 The vscanf function is equivalent to scanf, with the variable argument list replaced
15985 by arg, which shall have been initialized by the va_start macro (and possibly
15986 subsequent va_arg calls). The vscanf function does not invoke the va_end
15987 macro.<sup><a href="#note281"><b>281)</b></a></sup>
15988 <h6>Returns</h6>
15989 <p><!--para 3 -->
15990 The vscanf function returns the value of the macro EOF if an input failure occurs
15991 before the first conversion (if any) has completed. Otherwise, the vscanf function
15992 returns the number of input items assigned, which can be fewer than provided for, or even
15993 zero, in the event of an early matching failure.
15995 <h5><a name="7.21.6.12" href="#7.21.6.12">7.21.6.12 The vsnprintf function</a></h5>
15996 <h6>Synopsis</h6>
15997 <p><!--para 1 -->
15998 <pre>
15999 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16000 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16001 int vsnprintf(char * restrict s, size_t n,
16002 const char * restrict format,
16003 va_list arg);</pre>
16004 <h6>Description</h6>
16005 <p><!--para 2 -->
16006 The vsnprintf function is equivalent to snprintf, with the variable argument list
16007 replaced by arg, which shall have been initialized by the va_start macro (and
16008 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
16009 va_end macro.<sup><a href="#note281"><b>281)</b></a></sup> If copying takes place between objects that overlap, the behavior is
16010 undefined.
16011 <!--page 347 -->
16012 <h6>Returns</h6>
16013 <p><!--para 3 -->
16014 The vsnprintf function returns the number of characters that would have been written
16015 had n been sufficiently large, not counting the terminating null character, or a negative
16016 value if an encoding error occurred. Thus, the null-terminated output has been
16017 completely written if and only if the returned value is nonnegative and less than n.
16019 <h5><a name="7.21.6.13" href="#7.21.6.13">7.21.6.13 The vsprintf function</a></h5>
16020 <h6>Synopsis</h6>
16021 <p><!--para 1 -->
16022 <pre>
16023 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16024 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16025 int vsprintf(char * restrict s,
16026 const char * restrict format,
16027 va_list arg);</pre>
16028 <h6>Description</h6>
16029 <p><!--para 2 -->
16030 The vsprintf function is equivalent to sprintf, with the variable argument list
16031 replaced by arg, which shall have been initialized by the va_start macro (and
16032 possibly subsequent va_arg calls). The vsprintf function does not invoke the
16033 va_end macro.<sup><a href="#note281"><b>281)</b></a></sup> If copying takes place between objects that overlap, the behavior is
16034 undefined.
16035 <h6>Returns</h6>
16036 <p><!--para 3 -->
16037 The vsprintf function returns the number of characters written in the array, not
16038 counting the terminating null character, or a negative value if an encoding error occurred.
16040 <h5><a name="7.21.6.14" href="#7.21.6.14">7.21.6.14 The vsscanf function</a></h5>
16041 <h6>Synopsis</h6>
16042 <p><!--para 1 -->
16043 <pre>
16044 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16045 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16046 int vsscanf(const char * restrict s,
16047 const char * restrict format,
16048 va_list arg);</pre>
16049 <h6>Description</h6>
16050 <p><!--para 2 -->
16051 The vsscanf function is equivalent to sscanf, with the variable argument list
16052 replaced by arg, which shall have been initialized by the va_start macro (and
16053 possibly subsequent va_arg calls). The vsscanf function does not invoke the
16054 va_end macro.<sup><a href="#note281"><b>281)</b></a></sup>
16055 <h6>Returns</h6>
16056 <p><!--para 3 -->
16057 The vsscanf function returns the value of the macro EOF if an input failure occurs
16058 before the first conversion (if any) has completed. Otherwise, the vsscanf function
16059 <!--page 348 -->
16060 returns the number of input items assigned, which can be fewer than provided for, or even
16061 zero, in the event of an early matching failure.
16063 <h4><a name="7.21.7" href="#7.21.7">7.21.7 Character input/output functions</a></h4>
16065 <h5><a name="7.21.7.1" href="#7.21.7.1">7.21.7.1 The fgetc function</a></h5>
16066 <h6>Synopsis</h6>
16067 <p><!--para 1 -->
16068 <pre>
16069 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16070 int fgetc(FILE *stream);</pre>
16071 <h6>Description</h6>
16072 <p><!--para 2 -->
16073 If the end-of-file indicator for the input stream pointed to by stream is not set and a
16074 next character is present, the fgetc function obtains that character as an unsigned
16075 char converted to an int and advances the associated file position indicator for the
16076 stream (if defined).
16077 <h6>Returns</h6>
16078 <p><!--para 3 -->
16079 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
16080 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
16081 fgetc function returns the next character from the input stream pointed to by stream.
16082 If a read error occurs, the error indicator for the stream is set and the fgetc function
16083 returns EOF.<sup><a href="#note282"><b>282)</b></a></sup>
16085 <h6>footnotes</h6>
16086 <p><small><a name="note282" href="#note282">282)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
16087 </small>
16089 <h5><a name="7.21.7.2" href="#7.21.7.2">7.21.7.2 The fgets function</a></h5>
16090 <h6>Synopsis</h6>
16091 <p><!--para 1 -->
16092 <pre>
16093 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16094 char *fgets(char * restrict s, int n,
16095 FILE * restrict stream);</pre>
16096 <h6>Description</h6>
16097 <p><!--para 2 -->
16098 The fgets function reads at most one less than the number of characters specified by n
16099 from the stream pointed to by stream into the array pointed to by s. No additional
16100 characters are read after a new-line character (which is retained) or after end-of-file. A
16101 null character is written immediately after the last character read into the array.
16102 <h6>Returns</h6>
16103 <p><!--para 3 -->
16104 The fgets function returns s if successful. If end-of-file is encountered and no
16105 characters have been read into the array, the contents of the array remain unchanged and a
16106 null pointer is returned. If a read error occurs during the operation, the array contents are
16107 indeterminate and a null pointer is returned.
16109 <!--page 349 -->
16111 <h5><a name="7.21.7.3" href="#7.21.7.3">7.21.7.3 The fputc function</a></h5>
16112 <h6>Synopsis</h6>
16113 <p><!--para 1 -->
16114 <pre>
16115 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16116 int fputc(int c, FILE *stream);</pre>
16117 <h6>Description</h6>
16118 <p><!--para 2 -->
16119 The fputc function writes the character specified by c (converted to an unsigned
16120 char) to the output stream pointed to by stream, at the position indicated by the
16121 associated file position indicator for the stream (if defined), and advances the indicator
16122 appropriately. If the file cannot support positioning requests, or if the stream was opened
16123 with append mode, the character is appended to the output stream.
16124 <h6>Returns</h6>
16125 <p><!--para 3 -->
16126 The fputc function returns the character written. If a write error occurs, the error
16127 indicator for the stream is set and fputc returns EOF.
16129 <h5><a name="7.21.7.4" href="#7.21.7.4">7.21.7.4 The fputs function</a></h5>
16130 <h6>Synopsis</h6>
16131 <p><!--para 1 -->
16132 <pre>
16133 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16134 int fputs(const char * restrict s,
16135 FILE * restrict stream);</pre>
16136 <h6>Description</h6>
16137 <p><!--para 2 -->
16138 The fputs function writes the string pointed to by s to the stream pointed to by
16139 stream. The terminating null character is not written.
16140 <h6>Returns</h6>
16141 <p><!--para 3 -->
16142 The fputs function returns EOF if a write error occurs; otherwise it returns a
16143 nonnegative value.
16145 <h5><a name="7.21.7.5" href="#7.21.7.5">7.21.7.5 The getc function</a></h5>
16146 <h6>Synopsis</h6>
16147 <p><!--para 1 -->
16148 <pre>
16149 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16150 int getc(FILE *stream);</pre>
16151 <h6>Description</h6>
16152 <p><!--para 2 -->
16153 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
16154 may evaluate stream more than once, so the argument should never be an expression
16155 with side effects.
16156 <!--page 350 -->
16157 <h6>Returns</h6>
16158 <p><!--para 3 -->
16159 The getc function returns the next character from the input stream pointed to by
16160 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
16161 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
16162 getc returns EOF.
16164 <h5><a name="7.21.7.6" href="#7.21.7.6">7.21.7.6 The getchar function</a></h5>
16165 <h6>Synopsis</h6>
16166 <p><!--para 1 -->
16167 <pre>
16168 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16169 int getchar(void);</pre>
16170 <h6>Description</h6>
16171 <p><!--para 2 -->
16172 The getchar function is equivalent to getc with the argument stdin.
16173 <h6>Returns</h6>
16174 <p><!--para 3 -->
16175 The getchar function returns the next character from the input stream pointed to by
16176 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
16177 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
16178 getchar returns EOF. *
16180 <h5><a name="7.21.7.7" href="#7.21.7.7">7.21.7.7 The putc function</a></h5>
16181 <h6>Synopsis</h6>
16182 <p><!--para 1 -->
16183 <pre>
16184 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16185 int putc(int c, FILE *stream);</pre>
16186 <h6>Description</h6>
16187 <p><!--para 2 -->
16188 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
16189 may evaluate stream more than once, so that argument should never be an expression
16190 with side effects.
16191 <h6>Returns</h6>
16192 <p><!--para 3 -->
16193 The putc function returns the character written. If a write error occurs, the error
16194 indicator for the stream is set and putc returns EOF.
16196 <h5><a name="7.21.7.8" href="#7.21.7.8">7.21.7.8 The putchar function</a></h5>
16197 <h6>Synopsis</h6>
16198 <p><!--para 1 -->
16199 <pre>
16200 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16201 int putchar(int c);</pre>
16202 <h6>Description</h6>
16203 <p><!--para 2 -->
16204 The putchar function is equivalent to putc with the second argument stdout.
16205 <!--page 351 -->
16206 <h6>Returns</h6>
16207 <p><!--para 3 -->
16208 The putchar function returns the character written. If a write error occurs, the error
16209 indicator for the stream is set and putchar returns EOF.
16211 <h5><a name="7.21.7.9" href="#7.21.7.9">7.21.7.9 The puts function</a></h5>
16212 <h6>Synopsis</h6>
16213 <p><!--para 1 -->
16214 <pre>
16215 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16216 int puts(const char *s);</pre>
16217 <h6>Description</h6>
16218 <p><!--para 2 -->
16219 The puts function writes the string pointed to by s to the stream pointed to by stdout,
16220 and appends a new-line character to the output. The terminating null character is not
16221 written.
16222 <h6>Returns</h6>
16223 <p><!--para 3 -->
16224 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
16225 value.
16227 <h5><a name="7.21.7.10" href="#7.21.7.10">7.21.7.10 The ungetc function</a></h5>
16228 <h6>Synopsis</h6>
16229 <p><!--para 1 -->
16230 <pre>
16231 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16232 int ungetc(int c, FILE *stream);</pre>
16233 <h6>Description</h6>
16234 <p><!--para 2 -->
16235 The ungetc function pushes the character specified by c (converted to an unsigned
16236 char) back onto the input stream pointed to by stream. Pushed-back characters will be
16237 returned by subsequent reads on that stream in the reverse order of their pushing. A
16238 successful intervening call (with the stream pointed to by stream) to a file positioning
16239 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
16240 stream. The external storage corresponding to the stream is unchanged.
16241 <p><!--para 3 -->
16242 One character of pushback is guaranteed. If the ungetc function is called too many
16243 times on the same stream without an intervening read or file positioning operation on that
16244 stream, the operation may fail.
16245 <p><!--para 4 -->
16246 If the value of c equals that of the macro EOF, the operation fails and the input stream is
16247 unchanged.
16248 <p><!--para 5 -->
16249 A successful call to the ungetc function clears the end-of-file indicator for the stream.
16250 The value of the file position indicator for the stream after reading or discarding all
16251 pushed-back characters shall be the same as it was before the characters were pushed
16252 back. For a text stream, the value of its file position indicator after a successful call to the
16253 ungetc function is unspecified until all pushed-back characters are read or discarded.
16254 <!--page 352 -->
16255 For a binary stream, its file position indicator is decremented by each successful call to
16256 the ungetc function; if its value was zero before a call, it is indeterminate after the
16257 call.<sup><a href="#note283"><b>283)</b></a></sup>
16258 <h6>Returns</h6>
16259 <p><!--para 6 -->
16260 The ungetc function returns the character pushed back after conversion, or EOF if the
16261 operation fails.
16262 <p><b> Forward references</b>: file positioning functions (<a href="#7.21.9">7.21.9</a>).
16264 <h6>footnotes</h6>
16265 <p><small><a name="note283" href="#note283">283)</a> See ''future library directions'' (<a href="#7.30.9">7.30.9</a>).
16266 </small>
16268 <h4><a name="7.21.8" href="#7.21.8">7.21.8 Direct input/output functions</a></h4>
16270 <h5><a name="7.21.8.1" href="#7.21.8.1">7.21.8.1 The fread function</a></h5>
16271 <h6>Synopsis</h6>
16272 <p><!--para 1 -->
16273 <pre>
16274 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16275 size_t fread(void * restrict ptr,
16276 size_t size, size_t nmemb,
16277 FILE * restrict stream);</pre>
16278 <h6>Description</h6>
16279 <p><!--para 2 -->
16280 The fread function reads, into the array pointed to by ptr, up to nmemb elements
16281 whose size is specified by size, from the stream pointed to by stream. For each
16282 object, size calls are made to the fgetc function and the results stored, in the order
16283 read, in an array of unsigned char exactly overlaying the object. The file position
16284 indicator for the stream (if defined) is advanced by the number of characters successfully
16285 read. If an error occurs, the resulting value of the file position indicator for the stream is
16286 indeterminate. If a partial element is read, its value is indeterminate.
16287 <h6>Returns</h6>
16288 <p><!--para 3 -->
16289 The fread function returns the number of elements successfully read, which may be
16290 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
16291 fread returns zero and the contents of the array and the state of the stream remain
16292 unchanged.
16297 <!--page 353 -->
16299 <h5><a name="7.21.8.2" href="#7.21.8.2">7.21.8.2 The fwrite function</a></h5>
16300 <h6>Synopsis</h6>
16301 <p><!--para 1 -->
16302 <pre>
16303 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16304 size_t fwrite(const void * restrict ptr,
16305 size_t size, size_t nmemb,
16306 FILE * restrict stream);</pre>
16307 <h6>Description</h6>
16308 <p><!--para 2 -->
16309 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
16310 whose size is specified by size, to the stream pointed to by stream. For each object,
16311 size calls are made to the fputc function, taking the values (in order) from an array of
16312 unsigned char exactly overlaying the object. The file position indicator for the
16313 stream (if defined) is advanced by the number of characters successfully written. If an
16314 error occurs, the resulting value of the file position indicator for the stream is
16315 indeterminate.
16316 <h6>Returns</h6>
16317 <p><!--para 3 -->
16318 The fwrite function returns the number of elements successfully written, which will be
16319 less than nmemb only if a write error is encountered. If size or nmemb is zero,
16320 fwrite returns zero and the state of the stream remains unchanged.
16322 <h4><a name="7.21.9" href="#7.21.9">7.21.9 File positioning functions</a></h4>
16324 <h5><a name="7.21.9.1" href="#7.21.9.1">7.21.9.1 The fgetpos function</a></h5>
16325 <h6>Synopsis</h6>
16326 <p><!--para 1 -->
16327 <pre>
16328 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16329 int fgetpos(FILE * restrict stream,
16330 fpos_t * restrict pos);</pre>
16331 <h6>Description</h6>
16332 <p><!--para 2 -->
16333 The fgetpos function stores the current values of the parse state (if any) and file
16334 position indicator for the stream pointed to by stream in the object pointed to by pos.
16335 The values stored contain unspecified information usable by the fsetpos function for
16336 repositioning the stream to its position at the time of the call to the fgetpos function.
16337 <h6>Returns</h6>
16338 <p><!--para 3 -->
16339 If successful, the fgetpos function returns zero; on failure, the fgetpos function
16340 returns nonzero and stores an implementation-defined positive value in errno.
16341 <p><b> Forward references</b>: the fsetpos function (<a href="#7.21.9.3">7.21.9.3</a>).
16342 <!--page 354 -->
16344 <h5><a name="7.21.9.2" href="#7.21.9.2">7.21.9.2 The fseek function</a></h5>
16345 <h6>Synopsis</h6>
16346 <p><!--para 1 -->
16347 <pre>
16348 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16349 int fseek(FILE *stream, long int offset, int whence);</pre>
16350 <h6>Description</h6>
16351 <p><!--para 2 -->
16352 The fseek function sets the file position indicator for the stream pointed to by stream.
16353 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
16354 <p><!--para 3 -->
16355 For a binary stream, the new position, measured in characters from the beginning of the
16356 file, is obtained by adding offset to the position specified by whence. The specified
16357 position is the beginning of the file if whence is SEEK_SET, the current value of the file
16358 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
16359 meaningfully support fseek calls with a whence value of SEEK_END.
16360 <p><!--para 4 -->
16361 For a text stream, either offset shall be zero, or offset shall be a value returned by
16362 an earlier successful call to the ftell function on a stream associated with the same file
16363 and whence shall be SEEK_SET.
16364 <p><!--para 5 -->
16365 After determining the new position, a successful call to the fseek function undoes any
16366 effects of the ungetc function on the stream, clears the end-of-file indicator for the
16367 stream, and then establishes the new position. After a successful fseek call, the next
16368 operation on an update stream may be either input or output.
16369 <h6>Returns</h6>
16370 <p><!--para 6 -->
16371 The fseek function returns nonzero only for a request that cannot be satisfied.
16372 <p><b> Forward references</b>: the ftell function (<a href="#7.21.9.4">7.21.9.4</a>).
16374 <h5><a name="7.21.9.3" href="#7.21.9.3">7.21.9.3 The fsetpos function</a></h5>
16375 <h6>Synopsis</h6>
16376 <p><!--para 1 -->
16377 <pre>
16378 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16379 int fsetpos(FILE *stream, const fpos_t *pos);</pre>
16380 <h6>Description</h6>
16381 <p><!--para 2 -->
16382 The fsetpos function sets the mbstate_t object (if any) and file position indicator
16383 for the stream pointed to by stream according to the value of the object pointed to by
16384 pos, which shall be a value obtained from an earlier successful call to the fgetpos
16385 function on a stream associated with the same file. If a read or write error occurs, the
16386 error indicator for the stream is set and fsetpos fails.
16387 <p><!--para 3 -->
16388 A successful call to the fsetpos function undoes any effects of the ungetc function
16389 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
16390 parse state and position. After a successful fsetpos call, the next operation on an
16391 <!--page 355 -->
16392 update stream may be either input or output.
16393 <h6>Returns</h6>
16394 <p><!--para 4 -->
16395 If successful, the fsetpos function returns zero; on failure, the fsetpos function
16396 returns nonzero and stores an implementation-defined positive value in errno.
16398 <h5><a name="7.21.9.4" href="#7.21.9.4">7.21.9.4 The ftell function</a></h5>
16399 <h6>Synopsis</h6>
16400 <p><!--para 1 -->
16401 <pre>
16402 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16403 long int ftell(FILE *stream);</pre>
16404 <h6>Description</h6>
16405 <p><!--para 2 -->
16406 The ftell function obtains the current value of the file position indicator for the stream
16407 pointed to by stream. For a binary stream, the value is the number of characters from
16408 the beginning of the file. For a text stream, its file position indicator contains unspecified
16409 information, usable by the fseek function for returning the file position indicator for the
16410 stream to its position at the time of the ftell call; the difference between two such
16411 return values is not necessarily a meaningful measure of the number of characters written
16412 or read.
16413 <h6>Returns</h6>
16414 <p><!--para 3 -->
16415 If successful, the ftell function returns the current value of the file position indicator
16416 for the stream. On failure, the ftell function returns -1L and stores an
16417 implementation-defined positive value in errno.
16419 <h5><a name="7.21.9.5" href="#7.21.9.5">7.21.9.5 The rewind function</a></h5>
16420 <h6>Synopsis</h6>
16421 <p><!--para 1 -->
16422 <pre>
16423 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16424 void rewind(FILE *stream);</pre>
16425 <h6>Description</h6>
16426 <p><!--para 2 -->
16427 The rewind function sets the file position indicator for the stream pointed to by
16428 stream to the beginning of the file. It is equivalent to
16429 <pre>
16430 (void)fseek(stream, 0L, SEEK_SET)</pre>
16431 except that the error indicator for the stream is also cleared.
16432 <h6>Returns</h6>
16433 <p><!--para 3 -->
16434 The rewind function returns no value.
16435 <!--page 356 -->
16437 <h4><a name="7.21.10" href="#7.21.10">7.21.10 Error-handling functions</a></h4>
16439 <h5><a name="7.21.10.1" href="#7.21.10.1">7.21.10.1 The clearerr function</a></h5>
16440 <h6>Synopsis</h6>
16441 <p><!--para 1 -->
16442 <pre>
16443 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16444 void clearerr(FILE *stream);</pre>
16445 <h6>Description</h6>
16446 <p><!--para 2 -->
16447 The clearerr function clears the end-of-file and error indicators for the stream pointed
16448 to by stream.
16449 <h6>Returns</h6>
16450 <p><!--para 3 -->
16451 The clearerr function returns no value.
16453 <h5><a name="7.21.10.2" href="#7.21.10.2">7.21.10.2 The feof function</a></h5>
16454 <h6>Synopsis</h6>
16455 <p><!--para 1 -->
16456 <pre>
16457 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16458 int feof(FILE *stream);</pre>
16459 <h6>Description</h6>
16460 <p><!--para 2 -->
16461 The feof function tests the end-of-file indicator for the stream pointed to by stream.
16462 <h6>Returns</h6>
16463 <p><!--para 3 -->
16464 The feof function returns nonzero if and only if the end-of-file indicator is set for
16465 stream.
16467 <h5><a name="7.21.10.3" href="#7.21.10.3">7.21.10.3 The ferror function</a></h5>
16468 <h6>Synopsis</h6>
16469 <p><!--para 1 -->
16470 <pre>
16471 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16472 int ferror(FILE *stream);</pre>
16473 <h6>Description</h6>
16474 <p><!--para 2 -->
16475 The ferror function tests the error indicator for the stream pointed to by stream.
16476 <h6>Returns</h6>
16477 <p><!--para 3 -->
16478 The ferror function returns nonzero if and only if the error indicator is set for
16479 stream.
16480 <!--page 357 -->
16482 <h5><a name="7.21.10.4" href="#7.21.10.4">7.21.10.4 The perror function</a></h5>
16483 <h6>Synopsis</h6>
16484 <p><!--para 1 -->
16485 <pre>
16486 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16487 void perror(const char *s);</pre>
16488 <h6>Description</h6>
16489 <p><!--para 2 -->
16490 The perror function maps the error number in the integer expression errno to an
16491 error message. It writes a sequence of characters to the standard error stream thus: first
16492 (if s is not a null pointer and the character pointed to by s is not the null character), the
16493 string pointed to by s followed by a colon (:) and a space; then an appropriate error
16494 message string followed by a new-line character. The contents of the error message
16495 strings are the same as those returned by the strerror function with argument errno.
16496 <h6>Returns</h6>
16497 <p><!--para 3 -->
16498 The perror function returns no value.
16499 <p><b> Forward references</b>: the strerror function (<a href="#7.23.6.2">7.23.6.2</a>).
16500 <!--page 358 -->
16502 <h3><a name="7.22" href="#7.22">7.22 General utilities <stdlib.h></a></h3>
16503 <p><!--para 1 -->
16504 The header <a href="#7.22">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
16505 defines several macros.<sup><a href="#note284"><b>284)</b></a></sup>
16506 <p><!--para 2 -->
16507 The types declared are size_t and wchar_t (both described in <a href="#7.19">7.19</a>),
16508 <pre>
16509 div_t</pre>
16510 which is a structure type that is the type of the value returned by the div function,
16511 <pre>
16512 ldiv_t</pre>
16513 which is a structure type that is the type of the value returned by the ldiv function, and
16514 <pre>
16515 lldiv_t</pre>
16516 which is a structure type that is the type of the value returned by the lldiv function.
16517 <p><!--para 3 -->
16518 The macros defined are NULL (described in <a href="#7.19">7.19</a>);
16519 <pre>
16520 EXIT_FAILURE</pre>
16522 <pre>
16523 EXIT_SUCCESS</pre>
16524 which expand to integer constant expressions that can be used as the argument to the
16525 exit function to return unsuccessful or successful termination status, respectively, to the
16526 host environment;
16527 <pre>
16528 RAND_MAX</pre>
16529 which expands to an integer constant expression that is the maximum value returned by
16530 the rand function; and
16531 <pre>
16532 MB_CUR_MAX</pre>
16533 which expands to a positive integer expression with type size_t that is the maximum
16534 number of bytes in a multibyte character for the extended character set specified by the
16535 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
16540 <!--page 359 -->
16542 <h6>footnotes</h6>
16543 <p><small><a name="note284" href="#note284">284)</a> See ''future library directions'' (<a href="#7.30.10">7.30.10</a>).
16544 </small>
16546 <h4><a name="7.22.1" href="#7.22.1">7.22.1 Numeric conversion functions</a></h4>
16547 <p><!--para 1 -->
16548 The functions atof, atoi, atol, and atoll need not affect the value of the integer
16549 expression errno on an error. If the value of the result cannot be represented, the
16550 behavior is undefined.
16552 <h5><a name="7.22.1.1" href="#7.22.1.1">7.22.1.1 The atof function</a></h5>
16553 <h6>Synopsis</h6>
16554 <p><!--para 1 -->
16555 <pre>
16556 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16557 double atof(const char *nptr);</pre>
16558 <h6>Description</h6>
16559 <p><!--para 2 -->
16560 The atof function converts the initial portion of the string pointed to by nptr to
16561 double representation. Except for the behavior on error, it is equivalent to
16562 <pre>
16563 strtod(nptr, (char **)NULL)</pre>
16564 <h6>Returns</h6>
16565 <p><!--para 3 -->
16566 The atof function returns the converted value.
16567 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>).
16569 <h5><a name="7.22.1.2" href="#7.22.1.2">7.22.1.2 The atoi, atol, and atoll functions</a></h5>
16570 <h6>Synopsis</h6>
16571 <p><!--para 1 -->
16572 <pre>
16573 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16574 int atoi(const char *nptr);
16575 long int atol(const char *nptr);
16576 long long int atoll(const char *nptr);</pre>
16577 <h6>Description</h6>
16578 <p><!--para 2 -->
16579 The atoi, atol, and atoll functions convert the initial portion of the string pointed
16580 to by nptr to int, long int, and long long int representation, respectively.
16581 Except for the behavior on error, they are equivalent to
16582 <pre>
16583 atoi: (int)strtol(nptr, (char **)NULL, 10)
16584 atol: strtol(nptr, (char **)NULL, 10)
16585 atoll: strtoll(nptr, (char **)NULL, 10)</pre>
16586 <h6>Returns</h6>
16587 <p><!--para 3 -->
16588 The atoi, atol, and atoll functions return the converted value.
16589 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
16590 (<a href="#7.22.1.4">7.22.1.4</a>).
16591 <!--page 360 -->
16593 <h5><a name="7.22.1.3" href="#7.22.1.3">7.22.1.3 The strtod, strtof, and strtold functions</a></h5>
16594 <h6>Synopsis</h6>
16595 <p><!--para 1 -->
16596 <pre>
16597 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16598 double strtod(const char * restrict nptr,
16599 char ** restrict endptr);
16600 float strtof(const char * restrict nptr,
16601 char ** restrict endptr);
16602 long double strtold(const char * restrict nptr,
16603 char ** restrict endptr);</pre>
16604 <h6>Description</h6>
16605 <p><!--para 2 -->
16606 The strtod, strtof, and strtold functions convert the initial portion of the string
16607 pointed to by nptr to double, float, and long double representation,
16608 respectively. First, they decompose the input string into three parts: an initial, possibly
16609 empty, sequence of white-space characters (as specified by the isspace function), a
16610 subject sequence resembling a floating-point constant or representing an infinity or NaN;
16611 and a final string of one or more unrecognized characters, including the terminating null
16612 character of the input string. Then, they attempt to convert the subject sequence to a
16613 floating-point number, and return the result.
16614 <p><!--para 3 -->
16615 The expected form of the subject sequence is an optional plus or minus sign, then one of
16616 the following:
16617 <ul>
16618 <li> a nonempty sequence of decimal digits optionally containing a decimal-point
16619 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
16620 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
16621 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
16622 <li> INF or INFINITY, ignoring case
16623 <li> NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part, where:
16624 <pre>
16625 n-char-sequence:
16626 digit
16627 nondigit
16628 n-char-sequence digit
16629 n-char-sequence nondigit</pre>
16630 </ul>
16631 The subject sequence is defined as the longest initial subsequence of the input string,
16632 starting with the first non-white-space character, that is of the expected form. The subject
16633 sequence contains no characters if the input string is not of the expected form.
16634 <p><!--para 4 -->
16635 If the subject sequence has the expected form for a floating-point number, the sequence of
16636 characters starting with the first digit or the decimal-point character (whichever occurs
16637 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
16638 <!--page 361 -->
16639 decimal-point character is used in place of a period, and that if neither an exponent part
16640 nor a decimal-point character appears in a decimal floating point number, or if a binary
16641 exponent part does not appear in a hexadecimal floating point number, an exponent part
16642 of the appropriate type with value zero is assumed to follow the last digit in the string. If
16643 the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note285"><b>285)</b></a></sup>
16644 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
16645 the return type, else like a floating constant that is too large for the range of the return
16646 type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
16647 NaN, if supported in the return type, else like a subject sequence part that does not have
16648 the expected form; the meaning of the n-char sequences is implementation-defined.<sup><a href="#note286"><b>286)</b></a></sup> A
16649 pointer to the final string is stored in the object pointed to by endptr, provided that
16650 endptr is not a null pointer.
16651 <p><!--para 5 -->
16652 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
16653 value resulting from the conversion is correctly rounded.
16654 <p><!--para 6 -->
16655 In other than the "C" locale, additional locale-specific subject sequence forms may be
16656 accepted.
16657 <p><!--para 7 -->
16658 If the subject sequence is empty or does not have the expected form, no conversion is
16659 performed; the value of nptr is stored in the object pointed to by endptr, provided
16660 that endptr is not a null pointer.
16661 <h6>Recommended practice</h6>
16662 <p><!--para 8 -->
16663 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
16664 the result is not exactly representable, the result should be one of the two numbers in the
16665 appropriate internal format that are adjacent to the hexadecimal floating source value,
16666 with the extra stipulation that the error should have a correct sign for the current rounding
16667 direction.
16668 <p><!--para 9 -->
16669 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
16670 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
16671 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
16672 consider the two bounding, adjacent decimal strings L and U, both having
16673 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
16674 The result should be one of the (equal or adjacent) values that would be obtained by
16675 correctly rounding L and U according to the current rounding direction, with the extra
16677 <!--page 362 -->
16678 stipulation that the error with respect to D should have a correct sign for the current
16679 rounding direction.<sup><a href="#note287"><b>287)</b></a></sup>
16680 <h6>Returns</h6>
16681 <p><!--para 10 -->
16682 The functions return the converted value, if any. If no conversion could be performed,
16683 zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
16684 plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the
16685 return type and sign of the value), and the value of the macro ERANGE is stored in
16686 errno. If the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is
16687 no greater than the smallest normalized positive number in the return type; whether
16688 errno acquires the value ERANGE is implementation-defined.
16690 <h6>footnotes</h6>
16691 <p><small><a name="note285" href="#note285">285)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
16692 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
16693 methods may yield different results if rounding is toward positive or negative infinity. In either case,
16694 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
16695 </small>
16696 <p><small><a name="note286" href="#note286">286)</a> An implementation may use the n-char sequence to determine extra information to be represented in
16697 the NaN's significand.
16698 </small>
16699 <p><small><a name="note287" href="#note287">287)</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
16700 to the same internal floating value, but if not will round to adjacent values.
16701 </small>
16703 <h5><a name="7.22.1.4" href="#7.22.1.4">7.22.1.4 The strtol, strtoll, strtoul, and strtoull functions</a></h5>
16704 <h6>Synopsis</h6>
16705 <p><!--para 1 -->
16706 <pre>
16707 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16708 long int strtol(
16709 const char * restrict nptr,
16710 char ** restrict endptr,
16711 int base);
16712 long long int strtoll(
16713 const char * restrict nptr,
16714 char ** restrict endptr,
16715 int base);
16716 unsigned long int strtoul(
16717 const char * restrict nptr,
16718 char ** restrict endptr,
16719 int base);
16720 unsigned long long int strtoull(
16721 const char * restrict nptr,
16722 char ** restrict endptr,
16723 int base);</pre>
16724 <h6>Description</h6>
16725 <p><!--para 2 -->
16726 The strtol, strtoll, strtoul, and strtoull functions convert the initial
16727 portion of the string pointed to by nptr to long int, long long int, unsigned
16728 long int, and unsigned long long int representation, respectively. First,
16729 they decompose the input string into three parts: an initial, possibly empty, sequence of
16730 white-space characters (as specified by the isspace function), a subject sequence
16733 <!--page 363 -->
16734 resembling an integer represented in some radix determined by the value of base, and a
16735 final string of one or more unrecognized characters, including the terminating null
16736 character of the input string. Then, they attempt to convert the subject sequence to an
16737 integer, and return the result.
16738 <p><!--para 3 -->
16739 If the value of base is zero, the expected form of the subject sequence is that of an
16740 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
16741 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
16742 expected form of the subject sequence is a sequence of letters and digits representing an
16743 integer with the radix specified by base, optionally preceded by a plus or minus sign,
16744 but not including an integer suffix. The letters from a (or A) through z (or Z) are
16745 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
16746 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
16747 optionally precede the sequence of letters and digits, following the sign if present.
16748 <p><!--para 4 -->
16749 The subject sequence is defined as the longest initial subsequence of the input string,
16750 starting with the first non-white-space character, that is of the expected form. The subject
16751 sequence contains no characters if the input string is empty or consists entirely of white
16752 space, or if the first non-white-space character is other than a sign or a permissible letter
16753 or digit.
16754 <p><!--para 5 -->
16755 If the subject sequence has the expected form and the value of base is zero, the sequence
16756 of characters starting with the first digit is interpreted as an integer constant according to
16757 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
16758 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
16759 as given above. If the subject sequence begins with a minus sign, the value resulting from
16760 the conversion is negated (in the return type). A pointer to the final string is stored in the
16761 object pointed to by endptr, provided that endptr is not a null pointer.
16762 <p><!--para 6 -->
16763 In other than the "C" locale, additional locale-specific subject sequence forms may be
16764 accepted.
16765 <p><!--para 7 -->
16766 If the subject sequence is empty or does not have the expected form, no conversion is
16767 performed; the value of nptr is stored in the object pointed to by endptr, provided
16768 that endptr is not a null pointer.
16769 <h6>Returns</h6>
16770 <p><!--para 8 -->
16771 The strtol, strtoll, strtoul, and strtoull functions return the converted
16772 value, if any. If no conversion could be performed, zero is returned. If the correct value
16773 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
16774 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
16775 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
16776 <!--page 364 -->
16778 <h4><a name="7.22.2" href="#7.22.2">7.22.2 Pseudo-random sequence generation functions</a></h4>
16780 <h5><a name="7.22.2.1" href="#7.22.2.1">7.22.2.1 The rand function</a></h5>
16781 <h6>Synopsis</h6>
16782 <p><!--para 1 -->
16783 <pre>
16784 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16785 int rand(void);</pre>
16786 <h6>Description</h6>
16787 <p><!--para 2 -->
16788 The rand function computes a sequence of pseudo-random integers in the range 0 to
16789 RAND_MAX.<sup><a href="#note288"><b>288)</b></a></sup>
16790 <p><!--para 3 -->
16791 The rand function is not required to avoid data races. The implementation shall behave
16792 as if no library function calls the rand function.
16793 <h6>Returns</h6>
16794 <p><!--para 4 -->
16795 The rand function returns a pseudo-random integer.
16796 <h6>Environmental limits</h6>
16797 <p><!--para 5 -->
16798 The value of the RAND_MAX macro shall be at least 32767.
16800 <h6>footnotes</h6>
16801 <p><small><a name="note288" href="#note288">288)</a> There are no guarantees as to the quality of the random sequence produced and some implementations
16802 are known to produce sequences with distressingly non-random low-order bits. Applications with
16803 particular requirements should use a generator that is known to be sufficient for their needs.
16804 </small>
16806 <h5><a name="7.22.2.2" href="#7.22.2.2">7.22.2.2 The srand function</a></h5>
16807 <h6>Synopsis</h6>
16808 <p><!--para 1 -->
16809 <pre>
16810 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16811 void srand(unsigned int seed);</pre>
16812 <h6>Description</h6>
16813 <p><!--para 2 -->
16814 The srand function uses the argument as a seed for a new sequence of pseudo-random
16815 numbers to be returned by subsequent calls to rand. If srand is then called with the
16816 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
16817 called before any calls to srand have been made, the same sequence shall be generated
16818 as when srand is first called with a seed value of 1.
16819 <p><!--para 3 -->
16820 The implementation shall behave as if no library function calls the srand function.
16821 <h6>Returns</h6>
16822 <p><!--para 4 -->
16823 The srand function returns no value.
16828 <!--page 365 -->
16829 <p><!--para 5 -->
16830 EXAMPLE The following functions define a portable implementation of rand and srand.
16831 <pre>
16832 static unsigned long int next = 1;
16833 int rand(void) // RAND_MAX assumed to be 32767
16835 next = next * 1103515245 + 12345;
16836 return (unsigned int)(next/65536) % 32768;
16838 void srand(unsigned int seed)
16840 next = seed;
16841 }</pre>
16844 <h4><a name="7.22.3" href="#7.22.3">7.22.3 Memory management functions</a></h4>
16845 <p><!--para 1 -->
16846 The order and contiguity of storage allocated by successive calls to the
16847 aligned_alloc, calloc, malloc, and realloc functions is unspecified. The
16848 pointer returned if the allocation succeeds is suitably aligned so that it may be assigned to
16849 a pointer to any type of object with a fundamental alignment requirement and then used
16850 to access such an object or an array of such objects in the space allocated (until the space
16851 is explicitly deallocated). The lifetime of an allocated object extends from the allocation
16852 until the deallocation. Each such allocation shall yield a pointer to an object disjoint from
16853 any other object. The pointer returned points to the start (lowest byte address) of the
16854 allocated space. If the space cannot be allocated, a null pointer is returned. If the size of
16855 the space requested is zero, the behavior is implementation-defined: either a null pointer
16856 is returned, or the behavior is as if the size were some nonzero value, except that the
16857 returned pointer shall not be used to access an object.
16859 <h5><a name="7.22.3.1" href="#7.22.3.1">7.22.3.1 The aligned_alloc function</a></h5>
16860 <h6>Synopsis</h6>
16861 <p><!--para 1 -->
16862 <pre>
16863 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16864 void *aligned_alloc(size_t alignment, size_t size);</pre>
16865 <h6>Description</h6>
16866 <p><!--para 2 -->
16867 The aligned_alloc function allocates space for an object whose alignment is
16868 specified by alignment, whose size is specified by size, and whose value is
16869 indeterminate. The value of alignment shall be a valid alignment supported by the
16870 implementation and the value of size shall be an integral multiple of alignment.
16871 <h6>Returns</h6>
16872 <p><!--para 3 -->
16873 The aligned_alloc function returns either a null pointer or a pointer to the allocated
16874 space.
16875 <!--page 366 -->
16877 <h5><a name="7.22.3.2" href="#7.22.3.2">7.22.3.2 The calloc function</a></h5>
16878 <h6>Synopsis</h6>
16879 <p><!--para 1 -->
16880 <pre>
16881 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16882 void *calloc(size_t nmemb, size_t size);</pre>
16883 <h6>Description</h6>
16884 <p><!--para 2 -->
16885 The calloc function allocates space for an array of nmemb objects, each of whose size
16886 is size. The space is initialized to all bits zero.<sup><a href="#note289"><b>289)</b></a></sup>
16887 <h6>Returns</h6>
16888 <p><!--para 3 -->
16889 The calloc function returns either a null pointer or a pointer to the allocated space.
16891 <h6>footnotes</h6>
16892 <p><small><a name="note289" href="#note289">289)</a> Note that this need not be the same as the representation of floating-point zero or a null pointer
16893 constant.
16894 </small>
16896 <h5><a name="7.22.3.3" href="#7.22.3.3">7.22.3.3 The free function</a></h5>
16897 <h6>Synopsis</h6>
16898 <p><!--para 1 -->
16899 <pre>
16900 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16901 void free(void *ptr);</pre>
16902 <h6>Description</h6>
16903 <p><!--para 2 -->
16904 The free function causes the space pointed to by ptr to be deallocated, that is, made
16905 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
16906 the argument does not match a pointer earlier returned by a memory management
16907 function, or if the space has been deallocated by a call to free or realloc, the
16908 behavior is undefined.
16909 <h6>Returns</h6>
16910 <p><!--para 3 -->
16911 The free function returns no value.
16913 <h5><a name="7.22.3.4" href="#7.22.3.4">7.22.3.4 The malloc function</a></h5>
16914 <h6>Synopsis</h6>
16915 <p><!--para 1 -->
16916 <pre>
16917 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16918 void *malloc(size_t size);</pre>
16919 <h6>Description</h6>
16920 <p><!--para 2 -->
16921 The malloc function allocates space for an object whose size is specified by size and
16922 whose value is indeterminate.
16927 <!--page 367 -->
16928 <h6>Returns</h6>
16929 <p><!--para 3 -->
16930 The malloc function returns either a null pointer or a pointer to the allocated space.
16932 <h5><a name="7.22.3.5" href="#7.22.3.5">7.22.3.5 The realloc function</a></h5>
16933 <h6>Synopsis</h6>
16934 <p><!--para 1 -->
16935 <pre>
16936 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16937 void *realloc(void *ptr, size_t size);</pre>
16938 <h6>Description</h6>
16939 <p><!--para 2 -->
16940 The realloc function deallocates the old object pointed to by ptr and returns a
16941 pointer to a new object that has the size specified by size. The contents of the new
16942 object shall be the same as that of the old object prior to deallocation, up to the lesser of
16943 the new and old sizes. Any bytes in the new object beyond the size of the old object have
16944 indeterminate values.
16945 <p><!--para 3 -->
16946 If ptr is a null pointer, the realloc function behaves like the malloc function for the
16947 specified size. Otherwise, if ptr does not match a pointer earlier returned by a memory
16948 management function, or if the space has been deallocated by a call to the free or
16949 realloc function, the behavior is undefined. If memory for the new object cannot be
16950 allocated, the old object is not deallocated and its value is unchanged.
16951 <h6>Returns</h6>
16952 <p><!--para 4 -->
16953 The realloc function returns a pointer to the new object (which may have the same
16954 value as a pointer to the old object), or a null pointer if the new object could not be
16955 allocated.
16957 <h4><a name="7.22.4" href="#7.22.4">7.22.4 Communication with the environment</a></h4>
16959 <h5><a name="7.22.4.1" href="#7.22.4.1">7.22.4.1 The abort function</a></h5>
16960 <h6>Synopsis</h6>
16961 <p><!--para 1 -->
16962 <pre>
16963 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16964 _Noreturn void abort(void);</pre>
16965 <h6>Description</h6>
16966 <p><!--para 2 -->
16967 The abort function causes abnormal program termination to occur, unless the signal
16968 SIGABRT is being caught and the signal handler does not return. Whether open streams
16969 with unwritten buffered data are flushed, open streams are closed, or temporary files are
16970 removed is implementation-defined. An implementation-defined form of the status
16971 unsuccessful termination is returned to the host environment by means of the function
16972 call raise(SIGABRT).
16973 <!--page 368 -->
16974 <h6>Returns</h6>
16975 <p><!--para 3 -->
16976 The abort function does not return to its caller.
16978 <h5><a name="7.22.4.2" href="#7.22.4.2">7.22.4.2 The atexit function</a></h5>
16979 <h6>Synopsis</h6>
16980 <p><!--para 1 -->
16981 <pre>
16982 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
16983 int atexit(void (*func)(void));</pre>
16984 <h6>Description</h6>
16985 <p><!--para 2 -->
16986 The atexit function registers the function pointed to by func, to be called without
16987 arguments at normal program termination.<sup><a href="#note290"><b>290)</b></a></sup>
16988 <h6>Environmental limits</h6>
16989 <p><!--para 3 -->
16990 The implementation shall support the registration of at least 32 functions.
16991 <h6>Returns</h6>
16992 <p><!--para 4 -->
16993 The atexit function returns zero if the registration succeeds, nonzero if it fails.
16994 <p><b> Forward references</b>: the at_quick_exit function (<a href="#7.22.4.3">7.22.4.3</a>), the exit function
16995 (<a href="#7.22.4.4">7.22.4.4</a>).
16997 <h6>footnotes</h6>
16998 <p><small><a name="note290" href="#note290">290)</a> The atexit function registrations are distinct from the at_quick_exit registrations, so
16999 applications may need to call both registration functions with the same argument.
17000 </small>
17002 <h5><a name="7.22.4.3" href="#7.22.4.3">7.22.4.3 The at_quick_exit function</a></h5>
17003 <h6>Synopsis</h6>
17004 <p><!--para 1 -->
17005 <pre>
17006 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17007 int at_quick_exit(void (*func)(void));</pre>
17008 <h6>Description</h6>
17009 <p><!--para 2 -->
17010 The at_quick_exit function registers the function pointed to by func, to be called
17011 without arguments should quick_exit be called.<sup><a href="#note291"><b>291)</b></a></sup>
17012 <h6>Environmental limits</h6>
17013 <p><!--para 3 -->
17014 The implementation shall support the registration of at least 32 functions.
17015 <h6>Returns</h6>
17016 <p><!--para 4 -->
17017 The at_quick_exit function returns zero if the registration succeeds, nonzero if it
17018 fails.
17019 <p><b> Forward references</b>: the quick_exit function (<a href="#7.22.4.7">7.22.4.7</a>).
17022 <!--page 369 -->
17024 <h6>footnotes</h6>
17025 <p><small><a name="note291" href="#note291">291)</a> The at_quick_exit function registrations are distinct from the atexit registrations, so
17026 applications may need to call both registration functions with the same argument.
17027 </small>
17029 <h5><a name="7.22.4.4" href="#7.22.4.4">7.22.4.4 The exit function</a></h5>
17030 <h6>Synopsis</h6>
17031 <p><!--para 1 -->
17032 <pre>
17033 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17034 _Noreturn void exit(int status);</pre>
17035 <h6>Description</h6>
17036 <p><!--para 2 -->
17037 The exit function causes normal program termination to occur. No functions registered
17038 by the at_quick_exit function are called. If a program calls the exit function
17039 more than once, or calls the quick_exit function in addition to the exit function, the
17040 behavior is undefined.
17041 <p><!--para 3 -->
17042 First, all functions registered by the atexit function are called, in the reverse order of
17043 their registration,<sup><a href="#note292"><b>292)</b></a></sup> except that a function is called after any previously registered
17044 functions that had already been called at the time it was registered. If, during the call to
17045 any such function, a call to the longjmp function is made that would terminate the call
17046 to the registered function, the behavior is undefined.
17047 <p><!--para 4 -->
17048 Next, all open streams with unwritten buffered data are flushed, all open streams are
17049 closed, and all files created by the tmpfile function are removed.
17050 <p><!--para 5 -->
17051 Finally, control is returned to the host environment. If the value of status is zero or
17052 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
17053 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
17054 of the status unsuccessful termination is returned. Otherwise the status returned is
17055 implementation-defined.
17056 <h6>Returns</h6>
17057 <p><!--para 6 -->
17058 The exit function cannot return to its caller.
17060 <h6>footnotes</h6>
17061 <p><small><a name="note292" href="#note292">292)</a> Each function is called as many times as it was registered, and in the correct order with respect to
17062 other registered functions.
17063 </small>
17065 <h5><a name="7.22.4.5" href="#7.22.4.5">7.22.4.5 The _Exit function</a></h5>
17066 <h6>Synopsis</h6>
17067 <p><!--para 1 -->
17068 <pre>
17069 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17070 _Noreturn void _Exit(int status);</pre>
17071 <h6>Description</h6>
17072 <p><!--para 2 -->
17073 The _Exit function causes normal program termination to occur and control to be
17074 returned to the host environment. No functions registered by the atexit function, the
17075 at_quick_exit function, or signal handlers registered by the signal function are
17076 called. The status returned to the host environment is determined in the same way as for
17079 <!--page 370 -->
17080 the exit function (<a href="#7.22.4.4">7.22.4.4</a>). Whether open streams with unwritten buffered data are
17081 flushed, open streams are closed, or temporary files are removed is implementation-
17082 defined.
17083 <h6>Returns</h6>
17084 <p><!--para 3 -->
17085 The _Exit function cannot return to its caller.
17087 <h5><a name="7.22.4.6" href="#7.22.4.6">7.22.4.6 The getenv function</a></h5>
17088 <h6>Synopsis</h6>
17089 <p><!--para 1 -->
17090 <pre>
17091 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17092 char *getenv(const char *name);</pre>
17093 <h6>Description</h6>
17094 <p><!--para 2 -->
17095 The getenv function searches an environment list, provided by the host environment,
17096 for a string that matches the string pointed to by name. The set of environment names
17097 and the method for altering the environment list are implementation-defined. The
17098 getenv function need not avoid data races with other threads of execution that modify
17099 the environment list.<sup><a href="#note293"><b>293)</b></a></sup>
17100 <p><!--para 3 -->
17101 The implementation shall behave as if no library function calls the getenv function.
17102 <h6>Returns</h6>
17103 <p><!--para 4 -->
17104 The getenv function returns a pointer to a string associated with the matched list
17105 member. The string pointed to shall not be modified by the program, but may be
17106 overwritten by a subsequent call to the getenv function. If the specified name cannot
17107 be found, a null pointer is returned.
17109 <h6>footnotes</h6>
17110 <p><small><a name="note293" href="#note293">293)</a> Many implementations provide non-standard functions that modify the environment list.
17111 </small>
17113 <h5><a name="7.22.4.7" href="#7.22.4.7">7.22.4.7 The quick_exit function</a></h5>
17114 <h6>Synopsis</h6>
17115 <p><!--para 1 -->
17116 <pre>
17117 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17118 _Noreturn void quick_exit(int status);</pre>
17119 <h6>Description</h6>
17120 <p><!--para 2 -->
17121 The quick_exit function causes normal program termination to occur. No functions
17122 registered by the atexit function or signal handlers registered by the signal function
17123 are called. If a program calls the quick_exit function more than once, or calls the
17124 exit function in addition to the quick_exit function, the behavior is undefined.
17125 <p><!--para 3 -->
17126 The quick_exit function first calls all functions registered by the at_quick_exit
17127 function, in the reverse order of their registration,<sup><a href="#note294"><b>294)</b></a></sup> except that a function is called after
17130 <!--page 371 -->
17131 any previously registered functions that had already been called at the time it was
17132 registered. If, during the call to any such function, a call to the longjmp function is
17133 made that would terminate the call to the registered function, the behavior is undefined.
17134 <p><!--para 4 -->
17135 Then control is returned to the host environment by means of the function call
17136 _Exit(status).
17137 <h6>Returns</h6>
17138 <p><!--para 5 -->
17139 The quick_exit function cannot return to its caller.
17141 <h6>footnotes</h6>
17142 <p><small><a name="note294" href="#note294">294)</a> Each function is called as many times as it was registered, and in the correct order with respect to
17143 other registered functions.
17144 </small>
17146 <h5><a name="7.22.4.8" href="#7.22.4.8">7.22.4.8 The system function</a></h5>
17147 <h6>Synopsis</h6>
17148 <p><!--para 1 -->
17149 <pre>
17150 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17151 int system(const char *string);</pre>
17152 <h6>Description</h6>
17153 <p><!--para 2 -->
17154 If string is a null pointer, the system function determines whether the host
17155 environment has a command processor. If string is not a null pointer, the system
17156 function passes the string pointed to by string to that command processor to be
17157 executed in a manner which the implementation shall document; this might then cause the
17158 program calling system to behave in a non-conforming manner or to terminate.
17159 <h6>Returns</h6>
17160 <p><!--para 3 -->
17161 If the argument is a null pointer, the system function returns nonzero only if a
17162 command processor is available. If the argument is not a null pointer, and the system
17163 function does return, it returns an implementation-defined value.
17165 <h4><a name="7.22.5" href="#7.22.5">7.22.5 Searching and sorting utilities</a></h4>
17166 <p><!--para 1 -->
17167 These utilities make use of a comparison function to search or sort arrays of unspecified
17168 type. Where an argument declared as size_t nmemb specifies the length of the array
17169 for a function, nmemb can have the value zero on a call to that function; the comparison
17170 function is not called, a search finds no matching element, and sorting performs no
17171 rearrangement. Pointer arguments on such a call shall still have valid values, as described
17172 in <a href="#7.1.4">7.1.4</a>.
17173 <p><!--para 2 -->
17174 The implementation shall ensure that the second argument of the comparison function
17175 (when called from bsearch), or both arguments (when called from qsort), are
17176 pointers to elements of the array.<sup><a href="#note295"><b>295)</b></a></sup> The first argument when called from bsearch
17177 shall equal key.
17181 <!--page 372 -->
17182 <p><!--para 3 -->
17183 The comparison function shall not alter the contents of the array. The implementation
17184 may reorder elements of the array between calls to the comparison function, but shall not
17185 alter the contents of any individual element.
17186 <p><!--para 4 -->
17187 When the same objects (consisting of size bytes, irrespective of their current positions
17188 in the array) are passed more than once to the comparison function, the results shall be
17189 consistent with one another. That is, for qsort they shall define a total ordering on the
17190 array, and for bsearch the same object shall always compare the same way with the
17191 key.
17192 <p><!--para 5 -->
17193 A sequence point occurs immediately before and immediately after each call to the
17194 comparison function, and also between any call to the comparison function and any
17195 movement of the objects passed as arguments to that call.
17197 <h6>footnotes</h6>
17198 <p><small><a name="note295" href="#note295">295)</a> That is, if the value passed is p, then the following expressions are always nonzero:
17200 <pre>
17201 ((char *)p - (char *)base) % size == 0
17202 (char *)p &gt;= (char *)base
17203 (char *)p &lt; (char *)base + nmemb * size</pre>
17205 </small>
17207 <h5><a name="7.22.5.1" href="#7.22.5.1">7.22.5.1 The bsearch function</a></h5>
17208 <h6>Synopsis</h6>
17209 <p><!--para 1 -->
17210 <pre>
17211 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17212 void *bsearch(const void *key, const void *base,
17213 size_t nmemb, size_t size,
17214 int (*compar)(const void *, const void *));</pre>
17215 <h6>Description</h6>
17216 <p><!--para 2 -->
17217 The bsearch function searches an array of nmemb objects, the initial element of which
17218 is pointed to by base, for an element that matches the object pointed to by key. The
17219 size of each element of the array is specified by size.
17220 <p><!--para 3 -->
17221 The comparison function pointed to by compar is called with two arguments that point
17222 to the key object and to an array element, in that order. The function shall return an
17223 integer less than, equal to, or greater than zero if the key object is considered,
17224 respectively, to be less than, to match, or to be greater than the array element. The array
17225 shall consist of: all the elements that compare less than, all the elements that compare
17226 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note296"><b>296)</b></a></sup>
17227 <h6>Returns</h6>
17228 <p><!--para 4 -->
17229 The bsearch function returns a pointer to a matching element of the array, or a null
17230 pointer if no match is found. If two elements compare as equal, which element is
17233 <!--page 373 -->
17234 matched is unspecified.
17236 <h6>footnotes</h6>
17237 <p><small><a name="note296" href="#note296">296)</a> In practice, the entire array is sorted according to the comparison function.
17238 </small>
17240 <h5><a name="7.22.5.2" href="#7.22.5.2">7.22.5.2 The qsort function</a></h5>
17241 <h6>Synopsis</h6>
17242 <p><!--para 1 -->
17243 <pre>
17244 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17245 void qsort(void *base, size_t nmemb, size_t size,
17246 int (*compar)(const void *, const void *));</pre>
17247 <h6>Description</h6>
17248 <p><!--para 2 -->
17249 The qsort function sorts an array of nmemb objects, the initial element of which is
17250 pointed to by base. The size of each object is specified by size.
17251 <p><!--para 3 -->
17252 The contents of the array are sorted into ascending order according to a comparison
17253 function pointed to by compar, which is called with two arguments that point to the
17254 objects being compared. The function shall return an integer less than, equal to, or
17255 greater than zero if the first argument is considered to be respectively less than, equal to,
17256 or greater than the second.
17257 <p><!--para 4 -->
17258 If two elements compare as equal, their order in the resulting sorted array is unspecified.
17259 <h6>Returns</h6>
17260 <p><!--para 5 -->
17261 The qsort function returns no value.
17263 <h4><a name="7.22.6" href="#7.22.6">7.22.6 Integer arithmetic functions</a></h4>
17265 <h5><a name="7.22.6.1" href="#7.22.6.1">7.22.6.1 The abs, labs and llabs functions</a></h5>
17266 <h6>Synopsis</h6>
17267 <p><!--para 1 -->
17268 <pre>
17269 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17270 int abs(int j);
17271 long int labs(long int j);
17272 long long int llabs(long long int j);</pre>
17273 <h6>Description</h6>
17274 <p><!--para 2 -->
17275 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
17276 result cannot be represented, the behavior is undefined.<sup><a href="#note297"><b>297)</b></a></sup>
17277 <h6>Returns</h6>
17278 <p><!--para 3 -->
17279 The abs, labs, and llabs, functions return the absolute value.
17284 <!--page 374 -->
17286 <h6>footnotes</h6>
17287 <p><small><a name="note297" href="#note297">297)</a> The absolute value of the most negative number cannot be represented in two's complement.
17288 </small>
17290 <h5><a name="7.22.6.2" href="#7.22.6.2">7.22.6.2 The div, ldiv, and lldiv functions</a></h5>
17291 <h6>Synopsis</h6>
17292 <p><!--para 1 -->
17293 <pre>
17294 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17295 div_t div(int numer, int denom);
17296 ldiv_t ldiv(long int numer, long int denom);
17297 lldiv_t lldiv(long long int numer, long long int denom);</pre>
17298 <h6>Description</h6>
17299 <p><!--para 2 -->
17300 The div, ldiv, and lldiv, functions compute numer / denom and numer %
17301 denom in a single operation.
17302 <h6>Returns</h6>
17303 <p><!--para 3 -->
17304 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
17305 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
17306 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
17307 each of which has the same type as the arguments numer and denom. If either part of
17308 the result cannot be represented, the behavior is undefined.
17310 <h4><a name="7.22.7" href="#7.22.7">7.22.7 Multibyte/wide character conversion functions</a></h4>
17311 <p><!--para 1 -->
17312 The behavior of the multibyte character functions is affected by the LC_CTYPE category
17313 of the current locale. For a state-dependent encoding, each function is placed into its
17314 initial conversion state at program startup and can be returned to that state by a call for
17315 which its character pointer argument, s, is a null pointer. Subsequent calls with s as
17316 other than a null pointer cause the internal conversion state of the function to be altered as
17317 necessary. A call with s as a null pointer causes these functions to return a nonzero value
17318 if encodings have state dependency, and zero otherwise.<sup><a href="#note298"><b>298)</b></a></sup> Changing the LC_CTYPE
17319 category causes the conversion state of these functions to be indeterminate.
17321 <h6>footnotes</h6>
17322 <p><small><a name="note298" href="#note298">298)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
17323 character codes, but are grouped with an adjacent multibyte character.
17324 </small>
17326 <h5><a name="7.22.7.1" href="#7.22.7.1">7.22.7.1 The mblen function</a></h5>
17327 <h6>Synopsis</h6>
17328 <p><!--para 1 -->
17329 <pre>
17330 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17331 int mblen(const char *s, size_t n);</pre>
17332 <h6>Description</h6>
17333 <p><!--para 2 -->
17334 If s is not a null pointer, the mblen function determines the number of bytes contained
17335 in the multibyte character pointed to by s. Except that the conversion state of the
17336 mbtowc function is not affected, it is equivalent to
17340 <!--page 375 -->
17341 <p><!--para 3 -->
17342 <pre>
17343 mbtowc((wchar_t *)0, (const char *)0, 0);
17344 mbtowc((wchar_t *)0, s, n);</pre>
17345 The implementation shall behave as if no library function calls the mblen function.
17346 <h6>Returns</h6>
17347 <p><!--para 4 -->
17348 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
17349 character encodings, respectively, do or do not have state-dependent encodings. If s is
17350 not a null pointer, the mblen function either returns 0 (if s points to the null character),
17351 or returns the number of bytes that are contained in the multibyte character (if the next n
17352 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
17353 multibyte character).
17354 <p><b> Forward references</b>: the mbtowc function (<a href="#7.22.7.2">7.22.7.2</a>).
17356 <h5><a name="7.22.7.2" href="#7.22.7.2">7.22.7.2 The mbtowc function</a></h5>
17357 <h6>Synopsis</h6>
17358 <p><!--para 1 -->
17359 <pre>
17360 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17361 int mbtowc(wchar_t * restrict pwc,
17362 const char * restrict s,
17363 size_t n);</pre>
17364 <h6>Description</h6>
17365 <p><!--para 2 -->
17366 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
17367 the byte pointed to by s to determine the number of bytes needed to complete the next
17368 multibyte character (including any shift sequences). If the function determines that the
17369 next multibyte character is complete and valid, it determines the value of the
17370 corresponding wide character and then, if pwc is not a null pointer, stores that value in
17371 the object pointed to by pwc. If the corresponding wide character is the null wide
17372 character, the function is left in the initial conversion state.
17373 <p><!--para 3 -->
17374 The implementation shall behave as if no library function calls the mbtowc function.
17375 <h6>Returns</h6>
17376 <p><!--para 4 -->
17377 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
17378 character encodings, respectively, do or do not have state-dependent encodings. If s is
17379 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
17380 or returns the number of bytes that are contained in the converted multibyte character (if
17381 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
17382 form a valid multibyte character).
17383 <p><!--para 5 -->
17384 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
17385 macro.
17386 <!--page 376 -->
17388 <h5><a name="7.22.7.3" href="#7.22.7.3">7.22.7.3 The wctomb function</a></h5>
17389 <h6>Synopsis</h6>
17390 <p><!--para 1 -->
17391 <pre>
17392 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17393 int wctomb(char *s, wchar_t wc);</pre>
17394 <h6>Description</h6>
17395 <p><!--para 2 -->
17396 The wctomb function determines the number of bytes needed to represent the multibyte
17397 character corresponding to the wide character given by wc (including any shift
17398 sequences), and stores the multibyte character representation in the array whose first
17399 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
17400 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
17401 sequence needed to restore the initial shift state, and the function is left in the initial
17402 conversion state.
17403 <p><!--para 3 -->
17404 The implementation shall behave as if no library function calls the wctomb function.
17405 <h6>Returns</h6>
17406 <p><!--para 4 -->
17407 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
17408 character encodings, respectively, do or do not have state-dependent encodings. If s is
17409 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
17410 to a valid multibyte character, or returns the number of bytes that are contained in the
17411 multibyte character corresponding to the value of wc.
17412 <p><!--para 5 -->
17413 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
17415 <h4><a name="7.22.8" href="#7.22.8">7.22.8 Multibyte/wide string conversion functions</a></h4>
17416 <p><!--para 1 -->
17417 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
17418 the current locale.
17420 <h5><a name="7.22.8.1" href="#7.22.8.1">7.22.8.1 The mbstowcs function</a></h5>
17421 <h6>Synopsis</h6>
17422 <p><!--para 1 -->
17423 <pre>
17424 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17425 size_t mbstowcs(wchar_t * restrict pwcs,
17426 const char * restrict s,
17427 size_t n);</pre>
17428 <h6>Description</h6>
17429 <p><!--para 2 -->
17430 The mbstowcs function converts a sequence of multibyte characters that begins in the
17431 initial shift state from the array pointed to by s into a sequence of corresponding wide
17432 characters and stores not more than n wide characters into the array pointed to by pwcs.
17433 No multibyte characters that follow a null character (which is converted into a null wide
17434 character) will be examined or converted. Each multibyte character is converted as if by
17435 a call to the mbtowc function, except that the conversion state of the mbtowc function is
17436 <!--page 377 -->
17437 not affected.
17438 <p><!--para 3 -->
17439 No more than n elements will be modified in the array pointed to by pwcs. If copying
17440 takes place between objects that overlap, the behavior is undefined.
17441 <h6>Returns</h6>
17442 <p><!--para 4 -->
17443 If an invalid multibyte character is encountered, the mbstowcs function returns
17444 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
17445 elements modified, not including a terminating null wide character, if any.<sup><a href="#note299"><b>299)</b></a></sup>
17447 <h6>footnotes</h6>
17448 <p><small><a name="note299" href="#note299">299)</a> The array will not be null-terminated if the value returned is n.
17449 </small>
17451 <h5><a name="7.22.8.2" href="#7.22.8.2">7.22.8.2 The wcstombs function</a></h5>
17452 <h6>Synopsis</h6>
17453 <p><!--para 1 -->
17454 <pre>
17455 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17456 size_t wcstombs(char * restrict s,
17457 const wchar_t * restrict pwcs,
17458 size_t n);</pre>
17459 <h6>Description</h6>
17460 <p><!--para 2 -->
17461 The wcstombs function converts a sequence of wide characters from the array pointed
17462 to by pwcs into a sequence of corresponding multibyte characters that begins in the
17463 initial shift state, and stores these multibyte characters into the array pointed to by s,
17464 stopping if a multibyte character would exceed the limit of n total bytes or if a null
17465 character is stored. Each wide character is converted as if by a call to the wctomb
17466 function, except that the conversion state of the wctomb function is not affected.
17467 <p><!--para 3 -->
17468 No more than n bytes will be modified in the array pointed to by s. If copying takes place
17469 between objects that overlap, the behavior is undefined.
17470 <h6>Returns</h6>
17471 <p><!--para 4 -->
17472 If a wide character is encountered that does not correspond to a valid multibyte character,
17473 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
17474 returns the number of bytes modified, not including a terminating null character, if
17475 any.<sup><a href="#note299"><b>299)</b></a></sup>
17480 <!--page 378 -->
17482 <h3><a name="7.23" href="#7.23">7.23 String handling <string.h></a></h3>
17484 <h4><a name="7.23.1" href="#7.23.1">7.23.1 String function conventions</a></h4>
17485 <p><!--para 1 -->
17486 The header <a href="#7.23">&lt;string.h&gt;</a> declares one type and several functions, and defines one
17487 macro useful for manipulating arrays of character type and other objects treated as arrays
17488 of character type.<sup><a href="#note300"><b>300)</b></a></sup> The type is size_t and the macro is NULL (both described in
17489 <a href="#7.19">7.19</a>). Various methods are used for determining the lengths of the arrays, but in all cases
17490 a char * or void * argument points to the initial (lowest addressed) character of the
17491 array. If an array is accessed beyond the end of an object, the behavior is undefined.
17492 <p><!--para 2 -->
17493 Where an argument declared as size_t n specifies the length of the array for a
17494 function, n can have the value zero on a call to that function. Unless explicitly stated
17495 otherwise in the description of a particular function in this subclause, pointer arguments
17496 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
17497 function that locates a character finds no occurrence, a function that compares two
17498 character sequences returns zero, and a function that copies characters copies zero
17499 characters.
17500 <p><!--para 3 -->
17501 For all functions in this subclause, each character shall be interpreted as if it had the type
17502 unsigned char (and therefore every possible object representation is valid and has a
17503 different value).
17505 <h6>footnotes</h6>
17506 <p><small><a name="note300" href="#note300">300)</a> See ''future library directions'' (<a href="#7.30.11">7.30.11</a>).
17507 </small>
17509 <h4><a name="7.23.2" href="#7.23.2">7.23.2 Copying functions</a></h4>
17511 <h5><a name="7.23.2.1" href="#7.23.2.1">7.23.2.1 The memcpy function</a></h5>
17512 <h6>Synopsis</h6>
17513 <p><!--para 1 -->
17514 <pre>
17515 #include <a href="#7.23">&lt;string.h&gt;</a>
17516 void *memcpy(void * restrict s1,
17517 const void * restrict s2,
17518 size_t n);</pre>
17519 <h6>Description</h6>
17520 <p><!--para 2 -->
17521 The memcpy function copies n characters from the object pointed to by s2 into the
17522 object pointed to by s1. If copying takes place between objects that overlap, the behavior
17523 is undefined.
17524 <h6>Returns</h6>
17525 <p><!--para 3 -->
17526 The memcpy function returns the value of s1.
17531 <!--page 379 -->
17533 <h5><a name="7.23.2.2" href="#7.23.2.2">7.23.2.2 The memmove function</a></h5>
17534 <h6>Synopsis</h6>
17535 <p><!--para 1 -->
17536 <pre>
17537 #include <a href="#7.23">&lt;string.h&gt;</a>
17538 void *memmove(void *s1, const void *s2, size_t n);</pre>
17539 <h6>Description</h6>
17540 <p><!--para 2 -->
17541 The memmove function copies n characters from the object pointed to by s2 into the
17542 object pointed to by s1. Copying takes place as if the n characters from the object
17543 pointed to by s2 are first copied into a temporary array of n characters that does not
17544 overlap the objects pointed to by s1 and s2, and then the n characters from the
17545 temporary array are copied into the object pointed to by s1.
17546 <h6>Returns</h6>
17547 <p><!--para 3 -->
17548 The memmove function returns the value of s1.
17550 <h5><a name="7.23.2.3" href="#7.23.2.3">7.23.2.3 The strcpy function</a></h5>
17551 <h6>Synopsis</h6>
17552 <p><!--para 1 -->
17553 <pre>
17554 #include <a href="#7.23">&lt;string.h&gt;</a>
17555 char *strcpy(char * restrict s1,
17556 const char * restrict s2);</pre>
17557 <h6>Description</h6>
17558 <p><!--para 2 -->
17559 The strcpy function copies the string pointed to by s2 (including the terminating null
17560 character) into the array pointed to by s1. If copying takes place between objects that
17561 overlap, the behavior is undefined.
17562 <h6>Returns</h6>
17563 <p><!--para 3 -->
17564 The strcpy function returns the value of s1.
17566 <h5><a name="7.23.2.4" href="#7.23.2.4">7.23.2.4 The strncpy function</a></h5>
17567 <h6>Synopsis</h6>
17568 <p><!--para 1 -->
17569 <pre>
17570 #include <a href="#7.23">&lt;string.h&gt;</a>
17571 char *strncpy(char * restrict s1,
17572 const char * restrict s2,
17573 size_t n);</pre>
17574 <h6>Description</h6>
17575 <p><!--para 2 -->
17576 The strncpy function copies not more than n characters (characters that follow a null
17577 character are not copied) from the array pointed to by s2 to the array pointed to by
17578 <!--page 380 -->
17579 s1.<sup><a href="#note301"><b>301)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
17580 <p><!--para 3 -->
17581 If the array pointed to by s2 is a string that is shorter than n characters, null characters
17582 are appended to the copy in the array pointed to by s1, until n characters in all have been
17583 written.
17584 <h6>Returns</h6>
17585 <p><!--para 4 -->
17586 The strncpy function returns the value of s1.
17588 <h6>footnotes</h6>
17589 <p><small><a name="note301" href="#note301">301)</a> Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
17590 not be null-terminated.
17591 </small>
17593 <h4><a name="7.23.3" href="#7.23.3">7.23.3 Concatenation functions</a></h4>
17595 <h5><a name="7.23.3.1" href="#7.23.3.1">7.23.3.1 The strcat function</a></h5>
17596 <h6>Synopsis</h6>
17597 <p><!--para 1 -->
17598 <pre>
17599 #include <a href="#7.23">&lt;string.h&gt;</a>
17600 char *strcat(char * restrict s1,
17601 const char * restrict s2);</pre>
17602 <h6>Description</h6>
17603 <p><!--para 2 -->
17604 The strcat function appends a copy of the string pointed to by s2 (including the
17605 terminating null character) to the end of the string pointed to by s1. The initial character
17606 of s2 overwrites the null character at the end of s1. If copying takes place between
17607 objects that overlap, the behavior is undefined.
17608 <h6>Returns</h6>
17609 <p><!--para 3 -->
17610 The strcat function returns the value of s1.
17612 <h5><a name="7.23.3.2" href="#7.23.3.2">7.23.3.2 The strncat function</a></h5>
17613 <h6>Synopsis</h6>
17614 <p><!--para 1 -->
17615 <pre>
17616 #include <a href="#7.23">&lt;string.h&gt;</a>
17617 char *strncat(char * restrict s1,
17618 const char * restrict s2,
17619 size_t n);</pre>
17620 <h6>Description</h6>
17621 <p><!--para 2 -->
17622 The strncat function appends not more than n characters (a null character and
17623 characters that follow it are not appended) from the array pointed to by s2 to the end of
17624 the string pointed to by s1. The initial character of s2 overwrites the null character at the
17625 end of s1. A terminating null character is always appended to the result.<sup><a href="#note302"><b>302)</b></a></sup> If copying
17627 <!--page 381 -->
17628 takes place between objects that overlap, the behavior is undefined.
17629 <h6>Returns</h6>
17630 <p><!--para 3 -->
17631 The strncat function returns the value of s1.
17632 <p><b> Forward references</b>: the strlen function (<a href="#7.23.6.3">7.23.6.3</a>).
17634 <h6>footnotes</h6>
17635 <p><small><a name="note302" href="#note302">302)</a> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
17636 strlen(s1)+n+1.
17637 </small>
17639 <h4><a name="7.23.4" href="#7.23.4">7.23.4 Comparison functions</a></h4>
17640 <p><!--para 1 -->
17641 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
17642 and strncmp is determined by the sign of the difference between the values of the first
17643 pair of characters (both interpreted as unsigned char) that differ in the objects being
17644 compared.
17646 <h5><a name="7.23.4.1" href="#7.23.4.1">7.23.4.1 The memcmp function</a></h5>
17647 <h6>Synopsis</h6>
17648 <p><!--para 1 -->
17649 <pre>
17650 #include <a href="#7.23">&lt;string.h&gt;</a>
17651 int memcmp(const void *s1, const void *s2, size_t n);</pre>
17652 <h6>Description</h6>
17653 <p><!--para 2 -->
17654 The memcmp function compares the first n characters of the object pointed to by s1 to
17655 the first n characters of the object pointed to by s2.<sup><a href="#note303"><b>303)</b></a></sup>
17656 <h6>Returns</h6>
17657 <p><!--para 3 -->
17658 The memcmp function returns an integer greater than, equal to, or less than zero,
17659 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
17660 pointed to by s2.
17662 <h6>footnotes</h6>
17663 <p><small><a name="note303" href="#note303">303)</a> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
17664 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
17665 comparison.
17666 </small>
17668 <h5><a name="7.23.4.2" href="#7.23.4.2">7.23.4.2 The strcmp function</a></h5>
17669 <h6>Synopsis</h6>
17670 <p><!--para 1 -->
17671 <pre>
17672 #include <a href="#7.23">&lt;string.h&gt;</a>
17673 int strcmp(const char *s1, const char *s2);</pre>
17674 <h6>Description</h6>
17675 <p><!--para 2 -->
17676 The strcmp function compares the string pointed to by s1 to the string pointed to by
17678 <h6>Returns</h6>
17679 <p><!--para 3 -->
17680 The strcmp function returns an integer greater than, equal to, or less than zero,
17681 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
17683 <!--page 382 -->
17684 pointed to by s2.
17686 <h5><a name="7.23.4.3" href="#7.23.4.3">7.23.4.3 The strcoll function</a></h5>
17687 <h6>Synopsis</h6>
17688 <p><!--para 1 -->
17689 <pre>
17690 #include <a href="#7.23">&lt;string.h&gt;</a>
17691 int strcoll(const char *s1, const char *s2);</pre>
17692 <h6>Description</h6>
17693 <p><!--para 2 -->
17694 The strcoll function compares the string pointed to by s1 to the string pointed to by
17695 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
17696 <h6>Returns</h6>
17697 <p><!--para 3 -->
17698 The strcoll function returns an integer greater than, equal to, or less than zero,
17699 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
17700 pointed to by s2 when both are interpreted as appropriate to the current locale.
17702 <h5><a name="7.23.4.4" href="#7.23.4.4">7.23.4.4 The strncmp function</a></h5>
17703 <h6>Synopsis</h6>
17704 <p><!--para 1 -->
17705 <pre>
17706 #include <a href="#7.23">&lt;string.h&gt;</a>
17707 int strncmp(const char *s1, const char *s2, size_t n);</pre>
17708 <h6>Description</h6>
17709 <p><!--para 2 -->
17710 The strncmp function compares not more than n characters (characters that follow a
17711 null character are not compared) from the array pointed to by s1 to the array pointed to
17712 by s2.
17713 <h6>Returns</h6>
17714 <p><!--para 3 -->
17715 The strncmp function returns an integer greater than, equal to, or less than zero,
17716 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
17717 to, or less than the possibly null-terminated array pointed to by s2.
17719 <h5><a name="7.23.4.5" href="#7.23.4.5">7.23.4.5 The strxfrm function</a></h5>
17720 <h6>Synopsis</h6>
17721 <p><!--para 1 -->
17722 <pre>
17723 #include <a href="#7.23">&lt;string.h&gt;</a>
17724 size_t strxfrm(char * restrict s1,
17725 const char * restrict s2,
17726 size_t n);</pre>
17727 <h6>Description</h6>
17728 <p><!--para 2 -->
17729 The strxfrm function transforms the string pointed to by s2 and places the resulting
17730 string into the array pointed to by s1. The transformation is such that if the strcmp
17731 function is applied to two transformed strings, it returns a value greater than, equal to, or
17732 <!--page 383 -->
17733 less than zero, corresponding to the result of the strcoll function applied to the same
17734 two original strings. No more than n characters are placed into the resulting array
17735 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
17736 be a null pointer. If copying takes place between objects that overlap, the behavior is
17737 undefined.
17738 <h6>Returns</h6>
17739 <p><!--para 3 -->
17740 The strxfrm function returns the length of the transformed string (not including the
17741 terminating null character). If the value returned is n or more, the contents of the array
17742 pointed to by s1 are indeterminate.
17743 <p><!--para 4 -->
17744 EXAMPLE The value of the following expression is the size of the array needed to hold the
17745 transformation of the string pointed to by s.
17746 <pre>
17747 1 + strxfrm(NULL, s, 0)</pre>
17750 <h4><a name="7.23.5" href="#7.23.5">7.23.5 Search functions</a></h4>
17752 <h5><a name="7.23.5.1" href="#7.23.5.1">7.23.5.1 The memchr function</a></h5>
17753 <h6>Synopsis</h6>
17754 <p><!--para 1 -->
17755 <pre>
17756 #include <a href="#7.23">&lt;string.h&gt;</a>
17757 void *memchr(const void *s, int c, size_t n);</pre>
17758 <h6>Description</h6>
17759 <p><!--para 2 -->
17760 The memchr function locates the first occurrence of c (converted to an unsigned
17761 char) in the initial n characters (each interpreted as unsigned char) of the object
17762 pointed to by s. The implementation shall behave as if it reads the characters sequentially
17763 and stops as soon as a matching character is found.
17764 <h6>Returns</h6>
17765 <p><!--para 3 -->
17766 The memchr function returns a pointer to the located character, or a null pointer if the
17767 character does not occur in the object.
17769 <h5><a name="7.23.5.2" href="#7.23.5.2">7.23.5.2 The strchr function</a></h5>
17770 <h6>Synopsis</h6>
17771 <p><!--para 1 -->
17772 <pre>
17773 #include <a href="#7.23">&lt;string.h&gt;</a>
17774 char *strchr(const char *s, int c);</pre>
17775 <h6>Description</h6>
17776 <p><!--para 2 -->
17777 The strchr function locates the first occurrence of c (converted to a char) in the
17778 string pointed to by s. The terminating null character is considered to be part of the
17779 string.
17780 <!--page 384 -->
17781 <h6>Returns</h6>
17782 <p><!--para 3 -->
17783 The strchr function returns a pointer to the located character, or a null pointer if the
17784 character does not occur in the string.
17786 <h5><a name="7.23.5.3" href="#7.23.5.3">7.23.5.3 The strcspn function</a></h5>
17787 <h6>Synopsis</h6>
17788 <p><!--para 1 -->
17789 <pre>
17790 #include <a href="#7.23">&lt;string.h&gt;</a>
17791 size_t strcspn(const char *s1, const char *s2);</pre>
17792 <h6>Description</h6>
17793 <p><!--para 2 -->
17794 The strcspn function computes the length of the maximum initial segment of the string
17795 pointed to by s1 which consists entirely of characters not from the string pointed to by
17797 <h6>Returns</h6>
17798 <p><!--para 3 -->
17799 The strcspn function returns the length of the segment.
17801 <h5><a name="7.23.5.4" href="#7.23.5.4">7.23.5.4 The strpbrk function</a></h5>
17802 <h6>Synopsis</h6>
17803 <p><!--para 1 -->
17804 <pre>
17805 #include <a href="#7.23">&lt;string.h&gt;</a>
17806 char *strpbrk(const char *s1, const char *s2);</pre>
17807 <h6>Description</h6>
17808 <p><!--para 2 -->
17809 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
17810 character from the string pointed to by s2.
17811 <h6>Returns</h6>
17812 <p><!--para 3 -->
17813 The strpbrk function returns a pointer to the character, or a null pointer if no character
17814 from s2 occurs in s1.
17816 <h5><a name="7.23.5.5" href="#7.23.5.5">7.23.5.5 The strrchr function</a></h5>
17817 <h6>Synopsis</h6>
17818 <p><!--para 1 -->
17819 <pre>
17820 #include <a href="#7.23">&lt;string.h&gt;</a>
17821 char *strrchr(const char *s, int c);</pre>
17822 <h6>Description</h6>
17823 <p><!--para 2 -->
17824 The strrchr function locates the last occurrence of c (converted to a char) in the
17825 string pointed to by s. The terminating null character is considered to be part of the
17826 string.
17827 <!--page 385 -->
17828 <h6>Returns</h6>
17829 <p><!--para 3 -->
17830 The strrchr function returns a pointer to the character, or a null pointer if c does not
17831 occur in the string.
17833 <h5><a name="7.23.5.6" href="#7.23.5.6">7.23.5.6 The strspn function</a></h5>
17834 <h6>Synopsis</h6>
17835 <p><!--para 1 -->
17836 <pre>
17837 #include <a href="#7.23">&lt;string.h&gt;</a>
17838 size_t strspn(const char *s1, const char *s2);</pre>
17839 <h6>Description</h6>
17840 <p><!--para 2 -->
17841 The strspn function computes the length of the maximum initial segment of the string
17842 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
17843 <h6>Returns</h6>
17844 <p><!--para 3 -->
17845 The strspn function returns the length of the segment.
17847 <h5><a name="7.23.5.7" href="#7.23.5.7">7.23.5.7 The strstr function</a></h5>
17848 <h6>Synopsis</h6>
17849 <p><!--para 1 -->
17850 <pre>
17851 #include <a href="#7.23">&lt;string.h&gt;</a>
17852 char *strstr(const char *s1, const char *s2);</pre>
17853 <h6>Description</h6>
17854 <p><!--para 2 -->
17855 The strstr function locates the first occurrence in the string pointed to by s1 of the
17856 sequence of characters (excluding the terminating null character) in the string pointed to
17857 by s2.
17858 <h6>Returns</h6>
17859 <p><!--para 3 -->
17860 The strstr function returns a pointer to the located string, or a null pointer if the string
17861 is not found. If s2 points to a string with zero length, the function returns s1.
17863 <h5><a name="7.23.5.8" href="#7.23.5.8">7.23.5.8 The strtok function</a></h5>
17864 <h6>Synopsis</h6>
17865 <p><!--para 1 -->
17866 <pre>
17867 #include <a href="#7.23">&lt;string.h&gt;</a>
17868 char *strtok(char * restrict s1,
17869 const char * restrict s2);</pre>
17870 <h6>Description</h6>
17871 <p><!--para 2 -->
17872 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
17873 sequence of tokens, each of which is delimited by a character from the string pointed to
17874 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
17875 sequence have a null first argument. The separator string pointed to by s2 may be
17876 different from call to call.
17877 <!--page 386 -->
17878 <p><!--para 3 -->
17879 The first call in the sequence searches the string pointed to by s1 for the first character
17880 that is not contained in the current separator string pointed to by s2. If no such character
17881 is found, then there are no tokens in the string pointed to by s1 and the strtok function
17882 returns a null pointer. If such a character is found, it is the start of the first token.
17883 <p><!--para 4 -->
17884 The strtok function then searches from there for a character that is contained in the
17885 current separator string. If no such character is found, the current token extends to the
17886 end of the string pointed to by s1, and subsequent searches for a token will return a null
17887 pointer. If such a character is found, it is overwritten by a null character, which
17888 terminates the current token. The strtok function saves a pointer to the following
17889 character, from which the next search for a token will start.
17890 <p><!--para 5 -->
17891 Each subsequent call, with a null pointer as the value of the first argument, starts
17892 searching from the saved pointer and behaves as described above.
17893 <p><!--para 6 -->
17894 The strtok function is not required to avoid data races. The implementation shall
17895 behave as if no library function calls the strtok function.
17896 <h6>Returns</h6>
17897 <p><!--para 7 -->
17898 The strtok function returns a pointer to the first character of a token, or a null pointer
17899 if there is no token.
17900 <p><!--para 8 -->
17901 EXAMPLE
17902 <pre>
17903 #include <a href="#7.23">&lt;string.h&gt;</a>
17904 static char str[] = "?a???b,,,#c";
17905 char *t;
17906 t = strtok(str, "?"); // t points to the token "a"
17907 t = strtok(NULL, ","); // t points to the token "??b"
17908 t = strtok(NULL, "#,"); // t points to the token "c"
17909 t = strtok(NULL, "?"); // t is a null pointer</pre>
17912 <h4><a name="7.23.6" href="#7.23.6">7.23.6 Miscellaneous functions</a></h4>
17914 <h5><a name="7.23.6.1" href="#7.23.6.1">7.23.6.1 The memset function</a></h5>
17915 <h6>Synopsis</h6>
17916 <p><!--para 1 -->
17917 <pre>
17918 #include <a href="#7.23">&lt;string.h&gt;</a>
17919 void *memset(void *s, int c, size_t n);</pre>
17920 <h6>Description</h6>
17921 <p><!--para 2 -->
17922 The memset function copies the value of c (converted to an unsigned char) into
17923 each of the first n characters of the object pointed to by s.
17924 <h6>Returns</h6>
17925 <p><!--para 3 -->
17926 The memset function returns the value of s.
17927 <!--page 387 -->
17929 <h5><a name="7.23.6.2" href="#7.23.6.2">7.23.6.2 The strerror function</a></h5>
17930 <h6>Synopsis</h6>
17931 <p><!--para 1 -->
17932 <pre>
17933 #include <a href="#7.23">&lt;string.h&gt;</a>
17934 char *strerror(int errnum);</pre>
17935 <h6>Description</h6>
17936 <p><!--para 2 -->
17937 The strerror function maps the number in errnum to a message string. Typically,
17938 the values for errnum come from errno, but strerror shall map any value of type
17939 int to a message.
17940 <p><!--para 3 -->
17941 The strerror function is not required to avoid data races. The implementation shall
17942 behave as if no library function calls the strerror function.
17943 <h6>Returns</h6>
17944 <p><!--para 4 -->
17945 The strerror function returns a pointer to the string, the contents of which are locale-
17946 specific. The array pointed to shall not be modified by the program, but may be
17947 overwritten by a subsequent call to the strerror function.
17949 <h5><a name="7.23.6.3" href="#7.23.6.3">7.23.6.3 The strlen function</a></h5>
17950 <h6>Synopsis</h6>
17951 <p><!--para 1 -->
17952 <pre>
17953 #include <a href="#7.23">&lt;string.h&gt;</a>
17954 size_t strlen(const char *s);</pre>
17955 <h6>Description</h6>
17956 <p><!--para 2 -->
17957 The strlen function computes the length of the string pointed to by s.
17958 <h6>Returns</h6>
17959 <p><!--para 3 -->
17960 The strlen function returns the number of characters that precede the terminating null
17961 character.
17962 <!--page 388 -->
17964 <h3><a name="7.24" href="#7.24">7.24 Type-generic math <tgmath.h></a></h3>
17965 <p><!--para 1 -->
17966 The header <a href="#7.24">&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
17967 defines several type-generic macros.
17968 <p><!--para 2 -->
17969 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
17970 double) suffix, several have one or more parameters whose corresponding real type is
17971 double. For each such function, except modf, there is a corresponding type-generic
17972 macro.<sup><a href="#note304"><b>304)</b></a></sup> The parameters whose corresponding real type is double in the function
17973 synopsis are generic parameters. Use of the macro invokes a function whose
17974 corresponding real type and type domain are determined by the arguments for the generic
17975 parameters.<sup><a href="#note305"><b>305)</b></a></sup>
17976 <p><!--para 3 -->
17977 Use of the macro invokes a function whose generic parameters have the corresponding
17978 real type determined as follows:
17979 <ul>
17980 <li> First, if any argument for generic parameters has type long double, the type
17981 determined is long double.
17982 <li> Otherwise, if any argument for generic parameters has type double or is of integer
17983 type, the type determined is double.
17984 <li> Otherwise, the type determined is float.
17985 </ul>
17986 <p><!--para 4 -->
17987 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
17988 <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
17989 generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
17990 corresponding type-generic macro for fabs and cabs is fabs.
17995 <!--page 389 -->
17996 <pre>
17997 <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.3">&lt;complex.h&gt;</a> type-generic
17998 function function macro
17999 acos cacos acos
18000 asin casin asin
18001 atan catan atan
18002 acosh cacosh acosh
18003 asinh casinh asinh
18004 atanh catanh atanh
18005 cos ccos cos
18006 sin csin sin
18007 tan ctan tan
18008 cosh ccosh cosh
18009 sinh csinh sinh
18010 tanh ctanh tanh
18011 exp cexp exp
18012 log clog log
18013 pow cpow pow
18014 sqrt csqrt sqrt
18015 fabs cabs fabs</pre>
18016 If at least one argument for a generic parameter is complex, then use of the macro invokes
18017 a complex function; otherwise, use of the macro invokes a real function.
18018 <p><!--para 5 -->
18019 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
18020 <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
18021 name as the function. These type-generic macros are:
18022 <pre>
18023 atan2 fma llround remainder
18024 cbrt fmax log10 remquo
18025 ceil fmin log1p rint
18026 copysign fmod log2 round
18027 erf frexp logb scalbn
18028 erfc hypot lrint scalbln
18029 exp2 ilogb lround tgamma
18030 expm1 ldexp nearbyint trunc
18031 fdim lgamma nextafter
18032 floor llrint nexttoward</pre>
18033 If all arguments for generic parameters are real, then use of the macro invokes a real
18034 function; otherwise, use of the macro results in undefined behavior.
18035 <!--page 390 -->
18036 <p><!--para 6 -->
18037 For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
18038 function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
18039 function. These type-generic macros are:
18040 <pre>
18041 carg conj creal
18042 cimag cproj</pre>
18043 Use of the macro with any real or complex argument invokes a complex function.
18044 <p><!--para 7 -->
18045 EXAMPLE With the declarations
18046 <pre>
18047 #include <a href="#7.24">&lt;tgmath.h&gt;</a>
18048 int n;
18049 float f;
18050 double d;
18051 long double ld;
18052 float complex fc;
18053 double complex dc;
18054 long double complex ldc;</pre>
18055 functions invoked by use of type-generic macros are shown in the following table:
18056 <!--page 391 -->
18057 <pre>
18058 macro use invokes
18059 exp(n) exp(n), the function
18060 acosh(f) acoshf(f)
18061 sin(d) sin(d), the function
18062 atan(ld) atanl(ld)
18063 log(fc) clogf(fc)
18064 sqrt(dc) csqrt(dc)
18065 pow(ldc, f) cpowl(ldc, f)
18066 remainder(n, n) remainder(n, n), the function
18067 nextafter(d, f) nextafter(d, f), the function
18068 nexttoward(f, ld) nexttowardf(f, ld)
18069 copysign(n, ld) copysignl(n, ld)
18070 ceil(fc) undefined behavior
18071 rint(dc) undefined behavior
18072 fmax(ldc, ld) undefined behavior
18073 carg(n) carg(n), the function
18074 cproj(f) cprojf(f)
18075 creal(d) creal(d), the function
18076 cimag(ld) cimagl(ld)
18077 fabs(fc) cabsf(fc)
18078 carg(dc) carg(dc), the function
18079 cproj(ldc) cprojl(ldc)</pre>
18081 <h6>footnotes</h6>
18082 <p><small><a name="note304" href="#note304">304)</a> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
18083 make available the corresponding ordinary function.
18084 </small>
18085 <p><small><a name="note305" href="#note305">305)</a> If the type of the argument is not compatible with the type of the parameter for the selected function,
18086 the behavior is undefined.
18087 </small>
18089 <h3><a name="7.25" href="#7.25">7.25 Threads <threads.h></a></h3>
18091 <h4><a name="7.25.1" href="#7.25.1">7.25.1 Introduction</a></h4>
18092 <p><!--para 1 -->
18093 The header <a href="#7.25">&lt;threads.h&gt;</a> defines macros, and declares types, enumeration constants,
18094 and functions that support multiple threads of execution.
18095 <p><!--para 2 -->
18096 Implementations that define the macro __STDC_NO_THREADS__ need not provide
18097 this header nor support any of its facilities.
18098 <p><!--para 3 -->
18099 The macros are
18100 <pre>
18101 ONCE_FLAG_INIT</pre>
18102 which expands to a value that can be used to initialize an object of type once_flag;
18104 <pre>
18105 TSS_DTOR_ITERATIONS</pre>
18106 which expands to an integer constant expression representing the maximum number of
18107 times that destructors will be called when a thread terminates.
18108 <p><!--para 4 -->
18109 The types are
18110 <pre>
18111 cnd_t</pre>
18112 which is a complete object type that holds an identifier for a condition variable;
18113 <pre>
18114 thrd_t</pre>
18115 which is a complete object type that holds an identifier for a thread;
18116 <pre>
18117 tss_t</pre>
18118 which is a complete object type that holds an identifier for a thread-specific storage
18119 pointer;
18120 <pre>
18121 mtx_t</pre>
18122 which is a complete object type that holds an identifier for a mutex;
18123 <pre>
18124 tss_dtor_t</pre>
18125 which is the function pointer type void (*)(void*), used for a destructor for a
18126 thread-specific storage pointer;
18127 <pre>
18128 thrd_start_t</pre>
18129 which is the function pointer type int (*)(void*) that is passed to thrd_create
18130 to create a new thread;
18131 <pre>
18132 once_flag</pre>
18133 which is a complete object type that holds a flag for use by call_once; and
18134 <!--page 392 -->
18135 <pre>
18136 xtime</pre>
18137 which is a structure type that holds a time specified in seconds and nanoseconds. The
18138 structure shall contain at least the following members, in any order.
18139 <p><!--para 5 -->
18140 <pre>
18141 time_t sec;
18142 long nsec;</pre>
18143 The enumeration constants are
18144 <pre>
18145 mtx_plain</pre>
18146 which is passed to mtx_init to create a mutex object that supports neither timeout nor
18147 test and return;
18148 <pre>
18149 mtx_recursive</pre>
18150 which is passed to mtx_init to create a mutex object that supports recursive locking;
18151 <pre>
18152 mtx_timed</pre>
18153 which is passed to mtx_init to create a mutex object that supports timeout;
18154 <pre>
18155 mtx_try</pre>
18156 which is passed to mtx_init to create a mutex object that supports test and return;
18157 <pre>
18158 thrd_timeout</pre>
18159 which is returned by a timed wait function to indicate that the time specified in the call
18160 was reached without acquiring the requested resource;
18161 <pre>
18162 thrd_success</pre>
18163 which is returned by a function to indicate that the requested operation succeeded;
18164 <pre>
18165 thrd_busy</pre>
18166 which is returned by a function to indicate that the requested operation failed because a
18167 resource requested by a test and return function is already in use;
18168 <pre>
18169 thrd_error</pre>
18170 which is returned by a function to indicate that the requested operation failed; and
18171 <pre>
18172 thrd_nomem</pre>
18173 which is returned by a function to indicate that the requested operation failed because it
18174 was unable to allocate memory.
18175 <!--page 393 -->
18177 <h4><a name="7.25.2" href="#7.25.2">7.25.2 Initialization functions</a></h4>
18179 <h5><a name="7.25.2.1" href="#7.25.2.1">7.25.2.1 The call_once function</a></h5>
18180 <h6>Synopsis</h6>
18181 <p><!--para 1 -->
18182 <pre>
18183 #include <a href="#7.25">&lt;threads.h&gt;</a>
18184 void call_once(once_flag *flag, void (*func)(void));</pre>
18185 <h6>Description</h6>
18186 <p><!--para 2 -->
18187 The call_once function uses the once_flag pointed to by flag to ensure that
18188 func is called exactly once, the first time the call_once function is called with that
18189 value of flag. Completion of an effective call to the call_once function synchronizes
18190 with all subsequent calls to the call_once function with the same value of flag.
18191 <h6>Returns</h6>
18192 <p><!--para 3 -->
18193 The call_once function returns no value.
18195 <h4><a name="7.25.3" href="#7.25.3">7.25.3 Condition variable functions</a></h4>
18197 <h5><a name="7.25.3.1" href="#7.25.3.1">7.25.3.1 The cnd_broadcast function</a></h5>
18198 <h6>Synopsis</h6>
18199 <p><!--para 1 -->
18200 <pre>
18201 #include <a href="#7.25">&lt;threads.h&gt;</a>
18202 int cnd_broadcast(cnd_t *cond);</pre>
18203 <h6>Description</h6>
18204 <p><!--para 2 -->
18205 The cnd_broadcast function unblocks all of the threads that are blocked on the
18206 condition variable pointed to by cond at the time of the call. If no threads are blocked
18207 on the condition variable pointed to by cond at the time of the call, the function does
18208 nothing.
18209 <h6>Returns</h6>
18210 <p><!--para 3 -->
18211 The cnd_broadcast function returns thrd_success on success, or thrd_error
18212 if the request could not be honored.
18214 <h5><a name="7.25.3.2" href="#7.25.3.2">7.25.3.2 The cnd_destroy function</a></h5>
18215 <h6>Synopsis</h6>
18216 <p><!--para 1 -->
18217 <pre>
18218 #include <a href="#7.25">&lt;threads.h&gt;</a>
18219 void cnd_destroy(cnd_t *cond);</pre>
18220 <h6>Description</h6>
18221 <p><!--para 2 -->
18222 The cnd_destroy function releases all resources used by the condition variable
18223 pointed to by cond. The cnd_destroy function requires that no threads be blocked
18224 waiting for the condition variable pointed to by cond.
18225 <!--page 394 -->
18226 <h6>Returns</h6>
18227 <p><!--para 3 -->
18228 The cnd_destroy function returns no value.
18230 <h5><a name="7.25.3.3" href="#7.25.3.3">7.25.3.3 The cnd_init function</a></h5>
18231 <h6>Synopsis</h6>
18232 <p><!--para 1 -->
18233 <pre>
18234 #include <a href="#7.25">&lt;threads.h&gt;</a>
18235 int cnd_init(cnd_t *cond);</pre>
18236 <h6>Description</h6>
18237 <p><!--para 2 -->
18238 The cnd_init function creates a condition variable. If it succeeds it sets the variable
18239 pointed to by cond to a value that uniquely identifies the newly created condition
18240 variable. A thread that calls cnd_wait on a newly created condition variable will
18241 block.
18242 <h6>Returns</h6>
18243 <p><!--para 3 -->
18244 The cnd_init function returns thrd_success on success, or thrd_nomem if no
18245 memory could be allocated for the newly created condition, or thrd_error if the
18246 request could not be honored.
18248 <h5><a name="7.25.3.4" href="#7.25.3.4">7.25.3.4 The cnd_signal function</a></h5>
18249 <h6>Synopsis</h6>
18250 <p><!--para 1 -->
18251 <pre>
18252 #include <a href="#7.25">&lt;threads.h&gt;</a>
18253 int cnd_signal(cnd_t *cond);</pre>
18254 <h6>Description</h6>
18255 <p><!--para 2 -->
18256 The cnd_signal function unblocks one of the threads that are blocked on the
18257 condition variable pointed to by cond at the time of the call. If no threads are blocked
18258 on the condition variable at the time of the call, the function does nothing and return
18259 success.
18260 <h6>Returns</h6>
18261 <p><!--para 3 -->
18262 The cnd_signal function returns thrd_success on success or thrd_error if
18263 the request could not be honored.
18265 <h5><a name="7.25.3.5" href="#7.25.3.5">7.25.3.5 The cnd_timedwait function</a></h5>
18266 <h6>Synopsis</h6>
18267 <p><!--para 1 -->
18268 <!--page 395 -->
18269 <pre>
18270 #include <a href="#7.25">&lt;threads.h&gt;</a>
18271 int cnd_timedwait(cnd_t *cond, mtx_t *mtx,
18272 const xtime *xt);</pre>
18273 <h6>Description</h6>
18274 <p><!--para 2 -->
18275 The cnd_timedwait function atomically unlocks the mutex pointed to by mtx and
18276 endeavors to block until the condition variable pointed to by cond is signaled by a call to
18277 cnd_signal or to cnd_broadcast, or until after the time specified by the xtime
18278 object pointed to by xt. When the calling thread becomes unblocked it locks the variable
18279 pointed to by mtx before it returns. The cnd_timedwait function requires that the
18280 mutex pointed to by mtx be locked by the calling thread.
18281 <h6>Returns</h6>
18282 <p><!--para 3 -->
18283 The cnd_timedwait function returns thrd_success upon success, or
18284 thrd_timeout if the time specified in the call was reached without acquiring the
18285 requested resource, or thrd_error if the request could not be honored.
18287 <h5><a name="7.25.3.6" href="#7.25.3.6">7.25.3.6 The cnd_wait function</a></h5>
18288 <h6>Synopsis</h6>
18289 <p><!--para 1 -->
18290 <pre>
18291 #include <a href="#7.25">&lt;threads.h&gt;</a>
18292 int cnd_wait(cnd_t *cond, mtx_t *mtx);</pre>
18293 <h6>Description</h6>
18294 <p><!--para 2 -->
18295 The cnd_wait function atomically unlocks the mutex pointed to by mtx and endeavors
18296 to block until the condition variable pointed to by cond is signaled by a call to
18297 cnd_signal or to cnd_broadcast. When the calling thread becomes unblocked it
18298 locks the mutex pointed to by mtx before it returns. If the mutex pointed to by mtx is
18299 not locked by the calling thread, the cnd_wait function will act as if the abort
18300 function is called.
18301 <h6>Returns</h6>
18302 <p><!--para 3 -->
18303 The cnd_wait function returns thrd_success on success or thrd_error if the
18304 request could not be honored.
18306 <h4><a name="7.25.4" href="#7.25.4">7.25.4 Mutex functions</a></h4>
18308 <h5><a name="7.25.4.1" href="#7.25.4.1">7.25.4.1 The mtx_destroy function</a></h5>
18309 <h6>Synopsis</h6>
18310 <p><!--para 1 -->
18311 <pre>
18312 #include <a href="#7.25">&lt;threads.h&gt;</a>
18313 void mtx_destroy(mtx_t *mtx);</pre>
18314 <h6>Description</h6>
18315 <p><!--para 2 -->
18316 The mtx_destroy function releases any resources used by the mutex pointed to by
18317 mtx. No threads can be blocked waiting for the mutex pointed to by mtx.
18318 <!--page 396 -->
18319 <h6>Returns</h6>
18320 <p><!--para 3 -->
18321 The mtx_destroy function returns no value.
18323 <h5><a name="7.25.4.2" href="#7.25.4.2">7.25.4.2 The mtx_init function</a></h5>
18324 <h6>Synopsis</h6>
18325 <p><!--para 1 -->
18326 <pre>
18327 #include <a href="#7.25">&lt;threads.h&gt;</a>
18328 int mtx_init(mtx_t *mtx, int type);</pre>
18329 <h6>Description</h6>
18330 <p><!--para 2 -->
18331 The mtx_init function creates a mutex object with properties indicated by type,
18332 which must have one of the six values:
18333 mtx_plain for a simple non-recursive mutex,
18334 mtx_timed for a non-recursive mutex that supports timeout,
18335 mtx_try for a non-recursive mutex that supports test and return,
18336 mtx_plain | mtx_recursive for a simple recursive mutex,
18337 mtx_timed | mtx_recursive for a recursive mutex that supports timeout, or
18338 mtx_try | mtx_recursive for a recursive mutex that supports test and return.
18339 <p><!--para 3 -->
18340 If the mtx_init function succeeds, it sets the mutex pointed to by mtx to a value that
18341 uniquely identifies the newly created mutex.
18342 <h6>Returns</h6>
18343 <p><!--para 4 -->
18344 The mtx_init function returns thrd_success on success, or thrd_error if the
18345 request could not be honored.
18347 <h5><a name="7.25.4.3" href="#7.25.4.3">7.25.4.3 The mtx_lock function</a></h5>
18348 <h6>Synopsis</h6>
18349 <p><!--para 1 -->
18350 <pre>
18351 #include <a href="#7.25">&lt;threads.h&gt;</a>
18352 int mtx_lock(mtx_t *mtx);</pre>
18353 <h6>Description</h6>
18354 <p><!--para 2 -->
18355 The mtx_lock function blocks until it locks the mutex pointed to by mtx. If the mutex
18356 is non-recursive, it shall not be locked by the calling thread. Prior calls to mtx_unlock
18357 on the same mutex shall synchronize with this operation.
18358 <h6>Returns</h6>
18359 <p><!--para 3 -->
18360 The mtx_lock function returns thrd_success on success, or thrd_busy if the
18361 resource requested is already in use, or thrd_error if the request could not be
18362 honored.
18363 <!--page 397 -->
18365 <h5><a name="7.25.4.4" href="#7.25.4.4">7.25.4.4 The mtx_timedlock function</a></h5>
18366 <h6>Synopsis</h6>
18367 <p><!--para 1 -->
18368 <pre>
18369 #include <a href="#7.25">&lt;threads.h&gt;</a>
18370 int mtx_timedlock(mtx_t *mtx, const xtime *xt);</pre>
18371 <h6>Description</h6>
18372 <p><!--para 2 -->
18373 The mtx_timedlock function endeavors to block until it locks the mutex pointed to by
18374 mtx or until the time specified by the xtime object xt has passed. The specified mutex
18375 shall support timeout. If the operation succeeds, prior calls to mtx_unlock on the same
18376 mutex shall synchronize with this operation.
18377 <h6>Returns</h6>
18378 <p><!--para 3 -->
18379 The mtx_timedlock function returns thrd_success on success, or thrd_busy
18380 if the resource requested is already in use, or thrd_timeout if the time specified was
18381 reached without acquiring the requested resource, or thrd_error if the request could
18382 not be honored.
18384 <h5><a name="7.25.4.5" href="#7.25.4.5">7.25.4.5 The mtx_trylock function</a></h5>
18385 <h6>Synopsis</h6>
18386 <p><!--para 1 -->
18387 <pre>
18388 #include <a href="#7.25">&lt;threads.h&gt;</a>
18389 int mtx_trylock(mtx_t *mtx);</pre>
18390 <h6>Description</h6>
18391 <p><!--para 2 -->
18392 The mtx_trylock function endeavors to lock the mutex pointed to by mtx. The
18393 specified mutex shall support either test and return or timeout. If the mutex is already
18394 locked, the function returns without blocking. If the operation succeeds, prior calls to
18395 mtx_unlock on the same mutex shall synchronize with this operation.
18396 <h6>Returns</h6>
18397 <p><!--para 3 -->
18398 The mtx_trylock function returns thrd_success on success, or thrd_busy if
18399 the resource requested is already in use, or thrd_error if the request could not be
18400 honored.
18402 <h5><a name="7.25.4.6" href="#7.25.4.6">7.25.4.6 The mtx_unlock function</a></h5>
18403 <h6>Synopsis</h6>
18404 <p><!--para 1 -->
18405 <pre>
18406 #include <a href="#7.25">&lt;threads.h&gt;</a>
18407 int mtx_unlock(mtx_t *mtx);</pre>
18408 <h6>Description</h6>
18409 <p><!--para 2 -->
18410 The mtx_unlock function unlocks the mutex pointed to by mtx. The mutex pointed to
18411 by mtx shall be locked by the calling thread.
18412 <!--page 398 -->
18413 <h6>Returns</h6>
18414 <p><!--para 3 -->
18415 The mtx_unlock function returns thrd_success on success or thrd_error if
18416 the request could not be honored.
18418 <h4><a name="7.25.5" href="#7.25.5">7.25.5 Thread functions</a></h4>
18420 <h5><a name="7.25.5.1" href="#7.25.5.1">7.25.5.1 The thrd_create function</a></h5>
18421 <h6>Synopsis</h6>
18422 <p><!--para 1 -->
18423 <pre>
18424 #include <a href="#7.25">&lt;threads.h&gt;</a>
18425 int thrd_create(thrd_t *thr, thrd_start_t func,
18426 void *arg);</pre>
18427 <h6>Description</h6>
18428 <p><!--para 2 -->
18429 The thrd_create function creates a new thread executing func(arg). If the
18430 thrd_create function succeeds, it sets the object pointed to by thr to the identifier of
18431 the newly created thread. (A thread's identifier may be reused for a different thread once
18432 the original thread has exited and either been detached or joined to another thread.) The
18433 completion of the thrd_create function synchronizes with the beginning of the
18434 execution of the new thread.
18435 <h6>Returns</h6>
18436 <p><!--para 3 -->
18437 The thrd_create function returns thrd_success on success, or thrd_nomem if
18438 no memory could be allocated for the thread requested, or thrd_error if the request
18439 could not be honored.
18441 <h5><a name="7.25.5.2" href="#7.25.5.2">7.25.5.2 The thrd_current function</a></h5>
18442 <h6>Synopsis</h6>
18443 <p><!--para 1 -->
18444 <pre>
18445 #include <a href="#7.25">&lt;threads.h&gt;</a>
18446 thrd_t thrd_current(void);</pre>
18447 <h6>Description</h6>
18448 <p><!--para 2 -->
18449 The thrd_current function identifies the thread that called it.
18450 <h6>Returns</h6>
18451 <p><!--para 3 -->
18452 The thrd_current function returns the identifier of the thread that called it.
18454 <h5><a name="7.25.5.3" href="#7.25.5.3">7.25.5.3 The thrd_detach function</a></h5>
18455 <h6>Synopsis</h6>
18456 <p><!--para 1 -->
18457 <!--page 399 -->
18458 <pre>
18459 #include <a href="#7.25">&lt;threads.h&gt;</a>
18460 int thrd_detach(thrd_t thr);</pre>
18461 <h6>Description</h6>
18462 <p><!--para 2 -->
18463 The thrd_detach function tells the operating system to dispose of any resources
18464 allocated to the thread identified by thr when that thread terminates. The thread
18465 identified by thr shall not have been previously detached or joined with another thread.
18466 <h6>Returns</h6>
18467 <p><!--para 3 -->
18468 The thrd_detach function returns thrd_success on success or thrd_error if
18469 the request could not be honored.
18471 <h5><a name="7.25.5.4" href="#7.25.5.4">7.25.5.4 The thrd_equal function</a></h5>
18472 <h6>Synopsis</h6>
18473 <p><!--para 1 -->
18474 <pre>
18475 #include <a href="#7.25">&lt;threads.h&gt;</a>
18476 int thrd_equal(thrd_t thr0, thrd_t thr1);</pre>
18477 <h6>Description</h6>
18478 <p><!--para 2 -->
18479 The thrd_equal function will determine whether the thread identified by thr0 refers
18480 to the thread identified by thr1.
18481 <h6>Returns</h6>
18482 <p><!--para 3 -->
18483 The thrd_equal function returns zero if the thread thr0 and the thread thr1 refer to
18484 different threads. Otherwise the thrd_equal function returns a nonzero value.
18486 <h5><a name="7.25.5.5" href="#7.25.5.5">7.25.5.5 The thrd_exit function</a></h5>
18487 <h6>Synopsis</h6>
18488 <p><!--para 1 -->
18489 <pre>
18490 #include <a href="#7.25">&lt;threads.h&gt;</a>
18491 void thrd_exit(int res);</pre>
18492 <h6>Description</h6>
18493 <p><!--para 2 -->
18494 The thrd_exit function terminates execution of the calling thread and sets its result
18495 code to res.
18496 <h6>Returns</h6>
18497 <p><!--para 3 -->
18498 The thrd_exit function returns no value.
18500 <h5><a name="7.25.5.6" href="#7.25.5.6">7.25.5.6 The thrd_join function</a></h5>
18501 <h6>Synopsis</h6>
18502 <p><!--para 1 -->
18503 <pre>
18504 #include <a href="#7.25">&lt;threads.h&gt;</a>
18505 int thrd_join(thrd_t thr, int *res);</pre>
18506 <h6>Description</h6>
18507 <p><!--para 2 -->
18508 The thrd_join function joins the thread identified by thr with the current thread by
18509 blocking until the other thread has terminated. If the parameter res is not a null pointer,
18510 <!--page 400 -->
18511 it stores the thread's result code in the integer pointed to by res. The termination of the
18512 other thread synchronizes with the completion of the thrd_join function. The thread
18513 identified by thr shall not have been previously detached or joined with another thread.
18514 <h6>Returns</h6>
18515 <p><!--para 3 -->
18516 The thrd_join function returns thrd_success on success or thrd_error if the
18517 request could not be honored.
18519 <h5><a name="7.25.5.7" href="#7.25.5.7">7.25.5.7 The thrd_sleep function</a></h5>
18520 <h6>Synopsis</h6>
18521 <p><!--para 1 -->
18522 <pre>
18523 #include <a href="#7.25">&lt;threads.h&gt;</a>
18524 void thrd_sleep(const xtime *xt);</pre>
18525 <h6>Description</h6>
18526 <p><!--para 2 -->
18527 The thrd_sleep function suspends execution of the calling thread until after the time
18528 specified by the xtime object pointed to by xt.
18529 <h6>Returns</h6>
18530 <p><!--para 3 -->
18531 The thrd_sleep function returns no value.
18533 <h5><a name="7.25.5.8" href="#7.25.5.8">7.25.5.8 The thrd_yield function</a></h5>
18534 <h6>Synopsis</h6>
18535 <p><!--para 1 -->
18536 <pre>
18537 #include <a href="#7.25">&lt;threads.h&gt;</a>
18538 void thrd_yield(void);</pre>
18539 <h6>Description</h6>
18540 <p><!--para 2 -->
18541 The thrd_yield function endeavors to permit other threads to run, even if the current
18542 thread would ordinarily continue to run.
18543 <h6>Returns</h6>
18544 <p><!--para 3 -->
18545 The thrd_yield function returns no value.
18547 <h4><a name="7.25.6" href="#7.25.6">7.25.6 Thread-specific storage functions</a></h4>
18549 <h5><a name="7.25.6.1" href="#7.25.6.1">7.25.6.1 The tss_create function</a></h5>
18550 <h6>Synopsis</h6>
18551 <p><!--para 1 -->
18552 <pre>
18553 #include <a href="#7.25">&lt;threads.h&gt;</a>
18554 int tss_create(tss_t *key, tss_dtor_t dtor);</pre>
18555 <h6>Description</h6>
18556 <p><!--para 2 -->
18557 The tss_create function creates a thread-specific storage pointer with destructor
18558 dtor, which may be null.
18559 <!--page 401 -->
18560 <h6>Returns</h6>
18561 <p><!--para 3 -->
18562 If the tss_create function is successful, it sets the thread-specific storage pointed to
18563 by key to a value that uniquely identifies the newly created pointer and returns
18564 thrd_success; otherwise, thrd_error is returned and the thread-specific storage
18565 pointed to by key is set to an undefined value.
18567 <h5><a name="7.25.6.2" href="#7.25.6.2">7.25.6.2 The tss_delete function</a></h5>
18568 <h6>Synopsis</h6>
18569 <p><!--para 1 -->
18570 <pre>
18571 #include <a href="#7.25">&lt;threads.h&gt;</a>
18572 void tss_delete(tss_t key);</pre>
18573 <h6>Description</h6>
18574 <p><!--para 2 -->
18575 The tss_delete function releases any resources used by the thread-specific storage
18576 identified by key.
18577 <h6>Returns</h6>
18578 <p><!--para 3 -->
18579 The tss_delete function returns no value.
18581 <h5><a name="7.25.6.3" href="#7.25.6.3">7.25.6.3 The tss_get function</a></h5>
18582 <h6>Synopsis</h6>
18583 <p><!--para 1 -->
18584 <pre>
18585 #include <a href="#7.25">&lt;threads.h&gt;</a>
18586 void *tss_get(tss_t key);</pre>
18587 <h6>Description</h6>
18588 <p><!--para 2 -->
18589 The tss_get function returns the value for the current thread held in the thread-specific
18590 storage identified by key.
18591 <h6>Returns</h6>
18592 <p><!--para 3 -->
18593 The tss_get function returns the value for the current thread if successful, or zero if
18594 unsuccessful.
18596 <h5><a name="7.25.6.4" href="#7.25.6.4">7.25.6.4 The tss_set function</a></h5>
18597 <h6>Synopsis</h6>
18598 <p><!--para 1 -->
18599 <pre>
18600 #include <a href="#7.25">&lt;threads.h&gt;</a>
18601 int tss_set(tss_t key, void *val);</pre>
18602 <h6>Description</h6>
18603 <p><!--para 2 -->
18604 The tss_set function sets the value for the current thread held in the thread-specific
18605 storage identified by key to val.
18606 <!--page 402 -->
18607 <h6>Returns</h6>
18608 <p><!--para 3 -->
18609 The tss_set function returns thrd_success on success or thrd_error if the
18610 request could not be honored.
18612 <h4><a name="7.25.7" href="#7.25.7">7.25.7 Time functions</a></h4>
18614 <h5><a name="7.25.7.1" href="#7.25.7.1">7.25.7.1 The xtime_get function</a></h5>
18615 <h6>Synopsis</h6>
18616 <p><!--para 1 -->
18617 <pre>
18618 #include <a href="#7.25">&lt;threads.h&gt;</a>
18619 int xtime_get(xtime *xt, int base);</pre>
18620 <h6>Description</h6>
18621 <p><!--para 2 -->
18622 The xtime_get function sets the xtime object pointed to by xt to hold the current
18623 time based on the time base base.
18624 <h6>Returns</h6>
18625 <p><!--para 3 -->
18626 If the xtime_get function is successful it returns the nonzero value base, which must
18627 be TIME_UTC; otherwise, it returns zero.<sup><a href="#note306"><b>306)</b></a></sup>
18632 <!--page 403 -->
18634 <h6>footnotes</h6>
18635 <p><small><a name="note306" href="#note306">306)</a> Although an xtime object describes times with nanosecond resolution, the actual resolution in an
18636 xtime object is system dependent.
18637 </small>
18639 <h3><a name="7.26" href="#7.26">7.26 Date and time <time.h></a></h3>
18641 <h4><a name="7.26.1" href="#7.26.1">7.26.1 Components of time</a></h4>
18642 <p><!--para 1 -->
18643 The header <a href="#7.26">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
18644 manipulating time. Many functions deal with a calendar time that represents the current
18645 date (according to the Gregorian calendar) and time. Some functions deal with local
18646 time, which is the calendar time expressed for some specific time zone, and with Daylight
18647 Saving Time, which is a temporary change in the algorithm for determining local time.
18648 The local time zone and Daylight Saving Time are implementation-defined.
18649 <p><!--para 2 -->
18650 The macros defined are NULL (described in <a href="#7.19">7.19</a>); and
18651 <pre>
18652 CLOCKS_PER_SEC</pre>
18653 which expands to an expression with type clock_t (described below) that is the
18654 number per second of the value returned by the clock function.
18655 <p><!--para 3 -->
18656 The types declared are size_t (described in <a href="#7.19">7.19</a>);
18657 <pre>
18658 clock_t</pre>
18660 <pre>
18661 time_t</pre>
18662 which are arithmetic types capable of representing times; and
18663 <pre>
18664 struct tm</pre>
18665 which holds the components of a calendar time, called the broken-down time.
18666 <p><!--para 4 -->
18667 The range and precision of times representable in clock_t and time_t are
18668 implementation-defined. The tm structure shall contain at least the following members,
18669 in any order. The semantics of the members and their normal ranges are expressed in the
18670 comments.<sup><a href="#note307"><b>307)</b></a></sup>
18671 <pre>
18672 int tm_sec; // seconds after the minute -- [0, 60]
18673 int tm_min; // minutes after the hour -- [0, 59]
18674 int tm_hour; // hours since midnight -- [0, 23]
18675 int tm_mday; // day of the month -- [1, 31]
18676 int tm_mon; // months since January -- [0, 11]
18677 int tm_year; // years since 1900
18678 int tm_wday; // days since Sunday -- [0, 6]
18679 int tm_yday; // days since January 1 -- [0, 365]
18680 int tm_isdst; // Daylight Saving Time flag</pre>
18684 <!--page 404 -->
18685 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
18686 Saving Time is not in effect, and negative if the information is not available.
18688 <h6>footnotes</h6>
18689 <p><small><a name="note307" href="#note307">307)</a> The range [0, 60] for tm_sec allows for a positive leap second.
18690 </small>
18692 <h4><a name="7.26.2" href="#7.26.2">7.26.2 Time manipulation functions</a></h4>
18694 <h5><a name="7.26.2.1" href="#7.26.2.1">7.26.2.1 The clock function</a></h5>
18695 <h6>Synopsis</h6>
18696 <p><!--para 1 -->
18697 <pre>
18698 #include <a href="#7.26">&lt;time.h&gt;</a>
18699 clock_t clock(void);</pre>
18700 <h6>Description</h6>
18701 <p><!--para 2 -->
18702 The clock function determines the processor time used.
18703 <h6>Returns</h6>
18704 <p><!--para 3 -->
18705 The clock function returns the implementation's best approximation to the processor
18706 time used by the program since the beginning of an implementation-defined era related
18707 only to the program invocation. To determine the time in seconds, the value returned by
18708 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
18709 the processor time used is not available or its value cannot be represented, the function
18710 returns the value (clock_t)(-1).<sup><a href="#note308"><b>308)</b></a></sup>
18712 <h6>footnotes</h6>
18713 <p><small><a name="note308" href="#note308">308)</a> In order to measure the time spent in a program, the clock function should be called at the start of
18714 the program and its return value subtracted from the value returned by subsequent calls.
18715 </small>
18717 <h5><a name="7.26.2.2" href="#7.26.2.2">7.26.2.2 The difftime function</a></h5>
18718 <h6>Synopsis</h6>
18719 <p><!--para 1 -->
18720 <pre>
18721 #include <a href="#7.26">&lt;time.h&gt;</a>
18722 double difftime(time_t time1, time_t time0);</pre>
18723 <h6>Description</h6>
18724 <p><!--para 2 -->
18725 The difftime function computes the difference between two calendar times: time1 -
18726 time0.
18727 <h6>Returns</h6>
18728 <p><!--para 3 -->
18729 The difftime function returns the difference expressed in seconds as a double.
18734 <!--page 405 -->
18736 <h5><a name="7.26.2.3" href="#7.26.2.3">7.26.2.3 The mktime function</a></h5>
18737 <h6>Synopsis</h6>
18738 <p><!--para 1 -->
18739 <pre>
18740 #include <a href="#7.26">&lt;time.h&gt;</a>
18741 time_t mktime(struct tm *timeptr);</pre>
18742 <h6>Description</h6>
18743 <p><!--para 2 -->
18744 The mktime function converts the broken-down time, expressed as local time, in the
18745 structure pointed to by timeptr into a calendar time value with the same encoding as
18746 that of the values returned by the time function. The original values of the tm_wday
18747 and tm_yday components of the structure are ignored, and the original values of the
18748 other components are not restricted to the ranges indicated above.<sup><a href="#note309"><b>309)</b></a></sup> On successful
18749 completion, the values of the tm_wday and tm_yday components of the structure are
18750 set appropriately, and the other components are set to represent the specified calendar
18751 time, but with their values forced to the ranges indicated above; the final value of
18752 tm_mday is not set until tm_mon and tm_year are determined.
18753 <h6>Returns</h6>
18754 <p><!--para 3 -->
18755 The mktime function returns the specified calendar time encoded as a value of type
18756 time_t. If the calendar time cannot be represented, the function returns the value
18757 (time_t)(-1).
18758 <p><!--para 4 -->
18759 EXAMPLE What day of the week is July 4, 2001?
18760 <pre>
18761 #include <a href="#7.21">&lt;stdio.h&gt;</a>
18762 #include <a href="#7.26">&lt;time.h&gt;</a>
18763 static const char *const wday[] = {
18764 "Sunday", "Monday", "Tuesday", "Wednesday",
18765 "Thursday", "Friday", "Saturday", "-unknown-"
18767 struct tm time_str;
18768 /* ... */</pre>
18773 <!--page 406 -->
18774 <pre>
18775 time_str.tm_year = 2001 - 1900;
18776 time_str.tm_mon = 7 - 1;
18777 time_str.tm_mday = 4;
18778 time_str.tm_hour = 0;
18779 time_str.tm_min = 0;
18780 time_str.tm_sec = 1;
18781 time_str.tm_isdst = -1;
18782 if (mktime(&amp;time_str) == (time_t)(-1))
18783 time_str.tm_wday = 7;
18784 printf("%s\n", wday[time_str.tm_wday]);</pre>
18787 <h6>footnotes</h6>
18788 <p><small><a name="note309" href="#note309">309)</a> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
18789 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
18790 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
18791 </small>
18793 <h5><a name="7.26.2.4" href="#7.26.2.4">7.26.2.4 The time function</a></h5>
18794 <h6>Synopsis</h6>
18795 <p><!--para 1 -->
18796 <pre>
18797 #include <a href="#7.26">&lt;time.h&gt;</a>
18798 time_t time(time_t *timer);</pre>
18799 <h6>Description</h6>
18800 <p><!--para 2 -->
18801 The time function determines the current calendar time. The encoding of the value is
18802 unspecified.
18803 <h6>Returns</h6>
18804 <p><!--para 3 -->
18805 The time function returns the implementation's best approximation to the current
18806 calendar time. The value (time_t)(-1) is returned if the calendar time is not
18807 available. If timer is not a null pointer, the return value is also assigned to the object it
18808 points to.
18810 <h4><a name="7.26.3" href="#7.26.3">7.26.3 Time conversion functions</a></h4>
18811 <p><!--para 1 -->
18812 Except for the strftime function, these functions each return a pointer to one of two
18813 types of static objects: a broken-down time structure or an array of char. Execution of
18814 any of the functions that return a pointer to one of these object types may overwrite the
18815 information in any object of the same type pointed to by the value returned from any
18816 previous call to any of them and the functions are not required to avoid data races. The
18817 implementation shall behave as if no other library functions call these functions.
18819 <h5><a name="7.26.3.1" href="#7.26.3.1">7.26.3.1 The asctime function</a></h5>
18820 <h6>Synopsis</h6>
18821 <p><!--para 1 -->
18822 <pre>
18823 #include <a href="#7.26">&lt;time.h&gt;</a>
18824 char *asctime(const struct tm *timeptr);</pre>
18825 <h6>Description</h6>
18826 <p><!--para 2 -->
18827 The asctime function converts the broken-down time in the structure pointed to by
18828 timeptr into a string in the form
18829 <!--page 407 -->
18830 <pre>
18831 Sun Sep 16 01:03:52 1973\n\0</pre>
18832 using the equivalent of the following algorithm.
18833 char *asctime(const struct tm *timeptr)
18835 <pre>
18836 static const char wday_name[7][3] = {
18837 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
18839 static const char mon_name[12][3] = {
18840 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
18841 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
18843 static char result[26];
18844 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
18845 wday_name[timeptr-&gt;tm_wday],
18846 mon_name[timeptr-&gt;tm_mon],
18847 timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
18848 timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
18849 1900 + timeptr-&gt;tm_year);
18850 return result;</pre>
18852 <p><!--para 3 -->
18853 If any of the fields of the broken-down time contain values that are outside their normal
18854 ranges,<sup><a href="#note310"><b>310)</b></a></sup> the behavior of the asctime function is undefined. Likewise, if the
18855 calculated year exceeds four digits or is less than the year 1000, the behavior is
18856 undefined.
18857 <h6>Returns</h6>
18858 <p><!--para 4 -->
18859 The asctime function returns a pointer to the string.
18861 <h6>footnotes</h6>
18862 <p><small><a name="note310" href="#note310">310)</a> See <a href="#7.26.1">7.26.1</a>.
18863 </small>
18865 <h5><a name="7.26.3.2" href="#7.26.3.2">7.26.3.2 The ctime function</a></h5>
18866 <h6>Synopsis</h6>
18867 <p><!--para 1 -->
18868 <pre>
18869 #include <a href="#7.26">&lt;time.h&gt;</a>
18870 char *ctime(const time_t *timer);</pre>
18871 <h6>Description</h6>
18872 <p><!--para 2 -->
18873 The ctime function converts the calendar time pointed to by timer to local time in the
18874 form of a string. It is equivalent to
18875 <pre>
18876 asctime(localtime(timer))</pre>
18880 <!--page 408 -->
18881 <h6>Returns</h6>
18882 <p><!--para 3 -->
18883 The ctime function returns the pointer returned by the asctime function with that
18884 broken-down time as argument.
18885 <p><b> Forward references</b>: the localtime function (<a href="#7.26.3.4">7.26.3.4</a>).
18887 <h5><a name="7.26.3.3" href="#7.26.3.3">7.26.3.3 The gmtime function</a></h5>
18888 <h6>Synopsis</h6>
18889 <p><!--para 1 -->
18890 <pre>
18891 #include <a href="#7.26">&lt;time.h&gt;</a>
18892 struct tm *gmtime(const time_t *timer);</pre>
18893 <h6>Description</h6>
18894 <p><!--para 2 -->
18895 The gmtime function converts the calendar time pointed to by timer into a broken-
18896 down time, expressed as UTC.
18897 <h6>Returns</h6>
18898 <p><!--para 3 -->
18899 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
18900 specified time cannot be converted to UTC.
18902 <h5><a name="7.26.3.4" href="#7.26.3.4">7.26.3.4 The localtime function</a></h5>
18903 <h6>Synopsis</h6>
18904 <p><!--para 1 -->
18905 <pre>
18906 #include <a href="#7.26">&lt;time.h&gt;</a>
18907 struct tm *localtime(const time_t *timer);</pre>
18908 <h6>Description</h6>
18909 <p><!--para 2 -->
18910 The localtime function converts the calendar time pointed to by timer into a
18911 broken-down time, expressed as local time.
18912 <h6>Returns</h6>
18913 <p><!--para 3 -->
18914 The localtime function returns a pointer to the broken-down time, or a null pointer if
18915 the specified time cannot be converted to local time.
18917 <h5><a name="7.26.3.5" href="#7.26.3.5">7.26.3.5 The strftime function</a></h5>
18918 <h6>Synopsis</h6>
18919 <p><!--para 1 -->
18920 <!--page 409 -->
18921 <pre>
18922 #include <a href="#7.26">&lt;time.h&gt;</a>
18923 size_t strftime(char * restrict s,
18924 size_t maxsize,
18925 const char * restrict format,
18926 const struct tm * restrict timeptr);</pre>
18927 <h6>Description</h6>
18928 <p><!--para 2 -->
18929 The strftime function places characters into the array pointed to by s as controlled by
18930 the string pointed to by format. The format shall be a multibyte character sequence,
18931 beginning and ending in its initial shift state. The format string consists of zero or
18932 more conversion specifiers and ordinary multibyte characters. A conversion specifier
18933 consists of a % character, possibly followed by an E or O modifier character (described
18934 below), followed by a character that determines the behavior of the conversion specifier.
18935 All ordinary multibyte characters (including the terminating null character) are copied
18936 unchanged into the array. If copying takes place between objects that overlap, the
18937 behavior is undefined. No more than maxsize characters are placed into the array.
18938 <p><!--para 3 -->
18939 Each conversion specifier is replaced by appropriate characters as described in the
18940 following list. The appropriate characters are determined using the LC_TIME category
18941 of the current locale and by the values of zero or more members of the broken-down time
18942 structure pointed to by timeptr, as specified in brackets in the description. If any of
18943 the specified values is outside the normal range, the characters stored are unspecified.
18944 %a is replaced by the locale's abbreviated weekday name. [tm_wday]
18945 %A is replaced by the locale's full weekday name. [tm_wday]
18946 %b is replaced by the locale's abbreviated month name. [tm_mon]
18947 %B is replaced by the locale's full month name. [tm_mon]
18948 %c is replaced by the locale's appropriate date and time representation. [all specified
18949 <pre>
18950 in <a href="#7.26.1">7.26.1</a>]</pre>
18951 %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
18952 <pre>
18953 number (00-99). [tm_year]</pre>
18954 %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
18955 %D is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
18956 %e is replaced by the day of the month as a decimal number (1-31); a single digit is
18957 <pre>
18958 preceded by a space. [tm_mday]</pre>
18959 %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
18960 <pre>
18961 tm_mday]</pre>
18962 %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
18963 <pre>
18964 number (00-99). [tm_year, tm_wday, tm_yday]</pre>
18965 %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
18966 <pre>
18967 [tm_year, tm_wday, tm_yday]</pre>
18968 %h is equivalent to ''%b''. [tm_mon]
18969 %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
18970 %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
18971 %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]
18972 %m is replaced by the month as a decimal number (01-12). [tm_mon]
18973 %M is replaced by the minute as a decimal number (00-59). [tm_min]
18974 %n is replaced by a new-line character.
18975 <!--page 410 -->
18976 %p is replaced by the locale's equivalent of the AM/PM designations associated with a
18977 <pre>
18978 12-hour clock. [tm_hour]</pre>
18979 %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
18980 %R is equivalent to ''%H:%M''. [tm_hour, tm_min]
18981 %S is replaced by the second as a decimal number (00-60). [tm_sec]
18982 %t is replaced by a horizontal-tab character.
18983 %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
18984 <pre>
18985 tm_sec]</pre>
18986 %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
18987 <pre>
18988 is 1. [tm_wday]</pre>
18989 %U is replaced by the week number of the year (the first Sunday as the first day of week
18990 <pre>
18991 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]</pre>
18992 %V is replaced by the ISO 8601 week number (see below) as a decimal number
18993 <pre>
18994 (01-53). [tm_year, tm_wday, tm_yday]</pre>
18995 %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
18996 <pre>
18997 [tm_wday]</pre>
18998 %W is replaced by the week number of the year (the first Monday as the first day of
18999 <pre>
19000 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]</pre>
19001 %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.26.1">7.26.1</a>]
19002 %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.26.1">7.26.1</a>]
19003 %y is replaced by the last 2 digits of the year as a decimal number (00-99).
19004 <pre>
19005 [tm_year]</pre>
19006 %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
19007 %z is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
19008 <pre>
19009 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
19010 zone is determinable. [tm_isdst]</pre>
19011 %Z is replaced by the locale's time zone name or abbreviation, or by no characters if no
19012 <pre>
19013 time zone is determinable. [tm_isdst]</pre>
19014 %% is replaced by %.
19015 <p><!--para 4 -->
19016 Some conversion specifiers can be modified by the inclusion of an E or O modifier
19017 character to indicate an alternative format or specification. If the alternative format or
19018 specification does not exist for the current locale, the modifier is ignored.
19019 %Ec is replaced by the locale's alternative date and time representation.
19020 %EC is replaced by the name of the base year (period) in the locale's alternative
19021 <pre>
19022 representation.</pre>
19023 %Ex is replaced by the locale's alternative date representation.
19024 %EX is replaced by the locale's alternative time representation.
19025 %Ey is replaced by the offset from %EC (year only) in the locale's alternative
19026 <pre>
19027 representation.</pre>
19028 %EY is replaced by the locale's full alternative year representation.
19029 <!--page 411 -->
19030 %Od is replaced by the day of the month, using the locale's alternative numeric symbols
19031 <pre>
19032 (filled as needed with leading zeros, or with leading spaces if there is no alternative
19033 symbol for zero).</pre>
19034 %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
19035 <pre>
19036 (filled as needed with leading spaces).</pre>
19037 %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
19038 <pre>
19039 symbols.</pre>
19040 %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
19041 <pre>
19042 symbols.</pre>
19043 %Om is replaced by the month, using the locale's alternative numeric symbols.
19044 %OM is replaced by the minutes, using the locale's alternative numeric symbols.
19045 %OS is replaced by the seconds, using the locale's alternative numeric symbols.
19046 %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
19047 <pre>
19048 representation, where Monday is 1.</pre>
19049 %OU is replaced by the week number, using the locale's alternative numeric symbols.
19050 %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
19051 <pre>
19052 symbols.</pre>
19053 %Ow is replaced by the weekday as a number, using the locale's alternative numeric
19054 <pre>
19055 symbols.</pre>
19056 %OW is replaced by the week number of the year, using the locale's alternative numeric
19057 <pre>
19058 symbols.</pre>
19059 %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
19060 <p><!--para 5 -->
19061 <pre>
19062 symbols.</pre>
19063 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
19064 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
19065 which is also the week that includes the first Thursday of the year, and is also the first
19066 week that contains at least four days in the year. If the first Monday of January is the
19067 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
19068 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
19069 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
19070 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
19071 %V is replaced by 01.
19072 <p><!--para 6 -->
19073 If a conversion specifier is not one of the above, the behavior is undefined.
19074 <p><!--para 7 -->
19075 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
19076 following specifiers are:
19077 %a the first three characters of %A.
19078 %A one of ''Sunday'', ''Monday'', ... , ''Saturday''.
19079 %b the first three characters of %B.
19080 %B one of ''January'', ''February'', ... , ''December''.
19081 %c equivalent to ''%a %b %e %T %Y''.
19082 <!--page 412 -->
19083 %p one of ''AM'' or ''PM''.
19084 %r equivalent to ''%I:%M:%S %p''.
19085 %x equivalent to ''%m/%d/%y''.
19086 %X equivalent to %T.
19087 %Z implementation-defined.
19088 <h6>Returns</h6>
19089 <p><!--para 8 -->
19090 If the total number of resulting characters including the terminating null character is not
19091 more than maxsize, the strftime function returns the number of characters placed
19092 into the array pointed to by s not including the terminating null character. Otherwise,
19093 zero is returned and the contents of the array are indeterminate.
19094 <!--page 413 -->
19096 <h3><a name="7.27" href="#7.27">7.27 Unicode utilities <uchar.h></a></h3>
19097 <p><!--para 1 -->
19098 The header <a href="#7.27">&lt;uchar.h&gt;</a> declares types and functions for manipulating Unicode
19099 characters.
19100 <p><!--para 2 -->
19101 The types declared are mbstate_t (described in <a href="#7.29.1">7.29.1</a>) and size_t (described in
19102 <a href="#7.19">7.19</a>);
19103 <pre>
19104 char16_t</pre>
19105 which is an unsigned integer type used for 16-bit characters and is the same type as
19106 uint_least16_t (described in <a href="#7.20.1.2">7.20.1.2</a>); and
19107 <pre>
19108 char32_t</pre>
19109 which is an unsigned integer type used for 32-bit characters and is the same type as
19110 uint_least32_t (also described in <a href="#7.20.1.2">7.20.1.2</a>).
19112 <h4><a name="7.27.1" href="#7.27.1">7.27.1 Restartable multibyte/wide character conversion functions</a></h4>
19113 <p><!--para 1 -->
19114 These functions have a parameter, ps, of type pointer to mbstate_t that points to an
19115 object that can completely describe the current conversion state of the associated
19116 multibyte character sequence, which the functions alter as necessary. If ps is a null
19117 pointer, each function uses its own internal mbstate_t object instead, which is
19118 initialized at program startup to the initial conversion state; the functions are not required
19119 to avoid data races in this case. The implementation behaves as if no library function
19120 calls these functions with a null pointer for ps.
19122 <h5><a name="7.27.1.1" href="#7.27.1.1">7.27.1.1 The mbrtoc16 function</a></h5>
19123 <h6>Synopsis</h6>
19124 <p><!--para 1 -->
19125 <pre>
19126 #include <a href="#7.27">&lt;uchar.h&gt;</a>
19127 size_t mbrtoc16(char16_t * restrict pc16,
19128 const char * restrict s, size_t n,
19129 mbstate_t * restrict ps);</pre>
19130 <h6>Description</h6>
19131 <p><!--para 2 -->
19132 If s is a null pointer, the mbrtoc16 function is equivalent to the call:
19133 <pre>
19134 mbrtoc16(NULL, "", 1, ps)</pre>
19135 In this case, the values of the parameters pc16 and n are ignored.
19136 <p><!--para 3 -->
19137 If s is not a null pointer, the mbrtoc16 function inspects at most n bytes beginning with
19138 the byte pointed to by s to determine the number of bytes needed to complete the next
19139 multibyte character (including any shift sequences). If the function determines that the
19140 next multibyte character is complete and valid, it determines the values of the
19141 corresponding wide characters and then, if pc16 is not a null pointer, stores the value of
19142 the first (or only) such character in the object pointed to by pc16. Subsequent calls will
19143 <!--page 414 -->
19144 store successive wide characters without consuming any additional input until all the
19145 characters have been stored. If the corresponding wide character is the null wide
19146 character, the resulting state described is the initial conversion state.
19147 <h6>Returns</h6>
19148 <p><!--para 4 -->
19149 The mbrtoc16 function returns the first of the following that applies (given the current
19150 conversion state):
19151 0 if the next n or fewer bytes complete the multibyte character that
19152 <pre>
19153 corresponds to the null wide character (which is the value stored).</pre>
19154 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
19155 <pre>
19156 character (which is the value stored); the value returned is the number
19157 of bytes that complete the multibyte character.</pre>
19158 (size_t)(-3) if the next character resulting from a previous call has been stored (no
19159 <pre>
19160 bytes from the input have been consumed by this call).</pre>
19161 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
19162 <pre>
19163 multibyte character, and all n bytes have been processed (no value is
19164 stored).<sup><a href="#note311"><b>311)</b></a></sup></pre>
19165 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
19166 <pre>
19167 do not contribute to a complete and valid multibyte character (no
19168 value is stored); the value of the macro EILSEQ is stored in errno,
19169 and the conversion state is unspecified.</pre>
19171 <h6>footnotes</h6>
19172 <p><small><a name="note311" href="#note311">311)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
19173 sequence of redundant shift sequences (for implementations with state-dependent encodings).
19174 </small>
19176 <h5><a name="7.27.1.2" href="#7.27.1.2">7.27.1.2 The c16rtomb function</a></h5>
19177 <h6>Synopsis</h6>
19178 <p><!--para 1 -->
19179 <pre>
19180 #include <a href="#7.27">&lt;uchar.h&gt;</a>
19181 size_t c16rtomb(char * restrict s, char16_t c16,
19182 mbstate_t * restrict ps);</pre>
19183 <h6>Description</h6>
19184 <p><!--para 2 -->
19185 If s is a null pointer, the c16rtomb function is equivalent to the call
19186 <pre>
19187 c16rtomb(buf, L'\0', ps)</pre>
19188 where buf is an internal buffer.
19189 <p><!--para 3 -->
19190 If s is not a null pointer, the c16rtomb function determines the number of bytes needed
19191 to represent the multibyte character that corresponds to the wide character given by c16
19192 (including any shift sequences), and stores the multibyte character representation in the
19195 <!--page 415 -->
19196 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
19197 c16 is a null wide character, a null byte is stored, preceded by any shift sequence needed
19198 to restore the initial shift state; the resulting state described is the initial conversion state.
19199 <h6>Returns</h6>
19200 <p><!--para 4 -->
19201 The c16rtomb function returns the number of bytes stored in the array object (including
19202 any shift sequences). When c16 is not a valid wide character, an encoding error occurs:
19203 the function stores the value of the macro EILSEQ in errno and returns
19204 (size_t)(-1); the conversion state is unspecified.
19206 <h5><a name="7.27.1.3" href="#7.27.1.3">7.27.1.3 The mbrtoc32 function</a></h5>
19207 <h6>Synopsis</h6>
19208 <p><!--para 1 -->
19209 <pre>
19210 #include <a href="#7.27">&lt;uchar.h&gt;</a>
19211 size_t mbrtoc32(char32_t * restrict pc32,
19212 const char * restrict s, size_t n,
19213 mbstate_t * restrict ps);</pre>
19214 <h6>Description</h6>
19215 <p><!--para 2 -->
19216 If s is a null pointer, the mbrtoc32 function is equivalent to the call:
19217 <pre>
19218 mbrtoc32(NULL, "", 1, ps)</pre>
19219 In this case, the values of the parameters pc32 and n are ignored.
19220 <p><!--para 3 -->
19221 If s is not a null pointer, the mbrtoc32 function inspects at most n bytes beginning with
19222 the byte pointed to by s to determine the number of bytes needed to complete the next
19223 multibyte character (including any shift sequences). If the function determines that the
19224 next multibyte character is complete and valid, it determines the values of the
19225 corresponding wide characters and then, if pc32 is not a null pointer, stores the value of
19226 the first (or only) such character in the object pointed to by pc32. Subsequent calls will
19227 store successive wide characters without consuming any additional input until all the
19228 characters have been stored. If the corresponding wide character is the null wide
19229 character, the resulting state described is the initial conversion state.
19230 <h6>Returns</h6>
19231 <p><!--para 4 -->
19232 The mbrtoc32 function returns the first of the following that applies (given the current
19233 conversion state):
19234 0 if the next n or fewer bytes complete the multibyte character that
19235 <pre>
19236 corresponds to the null wide character (which is the value stored).</pre>
19237 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
19238 <!--page 416 -->
19239 <pre>
19240 character (which is the value stored); the value returned is the number
19241 of bytes that complete the multibyte character.</pre>
19242 (size_t)(-3) if the next character resulting from a previous call has been stored (no
19243 <pre>
19244 bytes from the input have been consumed by this call).</pre>
19245 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
19246 <pre>
19247 multibyte character, and all n bytes have been processed (no value is
19248 stored).<sup><a href="#note312"><b>312)</b></a></sup></pre>
19249 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
19250 <pre>
19251 do not contribute to a complete and valid multibyte character (no
19252 value is stored); the value of the macro EILSEQ is stored in errno,
19253 and the conversion state is unspecified.</pre>
19255 <h6>footnotes</h6>
19256 <p><small><a name="note312" href="#note312">312)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
19257 sequence of redundant shift sequences (for implementations with state-dependent encodings).
19258 </small>
19260 <h5><a name="7.27.1.4" href="#7.27.1.4">7.27.1.4 The c32rtomb function</a></h5>
19261 <h6>Synopsis</h6>
19262 <p><!--para 1 -->
19263 <pre>
19264 #include <a href="#7.27">&lt;uchar.h&gt;</a>
19265 size_t c32rtomb(char * restrict s, char32_t c32,
19266 mbstate_t * restrict ps);</pre>
19267 <h6>Description</h6>
19268 <p><!--para 2 -->
19269 If s is a null pointer, the c32rtomb function is equivalent to the call
19270 <pre>
19271 c32rtomb(buf, L'\0', ps)</pre>
19272 where buf is an internal buffer.
19273 <p><!--para 3 -->
19274 If s is not a null pointer, the c32rtomb function determines the number of bytes needed
19275 to represent the multibyte character that corresponds to the wide character given by c32
19276 (including any shift sequences), and stores the multibyte character representation in the
19277 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
19278 c32 is a null wide character, a null byte is stored, preceded by any shift sequence needed
19279 to restore the initial shift state; the resulting state described is the initial conversion state.
19280 <h6>Returns</h6>
19281 <p><!--para 4 -->
19282 The c32rtomb function returns the number of bytes stored in the array object (including
19283 any shift sequences). When c32 is not a valid wide character, an encoding error occurs:
19284 the function stores the value of the macro EILSEQ in errno and returns
19285 (size_t)(-1); the conversion state is unspecified.
19290 <!--page 417 -->
19292 <h3><a name="7.28" href="#7.28">7.28 Extended multibyte and wide character utilities <wchar.h></a></h3>
19294 <h4><a name="7.28.1" href="#7.28.1">7.28.1 Introduction</a></h4>
19295 <p><!--para 1 -->
19296 The header <a href="#7.28">&lt;wchar.h&gt;</a> defines four macros, and declares four data types, one tag, and
19297 many functions.<sup><a href="#note313"><b>313)</b></a></sup>
19298 <p><!--para 2 -->
19299 The types declared are wchar_t and size_t (both described in <a href="#7.19">7.19</a>);
19300 <pre>
19301 mbstate_t</pre>
19302 which is a complete object type other than an array type that can hold the conversion state
19303 information necessary to convert between sequences of multibyte characters and wide
19304 characters;
19305 <pre>
19306 wint_t</pre>
19307 which is an integer type unchanged by default argument promotions that can hold any
19308 value corresponding to members of the extended character set, as well as at least one
19309 value that does not correspond to any member of the extended character set (see WEOF
19310 below);<sup><a href="#note314"><b>314)</b></a></sup> and
19311 <pre>
19312 struct tm</pre>
19313 which is declared as an incomplete structure type (the contents are described in <a href="#7.26.1">7.26.1</a>).
19314 <p><!--para 3 -->
19315 The macros defined are NULL (described in <a href="#7.19">7.19</a>); WCHAR_MIN and WCHAR_MAX
19316 (described in <a href="#7.20.3">7.20.3</a>); and
19317 <pre>
19318 WEOF</pre>
19319 which expands to a constant expression of type wint_t whose value does not
19320 correspond to any member of the extended character set.<sup><a href="#note315"><b>315)</b></a></sup> It is accepted (and returned)
19321 by several functions in this subclause to indicate end-of-file, that is, no more input from a
19322 stream. It is also used as a wide character value that does not correspond to any member
19323 of the extended character set.
19324 <p><!--para 4 -->
19325 The functions declared are grouped as follows:
19326 <ul>
19327 <li> Functions that perform input and output of wide characters, or multibyte characters,
19328 or both;
19329 <li> Functions that provide wide string numeric conversion;
19330 <li> Functions that perform general wide string manipulation;
19333 <!--page 418 -->
19334 <li> Functions for wide string date and time conversion; and
19335 <li> Functions that provide extended capabilities for conversion between multibyte and
19336 wide character sequences.
19337 </ul>
19338 <p><!--para 5 -->
19339 Unless explicitly stated otherwise, if the execution of a function described in this
19340 subclause causes copying to take place between objects that overlap, the behavior is
19341 undefined.
19343 <h6>footnotes</h6>
19344 <p><small><a name="note313" href="#note313">313)</a> See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
19345 </small>
19346 <p><small><a name="note314" href="#note314">314)</a> wchar_t and wint_t can be the same integer type.
19347 </small>
19348 <p><small><a name="note315" href="#note315">315)</a> The value of the macro WEOF may differ from that of EOF and need not be negative.
19349 </small>
19351 <h4><a name="7.28.2" href="#7.28.2">7.28.2 Formatted wide character input/output functions</a></h4>
19352 <p><!--para 1 -->
19353 The formatted wide character input/output functions shall behave as if there is a sequence
19354 point after the actions associated with each specifier.<sup><a href="#note316"><b>316)</b></a></sup>
19356 <h6>footnotes</h6>
19357 <p><small><a name="note316" href="#note316">316)</a> The fwprintf functions perform writes to memory for the %n specifier.
19358 </small>
19360 <h5><a name="7.28.2.1" href="#7.28.2.1">7.28.2.1 The fwprintf function</a></h5>
19361 <h6>Synopsis</h6>
19362 <p><!--para 1 -->
19363 <pre>
19364 #include <a href="#7.21">&lt;stdio.h&gt;</a>
19365 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19366 int fwprintf(FILE * restrict stream,
19367 const wchar_t * restrict format, ...);</pre>
19368 <h6>Description</h6>
19369 <p><!--para 2 -->
19370 The fwprintf function writes output to the stream pointed to by stream, under
19371 control of the wide string pointed to by format that specifies how subsequent arguments
19372 are converted for output. If there are insufficient arguments for the format, the behavior
19373 is undefined. If the format is exhausted while arguments remain, the excess arguments
19374 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
19375 when the end of the format string is encountered.
19376 <p><!--para 3 -->
19377 The format is composed of zero or more directives: ordinary wide characters (not %),
19378 which are copied unchanged to the output stream; and conversion specifications, each of
19379 which results in fetching zero or more subsequent arguments, converting them, if
19380 applicable, according to the corresponding conversion specifier, and then writing the
19381 result to the output stream.
19382 <p><!--para 4 -->
19383 Each conversion specification is introduced by the wide character %. After the %, the
19384 following appear in sequence:
19385 <ul>
19386 <li> Zero or more flags (in any order) that modify the meaning of the conversion
19387 specification.
19388 <li> An optional minimum field width. If the converted value has fewer wide characters
19389 than the field width, it is padded with spaces (by default) on the left (or right, if the
19392 <!--page 419 -->
19393 left adjustment flag, described later, has been given) to the field width. The field
19394 width takes the form of an asterisk * (described later) or a nonnegative decimal
19395 integer.<sup><a href="#note317"><b>317)</b></a></sup>
19396 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
19397 o, u, x, and X conversions, the number of digits to appear after the decimal-point
19398 wide character for a, A, e, E, f, and F conversions, the maximum number of
19399 significant digits for the g and G conversions, or the maximum number of wide
19400 characters to be written for s conversions. The precision takes the form of a period
19401 (.) followed either by an asterisk * (described later) or by an optional decimal
19402 integer; if only the period is specified, the precision is taken as zero. If a precision
19403 appears with any other conversion specifier, the behavior is undefined.
19404 <li> An optional length modifier that specifies the size of the argument.
19405 <li> A conversion specifier wide character that specifies the type of conversion to be
19406 applied.
19407 </ul>
19408 <p><!--para 5 -->
19409 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
19410 this case, an int argument supplies the field width or precision. The arguments
19411 specifying field width, or precision, or both, shall appear (in that order) before the
19412 argument (if any) to be converted. A negative field width argument is taken as a - flag
19413 followed by a positive field width. A negative precision argument is taken as if the
19414 precision were omitted.
19415 <p><!--para 6 -->
19416 The flag wide characters and their meanings are:
19417 - The result of the conversion is left-justified within the field. (It is right-justified if
19418 <pre>
19419 this flag is not specified.)</pre>
19420 + The result of a signed conversion always begins with a plus or minus sign. (It
19421 <pre>
19422 begins with a sign only when a negative value is converted if this flag is not
19423 specified.)<sup><a href="#note318"><b>318)</b></a></sup></pre>
19424 space If the first wide character of a signed conversion is not a sign, or if a signed
19425 <pre>
19426 conversion results in no wide characters, a space is prefixed to the result. If the
19427 space and + flags both appear, the space flag is ignored.</pre>
19428 # The result is converted to an ''alternative form''. For o conversion, it increases
19429 <pre>
19430 the precision, if and only if necessary, to force the first digit of the result to be a
19431 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
19432 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,</pre>
19435 <!--page 420 -->
19436 <pre>
19437 and G conversions, the result of converting a floating-point number always
19438 contains a decimal-point wide character, even if no digits follow it. (Normally, a
19439 decimal-point wide character appears in the result of these conversions only if a
19440 digit follows it.) For g and G conversions, trailing zeros are not removed from the
19441 result. For other conversions, the behavior is undefined.</pre>
19442 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
19443 <p><!--para 7 -->
19444 <pre>
19445 (following any indication of sign or base) are used to pad to the field width rather
19446 than performing space padding, except when converting an infinity or NaN. If the
19447 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
19448 conversions, if a precision is specified, the 0 flag is ignored. For other
19449 conversions, the behavior is undefined.</pre>
19450 The length modifiers and their meanings are:
19451 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
19452 <pre>
19453 signed char or unsigned char argument (the argument will have
19454 been promoted according to the integer promotions, but its value shall be
19455 converted to signed char or unsigned char before printing); or that
19456 a following n conversion specifier applies to a pointer to a signed char
19457 argument.</pre>
19458 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
19459 <pre>
19460 short int or unsigned short int argument (the argument will
19461 have been promoted according to the integer promotions, but its value shall
19462 be converted to short int or unsigned short int before printing);
19463 or that a following n conversion specifier applies to a pointer to a short
19464 int argument.</pre>
19465 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
19466 <pre>
19467 long int or unsigned long int argument; that a following n
19468 conversion specifier applies to a pointer to a long int argument; that a
19469 following c conversion specifier applies to a wint_t argument; that a
19470 following s conversion specifier applies to a pointer to a wchar_t
19471 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
19472 specifier.</pre>
19473 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
19474 <pre>
19475 long long int or unsigned long long int argument; or that a
19476 following n conversion specifier applies to a pointer to a long long int
19477 argument.</pre>
19478 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
19479 <!--page 421 -->
19480 <pre>
19481 an intmax_t or uintmax_t argument; or that a following n conversion
19482 specifier applies to a pointer to an intmax_t argument.</pre>
19483 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
19484 <pre>
19485 size_t or the corresponding signed integer type argument; or that a
19486 following n conversion specifier applies to a pointer to a signed integer type
19487 corresponding to size_t argument.</pre>
19488 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
19489 <pre>
19490 ptrdiff_t or the corresponding unsigned integer type argument; or that a
19491 following n conversion specifier applies to a pointer to a ptrdiff_t
19492 argument.</pre>
19493 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
19494 <pre>
19495 applies to a long double argument.</pre>
19496 If a length modifier appears with any conversion specifier other than as specified above,
19497 the behavior is undefined.
19498 <p><!--para 8 -->
19499 The conversion specifiers and their meanings are:
19500 d,i The int argument is converted to signed decimal in the style [-]dddd. The
19501 <pre>
19502 precision specifies the minimum number of digits to appear; if the value
19503 being converted can be represented in fewer digits, it is expanded with
19504 leading zeros. The default precision is 1. The result of converting a zero
19505 value with a precision of zero is no wide characters.</pre>
19506 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
19507 <pre>
19508 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
19509 letters abcdef are used for x conversion and the letters ABCDEF for X
19510 conversion. The precision specifies the minimum number of digits to appear;
19511 if the value being converted can be represented in fewer digits, it is expanded
19512 with leading zeros. The default precision is 1. The result of converting a
19513 zero value with a precision of zero is no wide characters.</pre>
19514 f,F A double argument representing a floating-point number is converted to
19515 <!--page 422 -->
19516 <pre>
19517 decimal notation in the style [-]ddd.ddd, where the number of digits after
19518 the decimal-point wide character is equal to the precision specification. If the
19519 precision is missing, it is taken as 6; if the precision is zero and the # flag is
19520 not specified, no decimal-point wide character appears. If a decimal-point
19521 wide character appears, at least one digit appears before it. The value is
19522 rounded to the appropriate number of digits.
19523 A double argument representing an infinity is converted in one of the styles
19524 [-]inf or [-]infinity -- which style is implementation-defined. A
19525 double argument representing a NaN is converted in one of the styles
19526 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
19527 any n-wchar-sequence, is implementation-defined. The F conversion
19528 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
19529 nan, respectively.<sup><a href="#note319"><b>319)</b></a></sup></pre>
19530 e,E A double argument representing a floating-point number is converted in the
19531 <pre>
19532 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
19533 argument is nonzero) before the decimal-point wide character and the number
19534 of digits after it is equal to the precision; if the precision is missing, it is taken
19535 as 6; if the precision is zero and the # flag is not specified, no decimal-point
19536 wide character appears. The value is rounded to the appropriate number of
19537 digits. The E conversion specifier produces a number with E instead of e
19538 introducing the exponent. The exponent always contains at least two digits,
19539 and only as many more digits as necessary to represent the exponent. If the
19540 value is zero, the exponent is zero.
19541 A double argument representing an infinity or NaN is converted in the style
19542 of an f or F conversion specifier.</pre>
19543 g,G A double argument representing a floating-point number is converted in
19544 <pre>
19545 style f or e (or in style F or E in the case of a G conversion specifier),
19546 depending on the value converted and the precision. Let P equal the
19547 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
19548 Then, if a conversion with style E would have an exponent of X:
19549 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
19550 P - (X + 1).
19551 -- otherwise, the conversion is with style e (or E) and precision P - 1.
19552 Finally, unless the # flag is used, any trailing zeros are removed from the
19553 fractional portion of the result and the decimal-point wide character is
19554 removed if there is no fractional portion remaining.
19555 A double argument representing an infinity or NaN is converted in the style
19556 of an f or F conversion specifier.</pre>
19557 a,A A double argument representing a floating-point number is converted in the
19558 <pre>
19559 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
19560 nonzero if the argument is a normalized floating-point number and is
19561 otherwise unspecified) before the decimal-point wide character<sup><a href="#note320"><b>320)</b></a></sup> and the
19562 number of hexadecimal digits after it is equal to the precision; if the precision
19563 is missing and FLT_RADIX is a power of 2, then the precision is sufficient</pre>
19566 <!--page 423 -->
19567 <pre>
19568 for an exact representation of the value; if the precision is missing and
19569 FLT_RADIX is not a power of 2, then the precision is sufficient to
19570 distinguish<sup><a href="#note321"><b>321)</b></a></sup> values of type double, except that trailing zeros may be
19571 omitted; if the precision is zero and the # flag is not specified, no decimal-
19572 point wide character appears. The letters abcdef are used for a conversion
19573 and the letters ABCDEF for A conversion. The A conversion specifier
19574 produces a number with X and P instead of x and p. The exponent always
19575 contains at least one digit, and only as many more digits as necessary to
19576 represent the decimal exponent of 2. If the value is zero, the exponent is
19577 zero.
19578 A double argument representing an infinity or NaN is converted in the style
19579 of an f or F conversion specifier.</pre>
19580 c If no l length modifier is present, the int argument is converted to a wide
19581 <pre>
19582 character as if by calling btowc and the resulting wide character is written.
19583 If an l length modifier is present, the wint_t argument is converted to
19584 wchar_t and written.</pre>
19585 s If no l length modifier is present, the argument shall be a pointer to the initial
19586 <pre>
19587 element of a character array containing a multibyte character sequence
19588 beginning in the initial shift state. Characters from the array are converted as
19589 if by repeated calls to the mbrtowc function, with the conversion state
19590 described by an mbstate_t object initialized to zero before the first
19591 multibyte character is converted, and written up to (but not including) the
19592 terminating null wide character. If the precision is specified, no more than
19593 that many wide characters are written. If the precision is not specified or is
19594 greater than the size of the converted array, the converted array shall contain a
19595 null wide character.
19596 If an l length modifier is present, the argument shall be a pointer to the initial
19597 element of an array of wchar_t type. Wide characters from the array are
19598 written up to (but not including) a terminating null wide character. If the
19599 precision is specified, no more than that many wide characters are written. If
19600 the precision is not specified or is greater than the size of the array, the array
19601 shall contain a null wide character.</pre>
19602 p The argument shall be a pointer to void. The value of the pointer is
19603 <pre>
19604 converted to a sequence of printing wide characters, in an implementation-</pre>
19606 <!--page 424 -->
19607 <pre>
19608 defined manner.</pre>
19609 n The argument shall be a pointer to signed integer into which is written the
19610 <pre>
19611 number of wide characters written to the output stream so far by this call to
19612 fwprintf. No argument is converted, but one is consumed. If the
19613 conversion specification includes any flags, a field width, or a precision, the
19614 behavior is undefined.</pre>
19615 % A % wide character is written. No argument is converted. The complete
19616 <p><!--para 9 -->
19617 <pre>
19618 conversion specification shall be %%.</pre>
19619 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note322"><b>322)</b></a></sup> If any argument is
19620 not the correct type for the corresponding conversion specification, the behavior is
19621 undefined.
19622 <p><!--para 10 -->
19623 In no case does a nonexistent or small field width cause truncation of a field; if the result
19624 of a conversion is wider than the field width, the field is expanded to contain the
19625 conversion result.
19626 <p><!--para 11 -->
19627 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
19628 to a hexadecimal floating number with the given precision.
19629 <h6>Recommended practice</h6>
19630 <p><!--para 12 -->
19631 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
19632 representable in the given precision, the result should be one of the two adjacent numbers
19633 in hexadecimal floating style with the given precision, with the extra stipulation that the
19634 error should have a correct sign for the current rounding direction.
19635 <p><!--para 13 -->
19636 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
19637 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note323"><b>323)</b></a></sup> If the number of
19638 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
19639 representable with DECIMAL_DIG digits, then the result should be an exact
19640 representation with trailing zeros. Otherwise, the source value is bounded by two
19641 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
19642 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
19643 the error should have a correct sign for the current rounding direction.
19644 <h6>Returns</h6>
19645 <p><!--para 14 -->
19646 The fwprintf function returns the number of wide characters transmitted, or a negative
19647 value if an output or encoding error occurred.
19649 <!--page 425 -->
19650 <h6>Environmental limits</h6>
19651 <p><!--para 15 -->
19652 The number of wide characters that can be produced by any single conversion shall be at
19653 least 4095.
19654 <p><!--para 16 -->
19655 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
19656 places:
19657 <pre>
19658 #include <a href="#7.12">&lt;math.h&gt;</a>
19659 #include <a href="#7.21">&lt;stdio.h&gt;</a>
19660 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19661 /* ... */
19662 wchar_t *weekday, *month; // pointers to wide strings
19663 int day, hour, min;
19664 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
19665 weekday, month, day, hour, min);
19666 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));</pre>
19668 <p><b> Forward references</b>: the btowc function (<a href="#7.28.6.1.1">7.28.6.1.1</a>), the mbrtowc function
19669 (<a href="#7.28.6.3.2">7.28.6.3.2</a>).
19671 <h6>footnotes</h6>
19672 <p><small><a name="note317" href="#note317">317)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
19673 </small>
19674 <p><small><a name="note318" href="#note318">318)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
19675 include a minus sign.
19676 </small>
19677 <p><small><a name="note319" href="#note319">319)</a> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
19678 meaning; the # and 0 flag wide characters have no effect.
19679 </small>
19680 <p><small><a name="note320" href="#note320">320)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
19681 character so that subsequent digits align to nibble (4-bit) boundaries.
19682 </small>
19683 <p><small><a name="note321" href="#note321">321)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
19684 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
19685 might suffice depending on the implementation's scheme for determining the digit to the left of the
19686 decimal-point wide character.
19687 </small>
19688 <p><small><a name="note322" href="#note322">322)</a> See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
19689 </small>
19690 <p><small><a name="note323" href="#note323">323)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
19691 given format specifier. The number of significant digits is determined by the format specifier, and in
19692 the case of fixed-point conversion by the source value as well.
19693 </small>
19695 <h5><a name="7.28.2.2" href="#7.28.2.2">7.28.2.2 The fwscanf function</a></h5>
19696 <h6>Synopsis</h6>
19697 <p><!--para 1 -->
19698 <pre>
19699 #include <a href="#7.21">&lt;stdio.h&gt;</a>
19700 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19701 int fwscanf(FILE * restrict stream,
19702 const wchar_t * restrict format, ...);</pre>
19703 <h6>Description</h6>
19704 <p><!--para 2 -->
19705 The fwscanf function reads input from the stream pointed to by stream, under
19706 control of the wide string pointed to by format that specifies the admissible input
19707 sequences and how they are to be converted for assignment, using subsequent arguments
19708 as pointers to the objects to receive the converted input. If there are insufficient
19709 arguments for the format, the behavior is undefined. If the format is exhausted while
19710 arguments remain, the excess arguments are evaluated (as always) but are otherwise
19711 ignored.
19712 <p><!--para 3 -->
19713 The format is composed of zero or more directives: one or more white-space wide
19714 characters, an ordinary wide character (neither % nor a white-space wide character), or a
19715 conversion specification. Each conversion specification is introduced by the wide
19716 character %. After the %, the following appear in sequence:
19717 <ul>
19718 <li> An optional assignment-suppressing wide character *.
19719 <li> An optional decimal integer greater than zero that specifies the maximum field width
19720 (in wide characters).
19721 <!--page 426 -->
19722 <li> An optional length modifier that specifies the size of the receiving object.
19723 <li> A conversion specifier wide character that specifies the type of conversion to be
19724 applied.
19725 </ul>
19726 <p><!--para 4 -->
19727 The fwscanf function executes each directive of the format in turn. When all directives
19728 have been executed, or if a directive fails (as detailed below), the function returns.
19729 Failures are described as input failures (due to the occurrence of an encoding error or the
19730 unavailability of input characters), or matching failures (due to inappropriate input).
19731 <p><!--para 5 -->
19732 A directive composed of white-space wide character(s) is executed by reading input up to
19733 the first non-white-space wide character (which remains unread), or until no more wide
19734 characters can be read.
19735 <p><!--para 6 -->
19736 A directive that is an ordinary wide character is executed by reading the next wide
19737 character of the stream. If that wide character differs from the directive, the directive
19738 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
19739 of-file, an encoding error, or a read error prevents a wide character from being read, the
19740 directive fails.
19741 <p><!--para 7 -->
19742 A directive that is a conversion specification defines a set of matching input sequences, as
19743 described below for each specifier. A conversion specification is executed in the
19744 following steps:
19745 <p><!--para 8 -->
19746 Input white-space wide characters (as specified by the iswspace function) are skipped,
19747 unless the specification includes a [, c, or n specifier.<sup><a href="#note324"><b>324)</b></a></sup>
19748 <p><!--para 9 -->
19749 An input item is read from the stream, unless the specification includes an n specifier. An
19750 input item is defined as the longest sequence of input wide characters which does not
19751 exceed any specified field width and which is, or is a prefix of, a matching input
19752 sequence.<sup><a href="#note325"><b>325)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
19753 length of the input item is zero, the execution of the directive fails; this condition is a
19754 matching failure unless end-of-file, an encoding error, or a read error prevented input
19755 from the stream, in which case it is an input failure.
19756 <p><!--para 10 -->
19757 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
19758 count of input wide characters) is converted to a type appropriate to the conversion
19759 specifier. If the input item is not a matching sequence, the execution of the directive fails:
19760 this condition is a matching failure. Unless assignment suppression was indicated by a *,
19761 the result of the conversion is placed in the object pointed to by the first argument
19762 following the format argument that has not already received a conversion result. If this
19765 <!--page 427 -->
19766 object does not have an appropriate type, or if the result of the conversion cannot be
19767 represented in the object, the behavior is undefined.
19768 <p><!--para 11 -->
19769 The length modifiers and their meanings are:
19770 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19771 <pre>
19772 to an argument with type pointer to signed char or unsigned char.</pre>
19773 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19774 <pre>
19775 to an argument with type pointer to short int or unsigned short
19776 int.</pre>
19777 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19778 <pre>
19779 to an argument with type pointer to long int or unsigned long
19780 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
19781 an argument with type pointer to double; or that a following c, s, or [
19782 conversion specifier applies to an argument with type pointer to wchar_t.</pre>
19783 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19784 <pre>
19785 to an argument with type pointer to long long int or unsigned
19786 long long int.</pre>
19787 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19788 <pre>
19789 to an argument with type pointer to intmax_t or uintmax_t.</pre>
19790 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19791 <pre>
19792 to an argument with type pointer to size_t or the corresponding signed
19793 integer type.</pre>
19794 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
19795 <pre>
19796 to an argument with type pointer to ptrdiff_t or the corresponding
19797 unsigned integer type.</pre>
19798 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
19799 <pre>
19800 applies to an argument with type pointer to long double.</pre>
19801 If a length modifier appears with any conversion specifier other than as specified above,
19802 the behavior is undefined.
19803 <p><!--para 12 -->
19804 The conversion specifiers and their meanings are:
19805 d Matches an optionally signed decimal integer, whose format is the same as
19806 <pre>
19807 expected for the subject sequence of the wcstol function with the value 10
19808 for the base argument. The corresponding argument shall be a pointer to
19809 signed integer.</pre>
19810 i Matches an optionally signed integer, whose format is the same as expected
19811 <!--page 428 -->
19812 <pre>
19813 for the subject sequence of the wcstol function with the value 0 for the
19814 base argument. The corresponding argument shall be a pointer to signed
19815 integer.</pre>
19816 o Matches an optionally signed octal integer, whose format is the same as
19817 <pre>
19818 expected for the subject sequence of the wcstoul function with the value 8
19819 for the base argument. The corresponding argument shall be a pointer to
19820 unsigned integer.</pre>
19821 u Matches an optionally signed decimal integer, whose format is the same as
19822 <pre>
19823 expected for the subject sequence of the wcstoul function with the value 10
19824 for the base argument. The corresponding argument shall be a pointer to
19825 unsigned integer.</pre>
19826 x Matches an optionally signed hexadecimal integer, whose format is the same
19827 <pre>
19828 as expected for the subject sequence of the wcstoul function with the value
19829 16 for the base argument. The corresponding argument shall be a pointer to
19830 unsigned integer.</pre>
19831 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
19832 <pre>
19833 format is the same as expected for the subject sequence of the wcstod
19834 function. The corresponding argument shall be a pointer to floating.</pre>
19835 c Matches a sequence of wide characters of exactly the number specified by the
19836 <pre>
19837 field width (1 if no field width is present in the directive).
19838 If no l length modifier is present, characters from the input field are
19839 converted as if by repeated calls to the wcrtomb function, with the
19840 conversion state described by an mbstate_t object initialized to zero
19841 before the first wide character is converted. The corresponding argument
19842 shall be a pointer to the initial element of a character array large enough to
19843 accept the sequence. No null character is added.
19844 If an l length modifier is present, the corresponding argument shall be a
19845 pointer to the initial element of an array of wchar_t large enough to accept
19846 the sequence. No null wide character is added.</pre>
19847 s Matches a sequence of non-white-space wide characters.
19848 <!--page 429 -->
19849 <pre>
19850 If no l length modifier is present, characters from the input field are
19851 converted as if by repeated calls to the wcrtomb function, with the
19852 conversion state described by an mbstate_t object initialized to zero
19853 before the first wide character is converted. The corresponding argument
19854 shall be a pointer to the initial element of a character array large enough to
19855 accept the sequence and a terminating null character, which will be added
19856 automatically.
19857 If an l length modifier is present, the corresponding argument shall be a
19858 pointer to the initial element of an array of wchar_t large enough to accept
19859 the sequence and the terminating null wide character, which will be added
19860 automatically.</pre>
19861 [ Matches a nonempty sequence of wide characters from a set of expected
19862 <pre>
19863 characters (the scanset).
19864 If no l length modifier is present, characters from the input field are
19865 converted as if by repeated calls to the wcrtomb function, with the
19866 conversion state described by an mbstate_t object initialized to zero
19867 before the first wide character is converted. The corresponding argument
19868 shall be a pointer to the initial element of a character array large enough to
19869 accept the sequence and a terminating null character, which will be added
19870 automatically.
19871 If an l length modifier is present, the corresponding argument shall be a
19872 pointer to the initial element of an array of wchar_t large enough to accept
19873 the sequence and the terminating null wide character, which will be added
19874 automatically.
19875 The conversion specifier includes all subsequent wide characters in the
19876 format string, up to and including the matching right bracket (]). The wide
19877 characters between the brackets (the scanlist) compose the scanset, unless the
19878 wide character after the left bracket is a circumflex (^), in which case the
19879 scanset contains all wide characters that do not appear in the scanlist between
19880 the circumflex and the right bracket. If the conversion specifier begins with
19881 [] or [^], the right bracket wide character is in the scanlist and the next
19882 following right bracket wide character is the matching right bracket that ends
19883 the specification; otherwise the first following right bracket wide character is
19884 the one that ends the specification. If a - wide character is in the scanlist and
19885 is not the first, nor the second where the first wide character is a ^, nor the
19886 last character, the behavior is implementation-defined.</pre>
19887 p Matches an implementation-defined set of sequences, which should be the
19888 <pre>
19889 same as the set of sequences that may be produced by the %p conversion of
19890 the fwprintf function. The corresponding argument shall be a pointer to a
19891 pointer to void. The input item is converted to a pointer value in an
19892 implementation-defined manner. If the input item is a value converted earlier
19893 during the same program execution, the pointer that results shall compare
19894 equal to that value; otherwise the behavior of the %p conversion is undefined.</pre>
19895 n No input is consumed. The corresponding argument shall be a pointer to
19896 <!--page 430 -->
19897 <pre>
19898 signed integer into which is to be written the number of wide characters read
19899 from the input stream so far by this call to the fwscanf function. Execution
19900 of a %n directive does not increment the assignment count returned at the
19901 completion of execution of the fwscanf function. No argument is
19902 converted, but one is consumed. If the conversion specification includes an
19903 assignment-suppressing wide character or a field width, the behavior is
19904 undefined.</pre>
19905 % Matches a single % wide character; no conversion or assignment occurs. The
19906 <p><!--para 13 -->
19907 <pre>
19908 complete conversion specification shall be %%.</pre>
19909 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note326"><b>326)</b></a></sup>
19910 <p><!--para 14 -->
19911 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
19912 respectively, a, e, f, g, and x.
19913 <p><!--para 15 -->
19914 Trailing white space (including new-line wide characters) is left unread unless matched
19915 by a directive. The success of literal matches and suppressed assignments is not directly
19916 determinable other than via the %n directive.
19917 <h6>Returns</h6>
19918 <p><!--para 16 -->
19919 The fwscanf function returns the value of the macro EOF if an input failure occurs
19920 before the first conversion (if any) has completed. Otherwise, the function returns the
19921 number of input items assigned, which can be fewer than provided for, or even zero, in
19922 the event of an early matching failure.
19923 <p><!--para 17 -->
19924 EXAMPLE 1 The call:
19925 <pre>
19926 #include <a href="#7.21">&lt;stdio.h&gt;</a>
19927 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19928 /* ... */
19929 int n, i; float x; wchar_t name[50];
19930 n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);</pre>
19931 with the input line:
19932 <pre>
19933 25 54.32E-1 thompson</pre>
19934 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
19935 thompson\0.
19937 <p><!--para 18 -->
19938 EXAMPLE 2 The call:
19939 <pre>
19940 #include <a href="#7.21">&lt;stdio.h&gt;</a>
19941 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19942 /* ... */
19943 int i; float x; double y;
19944 fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);</pre>
19945 with input:
19946 <pre>
19947 56789 0123 56a72</pre>
19948 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
19949 56.0. The next wide character read from the input stream will be a.
19952 <!--page 431 -->
19953 <p><b> Forward references</b>: the wcstod, wcstof, and wcstold functions (<a href="#7.28.4.1.1">7.28.4.1.1</a>), the
19954 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.28.4.1.2">7.28.4.1.2</a>), the wcrtomb
19955 function (<a href="#7.28.6.3.3">7.28.6.3.3</a>).
19957 <h6>footnotes</h6>
19958 <p><small><a name="note324" href="#note324">324)</a> These white-space wide characters are not counted against a specified field width.
19959 </small>
19960 <p><small><a name="note325" href="#note325">325)</a> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
19961 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
19962 </small>
19963 <p><small><a name="note326" href="#note326">326)</a> See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
19964 </small>
19966 <h5><a name="7.28.2.3" href="#7.28.2.3">7.28.2.3 The swprintf function</a></h5>
19967 <h6>Synopsis</h6>
19968 <p><!--para 1 -->
19969 <pre>
19970 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19971 int swprintf(wchar_t * restrict s,
19972 size_t n,
19973 const wchar_t * restrict format, ...);</pre>
19974 <h6>Description</h6>
19975 <p><!--para 2 -->
19976 The swprintf function is equivalent to fwprintf, except that the argument s
19977 specifies an array of wide characters into which the generated output is to be written,
19978 rather than written to a stream. No more than n wide characters are written, including a
19979 terminating null wide character, which is always added (unless n is zero).
19980 <h6>Returns</h6>
19981 <p><!--para 3 -->
19982 The swprintf function returns the number of wide characters written in the array, not
19983 counting the terminating null wide character, or a negative value if an encoding error
19984 occurred or if n or more wide characters were requested to be written.
19986 <h5><a name="7.28.2.4" href="#7.28.2.4">7.28.2.4 The swscanf function</a></h5>
19987 <h6>Synopsis</h6>
19988 <p><!--para 1 -->
19989 <pre>
19990 #include <a href="#7.28">&lt;wchar.h&gt;</a>
19991 int swscanf(const wchar_t * restrict s,
19992 const wchar_t * restrict format, ...);</pre>
19993 <h6>Description</h6>
19994 <p><!--para 2 -->
19995 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
19996 wide string from which the input is to be obtained, rather than from a stream. Reaching
19997 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
19998 function.
19999 <h6>Returns</h6>
20000 <p><!--para 3 -->
20001 The swscanf function returns the value of the macro EOF if an input failure occurs
20002 before the first conversion (if any) has completed. Otherwise, the swscanf function
20003 returns the number of input items assigned, which can be fewer than provided for, or even
20004 zero, in the event of an early matching failure.
20005 <!--page 432 -->
20007 <h5><a name="7.28.2.5" href="#7.28.2.5">7.28.2.5 The vfwprintf function</a></h5>
20008 <h6>Synopsis</h6>
20009 <p><!--para 1 -->
20010 <pre>
20011 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20012 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20013 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20014 int vfwprintf(FILE * restrict stream,
20015 const wchar_t * restrict format,
20016 va_list arg);</pre>
20017 <h6>Description</h6>
20018 <p><!--para 2 -->
20019 The vfwprintf function is equivalent to fwprintf, with the variable argument list
20020 replaced by arg, which shall have been initialized by the va_start macro (and
20021 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
20022 va_end macro.<sup><a href="#note327"><b>327)</b></a></sup>
20023 <h6>Returns</h6>
20024 <p><!--para 3 -->
20025 The vfwprintf function returns the number of wide characters transmitted, or a
20026 negative value if an output or encoding error occurred.
20027 <p><!--para 4 -->
20028 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
20029 routine.
20030 <pre>
20031 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20032 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20033 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20034 void error(char *function_name, wchar_t *format, ...)
20036 va_list args;
20037 va_start(args, format);
20038 // print out name of function causing error
20039 fwprintf(stderr, L"ERROR in %s: ", function_name);
20040 // print out remainder of message
20041 vfwprintf(stderr, format, args);
20042 va_end(args);
20043 }</pre>
20048 <!--page 433 -->
20050 <h6>footnotes</h6>
20051 <p><small><a name="note327" href="#note327">327)</a> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
20052 invoke the va_arg macro, the value of arg after the return is indeterminate.
20053 </small>
20055 <h5><a name="7.28.2.6" href="#7.28.2.6">7.28.2.6 The vfwscanf function</a></h5>
20056 <h6>Synopsis</h6>
20057 <p><!--para 1 -->
20058 <pre>
20059 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20060 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20061 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20062 int vfwscanf(FILE * restrict stream,
20063 const wchar_t * restrict format,
20064 va_list arg);</pre>
20065 <h6>Description</h6>
20066 <p><!--para 2 -->
20067 The vfwscanf function is equivalent to fwscanf, with the variable argument list
20068 replaced by arg, which shall have been initialized by the va_start macro (and
20069 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
20070 va_end macro.<sup><a href="#note327"><b>327)</b></a></sup>
20071 <h6>Returns</h6>
20072 <p><!--para 3 -->
20073 The vfwscanf function returns the value of the macro EOF if an input failure occurs
20074 before the first conversion (if any) has completed. Otherwise, the vfwscanf function
20075 returns the number of input items assigned, which can be fewer than provided for, or even
20076 zero, in the event of an early matching failure.
20078 <h5><a name="7.28.2.7" href="#7.28.2.7">7.28.2.7 The vswprintf function</a></h5>
20079 <h6>Synopsis</h6>
20080 <p><!--para 1 -->
20081 <pre>
20082 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20083 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20084 int vswprintf(wchar_t * restrict s,
20085 size_t n,
20086 const wchar_t * restrict format,
20087 va_list arg);</pre>
20088 <h6>Description</h6>
20089 <p><!--para 2 -->
20090 The vswprintf function is equivalent to swprintf, with the variable argument list
20091 replaced by arg, which shall have been initialized by the va_start macro (and
20092 possibly subsequent va_arg calls). The vswprintf function does not invoke the
20093 va_end macro.<sup><a href="#note327"><b>327)</b></a></sup>
20094 <h6>Returns</h6>
20095 <p><!--para 3 -->
20096 The vswprintf function returns the number of wide characters written in the array, not
20097 counting the terminating null wide character, or a negative value if an encoding error
20098 occurred or if n or more wide characters were requested to be generated.
20099 <!--page 434 -->
20101 <h5><a name="7.28.2.8" href="#7.28.2.8">7.28.2.8 The vswscanf function</a></h5>
20102 <h6>Synopsis</h6>
20103 <p><!--para 1 -->
20104 <pre>
20105 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20106 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20107 int vswscanf(const wchar_t * restrict s,
20108 const wchar_t * restrict format,
20109 va_list arg);</pre>
20110 <h6>Description</h6>
20111 <p><!--para 2 -->
20112 The vswscanf function is equivalent to swscanf, with the variable argument list
20113 replaced by arg, which shall have been initialized by the va_start macro (and
20114 possibly subsequent va_arg calls). The vswscanf function does not invoke the
20115 va_end macro.<sup><a href="#note327"><b>327)</b></a></sup>
20116 <h6>Returns</h6>
20117 <p><!--para 3 -->
20118 The vswscanf function returns the value of the macro EOF if an input failure occurs
20119 before the first conversion (if any) has completed. Otherwise, the vswscanf function
20120 returns the number of input items assigned, which can be fewer than provided for, or even
20121 zero, in the event of an early matching failure.
20123 <h5><a name="7.28.2.9" href="#7.28.2.9">7.28.2.9 The vwprintf function</a></h5>
20124 <h6>Synopsis</h6>
20125 <p><!--para 1 -->
20126 <pre>
20127 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20128 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20129 int vwprintf(const wchar_t * restrict format,
20130 va_list arg);</pre>
20131 <h6>Description</h6>
20132 <p><!--para 2 -->
20133 The vwprintf function is equivalent to wprintf, with the variable argument list
20134 replaced by arg, which shall have been initialized by the va_start macro (and
20135 possibly subsequent va_arg calls). The vwprintf function does not invoke the
20136 va_end macro.<sup><a href="#note327"><b>327)</b></a></sup>
20137 <h6>Returns</h6>
20138 <p><!--para 3 -->
20139 The vwprintf function returns the number of wide characters transmitted, or a negative
20140 value if an output or encoding error occurred.
20141 <!--page 435 -->
20143 <h5><a name="7.28.2.10" href="#7.28.2.10">7.28.2.10 The vwscanf function</a></h5>
20144 <h6>Synopsis</h6>
20145 <p><!--para 1 -->
20146 <pre>
20147 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
20148 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20149 int vwscanf(const wchar_t * restrict format,
20150 va_list arg);</pre>
20151 <h6>Description</h6>
20152 <p><!--para 2 -->
20153 The vwscanf function is equivalent to wscanf, with the variable argument list
20154 replaced by arg, which shall have been initialized by the va_start macro (and
20155 possibly subsequent va_arg calls). The vwscanf function does not invoke the
20156 va_end macro.<sup><a href="#note327"><b>327)</b></a></sup>
20157 <h6>Returns</h6>
20158 <p><!--para 3 -->
20159 The vwscanf function returns the value of the macro EOF if an input failure occurs
20160 before the first conversion (if any) has completed. Otherwise, the vwscanf function
20161 returns the number of input items assigned, which can be fewer than provided for, or even
20162 zero, in the event of an early matching failure.
20164 <h5><a name="7.28.2.11" href="#7.28.2.11">7.28.2.11 The wprintf function</a></h5>
20165 <h6>Synopsis</h6>
20166 <p><!--para 1 -->
20167 <pre>
20168 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20169 int wprintf(const wchar_t * restrict format, ...);</pre>
20170 <h6>Description</h6>
20171 <p><!--para 2 -->
20172 The wprintf function is equivalent to fwprintf with the argument stdout
20173 interposed before the arguments to wprintf.
20174 <h6>Returns</h6>
20175 <p><!--para 3 -->
20176 The wprintf function returns the number of wide characters transmitted, or a negative
20177 value if an output or encoding error occurred.
20179 <h5><a name="7.28.2.12" href="#7.28.2.12">7.28.2.12 The wscanf function</a></h5>
20180 <h6>Synopsis</h6>
20181 <p><!--para 1 -->
20182 <pre>
20183 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20184 int wscanf(const wchar_t * restrict format, ...);</pre>
20185 <h6>Description</h6>
20186 <p><!--para 2 -->
20187 The wscanf function is equivalent to fwscanf with the argument stdin interposed
20188 before the arguments to wscanf.
20189 <!--page 436 -->
20190 <h6>Returns</h6>
20191 <p><!--para 3 -->
20192 The wscanf function returns the value of the macro EOF if an input failure occurs
20193 before the first conversion (if any) has completed. Otherwise, the wscanf function
20194 returns the number of input items assigned, which can be fewer than provided for, or even
20195 zero, in the event of an early matching failure.
20197 <h4><a name="7.28.3" href="#7.28.3">7.28.3 Wide character input/output functions</a></h4>
20199 <h5><a name="7.28.3.1" href="#7.28.3.1">7.28.3.1 The fgetwc function</a></h5>
20200 <h6>Synopsis</h6>
20201 <p><!--para 1 -->
20202 <pre>
20203 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20204 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20205 wint_t fgetwc(FILE *stream);</pre>
20206 <h6>Description</h6>
20207 <p><!--para 2 -->
20208 If the end-of-file indicator for the input stream pointed to by stream is not set and a
20209 next wide character is present, the fgetwc function obtains that wide character as a
20210 wchar_t converted to a wint_t and advances the associated file position indicator for
20211 the stream (if defined).
20212 <h6>Returns</h6>
20213 <p><!--para 3 -->
20214 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
20215 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
20216 the fgetwc function returns the next wide character from the input stream pointed to by
20217 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
20218 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
20219 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note328"><b>328)</b></a></sup>
20221 <h6>footnotes</h6>
20222 <p><small><a name="note328" href="#note328">328)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
20223 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
20224 </small>
20226 <h5><a name="7.28.3.2" href="#7.28.3.2">7.28.3.2 The fgetws function</a></h5>
20227 <h6>Synopsis</h6>
20228 <p><!--para 1 -->
20229 <pre>
20230 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20231 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20232 wchar_t *fgetws(wchar_t * restrict s,
20233 int n, FILE * restrict stream);</pre>
20234 <h6>Description</h6>
20235 <p><!--para 2 -->
20236 The fgetws function reads at most one less than the number of wide characters
20237 specified by n from the stream pointed to by stream into the array pointed to by s. No
20240 <!--page 437 -->
20241 additional wide characters are read after a new-line wide character (which is retained) or
20242 after end-of-file. A null wide character is written immediately after the last wide
20243 character read into the array.
20244 <h6>Returns</h6>
20245 <p><!--para 3 -->
20246 The fgetws function returns s if successful. If end-of-file is encountered and no
20247 characters have been read into the array, the contents of the array remain unchanged and a
20248 null pointer is returned. If a read or encoding error occurs during the operation, the array
20249 contents are indeterminate and a null pointer is returned.
20251 <h5><a name="7.28.3.3" href="#7.28.3.3">7.28.3.3 The fputwc function</a></h5>
20252 <h6>Synopsis</h6>
20253 <p><!--para 1 -->
20254 <pre>
20255 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20256 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20257 wint_t fputwc(wchar_t c, FILE *stream);</pre>
20258 <h6>Description</h6>
20259 <p><!--para 2 -->
20260 The fputwc function writes the wide character specified by c to the output stream
20261 pointed to by stream, at the position indicated by the associated file position indicator
20262 for the stream (if defined), and advances the indicator appropriately. If the file cannot
20263 support positioning requests, or if the stream was opened with append mode, the
20264 character is appended to the output stream.
20265 <h6>Returns</h6>
20266 <p><!--para 3 -->
20267 The fputwc function returns the wide character written. If a write error occurs, the
20268 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
20269 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
20271 <h5><a name="7.28.3.4" href="#7.28.3.4">7.28.3.4 The fputws function</a></h5>
20272 <h6>Synopsis</h6>
20273 <p><!--para 1 -->
20274 <pre>
20275 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20276 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20277 int fputws(const wchar_t * restrict s,
20278 FILE * restrict stream);</pre>
20279 <h6>Description</h6>
20280 <p><!--para 2 -->
20281 The fputws function writes the wide string pointed to by s to the stream pointed to by
20282 stream. The terminating null wide character is not written.
20283 <h6>Returns</h6>
20284 <p><!--para 3 -->
20285 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
20286 returns a nonnegative value.
20287 <!--page 438 -->
20289 <h5><a name="7.28.3.5" href="#7.28.3.5">7.28.3.5 The fwide function</a></h5>
20290 <h6>Synopsis</h6>
20291 <p><!--para 1 -->
20292 <pre>
20293 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20294 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20295 int fwide(FILE *stream, int mode);</pre>
20296 <h6>Description</h6>
20297 <p><!--para 2 -->
20298 The fwide function determines the orientation of the stream pointed to by stream. If
20299 mode is greater than zero, the function first attempts to make the stream wide oriented. If
20300 mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note329"><b>329)</b></a></sup>
20301 Otherwise, mode is zero and the function does not alter the orientation of the stream.
20302 <h6>Returns</h6>
20303 <p><!--para 3 -->
20304 The fwide function returns a value greater than zero if, after the call, the stream has
20305 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
20306 stream has no orientation.
20308 <h6>footnotes</h6>
20309 <p><small><a name="note329" href="#note329">329)</a> If the orientation of the stream has already been determined, fwide does not change it.
20310 </small>
20312 <h5><a name="7.28.3.6" href="#7.28.3.6">7.28.3.6 The getwc function</a></h5>
20313 <h6>Synopsis</h6>
20314 <p><!--para 1 -->
20315 <pre>
20316 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20317 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20318 wint_t getwc(FILE *stream);</pre>
20319 <h6>Description</h6>
20320 <p><!--para 2 -->
20321 The getwc function is equivalent to fgetwc, except that if it is implemented as a
20322 macro, it may evaluate stream more than once, so the argument should never be an
20323 expression with side effects.
20324 <h6>Returns</h6>
20325 <p><!--para 3 -->
20326 The getwc function returns the next wide character from the input stream pointed to by
20327 stream, or WEOF.
20329 <h5><a name="7.28.3.7" href="#7.28.3.7">7.28.3.7 The getwchar function</a></h5>
20330 <h6>Synopsis</h6>
20331 <p><!--para 1 -->
20332 <pre>
20333 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20334 wint_t getwchar(void);</pre>
20339 <!--page 439 -->
20340 <h6>Description</h6>
20341 <p><!--para 2 -->
20342 The getwchar function is equivalent to getwc with the argument stdin.
20343 <h6>Returns</h6>
20344 <p><!--para 3 -->
20345 The getwchar function returns the next wide character from the input stream pointed to
20346 by stdin, or WEOF.
20348 <h5><a name="7.28.3.8" href="#7.28.3.8">7.28.3.8 The putwc function</a></h5>
20349 <h6>Synopsis</h6>
20350 <p><!--para 1 -->
20351 <pre>
20352 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20353 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20354 wint_t putwc(wchar_t c, FILE *stream);</pre>
20355 <h6>Description</h6>
20356 <p><!--para 2 -->
20357 The putwc function is equivalent to fputwc, except that if it is implemented as a
20358 macro, it may evaluate stream more than once, so that argument should never be an
20359 expression with side effects.
20360 <h6>Returns</h6>
20361 <p><!--para 3 -->
20362 The putwc function returns the wide character written, or WEOF.
20364 <h5><a name="7.28.3.9" href="#7.28.3.9">7.28.3.9 The putwchar function</a></h5>
20365 <h6>Synopsis</h6>
20366 <p><!--para 1 -->
20367 <pre>
20368 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20369 wint_t putwchar(wchar_t c);</pre>
20370 <h6>Description</h6>
20371 <p><!--para 2 -->
20372 The putwchar function is equivalent to putwc with the second argument stdout.
20373 <h6>Returns</h6>
20374 <p><!--para 3 -->
20375 The putwchar function returns the character written, or WEOF.
20377 <h5><a name="7.28.3.10" href="#7.28.3.10">7.28.3.10 The ungetwc function</a></h5>
20378 <h6>Synopsis</h6>
20379 <p><!--para 1 -->
20380 <pre>
20381 #include <a href="#7.21">&lt;stdio.h&gt;</a>
20382 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20383 wint_t ungetwc(wint_t c, FILE *stream);</pre>
20384 <h6>Description</h6>
20385 <p><!--para 2 -->
20386 The ungetwc function pushes the wide character specified by c back onto the input
20387 stream pointed to by stream. Pushed-back wide characters will be returned by
20388 subsequent reads on that stream in the reverse order of their pushing. A successful
20389 <!--page 440 -->
20390 intervening call (with the stream pointed to by stream) to a file positioning function
20391 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
20392 stream. The external storage corresponding to the stream is unchanged.
20393 <p><!--para 3 -->
20394 One wide character of pushback is guaranteed, even if the call to the ungetwc function
20395 follows just after a call to a formatted wide character input function fwscanf,
20396 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
20397 on the same stream without an intervening read or file positioning operation on that
20398 stream, the operation may fail.
20399 <p><!--para 4 -->
20400 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
20401 unchanged.
20402 <p><!--para 5 -->
20403 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
20404 The value of the file position indicator for the stream after reading or discarding all
20405 pushed-back wide characters is the same as it was before the wide characters were pushed
20406 back. For a text or binary stream, the value of its file position indicator after a successful
20407 call to the ungetwc function is unspecified until all pushed-back wide characters are
20408 read or discarded.
20409 <h6>Returns</h6>
20410 <p><!--para 6 -->
20411 The ungetwc function returns the wide character pushed back, or WEOF if the operation
20412 fails.
20414 <h4><a name="7.28.4" href="#7.28.4">7.28.4 General wide string utilities</a></h4>
20415 <p><!--para 1 -->
20416 The header <a href="#7.28">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
20417 manipulation. Various methods are used for determining the lengths of the arrays, but in
20418 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
20419 array. If an array is accessed beyond the end of an object, the behavior is undefined.
20420 <p><!--para 2 -->
20421 Where an argument declared as size_t n determines the length of the array for a
20422 function, n can have the value zero on a call to that function. Unless explicitly stated
20423 otherwise in the description of a particular function in this subclause, pointer arguments
20424 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
20425 function that locates a wide character finds no occurrence, a function that compares two
20426 wide character sequences returns zero, and a function that copies wide characters copies
20427 zero wide characters.
20428 <!--page 441 -->
20430 <h5><a name="7.28.4.1" href="#7.28.4.1">7.28.4.1 Wide string numeric conversion functions</a></h5>
20432 <h5><a name="7.28.4.1.1" href="#7.28.4.1.1">7.28.4.1.1 The wcstod, wcstof, and wcstold functions</a></h5>
20433 <h6>Synopsis</h6>
20434 <p><!--para 1 -->
20435 <pre>
20436 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20437 double wcstod(const wchar_t * restrict nptr,
20438 wchar_t ** restrict endptr);
20439 float wcstof(const wchar_t * restrict nptr,
20440 wchar_t ** restrict endptr);
20441 long double wcstold(const wchar_t * restrict nptr,
20442 wchar_t ** restrict endptr);</pre>
20443 <h6>Description</h6>
20444 <p><!--para 2 -->
20445 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
20446 string pointed to by nptr to double, float, and long double representation,
20447 respectively. First, they decompose the input string into three parts: an initial, possibly
20448 empty, sequence of white-space wide characters (as specified by the iswspace
20449 function), a subject sequence resembling a floating-point constant or representing an
20450 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
20451 including the terminating null wide character of the input wide string. Then, they attempt
20452 to convert the subject sequence to a floating-point number, and return the result.
20453 <p><!--para 3 -->
20454 The expected form of the subject sequence is an optional plus or minus sign, then one of
20455 the following:
20456 <ul>
20457 <li> a nonempty sequence of decimal digits optionally containing a decimal-point wide
20458 character, then an optional exponent part as defined for the corresponding single-byte
20459 characters in <a href="#6.4.4.2">6.4.4.2</a>;
20460 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
20461 decimal-point wide character, then an optional binary exponent part as defined in
20462 <a href="#6.4.4.2">6.4.4.2</a>;
20463 <li> INF or INFINITY, or any other wide string equivalent except for case
20464 <li> NAN or NAN(n-wchar-sequenceopt), or any other wide string equivalent except for
20465 case in the NAN part, where:
20466 <pre>
20467 n-wchar-sequence:
20468 digit
20469 nondigit
20470 n-wchar-sequence digit
20471 n-wchar-sequence nondigit</pre>
20472 </ul>
20473 The subject sequence is defined as the longest initial subsequence of the input wide
20474 string, starting with the first non-white-space wide character, that is of the expected form.
20475 <!--page 442 -->
20476 The subject sequence contains no wide characters if the input wide string is not of the
20477 expected form.
20478 <p><!--para 4 -->
20479 If the subject sequence has the expected form for a floating-point number, the sequence of
20480 wide characters starting with the first digit or the decimal-point wide character
20481 (whichever occurs first) is interpreted as a floating constant according to the rules of
20482 <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
20483 if neither an exponent part nor a decimal-point wide character appears in a decimal
20484 floating point number, or if a binary exponent part does not appear in a hexadecimal
20485 floating point number, an exponent part of the appropriate type with value zero is
20486 assumed to follow the last digit in the string. If the subject sequence begins with a minus
20487 sign, the sequence is interpreted as negated.<sup><a href="#note330"><b>330)</b></a></sup> A wide character sequence INF or
20488 INFINITY is interpreted as an infinity, if representable in the return type, else like a
20489 floating constant that is too large for the range of the return type. A wide character
20490 sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
20491 in the return type, else like a subject sequence part that does not have the expected form;
20492 the meaning of the n-wchar sequences is implementation-defined.<sup><a href="#note331"><b>331)</b></a></sup> A pointer to the
20493 final wide string is stored in the object pointed to by endptr, provided that endptr is
20494 not a null pointer.
20495 <p><!--para 5 -->
20496 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
20497 value resulting from the conversion is correctly rounded.
20498 <p><!--para 6 -->
20499 In other than the "C" locale, additional locale-specific subject sequence forms may be
20500 accepted.
20501 <p><!--para 7 -->
20502 If the subject sequence is empty or does not have the expected form, no conversion is
20503 performed; the value of nptr is stored in the object pointed to by endptr, provided
20504 that endptr is not a null pointer.
20505 <h6>Recommended practice</h6>
20506 <p><!--para 8 -->
20507 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
20508 the result is not exactly representable, the result should be one of the two numbers in the
20509 appropriate internal format that are adjacent to the hexadecimal floating source value,
20510 with the extra stipulation that the error should have a correct sign for the current rounding
20511 direction.
20515 <!--page 443 -->
20516 <p><!--para 9 -->
20517 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
20518 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
20519 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
20520 consider the two bounding, adjacent decimal strings L and U, both having
20521 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
20522 The result should be one of the (equal or adjacent) values that would be obtained by
20523 correctly rounding L and U according to the current rounding direction, with the extra
20524 stipulation that the error with respect to D should have a correct sign for the current
20525 rounding direction.<sup><a href="#note332"><b>332)</b></a></sup>
20526 <h6>Returns</h6>
20527 <p><!--para 10 -->
20528 The functions return the converted value, if any. If no conversion could be performed,
20529 zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
20530 plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the
20531 return type and sign of the value), and the value of the macro ERANGE is stored in
20532 errno. If the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is
20533 no greater than the smallest normalized positive number in the return type; whether
20534 errno acquires the value ERANGE is implementation-defined.
20539 <!--page 444 -->
20541 <h6>footnotes</h6>
20542 <p><small><a name="note330" href="#note330">330)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
20543 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
20544 methods may yield different results if rounding is toward positive or negative infinity. In either case,
20545 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
20546 </small>
20547 <p><small><a name="note331" href="#note331">331)</a> An implementation may use the n-wchar sequence to determine extra information to be represented in
20548 the NaN's significand.
20549 </small>
20550 <p><small><a name="note332" href="#note332">332)</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
20551 to the same internal floating value, but if not will round to adjacent values.
20552 </small>
20554 <h5><a name="7.28.4.1.2" href="#7.28.4.1.2">7.28.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</a></h5>
20555 <h6>Synopsis</h6>
20556 <p><!--para 1 -->
20557 <pre>
20558 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20559 long int wcstol(
20560 const wchar_t * restrict nptr,
20561 wchar_t ** restrict endptr,
20562 int base);
20563 long long int wcstoll(
20564 const wchar_t * restrict nptr,
20565 wchar_t ** restrict endptr,
20566 int base);
20567 unsigned long int wcstoul(
20568 const wchar_t * restrict nptr,
20569 wchar_t ** restrict endptr,
20570 int base);
20571 unsigned long long int wcstoull(
20572 const wchar_t * restrict nptr,
20573 wchar_t ** restrict endptr,
20574 int base);</pre>
20575 <h6>Description</h6>
20576 <p><!--para 2 -->
20577 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
20578 portion of the wide string pointed to by nptr to long int, long long int,
20579 unsigned long int, and unsigned long long int representation,
20580 respectively. First, they decompose the input string into three parts: an initial, possibly
20581 empty, sequence of white-space wide characters (as specified by the iswspace
20582 function), a subject sequence resembling an integer represented in some radix determined
20583 by the value of base, and a final wide string of one or more unrecognized wide
20584 characters, including the terminating null wide character of the input wide string. Then,
20585 they attempt to convert the subject sequence to an integer, and return the result.
20586 <p><!--para 3 -->
20587 If the value of base is zero, the expected form of the subject sequence is that of an
20588 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
20589 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
20590 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
20591 is a sequence of letters and digits representing an integer with the radix specified by
20592 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
20593 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
20594 letters and digits whose ascribed values are less than that of base are permitted. If the
20595 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
20596 of letters and digits, following the sign if present.
20597 <!--page 445 -->
20598 <p><!--para 4 -->
20599 The subject sequence is defined as the longest initial subsequence of the input wide
20600 string, starting with the first non-white-space wide character, that is of the expected form.
20601 The subject sequence contains no wide characters if the input wide string is empty or
20602 consists entirely of white space, or if the first non-white-space wide character is other
20603 than a sign or a permissible letter or digit.
20604 <p><!--para 5 -->
20605 If the subject sequence has the expected form and the value of base is zero, the sequence
20606 of wide characters starting with the first digit is interpreted as an integer constant
20607 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
20608 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
20609 letter its value as given above. If the subject sequence begins with a minus sign, the value
20610 resulting from the conversion is negated (in the return type). A pointer to the final wide
20611 string is stored in the object pointed to by endptr, provided that endptr is not a null
20612 pointer.
20613 <p><!--para 6 -->
20614 In other than the "C" locale, additional locale-specific subject sequence forms may be
20615 accepted.
20616 <p><!--para 7 -->
20617 If the subject sequence is empty or does not have the expected form, no conversion is
20618 performed; the value of nptr is stored in the object pointed to by endptr, provided
20619 that endptr is not a null pointer.
20620 <h6>Returns</h6>
20621 <p><!--para 8 -->
20622 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
20623 value, if any. If no conversion could be performed, zero is returned. If the correct value
20624 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
20625 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
20626 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
20628 <h5><a name="7.28.4.2" href="#7.28.4.2">7.28.4.2 Wide string copying functions</a></h5>
20630 <h5><a name="7.28.4.2.1" href="#7.28.4.2.1">7.28.4.2.1 The wcscpy function</a></h5>
20631 <h6>Synopsis</h6>
20632 <p><!--para 1 -->
20633 <pre>
20634 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20635 wchar_t *wcscpy(wchar_t * restrict s1,
20636 const wchar_t * restrict s2);</pre>
20637 <h6>Description</h6>
20638 <p><!--para 2 -->
20639 The wcscpy function copies the wide string pointed to by s2 (including the terminating
20640 null wide character) into the array pointed to by s1.
20641 <h6>Returns</h6>
20642 <p><!--para 3 -->
20643 The wcscpy function returns the value of s1.
20644 <!--page 446 -->
20646 <h5><a name="7.28.4.2.2" href="#7.28.4.2.2">7.28.4.2.2 The wcsncpy function</a></h5>
20647 <h6>Synopsis</h6>
20648 <p><!--para 1 -->
20649 <pre>
20650 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20651 wchar_t *wcsncpy(wchar_t * restrict s1,
20652 const wchar_t * restrict s2,
20653 size_t n);</pre>
20654 <h6>Description</h6>
20655 <p><!--para 2 -->
20656 The wcsncpy function copies not more than n wide characters (those that follow a null
20657 wide character are not copied) from the array pointed to by s2 to the array pointed to by
20658 s1.<sup><a href="#note333"><b>333)</b></a></sup>
20659 <p><!--para 3 -->
20660 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
20661 wide characters are appended to the copy in the array pointed to by s1, until n wide
20662 characters in all have been written.
20663 <h6>Returns</h6>
20664 <p><!--para 4 -->
20665 The wcsncpy function returns the value of s1.
20667 <h6>footnotes</h6>
20668 <p><small><a name="note333" href="#note333">333)</a> Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
20669 result will not be null-terminated.
20670 </small>
20672 <h5><a name="7.28.4.2.3" href="#7.28.4.2.3">7.28.4.2.3 The wmemcpy function</a></h5>
20673 <h6>Synopsis</h6>
20674 <p><!--para 1 -->
20675 <pre>
20676 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20677 wchar_t *wmemcpy(wchar_t * restrict s1,
20678 const wchar_t * restrict s2,
20679 size_t n);</pre>
20680 <h6>Description</h6>
20681 <p><!--para 2 -->
20682 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
20683 object pointed to by s1.
20684 <h6>Returns</h6>
20685 <p><!--para 3 -->
20686 The wmemcpy function returns the value of s1.
20691 <!--page 447 -->
20693 <h5><a name="7.28.4.2.4" href="#7.28.4.2.4">7.28.4.2.4 The wmemmove function</a></h5>
20694 <h6>Synopsis</h6>
20695 <p><!--para 1 -->
20696 <pre>
20697 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20698 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
20699 size_t n);</pre>
20700 <h6>Description</h6>
20701 <p><!--para 2 -->
20702 The wmemmove function copies n wide characters from the object pointed to by s2 to
20703 the object pointed to by s1. Copying takes place as if the n wide characters from the
20704 object pointed to by s2 are first copied into a temporary array of n wide characters that
20705 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
20706 the temporary array are copied into the object pointed to by s1.
20707 <h6>Returns</h6>
20708 <p><!--para 3 -->
20709 The wmemmove function returns the value of s1.
20711 <h5><a name="7.28.4.3" href="#7.28.4.3">7.28.4.3 Wide string concatenation functions</a></h5>
20713 <h5><a name="7.28.4.3.1" href="#7.28.4.3.1">7.28.4.3.1 The wcscat function</a></h5>
20714 <h6>Synopsis</h6>
20715 <p><!--para 1 -->
20716 <pre>
20717 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20718 wchar_t *wcscat(wchar_t * restrict s1,
20719 const wchar_t * restrict s2);</pre>
20720 <h6>Description</h6>
20721 <p><!--para 2 -->
20722 The wcscat function appends a copy of the wide string pointed to by s2 (including the
20723 terminating null wide character) to the end of the wide string pointed to by s1. The initial
20724 wide character of s2 overwrites the null wide character at the end of s1.
20725 <h6>Returns</h6>
20726 <p><!--para 3 -->
20727 The wcscat function returns the value of s1.
20729 <h5><a name="7.28.4.3.2" href="#7.28.4.3.2">7.28.4.3.2 The wcsncat function</a></h5>
20730 <h6>Synopsis</h6>
20731 <p><!--para 1 -->
20732 <pre>
20733 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20734 wchar_t *wcsncat(wchar_t * restrict s1,
20735 const wchar_t * restrict s2,
20736 size_t n);</pre>
20737 <h6>Description</h6>
20738 <p><!--para 2 -->
20739 The wcsncat function appends not more than n wide characters (a null wide character
20740 and those that follow it are not appended) from the array pointed to by s2 to the end of
20741 <!--page 448 -->
20742 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
20743 wide character at the end of s1. A terminating null wide character is always appended to
20744 the result.<sup><a href="#note334"><b>334)</b></a></sup>
20745 <h6>Returns</h6>
20746 <p><!--para 3 -->
20747 The wcsncat function returns the value of s1.
20749 <h6>footnotes</h6>
20750 <p><small><a name="note334" href="#note334">334)</a> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
20751 wcslen(s1)+n+1.
20752 </small>
20754 <h5><a name="7.28.4.4" href="#7.28.4.4">7.28.4.4 Wide string comparison functions</a></h5>
20755 <p><!--para 1 -->
20756 Unless explicitly stated otherwise, the functions described in this subclause order two
20757 wide characters the same way as two integers of the underlying integer type designated
20758 by wchar_t.
20760 <h5><a name="7.28.4.4.1" href="#7.28.4.4.1">7.28.4.4.1 The wcscmp function</a></h5>
20761 <h6>Synopsis</h6>
20762 <p><!--para 1 -->
20763 <pre>
20764 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20765 int wcscmp(const wchar_t *s1, const wchar_t *s2);</pre>
20766 <h6>Description</h6>
20767 <p><!--para 2 -->
20768 The wcscmp function compares the wide string pointed to by s1 to the wide string
20769 pointed to by s2.
20770 <h6>Returns</h6>
20771 <p><!--para 3 -->
20772 The wcscmp function returns an integer greater than, equal to, or less than zero,
20773 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
20774 wide string pointed to by s2.
20776 <h5><a name="7.28.4.4.2" href="#7.28.4.4.2">7.28.4.4.2 The wcscoll function</a></h5>
20777 <h6>Synopsis</h6>
20778 <p><!--para 1 -->
20779 <pre>
20780 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20781 int wcscoll(const wchar_t *s1, const wchar_t *s2);</pre>
20782 <h6>Description</h6>
20783 <p><!--para 2 -->
20784 The wcscoll function compares the wide string pointed to by s1 to the wide string
20785 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
20786 current locale.
20787 <h6>Returns</h6>
20788 <p><!--para 3 -->
20789 The wcscoll function returns an integer greater than, equal to, or less than zero,
20790 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
20793 <!--page 449 -->
20794 wide string pointed to by s2 when both are interpreted as appropriate to the current
20795 locale.
20797 <h5><a name="7.28.4.4.3" href="#7.28.4.4.3">7.28.4.4.3 The wcsncmp function</a></h5>
20798 <h6>Synopsis</h6>
20799 <p><!--para 1 -->
20800 <pre>
20801 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20802 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
20803 size_t n);</pre>
20804 <h6>Description</h6>
20805 <p><!--para 2 -->
20806 The wcsncmp function compares not more than n wide characters (those that follow a
20807 null wide character are not compared) from the array pointed to by s1 to the array
20808 pointed to by s2.
20809 <h6>Returns</h6>
20810 <p><!--para 3 -->
20811 The wcsncmp function returns an integer greater than, equal to, or less than zero,
20812 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
20813 to, or less than the possibly null-terminated array pointed to by s2.
20815 <h5><a name="7.28.4.4.4" href="#7.28.4.4.4">7.28.4.4.4 The wcsxfrm function</a></h5>
20816 <h6>Synopsis</h6>
20817 <p><!--para 1 -->
20818 <pre>
20819 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20820 size_t wcsxfrm(wchar_t * restrict s1,
20821 const wchar_t * restrict s2,
20822 size_t n);</pre>
20823 <h6>Description</h6>
20824 <p><!--para 2 -->
20825 The wcsxfrm function transforms the wide string pointed to by s2 and places the
20826 resulting wide string into the array pointed to by s1. The transformation is such that if
20827 the wcscmp function is applied to two transformed wide strings, it returns a value greater
20828 than, equal to, or less than zero, corresponding to the result of the wcscoll function
20829 applied to the same two original wide strings. No more than n wide characters are placed
20830 into the resulting array pointed to by s1, including the terminating null wide character. If
20831 n is zero, s1 is permitted to be a null pointer.
20832 <h6>Returns</h6>
20833 <p><!--para 3 -->
20834 The wcsxfrm function returns the length of the transformed wide string (not including
20835 the terminating null wide character). If the value returned is n or greater, the contents of
20836 the array pointed to by s1 are indeterminate.
20837 <p><!--para 4 -->
20838 EXAMPLE The value of the following expression is the length of the array needed to hold the
20839 transformation of the wide string pointed to by s:
20840 <!--page 450 -->
20841 <pre>
20842 1 + wcsxfrm(NULL, s, 0)</pre>
20845 <h5><a name="7.28.4.4.5" href="#7.28.4.4.5">7.28.4.4.5 The wmemcmp function</a></h5>
20846 <h6>Synopsis</h6>
20847 <p><!--para 1 -->
20848 <pre>
20849 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20850 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
20851 size_t n);</pre>
20852 <h6>Description</h6>
20853 <p><!--para 2 -->
20854 The wmemcmp function compares the first n wide characters of the object pointed to by
20855 s1 to the first n wide characters of the object pointed to by s2.
20856 <h6>Returns</h6>
20857 <p><!--para 3 -->
20858 The wmemcmp function returns an integer greater than, equal to, or less than zero,
20859 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
20860 pointed to by s2.
20862 <h5><a name="7.28.4.5" href="#7.28.4.5">7.28.4.5 Wide string search functions</a></h5>
20864 <h5><a name="7.28.4.5.1" href="#7.28.4.5.1">7.28.4.5.1 The wcschr function</a></h5>
20865 <h6>Synopsis</h6>
20866 <p><!--para 1 -->
20867 <pre>
20868 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20869 wchar_t *wcschr(const wchar_t *s, wchar_t c);</pre>
20870 <h6>Description</h6>
20871 <p><!--para 2 -->
20872 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
20873 The terminating null wide character is considered to be part of the wide string.
20874 <h6>Returns</h6>
20875 <p><!--para 3 -->
20876 The wcschr function returns a pointer to the located wide character, or a null pointer if
20877 the wide character does not occur in the wide string.
20879 <h5><a name="7.28.4.5.2" href="#7.28.4.5.2">7.28.4.5.2 The wcscspn function</a></h5>
20880 <h6>Synopsis</h6>
20881 <p><!--para 1 -->
20882 <pre>
20883 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20884 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);</pre>
20885 <h6>Description</h6>
20886 <p><!--para 2 -->
20887 The wcscspn function computes the length of the maximum initial segment of the wide
20888 string pointed to by s1 which consists entirely of wide characters not from the wide
20889 string pointed to by s2.
20890 <!--page 451 -->
20891 <h6>Returns</h6>
20892 <p><!--para 3 -->
20893 The wcscspn function returns the length of the segment.
20895 <h5><a name="7.28.4.5.3" href="#7.28.4.5.3">7.28.4.5.3 The wcspbrk function</a></h5>
20896 <h6>Synopsis</h6>
20897 <p><!--para 1 -->
20898 <pre>
20899 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20900 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);</pre>
20901 <h6>Description</h6>
20902 <p><!--para 2 -->
20903 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
20904 any wide character from the wide string pointed to by s2.
20905 <h6>Returns</h6>
20906 <p><!--para 3 -->
20907 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
20908 no wide character from s2 occurs in s1.
20910 <h5><a name="7.28.4.5.4" href="#7.28.4.5.4">7.28.4.5.4 The wcsrchr function</a></h5>
20911 <h6>Synopsis</h6>
20912 <p><!--para 1 -->
20913 <pre>
20914 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20915 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);</pre>
20916 <h6>Description</h6>
20917 <p><!--para 2 -->
20918 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
20919 s. The terminating null wide character is considered to be part of the wide string.
20920 <h6>Returns</h6>
20921 <p><!--para 3 -->
20922 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
20923 not occur in the wide string.
20925 <h5><a name="7.28.4.5.5" href="#7.28.4.5.5">7.28.4.5.5 The wcsspn function</a></h5>
20926 <h6>Synopsis</h6>
20927 <p><!--para 1 -->
20928 <pre>
20929 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20930 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);</pre>
20931 <h6>Description</h6>
20932 <p><!--para 2 -->
20933 The wcsspn function computes the length of the maximum initial segment of the wide
20934 string pointed to by s1 which consists entirely of wide characters from the wide string
20935 pointed to by s2.
20936 <h6>Returns</h6>
20937 <p><!--para 3 -->
20938 The wcsspn function returns the length of the segment.
20939 <!--page 452 -->
20941 <h5><a name="7.28.4.5.6" href="#7.28.4.5.6">7.28.4.5.6 The wcsstr function</a></h5>
20942 <h6>Synopsis</h6>
20943 <p><!--para 1 -->
20944 <pre>
20945 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20946 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);</pre>
20947 <h6>Description</h6>
20948 <p><!--para 2 -->
20949 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
20950 the sequence of wide characters (excluding the terminating null wide character) in the
20951 wide string pointed to by s2.
20952 <h6>Returns</h6>
20953 <p><!--para 3 -->
20954 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
20955 wide string is not found. If s2 points to a wide string with zero length, the function
20956 returns s1.
20958 <h5><a name="7.28.4.5.7" href="#7.28.4.5.7">7.28.4.5.7 The wcstok function</a></h5>
20959 <h6>Synopsis</h6>
20960 <p><!--para 1 -->
20961 <pre>
20962 #include <a href="#7.28">&lt;wchar.h&gt;</a>
20963 wchar_t *wcstok(wchar_t * restrict s1,
20964 const wchar_t * restrict s2,
20965 wchar_t ** restrict ptr);</pre>
20966 <h6>Description</h6>
20967 <p><!--para 2 -->
20968 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
20969 a sequence of tokens, each of which is delimited by a wide character from the wide string
20970 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
20971 which the wcstok function stores information necessary for it to continue scanning the
20972 same wide string.
20973 <p><!--para 3 -->
20974 The first call in a sequence has a non-null first argument and stores an initial value in the
20975 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
20976 the object pointed to by ptr is required to have the value stored by the previous call in
20977 the sequence, which is then updated. The separator wide string pointed to by s2 may be
20978 different from call to call.
20979 <p><!--para 4 -->
20980 The first call in the sequence searches the wide string pointed to by s1 for the first wide
20981 character that is not contained in the current separator wide string pointed to by s2. If no
20982 such wide character is found, then there are no tokens in the wide string pointed to by s1
20983 and the wcstok function returns a null pointer. If such a wide character is found, it is
20984 the start of the first token.
20985 <p><!--para 5 -->
20986 The wcstok function then searches from there for a wide character that is contained in
20987 the current separator wide string. If no such wide character is found, the current token
20988 <!--page 453 -->
20989 extends to the end of the wide string pointed to by s1, and subsequent searches in the
20990 same wide string for a token return a null pointer. If such a wide character is found, it is
20991 overwritten by a null wide character, which terminates the current token.
20992 <p><!--para 6 -->
20993 In all cases, the wcstok function stores sufficient information in the pointer pointed to
20994 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
20995 value for ptr, shall start searching just past the element overwritten by a null wide
20996 character (if any).
20997 <h6>Returns</h6>
20998 <p><!--para 7 -->
20999 The wcstok function returns a pointer to the first wide character of a token, or a null
21000 pointer if there is no token.
21001 <p><!--para 8 -->
21002 EXAMPLE
21003 <pre>
21004 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21005 static wchar_t str1[] = L"?a???b,,,#c";
21006 static wchar_t str2[] = L"\t \t";
21007 wchar_t *t, *ptr1, *ptr2;
21008 t = wcstok(str1, L"?", &amp;ptr1); // t points to the token L"a"
21009 t = wcstok(NULL, L",", &amp;ptr1); // t points to the token L"??b"
21010 t = wcstok(str2, L" \t", &amp;ptr2); // t is a null pointer
21011 t = wcstok(NULL, L"#,", &amp;ptr1); // t points to the token L"c"
21012 t = wcstok(NULL, L"?", &amp;ptr1); // t is a null pointer</pre>
21015 <h5><a name="7.28.4.5.8" href="#7.28.4.5.8">7.28.4.5.8 The wmemchr function</a></h5>
21016 <h6>Synopsis</h6>
21017 <p><!--para 1 -->
21018 <pre>
21019 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21020 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
21021 size_t n);</pre>
21022 <h6>Description</h6>
21023 <p><!--para 2 -->
21024 The wmemchr function locates the first occurrence of c in the initial n wide characters of
21025 the object pointed to by s.
21026 <h6>Returns</h6>
21027 <p><!--para 3 -->
21028 The wmemchr function returns a pointer to the located wide character, or a null pointer if
21029 the wide character does not occur in the object.
21030 <!--page 454 -->
21032 <h5><a name="7.28.4.6" href="#7.28.4.6">7.28.4.6 Miscellaneous functions</a></h5>
21034 <h5><a name="7.28.4.6.1" href="#7.28.4.6.1">7.28.4.6.1 The wcslen function</a></h5>
21035 <h6>Synopsis</h6>
21036 <p><!--para 1 -->
21037 <pre>
21038 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21039 size_t wcslen(const wchar_t *s);</pre>
21040 <h6>Description</h6>
21041 <p><!--para 2 -->
21042 The wcslen function computes the length of the wide string pointed to by s.
21043 <h6>Returns</h6>
21044 <p><!--para 3 -->
21045 The wcslen function returns the number of wide characters that precede the terminating
21046 null wide character.
21048 <h5><a name="7.28.4.6.2" href="#7.28.4.6.2">7.28.4.6.2 The wmemset function</a></h5>
21049 <h6>Synopsis</h6>
21050 <p><!--para 1 -->
21051 <pre>
21052 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21053 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);</pre>
21054 <h6>Description</h6>
21055 <p><!--para 2 -->
21056 The wmemset function copies the value of c into each of the first n wide characters of
21057 the object pointed to by s.
21058 <h6>Returns</h6>
21059 <p><!--para 3 -->
21060 The wmemset function returns the value of s.
21062 <h4><a name="7.28.5" href="#7.28.5">7.28.5 Wide character time conversion functions</a></h4>
21064 <h5><a name="7.28.5.1" href="#7.28.5.1">7.28.5.1 The wcsftime function</a></h5>
21065 <h6>Synopsis</h6>
21066 <p><!--para 1 -->
21067 <pre>
21068 #include <a href="#7.26">&lt;time.h&gt;</a>
21069 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21070 size_t wcsftime(wchar_t * restrict s,
21071 size_t maxsize,
21072 const wchar_t * restrict format,
21073 const struct tm * restrict timeptr);</pre>
21074 <h6>Description</h6>
21075 <p><!--para 2 -->
21076 The wcsftime function is equivalent to the strftime function, except that:
21077 <ul>
21078 <li> The argument s points to the initial element of an array of wide characters into which
21079 the generated output is to be placed.
21080 <!--page 455 -->
21081 <li> The argument maxsize indicates the limiting number of wide characters.
21082 <li> The argument format is a wide string and the conversion specifiers are replaced by
21083 corresponding sequences of wide characters.
21084 <li> The return value indicates the number of wide characters.
21085 </ul>
21086 <h6>Returns</h6>
21087 <p><!--para 3 -->
21088 If the total number of resulting wide characters including the terminating null wide
21089 character is not more than maxsize, the wcsftime function returns the number of
21090 wide characters placed into the array pointed to by s not including the terminating null
21091 wide character. Otherwise, zero is returned and the contents of the array are
21092 indeterminate.
21094 <h4><a name="7.28.6" href="#7.28.6">7.28.6 Extended multibyte/wide character conversion utilities</a></h4>
21095 <p><!--para 1 -->
21096 The header <a href="#7.28">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
21097 between multibyte characters and wide characters.
21098 <p><!--para 2 -->
21099 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.28.6.3">7.28.6.3</a> and
21100 <a href="#7.28.6.4">7.28.6.4</a> -- take as a last argument a pointer to an object of type mbstate_t that is used
21101 to describe the current conversion state from a particular multibyte character sequence to
21102 a wide character sequence (or the reverse) under the rules of a particular setting for the
21103 LC_CTYPE category of the current locale.
21104 <p><!--para 3 -->
21105 The initial conversion state corresponds, for a conversion in either direction, to the
21106 beginning of a new multibyte character in the initial shift state. A zero-valued
21107 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
21108 valued mbstate_t object can be used to initiate conversion involving any multibyte
21109 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
21110 been altered by any of the functions described in this subclause, and is then used with a
21111 different multibyte character sequence, or in the other conversion direction, or with a
21112 different LC_CTYPE category setting than on earlier function calls, the behavior is
21113 undefined.<sup><a href="#note335"><b>335)</b></a></sup>
21114 <p><!--para 4 -->
21115 On entry, each function takes the described conversion state (either internal or pointed to
21116 by an argument) as current. The conversion state described by the referenced object is
21117 altered as needed to track the shift state, and the position within a multibyte character, for
21118 the associated multibyte character sequence.
21123 <!--page 456 -->
21125 <h6>footnotes</h6>
21126 <p><small><a name="note335" href="#note335">335)</a> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
21127 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
21128 character string.
21129 </small>
21131 <h5><a name="7.28.6.1" href="#7.28.6.1">7.28.6.1 Single-byte/wide character conversion functions</a></h5>
21133 <h5><a name="7.28.6.1.1" href="#7.28.6.1.1">7.28.6.1.1 The btowc function</a></h5>
21134 <h6>Synopsis</h6>
21135 <p><!--para 1 -->
21136 <pre>
21137 #include <a href="#7.28">&lt;wchar.h&gt;</a> *
21138 wint_t btowc(int c);</pre>
21139 <h6>Description</h6>
21140 <p><!--para 2 -->
21141 The btowc function determines whether c constitutes a valid single-byte character in the
21142 initial shift state.
21143 <h6>Returns</h6>
21144 <p><!--para 3 -->
21145 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
21146 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
21147 returns the wide character representation of that character.
21149 <h5><a name="7.28.6.1.2" href="#7.28.6.1.2">7.28.6.1.2 The wctob function</a></h5>
21150 <h6>Synopsis</h6>
21151 <p><!--para 1 -->
21152 <pre>
21153 #include <a href="#7.28">&lt;wchar.h&gt;</a> *
21154 int wctob(wint_t c);</pre>
21155 <h6>Description</h6>
21156 <p><!--para 2 -->
21157 The wctob function determines whether c corresponds to a member of the extended
21158 character set whose multibyte character representation is a single byte when in the initial
21159 shift state.
21160 <h6>Returns</h6>
21161 <p><!--para 3 -->
21162 The wctob function returns EOF if c does not correspond to a multibyte character with
21163 length one in the initial shift state. Otherwise, it returns the single-byte representation of
21164 that character as an unsigned char converted to an int.
21166 <h5><a name="7.28.6.2" href="#7.28.6.2">7.28.6.2 Conversion state functions</a></h5>
21168 <h5><a name="7.28.6.2.1" href="#7.28.6.2.1">7.28.6.2.1 The mbsinit function</a></h5>
21169 <h6>Synopsis</h6>
21170 <p><!--para 1 -->
21171 <pre>
21172 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21173 int mbsinit(const mbstate_t *ps);</pre>
21174 <h6>Description</h6>
21175 <p><!--para 2 -->
21176 If ps is not a null pointer, the mbsinit function determines whether the referenced
21177 mbstate_t object describes an initial conversion state.
21178 <!--page 457 -->
21179 <h6>Returns</h6>
21180 <p><!--para 3 -->
21181 The mbsinit function returns nonzero if ps is a null pointer or if the referenced object
21182 describes an initial conversion state; otherwise, it returns zero.
21184 <h5><a name="7.28.6.3" href="#7.28.6.3">7.28.6.3 Restartable multibyte/wide character conversion functions</a></h5>
21185 <p><!--para 1 -->
21186 These functions differ from the corresponding multibyte character functions of <a href="#7.22.7">7.22.7</a>
21187 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
21188 pointer to mbstate_t that points to an object that can completely describe the current
21189 conversion state of the associated multibyte character sequence. If ps is a null pointer,
21190 each function uses its own internal mbstate_t object instead, which is initialized at
21191 program startup to the initial conversion state; the functions are not required to avoid data
21192 races in this case. The implementation behaves as if no library function calls these
21193 functions with a null pointer for ps.
21194 <p><!--para 2 -->
21195 Also unlike their corresponding functions, the return value does not represent whether the
21196 encoding is state-dependent.
21198 <h5><a name="7.28.6.3.1" href="#7.28.6.3.1">7.28.6.3.1 The mbrlen function</a></h5>
21199 <h6>Synopsis</h6>
21200 <p><!--para 1 -->
21201 <pre>
21202 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21203 size_t mbrlen(const char * restrict s,
21204 size_t n,
21205 mbstate_t * restrict ps);</pre>
21206 <h6>Description</h6>
21207 <p><!--para 2 -->
21208 The mbrlen function is equivalent to the call:
21209 <pre>
21210 mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)</pre>
21211 where internal is the mbstate_t object for the mbrlen function, except that the
21212 expression designated by ps is evaluated only once.
21213 <h6>Returns</h6>
21214 <p><!--para 3 -->
21215 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
21216 or (size_t)(-1).
21217 <p><b> Forward references</b>: the mbrtowc function (<a href="#7.28.6.3.2">7.28.6.3.2</a>).
21218 <!--page 458 -->
21220 <h5><a name="7.28.6.3.2" href="#7.28.6.3.2">7.28.6.3.2 The mbrtowc function</a></h5>
21221 <h6>Synopsis</h6>
21222 <p><!--para 1 -->
21223 <pre>
21224 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21225 size_t mbrtowc(wchar_t * restrict pwc,
21226 const char * restrict s,
21227 size_t n,
21228 mbstate_t * restrict ps);</pre>
21229 <h6>Description</h6>
21230 <p><!--para 2 -->
21231 If s is a null pointer, the mbrtowc function is equivalent to the call:
21232 <pre>
21233 mbrtowc(NULL, "", 1, ps)</pre>
21234 In this case, the values of the parameters pwc and n are ignored.
21235 <p><!--para 3 -->
21236 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
21237 the byte pointed to by s to determine the number of bytes needed to complete the next
21238 multibyte character (including any shift sequences). If the function determines that the
21239 next multibyte character is complete and valid, it determines the value of the
21240 corresponding wide character and then, if pwc is not a null pointer, stores that value in
21241 the object pointed to by pwc. If the corresponding wide character is the null wide
21242 character, the resulting state described is the initial conversion state.
21243 <h6>Returns</h6>
21244 <p><!--para 4 -->
21245 The mbrtowc function returns the first of the following that applies (given the current
21246 conversion state):
21247 0 if the next n or fewer bytes complete the multibyte character that
21248 <pre>
21249 corresponds to the null wide character (which is the value stored).</pre>
21250 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
21251 <pre>
21252 character (which is the value stored); the value returned is the number
21253 of bytes that complete the multibyte character.</pre>
21254 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
21255 <pre>
21256 multibyte character, and all n bytes have been processed (no value is
21257 stored).<sup><a href="#note336"><b>336)</b></a></sup></pre>
21258 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
21259 <pre>
21260 do not contribute to a complete and valid multibyte character (no
21261 value is stored); the value of the macro EILSEQ is stored in errno,
21262 and the conversion state is unspecified.</pre>
21264 <!--page 459 -->
21266 <h6>footnotes</h6>
21267 <p><small><a name="note336" href="#note336">336)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
21268 sequence of redundant shift sequences (for implementations with state-dependent encodings).
21269 </small>
21271 <h5><a name="7.28.6.3.3" href="#7.28.6.3.3">7.28.6.3.3 The wcrtomb function</a></h5>
21272 <h6>Synopsis</h6>
21273 <p><!--para 1 -->
21274 <pre>
21275 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21276 size_t wcrtomb(char * restrict s,
21277 wchar_t wc,
21278 mbstate_t * restrict ps);</pre>
21279 <h6>Description</h6>
21280 <p><!--para 2 -->
21281 If s is a null pointer, the wcrtomb function is equivalent to the call
21282 <pre>
21283 wcrtomb(buf, L'\0', ps)</pre>
21284 where buf is an internal buffer.
21285 <p><!--para 3 -->
21286 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
21287 to represent the multibyte character that corresponds to the wide character given by wc
21288 (including any shift sequences), and stores the multibyte character representation in the
21289 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
21290 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
21291 to restore the initial shift state; the resulting state described is the initial conversion state.
21292 <h6>Returns</h6>
21293 <p><!--para 4 -->
21294 The wcrtomb function returns the number of bytes stored in the array object (including
21295 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
21296 the function stores the value of the macro EILSEQ in errno and returns
21297 (size_t)(-1); the conversion state is unspecified.
21299 <h5><a name="7.28.6.4" href="#7.28.6.4">7.28.6.4 Restartable multibyte/wide string conversion functions</a></h5>
21300 <p><!--para 1 -->
21301 These functions differ from the corresponding multibyte string functions of <a href="#7.22.8">7.22.8</a>
21302 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
21303 mbstate_t that points to an object that can completely describe the current conversion
21304 state of the associated multibyte character sequence. If ps is a null pointer, each function
21305 uses its own internal mbstate_t object instead, which is initialized at program startup
21306 to the initial conversion state; the functions are not required to avoid data races in this
21307 case. The implementation behaves as if no library function calls these functions with a
21308 null pointer for ps.
21309 <p><!--para 2 -->
21310 Also unlike their corresponding functions, the conversion source parameter, src, has a
21311 pointer-to-pointer type. When the function is storing the results of conversions (that is,
21312 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
21313 to reflect the amount of the source processed by that invocation.
21314 <!--page 460 -->
21316 <h5><a name="7.28.6.4.1" href="#7.28.6.4.1">7.28.6.4.1 The mbsrtowcs function</a></h5>
21317 <h6>Synopsis</h6>
21318 <p><!--para 1 -->
21319 <pre>
21320 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21321 size_t mbsrtowcs(wchar_t * restrict dst,
21322 const char ** restrict src,
21323 size_t len,
21324 mbstate_t * restrict ps);</pre>
21325 <h6>Description</h6>
21326 <p><!--para 2 -->
21327 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
21328 conversion state described by the object pointed to by ps, from the array indirectly
21329 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
21330 pointer, the converted characters are stored into the array pointed to by dst. Conversion
21331 continues up to and including a terminating null character, which is also stored.
21332 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
21333 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
21334 characters have been stored into the array pointed to by dst.<sup><a href="#note337"><b>337)</b></a></sup> Each conversion takes
21335 place as if by a call to the mbrtowc function.
21336 <p><!--para 3 -->
21337 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
21338 pointer (if conversion stopped due to reaching a terminating null character) or the address
21339 just past the last multibyte character converted (if any). If conversion stopped due to
21340 reaching a terminating null character and if dst is not a null pointer, the resulting state
21341 described is the initial conversion state.
21342 <h6>Returns</h6>
21343 <p><!--para 4 -->
21344 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
21345 character, an encoding error occurs: the mbsrtowcs function stores the value of the
21346 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
21347 unspecified. Otherwise, it returns the number of multibyte characters successfully
21348 converted, not including the terminating null character (if any).
21353 <!--page 461 -->
21355 <h6>footnotes</h6>
21356 <p><small><a name="note337" href="#note337">337)</a> Thus, the value of len is ignored if dst is a null pointer.
21357 </small>
21359 <h5><a name="7.28.6.4.2" href="#7.28.6.4.2">7.28.6.4.2 The wcsrtombs function</a></h5>
21360 <h6>Synopsis</h6>
21361 <p><!--para 1 -->
21362 <pre>
21363 #include <a href="#7.28">&lt;wchar.h&gt;</a>
21364 size_t wcsrtombs(char * restrict dst,
21365 const wchar_t ** restrict src,
21366 size_t len,
21367 mbstate_t * restrict ps);</pre>
21368 <h6>Description</h6>
21369 <p><!--para 2 -->
21370 The wcsrtombs function converts a sequence of wide characters from the array
21371 indirectly pointed to by src into a sequence of corresponding multibyte characters that
21372 begins in the conversion state described by the object pointed to by ps. If dst is not a
21373 null pointer, the converted characters are then stored into the array pointed to by dst.
21374 Conversion continues up to and including a terminating null wide character, which is also
21375 stored. Conversion stops earlier in two cases: when a wide character is reached that does
21376 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
21377 next multibyte character would exceed the limit of len total bytes to be stored into the
21378 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
21379 function.<sup><a href="#note338"><b>338)</b></a></sup>
21380 <p><!--para 3 -->
21381 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
21382 pointer (if conversion stopped due to reaching a terminating null wide character) or the
21383 address just past the last wide character converted (if any). If conversion stopped due to
21384 reaching a terminating null wide character, the resulting state described is the initial
21385 conversion state.
21386 <h6>Returns</h6>
21387 <p><!--para 4 -->
21388 If conversion stops because a wide character is reached that does not correspond to a
21389 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
21390 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
21391 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
21392 character sequence, not including the terminating null character (if any).
21397 <!--page 462 -->
21399 <h6>footnotes</h6>
21400 <p><small><a name="note338" href="#note338">338)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
21401 include those necessary to reach the initial shift state immediately before the null byte.
21402 </small>
21404 <h3><a name="7.29" href="#7.29">7.29 Wide character classification and mapping utilities <wctype.h></a></h3>
21406 <h4><a name="7.29.1" href="#7.29.1">7.29.1 Introduction</a></h4>
21407 <p><!--para 1 -->
21408 The header <a href="#7.29">&lt;wctype.h&gt;</a> defines one macro, and declares three data types and many
21409 functions.<sup><a href="#note339"><b>339)</b></a></sup>
21410 <p><!--para 2 -->
21411 The types declared are
21412 <pre>
21413 wint_t</pre>
21414 described in <a href="#7.28.1">7.28.1</a>;
21415 <pre>
21416 wctrans_t</pre>
21417 which is a scalar type that can hold values which represent locale-specific character
21418 mappings; and
21419 <pre>
21420 wctype_t</pre>
21421 which is a scalar type that can hold values which represent locale-specific character
21422 classifications.
21423 <p><!--para 3 -->
21424 The macro defined is WEOF (described in <a href="#7.28.1">7.28.1</a>).
21425 <p><!--para 4 -->
21426 The functions declared are grouped as follows:
21427 <ul>
21428 <li> Functions that provide wide character classification;
21429 <li> Extensible functions that provide wide character classification;
21430 <li> Functions that provide wide character case mapping;
21431 <li> Extensible functions that provide wide character mapping.
21432 </ul>
21433 <p><!--para 5 -->
21434 For all functions described in this subclause that accept an argument of type wint_t, the
21435 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
21436 this argument has any other value, the behavior is undefined.
21437 <p><!--para 6 -->
21438 The behavior of these functions is affected by the LC_CTYPE category of the current
21439 locale.
21444 <!--page 463 -->
21446 <h6>footnotes</h6>
21447 <p><small><a name="note339" href="#note339">339)</a> See ''future library directions'' (<a href="#7.30.13">7.30.13</a>).
21448 </small>
21450 <h4><a name="7.29.2" href="#7.29.2">7.29.2 Wide character classification utilities</a></h4>
21451 <p><!--para 1 -->
21452 The header <a href="#7.29">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
21453 characters.
21454 <p><!--para 2 -->
21455 The term printing wide character refers to a member of a locale-specific set of wide
21456 characters, each of which occupies at least one printing position on a display device. The
21457 term control wide character refers to a member of a locale-specific set of wide characters
21458 that are not printing wide characters.
21460 <h5><a name="7.29.2.1" href="#7.29.2.1">7.29.2.1 Wide character classification functions</a></h5>
21461 <p><!--para 1 -->
21462 The functions in this subclause return nonzero (true) if and only if the value of the
21463 argument wc conforms to that in the description of the function.
21464 <p><!--para 2 -->
21465 Each of the following functions returns true for each wide character that corresponds (as
21466 if by a call to the wctob function) to a single-byte character for which the corresponding
21467 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
21468 iswpunct functions may differ with respect to wide characters other than L' ' that are
21469 both printing and white-space wide characters.<sup><a href="#note340"><b>340)</b></a></sup>
21470 <p><b> Forward references</b>: the wctob function (<a href="#7.28.6.1.2">7.28.6.1.2</a>).
21472 <h6>footnotes</h6>
21473 <p><small><a name="note340" href="#note340">340)</a> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
21474 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
21475 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
21476 &amp;&amp; iswspace(wc) is true, but not both.
21477 </small>
21479 <h5><a name="7.29.2.1.1" href="#7.29.2.1.1">7.29.2.1.1 The iswalnum function</a></h5>
21480 <h6>Synopsis</h6>
21481 <p><!--para 1 -->
21482 <pre>
21483 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21484 int iswalnum(wint_t wc);</pre>
21485 <h6>Description</h6>
21486 <p><!--para 2 -->
21487 The iswalnum function tests for any wide character for which iswalpha or
21488 iswdigit is true.
21490 <h5><a name="7.29.2.1.2" href="#7.29.2.1.2">7.29.2.1.2 The iswalpha function</a></h5>
21491 <h6>Synopsis</h6>
21492 <p><!--para 1 -->
21493 <pre>
21494 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21495 int iswalpha(wint_t wc);</pre>
21496 <h6>Description</h6>
21497 <p><!--para 2 -->
21498 The iswalpha function tests for any wide character for which iswupper or
21499 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
21501 <!--page 464 -->
21502 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
21503 is true.<sup><a href="#note341"><b>341)</b></a></sup>
21505 <h6>footnotes</h6>
21506 <p><small><a name="note341" href="#note341">341)</a> The functions iswlower and iswupper test true or false separately for each of these additional
21507 wide characters; all four combinations are possible.
21508 </small>
21510 <h5><a name="7.29.2.1.3" href="#7.29.2.1.3">7.29.2.1.3 The iswblank function</a></h5>
21511 <h6>Synopsis</h6>
21512 <p><!--para 1 -->
21513 <pre>
21514 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21515 int iswblank(wint_t wc);</pre>
21516 <h6>Description</h6>
21517 <p><!--para 2 -->
21518 The iswblank function tests for any wide character that is a standard blank wide
21519 character or is one of a locale-specific set of wide characters for which iswspace is true
21520 and that is used to separate words within a line of text. The standard blank wide
21521 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
21522 locale, iswblank returns true only for the standard blank characters.
21524 <h5><a name="7.29.2.1.4" href="#7.29.2.1.4">7.29.2.1.4 The iswcntrl function</a></h5>
21525 <h6>Synopsis</h6>
21526 <p><!--para 1 -->
21527 <pre>
21528 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21529 int iswcntrl(wint_t wc);</pre>
21530 <h6>Description</h6>
21531 <p><!--para 2 -->
21532 The iswcntrl function tests for any control wide character.
21534 <h5><a name="7.29.2.1.5" href="#7.29.2.1.5">7.29.2.1.5 The iswdigit function</a></h5>
21535 <h6>Synopsis</h6>
21536 <p><!--para 1 -->
21537 <pre>
21538 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21539 int iswdigit(wint_t wc);</pre>
21540 <h6>Description</h6>
21541 <p><!--para 2 -->
21542 The iswdigit function tests for any wide character that corresponds to a decimal-digit
21543 character (as defined in <a href="#5.2.1">5.2.1</a>).
21545 <h5><a name="7.29.2.1.6" href="#7.29.2.1.6">7.29.2.1.6 The iswgraph function</a></h5>
21546 <h6>Synopsis</h6>
21547 <p><!--para 1 -->
21548 <pre>
21549 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21550 int iswgraph(wint_t wc);</pre>
21555 <!--page 465 -->
21556 <h6>Description</h6>
21557 <p><!--para 2 -->
21558 The iswgraph function tests for any wide character for which iswprint is true and
21559 iswspace is false.<sup><a href="#note342"><b>342)</b></a></sup>
21561 <h6>footnotes</h6>
21562 <p><small><a name="note342" href="#note342">342)</a> Note that the behavior of the iswgraph and iswpunct functions may differ from their
21563 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
21564 characters other than ' '.
21565 </small>
21567 <h5><a name="7.29.2.1.7" href="#7.29.2.1.7">7.29.2.1.7 The iswlower function</a></h5>
21568 <h6>Synopsis</h6>
21569 <p><!--para 1 -->
21570 <pre>
21571 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21572 int iswlower(wint_t wc);</pre>
21573 <h6>Description</h6>
21574 <p><!--para 2 -->
21575 The iswlower function tests for any wide character that corresponds to a lowercase
21576 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
21577 iswdigit, iswpunct, or iswspace is true.
21579 <h5><a name="7.29.2.1.8" href="#7.29.2.1.8">7.29.2.1.8 The iswprint function</a></h5>
21580 <h6>Synopsis</h6>
21581 <p><!--para 1 -->
21582 <pre>
21583 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21584 int iswprint(wint_t wc);</pre>
21585 <h6>Description</h6>
21586 <p><!--para 2 -->
21587 The iswprint function tests for any printing wide character.
21589 <h5><a name="7.29.2.1.9" href="#7.29.2.1.9">7.29.2.1.9 The iswpunct function</a></h5>
21590 <h6>Synopsis</h6>
21591 <p><!--para 1 -->
21592 <pre>
21593 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21594 int iswpunct(wint_t wc);</pre>
21595 <h6>Description</h6>
21596 <p><!--para 2 -->
21597 The iswpunct function tests for any printing wide character that is one of a locale-
21598 specific set of punctuation wide characters for which neither iswspace nor iswalnum
21599 is true.<sup><a href="#note342"><b>342)</b></a></sup>
21601 <h5><a name="7.29.2.1.10" href="#7.29.2.1.10">7.29.2.1.10 The iswspace function</a></h5>
21602 <h6>Synopsis</h6>
21603 <p><!--para 1 -->
21604 <pre>
21605 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21606 int iswspace(wint_t wc);</pre>
21610 <!--page 466 -->
21611 <h6>Description</h6>
21612 <p><!--para 2 -->
21613 The iswspace function tests for any wide character that corresponds to a locale-specific
21614 set of white-space wide characters for which none of iswalnum, iswgraph, or
21615 iswpunct is true.
21617 <h5><a name="7.29.2.1.11" href="#7.29.2.1.11">7.29.2.1.11 The iswupper function</a></h5>
21618 <h6>Synopsis</h6>
21619 <p><!--para 1 -->
21620 <pre>
21621 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21622 int iswupper(wint_t wc);</pre>
21623 <h6>Description</h6>
21624 <p><!--para 2 -->
21625 The iswupper function tests for any wide character that corresponds to an uppercase
21626 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
21627 iswdigit, iswpunct, or iswspace is true.
21629 <h5><a name="7.29.2.1.12" href="#7.29.2.1.12">7.29.2.1.12 The iswxdigit function</a></h5>
21630 <h6>Synopsis</h6>
21631 <p><!--para 1 -->
21632 <pre>
21633 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21634 int iswxdigit(wint_t wc);</pre>
21635 <h6>Description</h6>
21636 <p><!--para 2 -->
21637 The iswxdigit function tests for any wide character that corresponds to a
21638 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
21640 <h5><a name="7.29.2.2" href="#7.29.2.2">7.29.2.2 Extensible wide character classification functions</a></h5>
21641 <p><!--para 1 -->
21642 The functions wctype and iswctype provide extensible wide character classification
21643 as well as testing equivalent to that performed by the functions described in the previous
21644 subclause (<a href="#7.29.2.1">7.29.2.1</a>).
21646 <h5><a name="7.29.2.2.1" href="#7.29.2.2.1">7.29.2.2.1 The iswctype function</a></h5>
21647 <h6>Synopsis</h6>
21648 <p><!--para 1 -->
21649 <pre>
21650 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21651 int iswctype(wint_t wc, wctype_t desc);</pre>
21652 <h6>Description</h6>
21653 <p><!--para 2 -->
21654 The iswctype function determines whether the wide character wc has the property
21655 described by desc. The current setting of the LC_CTYPE category shall be the same as
21656 during the call to wctype that returned the value desc.
21657 <p><!--para 3 -->
21658 Each of the following expressions has a truth-value equivalent to the call to the wide
21659 character classification function (<a href="#7.29.2.1">7.29.2.1</a>) in the comment that follows the expression:
21660 <!--page 467 -->
21661 <pre>
21662 iswctype(wc, wctype("alnum")) // iswalnum(wc)
21663 iswctype(wc, wctype("alpha")) // iswalpha(wc)
21664 iswctype(wc, wctype("blank")) // iswblank(wc)
21665 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
21666 iswctype(wc, wctype("digit")) // iswdigit(wc)
21667 iswctype(wc, wctype("graph")) // iswgraph(wc)
21668 iswctype(wc, wctype("lower")) // iswlower(wc)
21669 iswctype(wc, wctype("print")) // iswprint(wc)
21670 iswctype(wc, wctype("punct")) // iswpunct(wc)
21671 iswctype(wc, wctype("space")) // iswspace(wc)
21672 iswctype(wc, wctype("upper")) // iswupper(wc)
21673 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)</pre>
21674 <h6>Returns</h6>
21675 <p><!--para 4 -->
21676 The iswctype function returns nonzero (true) if and only if the value of the wide
21677 character wc has the property described by desc. If desc is zero, the iswctype
21678 function returns zero (false).
21679 <p><b> Forward references</b>: the wctype function (<a href="#7.29.2.2.2">7.29.2.2.2</a>).
21681 <h5><a name="7.29.2.2.2" href="#7.29.2.2.2">7.29.2.2.2 The wctype function</a></h5>
21682 <h6>Synopsis</h6>
21683 <p><!--para 1 -->
21684 <pre>
21685 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21686 wctype_t wctype(const char *property);</pre>
21687 <h6>Description</h6>
21688 <p><!--para 2 -->
21689 The wctype function constructs a value with type wctype_t that describes a class of
21690 wide characters identified by the string argument property.
21691 <p><!--para 3 -->
21692 The strings listed in the description of the iswctype function shall be valid in all
21693 locales as property arguments to the wctype function.
21694 <h6>Returns</h6>
21695 <p><!--para 4 -->
21696 If property identifies a valid class of wide characters according to the LC_CTYPE
21697 category of the current locale, the wctype function returns a nonzero value that is valid
21698 as the second argument to the iswctype function; otherwise, it returns zero.
21699 <!--page 468 -->
21701 <h4><a name="7.29.3" href="#7.29.3">7.29.3 Wide character case mapping utilities</a></h4>
21702 <p><!--para 1 -->
21703 The header <a href="#7.29">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
21705 <h5><a name="7.29.3.1" href="#7.29.3.1">7.29.3.1 Wide character case mapping functions</a></h5>
21707 <h5><a name="7.29.3.1.1" href="#7.29.3.1.1">7.29.3.1.1 The towlower function</a></h5>
21708 <h6>Synopsis</h6>
21709 <p><!--para 1 -->
21710 <pre>
21711 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21712 wint_t towlower(wint_t wc);</pre>
21713 <h6>Description</h6>
21714 <p><!--para 2 -->
21715 The towlower function converts an uppercase letter to a corresponding lowercase letter.
21716 <h6>Returns</h6>
21717 <p><!--para 3 -->
21718 If the argument is a wide character for which iswupper is true and there are one or
21719 more corresponding wide characters, as specified by the current locale, for which
21720 iswlower is true, the towlower function returns one of the corresponding wide
21721 characters (always the same one for any given locale); otherwise, the argument is
21722 returned unchanged.
21724 <h5><a name="7.29.3.1.2" href="#7.29.3.1.2">7.29.3.1.2 The towupper function</a></h5>
21725 <h6>Synopsis</h6>
21726 <p><!--para 1 -->
21727 <pre>
21728 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21729 wint_t towupper(wint_t wc);</pre>
21730 <h6>Description</h6>
21731 <p><!--para 2 -->
21732 The towupper function converts a lowercase letter to a corresponding uppercase letter.
21733 <h6>Returns</h6>
21734 <p><!--para 3 -->
21735 If the argument is a wide character for which iswlower is true and there are one or
21736 more corresponding wide characters, as specified by the current locale, for which
21737 iswupper is true, the towupper function returns one of the corresponding wide
21738 characters (always the same one for any given locale); otherwise, the argument is
21739 returned unchanged.
21741 <h5><a name="7.29.3.2" href="#7.29.3.2">7.29.3.2 Extensible wide character case mapping functions</a></h5>
21742 <p><!--para 1 -->
21743 The functions wctrans and towctrans provide extensible wide character mapping as
21744 well as case mapping equivalent to that performed by the functions described in the
21745 previous subclause (<a href="#7.29.3.1">7.29.3.1</a>).
21746 <!--page 469 -->
21748 <h5><a name="7.29.3.2.1" href="#7.29.3.2.1">7.29.3.2.1 The towctrans function</a></h5>
21749 <h6>Synopsis</h6>
21750 <p><!--para 1 -->
21751 <pre>
21752 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21753 wint_t towctrans(wint_t wc, wctrans_t desc);</pre>
21754 <h6>Description</h6>
21755 <p><!--para 2 -->
21756 The towctrans function maps the wide character wc using the mapping described by
21757 desc. The current setting of the LC_CTYPE category shall be the same as during the call
21758 to wctrans that returned the value desc.
21759 <p><!--para 3 -->
21760 Each of the following expressions behaves the same as the call to the wide character case
21761 mapping function (<a href="#7.29.3.1">7.29.3.1</a>) in the comment that follows the expression:
21762 <pre>
21763 towctrans(wc, wctrans("tolower")) // towlower(wc)
21764 towctrans(wc, wctrans("toupper")) // towupper(wc)</pre>
21765 <h6>Returns</h6>
21766 <p><!--para 4 -->
21767 The towctrans function returns the mapped value of wc using the mapping described
21768 by desc. If desc is zero, the towctrans function returns the value of wc.
21770 <h5><a name="7.29.3.2.2" href="#7.29.3.2.2">7.29.3.2.2 The wctrans function</a></h5>
21771 <h6>Synopsis</h6>
21772 <p><!--para 1 -->
21773 <pre>
21774 #include <a href="#7.29">&lt;wctype.h&gt;</a>
21775 wctrans_t wctrans(const char *property);</pre>
21776 <h6>Description</h6>
21777 <p><!--para 2 -->
21778 The wctrans function constructs a value with type wctrans_t that describes a
21779 mapping between wide characters identified by the string argument property.
21780 <p><!--para 3 -->
21781 The strings listed in the description of the towctrans function shall be valid in all
21782 locales as property arguments to the wctrans function.
21783 <h6>Returns</h6>
21784 <p><!--para 4 -->
21785 If property identifies a valid mapping of wide characters according to the LC_CTYPE
21786 category of the current locale, the wctrans function returns a nonzero value that is valid
21787 as the second argument to the towctrans function; otherwise, it returns zero.
21788 <!--page 470 -->
21790 <h3><a name="7.30" href="#7.30">7.30 Future library directions</a></h3>
21791 <p><!--para 1 -->
21792 The following names are grouped under individual headers for convenience. All external
21793 names described below are reserved no matter what headers are included by the program.
21795 <h4><a name="7.30.1" href="#7.30.1">7.30.1 Complex arithmetic <complex.h></a></h4>
21796 <p><!--para 1 -->
21797 The function names
21798 <pre>
21799 cerf cexpm1 clog2
21800 cerfc clog10 clgamma
21801 cexp2 clog1p ctgamma</pre>
21802 and the same names suffixed with f or l may be added to the declarations in the
21803 <a href="#7.3">&lt;complex.h&gt;</a> header.
21805 <h4><a name="7.30.2" href="#7.30.2">7.30.2 Character handling <ctype.h></a></h4>
21806 <p><!--para 1 -->
21807 Function names that begin with either is or to, and a lowercase letter may be added to
21808 the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
21810 <h4><a name="7.30.3" href="#7.30.3">7.30.3 Errors <errno.h></a></h4>
21811 <p><!--para 1 -->
21812 Macros that begin with E and a digit or E and an uppercase letter may be added to the
21813 declarations in the <a href="#7.5">&lt;errno.h&gt;</a> header.
21815 <h4><a name="7.30.4" href="#7.30.4">7.30.4 Format conversion of integer types <inttypes.h></a></h4>
21816 <p><!--para 1 -->
21817 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
21818 added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
21820 <h4><a name="7.30.5" href="#7.30.5">7.30.5 Localization <locale.h></a></h4>
21821 <p><!--para 1 -->
21822 Macros that begin with LC_ and an uppercase letter may be added to the definitions in
21823 the <a href="#7.11">&lt;locale.h&gt;</a> header.
21825 <h4><a name="7.30.6" href="#7.30.6">7.30.6 Signal handling <signal.h></a></h4>
21826 <p><!--para 1 -->
21827 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
21828 letter may be added to the definitions in the <a href="#7.14">&lt;signal.h&gt;</a> header.
21830 <h4><a name="7.30.7" href="#7.30.7">7.30.7 Boolean type and values <stdbool.h></a></h4>
21831 <p><!--para 1 -->
21832 The ability to undefine and perhaps then redefine the macros bool, true, and false is
21833 an obsolescent feature.
21835 <h4><a name="7.30.8" href="#7.30.8">7.30.8 Integer types <stdint.h></a></h4>
21836 <p><!--para 1 -->
21837 Typedef names beginning with int or uint and ending with _t may be added to the
21838 types defined in the <a href="#7.20">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
21839 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
21840 <a href="#7.20">&lt;stdint.h&gt;</a> header.
21841 <!--page 471 -->
21843 <h4><a name="7.30.9" href="#7.30.9">7.30.9 Input/output <stdio.h></a></h4>
21844 <p><!--para 1 -->
21845 Lowercase letters may be added to the conversion specifiers and length modifiers in
21846 fprintf and fscanf. Other characters may be used in extensions.
21847 <p><!--para 2 -->
21848 The use of ungetc on a binary stream where the file position indicator is zero prior to *
21849 the call is an obsolescent feature.
21851 <h4><a name="7.30.10" href="#7.30.10">7.30.10 General utilities <stdlib.h></a></h4>
21852 <p><!--para 1 -->
21853 Function names that begin with str and a lowercase letter may be added to the
21854 declarations in the <a href="#7.22">&lt;stdlib.h&gt;</a> header.
21856 <h4><a name="7.30.11" href="#7.30.11">7.30.11 String handling <string.h></a></h4>
21857 <p><!--para 1 -->
21858 Function names that begin with str, mem, or wcs and a lowercase letter may be added
21859 to the declarations in the <a href="#7.23">&lt;string.h&gt;</a> header.
21861 <h4><a name="7.30.12" href="#7.30.12">7.30.12 Extended multibyte and wide character utilities <wchar.h></a></h4>
21862 <p><!--para 1 -->
21863 Function names that begin with wcs and a lowercase letter may be added to the
21864 declarations in the <a href="#7.28">&lt;wchar.h&gt;</a> header.
21865 <p><!--para 2 -->
21866 Lowercase letters may be added to the conversion specifiers and length modifiers in
21867 fwprintf and fwscanf. Other characters may be used in extensions.
21869 <h4><a name="7.30.13" href="#7.30.13">7.30.13 Wide character classification and mapping utilities</a></h4>
21870 <a href="#7.29">&lt;wctype.h&gt;</a>
21871 <p><!--para 1 -->
21872 Function names that begin with is or to and a lowercase letter may be added to the
21873 declarations in the <a href="#7.29">&lt;wctype.h&gt;</a> header.
21874 <!--page 472 -->
21876 <h2><a name="A" href="#A">Annex A</a></h2>
21877 <p><!--para 1 -->
21878 <pre>
21879 (informative)
21880 Language syntax summary</pre>
21881 NOTE The notation is described in <a href="#6.1">6.1</a>.
21884 <h3><a name="A.1" href="#A.1">A.1 Lexical grammar</a></h3>
21886 <h4><a name="A.1.1" href="#A.1.1">A.1.1 Lexical elements</a></h4>
21887 (<a href="#6.4">6.4</a>) token:
21888 <pre>
21889 keyword
21890 identifier
21891 constant
21892 string-literal
21893 punctuator</pre>
21894 (<a href="#6.4">6.4</a>) preprocessing-token:
21895 <!--page 473 -->
21896 <pre>
21897 header-name
21898 identifier
21899 pp-number
21900 character-constant
21901 string-literal
21902 punctuator
21903 each non-white-space character that cannot be one of the above</pre>
21905 <h4><a name="A.1.2" href="#A.1.2">A.1.2 Keywords</a></h4>
21906 (<a href="#6.4.1">6.4.1</a>) keyword: one of
21907 <pre>
21908 alignof goto union
21909 auto if unsigned
21910 break inline void
21911 case int volatile
21912 char long while
21913 const register _Alignas
21914 continue restrict _Atomic
21915 default return _Bool
21916 do short _Complex
21917 double signed _Generic
21918 else sizeof _Imaginary
21919 enum static _Noreturn
21920 extern struct _Static_assert
21921 float switch _Thread_local
21922 for typedef</pre>
21924 <h4><a name="A.1.3" href="#A.1.3">A.1.3 Identifiers</a></h4>
21925 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
21926 <pre>
21927 identifier-nondigit
21928 identifier identifier-nondigit
21929 identifier digit</pre>
21930 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
21931 <pre>
21932 nondigit
21933 universal-character-name
21934 other implementation-defined characters</pre>
21935 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
21936 <pre>
21937 _ a b c d e f g h i j k l m
21938 n o p q r s t u v w x y z
21939 A B C D E F G H I J K L M
21940 N O P Q R S T U V W X Y Z</pre>
21941 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
21942 <!--page 474 -->
21943 <pre>
21944 0 1 2 3 4 5 6 7 8 9</pre>
21946 <h4><a name="A.1.4" href="#A.1.4">A.1.4 Universal character names</a></h4>
21947 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
21948 <pre>
21949 \u hex-quad
21950 \U hex-quad hex-quad</pre>
21951 (<a href="#6.4.3">6.4.3</a>) hex-quad:
21952 <pre>
21953 hexadecimal-digit hexadecimal-digit
21954 hexadecimal-digit hexadecimal-digit</pre>
21956 <h4><a name="A.1.5" href="#A.1.5">A.1.5 Constants</a></h4>
21957 (<a href="#6.4.4">6.4.4</a>) constant:
21958 <pre>
21959 integer-constant
21960 floating-constant
21961 enumeration-constant
21962 character-constant</pre>
21963 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
21964 <pre>
21965 decimal-constant integer-suffixopt
21966 octal-constant integer-suffixopt
21967 hexadecimal-constant integer-suffixopt</pre>
21968 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
21969 <pre>
21970 nonzero-digit
21971 decimal-constant digit</pre>
21972 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
21973 <pre>
21975 octal-constant octal-digit</pre>
21976 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
21977 <pre>
21978 hexadecimal-prefix hexadecimal-digit
21979 hexadecimal-constant hexadecimal-digit</pre>
21980 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
21981 <pre>
21982 0x 0X</pre>
21983 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
21984 <pre>
21985 1 2 3 4 5 6 7 8 9</pre>
21986 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
21987 <!--page 475 -->
21988 <pre>
21989 0 1 2 3 4 5 6 7</pre>
21990 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
21991 <pre>
21992 0 1 2 3 4 5 6 7 8 9
21993 a b c d e f
21994 A B C D E F</pre>
21995 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
21996 <pre>
21997 unsigned-suffix long-suffixopt
21998 unsigned-suffix long-long-suffix
21999 long-suffix unsigned-suffixopt
22000 long-long-suffix unsigned-suffixopt</pre>
22001 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
22002 <pre>
22003 u U</pre>
22004 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
22005 <pre>
22006 l L</pre>
22007 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
22008 <pre>
22009 ll LL</pre>
22010 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
22011 <pre>
22012 decimal-floating-constant
22013 hexadecimal-floating-constant</pre>
22014 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
22015 <pre>
22016 fractional-constant exponent-partopt floating-suffixopt
22017 digit-sequence exponent-part floating-suffixopt</pre>
22018 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
22019 <pre>
22020 hexadecimal-prefix hexadecimal-fractional-constant
22021 binary-exponent-part floating-suffixopt
22022 hexadecimal-prefix hexadecimal-digit-sequence
22023 binary-exponent-part floating-suffixopt</pre>
22024 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
22025 <pre>
22026 digit-sequenceopt . digit-sequence
22027 digit-sequence .</pre>
22028 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
22029 <pre>
22030 e signopt digit-sequence
22031 E signopt digit-sequence</pre>
22032 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
22033 <!--page 476 -->
22034 <pre>
22035 + -</pre>
22036 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
22037 <pre>
22038 digit
22039 digit-sequence digit</pre>
22040 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
22041 <pre>
22042 hexadecimal-digit-sequenceopt .
22043 hexadecimal-digit-sequence
22044 hexadecimal-digit-sequence .</pre>
22045 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
22046 <pre>
22047 p signopt digit-sequence
22048 P signopt digit-sequence</pre>
22049 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
22050 <pre>
22051 hexadecimal-digit
22052 hexadecimal-digit-sequence hexadecimal-digit</pre>
22053 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
22054 <pre>
22055 f l F L</pre>
22056 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
22057 <pre>
22058 identifier</pre>
22059 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
22060 <pre>
22061 ' c-char-sequence '
22062 L' c-char-sequence '
22063 u' c-char-sequence '
22064 U' c-char-sequence '</pre>
22065 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
22066 <pre>
22067 c-char
22068 c-char-sequence c-char</pre>
22069 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
22070 <pre>
22071 any member of the source character set except
22072 the single-quote ', backslash \, or new-line character
22073 escape-sequence</pre>
22074 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
22075 <!--page 477 -->
22076 <pre>
22077 simple-escape-sequence
22078 octal-escape-sequence
22079 hexadecimal-escape-sequence
22080 universal-character-name</pre>
22081 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
22082 <pre>
22083 \' \" \? \\
22084 \a \b \f \n \r \t \v</pre>
22085 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
22086 <pre>
22087 \ octal-digit
22088 \ octal-digit octal-digit
22089 \ octal-digit octal-digit octal-digit</pre>
22090 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
22091 <pre>
22092 \x hexadecimal-digit
22093 hexadecimal-escape-sequence hexadecimal-digit</pre>
22095 <h4><a name="A.1.6" href="#A.1.6">A.1.6 String literals</a></h4>
22096 (<a href="#6.4.5">6.4.5</a>) string-literal:
22097 <pre>
22098 encoding-prefixopt " s-char-sequenceopt "</pre>
22099 (<a href="#6.4.5">6.4.5</a>) encoding-prefix:
22100 <pre>
22104 L</pre>
22105 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
22106 <pre>
22107 s-char
22108 s-char-sequence s-char</pre>
22109 (<a href="#6.4.5">6.4.5</a>) s-char:
22110 <pre>
22111 any member of the source character set except
22112 the double-quote ", backslash \, or new-line character
22113 escape-sequence</pre>
22115 <h4><a name="A.1.7" href="#A.1.7">A.1.7 Punctuators</a></h4>
22116 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
22117 <!--page 478 -->
22118 <pre>
22119 [ ] ( ) { } . -&gt;
22120 ++ -- &amp; * + - ~ !
22121 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
22122 ? : ; ...
22123 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
22124 , # ##
22125 &lt;: :&gt; &lt;% %&gt; %: %:%:</pre>
22127 <h4><a name="A.1.8" href="#A.1.8">A.1.8 Header names</a></h4>
22128 (<a href="#6.4.7">6.4.7</a>) header-name:
22129 <pre>
22130 &lt; h-char-sequence &gt;
22131 " q-char-sequence "</pre>
22132 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
22133 <pre>
22134 h-char
22135 h-char-sequence h-char</pre>
22136 (<a href="#6.4.7">6.4.7</a>) h-char:
22137 <pre>
22138 any member of the source character set except
22139 the new-line character and &gt;</pre>
22140 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
22141 <pre>
22142 q-char
22143 q-char-sequence q-char</pre>
22144 (<a href="#6.4.7">6.4.7</a>) q-char:
22145 <pre>
22146 any member of the source character set except
22147 the new-line character and "</pre>
22149 <h4><a name="A.1.9" href="#A.1.9">A.1.9 Preprocessing numbers</a></h4>
22150 (<a href="#6.4.8">6.4.8</a>) pp-number:
22151 <!--page 479 -->
22152 <pre>
22153 digit
22154 . digit
22155 pp-number digit
22156 pp-number identifier-nondigit
22157 pp-number e sign
22158 pp-number E sign
22159 pp-number p sign
22160 pp-number P sign
22161 pp-number .</pre>
22163 <h3><a name="A.2" href="#A.2">A.2 Phrase structure grammar</a></h3>
22165 <h4><a name="A.2.1" href="#A.2.1">A.2.1 Expressions</a></h4>
22166 (<a href="#6.5.1">6.5.1</a>) primary-expression:
22167 <pre>
22168 identifier
22169 constant
22170 string-literal
22171 ( expression )
22172 generic-selection</pre>
22173 (<a href="#6.5.1.1">6.5.1.1</a>) generic-selection:
22174 <pre>
22175 _Generic ( assignment-expression , generic-assoc-list )</pre>
22176 (<a href="#6.5.1.1">6.5.1.1</a>) generic-assoc-list:
22177 <pre>
22178 generic-association
22179 generic-assoc-list , generic-association</pre>
22180 (<a href="#6.5.1.1">6.5.1.1</a>) generic-association:
22181 <pre>
22182 type-name : assignment-expression
22183 default : assignment-expression</pre>
22184 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
22185 <pre>
22186 primary-expression
22187 postfix-expression [ expression ]
22188 postfix-expression ( argument-expression-listopt )
22189 postfix-expression . identifier
22190 postfix-expression -&gt; identifier
22191 postfix-expression ++
22192 postfix-expression --
22193 ( type-name ) { initializer-list }
22194 ( type-name ) { initializer-list , }</pre>
22195 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
22196 <pre>
22197 assignment-expression
22198 argument-expression-list , assignment-expression</pre>
22199 (<a href="#6.5.3">6.5.3</a>) unary-expression:
22200 <!--page 480 -->
22201 <pre>
22202 postfix-expression
22203 ++ unary-expression
22204 -- unary-expression
22205 unary-operator cast-expression
22206 sizeof unary-expression
22207 sizeof ( type-name )
22208 alignof ( type-name )</pre>
22209 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
22210 <pre>
22211 &amp; * + - ~ !</pre>
22212 (<a href="#6.5.4">6.5.4</a>) cast-expression:
22213 <pre>
22214 unary-expression
22215 ( type-name ) cast-expression</pre>
22216 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
22217 <pre>
22218 cast-expression
22219 multiplicative-expression * cast-expression
22220 multiplicative-expression / cast-expression
22221 multiplicative-expression % cast-expression</pre>
22222 (<a href="#6.5.6">6.5.6</a>) additive-expression:
22223 <pre>
22224 multiplicative-expression
22225 additive-expression + multiplicative-expression
22226 additive-expression - multiplicative-expression</pre>
22227 (<a href="#6.5.7">6.5.7</a>) shift-expression:
22228 <pre>
22229 additive-expression
22230 shift-expression &lt;&lt; additive-expression
22231 shift-expression &gt;&gt; additive-expression</pre>
22232 (<a href="#6.5.8">6.5.8</a>) relational-expression:
22233 <pre>
22234 shift-expression
22235 relational-expression &lt; shift-expression
22236 relational-expression &gt; shift-expression
22237 relational-expression &lt;= shift-expression
22238 relational-expression &gt;= shift-expression</pre>
22239 (<a href="#6.5.9">6.5.9</a>) equality-expression:
22240 <pre>
22241 relational-expression
22242 equality-expression == relational-expression
22243 equality-expression != relational-expression</pre>
22244 (<a href="#6.5.10">6.5.10</a>) AND-expression:
22245 <pre>
22246 equality-expression
22247 AND-expression &amp; equality-expression</pre>
22248 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
22249 <!--page 481 -->
22250 <pre>
22251 AND-expression
22252 exclusive-OR-expression ^ AND-expression</pre>
22253 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
22254 <pre>
22255 exclusive-OR-expression
22256 inclusive-OR-expression | exclusive-OR-expression</pre>
22257 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
22258 <pre>
22259 inclusive-OR-expression
22260 logical-AND-expression &amp;&amp; inclusive-OR-expression</pre>
22261 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
22262 <pre>
22263 logical-AND-expression
22264 logical-OR-expression || logical-AND-expression</pre>
22265 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
22266 <pre>
22267 logical-OR-expression
22268 logical-OR-expression ? expression : conditional-expression</pre>
22269 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
22270 <pre>
22271 conditional-expression
22272 unary-expression assignment-operator assignment-expression</pre>
22273 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
22274 <pre>
22275 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</pre>
22276 (<a href="#6.5.17">6.5.17</a>) expression:
22277 <pre>
22278 assignment-expression
22279 expression , assignment-expression</pre>
22280 (<a href="#6.6">6.6</a>) constant-expression:
22281 <pre>
22282 conditional-expression</pre>
22284 <h4><a name="A.2.2" href="#A.2.2">A.2.2 Declarations</a></h4>
22285 (<a href="#6.7">6.7</a>) declaration:
22286 <pre>
22287 declaration-specifiers init-declarator-listopt ;
22288 static_assert-declaration</pre>
22289 (<a href="#6.7">6.7</a>) declaration-specifiers:
22290 <pre>
22291 storage-class-specifier declaration-specifiersopt
22292 type-specifier declaration-specifiersopt
22293 type-qualifier declaration-specifiersopt
22294 function-specifier declaration-specifiersopt
22295 alignment-specifier declaration-specifiersopt</pre>
22296 (<a href="#6.7">6.7</a>) init-declarator-list:
22297 <!--page 482 -->
22298 <pre>
22299 init-declarator
22300 init-declarator-list , init-declarator</pre>
22301 (<a href="#6.7">6.7</a>) init-declarator:
22302 <pre>
22303 declarator
22304 declarator = initializer</pre>
22305 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
22306 <pre>
22307 typedef
22308 extern
22309 static
22310 _Thread_local
22311 auto
22312 register</pre>
22313 (<a href="#6.7.2">6.7.2</a>) type-specifier:
22314 <pre>
22315 void
22316 char
22317 short
22319 long
22320 float
22321 double
22322 signed
22323 unsigned
22324 _Bool
22325 _Complex
22326 atomic-type-specifier
22327 struct-or-union-specifier
22328 enum-specifier
22329 typedef-name</pre>
22330 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
22331 <pre>
22332 struct-or-union identifieropt { struct-declaration-list }
22333 struct-or-union identifier</pre>
22334 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
22335 <pre>
22336 struct
22337 union</pre>
22338 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
22339 <pre>
22340 struct-declaration
22341 struct-declaration-list struct-declaration</pre>
22342 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
22343 <!--page 483 -->
22344 <pre>
22345 specifier-qualifier-list struct-declarator-listopt ;
22346 static_assert-declaration</pre>
22347 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
22348 <pre>
22349 type-specifier specifier-qualifier-listopt
22350 type-qualifier specifier-qualifier-listopt</pre>
22351 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
22352 <pre>
22353 struct-declarator
22354 struct-declarator-list , struct-declarator</pre>
22355 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
22356 <pre>
22357 declarator
22358 declaratoropt : constant-expression</pre>
22359 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
22360 <pre>
22361 enum identifieropt { enumerator-list }
22362 enum identifieropt { enumerator-list , }
22363 enum identifier</pre>
22364 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
22365 <pre>
22366 enumerator
22367 enumerator-list , enumerator</pre>
22368 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
22369 <pre>
22370 enumeration-constant
22371 enumeration-constant = constant-expression</pre>
22372 (<a href="#6.7.2.4">6.7.2.4</a>) atomic-type-specifier:
22373 <pre>
22374 _Atomic ( type-name )</pre>
22375 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
22376 <pre>
22377 const
22378 restrict
22379 volatile
22380 _Atomic</pre>
22381 (<a href="#6.7.4">6.7.4</a>) function-specifier:
22382 <pre>
22383 inline
22384 _Noreturn</pre>
22385 (<a href="#6.7.5">6.7.5</a>) alignment-specifier:
22386 <pre>
22387 _Alignas ( type-name )
22388 _Alignas ( constant-expression )</pre>
22389 (<a href="#6.7.6">6.7.6</a>) declarator:
22390 <!--page 484 -->
22391 <pre>
22392 pointeropt direct-declarator</pre>
22393 (<a href="#6.7.6">6.7.6</a>) direct-declarator:
22394 <pre>
22395 identifier
22396 ( declarator )
22397 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
22398 direct-declarator [ static type-qualifier-listopt assignment-expression ]
22399 direct-declarator [ type-qualifier-list static assignment-expression ]
22400 direct-declarator [ type-qualifier-listopt * ]
22401 direct-declarator ( parameter-type-list )
22402 direct-declarator ( identifier-listopt )</pre>
22403 (<a href="#6.7.6">6.7.6</a>) pointer:
22404 <pre>
22405 * type-qualifier-listopt
22406 * type-qualifier-listopt pointer</pre>
22407 (<a href="#6.7.6">6.7.6</a>) type-qualifier-list:
22408 <pre>
22409 type-qualifier
22410 type-qualifier-list type-qualifier</pre>
22411 (<a href="#6.7.6">6.7.6</a>) parameter-type-list:
22412 <pre>
22413 parameter-list
22414 parameter-list , ...</pre>
22415 (<a href="#6.7.6">6.7.6</a>) parameter-list:
22416 <pre>
22417 parameter-declaration
22418 parameter-list , parameter-declaration</pre>
22419 (<a href="#6.7.6">6.7.6</a>) parameter-declaration:
22420 <pre>
22421 declaration-specifiers declarator
22422 declaration-specifiers abstract-declaratoropt</pre>
22423 (<a href="#6.7.6">6.7.6</a>) identifier-list:
22424 <pre>
22425 identifier
22426 identifier-list , identifier</pre>
22427 (<a href="#6.7.7">6.7.7</a>) type-name:
22428 <pre>
22429 specifier-qualifier-list abstract-declaratoropt</pre>
22430 (<a href="#6.7.7">6.7.7</a>) abstract-declarator:
22431 <!--page 485 -->
22432 <pre>
22433 pointer
22434 pointeropt direct-abstract-declarator</pre>
22435 (<a href="#6.7.7">6.7.7</a>) direct-abstract-declarator:
22436 <pre>
22437 ( abstract-declarator )
22438 direct-abstract-declaratoropt [ type-qualifier-listopt
22439 assignment-expressionopt ]
22440 direct-abstract-declaratoropt [ static type-qualifier-listopt
22441 assignment-expression ]
22442 direct-abstract-declaratoropt [ type-qualifier-list static
22443 assignment-expression ]
22444 direct-abstract-declaratoropt [ * ]
22445 direct-abstract-declaratoropt ( parameter-type-listopt )</pre>
22446 (<a href="#6.7.8">6.7.8</a>) typedef-name:
22447 <pre>
22448 identifier</pre>
22449 (<a href="#6.7.9">6.7.9</a>) initializer:
22450 <pre>
22451 assignment-expression
22452 { initializer-list }
22453 { initializer-list , }</pre>
22454 (<a href="#6.7.9">6.7.9</a>) initializer-list:
22455 <pre>
22456 designationopt initializer
22457 initializer-list , designationopt initializer</pre>
22458 (<a href="#6.7.9">6.7.9</a>) designation:
22459 <pre>
22460 designator-list =</pre>
22461 (<a href="#6.7.9">6.7.9</a>) designator-list:
22462 <pre>
22463 designator
22464 designator-list designator</pre>
22465 (<a href="#6.7.9">6.7.9</a>) designator:
22466 <pre>
22467 [ constant-expression ]
22468 . identifier</pre>
22469 (<a href="#6.7.10">6.7.10</a>) static_assert-declaration:
22470 <!--page 486 -->
22471 <pre>
22472 _Static_assert ( constant-expression , string-literal ) ;</pre>
22474 <h4><a name="A.2.3" href="#A.2.3">A.2.3 Statements</a></h4>
22475 (<a href="#6.8">6.8</a>) statement:
22476 <pre>
22477 labeled-statement
22478 compound-statement
22479 expression-statement
22480 selection-statement
22481 iteration-statement
22482 jump-statement</pre>
22483 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
22484 <pre>
22485 identifier : statement
22486 case constant-expression : statement
22487 default : statement</pre>
22488 (<a href="#6.8.2">6.8.2</a>) compound-statement:
22489 <pre>
22490 { block-item-listopt }</pre>
22491 (<a href="#6.8.2">6.8.2</a>) block-item-list:
22492 <pre>
22493 block-item
22494 block-item-list block-item</pre>
22495 (<a href="#6.8.2">6.8.2</a>) block-item:
22496 <pre>
22497 declaration
22498 statement</pre>
22499 (<a href="#6.8.3">6.8.3</a>) expression-statement:
22500 <pre>
22501 expressionopt ;</pre>
22502 (<a href="#6.8.4">6.8.4</a>) selection-statement:
22503 <pre>
22504 if ( expression ) statement
22505 if ( expression ) statement else statement
22506 switch ( expression ) statement</pre>
22507 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
22508 <pre>
22509 while ( expression ) statement
22510 do statement while ( expression ) ;
22511 for ( expressionopt ; expressionopt ; expressionopt ) statement
22512 for ( declaration expressionopt ; expressionopt ) statement</pre>
22513 (<a href="#6.8.6">6.8.6</a>) jump-statement:
22514 <!--page 487 -->
22515 <pre>
22516 goto identifier ;
22517 continue ;
22518 break ;
22519 return expressionopt ;</pre>
22521 <h4><a name="A.2.4" href="#A.2.4">A.2.4 External definitions</a></h4>
22522 (<a href="#6.9">6.9</a>) translation-unit:
22523 <pre>
22524 external-declaration
22525 translation-unit external-declaration</pre>
22526 (<a href="#6.9">6.9</a>) external-declaration:
22527 <pre>
22528 function-definition
22529 declaration</pre>
22530 (<a href="#6.9.1">6.9.1</a>) function-definition:
22531 <pre>
22532 declaration-specifiers declarator declaration-listopt compound-statement</pre>
22533 (<a href="#6.9.1">6.9.1</a>) declaration-list:
22534 <pre>
22535 declaration
22536 declaration-list declaration</pre>
22538 <h3><a name="A.3" href="#A.3">A.3 Preprocessing directives</a></h3>
22539 (<a href="#6.10">6.10</a>) preprocessing-file:
22540 <pre>
22541 groupopt</pre>
22542 (<a href="#6.10">6.10</a>) group:
22543 <pre>
22544 group-part
22545 group group-part</pre>
22546 (<a href="#6.10">6.10</a>) group-part:
22547 <pre>
22548 if-section
22549 control-line
22550 text-line
22551 # non-directive</pre>
22552 (<a href="#6.10">6.10</a>) if-section:
22553 <pre>
22554 if-group elif-groupsopt else-groupopt endif-line</pre>
22555 (<a href="#6.10">6.10</a>) if-group:
22556 <pre>
22557 # if constant-expression new-line groupopt
22558 # ifdef identifier new-line groupopt
22559 # ifndef identifier new-line groupopt</pre>
22560 (<a href="#6.10">6.10</a>) elif-groups:
22561 <pre>
22562 elif-group
22563 elif-groups elif-group</pre>
22564 (<a href="#6.10">6.10</a>) elif-group:
22565 <!--page 488 -->
22566 <pre>
22567 # elif constant-expression new-line groupopt</pre>
22568 (<a href="#6.10">6.10</a>) else-group:
22569 <pre>
22570 # else new-line groupopt</pre>
22571 (<a href="#6.10">6.10</a>) endif-line:
22572 <pre>
22573 # endif new-line</pre>
22574 (<a href="#6.10">6.10</a>) control-line:
22575 <pre>
22576 # include pp-tokens new-line
22577 # define identifier replacement-list new-line
22578 # define identifier lparen identifier-listopt )
22579 replacement-list new-line
22580 # define identifier lparen ... ) replacement-list new-line
22581 # define identifier lparen identifier-list , ... )
22582 replacement-list new-line
22583 # undef identifier new-line
22584 # line pp-tokens new-line
22585 # error pp-tokensopt new-line
22586 # pragma pp-tokensopt new-line
22587 # new-line</pre>
22588 (<a href="#6.10">6.10</a>) text-line:
22589 <pre>
22590 pp-tokensopt new-line</pre>
22591 (<a href="#6.10">6.10</a>) non-directive:
22592 <pre>
22593 pp-tokens new-line</pre>
22594 (<a href="#6.10">6.10</a>) lparen:
22595 <pre>
22596 a ( character not immediately preceded by white-space</pre>
22597 (<a href="#6.10">6.10</a>) replacement-list:
22598 <pre>
22599 pp-tokensopt</pre>
22600 (<a href="#6.10">6.10</a>) pp-tokens:
22601 <pre>
22602 preprocessing-token
22603 pp-tokens preprocessing-token</pre>
22604 (<a href="#6.10">6.10</a>) new-line:
22605 <!--page 489 -->
22606 <pre>
22607 the new-line character</pre>
22609 <h2><a name="B" href="#B">Annex B</a></h2>
22610 <pre>
22611 (informative)
22612 Library summary</pre>
22614 <h3><a name="B.1" href="#B.1">B.1 Diagnostics <assert.h></a></h3>
22615 <pre>
22616 NDEBUG
22617 static_assert
22618 void assert(scalar expression);</pre>
22620 <h3><a name="B.2" href="#B.2">B.2 Complex <complex.h></a></h3>
22621 <!--page 490 -->
22622 <!--page 491 -->
22623 <pre>
22624 __STDC_NO_COMPLEX__ imaginary
22625 complex _Imaginary_I
22626 _Complex_I I
22627 #pragma STDC CX_LIMITED_RANGE on-off-switch
22628 double complex cacos(double complex z);
22629 float complex cacosf(float complex z);
22630 long double complex cacosl(long double complex z);
22631 double complex casin(double complex z);
22632 float complex casinf(float complex z);
22633 long double complex casinl(long double complex z);
22634 double complex catan(double complex z);
22635 float complex catanf(float complex z);
22636 long double complex catanl(long double complex z);
22637 double complex ccos(double complex z);
22638 float complex ccosf(float complex z);
22639 long double complex ccosl(long double complex z);
22640 double complex csin(double complex z);
22641 float complex csinf(float complex z);
22642 long double complex csinl(long double complex z);
22643 double complex ctan(double complex z);
22644 float complex ctanf(float complex z);
22645 long double complex ctanl(long double complex z);
22646 double complex cacosh(double complex z);
22647 float complex cacoshf(float complex z);
22648 long double complex cacoshl(long double complex z);
22649 double complex casinh(double complex z);
22650 float complex casinhf(float complex z);
22651 long double complex casinhl(long double complex z);
22652 double complex catanh(double complex z);
22653 float complex catanhf(float complex z);
22654 long double complex catanhl(long double complex z);
22655 double complex ccosh(double complex z);
22656 float complex ccoshf(float complex z);
22657 long double complex ccoshl(long double complex z);
22658 double complex csinh(double complex z);
22659 float complex csinhf(float complex z);
22660 long double complex csinhl(long double complex z);
22661 double complex ctanh(double complex z);
22662 float complex ctanhf(float complex z);
22663 long double complex ctanhl(long double complex z);
22664 double complex cexp(double complex z);
22665 float complex cexpf(float complex z);
22666 long double complex cexpl(long double complex z);
22667 double complex clog(double complex z);
22668 float complex clogf(float complex z);
22669 long double complex clogl(long double complex z);
22670 double cabs(double complex z);
22671 float cabsf(float complex z);
22672 long double cabsl(long double complex z);
22673 double complex cpow(double complex x, double complex y);
22674 float complex cpowf(float complex x, float complex y);
22675 long double complex cpowl(long double complex x,
22676 long double complex y);
22677 double complex csqrt(double complex z);
22678 float complex csqrtf(float complex z);
22679 long double complex csqrtl(long double complex z);
22680 double carg(double complex z);
22681 float cargf(float complex z);
22682 long double cargl(long double complex z);
22683 double cimag(double complex z);
22684 float cimagf(float complex z);
22685 long double cimagl(long double complex z);
22686 double complex CMPLX(double x, double y);
22687 float complex CMPLXF(float x, float y);
22688 long double complex CMPLXL(long double x, long double y);
22689 double complex conj(double complex z);
22690 float complex conjf(float complex z);
22691 long double complex conjl(long double complex z);
22692 double complex cproj(double complex z);
22693 float complex cprojf(float complex z);
22694 long double complex cprojl(long double complex z);
22695 double creal(double complex z);
22696 float crealf(float complex z);
22697 long double creall(long double complex z);</pre>
22699 <h3><a name="B.3" href="#B.3">B.3 Character handling <ctype.h></a></h3>
22700 <pre>
22701 int isalnum(int c);
22702 int isalpha(int c);
22703 int isblank(int c);
22704 int iscntrl(int c);
22705 int isdigit(int c);
22706 int isgraph(int c);
22707 int islower(int c);
22708 int isprint(int c);
22709 int ispunct(int c);
22710 int isspace(int c);
22711 int isupper(int c);
22712 int isxdigit(int c);
22713 int tolower(int c);
22714 int toupper(int c);</pre>
22716 <h3><a name="B.4" href="#B.4">B.4 Errors <errno.h></a></h3>
22717 <pre>
22718 EDOM EILSEQ ERANGE errno
22719 __STDC_WANT_LIB_EXT1__
22720 errno_t</pre>
22722 <h3><a name="B.5" href="#B.5">B.5 Floating-point environment <fenv.h></a></h3>
22723 <!--page 492 -->
22724 <pre>
22725 fenv_t FE_OVERFLOW FE_TOWARDZERO
22726 fexcept_t FE_UNDERFLOW FE_UPWARD
22727 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
22728 FE_INEXACT FE_DOWNWARD
22729 FE_INVALID FE_TONEAREST
22730 #pragma STDC FENV_ACCESS on-off-switch
22731 int feclearexcept(int excepts);
22732 int fegetexceptflag(fexcept_t *flagp, int excepts);
22733 int feraiseexcept(int excepts);
22734 int fesetexceptflag(const fexcept_t *flagp,
22735 int excepts);
22736 int fetestexcept(int excepts);
22737 int fegetround(void);
22738 int fesetround(int round);
22739 int fegetenv(fenv_t *envp);
22740 int feholdexcept(fenv_t *envp);
22741 int fesetenv(const fenv_t *envp);
22742 int feupdateenv(const fenv_t *envp);</pre>
22744 <h3><a name="B.6" href="#B.6">B.6 Characteristics of floating types <float.h></a></h3>
22745 <pre>
22746 FLT_ROUNDS DBL_DIG FLT_MAX
22747 FLT_EVAL_METHOD LDBL_DIG DBL_MAX
22748 FLT_HAS_SUBNORM FLT_MIN_EXP LDBL_MAX
22749 DBL_HAS_SUBNORM DBL_MIN_EXP FLT_EPSILON
22750 LDBL_HAS_SUBNORM LDBL_MIN_EXP DBL_EPSILON
22751 FLT_RADIX FLT_MIN_10_EXP LDBL_EPSILON
22752 FLT_MANT_DIG DBL_MIN_10_EXP FLT_MIN
22753 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_MIN
22754 LDBL_MANT_DIG FLT_MAX_EXP LDBL_MIN
22755 FLT_DECIMAL_DIG DBL_MAX_EXP FLT_TRUE_MIN
22756 DBL_DECIMAL_DIG LDBL_MAX_EXP DBL_TRUE_MIN
22757 LDBL_DECIMAL_DIG FLT_MAX_10_EXP LDBL_TRUE_MIN
22758 DECIMAL_DIG DBL_MAX_10_EXP
22759 FLT_DIG LDBL_MAX_10_EXP</pre>
22761 <h3><a name="B.7" href="#B.7">B.7 Format conversion of integer types <inttypes.h></a></h3>
22762 <!--page 493 -->
22763 <pre>
22764 imaxdiv_t
22765 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
22766 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
22767 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
22768 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
22769 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
22770 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
22771 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
22772 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
22773 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
22774 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
22775 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
22776 intmax_t imaxabs(intmax_t j);
22777 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
22778 intmax_t strtoimax(const char * restrict nptr,
22779 char ** restrict endptr, int base);
22780 uintmax_t strtoumax(const char * restrict nptr,
22781 char ** restrict endptr, int base);
22782 intmax_t wcstoimax(const wchar_t * restrict nptr,
22783 wchar_t ** restrict endptr, int base);
22784 uintmax_t wcstoumax(const wchar_t * restrict nptr,
22785 wchar_t ** restrict endptr, int base);</pre>
22787 <h3><a name="B.8" href="#B.8">B.8 Alternative spellings <iso646.h></a></h3>
22788 <pre>
22789 and bitor not_eq xor
22790 and_eq compl or xor_eq
22791 bitand not or_eq</pre>
22793 <h3><a name="B.9" href="#B.9">B.9 Sizes of integer types <limits.h></a></h3>
22794 <pre>
22795 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
22796 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
22797 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
22798 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
22799 CHAR_MIN USHRT_MAX LONG_MAX</pre>
22801 <h3><a name="B.10" href="#B.10">B.10 Localization <locale.h></a></h3>
22802 <pre>
22803 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
22804 NULL LC_COLLATE LC_MONETARY LC_TIME
22805 char *setlocale(int category, const char *locale);
22806 struct lconv *localeconv(void);</pre>
22808 <h3><a name="B.11" href="#B.11">B.11 Mathematics <math.h></a></h3>
22809 <!--page 494 -->
22810 <!--page 495 -->
22811 <!--page 496 -->
22812 <!--page 497 -->
22813 <!--page 498 -->
22814 <pre>
22815 float_t FP_INFINITE FP_FAST_FMAL
22816 double_t FP_NAN FP_ILOGB0
22817 HUGE_VAL FP_NORMAL FP_ILOGBNAN
22818 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
22819 HUGE_VALL FP_ZERO MATH_ERREXCEPT
22820 INFINITY FP_FAST_FMA math_errhandling
22821 NAN FP_FAST_FMAF
22822 #pragma STDC FP_CONTRACT on-off-switch
22823 int fpclassify(real-floating x);
22824 int isfinite(real-floating x);
22825 int isinf(real-floating x);
22826 int isnan(real-floating x);
22827 int isnormal(real-floating x);
22828 int signbit(real-floating x);
22829 double acos(double x);
22830 float acosf(float x);
22831 long double acosl(long double x);
22832 double asin(double x);
22833 float asinf(float x);
22834 long double asinl(long double x);
22835 double atan(double x);
22836 float atanf(float x);
22837 long double atanl(long double x);
22838 double atan2(double y, double x);
22839 float atan2f(float y, float x);
22840 long double atan2l(long double y, long double x);
22841 double cos(double x);
22842 float cosf(float x);
22843 long double cosl(long double x);
22844 double sin(double x);
22845 float sinf(float x);
22846 long double sinl(long double x);
22847 double tan(double x);
22848 float tanf(float x);
22849 long double tanl(long double x);
22850 double acosh(double x);
22851 float acoshf(float x);
22852 long double acoshl(long double x);
22853 double asinh(double x);
22854 float asinhf(float x);
22855 long double asinhl(long double x);
22856 double atanh(double x);
22857 float atanhf(float x);
22858 long double atanhl(long double x);
22859 double cosh(double x);
22860 float coshf(float x);
22861 long double coshl(long double x);
22862 double sinh(double x);
22863 float sinhf(float x);
22864 long double sinhl(long double x);
22865 double tanh(double x);
22866 float tanhf(float x);
22867 long double tanhl(long double x);
22868 double exp(double x);
22869 float expf(float x);
22870 long double expl(long double x);
22871 double exp2(double x);
22872 float exp2f(float x);
22873 long double exp2l(long double x);
22874 double expm1(double x);
22875 float expm1f(float x);
22876 long double expm1l(long double x);
22877 double frexp(double value, int *exp);
22878 float frexpf(float value, int *exp);
22879 long double frexpl(long double value, int *exp);
22880 int ilogb(double x);
22881 int ilogbf(float x);
22882 int ilogbl(long double x);
22883 double ldexp(double x, int exp);
22884 float ldexpf(float x, int exp);
22885 long double ldexpl(long double x, int exp);
22886 double log(double x);
22887 float logf(float x);
22888 long double logl(long double x);
22889 double log10(double x);
22890 float log10f(float x);
22891 long double log10l(long double x);
22892 double log1p(double x);
22893 float log1pf(float x);
22894 long double log1pl(long double x);
22895 double log2(double x);
22896 float log2f(float x);
22897 long double log2l(long double x);
22898 double logb(double x);
22899 float logbf(float x);
22900 long double logbl(long double x);
22901 double modf(double value, double *iptr);
22902 float modff(float value, float *iptr);
22903 long double modfl(long double value, long double *iptr);
22904 double scalbn(double x, int n);
22905 float scalbnf(float x, int n);
22906 long double scalbnl(long double x, int n);
22907 double scalbln(double x, long int n);
22908 float scalblnf(float x, long int n);
22909 long double scalblnl(long double x, long int n);
22910 double cbrt(double x);
22911 float cbrtf(float x);
22912 long double cbrtl(long double x);
22913 double fabs(double x);
22914 float fabsf(float x);
22915 long double fabsl(long double x);
22916 double hypot(double x, double y);
22917 float hypotf(float x, float y);
22918 long double hypotl(long double x, long double y);
22919 double pow(double x, double y);
22920 float powf(float x, float y);
22921 long double powl(long double x, long double y);
22922 double sqrt(double x);
22923 float sqrtf(float x);
22924 long double sqrtl(long double x);
22925 double erf(double x);
22926 float erff(float x);
22927 long double erfl(long double x);
22928 double erfc(double x);
22929 float erfcf(float x);
22930 long double erfcl(long double x);
22931 double lgamma(double x);
22932 float lgammaf(float x);
22933 long double lgammal(long double x);
22934 double tgamma(double x);
22935 float tgammaf(float x);
22936 long double tgammal(long double x);
22937 double ceil(double x);
22938 float ceilf(float x);
22939 long double ceill(long double x);
22940 double floor(double x);
22941 float floorf(float x);
22942 long double floorl(long double x);
22943 double nearbyint(double x);
22944 float nearbyintf(float x);
22945 long double nearbyintl(long double x);
22946 double rint(double x);
22947 float rintf(float x);
22948 long double rintl(long double x);
22949 long int lrint(double x);
22950 long int lrintf(float x);
22951 long int lrintl(long double x);
22952 long long int llrint(double x);
22953 long long int llrintf(float x);
22954 long long int llrintl(long double x);
22955 double round(double x);
22956 float roundf(float x);
22957 long double roundl(long double x);
22958 long int lround(double x);
22959 long int lroundf(float x);
22960 long int lroundl(long double x);
22961 long long int llround(double x);
22962 long long int llroundf(float x);
22963 long long int llroundl(long double x);
22964 double trunc(double x);
22965 float truncf(float x);
22966 long double truncl(long double x);
22967 double fmod(double x, double y);
22968 float fmodf(float x, float y);
22969 long double fmodl(long double x, long double y);
22970 double remainder(double x, double y);
22971 float remainderf(float x, float y);
22972 long double remainderl(long double x, long double y);
22973 double remquo(double x, double y, int *quo);
22974 float remquof(float x, float y, int *quo);
22975 long double remquol(long double x, long double y,
22976 int *quo);
22977 double copysign(double x, double y);
22978 float copysignf(float x, float y);
22979 long double copysignl(long double x, long double y);
22980 double nan(const char *tagp);
22981 float nanf(const char *tagp);
22982 long double nanl(const char *tagp);
22983 double nextafter(double x, double y);
22984 float nextafterf(float x, float y);
22985 long double nextafterl(long double x, long double y);
22986 double nexttoward(double x, long double y);
22987 float nexttowardf(float x, long double y);
22988 long double nexttowardl(long double x, long double y);
22989 double fdim(double x, double y);
22990 float fdimf(float x, float y);
22991 long double fdiml(long double x, long double y);
22992 double fmax(double x, double y);
22993 float fmaxf(float x, float y);
22994 long double fmaxl(long double x, long double y);
22995 double fmin(double x, double y);
22996 float fminf(float x, float y);
22997 long double fminl(long double x, long double y);
22998 double fma(double x, double y, double z);
22999 float fmaf(float x, float y, float z);
23000 long double fmal(long double x, long double y,
23001 long double z);
23002 int isgreater(real-floating x, real-floating y);
23003 int isgreaterequal(real-floating x, real-floating y);
23004 int isless(real-floating x, real-floating y);
23005 int islessequal(real-floating x, real-floating y);
23006 int islessgreater(real-floating x, real-floating y);
23007 int isunordered(real-floating x, real-floating y);</pre>
23009 <h3><a name="B.12" href="#B.12">B.12 Nonlocal jumps <setjmp.h></a></h3>
23010 <pre>
23011 jmp_buf
23012 int setjmp(jmp_buf env);
23013 _Noreturn void longjmp(jmp_buf env, int val);</pre>
23015 <h3><a name="B.13" href="#B.13">B.13 Signal handling <signal.h></a></h3>
23016 <!--page 499 -->
23017 <pre>
23018 sig_atomic_t SIG_IGN SIGILL SIGTERM
23019 SIG_DFL SIGABRT SIGINT
23020 SIG_ERR SIGFPE SIGSEGV
23021 void (*signal(int sig, void (*func)(int)))(int);
23022 int raise(int sig);</pre>
23024 <h3><a name="B.14" href="#B.14">B.14 Alignment <stdalign.h></a></h3>
23025 <pre>
23026 alignas
23027 __alignas_is_defined</pre>
23029 <h3><a name="B.15" href="#B.15">B.15 Variable arguments <stdarg.h></a></h3>
23030 <pre>
23031 va_list
23032 type va_arg(va_list ap, type);
23033 void va_copy(va_list dest, va_list src);
23034 void va_end(va_list ap);
23035 void va_start(va_list ap, parmN);</pre>
23037 <h3><a name="B.16" href="#B.16">B.16 Atomics <stdatomic.h></a></h3>
23038 <!--page 500 -->
23039 <!--page 501 -->
23040 <pre>
23041 ATOMIC_CHAR_LOCK_FREE atomic_uint
23042 ATOMIC_CHAR16_T_LOCK_FREE atomic_long
23043 ATOMIC_CHAR32_T_LOCK_FREE atomic_ulong
23044 ATOMIC_WCHAR_T_LOCK_FREE atomic_llong
23045 ATOMIC_SHORT_LOCK_FREE atomic_ullong
23046 ATOMIC_INT_LOCK_FREE atomic_char16_t
23047 ATOMIC_LONG_LOCK_FREE atomic_char32_t
23048 ATOMIC_LLONG_LOCK_FREE atomic_wchar_t
23049 ATOMIC_ADDRESS_LOCK_FREE atomic_int_least8_t
23050 ATOMIC_FLAG_INIT atomic_uint_least8_t
23051 memory_order atomic_int_least16_t
23052 atomic_flag atomic_uint_least16_t
23053 atomic_bool atomic_int_least32_t
23054 atomic_address atomic_uint_least32_t
23055 memory_order_relaxed atomic_int_least64_t
23056 memory_order_consume atomic_uint_least64_t
23057 memory_order_acquire atomic_int_fast8_t
23058 memory_order_release atomic_uint_fast8_t
23059 memory_order_acq_rel atomic_int_fast16_t
23060 memory_order_seq_cst atomic_uint_fast16_t
23061 atomic_char atomic_int_fast32_t
23062 atomic_schar atomic_uint_fast32_t
23063 atomic_uchar atomic_int_fast64_t
23064 atomic_short atomic_uint_fast64_t
23065 atomic_ushort atomic_intptr_t
23066 atomic_int atomic_uintptr_t
23067 atomic_size_t atomic_intmax_t
23068 atomic_ptrdiff_t atomic_uintmax_t
23069 #define ATOMIC_VAR_INIT(C value)
23070 void atomic_init(volatile A *obj, C value);
23071 type kill_dependency(type y);
23072 void atomic_thread_fence(memory_order order);
23073 void atomic_signal_fence(memory_order order);
23074 _Bool atomic_is_lock_free(atomic_type const volatile *obj);
23075 void atomic_store(volatile A *object, C desired);
23076 void atomic_store_explicit(volatile A *object,
23077 C desired, memory_order order);
23078 C atomic_load(volatile A *object);
23079 C atomic_load_explicit(volatile A *object,
23080 memory_order order);
23081 C atomic_exchange(volatile A *object, C desired);
23082 C atomic_exchange_explicit(volatile A *object,
23083 C desired, memory_order order);
23084 _Bool atomic_compare_exchange_strong(volatile A *object,
23085 C *expected, C desired);
23086 _Bool atomic_compare_exchange_strong_explicit(
23087 volatile A *object, C *expected, C desired,
23088 memory_order success, memory_order failure);
23089 _Bool atomic_compare_exchange_weak(volatile A *object,
23090 C *expected, C desired);
23091 _Bool atomic_compare_exchange_weak_explicit(
23092 volatile A *object, C *expected, C desired,
23093 memory_order success, memory_order failure);
23094 C atomic_fetch_key(volatile A *object, M operand);
23095 C atomic_fetch_key_explicit(volatile A *object,
23096 M operand, memory_order order);
23097 bool atomic_flag_test_and_set(
23098 volatile atomic_flag *object);
23099 bool atomic_flag_test_and_set_explicit(
23100 volatile atomic_flag *object, memory_order order);
23101 void atomic_flag_clear(volatile atomic_flag *object);
23102 void atomic_flag_clear_explicit(
23103 volatile atomic_flag *object, memory_order order);</pre>
23105 <h3><a name="B.17" href="#B.17">B.17 Boolean type and values <stdbool.h></a></h3>
23106 <pre>
23107 bool
23108 true
23109 false
23110 __bool_true_false_are_defined</pre>
23112 <h3><a name="B.18" href="#B.18">B.18 Common definitions <stddef.h></a></h3>
23113 <pre>
23114 ptrdiff_t max_align_t NULL
23115 size_t wchar_t
23116 offsetof(type, member-designator)
23117 __STDC_WANT_LIB_EXT1__
23118 rsize_t</pre>
23120 <h3><a name="B.19" href="#B.19">B.19 Integer types <stdint.h></a></h3>
23121 <!--page 502 -->
23122 <pre>
23123 intN_t INT_LEASTN_MIN PTRDIFF_MAX
23124 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
23125 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
23126 uint_leastN_t INT_FASTN_MIN SIZE_MAX
23127 int_fastN_t INT_FASTN_MAX WCHAR_MIN
23128 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
23129 intptr_t INTPTR_MIN WINT_MIN
23130 uintptr_t INTPTR_MAX WINT_MAX
23131 intmax_t UINTPTR_MAX INTN_C(value)
23132 uintmax_t INTMAX_MIN UINTN_C(value)
23133 INTN_MIN INTMAX_MAX INTMAX_C(value)
23134 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
23135 UINTN_MAX PTRDIFF_MIN
23136 __STDC_WANT_LIB_EXT1__
23137 RSIZE_MAX</pre>
23139 <h3><a name="B.20" href="#B.20">B.20 Input/output <stdio.h></a></h3>
23140 <!--page 503 -->
23141 <!--page 504 -->
23142 <!--page 505 -->
23143 <pre>
23144 size_t _IOLBF FILENAME_MAX TMP_MAX
23145 FILE _IONBF L_tmpnam stderr
23146 fpos_t BUFSIZ SEEK_CUR stdin
23147 NULL EOF SEEK_END stdout
23148 _IOFBF FOPEN_MAX SEEK_SET
23149 int remove(const char *filename);
23150 int rename(const char *old, const char *new);
23151 FILE *tmpfile(void);
23152 char *tmpnam(char *s);
23153 int fclose(FILE *stream);
23154 int fflush(FILE *stream);
23155 FILE *fopen(const char * restrict filename,
23156 const char * restrict mode);
23157 FILE *freopen(const char * restrict filename,
23158 const char * restrict mode,
23159 FILE * restrict stream);
23160 void setbuf(FILE * restrict stream,
23161 char * restrict buf);
23162 int setvbuf(FILE * restrict stream,
23163 char * restrict buf,
23164 int mode, size_t size);
23165 int fprintf(FILE * restrict stream,
23166 const char * restrict format, ...);
23167 int fscanf(FILE * restrict stream,
23168 const char * restrict format, ...);
23169 int printf(const char * restrict format, ...);
23170 int scanf(const char * restrict format, ...);
23171 int snprintf(char * restrict s, size_t n,
23172 const char * restrict format, ...);
23173 int sprintf(char * restrict s,
23174 const char * restrict format, ...);
23175 int sscanf(const char * restrict s,
23176 const char * restrict format, ...);
23177 int vfprintf(FILE * restrict stream,
23178 const char * restrict format, va_list arg);
23179 int vfscanf(FILE * restrict stream,
23180 const char * restrict format, va_list arg);
23181 int vprintf(const char * restrict format, va_list arg);
23182 int vscanf(const char * restrict format, va_list arg);
23183 int vsnprintf(char * restrict s, size_t n,
23184 const char * restrict format, va_list arg);
23185 int vsprintf(char * restrict s,
23186 const char * restrict format, va_list arg);
23187 int vsscanf(const char * restrict s,
23188 const char * restrict format, va_list arg);
23189 int fgetc(FILE *stream);
23190 char *fgets(char * restrict s, int n,
23191 FILE * restrict stream);
23192 int fputc(int c, FILE *stream);
23193 int fputs(const char * restrict s,
23194 FILE * restrict stream);
23195 int getc(FILE *stream);
23196 int getchar(void);
23197 int putc(int c, FILE *stream); *
23198 int putchar(int c);
23199 int puts(const char *s);
23200 int ungetc(int c, FILE *stream);
23201 size_t fread(void * restrict ptr,
23202 size_t size, size_t nmemb,
23203 FILE * restrict stream);
23204 size_t fwrite(const void * restrict ptr,
23205 size_t size, size_t nmemb,
23206 FILE * restrict stream);
23207 int fgetpos(FILE * restrict stream,
23208 fpos_t * restrict pos);
23209 int fseek(FILE *stream, long int offset, int whence);
23210 int fsetpos(FILE *stream, const fpos_t *pos);
23211 long int ftell(FILE *stream);
23212 void rewind(FILE *stream);
23213 void clearerr(FILE *stream);
23214 int feof(FILE *stream);
23215 int ferror(FILE *stream);
23216 void perror(const char *s);
23217 __STDC_WANT_LIB_EXT1__
23218 L_tmpnam_s TMP_MAX_S errno_t rsize_t
23219 errno_t tmpfile_s(FILE * restrict * restrict streamptr);
23220 errno_t tmpnam_s(char *s, rsize_t maxsize);
23221 errno_t fopen_s(FILE * restrict * restrict streamptr,
23222 const char * restrict filename,
23223 const char * restrict mode);
23224 errno_t freopen_s(FILE * restrict * restrict newstreamptr,
23225 const char * restrict filename,
23226 const char * restrict mode,
23227 FILE * restrict stream);
23228 int fprintf_s(FILE * restrict stream,
23229 const char * restrict format, ...);
23230 int fscanf_s(FILE * restrict stream,
23231 const char * restrict format, ...);
23232 int printf_s(const char * restrict format, ...);
23233 int scanf_s(const char * restrict format, ...);
23234 int snprintf_s(char * restrict s, rsize_t n,
23235 const char * restrict format, ...);
23236 int sprintf_s(char * restrict s, rsize_t n,
23237 const char * restrict format, ...);
23238 int sscanf_s(const char * restrict s,
23239 const char * restrict format, ...);
23240 int vfprintf_s(FILE * restrict stream,
23241 const char * restrict format,
23242 va_list arg);
23243 int vfscanf_s(FILE * restrict stream,
23244 const char * restrict format,
23245 va_list arg);
23246 int vprintf_s(const char * restrict format,
23247 va_list arg);
23248 int vscanf_s(const char * restrict format,
23249 va_list arg);
23250 int vsnprintf_s(char * restrict s, rsize_t n,
23251 const char * restrict format,
23252 va_list arg);
23253 int vsprintf_s(char * restrict s, rsize_t n,
23254 const char * restrict format,
23255 va_list arg);
23256 int vsscanf_s(const char * restrict s,
23257 const char * restrict format,
23258 va_list arg);
23259 char *gets_s(char *s, rsize_t n);</pre>
23261 <h3><a name="B.21" href="#B.21">B.21 General utilities <stdlib.h></a></h3>
23262 <!--page 506 -->
23263 <!--page 507 -->
23264 <pre>
23265 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
23266 wchar_t lldiv_t EXIT_SUCCESS
23267 div_t NULL RAND_MAX
23268 double atof(const char *nptr);
23269 int atoi(const char *nptr);
23270 long int atol(const char *nptr);
23271 long long int atoll(const char *nptr);
23272 double strtod(const char * restrict nptr,
23273 char ** restrict endptr);
23274 float strtof(const char * restrict nptr,
23275 char ** restrict endptr);
23276 long double strtold(const char * restrict nptr,
23277 char ** restrict endptr);
23278 long int strtol(const char * restrict nptr,
23279 char ** restrict endptr, int base);
23280 long long int strtoll(const char * restrict nptr,
23281 char ** restrict endptr, int base);
23282 unsigned long int strtoul(
23283 const char * restrict nptr,
23284 char ** restrict endptr, int base);
23285 unsigned long long int strtoull(
23286 const char * restrict nptr,
23287 char ** restrict endptr, int base);
23288 int rand(void);
23289 void srand(unsigned int seed);
23290 void *aligned_alloc(size_t alignment, size_t size);
23291 void *calloc(size_t nmemb, size_t size);
23292 void free(void *ptr);
23293 void *malloc(size_t size);
23294 void *realloc(void *ptr, size_t size);
23295 _Noreturn void abort(void);
23296 int atexit(void (*func)(void));
23297 int at_quick_exit(void (*func)(void));
23298 _Noreturn void exit(int status);
23299 _Noreturn void _Exit(int status);
23300 char *getenv(const char *name);
23301 _Noreturn void quick_exit(int status);
23302 int system(const char *string);
23303 void *bsearch(const void *key, const void *base,
23304 size_t nmemb, size_t size,
23305 int (*compar)(const void *, const void *));
23306 void qsort(void *base, size_t nmemb, size_t size,
23307 int (*compar)(const void *, const void *));
23308 int abs(int j);
23309 long int labs(long int j);
23310 long long int llabs(long long int j);
23311 div_t div(int numer, int denom);
23312 ldiv_t ldiv(long int numer, long int denom);
23313 lldiv_t lldiv(long long int numer,
23314 long long int denom);
23315 int mblen(const char *s, size_t n);
23316 int mbtowc(wchar_t * restrict pwc,
23317 const char * restrict s, size_t n);
23318 int wctomb(char *s, wchar_t wchar);
23319 size_t mbstowcs(wchar_t * restrict pwcs,
23320 const char * restrict s, size_t n);
23321 size_t wcstombs(char * restrict s,
23322 const wchar_t * restrict pwcs, size_t n);
23323 __STDC_WANT_LIB_EXT1__
23324 errno_t
23325 rsize_t
23326 constraint_handler_t
23327 constraint_handler_t set_constraint_handler_s(
23328 constraint_handler_t handler);
23329 void abort_handler_s(
23330 const char * restrict msg,
23331 void * restrict ptr,
23332 errno_t error);
23333 void ignore_handler_s(
23334 const char * restrict msg,
23335 void * restrict ptr,
23336 errno_t error);
23337 errno_t getenv_s(size_t * restrict len,
23338 char * restrict value, rsize_t maxsize,
23339 const char * restrict name);
23340 void *bsearch_s(const void *key, const void *base,
23341 rsize_t nmemb, rsize_t size,
23342 int (*compar)(const void *k, const void *y,
23343 void *context),
23344 void *context);
23345 errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
23346 int (*compar)(const void *x, const void *y,
23347 void *context),
23348 void *context);
23349 errno_t wctomb_s(int * restrict status,
23350 char * restrict s,
23351 rsize_t smax,
23352 wchar_t wc);
23353 errno_t mbstowcs_s(size_t * restrict retval,
23354 wchar_t * restrict dst, rsize_t dstmax,
23355 const char * restrict src, rsize_t len);
23356 errno_t wcstombs_s(size_t * restrict retval,
23357 char * restrict dst, rsize_t dstmax,
23358 const wchar_t * restrict src, rsize_t len);</pre>
23360 <h3><a name="B.22" href="#B.22">B.22 String handling <string.h></a></h3>
23361 <!--page 508 -->
23362 <!--page 509 -->
23363 <pre>
23364 size_t
23365 NULL
23366 void *memcpy(void * restrict s1,
23367 const void * restrict s2, size_t n);
23368 void *memmove(void *s1, const void *s2, size_t n);
23369 char *strcpy(char * restrict s1,
23370 const char * restrict s2);
23371 char *strncpy(char * restrict s1,
23372 const char * restrict s2, size_t n);
23373 char *strcat(char * restrict s1,
23374 const char * restrict s2);
23375 char *strncat(char * restrict s1,
23376 const char * restrict s2, size_t n);
23377 int memcmp(const void *s1, const void *s2, size_t n);
23378 int strcmp(const char *s1, const char *s2);
23379 int strcoll(const char *s1, const char *s2);
23380 int strncmp(const char *s1, const char *s2, size_t n);
23381 size_t strxfrm(char * restrict s1,
23382 const char * restrict s2, size_t n);
23383 void *memchr(const void *s, int c, size_t n);
23384 char *strchr(const char *s, int c);
23385 size_t strcspn(const char *s1, const char *s2);
23386 char *strpbrk(const char *s1, const char *s2);
23387 char *strrchr(const char *s, int c);
23388 size_t strspn(const char *s1, const char *s2);
23389 char *strstr(const char *s1, const char *s2);
23390 char *strtok(char * restrict s1,
23391 const char * restrict s2);
23392 void *memset(void *s, int c, size_t n);
23393 char *strerror(int errnum);
23394 size_t strlen(const char *s);
23395 __STDC_WANT_LIB_EXT1__
23396 errno_t
23397 rsize_t
23398 errno_t memcpy_s(void * restrict s1, rsize_t s1max,
23399 const void * restrict s2, rsize_t n);
23400 errno_t memmove_s(void *s1, rsize_t s1max,
23401 const void *s2, rsize_t n);
23402 errno_t strcpy_s(char * restrict s1,
23403 rsize_t s1max,
23404 const char * restrict s2);
23405 errno_t strncpy_s(char * restrict s1,
23406 rsize_t s1max,
23407 const char * restrict s2,
23408 rsize_t n);
23409 errno_t strcat_s(char * restrict s1,
23410 rsize_t s1max,
23411 const char * restrict s2);
23412 errno_t strncat_s(char * restrict s1,
23413 rsize_t s1max,
23414 const char * restrict s2,
23415 rsize_t n);
23416 char *strtok_s(char * restrict s1,
23417 rsize_t * restrict s1max,
23418 const char * restrict s2,
23419 char ** restrict ptr);
23420 errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
23421 errno_t strerror_s(char *s, rsize_t maxsize,
23422 errno_t errnum);
23423 size_t strerrorlen_s(errno_t errnum);
23424 size_t strnlen_s(const char *s, size_t maxsize);</pre>
23426 <h3><a name="B.23" href="#B.23">B.23 Type-generic math <tgmath.h></a></h3>
23427 <pre>
23428 acos sqrt fmod nextafter
23429 asin fabs frexp nexttoward
23430 atan atan2 hypot remainder
23431 acosh cbrt ilogb remquo
23432 asinh ceil ldexp rint
23433 atanh copysign lgamma round
23434 cos erf llrint scalbn
23435 sin erfc llround scalbln
23436 tan exp2 log10 tgamma
23437 cosh expm1 log1p trunc
23438 sinh fdim log2 carg
23439 tanh floor logb cimag
23440 exp fma lrint conj
23441 log fmax lround cproj
23442 pow fmin nearbyint creal</pre>
23444 <h3><a name="B.24" href="#B.24">B.24 Threads <threads.h></a></h3>
23445 <!--page 510 -->
23446 <pre>
23447 ONCE_FLAG_INIT mtx_plain
23448 TSS_DTOR_ITERATIONS mtx_recursive
23449 cnd_t mtx_timed
23450 thrd_t mtx_try
23451 tss_t thrd_timeout
23452 mtx_t thrd_success
23453 tss_dtor_t thrd_busy
23454 thrd_start_t thrd_error
23455 once_flag thrd_nomem
23456 xtime
23457 void call_once(once_flag *flag, void (*func)(void));
23458 int cnd_broadcast(cnd_t *cond);
23459 void cnd_destroy(cnd_t *cond);
23460 int cnd_init(cnd_t *cond);
23461 int cnd_signal(cnd_t *cond);
23462 int cnd_timedwait(cnd_t *cond, mtx_t *mtx,
23463 const xtime *xt);
23464 int cnd_wait(cnd_t *cond, mtx_t *mtx);
23465 void mtx_destroy(mtx_t *mtx);
23466 int mtx_init(mtx_t *mtx, int type);
23467 int mtx_lock(mtx_t *mtx);
23468 int mtx_timedlock(mtx_t *mtx, const xtime *xt);
23469 int mtx_trylock(mtx_t *mtx);
23470 int mtx_unlock(mtx_t *mtx);
23471 int thrd_create(thrd_t *thr, thrd_start_t func,
23472 void *arg);
23473 thrd_t thrd_current(void);
23474 int thrd_detach(thrd_t thr);
23475 int thrd_equal(thrd_t thr0, thrd_t thr1);
23476 void thrd_exit(int res);
23477 int thrd_join(thrd_t thr, int *res);
23478 void thrd_sleep(const xtime *xt);
23479 void thrd_yield(void);
23480 int tss_create(tss_t *key, tss_dtor_t dtor);
23481 void tss_delete(tss_t key);
23482 void *tss_get(tss_t key);
23483 int tss_set(tss_t key, void *val);
23484 int xtime_get(xtime *xt, int base);</pre>
23486 <h3><a name="B.25" href="#B.25">B.25 Date and time <time.h></a></h3>
23487 <!--page 511 -->
23488 <pre>
23489 NULL size_t time_t
23490 CLOCKS_PER_SEC clock_t struct tm
23491 clock_t clock(void);
23492 double difftime(time_t time1, time_t time0);
23493 time_t mktime(struct tm *timeptr);
23494 time_t time(time_t *timer);
23495 char *asctime(const struct tm *timeptr);
23496 char *ctime(const time_t *timer);
23497 struct tm *gmtime(const time_t *timer);
23498 struct tm *localtime(const time_t *timer);
23499 size_t strftime(char * restrict s,
23500 size_t maxsize,
23501 const char * restrict format,
23502 const struct tm * restrict timeptr);
23503 __STDC_WANT_LIB_EXT1__
23504 errno_t
23505 rsize_t
23506 errno_t asctime_s(char *s, rsize_t maxsize,
23507 const struct tm *timeptr);
23508 errno_t ctime_s(char *s, rsize_t maxsize,
23509 const time_t *timer);
23510 struct tm *gmtime_s(const time_t * restrict timer,
23511 struct tm * restrict result);
23512 struct tm *localtime_s(const time_t * restrict timer,
23513 struct tm * restrict result);</pre>
23515 <h3><a name="B.26" href="#B.26">B.26 Unicode utilities <uchar.h></a></h3>
23516 <pre>
23517 mbstate_t size_t char16_t char32_t
23518 size_t mbrtoc16(char16_t * restrict pc16,
23519 const char * restrict s, size_t n,
23520 mbstate_t * restrict ps);
23521 size_t c16rtomb(char * restrict s, char16_t c16,
23522 mbstate_t * restrict ps);
23523 size_t mbrtoc32(char32_t * restrict pc32,
23524 const char * restrict s, size_t n,
23525 mbstate_t * restrict ps);
23526 size_t c32rtomb(char * restrict s, char32_t c32,
23527 mbstate_t * restrict ps);</pre>
23529 <h3><a name="B.27" href="#B.27">B.27 Extended multibyte/wide character utilities <wchar.h></a></h3>
23530 <!--page 512 -->
23531 <!--page 513 -->
23532 <!--page 514 -->
23533 <!--page 515 -->
23534 <!--page 516 -->
23535 <pre>
23536 wchar_t wint_t WCHAR_MAX
23537 size_t struct tm WCHAR_MIN
23538 mbstate_t NULL WEOF
23539 int fwprintf(FILE * restrict stream,
23540 const wchar_t * restrict format, ...);
23541 int fwscanf(FILE * restrict stream,
23542 const wchar_t * restrict format, ...);
23543 int swprintf(wchar_t * restrict s, size_t n,
23544 const wchar_t * restrict format, ...);
23545 int swscanf(const wchar_t * restrict s,
23546 const wchar_t * restrict format, ...);
23547 int vfwprintf(FILE * restrict stream,
23548 const wchar_t * restrict format, va_list arg);
23549 int vfwscanf(FILE * restrict stream,
23550 const wchar_t * restrict format, va_list arg);
23551 int vswprintf(wchar_t * restrict s, size_t n,
23552 const wchar_t * restrict format, va_list arg);
23553 int vswscanf(const wchar_t * restrict s,
23554 const wchar_t * restrict format, va_list arg);
23555 int vwprintf(const wchar_t * restrict format,
23556 va_list arg);
23557 int vwscanf(const wchar_t * restrict format,
23558 va_list arg);
23559 int wprintf(const wchar_t * restrict format, ...);
23560 int wscanf(const wchar_t * restrict format, ...);
23561 wint_t fgetwc(FILE *stream);
23562 wchar_t *fgetws(wchar_t * restrict s, int n,
23563 FILE * restrict stream);
23564 wint_t fputwc(wchar_t c, FILE *stream);
23565 int fputws(const wchar_t * restrict s,
23566 FILE * restrict stream);
23567 int fwide(FILE *stream, int mode);
23568 wint_t getwc(FILE *stream);
23569 wint_t getwchar(void);
23570 wint_t putwc(wchar_t c, FILE *stream);
23571 wint_t putwchar(wchar_t c);
23572 wint_t ungetwc(wint_t c, FILE *stream);
23573 double wcstod(const wchar_t * restrict nptr,
23574 wchar_t ** restrict endptr);
23575 float wcstof(const wchar_t * restrict nptr,
23576 wchar_t ** restrict endptr);
23577 long double wcstold(const wchar_t * restrict nptr,
23578 wchar_t ** restrict endptr);
23579 long int wcstol(const wchar_t * restrict nptr,
23580 wchar_t ** restrict endptr, int base);
23581 long long int wcstoll(const wchar_t * restrict nptr,
23582 wchar_t ** restrict endptr, int base);
23583 unsigned long int wcstoul(const wchar_t * restrict nptr,
23584 wchar_t ** restrict endptr, int base);
23585 unsigned long long int wcstoull(
23586 const wchar_t * restrict nptr,
23587 wchar_t ** restrict endptr, int base);
23588 wchar_t *wcscpy(wchar_t * restrict s1,
23589 const wchar_t * restrict s2);
23590 wchar_t *wcsncpy(wchar_t * restrict s1,
23591 const wchar_t * restrict s2, size_t n);
23592 wchar_t *wmemcpy(wchar_t * restrict s1,
23593 const wchar_t * restrict s2, size_t n);
23594 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
23595 size_t n);
23596 wchar_t *wcscat(wchar_t * restrict s1,
23597 const wchar_t * restrict s2);
23598 wchar_t *wcsncat(wchar_t * restrict s1,
23599 const wchar_t * restrict s2, size_t n);
23600 int wcscmp(const wchar_t *s1, const wchar_t *s2);
23601 int wcscoll(const wchar_t *s1, const wchar_t *s2);
23602 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
23603 size_t n);
23604 size_t wcsxfrm(wchar_t * restrict s1,
23605 const wchar_t * restrict s2, size_t n);
23606 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
23607 size_t n);
23608 wchar_t *wcschr(const wchar_t *s, wchar_t c);
23609 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
23610 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
23611 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
23612 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
23613 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
23614 wchar_t *wcstok(wchar_t * restrict s1,
23615 const wchar_t * restrict s2,
23616 wchar_t ** restrict ptr);
23617 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
23618 size_t wcslen(const wchar_t *s);
23619 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
23620 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
23621 const wchar_t * restrict format,
23622 const struct tm * restrict timeptr);
23623 wint_t btowc(int c);
23624 int wctob(wint_t c);
23625 int mbsinit(const mbstate_t *ps);
23626 size_t mbrlen(const char * restrict s, size_t n,
23627 mbstate_t * restrict ps);
23628 size_t mbrtowc(wchar_t * restrict pwc,
23629 const char * restrict s, size_t n,
23630 mbstate_t * restrict ps);
23631 size_t wcrtomb(char * restrict s, wchar_t wc,
23632 mbstate_t * restrict ps);
23633 size_t mbsrtowcs(wchar_t * restrict dst,
23634 const char ** restrict src, size_t len,
23635 mbstate_t * restrict ps);
23636 size_t wcsrtombs(char * restrict dst,
23637 const wchar_t ** restrict src, size_t len,
23638 mbstate_t * restrict ps);
23639 __STDC_WANT_LIB_EXT1__
23640 errno_t
23641 rsize_t
23642 int fwprintf_s(FILE * restrict stream,
23643 const wchar_t * restrict format, ...);
23644 int fwscanf_s(FILE * restrict stream,
23645 const wchar_t * restrict format, ...);
23646 int snwprintf_s(wchar_t * restrict s,
23647 rsize_t n,
23648 const wchar_t * restrict format, ...);
23649 int swprintf_s(wchar_t * restrict s, rsize_t n,
23650 const wchar_t * restrict format, ...);
23651 int swscanf_s(const wchar_t * restrict s,
23652 const wchar_t * restrict format, ...);
23653 int vfwprintf_s(FILE * restrict stream,
23654 const wchar_t * restrict format,
23655 va_list arg);
23656 int vfwscanf_s(FILE * restrict stream,
23657 const wchar_t * restrict format, va_list arg);
23658 int vsnwprintf_s(wchar_t * restrict s,
23659 rsize_t n,
23660 const wchar_t * restrict format,
23661 va_list arg);
23662 int vswprintf_s(wchar_t * restrict s,
23663 rsize_t n,
23664 const wchar_t * restrict format,
23665 va_list arg);
23666 int vswscanf_s(const wchar_t * restrict s,
23667 const wchar_t * restrict format,
23668 va_list arg);
23669 int vwprintf_s(const wchar_t * restrict format,
23670 va_list arg);
23671 int vwscanf_s(const wchar_t * restrict format,
23672 va_list arg);
23673 int wprintf_s(const wchar_t * restrict format, ...);
23674 int wscanf_s(const wchar_t * restrict format, ...);
23675 errno_t wcscpy_s(wchar_t * restrict s1,
23676 rsize_t s1max,
23677 const wchar_t * restrict s2);
23678 errno_t wcsncpy_s(wchar_t * restrict s1,
23679 rsize_t s1max,
23680 const wchar_t * restrict s2,
23681 rsize_t n);
23682 errno_t wmemcpy_s(wchar_t * restrict s1,
23683 rsize_t s1max,
23684 const wchar_t * restrict s2,
23685 rsize_t n);
23686 errno_t wmemmove_s(wchar_t *s1, rsize_t s1max,
23687 const wchar_t *s2, rsize_t n);
23688 errno_t wcscat_s(wchar_t * restrict s1,
23689 rsize_t s1max,
23690 const wchar_t * restrict s2);
23691 errno_t wcsncat_s(wchar_t * restrict s1,
23692 rsize_t s1max,
23693 const wchar_t * restrict s2,
23694 rsize_t n);
23695 wchar_t *wcstok_s(wchar_t * restrict s1,
23696 rsize_t * restrict s1max,
23697 const wchar_t * restrict s2,
23698 wchar_t ** restrict ptr);
23699 size_t wcsnlen_s(const wchar_t *s, size_t maxsize);
23700 errno_t wcrtomb_s(size_t * restrict retval,
23701 char * restrict s, rsize_t smax,
23702 wchar_t wc, mbstate_t * restrict ps);
23703 errno_t mbsrtowcs_s(size_t * restrict retval,
23704 wchar_t * restrict dst, rsize_t dstmax,
23705 const char ** restrict src, rsize_t len,
23706 mbstate_t * restrict ps);
23707 errno_t wcsrtombs_s(size_t * restrict retval,
23708 char * restrict dst, rsize_t dstmax,
23709 const wchar_t ** restrict src, rsize_t len,
23710 mbstate_t * restrict ps);</pre>
23712 <h3><a name="B.28" href="#B.28">B.28 Wide character classification and mapping utilities <wctype.h></a></h3>
23713 <!--page 517 -->
23714 <pre>
23715 wint_t wctrans_t wctype_t WEOF
23716 int iswalnum(wint_t wc);
23717 int iswalpha(wint_t wc);
23718 int iswblank(wint_t wc);
23719 int iswcntrl(wint_t wc);
23720 int iswdigit(wint_t wc);
23721 int iswgraph(wint_t wc);
23722 int iswlower(wint_t wc);
23723 int iswprint(wint_t wc);
23724 int iswpunct(wint_t wc);
23725 int iswspace(wint_t wc);
23726 int iswupper(wint_t wc);
23727 int iswxdigit(wint_t wc);
23728 int iswctype(wint_t wc, wctype_t desc);
23729 wctype_t wctype(const char *property);
23730 wint_t towlower(wint_t wc);
23731 wint_t towupper(wint_t wc);
23732 wint_t towctrans(wint_t wc, wctrans_t desc);
23733 wctrans_t wctrans(const char *property);</pre>
23735 <h2><a name="C" href="#C">Annex C</a></h2>
23736 <p><!--para 1 -->
23737 <pre>
23738 (informative)
23739 Sequence points</pre>
23740 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
23741 <ul>
23742 <li> Between the evaluations of the function designator and actual arguments in a function
23743 call and the actual call. (<a href="#6.5.2.2">6.5.2.2</a>).
23744 <li> Between the evaluations of the first and second operands of the following operators:
23745 logical AND &amp;&amp; (<a href="#6.5.13">6.5.13</a>); logical OR || (<a href="#6.5.14">6.5.14</a>); comma , (<a href="#6.5.17">6.5.17</a>). *
23746 <li> Between the evaluations of the first operand of the conditional ? : operator and
23747 whichever of the second and third operands is evaluated (<a href="#6.5.15">6.5.15</a>).
23748 <li> The end of a full declarator: declarators (<a href="#6.7.6">6.7.6</a>);
23749 <li> Between the evaluation of a full expression and the next full expression to be
23750 evaluated. The following are full expressions: an initializer that is not part of a
23751 compound literal (<a href="#6.7.9">6.7.9</a>); the expression in an expression statement (<a href="#6.8.3">6.8.3</a>); the
23752 controlling expression of a selection statement (if or switch) (<a href="#6.8.4">6.8.4</a>); the
23753 controlling expression of a while or do statement (<a href="#6.8.5">6.8.5</a>); each of the (optional)
23754 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the (optional) expression in a return
23755 statement (<a href="#6.8.6.4">6.8.6.4</a>).
23756 <li> Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
23757 <li> After the actions associated with each formatted input/output function conversion
23758 specifier (<a href="#7.21.6">7.21.6</a>, <a href="#7.28.2">7.28.2</a>).
23759 <li> Immediately before and immediately after each call to a comparison function, and
23760 also between any call to a comparison function and any movement of the objects
23761 passed as arguments to that call (<a href="#7.22.5">7.22.5</a>).
23762 <!--page 518 -->
23763 </ul>
23765 <h2><a name="D" href="#D">Annex D</a></h2>
23766 <p><!--para 1 -->
23767 <pre>
23768 (normative)
23769 Universal character names for identifiers</pre>
23770 This clause lists the hexadecimal code values that are valid in universal character names
23771 in identifiers.
23773 <h3><a name="D.1" href="#D.1">D.1 Ranges of characters allowed</a></h3>
23774 <p><!--para 1 -->
23775 00A8, 00AA, 00AD, 00AF, 00B2-00B5, 00B7-00BA, 00BC-00BE, 00C0-00D6,
23776 00D8-00F6, 00F8-00FF
23777 <p><!--para 2 -->
23778 0100-167F, 1681-180D, 180F-1FFF
23779 <p><!--para 3 -->
23780 200B-200D, 202A-202E, 203F-2040, 2054, 2060-206F
23781 <p><!--para 4 -->
23782 2070-218F, 2460-24FF, 2776-2793, 2C00-2DFF, 2E80-2FFF
23783 <p><!--para 5 -->
23784 3004-3007, 3021-302F, 3031-303F
23785 <p><!--para 6 -->
23786 3040-D7FF
23787 <p><!--para 7 -->
23788 F900-FD3D, FD40-FDCF, FDF0-FE44, FE47-FFFD
23789 <p><!--para 8 -->
23790 10000-1FFFD, 20000-2FFFD, 30000-3FFFD, 40000-4FFFD, 50000-5FFFD,
23791 60000-6FFFD, 70000-7FFFD, 80000-8FFFD, 90000-9FFFD, A0000-AFFFD,
23792 B0000-BFFFD, C0000-CFFFD, D0000-DFFFD, E0000-EFFFD
23794 <h3><a name="D.2" href="#D.2">D.2 Ranges of characters disallowed initially</a></h3>
23795 <p><!--para 1 -->
23796 0300-036F, 1DC0-1DFF, 20D0-20FF, FE20-FE2F
23797 <!--page 519 -->
23799 <h2><a name="E" href="#E">Annex E</a></h2>
23800 <p><!--para 1 -->
23801 <pre>
23802 (informative)
23803 Implementation limits</pre>
23804 The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
23805 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
23806 with the same sign. The values shall all be constant expressions suitable for use in #if
23807 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
23808 <p><!--para 2 -->
23809 <pre>
23810 #define CHAR_BIT 8
23811 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
23812 #define CHAR_MIN 0 or SCHAR_MIN
23813 #define INT_MAX +32767
23814 #define INT_MIN -32767
23815 #define LONG_MAX +2147483647
23816 #define LONG_MIN -2147483647
23817 #define LLONG_MAX +9223372036854775807
23818 #define LLONG_MIN -9223372036854775807
23819 #define MB_LEN_MAX 1
23820 #define SCHAR_MAX +127
23821 #define SCHAR_MIN -127
23822 #define SHRT_MAX +32767
23823 #define SHRT_MIN -32767
23824 #define UCHAR_MAX 255
23825 #define USHRT_MAX 65535
23826 #define UINT_MAX 65535
23827 #define ULONG_MAX 4294967295
23828 #define ULLONG_MAX 18446744073709551615</pre>
23829 The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
23830 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
23831 directives; all floating values shall be constant expressions. The components are
23832 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
23833 <p><!--para 3 -->
23834 The values given in the following list shall be replaced by implementation-defined
23835 expressions:
23836 <p><!--para 4 -->
23837 <pre>
23838 #define FLT_EVAL_METHOD
23839 #define FLT_ROUNDS</pre>
23840 The values given in the following list shall be replaced by implementation-defined
23841 constant expressions that are greater or equal in magnitude (absolute value) to those
23842 shown, with the same sign:
23843 <!--page 520 -->
23844 <p><!--para 5 -->
23845 <pre>
23846 #define DLB_DECIMAL_DIG 10
23847 #define DBL_DIG 10
23848 #define DBL_MANT_DIG
23849 #define DBL_MAX_10_EXP +37
23850 #define DBL_MAX_EXP
23851 #define DBL_MIN_10_EXP -37
23852 #define DBL_MIN_EXP
23853 #define DECIMAL_DIG 10
23854 #define FLT_DECIMAL_DIG 6
23855 #define FLT_DIG 6
23856 #define FLT_MANT_DIG
23857 #define FLT_MAX_10_EXP +37
23858 #define FLT_MAX_EXP
23859 #define FLT_MIN_10_EXP -37
23860 #define FLT_MIN_EXP
23861 #define FLT_RADIX 2
23862 #define LDLB_DECIMAL_DIG 10
23863 #define LDBL_DIG 10
23864 #define LDBL_MANT_DIG
23865 #define LDBL_MAX_10_EXP +37
23866 #define LDBL_MAX_EXP
23867 #define LDBL_MIN_10_EXP -37
23868 #define LDBL_MIN_EXP</pre>
23869 The values given in the following list shall be replaced by implementation-defined
23870 constant expressions with values that are greater than or equal to those shown:
23871 <p><!--para 6 -->
23872 <pre>
23873 #define DBL_MAX 1E+37
23874 #define FLT_MAX 1E+37
23875 #define LDBL_MAX 1E+37</pre>
23876 The values given in the following list shall be replaced by implementation-defined
23877 constant expressions with (positive) values that are less than or equal to those shown:
23878 <!--page 521 -->
23879 <pre>
23880 #define DBL_EPSILON 1E-9
23881 #define DBL_MIN 1E-37
23882 #define FLT_EPSILON 1E-5
23883 #define FLT_MIN 1E-37
23884 #define LDBL_EPSILON 1E-9
23885 #define LDBL_MIN 1E-37</pre>
23887 <h2><a name="F" href="#F">Annex F</a></h2>
23888 <pre>
23889 (normative)
23890 IEC 60559 floating-point arithmetic</pre>
23892 <h3><a name="F.1" href="#F.1">F.1 Introduction</a></h3>
23893 <p><!--para 1 -->
23894 This annex specifies C language support for the IEC 60559 floating-point standard. The
23895 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
23896 microprocessor systems, second edition (IEC 60559:1989), previously designated
23897 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
23898 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
23899 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
23900 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
23901 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
23902 defines __STDC_IEC_559__ shall conform to the specifications in this annex.<sup><a href="#note343"><b>343)</b></a></sup>
23903 Where a binding between the C language and IEC 60559 is indicated, the
23904 IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since
23905 negative and positive infinity are representable in IEC 60559 formats, all real numbers lie
23906 within the range of representable values.
23908 <h6>footnotes</h6>
23909 <p><small><a name="note343" href="#note343">343)</a> Implementations that do not define __STDC_IEC_559__ are not required to conform to these
23910 specifications.
23911 </small>
23913 <h3><a name="F.2" href="#F.2">F.2 Types</a></h3>
23914 <p><!--para 1 -->
23915 The C floating types match the IEC 60559 formats as follows:
23916 <ul>
23917 <li> The float type matches the IEC 60559 single format.
23918 <li> The double type matches the IEC 60559 double format.
23919 <li> The long double type matches an IEC 60559 extended format,<sup><a href="#note344"><b>344)</b></a></sup> else a
23920 non-IEC 60559 extended format, else the IEC 60559 double format.
23921 </ul>
23922 Any non-IEC 60559 extended format used for the long double type shall have more
23923 precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note345"><b>345)</b></a></sup>
23928 <!--page 522 -->
23929 <h6>Recommended practice</h6>
23930 <p><!--para 2 -->
23931 The long double type should match an IEC 60559 extended format.
23933 <h6>footnotes</h6>
23934 <p><small><a name="note344" href="#note344">344)</a> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
23935 and quadruple 128-bit IEC 60559 formats.
23936 </small>
23937 <p><small><a name="note345" href="#note345">345)</a> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
23938 all double values.
23939 </small>
23941 <h4><a name="F.2.1" href="#F.2.1">F.2.1 Infinities, signed zeros, and NaNs</a></h4>
23942 <p><!--para 1 -->
23943 This specification does not define the behavior of signaling NaNs.<sup><a href="#note346"><b>346)</b></a></sup> It generally uses
23944 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
23945 functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
23947 <h6>footnotes</h6>
23948 <p><small><a name="note346" href="#note346">346)</a> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
23949 sufficient for closure of the arithmetic.
23950 </small>
23952 <h3><a name="F.3" href="#F.3">F.3 Operators and functions</a></h3>
23953 <p><!--para 1 -->
23954 C operators and functions provide IEC 60559 required and recommended facilities as
23955 listed below.
23956 <ul>
23957 <li> The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
23958 divide operations.
23959 <li> The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
23960 <li> The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
23961 operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
23962 with additional information.
23963 <li> The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
23964 floating-point number to an integer value (in the same precision). The nearbyint
23965 functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
23966 Appendix to ANSI/IEEE 854.
23967 <li> The conversions for floating types provide the IEC 60559 conversions between
23968 floating-point precisions.
23969 <li> The conversions from integer to floating types provide the IEC 60559 conversions
23970 from integer to floating point.
23971 <li> The conversions from floating to integer types provide IEC 60559-like conversions
23972 but always round toward zero.
23973 <li> The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
23974 conversions, which honor the directed rounding mode, from floating point to the
23975 long int and long long int integer formats. The lrint and llrint
23976 functions can be used to implement IEC 60559 conversions from floating to other
23977 integer formats.
23978 <li> The translation time conversion of floating constants and the strtod, strtof,
23979 strtold, fprintf, fscanf, and related library functions in <a href="#7.22">&lt;stdlib.h&gt;</a>,
23982 <!--page 523 -->
23983 <a href="#7.21">&lt;stdio.h&gt;</a>, and <a href="#7.28">&lt;wchar.h&gt;</a> provide IEC 60559 binary-decimal conversions. The
23984 strtold function in <a href="#7.22">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
23985 Appendix to ANSI/IEEE 854.
23986 <li> The relational and equality operators provide IEC 60559 comparisons. IEC 60559
23987 identifies a need for additional comparison predicates to facilitate writing code that
23988 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
23989 isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
23990 supplement the language operators to address this need. The islessgreater and
23991 isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
23992 the unordered predicate recommended in the Appendix to IEC 60559.
23993 <li> The feclearexcept, feraiseexcept, and fetestexcept functions in
23994 <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
23995 exception status flags. The fegetexceptflag and fesetexceptflag
23996 functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
23997 one time. These functions are used in conjunction with the type fexcept_t and the
23998 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
23999 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
24000 <li> The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
24001 to select among the IEC 60559 directed rounding modes represented by the rounding
24002 direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
24003 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
24004 IEC 60559 directed rounding modes.
24005 <li> The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
24006 <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
24007 the IEC 60559 status flags and control modes.
24008 <li> The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
24009 recommended in the Appendix to IEC 60559.
24010 <li> The fabs functions in <a href="#7.12">&lt;math.h&gt;</a> provide the abs function recommended in the
24011 Appendix to IEC 60559.
24012 <li> The unary minus (-) operator provides the unary minus (-) operation recommended
24013 in the Appendix to IEC 60559.
24014 <li> The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
24015 recommended in the Appendix to IEC 60559.
24016 <li> The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
24017 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
24018 <li> The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
24019 function recommended in the Appendix to IEC 60559 (but with a minor change to
24020 <!--page 524 -->
24021 better handle signed zeros).
24022 <li> The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
24023 the Appendix to IEC 60559.
24024 <li> The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
24025 Appendix to IEC 60559.
24026 <li> The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
24027 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
24028 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
24029 function recommended in the Appendix to IEC 60559 (except that the classification
24030 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
24031 </ul>
24033 <h3><a name="F.4" href="#F.4">F.4 Floating to integer conversion</a></h3>
24034 <p><!--para 1 -->
24035 If the integer type is _Bool, <a href="#6.3.1.2">6.3.1.2</a> applies and no floating-point exceptions are raised
24036 (even for NaN). Otherwise, if the floating value is infinite or NaN or if the integral part
24037 of the floating value exceeds the range of the integer type, then the ''invalid'' floating-
24038 point exception is raised and the resulting value is unspecified. Otherwise, the resulting
24039 value is determined by <a href="#6.3.1.4">6.3.1.4</a>. Conversion of an integral floating value that does not
24040 exceed the range of the integer type raises no floating-point exceptions; whether
24041 conversion of a non-integral floating value raises the ''inexact'' floating-point exception is
24042 unspecified.<sup><a href="#note347"><b>347)</b></a></sup>
24044 <h6>footnotes</h6>
24045 <p><small><a name="note347" href="#note347">347)</a> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
24046 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
24047 cases where it matters, library functions can be used to effect such conversions with or without raising
24048 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
24049 <a href="#7.12">&lt;math.h&gt;</a>.
24050 </small>
24052 <h3><a name="F.5" href="#F.5">F.5 Binary-decimal conversion</a></h3>
24053 <p><!--para 1 -->
24054 Conversion from the widest supported IEC 60559 format to decimal with
24055 DECIMAL_DIG digits and back is the identity function.<sup><a href="#note348"><b>348)</b></a></sup>
24056 <p><!--para 2 -->
24057 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
24058 particular, conversion between any supported IEC 60559 format and decimal with
24059 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
24060 rounding mode), which assures that conversion from the widest supported IEC 60559
24061 format to decimal with DECIMAL_DIG digits and back is the identity function.
24065 <!--page 525 -->
24066 <p><!--para 3 -->
24067 Functions such as strtod that convert character sequences to floating types honor the
24068 rounding direction. Hence, if the rounding direction might be upward or downward, the
24069 implementation cannot convert a minus-signed sequence by negating the converted
24070 unsigned sequence.
24072 <h6>footnotes</h6>
24073 <p><small><a name="note348" href="#note348">348)</a> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
24074 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
24075 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
24076 DBL_DIG are 18 and 15, respectively, for these formats.)
24077 </small>
24079 <h3><a name="F.6" href="#F.6">F.6 The return statement</a></h3>
24080 If the return expression is evaluated in a floating-point format different from the return
24081 type, the expression is converted as if by assignment<sup><a href="#note349"><b>349)</b></a></sup> to the return type of the function
24082 and the resulting value is returned to the caller.
24084 <h6>footnotes</h6>
24085 <p><small><a name="note349" href="#note349">349)</a> Assignment removes any extra range and precision.
24086 </small>
24088 <h3><a name="F.7" href="#F.7">F.7 Contracted expressions</a></h3>
24089 <p><!--para 1 -->
24090 A contracted expression is correctly rounded (once) and treats infinities, NaNs, signed
24091 zeros, subnormals, and the rounding directions in a manner consistent with the basic
24092 arithmetic operations covered by IEC 60559.
24093 <h6>Recommended practice</h6>
24094 <p><!--para 2 -->
24095 A contracted expression should raise floating-point exceptions in a manner generally
24096 consistent with the basic arithmetic operations. *
24098 <h3><a name="F.8" href="#F.8">F.8 Floating-point environment</a></h3>
24099 <p><!--para 1 -->
24100 The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
24101 point exception status flags and directed-rounding control modes. It includes also
24102 IEC 60559 dynamic rounding precision and trap enablement modes, if the
24103 implementation supports them.<sup><a href="#note350"><b>350)</b></a></sup>
24105 <h6>footnotes</h6>
24106 <p><small><a name="note350" href="#note350">350)</a> This specification does not require dynamic rounding precision nor trap enablement modes.
24107 </small>
24109 <h4><a name="F.8.1" href="#F.8.1">F.8.1 Environment management</a></h4>
24110 <p><!--para 1 -->
24111 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
24112 status flags, and that rounding control modes can be set explicitly to affect result values of
24113 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
24114 <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
24115 which respect sequence points.<sup><a href="#note351"><b>351)</b></a></sup>
24120 <!--page 526 -->
24122 <h6>footnotes</h6>
24123 <p><small><a name="note351" href="#note351">351)</a> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
24124 point control modes will be the default ones and the floating-point status flags will not be tested,
24125 which allows certain optimizations (see <a href="#F.9">F.9</a>).
24126 </small>
24128 <h4><a name="F.8.2" href="#F.8.2">F.8.2 Translation</a></h4>
24129 <p><!--para 1 -->
24130 During translation the IEC 60559 default modes are in effect:
24131 <ul>
24132 <li> The rounding direction mode is rounding to nearest.
24133 <li> The rounding precision mode (if supported) is set so that results are not shortened.
24134 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
24135 </ul>
24136 <h6>Recommended practice</h6>
24137 <p><!--para 2 -->
24138 The implementation should produce a diagnostic message for each translation-time
24139 floating-point exception, other than ''inexact'';<sup><a href="#note352"><b>352)</b></a></sup> the implementation should then
24140 proceed with the translation of the program.
24142 <h6>footnotes</h6>
24143 <p><small><a name="note352" href="#note352">352)</a> As floating constants are converted to appropriate internal representations at translation time, their
24144 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
24145 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
24146 strtod, provide execution-time conversion of numeric strings.
24147 </small>
24149 <h4><a name="F.8.3" href="#F.8.3">F.8.3 Execution</a></h4>
24150 <p><!--para 1 -->
24151 At program startup the floating-point environment is initialized as prescribed by
24152 IEC 60559:
24153 <ul>
24154 <li> All floating-point exception status flags are cleared.
24155 <li> The rounding direction mode is rounding to nearest.
24156 <li> The dynamic rounding precision mode (if supported) is set so that results are not
24157 shortened.
24158 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
24159 </ul>
24161 <h4><a name="F.8.4" href="#F.8.4">F.8.4 Constant expressions</a></h4>
24162 <p><!--para 1 -->
24163 An arithmetic constant expression of floating type, other than one in an initializer for an
24164 object that has static or thread storage duration, is evaluated (as if) during execution; thus,
24165 it is affected by any operative floating-point control modes and raises floating-point
24166 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
24167 is ''on'').<sup><a href="#note353"><b>353)</b></a></sup>
24168 <p><!--para 2 -->
24169 EXAMPLE
24173 <!--page 527 -->
24174 <p><!--para 3 -->
24175 <pre>
24176 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24177 #pragma STDC FENV_ACCESS ON
24178 void f(void)
24180 float w[] = { 0.0/0.0 }; // raises an exception
24181 static float x = 0.0/0.0; // does not raise an exception
24182 float y = 0.0/0.0; // raises an exception
24183 double z = 0.0/0.0; // raises an exception
24184 /* ... */
24185 }</pre>
24186 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
24187 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
24188 execution time.
24191 <h6>footnotes</h6>
24192 <p><small><a name="note353" href="#note353">353)</a> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
24193 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
24194 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
24195 efficiency of translation-time evaluation through static initialization, such as
24197 <pre>
24198 const static double one_third = 1.0/3.0;</pre>
24199 </small>
24201 <h4><a name="F.8.5" href="#F.8.5">F.8.5 Initialization</a></h4>
24202 <p><!--para 1 -->
24203 All computation for automatic initialization is done (as if) at execution time; thus, it is
24204 affected by any operative modes and raises floating-point exceptions as required by
24205 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
24206 for initialization of objects that have static or thread storage duration is done (as if) at
24207 translation time.
24208 <p><!--para 2 -->
24209 EXAMPLE
24210 <p><!--para 3 -->
24211 <pre>
24212 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24213 #pragma STDC FENV_ACCESS ON
24214 void f(void)
24216 float u[] = { 1.1e75 }; // raises exceptions
24217 static float v = 1.1e75; // does not raise exceptions
24218 float w = 1.1e75; // raises exceptions
24219 double x = 1.1e75; // may raise exceptions
24220 float y = 1.1e75f; // may raise exceptions
24221 long double z = 1.1e75; // does not raise exceptions
24222 /* ... */
24223 }</pre>
24224 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
24225 done at translation time. The automatic initialization of u and w require an execution-time conversion to
24226 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
24227 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
24228 conversions is not to a narrower format, in which case no floating-point exception is raised.<sup><a href="#note354"><b>354)</b></a></sup> The
24229 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
24230 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
24234 <!--page 528 -->
24235 their internal representations occur at translation time in all cases.
24238 <h6>footnotes</h6>
24239 <p><small><a name="note354" href="#note354">354)</a> Use of float_t and double_t variables increases the likelihood of translation-time computation.
24240 For example, the automatic initialization
24242 <pre>
24243 double_t x = 1.1e75;</pre>
24244 could be done at translation time, regardless of the expression evaluation method.
24245 </small>
24247 <h4><a name="F.8.6" href="#F.8.6">F.8.6 Changing the environment</a></h4>
24248 <p><!--para 1 -->
24249 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
24250 change floating-point status flags and control modes just as indicated by their
24251 specifications (including conformance to IEC 60559). They do not change flags or modes
24252 (so as to be detectable by the user) in any other cases.
24253 <p><!--para 2 -->
24254 If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
24255 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
24256 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
24257 before ''inexact''.
24259 <h3><a name="F.9" href="#F.9">F.9 Optimization</a></h3>
24260 <p><!--para 1 -->
24261 This section identifies code transformations that might subvert IEC 60559-specified
24262 behavior, and others that do not.
24264 <h4><a name="F.9.1" href="#F.9.1">F.9.1 Global transformations</a></h4>
24265 <p><!--para 1 -->
24266 Floating-point arithmetic operations and external function calls may entail side effects
24267 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
24268 ''on''. The flags and modes in the floating-point environment may be regarded as global
24269 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
24270 flags.
24271 <p><!--para 2 -->
24272 Concern about side effects may inhibit code motion and removal of seemingly useless
24273 code. For example, in
24274 <pre>
24275 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24276 #pragma STDC FENV_ACCESS ON
24277 void f(double x)
24279 /* ... */
24280 for (i = 0; i &lt; n; i++) x + 1;
24281 /* ... */
24282 }</pre>
24283 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
24284 body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
24285 course these optimizations are valid if the implementation can rule out the nettlesome
24286 cases.)
24287 <p><!--para 3 -->
24288 This specification does not require support for trap handlers that maintain information
24289 about the order or count of floating-point exceptions. Therefore, between function calls,
24290 floating-point exceptions need not be precise: the actual order and number of occurrences
24291 of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
24292 <!--page 529 -->
24293 the preceding loop could be treated as
24294 <pre>
24295 if (0 &lt; n) x + 1;</pre>
24297 <h4><a name="F.9.2" href="#F.9.2">F.9.2 Expression transformations</a></h4>
24298 <p><!--para 1 -->
24299 x/2 &lt;-&gt; x x 0.5 Although similar transformations involving inexact constants
24300 <pre>
24301 generally do not yield numerically equivalent expressions, if the
24302 constants are exact then such transformations can be made on
24303 IEC 60559 machines and others that round perfectly.</pre>
24304 1 x x and x/1 -&gt; x The expressions 1 x x, x/1, and x are equivalent (on IEC 60559
24305 <pre>
24306 machines, among others).<sup><a href="#note355"><b>355)</b></a></sup></pre>
24307 x/x -&gt; 1.0 The expressions x/x and 1.0 are not equivalent if x can be zero,
24308 <pre>
24309 infinite, or NaN.</pre>
24310 x - y &lt;-&gt; x + (-y) The expressions x - y, x + (-y), and (-y) + x are equivalent (on
24311 <pre>
24312 IEC 60559 machines, among others).</pre>
24313 x - y &lt;-&gt; -(y - x) The expressions x - y and -(y - x) are not equivalent because 1 - 1
24314 <pre>
24315 is +0 but -(1 - 1) is -0 (in the default rounding direction).<sup><a href="#note356"><b>356)</b></a></sup></pre>
24316 x - x -&gt; 0.0 The expressions x - x and 0.0 are not equivalent if x is a NaN or
24317 <pre>
24318 infinite.</pre>
24319 0 x x -&gt; 0.0 The expressions 0 x x and 0.0 are not equivalent if x is a NaN,
24320 <pre>
24321 infinite, or -0.</pre>
24322 x+0-&gt; x The expressions x + 0 and x are not equivalent if x is -0, because
24323 <pre>
24324 (-0) + (+0) yields +0 (in the default rounding direction), not -0.</pre>
24325 x-0-&gt; x (+0) - (+0) yields -0 when rounding is downward (toward -(inf)), but
24326 <pre>
24327 +0 otherwise, and (-0) - (+0) always yields -0; so, if the state of the
24328 FENV_ACCESS pragma is ''off'', promising default rounding, then
24329 the implementation can replace x - 0 by x, even if x might be zero.</pre>
24330 -x &lt;-&gt; 0 - x The expressions -x and 0 - x are not equivalent if x is +0, because
24331 <pre>
24332 -(+0) yields -0, but 0 - (+0) yields +0 (unless rounding is
24333 downward).</pre>
24335 <!--page 530 -->
24337 <h6>footnotes</h6>
24338 <p><small><a name="note355" href="#note355">355)</a> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
24339 other transformations that remove arithmetic operators.
24340 </small>
24341 <p><small><a name="note356" href="#note356">356)</a> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
24342 Examples include:
24344 <pre>
24345 1/(1/ (+-) (inf)) is (+-) (inf)</pre>
24348 <pre>
24349 conj(csqrt(z)) is csqrt(conj(z)),</pre>
24350 for complex z.
24351 </small>
24353 <h4><a name="F.9.3" href="#F.9.3">F.9.3 Relational operators</a></h4>
24354 <p><!--para 1 -->
24355 x != x -&gt; false The expression x != x is true if x is a NaN.
24356 x = x -&gt; true The expression x = x is false if x is a NaN.
24357 x &lt; y -&gt; isless(x,y) (and similarly for &lt;=, &gt;, &gt;=) Though numerically equal, these
24358 <pre>
24359 expressions are not equivalent because of side effects when x or y is a
24360 NaN and the state of the FENV_ACCESS pragma is ''on''. This
24361 transformation, which would be desirable if extra code were required
24362 to cause the ''invalid'' floating-point exception for unordered cases,
24363 could be performed provided the state of the FENV_ACCESS pragma
24364 is ''off''.</pre>
24365 The sense of relational operators shall be maintained. This includes handling unordered
24366 cases as expressed by the source code.
24367 <p><!--para 2 -->
24368 EXAMPLE
24369 <pre>
24370 // calls g and raises ''invalid'' if a and b are unordered
24371 if (a &lt; b)
24372 f();
24373 else
24374 g();</pre>
24375 is not equivalent to
24376 <pre>
24377 // calls f and raises ''invalid'' if a and b are unordered
24378 if (a &gt;= b)
24379 g();
24380 else
24381 f();</pre>
24382 nor to
24383 <pre>
24384 // calls f without raising ''invalid'' if a and b are unordered
24385 if (isgreaterequal(a,b))
24386 g();
24387 else
24388 f();</pre>
24389 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
24390 <pre>
24391 // calls g without raising ''invalid'' if a and b are unordered
24392 if (isless(a,b))
24393 f();
24394 else
24395 g();</pre>
24396 but is equivalent to
24397 <!--page 531 -->
24398 <pre>
24399 if (!(a &lt; b))
24400 g();
24401 else
24402 f();</pre>
24405 <h4><a name="F.9.4" href="#F.9.4">F.9.4 Constant arithmetic</a></h4>
24406 <p><!--para 1 -->
24407 The implementation shall honor floating-point exceptions raised by execution-time
24408 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.8.4">F.8.4</a>
24409 and <a href="#F.8.5">F.8.5</a>.) An operation on constants that raises no floating-point exception can be
24410 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
24411 further check is required to assure that changing the rounding direction to downward does
24412 not alter the sign of the result,<sup><a href="#note357"><b>357)</b></a></sup> and implementations that support dynamic rounding
24413 precision modes shall assure further that the result of the operation raises no floating-
24414 point exception when converted to the semantic type of the operation.
24416 <h6>footnotes</h6>
24417 <p><small><a name="note357" href="#note357">357)</a> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
24418 </small>
24420 <h3><a name="F.10" href="#F.10">F.10 Mathematics <math.h></a></h3>
24421 <p><!--para 1 -->
24422 This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
24423 for IEC 60559 implementations.
24424 <p><!--para 2 -->
24425 The Standard C macro HUGE_VAL and its float and long double analogs,
24426 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
24427 infinities.
24428 <p><!--para 3 -->
24429 Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
24430 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
24431 other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
24432 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
24433 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
24434 <p><!--para 4 -->
24435 The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
24436 nonzero value.
24437 <p><!--para 5 -->
24438 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
24439 subsequent subclauses of this annex.
24440 <p><!--para 6 -->
24441 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
24442 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
24443 whose magnitude is too large.
24444 <p><!--para 7 -->
24445 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
24446 subnormal or zero) and suffers loss of accuracy.<sup><a href="#note358"><b>358)</b></a></sup>
24449 <!--page 532 -->
24450 <p><!--para 8 -->
24451 Whether or when library functions raise the ''inexact'' floating-point exception is
24452 unspecified, unless explicitly specified otherwise.
24453 <p><!--para 9 -->
24454 Whether or when library functions raise an undeserved ''underflow'' floating-point
24455 exception is unspecified.<sup><a href="#note359"><b>359)</b></a></sup> Otherwise, as implied by <a href="#F.8.6">F.8.6</a>, the <a href="#7.12">&lt;math.h&gt;</a> functions do
24456 not raise spurious floating-point exceptions (detectable by the user), other than the
24457 ''inexact'' floating-point exception.
24458 <p><!--para 10 -->
24459 Whether the functions honor the rounding direction mode is implementation-defined,
24460 unless explicitly specified otherwise.
24461 <p><!--para 11 -->
24462 Functions with a NaN argument return a NaN result and raise no floating-point exception,
24463 except where stated otherwise.
24464 <p><!--para 12 -->
24465 The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
24466 For families of functions, the specifications apply to all of the functions even though only
24467 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
24468 occurs in both an argument and the result, the result has the same sign as the argument.
24469 <h6>Recommended practice</h6>
24470 <p><!--para 13 -->
24471 If a function with one or more NaN arguments returns a NaN result, the result should be
24472 the same as one of the NaN arguments (after possible type conversion), except perhaps
24473 for the sign.
24475 <h6>footnotes</h6>
24476 <p><small><a name="note358" href="#note358">358)</a> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
24477 when the floating-point exception is raised.
24478 </small>
24479 <p><small><a name="note359" href="#note359">359)</a> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
24480 avoiding them would be too costly.
24481 </small>
24483 <h4><a name="F.10.1" href="#F.10.1">F.10.1 Trigonometric functions</a></h4>
24485 <h5><a name="F.10.1.1" href="#F.10.1.1">F.10.1.1 The acos functions</a></h5>
24486 <p><!--para 1 -->
24487 <ul>
24488 <li> acos(1) returns +0.
24489 <li> acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
24490 | x | &gt; 1.
24491 </ul>
24493 <h5><a name="F.10.1.2" href="#F.10.1.2">F.10.1.2 The asin functions</a></h5>
24494 <p><!--para 1 -->
24495 <ul>
24496 <li> asin((+-)0) returns (+-)0.
24497 <li> asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
24498 | x | &gt; 1.
24503 <!--page 533 -->
24504 </ul>
24506 <h5><a name="F.10.1.3" href="#F.10.1.3">F.10.1.3 The atan functions</a></h5>
24507 <p><!--para 1 -->
24508 <ul>
24509 <li> atan((+-)0) returns (+-)0.
24510 <li> atan((+-)(inf)) returns (+-)pi /2.
24511 </ul>
24513 <h5><a name="F.10.1.4" href="#F.10.1.4">F.10.1.4 The atan2 functions</a></h5>
24514 <p><!--para 1 -->
24515 <ul>
24516 <li> atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note360"><b>360)</b></a></sup>
24517 <li> atan2((+-)0, +0) returns (+-)0.
24518 <li> atan2((+-)0, x) returns (+-)pi for x &lt; 0.
24519 <li> atan2((+-)0, x) returns (+-)0 for x &gt; 0.
24520 <li> atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
24521 <li> atan2(y, (+-)0) returns pi /2 for y &gt; 0.
24522 <li> atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
24523 <li> atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
24524 <li> atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
24525 <li> atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
24526 <li> atan2((+-)(inf), +(inf)) returns (+-)pi /4.
24527 </ul>
24529 <h6>footnotes</h6>
24530 <p><small><a name="note360" href="#note360">360)</a> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
24531 the ''divide-by-zero'' floating-point exception.
24532 </small>
24534 <h5><a name="F.10.1.5" href="#F.10.1.5">F.10.1.5 The cos functions</a></h5>
24535 <p><!--para 1 -->
24536 <ul>
24537 <li> cos((+-)0) returns 1.
24538 <li> cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
24539 </ul>
24541 <h5><a name="F.10.1.6" href="#F.10.1.6">F.10.1.6 The sin functions</a></h5>
24542 <p><!--para 1 -->
24543 <ul>
24544 <li> sin((+-)0) returns (+-)0.
24545 <li> sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
24546 </ul>
24548 <h5><a name="F.10.1.7" href="#F.10.1.7">F.10.1.7 The tan functions</a></h5>
24549 <p><!--para 1 -->
24550 <ul>
24551 <li> tan((+-)0) returns (+-)0.
24552 <li> tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
24557 <!--page 534 -->
24558 </ul>
24560 <h4><a name="F.10.2" href="#F.10.2">F.10.2 Hyperbolic functions</a></h4>
24562 <h5><a name="F.10.2.1" href="#F.10.2.1">F.10.2.1 The acosh functions</a></h5>
24563 <p><!--para 1 -->
24564 <ul>
24565 <li> acosh(1) returns +0.
24566 <li> acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
24567 <li> acosh(+(inf)) returns +(inf).
24568 </ul>
24570 <h5><a name="F.10.2.2" href="#F.10.2.2">F.10.2.2 The asinh functions</a></h5>
24571 <p><!--para 1 -->
24572 <ul>
24573 <li> asinh((+-)0) returns (+-)0.
24574 <li> asinh((+-)(inf)) returns (+-)(inf).
24575 </ul>
24577 <h5><a name="F.10.2.3" href="#F.10.2.3">F.10.2.3 The atanh functions</a></h5>
24578 <p><!--para 1 -->
24579 <ul>
24580 <li> atanh((+-)0) returns (+-)0.
24581 <li> atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
24582 <li> atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
24583 | x | &gt; 1.
24584 </ul>
24586 <h5><a name="F.10.2.4" href="#F.10.2.4">F.10.2.4 The cosh functions</a></h5>
24587 <p><!--para 1 -->
24588 <ul>
24589 <li> cosh((+-)0) returns 1.
24590 <li> cosh((+-)(inf)) returns +(inf).
24591 </ul>
24593 <h5><a name="F.10.2.5" href="#F.10.2.5">F.10.2.5 The sinh functions</a></h5>
24594 <p><!--para 1 -->
24595 <ul>
24596 <li> sinh((+-)0) returns (+-)0.
24597 <li> sinh((+-)(inf)) returns (+-)(inf).
24598 </ul>
24600 <h5><a name="F.10.2.6" href="#F.10.2.6">F.10.2.6 The tanh functions</a></h5>
24601 <p><!--para 1 -->
24602 <ul>
24603 <li> tanh((+-)0) returns (+-)0.
24604 <li> tanh((+-)(inf)) returns (+-)1.
24605 </ul>
24607 <h4><a name="F.10.3" href="#F.10.3">F.10.3 Exponential and logarithmic functions</a></h4>
24609 <h5><a name="F.10.3.1" href="#F.10.3.1">F.10.3.1 The exp functions</a></h5>
24610 <p><!--para 1 -->
24611 <ul>
24612 <li> exp((+-)0) returns 1.
24613 <li> exp(-(inf)) returns +0.
24614 <li> exp(+(inf)) returns +(inf).
24615 <!--page 535 -->
24616 </ul>
24618 <h5><a name="F.10.3.2" href="#F.10.3.2">F.10.3.2 The exp2 functions</a></h5>
24619 <p><!--para 1 -->
24620 <ul>
24621 <li> exp2((+-)0) returns 1.
24622 <li> exp2(-(inf)) returns +0.
24623 <li> exp2(+(inf)) returns +(inf).
24624 </ul>
24626 <h5><a name="F.10.3.3" href="#F.10.3.3">F.10.3.3 The expm1 functions</a></h5>
24627 <p><!--para 1 -->
24628 <ul>
24629 <li> expm1((+-)0) returns (+-)0.
24630 <li> expm1(-(inf)) returns -1.
24631 <li> expm1(+(inf)) returns +(inf).
24632 </ul>
24634 <h5><a name="F.10.3.4" href="#F.10.3.4">F.10.3.4 The frexp functions</a></h5>
24635 <p><!--para 1 -->
24636 <ul>
24637 <li> frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
24638 <li> frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
24639 pointed to by exp.
24640 <li> frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
24641 (and returns a NaN).
24642 </ul>
24643 <p><!--para 2 -->
24644 frexp raises no floating-point exceptions.
24645 <p><!--para 3 -->
24646 When the radix of the argument is a power of 2, the returned value is exact and is
24647 independent of the current rounding direction mode.
24648 <p><!--para 4 -->
24649 On a binary system, the body of the frexp function might be
24650 <pre>
24652 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
24653 return scalbn(value, -(*exp));
24654 }</pre>
24656 <h5><a name="F.10.3.5" href="#F.10.3.5">F.10.3.5 The ilogb functions</a></h5>
24657 <p><!--para 1 -->
24658 When the correct result is representable in the range of the return type, the returned value
24659 is exact and is independent of the current rounding direction mode.
24660 <p><!--para 2 -->
24661 If the correct result is outside the range of the return type, the numeric result is
24662 unspecified and the ''invalid'' floating-point exception is raised.
24663 <!--page 536 -->
24665 <h5><a name="F.10.3.6" href="#F.10.3.6">F.10.3.6 The ldexp functions</a></h5>
24666 <p><!--para 1 -->
24667 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
24669 <h5><a name="F.10.3.7" href="#F.10.3.7">F.10.3.7 The log functions</a></h5>
24670 <p><!--para 1 -->
24671 <ul>
24672 <li> log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
24673 <li> log(1) returns +0.
24674 <li> log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
24675 <li> log(+(inf)) returns +(inf).
24676 </ul>
24678 <h5><a name="F.10.3.8" href="#F.10.3.8">F.10.3.8 The log10 functions</a></h5>
24679 <p><!--para 1 -->
24680 <ul>
24681 <li> log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
24682 <li> log10(1) returns +0.
24683 <li> log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
24684 <li> log10(+(inf)) returns +(inf).
24685 </ul>
24687 <h5><a name="F.10.3.9" href="#F.10.3.9">F.10.3.9 The log1p functions</a></h5>
24688 <p><!--para 1 -->
24689 <ul>
24690 <li> log1p((+-)0) returns (+-)0.
24691 <li> log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
24692 <li> log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
24693 x &lt; -1.
24694 <li> log1p(+(inf)) returns +(inf).
24695 </ul>
24697 <h5><a name="F.10.3.10" href="#F.10.3.10">F.10.3.10 The log2 functions</a></h5>
24698 <p><!--para 1 -->
24699 <ul>
24700 <li> log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
24701 <li> log2(1) returns +0.
24702 <li> log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
24703 <li> log2(+(inf)) returns +(inf).
24704 </ul>
24706 <h5><a name="F.10.3.11" href="#F.10.3.11">F.10.3.11 The logb functions</a></h5>
24707 <p><!--para 1 -->
24708 <ul>
24709 <li> logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
24710 <li> logb((+-)(inf)) returns +(inf).
24711 </ul>
24712 <p><!--para 2 -->
24713 The returned value is exact and is independent of the current rounding direction mode.
24714 <!--page 537 -->
24716 <h5><a name="F.10.3.12" href="#F.10.3.12">F.10.3.12 The modf functions</a></h5>
24717 <p><!--para 1 -->
24718 <ul>
24719 <li> modf((+-)x, iptr) returns a result with the same sign as x.
24720 <li> modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
24721 <li> modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
24722 NaN).
24723 </ul>
24724 <p><!--para 2 -->
24725 The returned values are exact and are independent of the current rounding direction
24726 mode.
24727 <p><!--para 3 -->
24728 modf behaves as though implemented by
24729 <pre>
24730 #include <a href="#7.12">&lt;math.h&gt;</a>
24731 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24732 #pragma STDC FENV_ACCESS ON
24733 double modf(double value, double *iptr)
24735 int save_round = fegetround();
24736 fesetround(FE_TOWARDZERO);
24737 *iptr = nearbyint(value);
24738 fesetround(save_round);
24739 return copysign(
24740 isinf(value) ? 0.0 :
24741 value - (*iptr), value);
24742 }</pre>
24744 <h5><a name="F.10.3.13" href="#F.10.3.13">F.10.3.13 The scalbn and scalbln functions</a></h5>
24745 <p><!--para 1 -->
24746 <ul>
24747 <li> scalbn((+-)0, n) returns (+-)0.
24748 <li> scalbn(x, 0) returns x.
24749 <li> scalbn((+-)(inf), n) returns (+-)(inf).
24750 </ul>
24751 <p><!--para 2 -->
24752 If the calculation does not overflow or underflow, the returned value is exact and
24753 independent of the current rounding direction mode.
24754 <!--page 538 -->
24756 <h4><a name="F.10.4" href="#F.10.4">F.10.4 Power and absolute value functions</a></h4>
24758 <h5><a name="F.10.4.1" href="#F.10.4.1">F.10.4.1 The cbrt functions</a></h5>
24759 <p><!--para 1 -->
24760 <ul>
24761 <li> cbrt((+-)0) returns (+-)0.
24762 <li> cbrt((+-)(inf)) returns (+-)(inf).
24763 </ul>
24765 <h5><a name="F.10.4.2" href="#F.10.4.2">F.10.4.2 The fabs functions</a></h5>
24766 <p><!--para 1 -->
24767 <ul>
24768 <li> fabs((+-)0) returns +0.
24769 <li> fabs((+-)(inf)) returns +(inf).
24770 </ul>
24771 <p><!--para 2 -->
24772 The returned value is exact and is independent of the current rounding direction mode.
24774 <h5><a name="F.10.4.3" href="#F.10.4.3">F.10.4.3 The hypot functions</a></h5>
24775 <p><!--para 1 -->
24776 <ul>
24777 <li> hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
24778 <li> hypot(x, (+-)0) is equivalent to fabs(x).
24779 <li> hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
24780 </ul>
24782 <h5><a name="F.10.4.4" href="#F.10.4.4">F.10.4.4 The pow functions</a></h5>
24783 <p><!--para 1 -->
24784 <ul>
24785 <li> pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
24786 for y an odd integer &lt; 0.
24787 <li> pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
24788 for y &lt; 0, finite, and not an odd integer.
24789 <li> pow((+-)0, -(inf)) returns +(inf) and may raise the ''divide-by-zero'' floating-point
24790 exception.
24791 <li> pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
24792 <li> pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
24793 <li> pow(-1, (+-)(inf)) returns 1.
24794 <li> pow(+1, y) returns 1 for any y, even a NaN.
24795 <li> pow(x, (+-)0) returns 1 for any x, even a NaN.
24796 <li> pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
24797 finite x &lt; 0 and finite non-integer y.
24798 <li> pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
24799 <li> pow(x, -(inf)) returns +0 for | x | &gt; 1.
24800 <li> pow(x, +(inf)) returns +0 for | x | &lt; 1.
24801 <li> pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
24802 <!--page 539 -->
24803 <li> pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
24804 <li> pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
24805 <li> pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
24806 <li> pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
24807 <li> pow(+(inf), y) returns +0 for y &lt; 0.
24808 <li> pow(+(inf), y) returns +(inf) for y &gt; 0.
24809 </ul>
24811 <h5><a name="F.10.4.5" href="#F.10.4.5">F.10.4.5 The sqrt functions</a></h5>
24812 <p><!--para 1 -->
24813 sqrt is fully specified as a basic arithmetic operation in IEC 60559. The returned value
24814 is dependent on the current rounding direction mode.
24816 <h4><a name="F.10.5" href="#F.10.5">F.10.5 Error and gamma functions</a></h4>
24818 <h5><a name="F.10.5.1" href="#F.10.5.1">F.10.5.1 The erf functions</a></h5>
24819 <p><!--para 1 -->
24820 <ul>
24821 <li> erf((+-)0) returns (+-)0.
24822 <li> erf((+-)(inf)) returns (+-)1.
24823 </ul>
24825 <h5><a name="F.10.5.2" href="#F.10.5.2">F.10.5.2 The erfc functions</a></h5>
24826 <p><!--para 1 -->
24827 <ul>
24828 <li> erfc(-(inf)) returns 2.
24829 <li> erfc(+(inf)) returns +0.
24830 </ul>
24832 <h5><a name="F.10.5.3" href="#F.10.5.3">F.10.5.3 The lgamma functions</a></h5>
24833 <p><!--para 1 -->
24834 <ul>
24835 <li> lgamma(1) returns +0.
24836 <li> lgamma(2) returns +0.
24837 <li> lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
24838 x a negative integer or zero.
24839 <li> lgamma(-(inf)) returns +(inf).
24840 <li> lgamma(+(inf)) returns +(inf).
24841 </ul>
24843 <h5><a name="F.10.5.4" href="#F.10.5.4">F.10.5.4 The tgamma functions</a></h5>
24844 <p><!--para 1 -->
24845 <ul>
24846 <li> tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
24847 <li> tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
24848 negative integer.
24849 <li> tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
24850 <li> tgamma(+(inf)) returns +(inf).
24851 <!--page 540 -->
24852 </ul>
24854 <h4><a name="F.10.6" href="#F.10.6">F.10.6 Nearest integer functions</a></h4>
24856 <h5><a name="F.10.6.1" href="#F.10.6.1">F.10.6.1 The ceil functions</a></h5>
24857 <p><!--para 1 -->
24858 <ul>
24859 <li> ceil((+-)0) returns (+-)0.
24860 <li> ceil((+-)(inf)) returns (+-)(inf).
24861 </ul>
24862 <p><!--para 2 -->
24863 The returned value is independent of the current rounding direction mode.
24864 <p><!--para 3 -->
24865 The double version of ceil behaves as though implemented by
24866 <p><!--para 4 -->
24867 <pre>
24868 #include <a href="#7.12">&lt;math.h&gt;</a>
24869 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24870 #pragma STDC FENV_ACCESS ON
24871 double ceil(double x)
24873 double result;
24874 int save_round = fegetround();
24875 fesetround(FE_UPWARD);
24876 result = rint(x); // or nearbyint instead of rint
24877 fesetround(save_round);
24878 return result;
24879 }</pre>
24880 The ceil functions may, but are not required to, raise the ''inexact'' floating-point
24881 exception for finite non-integer arguments, as this implementation does.
24883 <h5><a name="F.10.6.2" href="#F.10.6.2">F.10.6.2 The floor functions</a></h5>
24884 <p><!--para 1 -->
24885 <ul>
24886 <li> floor((+-)0) returns (+-)0.
24887 <li> floor((+-)(inf)) returns (+-)(inf).
24888 </ul>
24889 <p><!--para 2 -->
24890 The returned value and is independent of the current rounding direction mode.
24891 <p><!--para 3 -->
24892 See the sample implementation for ceil in <a href="#F.10.6.1">F.10.6.1</a>. The floor functions may, but are
24893 not required to, raise the ''inexact'' floating-point exception for finite non-integer
24894 arguments, as that implementation does.
24896 <h5><a name="F.10.6.3" href="#F.10.6.3">F.10.6.3 The nearbyint functions</a></h5>
24897 <p><!--para 1 -->
24898 The nearbyint functions use IEC 60559 rounding according to the current rounding
24899 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
24900 value from the argument.
24901 <ul>
24902 <li> nearbyint((+-)0) returns (+-)0 (for all rounding directions).
24903 <li> nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
24904 <!--page 541 -->
24905 </ul>
24907 <h5><a name="F.10.6.4" href="#F.10.6.4">F.10.6.4 The rint functions</a></h5>
24908 <p><!--para 1 -->
24909 The rint functions differ from the nearbyint functions only in that they do raise the
24910 ''inexact'' floating-point exception if the result differs in value from the argument.
24912 <h5><a name="F.10.6.5" href="#F.10.6.5">F.10.6.5 The lrint and llrint functions</a></h5>
24913 <p><!--para 1 -->
24914 The lrint and llrint functions provide floating-to-integer conversion as prescribed
24915 by IEC 60559. They round according to the current rounding direction. If the rounded
24916 value is outside the range of the return type, the numeric result is unspecified and the
24917 ''invalid'' floating-point exception is raised. When they raise no other floating-point
24918 exception and the result differs from the argument, they raise the ''inexact'' floating-point
24919 exception.
24921 <h5><a name="F.10.6.6" href="#F.10.6.6">F.10.6.6 The round functions</a></h5>
24922 <p><!--para 1 -->
24923 <ul>
24924 <li> round((+-)0) returns (+-)0.
24925 <li> round((+-)(inf)) returns (+-)(inf).
24926 </ul>
24927 <p><!--para 2 -->
24928 The returned value is independent of the current rounding direction mode.
24929 <p><!--para 3 -->
24930 The double version of round behaves as though implemented by
24931 <pre>
24932 #include <a href="#7.12">&lt;math.h&gt;</a>
24933 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24934 #pragma STDC FENV_ACCESS ON
24935 double round(double x)
24937 double result;
24938 fenv_t save_env;
24939 feholdexcept(&amp;save_env);
24940 result = rint(x);
24941 if (fetestexcept(FE_INEXACT)) {
24942 fesetround(FE_TOWARDZERO);
24943 result = rint(copysign(0.5 + fabs(x), x));
24945 feupdateenv(&amp;save_env);
24946 return result;
24947 }</pre>
24948 The round functions may, but are not required to, raise the ''inexact'' floating-point
24949 exception for finite non-integer numeric arguments, as this implementation does.
24950 <!--page 542 -->
24952 <h5><a name="F.10.6.7" href="#F.10.6.7">F.10.6.7 The lround and llround functions</a></h5>
24953 <p><!--para 1 -->
24954 The lround and llround functions differ from the lrint and llrint functions
24955 with the default rounding direction just in that the lround and llround functions
24956 round halfway cases away from zero and need not raise the ''inexact'' floating-point
24957 exception for non-integer arguments that round to within the range of the return type.
24959 <h5><a name="F.10.6.8" href="#F.10.6.8">F.10.6.8 The trunc functions</a></h5>
24960 <p><!--para 1 -->
24961 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
24962 rounding direction). The returned value is exact.
24963 <ul>
24964 <li> trunc((+-)0) returns (+-)0.
24965 <li> trunc((+-)(inf)) returns (+-)(inf).
24966 </ul>
24967 <p><!--para 2 -->
24968 The returned value is independent of the current rounding direction mode. The trunc
24969 functions may, but are not required to, raise the ''inexact'' floating-point exception for
24970 finite non-integer arguments.
24972 <h4><a name="F.10.7" href="#F.10.7">F.10.7 Remainder functions</a></h4>
24974 <h5><a name="F.10.7.1" href="#F.10.7.1">F.10.7.1 The fmod functions</a></h5>
24975 <p><!--para 1 -->
24976 <ul>
24977 <li> fmod((+-)0, y) returns (+-)0 for y not zero.
24978 <li> fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
24979 infinite or y zero (and neither is a NaN).
24980 <li> fmod(x, (+-)(inf)) returns x for x not infinite.
24981 </ul>
24982 <p><!--para 2 -->
24983 When subnormal results are supported, the returned value is exact and is independent of
24984 the current rounding direction mode.
24985 <p><!--para 3 -->
24986 The double version of fmod behaves as though implemented by
24987 <!--page 543 -->
24988 <pre>
24989 #include <a href="#7.12">&lt;math.h&gt;</a>
24990 #include <a href="#7.6">&lt;fenv.h&gt;</a>
24991 #pragma STDC FENV_ACCESS ON
24992 double fmod(double x, double y)
24994 double result;
24995 result = remainder(fabs(x), (y = fabs(y)));
24996 if (signbit(result)) result += y;
24997 return copysign(result, x);
24998 }</pre>
25000 <h5><a name="F.10.7.2" href="#F.10.7.2">F.10.7.2 The remainder functions</a></h5>
25001 <p><!--para 1 -->
25002 The remainder functions are fully specified as a basic arithmetic operation in
25003 IEC 60559.
25004 <p><!--para 2 -->
25005 When subnormal results are supported, the returned value is exact and is independent of
25006 the current rounding direction mode.
25008 <h5><a name="F.10.7.3" href="#F.10.7.3">F.10.7.3 The remquo functions</a></h5>
25009 <p><!--para 1 -->
25010 The remquo functions follow the specifications for the remainder functions. They
25011 have no further specifications special to IEC 60559 implementations.
25012 <p><!--para 2 -->
25013 When subnormal results are supported, the returned value is exact and is independent of
25014 the current rounding direction mode.
25016 <h4><a name="F.10.8" href="#F.10.8">F.10.8 Manipulation functions</a></h4>
25018 <h5><a name="F.10.8.1" href="#F.10.8.1">F.10.8.1 The copysign functions</a></h5>
25019 <p><!--para 1 -->
25020 copysign is specified in the Appendix to IEC 60559.
25021 <p><!--para 2 -->
25022 The returned value is exact and is independent of the current rounding direction mode.
25024 <h5><a name="F.10.8.2" href="#F.10.8.2">F.10.8.2 The nan functions</a></h5>
25025 <p><!--para 1 -->
25026 All IEC 60559 implementations support quiet NaNs, in all floating formats.
25027 <p><!--para 2 -->
25028 The returned value is exact and is independent of the current rounding direction mode.
25030 <h5><a name="F.10.8.3" href="#F.10.8.3">F.10.8.3 The nextafter functions</a></h5>
25031 <p><!--para 1 -->
25032 <ul>
25033 <li> nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
25034 for x finite and the function value infinite.
25035 <li> nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
25036 exceptions for the function value subnormal or zero and x != y.
25037 </ul>
25038 <p><!--para 2 -->
25039 Even though underflow or overflow can occur, the returned value is independent of the
25040 current rounding direction mode.
25042 <h5><a name="F.10.8.4" href="#F.10.8.4">F.10.8.4 The nexttoward functions</a></h5>
25043 <p><!--para 1 -->
25044 No additional requirements beyond those on nextafter.
25045 <p><!--para 2 -->
25046 Even though underflow or overflow can occur, the returned value is independent of the
25047 current rounding direction mode.
25048 <!--page 544 -->
25050 <h4><a name="F.10.9" href="#F.10.9">F.10.9 Maximum, minimum, and positive difference functions</a></h4>
25052 <h5><a name="F.10.9.1" href="#F.10.9.1">F.10.9.1 The fdim functions</a></h5>
25053 <p><!--para 1 -->
25054 No additional requirements.
25056 <h5><a name="F.10.9.2" href="#F.10.9.2">F.10.9.2 The fmax functions</a></h5>
25057 <p><!--para 1 -->
25058 If just one argument is a NaN, the fmax functions return the other argument (if both
25059 arguments are NaNs, the functions return a NaN).
25060 <p><!--para 2 -->
25061 The returned value is exact and is independent of the current rounding direction mode.
25062 <p><!--para 3 -->
25063 The body of the fmax function might be<sup><a href="#note361"><b>361)</b></a></sup>
25064 <pre>
25065 { return (isgreaterequal(x, y) ||
25066 isnan(y)) ? x : y; }</pre>
25068 <h6>footnotes</h6>
25069 <p><small><a name="note361" href="#note361">361)</a> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
25070 return +0; however, implementation in software might be impractical.
25071 </small>
25073 <h5><a name="F.10.9.3" href="#F.10.9.3">F.10.9.3 The fmin functions</a></h5>
25074 <p><!--para 1 -->
25075 The fmin functions are analogous to the fmax functions (see <a href="#F.10.9.2">F.10.9.2</a>).
25076 <p><!--para 2 -->
25077 The returned value is exact and is independent of the current rounding direction mode.
25079 <h4><a name="F.10.10" href="#F.10.10">F.10.10 Floating multiply-add</a></h4>
25081 <h5><a name="F.10.10.1" href="#F.10.10.1">F.10.10.1 The fma functions</a></h5>
25082 <p><!--para 1 -->
25083 <ul>
25084 <li> fma(x, y, z) computes xy + z, correctly rounded once.
25085 <li> fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
25086 exception if one of x and y is infinite, the other is zero, and z is a NaN.
25087 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
25088 one of x and y is infinite, the other is zero, and z is not a NaN.
25089 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
25090 times y is an exact infinity and z is also an infinity but with the opposite sign.
25095 <!--page 545 -->
25096 </ul>
25098 <h4><a name="F.10.11" href="#F.10.11">F.10.11 Comparison macros</a></h4>
25099 <p><!--para 1 -->
25100 Relational operators and their corresponding comparison macros (<a href="#7.12.14">7.12.14</a>) produce
25101 equivalent result values, even if argument values are represented in wider formats. Thus,
25102 comparison macro arguments represented in formats wider than their semantic types are
25103 not converted to the semantic types, unless the wide evaluation method converts operands
25104 of relational operators to their semantic types. The standard wide evaluation methods
25105 characterized by FLT_EVAL_METHOD equal to 1 or 2 (<a href="#5.2.4.2.2">5.2.4.2.2</a>), do not convert
25106 operands of relational operators to their semantic types.
25107 <!--page 546 -->
25109 <h2><a name="G" href="#G">Annex G</a></h2>
25110 <pre>
25111 (normative)
25112 IEC 60559-compatible complex arithmetic</pre>
25114 <h3><a name="G.1" href="#G.1">G.1 Introduction</a></h3>
25115 <p><!--para 1 -->
25116 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
25117 IEC 60559 real floating-point arithmetic. An implementation that defines *
25118 __STDC_IEC_559_COMPLEX__ shall conform to the specifications in this annex.<sup><a href="#note362"><b>362)</b></a></sup>
25120 <h6>footnotes</h6>
25121 <p><small><a name="note362" href="#note362">362)</a> Implementations that do not define __STDC_IEC_559_COMPLEX__ are not required to conform
25122 to these specifications.
25123 </small>
25125 <h3><a name="G.2" href="#G.2">G.2 Types</a></h3>
25126 <p><!--para 1 -->
25127 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
25128 used as a type specifier within declaration specifiers in the same way as _Complex is
25129 (thus, _Imaginary float is a valid type name).
25130 <p><!--para 2 -->
25131 There are three imaginary types, designated as float _Imaginary, double
25132 _Imaginary, and long double _Imaginary. The imaginary types (along with
25133 the real floating and complex types) are floating types.
25134 <p><!--para 3 -->
25135 For imaginary types, the corresponding real type is given by deleting the keyword
25136 _Imaginary from the type name.
25137 <p><!--para 4 -->
25138 Each imaginary type has the same representation and alignment requirements as the
25139 corresponding real type. The value of an object of imaginary type is the value of the real
25140 representation times the imaginary unit.
25141 <p><!--para 5 -->
25142 The imaginary type domain comprises the imaginary types.
25144 <h3><a name="G.3" href="#G.3">G.3 Conventions</a></h3>
25145 <p><!--para 1 -->
25146 A complex or imaginary value with at least one infinite part is regarded as an infinity
25147 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
25148 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
25149 a zero if each of its parts is a zero.
25154 <!--page 547 -->
25156 <h3><a name="G.4" href="#G.4">G.4 Conversions</a></h3>
25158 <h4><a name="G.4.1" href="#G.4.1">G.4.1 Imaginary types</a></h4>
25159 <p><!--para 1 -->
25160 Conversions among imaginary types follow rules analogous to those for real floating
25161 types.
25163 <h4><a name="G.4.2" href="#G.4.2">G.4.2 Real and imaginary</a></h4>
25164 <p><!--para 1 -->
25165 When a value of imaginary type is converted to a real type other than _Bool,<sup><a href="#note363"><b>363)</b></a></sup> the
25166 result is a positive zero.
25167 <p><!--para 2 -->
25168 When a value of real type is converted to an imaginary type, the result is a positive
25169 imaginary zero.
25171 <h6>footnotes</h6>
25172 <p><small><a name="note363" href="#note363">363)</a> See <a href="#6.3.1.2">6.3.1.2</a>.
25173 </small>
25175 <h4><a name="G.4.3" href="#G.4.3">G.4.3 Imaginary and complex</a></h4>
25176 <p><!--para 1 -->
25177 When a value of imaginary type is converted to a complex type, the real part of the
25178 complex result value is a positive zero and the imaginary part of the complex result value
25179 is determined by the conversion rules for the corresponding real types.
25180 <p><!--para 2 -->
25181 When a value of complex type is converted to an imaginary type, the real part of the
25182 complex value is discarded and the value of the imaginary part is converted according to
25183 the conversion rules for the corresponding real types.
25185 <h3><a name="G.5" href="#G.5">G.5 Binary operators</a></h3>
25186 <p><!--para 1 -->
25187 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
25188 operation with an imaginary operand.
25189 <p><!--para 2 -->
25190 For most operand types, the value of the result of a binary operator with an imaginary or
25191 complex operand is completely determined, with reference to real arithmetic, by the usual
25192 mathematical formula. For some operand types, the usual mathematical formula is
25193 problematic because of its treatment of infinities and because of undue overflow or
25194 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
25195 not completely determined.
25200 <!--page 548 -->
25202 <h4><a name="G.5.1" href="#G.5.1">G.5.1 Multiplicative operators</a></h4>
25203 <h6>Semantics</h6>
25204 <p><!--para 1 -->
25205 If one operand has real type and the other operand has imaginary type, then the result has
25206 imaginary type. If both operands have imaginary type, then the result has real type. (If
25207 either operand has complex type, then the result has complex type.)
25208 <p><!--para 2 -->
25209 If the operands are not both complex, then the result and floating-point exception
25210 behavior of the * operator is defined by the usual mathematical formula:
25211 <pre>
25212 * u iv u + iv</pre>
25214 <pre>
25215 x xu i(xv) (xu) + i(xv)</pre>
25217 <pre>
25218 iy i(yu) -yv (-yv) + i(yu)</pre>
25220 <p><!--para 3 -->
25221 <pre>
25222 x + iy (xu) + i(yu) (-yv) + i(xv)</pre>
25223 If the second operand is not complex, then the result and floating-point exception
25224 behavior of the / operator is defined by the usual mathematical formula:
25225 <pre>
25226 / u iv</pre>
25228 <pre>
25229 x x/u i(-x/v)</pre>
25231 <pre>
25232 iy i(y/u) y/v</pre>
25234 <p><!--para 4 -->
25235 <pre>
25236 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)</pre>
25237 The * and / operators satisfy the following infinity properties for all real, imaginary, and
25238 complex operands:<sup><a href="#note364"><b>364)</b></a></sup>
25239 <ul>
25240 <li> if one operand is an infinity and the other operand is a nonzero finite number or an
25241 infinity, then the result of the * operator is an infinity;
25242 <li> if the first operand is an infinity and the second operand is a finite number, then the
25243 result of the / operator is an infinity;
25244 <li> if the first operand is a finite number and the second operand is an infinity, then the
25245 result of the / operator is a zero;
25250 <!--page 549 -->
25251 <li> if the first operand is a nonzero finite number or an infinity and the second operand is
25252 a zero, then the result of the / operator is an infinity.
25253 </ul>
25254 <p><!--para 5 -->
25255 If both operands of the * operator are complex or if the second operand of the / operator
25256 is complex, the operator raises floating-point exceptions if appropriate for the calculation
25257 of the parts of the result, and may raise spurious floating-point exceptions.
25258 <p><!--para 6 -->
25259 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
25260 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
25261 <!--page 550 -->
25262 <p><!--para 7 -->
25263 <pre>
25264 #include <a href="#7.12">&lt;math.h&gt;</a>
25265 #include <a href="#7.3">&lt;complex.h&gt;</a>
25266 /* Multiply z * w ... */
25267 double complex _Cmultd(double complex z, double complex w)
25269 #pragma STDC FP_CONTRACT OFF
25270 double a, b, c, d, ac, bd, ad, bc, x, y;
25271 a = creal(z); b = cimag(z);
25272 c = creal(w); d = cimag(w);
25273 ac = a * c; bd = b * d;
25274 ad = a * d; bc = b * c;
25275 x = ac - bd; y = ad + bc;
25276 if (isnan(x) &amp;&amp; isnan(y)) {
25277 /* Recover infinities that computed as NaN+iNaN ... */
25278 int recalc = 0;
25279 if ( isinf(a) || isinf(b) ) { // z is infinite
25280 /* "Box" the infinity and change NaNs in the other factor to 0 */
25281 a = copysign(isinf(a) ? 1.0 : 0.0, a);
25282 b = copysign(isinf(b) ? 1.0 : 0.0, b);
25283 if (isnan(c)) c = copysign(0.0, c);
25284 if (isnan(d)) d = copysign(0.0, d);
25285 recalc = 1;
25287 if ( isinf(c) || isinf(d) ) { // w is infinite
25288 /* "Box" the infinity and change NaNs in the other factor to 0 */
25289 c = copysign(isinf(c) ? 1.0 : 0.0, c);
25290 d = copysign(isinf(d) ? 1.0 : 0.0, d);
25291 if (isnan(a)) a = copysign(0.0, a);
25292 if (isnan(b)) b = copysign(0.0, b);
25293 recalc = 1;
25295 if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
25296 isinf(ad) || isinf(bc))) {
25297 /* Recover infinities from overflow by changing NaNs to 0 ... */
25298 if (isnan(a)) a = copysign(0.0, a);
25299 if (isnan(b)) b = copysign(0.0, b);
25300 if (isnan(c)) c = copysign(0.0, c);
25301 if (isnan(d)) d = copysign(0.0, d);
25302 recalc = 1;
25304 if (recalc) {
25305 x = INFINITY * ( a * c - b * d );
25306 y = INFINITY * ( a * d + b * c );
25309 return x + I * y;
25310 }</pre>
25311 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
25312 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
25314 <p><!--para 8 -->
25315 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
25316 <!--page 551 -->
25317 <p><!--para 9 -->
25318 <pre>
25319 #include <a href="#7.12">&lt;math.h&gt;</a>
25320 #include <a href="#7.3">&lt;complex.h&gt;</a>
25321 /* Divide z / w ... */
25322 double complex _Cdivd(double complex z, double complex w)
25324 #pragma STDC FP_CONTRACT OFF
25325 double a, b, c, d, logbw, denom, x, y;
25326 int ilogbw = 0;
25327 a = creal(z); b = cimag(z);
25328 c = creal(w); d = cimag(w);
25329 logbw = logb(fmax(fabs(c), fabs(d)));
25330 if (logbw == INFINITY) {
25331 ilogbw = (int)logbw;
25332 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
25334 denom = c * c + d * d;
25335 x = scalbn((a * c + b * d) / denom, -ilogbw);
25336 y = scalbn((b * c - a * d) / denom, -ilogbw);
25337 /* Recover infinities and zeros that computed as NaN+iNaN; */
25338 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
25339 if (isnan(x) &amp;&amp; isnan(y)) {
25340 if ((denom == 0.0) &amp;&amp;
25341 (!isnan(a) || !isnan(b))) {
25342 x = copysign(INFINITY, c) * a;
25343 y = copysign(INFINITY, c) * b;
25345 else if ((isinf(a) || isinf(b)) &amp;&amp;
25346 isfinite(c) &amp;&amp; isfinite(d)) {
25347 a = copysign(isinf(a) ? 1.0 : 0.0, a);
25348 b = copysign(isinf(b) ? 1.0 : 0.0, b);
25349 x = INFINITY * ( a * c + b * d );
25350 y = INFINITY * ( b * c - a * d );
25352 else if (isinf(logbw) &amp;&amp;
25353 isfinite(a) &amp;&amp; isfinite(b)) {
25354 c = copysign(isinf(c) ? 1.0 : 0.0, c);
25355 d = copysign(isinf(d) ? 1.0 : 0.0, d);
25356 x = 0.0 * ( a * c + b * d );
25357 y = 0.0 * ( b * c - a * d );
25360 return x + I * y;
25361 }</pre>
25362 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
25363 for multiplication. In the spirit of the multiplication example above, this code does not defend against
25364 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
25365 with division, provides better roundoff characteristics.
25368 <h6>footnotes</h6>
25369 <p><small><a name="note364" href="#note364">364)</a> These properties are already implied for those cases covered in the tables, but are required for all cases
25370 (at least where the state for CX_LIMITED_RANGE is ''off'').
25371 </small>
25373 <h4><a name="G.5.2" href="#G.5.2">G.5.2 Additive operators</a></h4>
25374 <h6>Semantics</h6>
25375 <p><!--para 1 -->
25376 If both operands have imaginary type, then the result has imaginary type. (If one operand
25377 has real type and the other operand has imaginary type, or if either operand has complex
25378 type, then the result has complex type.)
25379 <p><!--para 2 -->
25380 In all cases the result and floating-point exception behavior of a + or - operator is defined
25381 by the usual mathematical formula:
25382 <pre>
25383 + or - u iv u + iv</pre>
25385 <pre>
25386 x x(+-)u x (+-) iv (x (+-) u) (+-) iv</pre>
25388 <pre>
25389 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)</pre>
25391 <pre>
25392 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)</pre>
25394 <h3><a name="G.6" href="#G.6">G.6 Complex arithmetic <complex.h></a></h3>
25395 <p><!--para 1 -->
25396 The macros
25397 <pre>
25398 imaginary</pre>
25400 <pre>
25401 _Imaginary_I</pre>
25402 are defined, respectively, as _Imaginary and a constant expression of type const
25403 float _Imaginary with the value of the imaginary unit. The macro
25404 <pre>
25405 I</pre>
25406 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
25407 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
25408 imaginary.
25409 <p><!--para 2 -->
25410 This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
25411 particularly suited to IEC 60559 implementations. For families of functions, the
25412 specifications apply to all of the functions even though only the principal function is
25413 <!--page 552 -->
25414 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
25415 and the result, the result has the same sign as the argument.
25416 <p><!--para 3 -->
25417 The functions are continuous onto both sides of their branch cuts, taking into account the
25418 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)2. -
25419 <p><!--para 4 -->
25420 Since complex and imaginary values are composed of real values, each function may be
25421 regarded as computing real values from real values. Except as noted, the functions treat
25422 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
25423 manner consistent with the specifications for real functions in F.10.<sup><a href="#note365"><b>365)</b></a></sup>
25424 <p><!--para 5 -->
25425 The functions cimag, conj, cproj, and creal are fully specified for all
25426 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
25427 point exceptions.
25428 <p><!--para 6 -->
25429 Each of the functions cabs and carg is specified by a formula in terms of a real
25430 function (whose special cases are covered in <a href="#F">annex F</a>):
25431 <p><!--para 7 -->
25432 <pre>
25433 cabs(x + iy) = hypot(x, y)
25434 carg(x + iy) = atan2(y, x)</pre>
25435 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
25436 a formula in terms of other complex functions (whose special cases are specified below):
25437 <p><!--para 8 -->
25438 <pre>
25439 casin(z) = -i casinh(iz)
25440 catan(z) = -i catanh(iz)
25441 ccos(z) = ccosh(iz)
25442 csin(z) = -i csinh(iz)
25443 ctan(z) = -i ctanh(iz)</pre>
25444 For the other functions, the following subclauses specify behavior for special cases,
25445 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
25446 families of functions, the specifications apply to all of the functions even though only the
25447 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
25448 specifications for the upper half-plane imply the specifications for the lower half-plane; if
25449 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
25450 specifications for the first quadrant imply the specifications for the other three quadrants.
25451 <p><!--para 9 -->
25452 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
25457 <!--page 553 -->
25459 <h6>footnotes</h6>
25460 <p><small><a name="note365" href="#note365">365)</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
25461 other part is a NaN.
25462 </small>
25464 <h4><a name="G.6.1" href="#G.6.1">G.6.1 Trigonometric functions</a></h4>
25466 <h5><a name="G.6.1.1" href="#G.6.1.1">G.6.1.1 The cacos functions</a></h5>
25467 <p><!--para 1 -->
25468 <ul>
25469 <li> cacos(conj(z)) = conj(cacos(z)).
25470 <li> cacos((+-)0 + i0) returns pi /2 - i0.
25471 <li> cacos((+-)0 + iNaN) returns pi /2 + iNaN.
25472 <li> cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
25473 <li> cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25474 point exception, for nonzero finite x.
25475 <li> cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
25476 <li> cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
25477 <li> cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
25478 <li> cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
25479 <li> cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
25480 result is unspecified).
25481 <li> cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25482 point exception, for finite y.
25483 <li> cacos(NaN + i (inf)) returns NaN - i (inf).
25484 <li> cacos(NaN + iNaN) returns NaN + iNaN.
25485 </ul>
25487 <h4><a name="G.6.2" href="#G.6.2">G.6.2 Hyperbolic functions</a></h4>
25489 <h5><a name="G.6.2.1" href="#G.6.2.1">G.6.2.1 The cacosh functions</a></h5>
25490 <p><!--para 1 -->
25491 <ul>
25492 <li> cacosh(conj(z)) = conj(cacosh(z)).
25493 <li> cacosh((+-)0 + i0) returns +0 + ipi /2.
25494 <li> cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
25495 <li> cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
25496 floating-point exception, for finite x.
25497 <li> cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
25498 <li> cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
25499 <li> cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
25500 <li> cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
25501 <li> cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
25502 <!--page 554 -->
25503 <li> cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
25504 floating-point exception, for finite y.
25505 <li> cacosh(NaN + i (inf)) returns +(inf) + iNaN.
25506 <li> cacosh(NaN + iNaN) returns NaN + iNaN.
25507 </ul>
25509 <h5><a name="G.6.2.2" href="#G.6.2.2">G.6.2.2 The casinh functions</a></h5>
25510 <p><!--para 1 -->
25511 <ul>
25512 <li> casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
25513 <li> casinh(+0 + i0) returns 0 + i0.
25514 <li> casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
25515 <li> casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
25516 floating-point exception, for finite x.
25517 <li> casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
25518 <li> casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
25519 <li> casinh(+(inf) + iNaN) returns +(inf) + iNaN.
25520 <li> casinh(NaN + i0) returns NaN + i0.
25521 <li> casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
25522 floating-point exception, for finite nonzero y.
25523 <li> casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
25524 is unspecified).
25525 <li> casinh(NaN + iNaN) returns NaN + iNaN.
25526 </ul>
25528 <h5><a name="G.6.2.3" href="#G.6.2.3">G.6.2.3 The catanh functions</a></h5>
25529 <p><!--para 1 -->
25530 <ul>
25531 <li> catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
25532 <li> catanh(+0 + i0) returns +0 + i0.
25533 <li> catanh(+0 + iNaN) returns +0 + iNaN.
25534 <li> catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
25535 exception.
25536 <li> catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
25537 <li> catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
25538 floating-point exception, for nonzero finite x.
25539 <li> catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
25540 <li> catanh(+(inf) + i (inf)) returns +0 + ipi /2.
25541 <li> catanh(+(inf) + iNaN) returns +0 + iNaN.
25542 <!--page 555 -->
25543 <li> catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
25544 floating-point exception, for finite y.
25545 <li> catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
25546 unspecified).
25547 <li> catanh(NaN + iNaN) returns NaN + iNaN.
25548 </ul>
25550 <h5><a name="G.6.2.4" href="#G.6.2.4">G.6.2.4 The ccosh functions</a></h5>
25551 <p><!--para 1 -->
25552 <ul>
25553 <li> ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
25554 <li> ccosh(+0 + i0) returns 1 + i0.
25555 <li> ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
25556 result is unspecified) and raises the ''invalid'' floating-point exception.
25557 <li> ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
25558 result is unspecified).
25559 <li> ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
25560 exception, for finite nonzero x.
25561 <li> ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25562 point exception, for finite nonzero x.
25563 <li> ccosh(+(inf) + i0) returns +(inf) + i0.
25564 <li> ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
25565 <li> ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
25566 unspecified) and raises the ''invalid'' floating-point exception.
25567 <li> ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
25568 <li> ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
25569 result is unspecified).
25570 <li> ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25571 point exception, for all nonzero numbers y.
25572 <li> ccosh(NaN + iNaN) returns NaN + iNaN.
25573 </ul>
25575 <h5><a name="G.6.2.5" href="#G.6.2.5">G.6.2.5 The csinh functions</a></h5>
25576 <p><!--para 1 -->
25577 <ul>
25578 <li> csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
25579 <li> csinh(+0 + i0) returns +0 + i0.
25580 <li> csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
25581 unspecified) and raises the ''invalid'' floating-point exception.
25582 <li> csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
25583 unspecified).
25584 <!--page 556 -->
25585 <li> csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
25586 exception, for positive finite x.
25587 <li> csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25588 point exception, for finite nonzero x.
25589 <li> csinh(+(inf) + i0) returns +(inf) + i0.
25590 <li> csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
25591 <li> csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
25592 unspecified) and raises the ''invalid'' floating-point exception.
25593 <li> csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
25594 is unspecified).
25595 <li> csinh(NaN + i0) returns NaN + i0.
25596 <li> csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25597 point exception, for all nonzero numbers y.
25598 <li> csinh(NaN + iNaN) returns NaN + iNaN.
25599 </ul>
25601 <h5><a name="G.6.2.6" href="#G.6.2.6">G.6.2.6 The ctanh functions</a></h5>
25602 <p><!--para 1 -->
25603 <ul>
25604 <li> ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
25605 <li> ctanh(+0 + i0) returns +0 + i0.
25606 <li> ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
25607 exception, for finite x.
25608 <li> ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25609 point exception, for finite x.
25610 <li> ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
25611 <li> ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
25612 is unspecified).
25613 <li> ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
25614 result is unspecified).
25615 <li> ctanh(NaN + i0) returns NaN + i0.
25616 <li> ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25617 point exception, for all nonzero numbers y.
25618 <li> ctanh(NaN + iNaN) returns NaN + iNaN.
25619 <!--page 557 -->
25620 </ul>
25622 <h4><a name="G.6.3" href="#G.6.3">G.6.3 Exponential and logarithmic functions</a></h4>
25624 <h5><a name="G.6.3.1" href="#G.6.3.1">G.6.3.1 The cexp functions</a></h5>
25625 <p><!--para 1 -->
25626 <ul>
25627 <li> cexp(conj(z)) = conj(cexp(z)).
25628 <li> cexp((+-)0 + i0) returns 1 + i0.
25629 <li> cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
25630 exception, for finite x.
25631 <li> cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25632 point exception, for finite x.
25633 <li> cexp(+(inf) + i0) returns +(inf) + i0.
25634 <li> cexp(-(inf) + iy) returns +0 cis(y), for finite y.
25635 <li> cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
25636 <li> cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
25637 the result are unspecified).
25638 <li> cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
25639 exception (where the sign of the real part of the result is unspecified).
25640 <li> cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
25641 of the result are unspecified).
25642 <li> cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
25643 is unspecified).
25644 <li> cexp(NaN + i0) returns NaN + i0.
25645 <li> cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25646 point exception, for all nonzero numbers y.
25647 <li> cexp(NaN + iNaN) returns NaN + iNaN.
25648 </ul>
25650 <h5><a name="G.6.3.2" href="#G.6.3.2">G.6.3.2 The clog functions</a></h5>
25651 <p><!--para 1 -->
25652 <ul>
25653 <li> clog(conj(z)) = conj(clog(z)).
25654 <li> clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
25655 exception.
25656 <li> clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
25657 exception.
25658 <li> clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
25659 <li> clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25660 point exception, for finite x.
25661 <!--page 558 -->
25662 <li> clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
25663 <li> clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
25664 <li> clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
25665 <li> clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
25666 <li> clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
25667 <li> clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25668 point exception, for finite y.
25669 <li> clog(NaN + i (inf)) returns +(inf) + iNaN.
25670 <li> clog(NaN + iNaN) returns NaN + iNaN.
25671 </ul>
25673 <h4><a name="G.6.4" href="#G.6.4">G.6.4 Power and absolute-value functions</a></h4>
25675 <h5><a name="G.6.4.1" href="#G.6.4.1">G.6.4.1 The cpow functions</a></h5>
25676 <p><!--para 1 -->
25677 The cpow functions raise floating-point exceptions if appropriate for the calculation of
25678 the parts of the result, and may also raise spurious floating-point exceptions.<sup><a href="#note366"><b>366)</b></a></sup>
25680 <h6>footnotes</h6>
25681 <p><small><a name="note366" href="#note366">366)</a> This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
25682 implementations that treat special cases more carefully.
25683 </small>
25685 <h5><a name="G.6.4.2" href="#G.6.4.2">G.6.4.2 The csqrt functions</a></h5>
25686 <p><!--para 1 -->
25687 <ul>
25688 <li> csqrt(conj(z)) = conj(csqrt(z)).
25689 <li> csqrt((+-)0 + i0) returns +0 + i0.
25690 <li> csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
25691 <li> csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25692 point exception, for finite x.
25693 <li> csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
25694 <li> csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
25695 <li> csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
25696 result is unspecified).
25697 <li> csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
25698 <li> csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
25699 point exception, for finite y.
25700 <li> csqrt(NaN + iNaN) returns NaN + iNaN.
25705 <!--page 559 -->
25706 </ul>
25708 <h3><a name="G.7" href="#G.7">G.7 Type-generic math <tgmath.h></a></h3>
25709 <p><!--para 1 -->
25710 Type-generic macros that accept complex arguments also accept imaginary arguments. If
25711 an argument is imaginary, the macro expands to an expression whose type is real,
25712 imaginary, or complex, as appropriate for the particular function: if the argument is
25713 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
25714 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
25715 the types of the others are complex.
25716 <p><!--para 2 -->
25717 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
25718 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
25719 functions:
25720 <!--page 560 -->
25721 <pre>
25722 cos(iy) = cosh(y)
25723 sin(iy) = i sinh(y)
25724 tan(iy) = i tanh(y)
25725 cosh(iy) = cos(y)
25726 sinh(iy) = i sin(y)
25727 tanh(iy) = i tan(y)
25728 asin(iy) = i asinh(y)
25729 atan(iy) = i atanh(y)
25730 asinh(iy) = i asin(y)
25731 atanh(iy) = i atan(y)</pre>
25733 <h2><a name="H" href="#H">Annex H</a></h2>
25734 <pre>
25735 (informative)
25736 Language independent arithmetic</pre>
25738 <h3><a name="H.1" href="#H.1">H.1 Introduction</a></h3>
25739 <p><!--para 1 -->
25740 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
25741 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
25742 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
25744 <h3><a name="H.2" href="#H.2">H.2 Types</a></h3>
25745 <p><!--para 1 -->
25746 The relevant C arithmetic types meet the requirements of LIA-1 types if an
25747 implementation adds notification of exceptional arithmetic operations and meets the 1
25748 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
25750 <h4><a name="H.2.1" href="#H.2.1">H.2.1 Boolean type</a></h4>
25751 <p><!--para 1 -->
25752 The LIA-1 data type Boolean is implemented by the C data type bool with values of
25753 true and false, all from <a href="#7.18">&lt;stdbool.h&gt;</a>.
25755 <h4><a name="H.2.2" href="#H.2.2">H.2.2 Integer types</a></h4>
25756 <p><!--para 1 -->
25757 The signed C integer types int, long int, long long int, and the corresponding
25758 unsigned types are compatible with LIA-1. If an implementation adds support for the
25759 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
25760 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
25761 in that overflows or out-of-bounds results silently wrap. An implementation that defines
25762 signed integer types as also being modulo need not detect integer overflow, in which case,
25763 only integer divide-by-zero need be detected.
25764 <p><!--para 2 -->
25765 The parameters for the integer data types can be accessed by the following:
25766 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
25767 <pre>
25768 ULLONG_MAX</pre>
25769 minint INT_MIN, LONG_MIN, LLONG_MIN
25770 <p><!--para 3 -->
25771 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
25772 is always 0 for the unsigned types, and is not provided for those types.
25773 <!--page 561 -->
25775 <h5><a name="H.2.2.1" href="#H.2.2.1">H.2.2.1 Integer operations</a></h5>
25776 <p><!--para 1 -->
25777 The integer operations on integer types are the following:
25778 addI x + y
25779 subI x - y
25780 mulI x * y
25781 divI, divtI x / y
25782 remI, remtI x % y
25783 negI -x
25784 absI abs(x), labs(x), llabs(x)
25785 eqI x == y
25786 neqI x != y
25787 lssI x &lt; y
25788 leqI x &lt;= y
25789 gtrI x &gt; y
25790 geqI x &gt;= y
25791 where x and y are expressions of the same integer type.
25793 <h4><a name="H.2.3" href="#H.2.3">H.2.3 Floating-point types</a></h4>
25794 <p><!--para 1 -->
25795 The C floating-point types float, double, and long double are compatible with
25796 LIA-1. If an implementation adds support for the LIA-1 exceptional values
25797 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
25798 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
25799 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
25800 conformant types.
25802 <h5><a name="H.2.3.1" href="#H.2.3.1">H.2.3.1 Floating-point parameters</a></h5>
25803 <p><!--para 1 -->
25804 The parameters for a floating point data type can be accessed by the following:
25805 r FLT_RADIX
25806 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
25807 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
25808 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
25809 <p><!--para 2 -->
25810 The derived constants for the floating point types are accessed by the following:
25811 <!--page 562 -->
25812 fmax FLT_MAX, DBL_MAX, LDBL_MAX
25813 fminN FLT_MIN, DBL_MIN, LDBL_MIN
25814 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
25815 rnd_style FLT_ROUNDS
25817 <h5><a name="H.2.3.2" href="#H.2.3.2">H.2.3.2 Floating-point operations</a></h5>
25818 <p><!--para 1 -->
25819 The floating-point operations on floating-point types are the following:
25820 addF x + y
25821 subF x - y
25822 mulF x * y
25823 divF x / y
25824 negF -x
25825 absF fabsf(x), fabs(x), fabsl(x)
25826 exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
25827 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
25828 <pre>
25829 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)</pre>
25830 intpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
25831 fractpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
25832 eqF x == y
25833 neqF x != y
25834 lssF x &lt; y
25835 leqF x &lt;= y
25836 gtrF x &gt; y
25837 geqF x &gt;= y
25838 where x and y are expressions of the same floating point type, n is of type int, and li
25839 is of type long int.
25841 <h5><a name="H.2.3.3" href="#H.2.3.3">H.2.3.3 Rounding styles</a></h5>
25842 <p><!--para 1 -->
25843 The C Standard requires all floating types to use the same radix and rounding style, so
25844 that only one identifier for each is provided to map to LIA-1.
25845 <p><!--para 2 -->
25846 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
25847 truncate FLT_ROUNDS == 0
25848 <!--page 563 -->
25849 nearest FLT_ROUNDS == 1
25850 other FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
25851 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
25852 in all relevant LIA-1 operations, not just addition as in C.
25854 <h4><a name="H.2.4" href="#H.2.4">H.2.4 Type conversions</a></h4>
25855 <p><!--para 1 -->
25856 The LIA-1 type conversions are the following type casts:
25857 cvtI' -&gt; I (int)i, (long int)i, (long long int)i,
25858 <pre>
25859 (unsigned int)i, (unsigned long int)i,
25860 (unsigned long long int)i</pre>
25861 cvtF -&gt; I (int)x, (long int)x, (long long int)x,
25862 <pre>
25863 (unsigned int)x, (unsigned long int)x,
25864 (unsigned long long int)x</pre>
25865 cvtI -&gt; F (float)i, (double)i, (long double)i
25866 cvtF' -&gt; F (float)x, (double)x, (long double)x
25867 <p><!--para 2 -->
25868 In the above conversions from floating to integer, the use of (cast)x can be replaced with
25869 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
25870 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
25871 conversion functions, lrint(), llrint(), lround(), and llround(), can be
25872 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
25873 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
25874 <p><!--para 3 -->
25875 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
25876 fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
25877 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
25878 to 65535.0 which can then be cast to unsigned short int. But, the
25879 remainder() function is not useful for doing silent wrapping to signed integer types,
25880 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
25881 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
25882 int.
25883 <p><!--para 4 -->
25884 C's conversions (casts) from floating-point to floating-point can meet LIA-1
25885 requirements if an implementation uses round-to-nearest (IEC 60559 default).
25886 <p><!--para 5 -->
25887 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
25888 implementation uses round-to-nearest.
25889 <!--page 564 -->
25891 <h3><a name="H.3" href="#H.3">H.3 Notification</a></h3>
25892 <p><!--para 1 -->
25893 Notification is the process by which a user or program is informed that an exceptional
25894 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
25895 allows an implementation to cause a notification to occur when any arithmetic operation
25896 returns an exceptional value as defined in LIA-1 clause 5.
25898 <h4><a name="H.3.1" href="#H.3.1">H.3.1 Notification alternatives</a></h4>
25899 <p><!--para 1 -->
25900 LIA-1 requires at least the following two alternatives for handling of notifications:
25901 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
25902 resume.
25903 <p><!--para 2 -->
25904 An implementation need only support a given notification alternative for the entire
25905 program. An implementation may support the ability to switch between notification
25906 alternatives during execution, but is not required to do so. An implementation can
25907 provide separate selection for each kind of notification, but this is not required.
25908 <p><!--para 3 -->
25909 C allows an implementation to provide notification. C's SIGFPE (for traps) and
25910 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
25911 can provide LIA-1 notification.
25912 <p><!--para 4 -->
25913 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
25914 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
25915 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
25916 and-resume behavior with the same constraint.
25918 <h5><a name="H.3.1.1" href="#H.3.1.1">H.3.1.1 Indicators</a></h5>
25919 <p><!--para 1 -->
25920 C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
25921 <p><!--para 2 -->
25922 The following mapping is for floating-point types:
25923 undefined FE_INVALID, FE_DIVBYZERO
25924 floating_overflow FE_OVERFLOW
25925 underflow FE_UNDERFLOW
25926 <p><!--para 3 -->
25927 The floating-point indicator interrogation and manipulation operations are:
25928 set_indicators feraiseexcept(i)
25929 clear_indicators feclearexcept(i)
25930 test_indicators fetestexcept(i)
25931 current_indicators fetestexcept(FE_ALL_EXCEPT)
25932 where i is an expression of type int representing a subset of the LIA-1 indicators.
25933 <p><!--para 4 -->
25934 C allows an implementation to provide the following LIA-1 required behavior: at
25935 program termination if any indicator is set the implementation shall send an unambiguous
25936 <!--page 565 -->
25937 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
25938 <p><!--para 5 -->
25939 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
25940 This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
25941 point indicators.
25943 <h5><a name="H.3.1.2" href="#H.3.1.2">H.3.1.2 Traps</a></h5>
25944 <p><!--para 1 -->
25945 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
25946 math library functions (which are not permitted to invoke a user's signal handler for
25947 SIGFPE). An implementation can provide an alternative of notification through
25948 termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
25949 <p><!--para 2 -->
25950 LIA-1 does not require that traps be precise.
25951 <p><!--para 3 -->
25952 C does require that SIGFPE be the signal corresponding to LIA-1 arithmetic exceptions,
25953 if there is any signal raised for them.
25954 <p><!--para 4 -->
25955 C supports signal handlers for SIGFPE and allows trapping of LIA-1 arithmetic
25956 exceptions. When LIA-1 arithmetic exceptions do trap, C's signal-handler mechanism
25957 allows trap-and-terminate (either default implementation behavior or user replacement for
25958 it) or trap-and-resume, at the programmer's option.
25959 <!--page 566 -->
25961 <h2><a name="I" href="#I">Annex I</a></h2>
25962 <p><!--para 1 -->
25963 <pre>
25964 (informative)
25965 Common warnings</pre>
25966 An implementation may generate warnings in many situations, none of which are
25967 specified as part of this International Standard. The following are a few of the more
25968 common situations.
25969 <p><!--para 2 -->
25970 <ul>
25971 <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>).
25972 <li> A block with initialization of an object that has automatic storage duration is jumped
25973 into (<a href="#6.2.4">6.2.4</a>).
25974 <li> An implicit narrowing conversion is encountered, such as the assignment of a long
25975 int or a double to an int, or a pointer to void to a pointer to any type other than
25976 a character type (<a href="#6.3">6.3</a>).
25977 <li> A hexadecimal floating constant cannot be represented exactly in its evaluation format
25978 (<a href="#6.4.4.2">6.4.4.2</a>).
25979 <li> An integer character constant includes more than one character or a wide character
25980 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
25981 <li> The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
25982 <li> An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
25983 lvalue in one operand, and a side effect to, or an access to the value of, the identical
25984 lvalue in the other operand (<a href="#6.5">6.5</a>).
25985 <li> A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
25986 <li> The arguments in a function call do not agree in number and type with those of the
25987 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
25988 <li> An object is defined but not used (<a href="#6.7">6.7</a>).
25989 <li> A value is given to an object of an enumerated type other than by assignment of an
25990 enumeration constant that is a member of that type, or an enumeration object that has
25991 the same type, or the value of a function that returns the same enumerated type
25992 (<a href="#6.7.2.2">6.7.2.2</a>).
25993 <li> An aggregate has a partly bracketed initialization (<a href="#6.7.8">6.7.8</a>).
25994 <li> A statement cannot be reached (<a href="#6.8">6.8</a>).
25995 <li> A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
25996 <li> A constant expression is used as the controlling expression of a selection statement
25997 (<a href="#6.8.4">6.8.4</a>).
25998 <!--page 567 -->
25999 <li> An incorrectly formed preprocessing group is encountered while skipping a
26000 preprocessing group (<a href="#6.10.1">6.10.1</a>).
26001 <li> An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
26002 <!--page 568 -->
26003 </ul>
26005 <h2><a name="J" href="#J">Annex J</a></h2>
26006 <p><!--para 1 -->
26007 <pre>
26008 (informative)
26009 Portability issues</pre>
26010 This annex collects some information about portability that appears in this International
26011 Standard.
26013 <h3><a name="J.1" href="#J.1">J.1 Unspecified behavior</a></h3>
26014 <p><!--para 1 -->
26015 The following are unspecified:
26016 <ul>
26017 <li> The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
26018 <li> The termination status returned to the hosted environment if the return type of main
26019 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
26020 <li> The behavior of the display device if a printing character is written when the active
26021 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
26022 <li> The behavior of the display device if a backspace character is written when the active
26023 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
26024 <li> The behavior of the display device if a horizontal tab character is written when the
26025 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
26026 <li> The behavior of the display device if a vertical tab character is written when the active
26027 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
26028 <li> How an extended source character that does not correspond to a universal character
26029 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
26030 <li> Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
26031 <li> The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
26032 <li> The values of bytes that correspond to union members other than the one last stored
26033 into (<a href="#6.2.6.1">6.2.6.1</a>).
26034 <li> The representation used when storing a value in an object that has more than one
26035 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
26036 <li> The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
26037 <li> Whether certain operators can generate negative zeros and whether a negative zero
26038 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
26039 <li> Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
26040 <li> The order in which subexpressions are evaluated and the order in which side effects
26041 take place, except as specified for the function-call (), &amp;&amp;, ||, ? :, and comma
26042 <!--page 569 -->
26043 operators (<a href="#6.5">6.5</a>).
26044 <li> The order in which the function designator, arguments, and subexpressions within the
26045 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
26046 <li> The order of side effects among compound literal initialization list expressions
26047 (<a href="#6.5.2.5">6.5.2.5</a>).
26048 <li> The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
26049 <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>).
26050 <li> Whether a call to an inline function uses the inline definition or the external definition
26051 of the function (<a href="#6.7.4">6.7.4</a>).
26052 <li> Whether or not a size expression is evaluated when it is part of the operand of a
26053 sizeof operator and changing the value of the size expression would not affect the
26054 result of the operator (<a href="#6.7.6.2">6.7.6.2</a>).
26055 <li> The order in which any side effects occur among the initialization list expressions in
26056 an initializer (<a href="#6.7.9">6.7.9</a>).
26057 <li> The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
26058 <li> When a fully expanded macro replacement list contains a function-like macro name
26059 as its last preprocessing token and the next preprocessing token from the source file is
26060 a (, and the fully expanded replacement of that macro ends with the name of the first
26061 macro and the next preprocessing token from the source file is again a (, whether that
26062 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
26063 <li> The order in which # and ## operations are evaluated during macro substitution
26064 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
26065 <li> The state of the floating-point status flags when execution passes from a part of the *
26066 program translated with FENV_ACCESS ''off'' to a part translated with
26067 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
26068 <li> The order in which feraiseexcept raises floating-point exceptions, except as
26069 stated in <a href="#F.8.6">F.8.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
26070 <li> Whether math_errhandling is a macro or an identifier with external linkage
26071 (<a href="#7.12">7.12</a>).
26072 <li> The results of the frexp functions when the specified value is not a floating-point
26073 number (<a href="#7.12.6.4">7.12.6.4</a>).
26074 <li> The numeric result of the ilogb functions when the correct value is outside the
26075 range of the return type (<a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.10.3.5">F.10.3.5</a>).
26076 <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.10.6.5">F.10.6.5</a>).
26077 <!--page 570 -->
26078 <li> The value stored by the remquo functions in the object pointed to by quo when y is
26079 zero (<a href="#7.12.10.3">7.12.10.3</a>).
26080 <li> Whether a comparison macro argument that is represented in a format wider than its
26081 semantic type is converted to the semantic type (<a href="#7.12.14">7.12.14</a>).
26082 <li> Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
26083 <li> Whether va_copy and va_end are macros or identifiers with external linkage
26084 (<a href="#7.16.1">7.16.1</a>).
26085 <li> The hexadecimal digit before the decimal point when a non-normalized floating-point
26086 number is printed with an a or A conversion specifier (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26087 <li> The value of the file position indicator after a successful call to the ungetc function
26088 for a text stream, or the ungetwc function for any stream, until all pushed-back
26089 characters are read or discarded (<a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.28.3.10">7.28.3.10</a>).
26090 <li> The details of the value stored by the fgetpos function (<a href="#7.21.9.1">7.21.9.1</a>).
26091 <li> The details of the value returned by the ftell function for a text stream (<a href="#7.21.9.4">7.21.9.4</a>).
26092 <li> Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
26093 functions convert a minus-signed sequence to a negative number directly or by
26094 negating the value resulting from converting the corresponding unsigned sequence
26095 (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>).
26096 <li> The order and contiguity of storage allocated by successive calls to the calloc,
26097 malloc, and realloc functions (<a href="#7.22.3">7.22.3</a>).
26098 <li> The amount of storage allocated by a successful call to the calloc, malloc, or
26099 realloc function when 0 bytes was requested (<a href="#7.22.3">7.22.3</a>).
26100 <li> Which of two elements that compare as equal is matched by the bsearch function
26101 (<a href="#7.22.5.1">7.22.5.1</a>).
26102 <li> The order of two elements that compare as equal in an array sorted by the qsort
26103 function (<a href="#7.22.5.2">7.22.5.2</a>).
26104 <li> The encoding of the calendar time returned by the time function (<a href="#7.26.2.4">7.26.2.4</a>).
26105 <li> The characters stored by the strftime or wcsftime function if any of the time
26106 values being converted is outside the normal range (<a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.28.5.1">7.28.5.1</a>).
26107 <li> The conversion state after an encoding error occurs (<a href="#7.28.6.3.2">7.28.6.3.2</a>, <a href="#7.28.6.3.3">7.28.6.3.3</a>, <a href="#7.28.6.4.1">7.28.6.4.1</a>,
26108 <a href="#7.28.6.4.2">7.28.6.4.2</a>,
26109 <li> The resulting value when the ''invalid'' floating-point exception is raised during
26110 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
26111 <!--page 571 -->
26112 <li> Whether conversion of non-integer IEC 60559 floating values to integer raises the
26113 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
26114 <li> Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
26115 exception in an IEC 60559 conformant implementation (<a href="#F.10">F.10</a>).
26116 <li> Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
26117 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.10">F.10</a>).
26118 <li> The exponent value stored by frexp for a NaN or infinity (<a href="#F.10.3.4">F.10.3.4</a>).
26119 <li> The numeric result returned by the lrint, llrint, lround, and llround
26120 functions if the rounded value is outside the range of the return type (<a href="#F.10.6.5">F.10.6.5</a>,
26121 <a href="#F.10.6.7">F.10.6.7</a>).
26122 <li> The sign of one part of the complex result of several math functions for certain
26123 special cases 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>, <a href="#G.6.2.3">G.6.2.3</a>,
26124 <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>).
26125 </ul>
26127 <h3><a name="J.2" href="#J.2">J.2 Undefined behavior</a></h3>
26128 <p><!--para 1 -->
26129 The behavior is undefined in the following circumstances:
26130 <ul>
26131 <li> A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
26132 (clause 4).
26133 <li> A nonempty source file does not end in a new-line character which is not immediately
26134 preceded by a backslash character or ends in a partial preprocessing token or
26135 comment (<a href="#5.1.1.2">5.1.1.2</a>).
26136 <li> Token concatenation produces a character sequence matching the syntax of a
26137 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
26138 <li> A program in a hosted environment does not define a function named main using one
26139 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
26140 <li> The execution of a program contains a data race (<a href="#5.1.2.4">5.1.2.4</a>).
26141 <li> A character not in the basic source character set is encountered in a source file, except
26142 in an identifier, a character constant, a string literal, a header name, a comment, or a
26143 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
26144 <li> An identifier, comment, string literal, character constant, or header name contains an
26145 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>).
26146 <li> The same identifier has both internal and external linkage in the same translation unit
26147 (<a href="#6.2.2">6.2.2</a>).
26148 <li> An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
26149 <!--page 572 -->
26150 <li> The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
26151 <li> The value of an object with automatic storage duration is used while it is
26152 indeterminate (<a href="#6.2.4">6.2.4</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.8">6.8</a>).
26153 <li> A trap representation is read by an lvalue expression that does not have character type
26154 (<a href="#6.2.6.1">6.2.6.1</a>).
26155 <li> A trap representation is produced by a side effect that modifies any part of the object
26156 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
26157 <li> The operands to certain operators are such that they could produce a negative zero
26158 result, but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
26159 <li> Two declarations of the same object or function specify types that are not compatible
26160 (<a href="#6.2.7">6.2.7</a>).
26161 <li> A program requires the formation of a composite type from a variable length array
26162 type whose size is specified by an expression that is not evaluated (<a href="#6.2.7">6.2.7</a>).
26163 <li> Conversion to or from an integer type produces a value outside the range that can be
26164 represented (<a href="#6.3.1.4">6.3.1.4</a>).
26165 <li> Demotion of one real floating type to another produces a value outside the range that
26166 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
26167 <li> An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
26168 <li> A non-array lvalue with an incomplete type is used in a context that requires the value
26169 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
26170 <li> An lvalue designating an object of automatic storage duration that could have been
26171 declared with the register storage class is used in a context that requires the value
26172 of the designated object, but the object is uninitialized. (<a href="#6.3.2.1">6.3.2.1</a>).
26173 <li> An lvalue having array type is converted to a pointer to the initial element of the
26174 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
26175 <li> An attempt is made to use the value of a void expression, or an implicit or explicit
26176 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
26177 <li> Conversion of a pointer to an integer type produces a value outside the range that can
26178 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
26179 <li> Conversion between two pointer types produces a result that is incorrectly aligned
26180 (<a href="#6.3.2.3">6.3.2.3</a>).
26181 <li> A pointer is used to call a function whose type is not compatible with the referenced
26182 type (<a href="#6.3.2.3">6.3.2.3</a>).
26183 <!--page 573 -->
26184 <li> An unmatched ' or " character is encountered on a logical source line during
26185 tokenization (<a href="#6.4">6.4</a>).
26186 <li> A reserved keyword token is used in translation phase 7 or 8 for some purpose other
26187 than as a keyword (<a href="#6.4.1">6.4.1</a>).
26188 <li> A universal character name in an identifier does not designate a character whose
26189 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
26190 <li> The initial character of an identifier is a universal character name designating a digit
26191 (<a href="#6.4.2.1">6.4.2.1</a>).
26192 <li> Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
26193 <li> The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
26194 <li> The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
26195 <li> The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
26196 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
26197 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
26198 <li> A side effect on a scalar object is unsequenced relative to either a different side effect
26199 on the same scalar object or a value computation using the value of the same scalar
26200 object (<a href="#6.5">6.5</a>).
26201 <li> An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
26202 <li> An object has its stored value accessed other than by an lvalue of an allowable type
26203 (<a href="#6.5">6.5</a>).
26204 <li> For a call to a function without a function prototype in scope, the number of *
26205 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
26206 <li> For call to a function without a function prototype in scope where the function is
26207 defined with a function prototype, either the prototype ends with an ellipsis or the
26208 types of the arguments after promotion are not compatible with the types of the
26209 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
26210 <li> For a call to a function without a function prototype in scope where the function is not
26211 defined with a function prototype, the types of the arguments after promotion are not
26212 compatible with those of the parameters after promotion (with certain exceptions)
26213 (<a href="#6.5.2.2">6.5.2.2</a>).
26214 <li> A function is defined with a type that is not compatible with the type (of the
26215 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
26216 <li> A member of an atomic structure or union is accessed (<a href="#6.5.2.3">6.5.2.3</a>).
26217 <li> The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
26218 <!--page 574 -->
26219 <li> A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
26220 <li> The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
26221 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
26222 integer type produces a result that does not point into, or just beyond, the same array
26223 object (<a href="#6.5.6">6.5.6</a>).
26224 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
26225 integer type produces a result that points just beyond the array object and is used as
26226 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
26227 <li> Pointers that do not point into, or just beyond, the same array object are subtracted
26228 (<a href="#6.5.6">6.5.6</a>).
26229 <li> An array subscript is out of range, even if an object is apparently accessible with the
26230 given subscript (as in the lvalue expression a[1][7] given the declaration int
26231 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
26232 <li> The result of subtracting two pointers is not representable in an object of type
26233 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
26234 <li> An expression is shifted by a negative number or by an amount greater than or equal
26235 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
26236 <li> An expression having signed promoted type is left-shifted and either the value of the
26237 expression is negative or the result of shifting would be not be representable in the
26238 promoted type (<a href="#6.5.7">6.5.7</a>).
26239 <li> Pointers that do not point to the same aggregate or union (nor just beyond the same
26240 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
26241 <li> An object is assigned to an inexactly overlapping object or to an exactly overlapping
26242 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
26243 <li> An expression that is required to be an integer constant expression does not have an
26244 integer type; has operands that are not integer constants, enumeration constants,
26245 character constants, sizeof expressions whose results are integer constants, or
26246 immediately-cast floating constants; or contains casts (outside operands to sizeof
26247 operators) other than conversions of arithmetic types to integer types (<a href="#6.6">6.6</a>).
26248 <li> A constant expression in an initializer is not, or does not evaluate to, one of the
26249 following: an arithmetic constant expression, a null pointer constant, an address
26250 constant, or an address constant for a complete object type plus or minus an integer
26251 constant expression (<a href="#6.6">6.6</a>).
26252 <li> An arithmetic constant expression does not have arithmetic type; has operands that
26253 are not integer constants, floating constants, enumeration constants, character
26254 constants, or sizeof expressions; or contains casts (outside operands to sizeof
26255 <!--page 575 -->
26256 operators) other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
26257 <li> The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
26258 address &amp;, or indirection * operator or a pointer cast in creating an address constant
26259 (<a href="#6.6">6.6</a>).
26260 <li> An identifier for an object is declared with no linkage and the type of the object is
26261 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
26262 <li> A function is declared at block scope with an explicit storage-class specifier other
26263 than extern (<a href="#6.7.1">6.7.1</a>).
26264 <li> A structure or union is defined as containing no named members, no anonymous
26265 structures, and no anonymous unions (<a href="#6.7.2.1">6.7.2.1</a>).
26266 <li> An attempt is made to access, or generate a pointer to just past, a flexible array
26267 member of a structure when the referenced object provides no elements for that array
26268 (<a href="#6.7.2.1">6.7.2.1</a>).
26269 <li> When the complete type is needed, an incomplete structure or union type is not
26270 completed in the same scope by another declaration of the tag that defines the content
26271 (<a href="#6.7.2.3">6.7.2.3</a>).
26272 <li> An attempt is made to modify an object defined with a const-qualified type through
26273 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
26274 <li> An attempt is made to refer to an object defined with a volatile-qualified type through
26275 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
26276 <li> The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>). *
26277 <li> Two qualified types that are required to be compatible do not have the identically
26278 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
26279 <li> An object which has been modified is accessed through a restrict-qualified pointer to
26280 a const-qualified type, or through a restrict-qualified pointer and another pointer that
26281 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
26282 <li> A restrict-qualified pointer is assigned a value based on another restricted pointer
26283 whose associated block neither began execution before the block associated with this
26284 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
26285 <li> A function with external linkage is declared with an inline function specifier, but is
26286 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
26287 <li> A function declared with a _Noreturn function specifier returns to its caller (<a href="#6.7.4">6.7.4</a>).
26288 <li> The definition of an object has an alignment specifier and another declaration of that
26289 object has a different alignment specifier (<a href="#6.7.5">6.7.5</a>).
26290 <!--page 576 -->
26291 <li> Declarations of an object in different translation units have different alignment
26292 specifiers (<a href="#6.7.5">6.7.5</a>).
26293 <li> Two pointer types that are required to be compatible are not identically qualified, or
26294 are not pointers to compatible types (<a href="#6.7.6.1">6.7.6.1</a>).
26295 <li> The size expression in an array declaration is not a constant expression and evaluates
26296 at program execution time to a nonpositive value (<a href="#6.7.6.2">6.7.6.2</a>).
26297 <li> In a context requiring two array types to be compatible, they do not have compatible
26298 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.6.2">6.7.6.2</a>).
26299 <li> A declaration of an array parameter includes the keyword static within the [ and
26300 ] and the corresponding argument does not provide access to the first element of an
26301 array with at least the specified number of elements (<a href="#6.7.6.3">6.7.6.3</a>).
26302 <li> A storage-class specifier or type qualifier modifies the keyword void as a function
26303 parameter type list (<a href="#6.7.6.3">6.7.6.3</a>).
26304 <li> In a context requiring two function types to be compatible, they do not have
26305 compatible return types, or their parameters disagree in use of the ellipsis terminator
26306 or the number and type of parameters (after default argument promotion, when there
26307 is no parameter type list or when one type is specified by a function definition with an
26308 identifier list) (<a href="#6.7.6.3">6.7.6.3</a>).
26309 <li> The value of an unnamed member of a structure or union is used (<a href="#6.7.9">6.7.9</a>).
26310 <li> The initializer for a scalar is neither a single expression nor a single expression
26311 enclosed in braces (<a href="#6.7.9">6.7.9</a>).
26312 <li> The initializer for a structure or union object that has automatic storage duration is
26313 neither an initializer list nor a single expression that has compatible structure or union
26314 type (<a href="#6.7.9">6.7.9</a>).
26315 <li> The initializer for an aggregate or union, other than an array initialized by a string
26316 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.9">6.7.9</a>).
26317 <li> An identifier with external linkage is used, but in the program there does not exist
26318 exactly one external definition for the identifier, or the identifier is not used and there
26319 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
26320 <li> A function definition includes an identifier list, but the types of the parameters are not
26321 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
26322 <li> An adjusted parameter type in a function definition is not a complete object type
26323 (<a href="#6.9.1">6.9.1</a>).
26324 <li> A function that accepts a variable number of arguments is defined without a
26325 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
26326 <!--page 577 -->
26327 <li> The } that terminates a function is reached, and the value of the function call is used
26328 by the caller (<a href="#6.9.1">6.9.1</a>).
26329 <li> An identifier for an object with internal linkage and an incomplete type is declared
26330 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
26331 <li> The token defined is generated during the expansion of a #if or #elif
26332 preprocessing directive, or the use of the defined unary operator does not match
26333 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
26334 <li> The #include preprocessing directive that results after expansion does not match
26335 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
26336 <li> The character sequence in an #include preprocessing directive does not start with a
26337 letter (<a href="#6.10.2">6.10.2</a>).
26338 <li> There are sequences of preprocessing tokens within the list of macro arguments that
26339 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
26340 <li> The result of the preprocessing operator # is not a valid character string literal
26341 (<a href="#6.10.3.2">6.10.3.2</a>).
26342 <li> The result of the preprocessing operator ## is not a valid preprocessing token
26343 (<a href="#6.10.3.3">6.10.3.3</a>).
26344 <li> The #line preprocessing directive that results after expansion does not match one of
26345 the two well-defined forms, or its digit sequence specifies zero or a number greater
26346 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
26347 <li> A non-STDC #pragma preprocessing directive that is documented as causing
26348 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
26349 <li> A #pragma STDC preprocessing directive does not match one of the well-defined
26350 forms (<a href="#6.10.6">6.10.6</a>).
26351 <li> The name of a predefined macro, or the identifier defined, is the subject of a
26352 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
26353 <li> An attempt is made to copy an object to an overlapping object by use of a library
26354 function, other than as explicitly allowed (e.g., memmove) (clause 7).
26355 <li> A file with the same name as one of the standard headers, not provided as part of the
26356 implementation, is placed in any of the standard places that are searched for included
26357 source files (<a href="#7.1.2">7.1.2</a>).
26358 <li> A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
26359 <li> A function, object, type, or macro that is specified as being declared or defined by
26360 some standard header is used before any header that declares or defines it is included
26361 (<a href="#7.1.2">7.1.2</a>).
26362 <!--page 578 -->
26363 <li> A standard header is included while a macro is defined with the same name as a
26364 keyword (<a href="#7.1.2">7.1.2</a>).
26365 <li> The program attempts to declare a library function itself, rather than via a standard
26366 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
26367 <li> The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
26368 (<a href="#7.1.3">7.1.3</a>).
26369 <li> The program removes the definition of a macro whose name begins with an
26370 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
26371 <li> An argument to a library function has an invalid value or a type not expected by a
26372 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
26373 <li> The pointer passed to a library function array parameter does not have a value such
26374 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
26375 <li> The macro definition of assert is suppressed in order to access an actual function
26376 (<a href="#7.2">7.2</a>).
26377 <li> The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
26378 <li> The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
26379 any context other than outside all external declarations or preceding all explicit
26380 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>).
26381 <li> The value of an argument to a character handling function is neither equal to the value
26382 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
26383 <li> A macro definition of errno is suppressed in order to access an actual object, or the
26384 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
26385 <li> Part of the program tests floating-point status flags, sets floating-point control modes,
26386 or runs under non-default mode settings, but was translated with the state for the
26387 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
26388 <li> The exception-mask argument for one of the functions that provide access to the
26389 floating-point status flags has a nonzero value not obtained by bitwise OR of the
26390 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
26391 <li> The fesetexceptflag function is used to set floating-point status flags that were
26392 not specified in the call to the fegetexceptflag function that provided the value
26393 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
26394 <li> The argument to fesetenv or feupdateenv is neither an object set by a call to
26395 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>).
26396 <li> The value of the result of an integer arithmetic or conversion function cannot be
26397 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.22.6.1">7.22.6.1</a>, <a href="#7.22.6.2">7.22.6.2</a>, <a href="#7.22.1">7.22.1</a>).
26398 <!--page 579 -->
26399 <li> The program modifies the string pointed to by the value returned by the setlocale
26400 function (<a href="#7.11.1.1">7.11.1.1</a>).
26401 <li> The program modifies the structure pointed to by the value returned by the
26402 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
26403 <li> A macro definition of math_errhandling is suppressed or the program defines
26404 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
26405 <li> An argument to a floating-point classification or comparison macro is not of real
26406 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
26407 <li> A macro definition of setjmp is suppressed in order to access an actual function, or
26408 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
26409 <li> An invocation of the setjmp macro occurs other than in an allowed context
26410 (<a href="#7.13.2.1">7.13.2.1</a>).
26411 <li> The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
26412 <li> After a longjmp, there is an attempt to access the value of an object of automatic
26413 storage duration that does not have volatile-qualified type, local to the function
26414 containing the invocation of the corresponding setjmp macro, that was changed
26415 between the setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
26416 <li> The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
26417 <li> A signal handler returns when the signal corresponded to a computational exception
26418 (<a href="#7.14.1.1">7.14.1.1</a>).
26419 <li> A signal occurs as the result of calling the abort or raise function, and the signal
26420 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
26421 <li> A signal occurs other than as the result of calling the abort or raise function, and
26422 the signal handler refers to an object with static or thread storage duration that is not a
26423 lock-free atomic object other than by assigning a value to an object declared as
26424 volatile sig_atomic_t, or calls any function in the standard library other
26425 than the abort function, the _Exit function, the quick_exit function, or the
26426 signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
26427 <li> The value of errno is referred to after a signal occurred other than as the result of
26428 calling the abort or raise function and the corresponding signal handler obtained
26429 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
26430 <li> A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
26431 <li> A function with a variable number of arguments attempts to access its varying
26432 arguments other than through a properly declared and initialized va_list object, or
26433 before the va_start macro is invoked (<a href="#7.16">7.16</a>, <a href="#7.16.1.1">7.16.1.1</a>, <a href="#7.16.1.4">7.16.1.4</a>).
26434 <!--page 580 -->
26435 <li> The macro va_arg is invoked using the parameter ap that was passed to a function
26436 that invoked the macro va_arg with the same parameter (<a href="#7.16">7.16</a>).
26437 <li> A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
26438 order to access an actual function, or the program defines an external identifier with
26439 the name va_copy or va_end (<a href="#7.16.1">7.16.1</a>).
26440 <li> The va_start or va_copy macro is invoked without a corresponding invocation
26441 of the va_end macro in the same function, or vice versa (<a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a>,
26442 <a href="#7.16.1.4">7.16.1.4</a>).
26443 <li> The type parameter to the va_arg macro is not such that a pointer to an object of
26444 that type can be obtained simply by postfixing a * (<a href="#7.16.1.1">7.16.1.1</a>).
26445 <li> The va_arg macro is invoked when there is no actual next argument, or with a
26446 specified type that is not compatible with the promoted type of the actual next
26447 argument, with certain exceptions (<a href="#7.16.1.1">7.16.1.1</a>).
26448 <li> The va_copy or va_start macro is called to initialize a va_list that was
26449 previously initialized by either macro without an intervening invocation of the
26450 va_end macro for the same va_list (<a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.4">7.16.1.4</a>).
26451 <li> The parameter parmN of a va_start macro is declared with the register
26452 storage class, with a function or array type, or with a type that is not compatible with
26453 the type that results after application of the default argument promotions (<a href="#7.16.1.4">7.16.1.4</a>).
26454 <li> The member designator parameter of an offsetof macro is an invalid right
26455 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.19">7.19</a>).
26456 <li> The argument in an instance of one of the integer-constant macros is not a decimal,
26457 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
26458 corresponding type (<a href="#7.20.4">7.20.4</a>).
26459 <li> A byte input/output function is applied to a wide-oriented stream, or a wide character
26460 input/output function is applied to a byte-oriented stream (<a href="#7.21.2">7.21.2</a>).
26461 <li> Use is made of any portion of a file beyond the most recent wide character written to
26462 a wide-oriented stream (<a href="#7.21.2">7.21.2</a>).
26463 <li> The value of a pointer to a FILE object is used after the associated file is closed
26464 (<a href="#7.21.3">7.21.3</a>).
26465 <li> The stream for the fflush function points to an input stream or to an update stream
26466 in which the most recent operation was input (<a href="#7.21.5.2">7.21.5.2</a>).
26467 <li> The string pointed to by the mode argument in a call to the fopen function does not
26468 exactly match one of the specified character sequences (<a href="#7.21.5.3">7.21.5.3</a>).
26469 <li> An output operation on an update stream is followed by an input operation without an
26470 intervening call to the fflush function or a file positioning function, or an input
26471 <!--page 581 -->
26472 operation on an update stream is followed by an output operation with an intervening
26473 call to a file positioning function (<a href="#7.21.5.3">7.21.5.3</a>).
26474 <li> An attempt is made to use the contents of the array that was supplied in a call to the
26475 setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>).
26476 <li> There are insufficient arguments for the format in a call to one of the formatted
26477 input/output functions, or an argument does not have an appropriate type (<a href="#7.21.6.1">7.21.6.1</a>,
26478 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26479 <li> The format in a call to one of the formatted input/output functions or to the
26480 strftime or wcsftime function is not a valid multibyte character sequence that
26481 begins and ends in its initial shift state (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>,
26482 <a href="#7.28.5.1">7.28.5.1</a>).
26483 <li> In a call to one of the formatted output functions, a precision appears with a
26484 conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26485 <li> A conversion specification for a formatted output function uses an asterisk to denote
26486 an argument-supplied field width or precision, but the corresponding argument is not
26487 provided (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26488 <li> A conversion specification for a formatted output function uses a # or 0 flag with a
26489 conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26490 <li> A conversion specification for one of the formatted input/output functions uses a
26491 length modifier with a conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>,
26492 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26493 <li> An s conversion specifier is encountered by one of the formatted output functions,
26494 and the argument is missing the null terminator (unless a precision is specified that
26495 does not require null termination) (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26496 <li> An n conversion specification for one of the formatted input/output functions includes
26497 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.21.6.1">7.21.6.1</a>,
26498 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26499 <li> A % conversion specifier is encountered by one of the formatted input/output
26500 functions, but the complete conversion specification is not exactly %% (<a href="#7.21.6.1">7.21.6.1</a>,
26501 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26502 <li> An invalid conversion specification is found in the format for one of the formatted
26503 input/output functions, or the strftime or wcsftime function (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
26504 <a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#7.28.5.1">7.28.5.1</a>).
26505 <li> The number of characters transmitted by a formatted output function is greater than
26506 INT_MAX (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.10">7.21.6.10</a>).
26507 <!--page 582 -->
26508 <li> The result of a conversion by one of the formatted input functions cannot be
26509 represented in the corresponding object, or the receiving object does not have an
26510 appropriate type (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26511 <li> A c, s, or [ conversion specifier is encountered by one of the formatted input
26512 functions, and the array pointed to by the corresponding argument is not large enough
26513 to accept the input sequence (and a null terminator if the conversion specifier is s or
26514 [) (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26515 <li> A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
26516 formatted input functions, but the input is not a valid multibyte character sequence
26517 that begins in the initial shift state (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26518 <li> The input item for a %p conversion by one of the formatted input functions is not a
26519 value converted earlier during the same program execution (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26520 <li> The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
26521 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
26522 vwscanf function is called with an improperly initialized va_list argument, or
26523 the argument is used (other than in an invocation of va_end) after the function
26524 returns (<a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>, <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>,
26525 <a href="#7.28.2.5">7.28.2.5</a>, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.7">7.28.2.7</a>, <a href="#7.28.2.8">7.28.2.8</a>, <a href="#7.28.2.9">7.28.2.9</a>, <a href="#7.28.2.10">7.28.2.10</a>).
26526 <li> The contents of the array supplied in a call to the fgets or fgetws function are
26527 used after a read error occurred (<a href="#7.21.7.2">7.21.7.2</a>, <a href="#7.28.3.2">7.28.3.2</a>).
26528 <li> The file position indicator for a binary stream is used after a call to the ungetc
26529 function where its value was zero before the call (<a href="#7.21.7.10">7.21.7.10</a>).
26530 <li> The file position indicator for a stream is used after an error occurred during a call to
26531 the fread or fwrite function (<a href="#7.21.8.1">7.21.8.1</a>, <a href="#7.21.8.2">7.21.8.2</a>).
26532 <li> A partial element read by a call to the fread function is used (<a href="#7.21.8.1">7.21.8.1</a>).
26533 <li> The fseek function is called for a text stream with a nonzero offset and either the
26534 offset was not returned by a previous successful call to the ftell function on a
26535 stream associated with the same file or whence is not SEEK_SET (<a href="#7.21.9.2">7.21.9.2</a>).
26536 <li> The fsetpos function is called to set a position that was not returned by a previous
26537 successful call to the fgetpos function on a stream associated with the same file
26538 (<a href="#7.21.9.3">7.21.9.3</a>).
26539 <li> A non-null pointer returned by a call to the calloc, malloc, or realloc function
26540 with a zero requested size is used to access an object (<a href="#7.22.3">7.22.3</a>).
26541 <li> The value of a pointer that refers to space deallocated by a call to the free or
26542 realloc function is used (<a href="#7.22.3">7.22.3</a>).
26543 <!--page 583 -->
26544 <li> The alignment requested of the aligned_alloc function is not valid or not
26545 supported by the implementation, or the size requested is not an integral multiple of
26546 the alignment (<a href="#7.22.3.1">7.22.3.1</a>).
26547 <li> The pointer argument to the free or realloc function does not match a pointer
26548 earlier returned by a memory management function, or the space has been deallocated
26549 by a call to free or realloc (<a href="#7.22.3.3">7.22.3.3</a>, <a href="#7.22.3.5">7.22.3.5</a>).
26550 <li> The value of the object allocated by the malloc function is used (<a href="#7.22.3.4">7.22.3.4</a>).
26551 <li> The value of any bytes in a new object allocated by the realloc function beyond
26552 the size of the old object are used (<a href="#7.22.3.5">7.22.3.5</a>).
26553 <li> The program calls the exit or quick_exit function more than once, or calls both
26554 functions (<a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.7">7.22.4.7</a>).
26555 <li> During the call to a function registered with the atexit or at_quick_exit
26556 function, a call is made to the longjmp function that would terminate the call to the
26557 registered function (<a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.7">7.22.4.7</a>).
26558 <li> The string set up by the getenv or strerror function is modified by the program
26559 (<a href="#7.22.4.6">7.22.4.6</a>, <a href="#7.23.6.2">7.23.6.2</a>).
26560 <li> A command is executed through the system function in a way that is documented as
26561 causing termination or some other form of undefined behavior (<a href="#7.22.4.8">7.22.4.8</a>).
26562 <li> A searching or sorting utility function is called with an invalid pointer argument, even
26563 if the number of elements is zero (<a href="#7.22.5">7.22.5</a>).
26564 <li> The comparison function called by a searching or sorting utility function alters the
26565 contents of the array being searched or sorted, or returns ordering values
26566 inconsistently (<a href="#7.22.5">7.22.5</a>).
26567 <li> The array being searched by the bsearch function does not have its elements in
26568 proper order (<a href="#7.22.5.1">7.22.5.1</a>).
26569 <li> The current conversion state is used by a multibyte/wide character conversion
26570 function after changing the LC_CTYPE category (<a href="#7.22.7">7.22.7</a>).
26571 <li> A string or wide string utility function is instructed to access an array beyond the end
26572 of an object (<a href="#7.23.1">7.23.1</a>, <a href="#7.28.4">7.28.4</a>).
26573 <li> A string or wide string utility function is called with an invalid pointer argument, even
26574 if the length is zero (<a href="#7.23.1">7.23.1</a>, <a href="#7.28.4">7.28.4</a>).
26575 <li> The contents of the destination array are used after a call to the strxfrm,
26576 strftime, wcsxfrm, or wcsftime function in which the specified length was
26577 too small to hold the entire null-terminated result (<a href="#7.23.4.5">7.23.4.5</a>, <a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.28.4.4.4">7.28.4.4.4</a>,
26578 <a href="#7.28.5.1">7.28.5.1</a>).
26579 <!--page 584 -->
26580 <li> The first argument in the very first call to the strtok or wcstok is a null pointer
26581 (<a href="#7.23.5.8">7.23.5.8</a>, <a href="#7.28.4.5.7">7.28.4.5.7</a>).
26582 <li> The type of an argument to a type-generic macro is not compatible with the type of
26583 the corresponding parameter of the selected function (<a href="#7.24">7.24</a>).
26584 <li> A complex argument is supplied for a generic parameter of a type-generic macro that
26585 has no corresponding complex function (<a href="#7.24">7.24</a>).
26586 <li> At least one field of the broken-down time passed to asctime contains a value
26587 outside its normal range, or the calculated year exceeds four digits or is less than the
26588 year 1000 (<a href="#7.26.3.1">7.26.3.1</a>).
26589 <li> The argument corresponding to an s specifier without an l qualifier in a call to the
26590 fwprintf function does not point to a valid multibyte character sequence that
26591 begins in the initial shift state (<a href="#7.28.2.11">7.28.2.11</a>).
26592 <li> In a call to the wcstok function, the object pointed to by ptr does not have the
26593 value stored by the previous call for the same wide string (<a href="#7.28.4.5.7">7.28.4.5.7</a>).
26594 <li> An mbstate_t object is used inappropriately (<a href="#7.28.6">7.28.6</a>).
26595 <li> The value of an argument of type wint_t to a wide character classification or case
26596 mapping function is neither equal to the value of WEOF nor representable as a
26597 wchar_t (<a href="#7.29.1">7.29.1</a>).
26598 <li> The iswctype function is called using a different LC_CTYPE category from the
26599 one in effect for the call to the wctype function that returned the description
26600 (<a href="#7.29.2.2.1">7.29.2.2.1</a>).
26601 <li> The towctrans function is called using a different LC_CTYPE category from the
26602 one in effect for the call to the wctrans function that returned the description
26603 (<a href="#7.29.3.2.1">7.29.3.2.1</a>).
26604 </ul>
26606 <h3><a name="J.3" href="#J.3">J.3 Implementation-defined behavior</a></h3>
26607 <p><!--para 1 -->
26608 A conforming implementation is required to document its choice of behavior in each of
26609 the areas listed in this subclause. The following are implementation-defined:
26610 <!--page 585 -->
26612 <h4><a name="J.3.1" href="#J.3.1">J.3.1 Translation</a></h4>
26613 <p><!--para 1 -->
26614 <ul>
26615 <li> How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
26616 <li> Whether each nonempty sequence of white-space characters other than new-line is
26617 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
26618 </ul>
26620 <h4><a name="J.3.2" href="#J.3.2">J.3.2 Environment</a></h4>
26621 <p><!--para 1 -->
26622 <ul>
26623 <li> The mapping between physical source file multibyte characters and the source
26624 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
26625 <li> The name and type of the function called at program startup in a freestanding
26626 environment (<a href="#5.1.2.1">5.1.2.1</a>).
26627 <li> The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
26628 <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>).
26629 <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>).
26630 <li> What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
26631 <li> Whether a program can have more than one thread of execution in a freestanding
26632 environment (<a href="#5.1.2.4">5.1.2.4</a>).
26633 <li> The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
26634 <li> Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
26635 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
26636 <li> Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
26637 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
26638 <li> The set of environment names and the method for altering the environment list used
26639 by the getenv function (<a href="#7.22.4.6">7.22.4.6</a>).
26640 <li> The manner of execution of the string by the system function (<a href="#7.22.4.8">7.22.4.8</a>).
26641 </ul>
26643 <h4><a name="J.3.3" href="#J.3.3">J.3.3 Identifiers</a></h4>
26644 <p><!--para 1 -->
26645 <ul>
26646 <li> Which additional multibyte characters may appear in identifiers and their
26647 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
26648 <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>).
26649 <!--page 586 -->
26650 </ul>
26652 <h4><a name="J.3.4" href="#J.3.4">J.3.4 Characters</a></h4>
26653 <p><!--para 1 -->
26654 <ul>
26655 <li> The number of bits in a byte (<a href="#3.6">3.6</a>).
26656 <li> The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
26657 <li> The unique value of the member of the execution character set produced for each of
26658 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
26659 <li> The value of a char object into which has been stored any character other than a
26660 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
26661 <li> Which of signed char or unsigned char has the same range, representation,
26662 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>).
26663 <li> The mapping of members of the source character set (in character constants and string
26664 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>).
26665 <li> The value of an integer character constant containing more than one character or
26666 containing a character or escape sequence that does not map to a single-byte
26667 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
26668 <li> The value of a wide character constant containing more than one multibyte character
26669 or a single multibyte character that maps to multiple members of the extended
26670 execution character set, or containing a multibyte character or escape sequence not
26671 represented in the extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
26672 <li> The current locale used to convert a wide character constant consisting of a single
26673 multibyte character that maps to a member of the extended execution character set
26674 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
26675 <li> Whether differently-prefixed wide string literal tokens can be concatenated and, if so,
26676 the treatment of the resulting multibyte character sequence (<a href="#6.4.5">6.4.5</a>).
26677 <li> The current locale used to convert a wide string literal into corresponding wide
26678 character codes (<a href="#6.4.5">6.4.5</a>).
26679 <li> The value of a string literal containing a multibyte character or escape sequence not
26680 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
26681 <li> The encoding of any of wchar_t, char16_t, and char32_t where the
26682 corresponding standard encoding macro (__STDC_ISO_10646__,
26683 __STDC_UTF_16__, or __STDC_UTF_32__) is not defined (<a href="#6.10.8.2">6.10.8.2</a>).
26684 <!--page 587 -->
26685 </ul>
26687 <h4><a name="J.3.5" href="#J.3.5">J.3.5 Integers</a></h4>
26688 <p><!--para 1 -->
26689 <ul>
26690 <li> Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
26691 <li> Whether signed integer types are represented using sign and magnitude, two's
26692 complement, or ones' complement, and whether the extraordinary value is a trap
26693 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
26694 <li> The rank of any extended integer type relative to another extended integer type with
26695 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
26696 <li> The result of, or the signal raised by, converting an integer to a signed integer type
26697 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
26698 <li> The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
26699 </ul>
26701 <h4><a name="J.3.6" href="#J.3.6">J.3.6 Floating point</a></h4>
26702 <p><!--para 1 -->
26703 <ul>
26704 <li> The accuracy of the floating-point operations and of the library functions in
26705 <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>).
26706 <li> The accuracy of the conversions between floating-point internal representations and
26707 string representations performed by the library functions in <a href="#7.21">&lt;stdio.h&gt;</a>,
26708 <a href="#7.22">&lt;stdlib.h&gt;</a>, and <a href="#7.28">&lt;wchar.h&gt;</a> (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
26709 <li> The rounding behaviors characterized by non-standard values of FLT_ROUNDS
26710 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
26711 <li> The evaluation methods characterized by non-standard negative values of
26712 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
26713 <li> The direction of rounding when an integer is converted to a floating-point number that
26714 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
26715 <li> The direction of rounding when a floating-point number is converted to a narrower
26716 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
26717 <li> How the nearest representable value or the larger or smaller representable value
26718 immediately adjacent to the nearest representable value is chosen for certain floating
26719 constants (<a href="#6.4.4.2">6.4.4.2</a>).
26720 <li> Whether and how floating expressions are contracted when not disallowed by the
26721 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
26722 <li> The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
26723 <li> Additional floating-point exceptions, rounding modes, environments, and
26724 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
26725 <li> The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>).
26726 <!--page 588 -->
26727 </ul>
26729 <h4><a name="J.3.7" href="#J.3.7">J.3.7 Arrays and pointers</a></h4>
26730 <p><!--para 1 -->
26731 <ul>
26732 <li> The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
26733 <li> The size of the result of subtracting two pointers to elements of the same array
26734 (<a href="#6.5.6">6.5.6</a>).
26735 </ul>
26737 <h4><a name="J.3.8" href="#J.3.8">J.3.8 Hints</a></h4>
26738 <p><!--para 1 -->
26739 <ul>
26740 <li> The extent to which suggestions made by using the register storage-class
26741 specifier are effective (<a href="#6.7.1">6.7.1</a>).
26742 <li> The extent to which suggestions made by using the inline function specifier are
26743 effective (<a href="#6.7.4">6.7.4</a>).
26744 </ul>
26746 <h4><a name="J.3.9" href="#J.3.9">J.3.9 Structures, unions, enumerations, and bit-fields</a></h4>
26747 <p><!--para 1 -->
26748 <ul>
26749 <li> Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
26750 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
26751 <li> Allowable bit-field types other than _Bool, signed int, and unsigned int
26752 (<a href="#6.7.2.1">6.7.2.1</a>).
26753 <li> Whether atomic types are permitted for bit-fields (<a href="#6.7.2.1">6.7.2.1</a>).
26754 <li> Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
26755 <li> The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
26756 <li> The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
26757 no problem unless binary data written by one implementation is read by another.
26758 <li> The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
26759 </ul>
26761 <h4><a name="J.3.10" href="#J.3.10">J.3.10 Qualifiers</a></h4>
26762 <p><!--para 1 -->
26763 <ul>
26764 <li> What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
26765 </ul>
26767 <h4><a name="J.3.11" href="#J.3.11">J.3.11 Preprocessing directives</a></h4>
26768 <p><!--para 1 -->
26769 <ul>
26770 <li> The locations within #pragma directives where header name preprocessing tokens
26771 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
26772 <li> How sequences in both forms of header names are mapped to headers or external
26773 source file names (<a href="#6.4.7">6.4.7</a>).
26774 <li> Whether the value of a character constant in a constant expression that controls
26775 conditional inclusion matches the value of the same character constant in the
26776 execution character set (<a href="#6.10.1">6.10.1</a>).
26777 <li> Whether the value of a single-character character constant in a constant expression
26778 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
26779 <!--page 589 -->
26780 <li> The places that are searched for an included &lt; &gt; delimited header, and how the places
26781 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
26782 <li> How the named source file is searched for in an included " " delimited header
26783 (<a href="#6.10.2">6.10.2</a>).
26784 <li> The method by which preprocessing tokens (possibly resulting from macro
26785 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
26786 <li> The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
26787 <li> Whether the # operator inserts a \ character before the \ character that begins a
26788 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
26789 <li> The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
26790 <li> The definitions for __DATE__ and __TIME__ when respectively, the date and
26791 time of translation are not available (<a href="#6.10.8.1">6.10.8.1</a>).
26792 </ul>
26794 <h4><a name="J.3.12" href="#J.3.12">J.3.12 Library functions</a></h4>
26795 <p><!--para 1 -->
26796 <ul>
26797 <li> Any library facilities available to a freestanding program, other than the minimal set
26798 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
26799 <li> The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
26800 <li> The representation of the floating-point status flags stored by the
26801 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
26802 <li> Whether the feraiseexcept function raises the ''inexact'' floating-point
26803 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
26804 (<a href="#7.6.2.3">7.6.2.3</a>).
26805 <li> Strings other than "C" and "" that may be passed as the second argument to the
26806 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
26807 <li> The types defined for float_t and double_t when the value of the
26808 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
26809 <li> Domain errors for the mathematics functions, other than those required by this
26810 International Standard (<a href="#7.12.1">7.12.1</a>).
26811 <li> The values returned by the mathematics functions on domain errors or pole errors
26812 (<a href="#7.12.1">7.12.1</a>).
26813 <li> The values returned by the mathematics functions on underflow range errors, whether
26814 errno is set to the value of the macro ERANGE when the integer expression
26815 math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
26816 floating-point exception is raised when the integer expression math_errhandling
26817 &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
26818 <!--page 590 -->
26819 <li> Whether a domain error occurs or zero is returned when an fmod function has a
26820 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
26821 <li> Whether a domain error occurs or zero is returned when a remainder function has
26822 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
26823 <li> The base-2 logarithm of the modulus used by the remquo functions in reducing the
26824 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
26825 <li> Whether a domain error occurs or zero is returned when a remquo function has a
26826 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
26827 <li> Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
26828 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>).
26829 <li> The null pointer constant to which the macro NULL expands (<a href="#7.19">7.19</a>).
26830 <li> Whether the last line of a text stream requires a terminating new-line character
26831 (<a href="#7.21.2">7.21.2</a>).
26832 <li> Whether space characters that are written out to a text stream immediately before a
26833 new-line character appear when read in (<a href="#7.21.2">7.21.2</a>).
26834 <li> The number of null characters that may be appended to data written to a binary
26835 stream (<a href="#7.21.2">7.21.2</a>).
26836 <li> Whether the file position indicator of an append-mode stream is initially positioned at
26837 the beginning or end of the file (<a href="#7.21.3">7.21.3</a>).
26838 <li> Whether a write on a text stream causes the associated file to be truncated beyond that
26839 point (<a href="#7.21.3">7.21.3</a>).
26840 <li> The characteristics of file buffering (<a href="#7.21.3">7.21.3</a>).
26841 <li> Whether a zero-length file actually exists (<a href="#7.21.3">7.21.3</a>).
26842 <li> The rules for composing valid file names (<a href="#7.21.3">7.21.3</a>).
26843 <li> Whether the same file can be simultaneously open multiple times (<a href="#7.21.3">7.21.3</a>).
26844 <li> The nature and choice of encodings used for multibyte characters in files (<a href="#7.21.3">7.21.3</a>).
26845 <li> The effect of the remove function on an open file (<a href="#7.21.4.1">7.21.4.1</a>).
26846 <li> The effect if a file with the new name exists prior to a call to the rename function
26847 (<a href="#7.21.4.2">7.21.4.2</a>).
26848 <li> Whether an open temporary file is removed upon abnormal program termination
26849 (<a href="#7.21.4.3">7.21.4.3</a>).
26850 <li> Which changes of mode are permitted (if any), and under what circumstances
26851 (<a href="#7.21.5.4">7.21.5.4</a>).
26852 <!--page 591 -->
26853 <li> The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
26854 sequence printed for a NaN (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26855 <li> The output for %p conversion in the fprintf or fwprintf function (<a href="#7.21.6.1">7.21.6.1</a>,
26856 <a href="#7.28.2.1">7.28.2.1</a>).
26857 <li> The interpretation of a - character that is neither the first nor the last character, nor
26858 the second where a ^ character is the first, in the scanlist for %[ conversion in the
26859 fscanf or fwscanf function (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>).
26860 <li> The set of sequences matched by a %p conversion and the interpretation of the
26861 corresponding input item in the fscanf or fwscanf function (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>).
26862 <li> The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
26863 functions on failure (<a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.9.4">7.21.9.4</a>).
26864 <li> The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
26865 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
26866 function (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>).
26867 <li> Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
26868 function sets errno to ERANGE when underflow occurs (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>).
26869 <li> Whether the calloc, malloc, and realloc functions return a null pointer or a
26870 pointer to an allocated object when the size requested is zero (<a href="#7.22.3">7.22.3</a>).
26871 <li> Whether open streams with unwritten buffered data are flushed, open streams are
26872 closed, or temporary files are removed when the abort or _Exit function is called
26873 (<a href="#7.22.4.1">7.22.4.1</a>, <a href="#7.22.4.5">7.22.4.5</a>).
26874 <li> The termination status returned to the host environment by the abort, exit,
26875 _Exit, or quick_exit function (<a href="#7.22.4.1">7.22.4.1</a>, <a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>).
26876 <li> The value returned by the system function when its argument is not a null pointer
26877 (<a href="#7.22.4.8">7.22.4.8</a>).
26878 <li> The local time zone and Daylight Saving Time (<a href="#7.26.1">7.26.1</a>).
26879 <li> The range and precision of times representable in clock_t and time_t (<a href="#7.26">7.26</a>).
26880 <li> The era for the clock function (<a href="#7.26.2.1">7.26.2.1</a>).
26881 <li> The replacement string for the %Z specifier to the strftime, and wcsftime
26882 functions in the "C" locale (<a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.28.5.1">7.28.5.1</a>).
26883 <li> Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
26884 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.10">F.10</a>).
26885 <!--page 592 -->
26886 </ul>
26888 <h4><a name="J.3.13" href="#J.3.13">J.3.13 Architecture</a></h4>
26889 <p><!--para 1 -->
26890 <ul>
26891 <li> The values or expressions assigned to the macros specified in the headers
26892 <a href="#7.7">&lt;float.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, and <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#5.2.4.2">5.2.4.2</a>, <a href="#7.20.2">7.20.2</a>, <a href="#7.20.3">7.20.3</a>).
26893 <li> The result of attempting to indirectly access an object with automatic or thread
26894 storage duration from a thread other than the one with which it is associated (<a href="#6.2.4">6.2.4</a>).
26895 <li> The number, order, and encoding of bytes in any object (when not explicitly specified
26896 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
26897 <li> Whether any extended alignments are supported and the contexts in which they are
26898 supported (<a href="#6.2.8">6.2.8</a>).
26899 <li> Valid alignment values other than those returned by an alignof expression for
26900 fundamental types, if any (<a href="#6.2.8">6.2.8</a>).
26901 <li> The value of the result of the sizeof and alignof operators (<a href="#6.5.3.4">6.5.3.4</a>).
26902 </ul>
26904 <h3><a name="J.4" href="#J.4">J.4 Locale-specific behavior</a></h3>
26905 <p><!--para 1 -->
26906 The following characteristics of a hosted environment are locale-specific and are required
26907 to be documented by the implementation:
26908 <ul>
26909 <li> Additional members of the source and execution character sets beyond the basic
26910 character set (<a href="#5.2.1">5.2.1</a>).
26911 <li> The presence, meaning, and representation of additional multibyte characters in the
26912 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
26913 <li> The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
26914 <li> The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
26915 <li> The decimal-point character (<a href="#7.1.1">7.1.1</a>).
26916 <li> The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.29.2">7.29.2</a>).
26917 <li> The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.29.2">7.29.2</a>).
26918 <li> The sets of characters tested for by the isalpha, isblank, islower, ispunct,
26919 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
26920 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>,
26921 <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.29.2.1.2">7.29.2.1.2</a>, <a href="#7.29.2.1.3">7.29.2.1.3</a>, <a href="#7.29.2.1.7">7.29.2.1.7</a>, <a href="#7.29.2.1.9">7.29.2.1.9</a>, <a href="#7.29.2.1.10">7.29.2.1.10</a>, <a href="#7.29.2.1.11">7.29.2.1.11</a>).
26922 <li> The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
26923 <li> Additional subject sequences accepted by the numeric conversion functions (<a href="#7.22.1">7.22.1</a>,
26924 <a href="#7.28.4.1">7.28.4.1</a>).
26925 <li> The collation sequence of the execution character set (<a href="#7.23.4.3">7.23.4.3</a>, <a href="#7.28.4.4.2">7.28.4.4.2</a>).
26926 <!--page 593 -->
26927 <li> The contents of the error message strings set up by the strerror function
26928 (<a href="#7.23.6.2">7.23.6.2</a>).
26929 <li> The formats for time and date (<a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.28.5.1">7.28.5.1</a>).
26930 <li> Character mappings that are supported by the towctrans function (<a href="#7.29.1">7.29.1</a>).
26931 <li> Character classifications that are supported by the iswctype function (<a href="#7.29.1">7.29.1</a>).
26932 </ul>
26934 <h3><a name="J.5" href="#J.5">J.5 Common extensions</a></h3>
26935 <p><!--para 1 -->
26936 The following extensions are widely used in many systems, but are not portable to all
26937 implementations. The inclusion of any extension that may cause a strictly conforming
26938 program to become invalid renders an implementation nonconforming. Examples of such
26939 extensions are new keywords, extra library functions declared in standard headers, or
26940 predefined macros with names that do not begin with an underscore.
26942 <h4><a name="J.5.1" href="#J.5.1">J.5.1 Environment arguments</a></h4>
26943 <p><!--para 1 -->
26944 In a hosted environment, the main function receives a third argument, char *envp[],
26945 that points to a null-terminated array of pointers to char, each of which points to a string
26946 that provides information about the environment for this execution of the program
26947 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
26949 <h4><a name="J.5.2" href="#J.5.2">J.5.2 Specialized identifiers</a></h4>
26950 <p><!--para 1 -->
26951 Characters other than the underscore _, letters, and digits, that are not part of the basic
26952 source character set (such as the dollar sign $, or characters in national character sets)
26953 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
26955 <h4><a name="J.5.3" href="#J.5.3">J.5.3 Lengths and cases of identifiers</a></h4>
26956 <p><!--para 1 -->
26957 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
26959 <h4><a name="J.5.4" href="#J.5.4">J.5.4 Scopes of identifiers</a></h4>
26960 <p><!--para 1 -->
26961 A function identifier, or the identifier of an object the declaration of which contains the
26962 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
26964 <h4><a name="J.5.5" href="#J.5.5">J.5.5 Writable string literals</a></h4>
26965 <p><!--para 1 -->
26966 String literals are modifiable (in which case, identical string literals should denote distinct
26967 objects) (<a href="#6.4.5">6.4.5</a>).
26968 <!--page 594 -->
26970 <h4><a name="J.5.6" href="#J.5.6">J.5.6 Other arithmetic types</a></h4>
26971 <p><!--para 1 -->
26972 Additional arithmetic types, such as __int128 or double double, and their
26973 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
26974 more range or precision than long double, may be used for evaluating expressions of
26975 other floating types, and may be used to define float_t or double_t.
26977 <h4><a name="J.5.7" href="#J.5.7">J.5.7 Function pointer casts</a></h4>
26978 <p><!--para 1 -->
26979 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
26980 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
26981 <p><!--para 2 -->
26982 A pointer to a function may be cast to a pointer to an object or to void, allowing a
26983 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
26985 <h4><a name="J.5.8" href="#J.5.8">J.5.8 Extended bit-field types</a></h4>
26986 <p><!--para 1 -->
26987 A bit-field may be declared with a type other than _Bool, unsigned int, or
26988 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
26990 <h4><a name="J.5.9" href="#J.5.9">J.5.9 The fortran keyword</a></h4>
26991 <p><!--para 1 -->
26992 The fortran function specifier may be used in a function declaration to indicate that
26993 calls suitable for FORTRAN should be generated, or that a different representation for the
26994 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
26996 <h4><a name="J.5.10" href="#J.5.10">J.5.10 The asm keyword</a></h4>
26997 <p><!--para 1 -->
26998 The asm keyword may be used to insert assembly language directly into the translator
26999 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
27000 <pre>
27001 asm ( character-string-literal );</pre>
27003 <h4><a name="J.5.11" href="#J.5.11">J.5.11 Multiple external definitions</a></h4>
27004 <p><!--para 1 -->
27005 There may be more than one external definition for the identifier of an object, with or
27006 without the explicit use of the keyword extern; if the definitions disagree, or more than
27007 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
27009 <h4><a name="J.5.12" href="#J.5.12">J.5.12 Predefined macro names</a></h4>
27010 <p><!--para 1 -->
27011 Macro names that do not begin with an underscore, describing the translation and
27012 execution environments, are defined by the implementation before translation begins
27013 (<a href="#6.10.8">6.10.8</a>).
27014 <!--page 595 -->
27016 <h4><a name="J.5.13" href="#J.5.13">J.5.13 Floating-point status flags</a></h4>
27017 <p><!--para 1 -->
27018 If any floating-point status flags are set on normal termination after all calls to functions
27019 registered by the atexit function have been made (see <a href="#7.22.4.4">7.22.4.4</a>), the implementation
27020 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
27022 <h4><a name="J.5.14" href="#J.5.14">J.5.14 Extra arguments for signal handlers</a></h4>
27023 <p><!--para 1 -->
27024 Handlers for specific signals are called with extra arguments in addition to the signal
27025 number (<a href="#7.14.1.1">7.14.1.1</a>).
27027 <h4><a name="J.5.15" href="#J.5.15">J.5.15 Additional stream types and file-opening modes</a></h4>
27028 <p><!--para 1 -->
27029 Additional mappings from files to streams are supported (<a href="#7.21.2">7.21.2</a>).
27030 <p><!--para 2 -->
27031 Additional file-opening modes may be specified by characters appended to the mode
27032 argument of the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
27034 <h4><a name="J.5.16" href="#J.5.16">J.5.16 Defined file position indicator</a></h4>
27035 <p><!--para 1 -->
27036 The file position indicator is decremented by each successful call to the ungetc or
27037 ungetwc function for a text stream, except if its value was zero before a call (<a href="#7.21.7.10">7.21.7.10</a>,
27038 <a href="#7.28.3.10">7.28.3.10</a>).
27040 <h4><a name="J.5.17" href="#J.5.17">J.5.17 Math error reporting</a></h4>
27041 <p><!--para 1 -->
27042 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
27043 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
27044 <a href="#7.12">7.12</a>).
27045 <!--page 596 -->
27047 <h2><a name="K" href="#K">Annex K</a></h2>
27048 <pre>
27049 (normative)
27050 Bounds-checking interfaces</pre>
27052 <h3><a name="K.1" href="#K.1">K.1 Background</a></h3>
27053 <p><!--para 1 -->
27054 Traditionally, the C Library has contained many functions that trust the programmer to
27055 provide output character arrays big enough to hold the result being produced. Not only
27056 do these functions not check that the arrays are big enough, they frequently lack the
27057 information needed to perform such checks. While it is possible to write safe, robust, and
27058 error-free code using the existing library, the library tends to promote programming styles
27059 that lead to mysterious failures if a result is too big for the provided array.
27060 <p><!--para 2 -->
27061 A common programming style is to declare character arrays large enough to handle most
27062 practical cases. However, if these arrays are not large enough to handle the resulting
27063 strings, data can be written past the end of the array overwriting other data and program
27064 structures. The program never gets any indication that a problem exists, and so never has
27065 a chance to recover or to fail gracefully.
27066 <p><!--para 3 -->
27067 Worse, this style of programming has compromised the security of computers and
27068 networks. Buffer overflows can often be exploited to run arbitrary code with the
27069 permissions of the vulnerable (defective) program.
27070 <p><!--para 4 -->
27071 If the programmer writes runtime checks to verify lengths before calling library
27072 functions, then those runtime checks frequently duplicate work done inside the library
27073 functions, which discover string lengths as a side effect of doing their job.
27074 <p><!--para 5 -->
27075 This annex provides alternative library functions that promote safer, more secure
27076 programming. The alternative functions verify that output buffers are large enough for
27077 the intended result and return a failure indicator if they are not. Data is never written past
27078 the end of an array. All string results are null terminated.
27079 <p><!--para 6 -->
27080 This annex also addresses another problem that complicates writing robust code:
27081 functions that are not reentrant because they return pointers to static objects owned by the
27082 function. Such functions can be troublesome since a previously returned result can
27083 change if the function is called again, perhaps by another thread.
27084 <!--page 597 -->
27086 <h3><a name="K.2" href="#K.2">K.2 Scope</a></h3>
27087 <p><!--para 1 -->
27088 This annex specifies a series of optional extensions that can be useful in the mitigation of
27089 security vulnerabilities in programs, and comprise new functions, macros, and types
27090 declared or defined in existing standard headers.
27091 <p><!--para 2 -->
27092 An implementation that defines __STDC_LIB_EXT1__ shall conform to the
27093 specifications in this annex.<sup><a href="#note367"><b>367)</b></a></sup>
27094 <p><!--para 3 -->
27095 Subclause <a href="#K.3">K.3</a> should be read as if it were merged into the parallel structure of named
27096 subclauses of clause 7.
27098 <h6>footnotes</h6>
27099 <p><small><a name="note367" href="#note367">367)</a> Implementations that do not define __STDC_LIB_EXT1__ are not required to conform to these
27100 specifications.
27101 </small>
27103 <h3><a name="K.3" href="#K.3">K.3 Library</a></h3>
27105 <h4><a name="K.3.1" href="#K.3.1">K.3.1 Introduction</a></h4>
27107 <h5><a name="K.3.1.1" href="#K.3.1.1">K.3.1.1 Standard headers</a></h5>
27108 <p><!--para 1 -->
27109 The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are not
27110 declared or defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
27111 defined as a macro which expands to the integer constant 0 at the point in the source file
27112 where the appropriate header is first included.
27113 <p><!--para 2 -->
27114 The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are
27115 declared and defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
27116 defined as a macro which expands to the integer constant 1 at the point in the source file
27117 where the appropriate header is first included.<sup><a href="#note368"><b>368)</b></a></sup>
27118 <p><!--para 3 -->
27119 It is implementation-defined whether the functions, macros, and types declared or defined
27120 in <a href="#K.3">K.3</a> and its subclauses are declared or defined by their respective headers if
27121 __STDC_WANT_LIB_EXT1__ is not defined as a macro at the point in the source file
27122 where the appropriate header is first included.<sup><a href="#note369"><b>369)</b></a></sup>
27123 <p><!--para 4 -->
27124 Within a preprocessing translation unit, __STDC_WANT_LIB_EXT1__ shall be
27125 defined identically for all inclusions of any headers from subclause <a href="#K.3">K.3</a>. If
27126 __STDC_WANT_LIB_EXT1__ is defined differently for any such inclusion, the
27127 implementation shall issue a diagnostic as if a preprocessor error directive were used.
27130 <!--page 598 -->
27132 <h6>footnotes</h6>
27133 <p><small><a name="note368" href="#note368">368)</a> Future revisions of this International Standard may define meanings for other values of
27134 __STDC_WANT_LIB_EXT1__.
27135 </small>
27136 <p><small><a name="note369" href="#note369">369)</a> Subclause <a href="#7.1.3">7.1.3</a> reserves certain names and patterns of names that an implementation may use in
27137 headers. All other names are not reserved, and a conforming implementation is not permitted to use
27138 them. While some of the names defined in <a href="#K.3">K.3</a> and its subclauses are reserved, others are not. If an
27139 unreserved name is defined in a header when __STDC_WANT_LIB_EXT1__ is defined as 0, the
27140 implementation is not conforming.
27141 </small>
27143 <h5><a name="K.3.1.2" href="#K.3.1.2">K.3.1.2 Reserved identifiers</a></h5>
27144 <p><!--para 1 -->
27145 Each macro name in any of the following subclauses is reserved for use as specified if it
27146 is defined by any of its associated headers when included; unless explicitly stated
27147 otherwise (see <a href="#7.1.4">7.1.4</a>).
27148 <p><!--para 2 -->
27149 All identifiers with external linkage in any of the following subclauses are reserved for
27150 use as identifiers with external linkage if any of them are used by the program. None of
27151 them are reserved if none of them are used.
27152 <p><!--para 3 -->
27153 Each identifier with file scope listed in any of the following subclauses is reserved for use
27154 as a macro name and as an identifier with file scope in the same name space if it is
27155 defined by any of its associated headers when included.
27157 <h5><a name="K.3.1.3" href="#K.3.1.3">K.3.1.3 Use of errno</a></h5>
27158 <p><!--para 1 -->
27159 An implementation may set errno for the functions defined in this annex, but is not
27160 required to.
27162 <h5><a name="K.3.1.4" href="#K.3.1.4">K.3.1.4 Runtime-constraint violations</a></h5>
27163 <p><!--para 1 -->
27164 Most functions in this annex include as part of their specification a list of runtime-
27165 constraints. These runtime-constraints are requirements on the program using the
27166 library.<sup><a href="#note370"><b>370)</b></a></sup>
27167 <p><!--para 2 -->
27168 Implementations shall verify that the runtime-constraints for a function are not violated
27169 by the program. If a runtime-constraint is violated, the implementation shall call the
27170 currently registered runtime-constraint handler (see set_constraint_handler_s
27171 in <a href="#7.22">&lt;stdlib.h&gt;</a>). Multiple runtime-constraint violations in the same call to a library
27172 function result in only one call to the runtime-constraint handler. It is unspecified which
27173 one of the multiple runtime-constraint violations cause the handler to be called.
27174 <p><!--para 3 -->
27175 If the runtime-constraints section for a function states an action to be performed when a
27176 runtime-constraint violation occurs, the function shall perform the action before calling
27177 the runtime-constraint handler. If the runtime-constraints section lists actions that are
27178 prohibited when a runtime-constraint violation occurs, then such actions are prohibited to
27179 the function both before calling the handler and after the handler returns.
27180 <p><!--para 4 -->
27181 The runtime-constraint handler might not return. If the handler does return, the library
27182 function whose runtime-constraint was violated shall return some indication of failure as
27183 given by the returns section in the function's specification.
27187 <!--page 599 -->
27189 <h6>footnotes</h6>
27190 <p><small><a name="note370" href="#note370">370)</a> Although runtime-constraints replace many cases of undefined behavior, undefined behavior still
27191 exists in this annex. Implementations are free to detect any case of undefined behavior and treat it as a
27192 runtime-constraint violation by calling the runtime-constraint handler. This license comes directly
27193 from the definition of undefined behavior.
27194 </small>
27196 <h4><a name="K.3.2" href="#K.3.2">K.3.2 Errors <errno.h></a></h4>
27197 <p><!--para 1 -->
27198 The header <a href="#7.5">&lt;errno.h&gt;</a> defines a type.
27199 <p><!--para 2 -->
27200 The type is
27201 <pre>
27202 errno_t</pre>
27203 which is type int.<sup><a href="#note371"><b>371)</b></a></sup>
27205 <h6>footnotes</h6>
27206 <p><small><a name="note371" href="#note371">371)</a> As a matter of programming style, errno_t may be used as the type of something that deals only
27207 with the values that might be found in errno. For example, a function which returns the value of
27208 errno might be declared as having the return type errno_t.
27209 </small>
27211 <h4><a name="K.3.3" href="#K.3.3">K.3.3 Common definitions <stddef.h></a></h4>
27212 <p><!--para 1 -->
27213 The header <a href="#7.19">&lt;stddef.h&gt;</a> defines a type.
27214 <p><!--para 2 -->
27215 The type is
27216 <pre>
27217 rsize_t</pre>
27218 which is the type size_t.<sup><a href="#note372"><b>372)</b></a></sup>
27220 <h6>footnotes</h6>
27221 <p><small><a name="note372" href="#note372">372)</a> See the description of the RSIZE_MAX macro in <a href="#7.20">&lt;stdint.h&gt;</a>.
27222 </small>
27224 <h4><a name="K.3.4" href="#K.3.4">K.3.4 Integer types <stdint.h></a></h4>
27225 <p><!--para 1 -->
27226 The header <a href="#7.20">&lt;stdint.h&gt;</a> defines a macro.
27227 <p><!--para 2 -->
27228 The macro is
27229 <pre>
27230 RSIZE_MAX</pre>
27231 which expands to a value<sup><a href="#note373"><b>373)</b></a></sup> of type size_t. Functions that have parameters of type
27232 rsize_t consider it a runtime-constraint violation if the values of those parameters are
27233 greater than RSIZE_MAX.
27234 <h6>Recommended practice</h6>
27235 <p><!--para 3 -->
27236 Extremely large object sizes are frequently a sign that an object's size was calculated
27237 incorrectly. For example, negative numbers appear as very large positive numbers when
27238 converted to an unsigned type like size_t. Also, some implementations do not support
27239 objects as large as the maximum value that can be represented by type size_t.
27240 <p><!--para 4 -->
27241 For those reasons, it is sometimes beneficial to restrict the range of object sizes to detect
27242 programming errors. For implementations targeting machines with large address spaces,
27243 it is recommended that RSIZE_MAX be defined as the smaller of the size of the largest
27244 object supported or (SIZE_MAX &gt;&gt; 1), even if this limit is smaller than the size of
27245 some legitimate, but very large, objects. Implementations targeting machines with small
27246 address spaces may wish to define RSIZE_MAX as SIZE_MAX, which means that there
27248 <!--page 600 -->
27249 is no object size that is considered a runtime-constraint violation.
27251 <h6>footnotes</h6>
27252 <p><small><a name="note373" href="#note373">373)</a> The macro RSIZE_MAX need not expand to a constant expression.
27253 </small>
27255 <h4><a name="K.3.5" href="#K.3.5">K.3.5 Input/output <stdio.h></a></h4>
27256 <p><!--para 1 -->
27257 The header <a href="#7.21">&lt;stdio.h&gt;</a> defines several macros and two types.
27258 <p><!--para 2 -->
27259 The macros are
27260 <pre>
27261 L_tmpnam_s</pre>
27262 which expands to an integer constant expression that is the size needed for an array of
27263 char large enough to hold a temporary file name string generated by the tmpnam_s
27264 function;
27265 <pre>
27266 TMP_MAX_S</pre>
27267 which expands to an integer constant expression that is the maximum number of unique
27268 file names that can be generated by the tmpnam_s function.
27269 <p><!--para 3 -->
27270 The types are
27271 <pre>
27272 errno_t</pre>
27273 which is type int; and
27274 <pre>
27275 rsize_t</pre>
27276 which is the type size_t.
27278 <h5><a name="K.3.5.1" href="#K.3.5.1">K.3.5.1 Operations on files</a></h5>
27280 <h5><a name="K.3.5.1.1" href="#K.3.5.1.1">K.3.5.1.1 The tmpfile_s function</a></h5>
27281 <h6>Synopsis</h6>
27282 <p><!--para 1 -->
27283 <pre>
27284 #define __STDC_WANT_LIB_EXT1__ 1
27285 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27286 errno_t tmpfile_s(FILE * restrict * restrict streamptr);</pre>
27287 Runtime-constraints
27288 <p><!--para 2 -->
27289 streamptr shall not be a null pointer.
27290 <p><!--para 3 -->
27291 If there is a runtime-constraint violation, tmpfile_s does not attempt to create a file.
27292 <h6>Description</h6>
27293 <p><!--para 4 -->
27294 The tmpfile_s function creates a temporary binary file that is different from any other
27295 existing file and that will automatically be removed when it is closed or at program
27296 termination. If the program terminates abnormally, whether an open temporary file is
27297 removed is implementation-defined. The file is opened for update with "wb+" mode
27298 with the meaning that mode has in the fopen_s function (including the mode's effect
27299 on exclusive access and file permissions).
27300 <!--page 601 -->
27301 <p><!--para 5 -->
27302 If the file was created successfully, then the pointer to FILE pointed to by streamptr
27303 will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
27304 to FILE pointed to by streamptr will be set to a null pointer.
27305 <h6>Recommended practice</h6>
27306 It should be possible to open at least TMP_MAX_S temporary files during the lifetime of
27307 the program (this limit may be shared with tmpnam_s) and there should be no limit on
27308 the number simultaneously open other than this limit and any limit on the number of open
27309 files (FOPEN_MAX).
27310 <h6>Returns</h6>
27311 <p><!--para 6 -->
27312 The tmpfile_s function returns zero if it created the file. If it did not create the file or
27313 there was a runtime-constraint violation, tmpfile_s returns a nonzero value.
27315 <h5><a name="K.3.5.1.2" href="#K.3.5.1.2">K.3.5.1.2 The tmpnam_s function</a></h5>
27316 <h6>Synopsis</h6>
27317 <p><!--para 1 -->
27318 <pre>
27319 #define __STDC_WANT_LIB_EXT1__ 1
27320 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27321 errno_t tmpnam_s(char *s, rsize_t maxsize);</pre>
27322 Runtime-constraints
27323 <p><!--para 2 -->
27324 s shall not be a null pointer. maxsize shall be less than or equal to RSIZE_MAX.
27325 maxsize shall be greater than the length of the generated file name string.
27326 <h6>Description</h6>
27327 <p><!--para 3 -->
27328 The tmpnam_s function generates a string that is a valid file name and that is not the
27329 same as the name of an existing file.<sup><a href="#note374"><b>374)</b></a></sup> The function is potentially capable of generating
27330 TMP_MAX_S different strings, but any or all of them may already be in use by existing
27331 files and thus not be suitable return values. The lengths of these strings shall be less than
27332 the value of the L_tmpnam_s macro.
27333 <p><!--para 4 -->
27334 The tmpnam_s function generates a different string each time it is called.
27335 <p><!--para 5 -->
27336 It is assumed that s points to an array of at least maxsize characters. This array will be
27337 set to generated string, as specified below.
27341 <!--page 602 -->
27342 <p><!--para 6 -->
27343 The implementation shall behave as if no library function except tmpnam calls the
27344 tmpnam_s function.<sup><a href="#note375"><b>375)</b></a></sup>
27345 <h6>Recommended practice</h6>
27346 <p><!--para 7 -->
27347 After a program obtains a file name using the tmpnam_s function and before the
27348 program creates a file with that name, the possibility exists that someone else may create
27349 a file with that same name. To avoid this race condition, the tmpfile_s function
27350 should be used instead of tmpnam_s when possible. One situation that requires the use
27351 of the tmpnam_s function is when the program needs to create a temporary directory
27352 rather than a temporary file.
27353 <h6>Returns</h6>
27354 <p><!--para 8 -->
27355 If no suitable string can be generated, or if there is a runtime-constraint violation, the
27356 tmpnam_s function writes a null character to s[0] (only if s is not null and maxsize
27357 is greater than zero) and returns a nonzero value.
27358 <p><!--para 9 -->
27359 Otherwise, the tmpnam_s function writes the string in the array pointed to by s and
27360 returns zero.
27361 <h6>Environmental limits</h6>
27362 <p><!--para 10 -->
27363 The value of the macro TMP_MAX_S shall be at least 25.
27365 <h6>footnotes</h6>
27366 <p><small><a name="note374" href="#note374">374)</a> Files created using strings generated by the tmpnam_s function are temporary only in the sense that
27367 their names should not collide with those generated by conventional naming rules for the
27368 implementation. It is still necessary to use the remove function to remove such files when their use
27369 is ended, and before program termination. Implementations should take care in choosing the patterns
27370 used for names returned by tmpnam_s. For example, making a thread id part of the names avoids the
27371 race condition and possible conflict when multiple programs run simultaneously by the same user
27372 generate the same temporary file names.
27373 </small>
27374 <p><small><a name="note375" href="#note375">375)</a> An implementation may have tmpnam call tmpnam_s (perhaps so there is only one naming
27375 convention for temporary files), but this is not required.
27376 </small>
27378 <h5><a name="K.3.5.2" href="#K.3.5.2">K.3.5.2 File access functions</a></h5>
27380 <h5><a name="K.3.5.2.1" href="#K.3.5.2.1">K.3.5.2.1 The fopen_s function</a></h5>
27381 <h6>Synopsis</h6>
27382 <p><!--para 1 -->
27383 <pre>
27384 #define __STDC_WANT_LIB_EXT1__ 1
27385 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27386 errno_t fopen_s(FILE * restrict * restrict streamptr,
27387 const char * restrict filename,
27388 const char * restrict mode);</pre>
27389 Runtime-constraints
27390 <p><!--para 2 -->
27391 None of streamptr, filename, or mode shall be a null pointer.
27392 <p><!--para 3 -->
27393 If there is a runtime-constraint violation, fopen_s does not attempt to open a file.
27394 Furthermore, if streamptr is not a null pointer, fopen_s sets *streamptr to the
27395 null pointer.
27400 <!--page 603 -->
27401 <h6>Description</h6>
27402 <p><!--para 4 -->
27403 The fopen_s function opens the file whose name is the string pointed to by
27404 filename, and associates a stream with it.
27405 <p><!--para 5 -->
27406 The mode string shall be as described for fopen, with the addition that modes starting
27407 with the character 'w' or 'a' may be preceded by the character 'u', see below:
27408 uw truncate to zero length or create text file for writing, default
27409 <pre>
27410 permissions</pre>
27411 uwx create text file for writing, default permissions
27412 ua append; open or create text file for writing at end-of-file, default
27413 <pre>
27414 permissions</pre>
27415 uwb truncate to zero length or create binary file for writing, default
27416 <pre>
27417 permissions</pre>
27418 uwbx create binary file for writing, default permissions
27419 uab append; open or create binary file for writing at end-of-file, default
27420 <pre>
27421 permissions</pre>
27422 uw+ truncate to zero length or create text file for update, default
27423 <pre>
27424 permissions</pre>
27425 uw+x create text file for update, default permissions
27426 ua+ append; open or create text file for update, writing at end-of-file,
27427 <pre>
27428 default permissions</pre>
27429 uw+b or uwb+ truncate to zero length or create binary file for update, default
27430 <pre>
27431 permissions</pre>
27432 uw+bx or uwb+x create binary file for update, default permissions
27433 ua+b or uab+ append; open or create binary file for update, writing at end-of-file,
27434 <p><!--para 6 -->
27435 <pre>
27436 default permissions</pre>
27437 Opening a file with exclusive mode ('x' as the last character in the mode argument)
27438 fails if the file already exists or cannot be created.
27439 <p><!--para 7 -->
27440 To the extent that the underlying system supports the concepts, files opened for writing
27441 shall be opened with exclusive (also known as non-shared) access. If the file is being
27442 created, and the first character of the mode string is not 'u', to the extent that the
27443 underlying system supports it, the file shall have a file permission that prevents other
27444 users on the system from accessing the file. If the file is being created and first character
27445 of the mode string is 'u', then by the time the file has been closed, it shall have the
27446 system default file access permissions.<sup><a href="#note376"><b>376)</b></a></sup>
27447 <p><!--para 8 -->
27448 If the file was opened successfully, then the pointer to FILE pointed to by streamptr
27449 will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
27452 <!--page 604 -->
27453 to FILE pointed to by streamptr will be set to a null pointer.
27454 <h6>Returns</h6>
27455 <p><!--para 9 -->
27456 The fopen_s function returns zero if it opened the file. If it did not open the file or if
27457 there was a runtime-constraint violation, fopen_s returns a nonzero value.
27459 <h6>footnotes</h6>
27460 <p><small><a name="note376" href="#note376">376)</a> These are the same permissions that the file would have been created with by fopen.
27461 </small>
27463 <h5><a name="K.3.5.2.2" href="#K.3.5.2.2">K.3.5.2.2 The freopen_s function</a></h5>
27464 <h6>Synopsis</h6>
27465 <p><!--para 1 -->
27466 <pre>
27467 #define __STDC_WANT_LIB_EXT1__ 1
27468 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27469 errno_t freopen_s(FILE * restrict * restrict newstreamptr,
27470 const char * restrict filename,
27471 const char * restrict mode,
27472 FILE * restrict stream);</pre>
27473 Runtime-constraints
27474 <p><!--para 2 -->
27475 None of newstreamptr, mode, and stream shall be a null pointer.
27476 <p><!--para 3 -->
27477 If there is a runtime-constraint violation, freopen_s neither attempts to close any file
27478 associated with stream nor attempts to open a file. Furthermore, if newstreamptr is
27479 not a null pointer, fopen_s sets *newstreamptr to the null pointer.
27480 <h6>Description</h6>
27481 <p><!--para 4 -->
27482 The freopen_s function opens the file whose name is the string pointed to by
27483 filename and associates the stream pointed to by stream with it. The mode
27484 argument has the same meaning as in the fopen_s function (including the mode's effect
27485 on exclusive access and file permissions).
27486 <p><!--para 5 -->
27487 If filename is a null pointer, the freopen_s function attempts to change the mode of
27488 the stream to that specified by mode, as if the name of the file currently associated with
27489 the stream had been used. It is implementation-defined which changes of mode are
27490 permitted (if any), and under what circumstances.
27491 <p><!--para 6 -->
27492 The freopen_s function first attempts to close any file that is associated with stream.
27493 Failure to close the file is ignored. The error and end-of-file indicators for the stream are
27494 cleared.
27495 <p><!--para 7 -->
27496 If the file was opened successfully, then the pointer to FILE pointed to by
27497 newstreamptr will be set to the value of stream. Otherwise, the pointer to FILE
27498 pointed to by newstreamptr will be set to a null pointer.
27499 <h6>Returns</h6>
27500 <p><!--para 8 -->
27501 The freopen_s function returns zero if it opened the file. If it did not open the file or
27502 there was a runtime-constraint violation, freopen_s returns a nonzero value.
27503 <!--page 605 -->
27505 <h5><a name="K.3.5.3" href="#K.3.5.3">K.3.5.3 Formatted input/output functions</a></h5>
27506 <p><!--para 1 -->
27507 Unless explicitly stated otherwise, if the execution of a function described in this
27508 subclause causes copying to take place between objects that overlap, the objects take on
27509 unspecified values.
27511 <h5><a name="K.3.5.3.1" href="#K.3.5.3.1">K.3.5.3.1 The fprintf_s function</a></h5>
27512 <h6>Synopsis</h6>
27513 <p><!--para 1 -->
27514 <pre>
27515 #define __STDC_WANT_LIB_EXT1__ 1
27516 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27517 int fprintf_s(FILE * restrict stream,
27518 const char * restrict format, ...);</pre>
27519 Runtime-constraints
27520 <p><!--para 2 -->
27521 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note377"><b>377)</b></a></sup> (modified or
27522 not by flags, field width, or precision) shall not appear in the string pointed to by
27523 format. Any argument to fprintf_s corresponding to a %s specifier shall not be a
27524 null pointer.
27525 <p><!--para 3 -->
27526 If there is a runtime-constraint violation,<sup><a href="#note378"><b>378)</b></a></sup> the fprintf_s function does not attempt
27527 to produce further output, and it is unspecified to what extent fprintf_s produced
27528 output before discovering the runtime-constraint violation.
27529 <h6>Description</h6>
27530 <p><!--para 4 -->
27531 The fprintf_s function is equivalent to the fprintf function except for the explicit
27532 runtime-constraints listed above.
27533 <h6>Returns</h6>
27534 <p><!--para 5 -->
27535 The fprintf_s function returns the number of characters transmitted, or a negative
27536 value if an output error, encoding error, or runtime-constraint violation occurred.
27541 <!--page 606 -->
27543 <h6>footnotes</h6>
27544 <p><small><a name="note377" href="#note377">377)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
27545 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
27546 format string was %%n.
27547 </small>
27548 <p><small><a name="note378" href="#note378">378)</a> Because an implementation may treat any undefined behavior as a runtime-constraint violation, an
27549 implementation may treat any unsupported specifiers in the string pointed to by format as a runtime-
27550 constraint violation.
27551 </small>
27553 <h5><a name="K.3.5.3.2" href="#K.3.5.3.2">K.3.5.3.2 The fscanf_s function</a></h5>
27554 <h6>Synopsis</h6>
27555 <p><!--para 1 -->
27556 <pre>
27557 #define __STDC_WANT_LIB_EXT1__ 1
27558 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27559 int fscanf_s(FILE * restrict stream,
27560 const char * restrict format, ...);</pre>
27561 Runtime-constraints
27562 <p><!--para 2 -->
27563 Neither stream nor format shall be a null pointer. Any argument indirected though in
27564 order to store converted input shall not be a null pointer.
27565 <p><!--para 3 -->
27566 If there is a runtime-constraint violation,<sup><a href="#note379"><b>379)</b></a></sup> the fscanf_s function does not attempt to
27567 perform further input, and it is unspecified to what extent fscanf_s performed input
27568 before discovering the runtime-constraint violation.
27569 <h6>Description</h6>
27570 <p><!--para 4 -->
27571 The fscanf_s function is equivalent to fscanf except that the c, s, and [ conversion
27572 specifiers apply to a pair of arguments (unless assignment suppression is indicated by a
27573 *). The first of these arguments is the same as for fscanf. That argument is
27574 immediately followed in the argument list by the second argument, which has type
27575 rsize_t and gives the number of elements in the array pointed to by the first argument
27576 of the pair. If the first argument points to a scalar object, it is considered to be an array of
27577 one element.<sup><a href="#note380"><b>380)</b></a></sup>
27578 <p><!--para 5 -->
27579 A matching failure occurs if the number of elements in a receiving object is insufficient to
27580 hold the converted input (including any trailing null character).
27581 <h6>Returns</h6>
27582 <p><!--para 6 -->
27583 The fscanf_s function returns the value of the macro EOF if an input failure occurs
27584 before any conversion or if there is a runtime-constraint violation. Otherwise, the
27586 <!--page 607 -->
27587 fscanf_s function returns the number of input items assigned, which can be fewer than
27588 provided for, or even zero, in the event of an early matching failure.
27589 <p><!--para 7 -->
27590 EXAMPLE 1 The call:
27591 <pre>
27592 #define __STDC_WANT_LIB_EXT1__ 1
27593 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27594 /* ... */
27595 int n, i; float x; char name[50];
27596 n = fscanf_s(stdin, "%d%f%s", &amp;i, &amp;x, name, (rsize_t) 50);</pre>
27597 with the input line:
27598 <pre>
27599 25 54.32E-1 thompson</pre>
27600 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
27601 thompson\0.
27603 <p><!--para 8 -->
27604 EXAMPLE 2 The call:
27605 <pre>
27606 #define __STDC_WANT_LIB_EXT1__ 1
27607 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27608 /* ... */
27609 int n; char s[5];
27610 n = fscanf_s(stdin, "%s", s, sizeof s);</pre>
27611 with the input line:
27612 <pre>
27613 hello</pre>
27614 will assign to n the value 0 since a matching failure occurred because the sequence hello\0 requires an
27615 array of six characters to store it.
27618 <h6>footnotes</h6>
27619 <p><small><a name="note379" href="#note379">379)</a> Because an implementation may treat any undefined behavior as a runtime-constraint violation, an
27620 implementation may treat any unsupported specifiers in the string pointed to by format as a runtime-
27621 constraint violation.
27622 </small>
27623 <p><small><a name="note380" href="#note380">380)</a> If the format is known at translation time, an implementation may issue a diagnostic for any argument
27624 used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
27625 argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
27626 the format is not known at translation time. For example, an implementation may issue a diagnostic
27627 for each argument after format that has of type pointer to one of char, signed char,
27628 unsigned char, or void that is not followed by an argument of a type compatible with
27629 rsize_t. The diagnostic could warn that unless the pointer is being used with a conversion specifier
27630 using the hh length modifier, a length argument must follow the pointer argument. Another useful
27631 diagnostic could flag any non-pointer argument following format that did not have a type
27632 compatible with rsize_t.
27633 </small>
27635 <h5><a name="K.3.5.3.3" href="#K.3.5.3.3">K.3.5.3.3 The printf_s function</a></h5>
27636 <h6>Synopsis</h6>
27637 <p><!--para 1 -->
27638 <pre>
27639 #define __STDC_WANT_LIB_EXT1__ 1
27640 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27641 int printf_s(const char * restrict format, ...);</pre>
27642 Runtime-constraints
27643 <p><!--para 2 -->
27644 format shall not be a null pointer. The %n specifier<sup><a href="#note381"><b>381)</b></a></sup> (modified or not by flags, field
27645 width, or precision) shall not appear in the string pointed to by format. Any argument
27646 to printf_s corresponding to a %s specifier shall not be a null pointer.
27647 <p><!--para 3 -->
27648 If there is a runtime-constraint violation, the printf_s function does not attempt to
27649 produce further output, and it is unspecified to what extent printf_s produced output
27650 before discovering the runtime-constraint violation.
27653 <!--page 608 -->
27654 <h6>Description</h6>
27655 <p><!--para 4 -->
27656 The printf_s function is equivalent to the printf function except for the explicit
27657 runtime-constraints listed above.
27658 <h6>Returns</h6>
27659 <p><!--para 5 -->
27660 The printf_s function returns the number of characters transmitted, or a negative
27661 value if an output error, encoding error, or runtime-constraint violation occurred.
27663 <h6>footnotes</h6>
27664 <p><small><a name="note381" href="#note381">381)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
27665 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
27666 format string was %%n.
27667 </small>
27669 <h5><a name="K.3.5.3.4" href="#K.3.5.3.4">K.3.5.3.4 The scanf_s function</a></h5>
27670 <h6>Synopsis</h6>
27671 <p><!--para 1 -->
27672 <pre>
27673 #define __STDC_WANT_LIB_EXT1__ 1
27674 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27675 int scanf_s(const char * restrict format, ...);</pre>
27676 Runtime-constraints
27677 <p><!--para 2 -->
27678 format shall not be a null pointer. Any argument indirected though in order to store
27679 converted input shall not be a null pointer.
27680 <p><!--para 3 -->
27681 If there is a runtime-constraint violation, the scanf_s function does not attempt to
27682 perform further input, and it is unspecified to what extent scanf_s performed input
27683 before discovering the runtime-constraint violation.
27684 <h6>Description</h6>
27685 <p><!--para 4 -->
27686 The scanf_s function is equivalent to fscanf_s with the argument stdin
27687 interposed before the arguments to scanf_s.
27688 <h6>Returns</h6>
27689 <p><!--para 5 -->
27690 The scanf_s function returns the value of the macro EOF if an input failure occurs
27691 before any conversion or if there is a runtime-constraint violation. Otherwise, the
27692 scanf_s function returns the number of input items assigned, which can be fewer than
27693 provided for, or even zero, in the event of an early matching failure.
27695 <h5><a name="K.3.5.3.5" href="#K.3.5.3.5">K.3.5.3.5 The snprintf_s function</a></h5>
27696 <h6>Synopsis</h6>
27697 <p><!--para 1 -->
27698 <pre>
27699 #define __STDC_WANT_LIB_EXT1__ 1
27700 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27701 int snprintf_s(char * restrict s, rsize_t n,
27702 const char * restrict format, ...);</pre>
27703 Runtime-constraints
27704 <p><!--para 2 -->
27705 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
27706 than RSIZE_MAX. The %n specifier<sup><a href="#note382"><b>382)</b></a></sup> (modified or not by flags, field width, or
27707 precision) shall not appear in the string pointed to by format. Any argument to
27708 <!--page 609 -->
27709 snprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
27710 error shall occur.
27711 <p><!--para 3 -->
27712 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
27713 than zero and less than RSIZE_MAX, then the snprintf_s function sets s[0] to the
27714 null character.
27715 <h6>Description</h6>
27716 <p><!--para 4 -->
27717 The snprintf_s function is equivalent to the snprintf function except for the
27718 explicit runtime-constraints listed above.
27719 <p><!--para 5 -->
27720 The snprintf_s function, unlike sprintf_s, will truncate the result to fit within the
27721 array pointed to by s.
27722 <h6>Returns</h6>
27723 <p><!--para 6 -->
27724 The snprintf_s function returns the number of characters that would have been
27725 written had n been sufficiently large, not counting the terminating null character, or a
27726 negative value if a runtime-constraint violation occurred. Thus, the null-terminated
27727 output has been completely written if and only if the returned value is nonnegative and
27728 less than n.
27730 <h6>footnotes</h6>
27731 <p><small><a name="note382" href="#note382">382)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
27732 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
27733 format string was %%n.
27734 </small>
27736 <h5><a name="K.3.5.3.6" href="#K.3.5.3.6">K.3.5.3.6 The sprintf_s function</a></h5>
27737 <h6>Synopsis</h6>
27738 <p><!--para 1 -->
27739 <pre>
27740 #define __STDC_WANT_LIB_EXT1__ 1
27741 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27742 int sprintf_s(char * restrict s, rsize_t n,
27743 const char * restrict format, ...);</pre>
27744 Runtime-constraints
27745 <p><!--para 2 -->
27746 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
27747 than RSIZE_MAX. The number of characters (including the trailing null) required for the
27748 result to be written to the array pointed to by s shall not be greater than n. The %n
27749 specifier<sup><a href="#note383"><b>383)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
27750 string pointed to by format. Any argument to sprintf_s corresponding to a %s
27751 specifier shall not be a null pointer. No encoding error shall occur.
27755 <!--page 610 -->
27756 <p><!--para 3 -->
27757 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
27758 than zero and less than RSIZE_MAX, then the sprintf_s function sets s[0] to the
27759 null character.
27760 <h6>Description</h6>
27761 <p><!--para 4 -->
27762 The sprintf_s function is equivalent to the sprintf function except for the
27763 parameter n and the explicit runtime-constraints listed above.
27764 <p><!--para 5 -->
27765 The sprintf_s function, unlike snprintf_s, treats a result too big for the array
27766 pointed to by s as a runtime-constraint violation.
27767 <h6>Returns</h6>
27768 <p><!--para 6 -->
27769 If no runtime-constraint violation occurred, the sprintf_s function returns the number
27770 of characters written in the array, not counting the terminating null character. If an
27771 encoding error occurred, sprintf_s returns a negative value. If any other runtime-
27772 constraint violation occurred, sprintf_s returns zero.
27774 <h6>footnotes</h6>
27775 <p><small><a name="note383" href="#note383">383)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
27776 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
27777 format string was %%n.
27778 </small>
27780 <h5><a name="K.3.5.3.7" href="#K.3.5.3.7">K.3.5.3.7 The sscanf_s function</a></h5>
27781 <h6>Synopsis</h6>
27782 <p><!--para 1 -->
27783 <pre>
27784 #define __STDC_WANT_LIB_EXT1__ 1
27785 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27786 int sscanf_s(const char * restrict s,
27787 const char * restrict format, ...);</pre>
27788 Runtime-constraints
27789 <p><!--para 2 -->
27790 Neither s nor format shall be a null pointer. Any argument indirected though in order
27791 to store converted input shall not be a null pointer.
27792 <p><!--para 3 -->
27793 If there is a runtime-constraint violation, the sscanf_s function does not attempt to
27794 perform further input, and it is unspecified to what extent sscanf_s performed input
27795 before discovering the runtime-constraint violation.
27796 <h6>Description</h6>
27797 <p><!--para 4 -->
27798 The sscanf_s function is equivalent to fscanf_s, except that input is obtained from
27799 a string (specified by the argument s) rather than from a stream. Reaching the end of the
27800 string is equivalent to encountering end-of-file for the fscanf_s function. If copying
27801 takes place between objects that overlap, the objects take on unspecified values.
27802 <h6>Returns</h6>
27803 <p><!--para 5 -->
27804 The sscanf_s function returns the value of the macro EOF if an input failure occurs
27805 before any conversion or if there is a runtime-constraint violation. Otherwise, the
27806 sscanf_s function returns the number of input items assigned, which can be fewer than
27807 provided for, or even zero, in the event of an early matching failure.
27808 <!--page 611 -->
27810 <h5><a name="K.3.5.3.8" href="#K.3.5.3.8">K.3.5.3.8 The vfprintf_s function</a></h5>
27811 <h6>Synopsis</h6>
27812 <p><!--para 1 -->
27813 <pre>
27814 #define __STDC_WANT_LIB_EXT1__ 1
27815 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
27816 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27817 int vfprintf_s(FILE * restrict stream,
27818 const char * restrict format,
27819 va_list arg);</pre>
27820 Runtime-constraints
27821 <p><!--para 2 -->
27822 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note384"><b>384)</b></a></sup> (modified or
27823 not by flags, field width, or precision) shall not appear in the string pointed to by
27824 format. Any argument to vfprintf_s corresponding to a %s specifier shall not be a
27825 null pointer.
27826 <p><!--para 3 -->
27827 If there is a runtime-constraint violation, the vfprintf_s function does not attempt to
27828 produce further output, and it is unspecified to what extent vfprintf_s produced
27829 output before discovering the runtime-constraint violation.
27830 <h6>Description</h6>
27831 <p><!--para 4 -->
27832 The vfprintf_s function is equivalent to the vfprintf function except for the
27833 explicit runtime-constraints listed above.
27834 <h6>Returns</h6>
27835 <p><!--para 5 -->
27836 The vfprintf_s function returns the number of characters transmitted, or a negative
27837 value if an output error, encoding error, or runtime-constraint violation occurred.
27839 <h6>footnotes</h6>
27840 <p><small><a name="note384" href="#note384">384)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
27841 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
27842 format string was %%n.
27843 </small>
27845 <h5><a name="K.3.5.3.9" href="#K.3.5.3.9">K.3.5.3.9 The vfscanf_s function</a></h5>
27846 <h6>Synopsis</h6>
27847 <p><!--para 1 -->
27848 <pre>
27849 #define __STDC_WANT_LIB_EXT1__ 1
27850 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
27851 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27852 int vfscanf_s(FILE * restrict stream,
27853 const char * restrict format,
27854 va_list arg);</pre>
27859 <!--page 612 -->
27860 Runtime-constraints
27861 <p><!--para 2 -->
27862 Neither stream nor format shall be a null pointer. Any argument indirected though in
27863 order to store converted input shall not be a null pointer.
27864 <p><!--para 3 -->
27865 If there is a runtime-constraint violation, the vfscanf_s function does not attempt to
27866 perform further input, and it is unspecified to what extent vfscanf_s performed input
27867 before discovering the runtime-constraint violation.
27868 <h6>Description</h6>
27869 <p><!--para 4 -->
27870 The vfscanf_s function is equivalent to fscanf_s, with the variable argument list
27871 replaced by arg, which shall have been initialized by the va_start macro (and
27872 possibly subsequent va_arg calls). The vfscanf_s function does not invoke the
27873 va_end macro.<sup><a href="#note385"><b>385)</b></a></sup>
27874 <h6>Returns</h6>
27875 <p><!--para 5 -->
27876 The vfscanf_s function returns the value of the macro EOF if an input failure occurs
27877 before any conversion or if there is a runtime-constraint violation. Otherwise, the
27878 vfscanf_s function returns the number of input items assigned, which can be fewer
27879 than provided for, or even zero, in the event of an early matching failure.
27881 <h6>footnotes</h6>
27882 <p><small><a name="note385" href="#note385">385)</a> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
27883 vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
27884 indeterminate.
27885 </small>
27887 <h5><a name="K.3.5.3.10" href="#K.3.5.3.10">K.3.5.3.10 The vprintf_s function</a></h5>
27888 <h6>Synopsis</h6>
27889 <p><!--para 1 -->
27890 <pre>
27891 #define __STDC_WANT_LIB_EXT1__ 1
27892 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
27893 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27894 int vprintf_s(const char * restrict format,
27895 va_list arg);</pre>
27896 Runtime-constraints
27897 <p><!--para 2 -->
27898 format shall not be a null pointer. The %n specifier<sup><a href="#note386"><b>386)</b></a></sup> (modified or not by flags, field
27899 width, or precision) shall not appear in the string pointed to by format. Any argument
27900 to vprintf_s corresponding to a %s specifier shall not be a null pointer.
27901 <p><!--para 3 -->
27902 If there is a runtime-constraint violation, the vprintf_s function does not attempt to
27903 produce further output, and it is unspecified to what extent vprintf_s produced output
27904 before discovering the runtime-constraint violation.
27906 <!--page 613 -->
27907 <h6>Description</h6>
27908 <p><!--para 4 -->
27909 The vprintf_s function is equivalent to the vprintf function except for the explicit
27910 runtime-constraints listed above.
27911 <h6>Returns</h6>
27912 <p><!--para 5 -->
27913 The vprintf_s function returns the number of characters transmitted, or a negative
27914 value if an output error, encoding error, or runtime-constraint violation occurred.
27916 <h6>footnotes</h6>
27917 <p><small><a name="note386" href="#note386">386)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
27918 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
27919 format string was %%n.
27920 </small>
27922 <h5><a name="K.3.5.3.11" href="#K.3.5.3.11">K.3.5.3.11 The vscanf_s function</a></h5>
27923 <h6>Synopsis</h6>
27924 <p><!--para 1 -->
27925 <pre>
27926 #define __STDC_WANT_LIB_EXT1__ 1
27927 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
27928 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27929 int vscanf_s(const char * restrict format,
27930 va_list arg);</pre>
27931 Runtime-constraints
27932 <p><!--para 2 -->
27933 format shall not be a null pointer. Any argument indirected though in order to store
27934 converted input shall not be a null pointer.
27935 <p><!--para 3 -->
27936 If there is a runtime-constraint violation, the vscanf_s function does not attempt to
27937 perform further input, and it is unspecified to what extent vscanf_s performed input
27938 before discovering the runtime-constraint violation.
27939 <h6>Description</h6>
27940 <p><!--para 4 -->
27941 The vscanf_s function is equivalent to scanf_s, with the variable argument list
27942 replaced by arg, which shall have been initialized by the va_start macro (and
27943 possibly subsequent va_arg calls). The vscanf_s function does not invoke the
27944 va_end macro.<sup><a href="#note387"><b>387)</b></a></sup>
27945 <h6>Returns</h6>
27946 <p><!--para 5 -->
27947 The vscanf_s function returns the value of the macro EOF if an input failure occurs
27948 before any conversion or if there is a runtime-constraint violation. Otherwise, the
27949 vscanf_s function returns the number of input items assigned, which can be fewer than
27950 provided for, or even zero, in the event of an early matching failure.
27955 <!--page 614 -->
27957 <h6>footnotes</h6>
27958 <p><small><a name="note387" href="#note387">387)</a> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
27959 vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
27960 indeterminate.
27961 </small>
27963 <h5><a name="K.3.5.3.12" href="#K.3.5.3.12">K.3.5.3.12 The vsnprintf_s function</a></h5>
27964 <h6>Synopsis</h6>
27965 <p><!--para 1 -->
27966 <pre>
27967 #define __STDC_WANT_LIB_EXT1__ 1
27968 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
27969 #include <a href="#7.21">&lt;stdio.h&gt;</a>
27970 int vsnprintf_s(char * restrict s, rsize_t n,
27971 const char * restrict format,
27972 va_list arg);</pre>
27973 Runtime-constraints
27974 <p><!--para 2 -->
27975 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
27976 than RSIZE_MAX. The %n specifier<sup><a href="#note388"><b>388)</b></a></sup> (modified or not by flags, field width, or
27977 precision) shall not appear in the string pointed to by format. Any argument to
27978 vsnprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
27979 error shall occur.
27980 <p><!--para 3 -->
27981 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
27982 than zero and less than RSIZE_MAX, then the vsnprintf_s function sets s[0] to the
27983 null character.
27984 <h6>Description</h6>
27985 <p><!--para 4 -->
27986 The vsnprintf_s function is equivalent to the vsnprintf function except for the
27987 explicit runtime-constraints listed above.
27988 <p><!--para 5 -->
27989 The vsnprintf_s function, unlike vsprintf_s, will truncate the result to fit within
27990 the array pointed to by s.
27991 <h6>Returns</h6>
27992 <p><!--para 6 -->
27993 The vsnprintf_s function returns the number of characters that would have been
27994 written had n been sufficiently large, not counting the terminating null character, or a
27995 negative value if a runtime-constraint violation occurred. Thus, the null-terminated
27996 output has been completely written if and only if the returned value is nonnegative and
27997 less than n.
28002 <!--page 615 -->
28004 <h6>footnotes</h6>
28005 <p><small><a name="note388" href="#note388">388)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
28006 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
28007 format string was %%n.
28008 </small>
28010 <h5><a name="K.3.5.3.13" href="#K.3.5.3.13">K.3.5.3.13 The vsprintf_s function</a></h5>
28011 <h6>Synopsis</h6>
28012 <p><!--para 1 -->
28013 <pre>
28014 #define __STDC_WANT_LIB_EXT1__ 1
28015 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
28016 #include <a href="#7.21">&lt;stdio.h&gt;</a>
28017 int vsprintf_s(char * restrict s, rsize_t n,
28018 const char * restrict format,
28019 va_list arg);</pre>
28020 Runtime-constraints
28021 <p><!--para 2 -->
28022 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
28023 than RSIZE_MAX. The number of characters (including the trailing null) required for the
28024 result to be written to the array pointed to by s shall not be greater than n. The %n
28025 specifier<sup><a href="#note389"><b>389)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
28026 string pointed to by format. Any argument to vsprintf_s corresponding to a %s
28027 specifier shall not be a null pointer. No encoding error shall occur.
28028 <p><!--para 3 -->
28029 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
28030 than zero and less than RSIZE_MAX, then the vsprintf_s function sets s[0] to the
28031 null character.
28032 <h6>Description</h6>
28033 <p><!--para 4 -->
28034 The vsprintf_s function is equivalent to the vsprintf function except for the
28035 parameter n and the explicit runtime-constraints listed above.
28036 <p><!--para 5 -->
28037 The vsprintf_s function, unlike vsnprintf_s, treats a result too big for the array
28038 pointed to by s as a runtime-constraint violation.
28039 <h6>Returns</h6>
28040 <p><!--para 6 -->
28041 If no runtime-constraint violation occurred, the vsprintf_s function returns the
28042 number of characters written in the array, not counting the terminating null character. If
28043 an encoding error occurred, vsprintf_s returns a negative value. If any other
28044 runtime-constraint violation occurred, vsprintf_s returns zero.
28049 <!--page 616 -->
28051 <h6>footnotes</h6>
28052 <p><small><a name="note389" href="#note389">389)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
28053 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
28054 format string was %%n.
28055 </small>
28057 <h5><a name="K.3.5.3.14" href="#K.3.5.3.14">K.3.5.3.14 The vsscanf_s function</a></h5>
28058 <h6>Synopsis</h6>
28059 <p><!--para 1 -->
28060 <pre>
28061 #define __STDC_WANT_LIB_EXT1__ 1
28062 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
28063 #include <a href="#7.21">&lt;stdio.h&gt;</a>
28064 int vsscanf_s(const char * restrict s,
28065 const char * restrict format,
28066 va_list arg);</pre>
28067 Runtime-constraints
28068 <p><!--para 2 -->
28069 Neither s nor format shall be a null pointer. Any argument indirected though in order
28070 to store converted input shall not be a null pointer.
28071 <p><!--para 3 -->
28072 If there is a runtime-constraint violation, the vsscanf_s function does not attempt to
28073 perform further input, and it is unspecified to what extent vsscanf_s performed input
28074 before discovering the runtime-constraint violation.
28075 <h6>Description</h6>
28076 <p><!--para 4 -->
28077 The vsscanf_s function is equivalent to sscanf_s, with the variable argument list
28078 replaced by arg, which shall have been initialized by the va_start macro (and
28079 possibly subsequent va_arg calls). The vsscanf_s function does not invoke the
28080 va_end macro.<sup><a href="#note390"><b>390)</b></a></sup>
28081 <h6>Returns</h6>
28082 <p><!--para 5 -->
28083 The vsscanf_s function returns the value of the macro EOF if an input failure occurs
28084 before any conversion or if there is a runtime-constraint violation. Otherwise, the
28085 vscanf_s function returns the number of input items assigned, which can be fewer than
28086 provided for, or even zero, in the event of an early matching failure.
28088 <h6>footnotes</h6>
28089 <p><small><a name="note390" href="#note390">390)</a> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
28090 vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
28091 indeterminate.
28092 </small>
28094 <h5><a name="K.3.5.4" href="#K.3.5.4">K.3.5.4 Character input/output functions</a></h5>
28096 <h5><a name="K.3.5.4.1" href="#K.3.5.4.1">K.3.5.4.1 The gets_s function</a></h5>
28097 <h6>Synopsis</h6>
28098 <p><!--para 1 -->
28099 <pre>
28100 #define __STDC_WANT_LIB_EXT1__ 1
28101 #include <a href="#7.21">&lt;stdio.h&gt;</a>
28102 char *gets_s(char *s, rsize_t n);</pre>
28107 <!--page 617 -->
28108 Runtime-constraints
28109 <p><!--para 2 -->
28110 s shall not be a null pointer. n shall neither be equal to zero nor be greater than
28111 RSIZE_MAX. A new-line character, end-of-file, or read error shall occur within reading
28112 n-1 characters from stdin.<sup><a href="#note391"><b>391)</b></a></sup>
28113 <p><!--para 3 -->
28114 If there is a runtime-constraint violation, s[0] is set to the null character, and characters
28115 are read and discarded from stdin until a new-line character is read, or end-of-file or a
28116 read error occurs.
28117 <h6>Description</h6>
28118 <p><!--para 4 -->
28119 The gets_s function reads at most one less than the number of characters specified by n
28120 from the stream pointed to by stdin, into the array pointed to by s. No additional
28121 characters are read after a new-line character (which is discarded) or after end-of-file.
28122 The discarded new-line character does not count towards number of characters read. A
28123 null character is written immediately after the last character read into the array.
28124 <p><!--para 5 -->
28125 If end-of-file is encountered and no characters have been read into the array, or if a read
28126 error occurs during the operation, then s[0] is set to the null character, and the other
28127 elements of s take unspecified values.
28128 <h6>Recommended practice</h6>
28129 <p><!--para 6 -->
28130 The fgets function allows properly-written programs to safely process input lines too
28131 long to store in the result array. In general this requires that callers of fgets pay
28132 attention to the presence or absence of a new-line character in the result array. Consider
28133 using fgets (along with any needed processing based on new-line characters) instead of
28134 gets_s.
28135 <h6>Returns</h6>
28136 <p><!--para 7 -->
28137 The gets_s function returns s if successful. If there was a runtime-constraint violation,
28138 or if end-of-file is encountered and no characters have been read into the array, or if a
28139 read error occurs during the operation, then a null pointer is returned.
28144 <!--page 618 -->
28146 <h6>footnotes</h6>
28147 <p><small><a name="note391" href="#note391">391)</a> The gets_s function, unlike the historical gets function, makes it a runtime-constraint violation for
28148 a line of input to overflow the buffer to store it. Unlike the fgets function, gets_s maintains a
28149 one-to-one relationship between input lines and successful calls to gets_s. Programs that use gets
28150 expect such a relationship.
28151 </small>
28153 <h4><a name="K.3.6" href="#K.3.6">K.3.6 General utilities <stdlib.h></a></h4>
28154 <p><!--para 1 -->
28155 The header <a href="#7.22">&lt;stdlib.h&gt;</a> defines three types.
28156 <p><!--para 2 -->
28157 The types are
28158 <pre>
28159 errno_t</pre>
28160 which is type int; and
28161 <pre>
28162 rsize_t</pre>
28163 which is the type size_t; and
28164 <pre>
28165 constraint_handler_t</pre>
28166 which has the following definition
28167 <pre>
28168 typedef void (*constraint_handler_t)(
28169 const char * restrict msg,
28170 void * restrict ptr,
28171 errno_t error);</pre>
28173 <h5><a name="K.3.6.1" href="#K.3.6.1">K.3.6.1 Runtime-constraint handling</a></h5>
28175 <h5><a name="K.3.6.1.1" href="#K.3.6.1.1">K.3.6.1.1 The set_constraint_handler_s function</a></h5>
28176 <h6>Synopsis</h6>
28177 <p><!--para 1 -->
28178 <pre>
28179 #define __STDC_WANT_LIB_EXT1__ 1
28180 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28181 constraint_handler_t set_constraint_handler_s(
28182 constraint_handler_t handler);</pre>
28183 <h6>Description</h6>
28184 <p><!--para 2 -->
28185 The set_constraint_handler_s function sets the runtime-constraint handler to
28186 be handler. The runtime-constraint handler is the function to be called when a library
28187 function detects a runtime-constraint violation. Only the most recent handler registered
28188 with set_constraint_handler_s is called when a runtime-constraint violation
28189 occurs.
28190 <p><!--para 3 -->
28191 When the handler is called, it is passed the following arguments in the following order:
28192 <ol>
28193 <li> A pointer to a character string describing the runtime-constraint violation.
28194 <li> A null pointer or a pointer to an implementation defined object.
28195 <li> If the function calling the handler has a return type declared as errno_t, the
28196 return value of the function is passed. Otherwise, a positive value of type
28197 errno_t is passed.
28198 <!--page 619 -->
28199 </ol>
28200 <p><!--para 4 -->
28201 The implementation has a default constraint handler that is used if no calls to the
28202 set_constraint_handler_s function have been made. The behavior of the
28203 default handler is implementation-defined, and it may cause the program to exit or abort.
28204 <p><!--para 5 -->
28205 If the handler argument to set_constraint_handler_s is a null pointer, the
28206 implementation default handler becomes the current constraint handler.
28207 <h6>Returns</h6>
28208 <p><!--para 6 -->
28209 The set_constraint_handler_s function returns a pointer to the previously
28210 registered handler.<sup><a href="#note392"><b>392)</b></a></sup>
28212 <h6>footnotes</h6>
28213 <p><small><a name="note392" href="#note392">392)</a> If the previous handler was registered by calling set_constraint_handler_s with a null
28214 pointer argument, a pointer to the implementation default handler is returned (not NULL).
28215 </small>
28217 <h5><a name="K.3.6.1.2" href="#K.3.6.1.2">K.3.6.1.2 The abort_handler_s function</a></h5>
28218 <h6>Synopsis</h6>
28219 <p><!--para 1 -->
28220 <pre>
28221 #define __STDC_WANT_LIB_EXT1__ 1
28222 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28223 void abort_handler_s(
28224 const char * restrict msg,
28225 void * restrict ptr,
28226 errno_t error);</pre>
28227 <h6>Description</h6>
28228 <p><!--para 2 -->
28229 A pointer to the abort_handler_s function shall be a suitable argument to the
28230 set_constraint_handler_s function.
28231 <p><!--para 3 -->
28232 The abort_handler_s function writes a message on the standard error stream in an
28233 implementation-defined format. The message shall include the string pointed to by msg.
28234 The abort_handler_s function then calls the abort function.<sup><a href="#note393"><b>393)</b></a></sup>
28235 <h6>Returns</h6>
28236 <p><!--para 4 -->
28237 The abort_handler_s function does not return to its caller.
28242 <!--page 620 -->
28244 <h6>footnotes</h6>
28245 <p><small><a name="note393" href="#note393">393)</a> Many implementations invoke a debugger when the abort function is called.
28246 </small>
28248 <h5><a name="K.3.6.1.3" href="#K.3.6.1.3">K.3.6.1.3 The ignore_handler_s function</a></h5>
28249 <h6>Synopsis</h6>
28250 <p><!--para 1 -->
28251 <pre>
28252 #define __STDC_WANT_LIB_EXT1__ 1
28253 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28254 void ignore_handler_s(
28255 const char * restrict msg,
28256 void * restrict ptr,
28257 errno_t error);</pre>
28258 <h6>Description</h6>
28259 <p><!--para 2 -->
28260 A pointer to the ignore_handler_s function shall be a suitable argument to the
28261 set_constraint_handler_s function.
28262 <p><!--para 3 -->
28263 The ignore_handler_s function simply returns to its caller.<sup><a href="#note394"><b>394)</b></a></sup>
28264 <h6>Returns</h6>
28265 <p><!--para 4 -->
28266 The ignore_handler_s function returns no value.
28268 <h6>footnotes</h6>
28269 <p><small><a name="note394" href="#note394">394)</a> If the runtime-constraint handler is set to the ignore_handler_s function, any library function in
28270 which a runtime-constraint violation occurs will return to its caller. The caller can determine whether
28271 a runtime-constraint violation occurred based on the library function's specification (usually, the
28272 library function returns a nonzero errno_t).
28273 </small>
28275 <h5><a name="K.3.6.2" href="#K.3.6.2">K.3.6.2 Communication with the environment</a></h5>
28277 <h5><a name="K.3.6.2.1" href="#K.3.6.2.1">K.3.6.2.1 The getenv_s function</a></h5>
28278 <h6>Synopsis</h6>
28279 <p><!--para 1 -->
28280 <pre>
28281 #define __STDC_WANT_LIB_EXT1__ 1
28282 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28283 errno_t getenv_s(size_t * restrict len,
28284 char * restrict value, rsize_t maxsize,
28285 const char * restrict name);</pre>
28286 Runtime-constraints
28287 <p><!--para 2 -->
28288 name shall not be a null pointer. maxsize shall neither equal zero nor be greater than
28289 RSIZE_MAX. If maxsize is not equal to zero, then value shall not be a null pointer.
28290 <p><!--para 3 -->
28291 If there is a runtime-constraint violation, the integer pointed to by len is set to 0 (if len
28292 is not null), and the environment list is not searched.
28293 <h6>Description</h6>
28294 <p><!--para 4 -->
28295 The getenv_s function searches an environment list, provided by the host environment,
28296 for a string that matches the string pointed to by name.
28299 <!--page 621 -->
28300 <p><!--para 5 -->
28301 If that name is found then getenv_s performs the following actions. If len is not a
28302 null pointer, the length of the string associated with the matched list member is stored in
28303 the integer pointed to by len. If the length of the associated string is less than maxsize,
28304 then the associated string is copied to the array pointed to by value.
28305 <p><!--para 6 -->
28306 If that name is not found then getenv_s performs the following actions. If len is not
28307 a null pointer, zero is stored in the integer pointed to by len. If maxsize is greater than
28308 zero, then value[0] is set to the null character.
28309 <p><!--para 7 -->
28310 The set of environment names and the method for altering the environment list are
28311 implementation-defined.
28312 <h6>Returns</h6>
28313 <p><!--para 8 -->
28314 The getenv_s function returns zero if the specified name is found and the associated
28315 string was successfully stored in value. Otherwise, a nonzero value is returned.
28317 <h5><a name="K.3.6.3" href="#K.3.6.3">K.3.6.3 Searching and sorting utilities</a></h5>
28318 <p><!--para 1 -->
28319 These utilities make use of a comparison function to search or sort arrays of unspecified
28320 type. Where an argument declared as size_t nmemb specifies the length of the array
28321 for a function, if nmemb has the value zero on a call to that function, then the comparison
28322 function is not called, a search finds no matching element, sorting performs no
28323 rearrangement, and the pointer to the array may be null.
28324 <p><!--para 2 -->
28325 The implementation shall ensure that the second argument of the comparison function
28326 (when called from bsearch_s), or both arguments (when called from qsort_s), are
28327 pointers to elements of the array.<sup><a href="#note395"><b>395)</b></a></sup> The first argument when called from bsearch_s
28328 shall equal key.
28329 <p><!--para 3 -->
28330 The comparison function shall not alter the contents of either the array or search key. The
28331 implementation may reorder elements of the array between calls to the comparison
28332 function, but shall not otherwise alter the contents of any individual element.
28333 <p><!--para 4 -->
28334 When the same objects (consisting of size bytes, irrespective of their current positions
28335 in the array) are passed more than once to the comparison function, the results shall be
28336 consistent with one another. That is, for qsort_s they shall define a total ordering on
28337 the array, and for bsearch_s the same object shall always compare the same way with
28338 the key.
28343 <!--page 622 -->
28344 <p><!--para 5 -->
28345 A sequence point occurs immediately before and immediately after each call to the
28346 comparison function, and also between any call to the comparison function and any
28347 movement of the objects passed as arguments to that call.
28349 <h6>footnotes</h6>
28350 <p><small><a name="note395" href="#note395">395)</a> That is, if the value passed is p, then the following expressions are always valid and nonzero:
28352 <pre>
28353 ((char *)p - (char *)base) % size == 0
28354 (char *)p &gt;= (char *)base
28355 (char *)p &lt; (char *)base + nmemb * size</pre>
28356 </small>
28358 <h5><a name="K.3.6.3.1" href="#K.3.6.3.1">K.3.6.3.1 The bsearch_s function</a></h5>
28359 <h6>Synopsis</h6>
28360 <p><!--para 1 -->
28361 <pre>
28362 #define __STDC_WANT_LIB_EXT1__ 1
28363 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28364 void *bsearch_s(const void *key, const void *base,
28365 rsize_t nmemb, rsize_t size,
28366 int (*compar)(const void *k, const void *y,
28367 void *context),
28368 void *context);</pre>
28369 Runtime-constraints
28370 <p><!--para 2 -->
28371 Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to
28372 zero, then none of key, base, or compar shall be a null pointer.
28373 <p><!--para 3 -->
28374 If there is a runtime-constraint violation, the bsearch_s function does not search the
28375 array.
28376 <h6>Description</h6>
28377 <p><!--para 4 -->
28378 The bsearch_s function searches an array of nmemb objects, the initial element of
28379 which is pointed to by base, for an element that matches the object pointed to by key.
28380 The size of each element of the array is specified by size.
28381 <p><!--para 5 -->
28382 The comparison function pointed to by compar is called with three arguments. The first
28383 two point to the key object and to an array element, in that order. The function shall
28384 return an integer less than, equal to, or greater than zero if the key object is considered,
28385 respectively, to be less than, to match, or to be greater than the array element. The array
28386 shall consist of: all the elements that compare less than, all the elements that compare
28387 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note396"><b>396)</b></a></sup>
28388 The third argument to the comparison function is the context argument passed to
28389 bsearch_s. The sole use of context by bsearch_s is to pass it to the comparison
28390 function.<sup><a href="#note397"><b>397)</b></a></sup>
28395 <!--page 623 -->
28396 <h6>Returns</h6>
28397 <p><!--para 6 -->
28398 The bsearch_s function returns a pointer to a matching element of the array, or a null
28399 pointer if no match is found or there is a runtime-constraint violation. If two elements
28400 compare as equal, which element is matched is unspecified.
28402 <h6>footnotes</h6>
28403 <p><small><a name="note396" href="#note396">396)</a> In practice, this means that the entire array has been sorted according to the comparison function.
28404 </small>
28405 <p><small><a name="note397" href="#note397">397)</a> The context argument is for the use of the comparison function in performing its duties. For
28406 example, it might specify a collating sequence used by the comparison function.
28407 </small>
28409 <h5><a name="K.3.6.3.2" href="#K.3.6.3.2">K.3.6.3.2 The qsort_s function</a></h5>
28410 <h6>Synopsis</h6>
28411 <p><!--para 1 -->
28412 <pre>
28413 #define __STDC_WANT_LIB_EXT1__ 1
28414 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28415 errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
28416 int (*compar)(const void *x, const void *y,
28417 void *context),
28418 void *context);</pre>
28419 Runtime-constraints
28420 <p><!--para 2 -->
28421 Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to
28422 zero, then neither base nor compar shall be a null pointer.
28423 <p><!--para 3 -->
28424 If there is a runtime-constraint violation, the qsort_s function does not sort the array.
28425 <h6>Description</h6>
28426 <p><!--para 4 -->
28427 The qsort_s function sorts an array of nmemb objects, the initial element of which is
28428 pointed to by base. The size of each object is specified by size.
28429 <p><!--para 5 -->
28430 The contents of the array are sorted into ascending order according to a comparison
28431 function pointed to by compar, which is called with three arguments. The first two
28432 point to the objects being compared. The function shall return an integer less than, equal
28433 to, or greater than zero if the first argument is considered to be respectively less than,
28434 equal to, or greater than the second. The third argument to the comparison function is the
28435 context argument passed to qsort_s. The sole use of context by qsort_s is to
28436 pass it to the comparison function.<sup><a href="#note398"><b>398)</b></a></sup>
28437 <p><!--para 6 -->
28438 If two elements compare as equal, their relative order in the resulting sorted array is
28439 unspecified.
28440 <h6>Returns</h6>
28441 <p><!--para 7 -->
28442 The qsort_s function returns zero if there was no runtime-constraint violation.
28443 Otherwise, a nonzero value is returned.
28448 <!--page 624 -->
28450 <h6>footnotes</h6>
28451 <p><small><a name="note398" href="#note398">398)</a> The context argument is for the use of the comparison function in performing its duties. For
28452 example, it might specify a collating sequence used by the comparison function.
28453 </small>
28455 <h5><a name="K.3.6.4" href="#K.3.6.4">K.3.6.4 Multibyte/wide character conversion functions</a></h5>
28456 <p><!--para 1 -->
28457 The behavior of the multibyte character functions is affected by the LC_CTYPE category
28458 of the current locale. For a state-dependent encoding, each function is placed into its
28459 initial conversion state by a call for which its character pointer argument, s, is a null
28460 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
28461 state of the function to be altered as necessary. A call with s as a null pointer causes
28462 these functions to set the int pointed to by their status argument to a nonzero value if
28463 encodings have state dependency, and zero otherwise.<sup><a href="#note399"><b>399)</b></a></sup> Changing the LC_CTYPE
28464 category causes the conversion state of these functions to be indeterminate.
28466 <h6>footnotes</h6>
28467 <p><small><a name="note399" href="#note399">399)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
28468 character codes, but are grouped with an adjacent multibyte character.
28469 </small>
28471 <h5><a name="K.3.6.4.1" href="#K.3.6.4.1">K.3.6.4.1 The wctomb_s function</a></h5>
28472 <h6>Synopsis</h6>
28473 <p><!--para 1 -->
28474 <pre>
28475 #define __STDC_WANT_LIB_EXT1__ 1
28476 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28477 errno_t wctomb_s(int * restrict status,
28478 char * restrict s,
28479 rsize_t smax,
28480 wchar_t wc);</pre>
28481 Runtime-constraints
28482 <p><!--para 2 -->
28483 Let n denote the number of bytes needed to represent the multibyte character
28484 corresponding to the wide character given by wc (including any shift sequences).
28485 <p><!--para 3 -->
28486 If s is not a null pointer, then smax shall not be less than n, and smax shall not be
28487 greater than RSIZE_MAX. If s is a null pointer, then smax shall equal zero.
28488 <p><!--para 4 -->
28489 If there is a runtime-constraint violation, wctomb_s does not modify the int pointed to
28490 by status, and if s is not a null pointer, no more than smax elements in the array
28491 pointed to by s will be accessed.
28492 <h6>Description</h6>
28493 <p><!--para 5 -->
28494 The wctomb_s function determines n and stores the multibyte character representation
28495 of wc in the array whose first element is pointed to by s (if s is not a null pointer). The
28496 number of characters stored never exceeds MB_CUR_MAX or smax. If wc is a null wide
28497 character, a null byte is stored, preceded by any shift sequence needed to restore the
28498 initial shift state, and the function is left in the initial conversion state.
28499 <p><!--para 6 -->
28500 The implementation shall behave as if no library function calls the wctomb_s function.
28505 <!--page 625 -->
28506 <p><!--para 7 -->
28507 If s is a null pointer, the wctomb_s function stores into the int pointed to by status a
28508 nonzero or zero value, if multibyte character encodings, respectively, do or do not have
28509 state-dependent encodings.
28510 <p><!--para 8 -->
28511 If s is not a null pointer, the wctomb_s function stores into the int pointed to by
28512 status either n or -1 if wc, respectively, does or does not correspond to a valid
28513 multibyte character.
28514 <p><!--para 9 -->
28515 In no case will the int pointed to by status be set to a value greater than the
28516 MB_CUR_MAX macro.
28517 <h6>Returns</h6>
28518 <p><!--para 10 -->
28519 The wctomb_s function returns zero if successful, and a nonzero value if there was a
28520 runtime-constraint violation or wc did not correspond to a valid multibyte character.
28522 <h5><a name="K.3.6.5" href="#K.3.6.5">K.3.6.5 Multibyte/wide string conversion functions</a></h5>
28523 <p><!--para 1 -->
28524 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
28525 the current locale.
28527 <h5><a name="K.3.6.5.1" href="#K.3.6.5.1">K.3.6.5.1 The mbstowcs_s function</a></h5>
28528 <h6>Synopsis</h6>
28529 <p><!--para 1 -->
28530 <pre>
28531 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28532 errno_t mbstowcs_s(size_t * restrict retval,
28533 wchar_t * restrict dst, rsize_t dstmax,
28534 const char * restrict src, rsize_t len);</pre>
28535 Runtime-constraints
28536 <p><!--para 2 -->
28537 Neither retval nor src shall be a null pointer. If dst is not a null pointer, then
28538 neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null pointer,
28539 then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall not equal
28540 zero. If dst is not a null pointer and len is not less than dstmax, then a null character
28541 shall occur within the first dstmax multibyte characters of the array pointed to by src.
28542 <p><!--para 3 -->
28543 If there is a runtime-constraint violation, then mbstowcs_s does the following. If
28544 retval is not a null pointer, then mbstowcs_s sets *retval to (size_t)(-1). If
28545 dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
28546 then mbstowcs_s sets dst[0] to the null wide character.
28547 <h6>Description</h6>
28548 <p><!--para 4 -->
28549 The mbstowcs_s function converts a sequence of multibyte characters that begins in
28550 the initial shift state from the array pointed to by src into a sequence of corresponding
28551 wide characters. If dst is not a null pointer, the converted characters are stored into the
28552 array pointed to by dst. Conversion continues up to and including a terminating null
28553 character, which is also stored. Conversion stops earlier in two cases: when a sequence of
28554 <!--page 626 -->
28555 bytes is encountered that does not form a valid multibyte character, or (if dst is not a
28556 null pointer) when len wide characters have been stored into the array pointed to by
28557 dst.<sup><a href="#note400"><b>400)</b></a></sup> If dst is not a null pointer and no null wide character was stored into the array
28558 pointed to by dst, then dst[len] is set to the null wide character. Each conversion
28559 takes place as if by a call to the mbrtowc function.
28560 <p><!--para 5 -->
28561 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
28562 sequence of bytes that do not form a valid multibyte character, an encoding error occurs:
28563 the mbstowcs_s function stores the value (size_t)(-1) into *retval.
28564 Otherwise, the mbstowcs_s function stores into *retval the number of multibyte
28565 characters successfully converted, not including the terminating null character (if any).
28566 <p><!--para 6 -->
28567 All elements following the terminating null wide character (if any) written by
28568 mbstowcs_s in the array of dstmax wide characters pointed to by dst take
28569 unspecified values when mbstowcs_s returns.<sup><a href="#note401"><b>401)</b></a></sup>
28570 <p><!--para 7 -->
28571 If copying takes place between objects that overlap, the objects take on unspecified
28572 values.
28573 <h6>Returns</h6>
28574 <p><!--para 8 -->
28575 The mbstowcs_s function returns zero if no runtime-constraint violation and no
28576 encoding error occurred. Otherwise, a nonzero value is returned.
28578 <h6>footnotes</h6>
28579 <p><small><a name="note400" href="#note400">400)</a> Thus, the value of len is ignored if dst is a null pointer.
28580 </small>
28581 <p><small><a name="note401" href="#note401">401)</a> This allows an implementation to attempt converting the multibyte string before discovering a
28582 terminating null character did not occur where required.
28583 </small>
28585 <h5><a name="K.3.6.5.2" href="#K.3.6.5.2">K.3.6.5.2 The wcstombs_s function</a></h5>
28586 <h6>Synopsis</h6>
28587 <p><!--para 1 -->
28588 <pre>
28589 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
28590 errno_t wcstombs_s(size_t * restrict retval,
28591 char * restrict dst, rsize_t dstmax,
28592 const wchar_t * restrict src, rsize_t len);</pre>
28593 Runtime-constraints
28594 <p><!--para 2 -->
28595 Neither retval nor src shall be a null pointer. If dst is not a null pointer, then
28596 neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null pointer,
28597 then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall not equal
28598 zero. If dst is not a null pointer and len is not less than dstmax, then the conversion
28599 shall have been stopped (see below) because a terminating null wide character was
28600 reached or because an encoding error occurred.
28605 <!--page 627 -->
28606 <p><!--para 3 -->
28607 If there is a runtime-constraint violation, then wcstombs_s does the following. If
28608 retval is not a null pointer, then wcstombs_s sets *retval to (size_t)(-1). If
28609 dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
28610 then wcstombs_s sets dst[0] to the null character.
28611 <h6>Description</h6>
28612 <p><!--para 4 -->
28613 The wcstombs_s function converts a sequence of wide characters from the array
28614 pointed to by src into a sequence of corresponding multibyte characters that begins in
28615 the initial shift state. If dst is not a null pointer, the converted characters are then stored
28616 into the array pointed to by dst. Conversion continues up to and including a terminating
28617 null wide character, which is also stored. Conversion stops earlier in two cases:
28618 <ul>
28619 <li> when a wide character is reached that does not correspond to a valid multibyte
28620 character;
28621 <li> (if dst is not a null pointer) when the next multibyte character would exceed the
28622 limit of n total bytes to be stored into the array pointed to by dst. If the wide
28623 character being converted is the null wide character, then n is the lesser of len or
28624 dstmax. Otherwise, n is the lesser of len or dstmax-1.
28625 </ul>
28626 If the conversion stops without converting a null wide character and dst is not a null
28627 pointer, then a null character is stored into the array pointed to by dst immediately
28628 following any multibyte characters already stored. Each conversion takes place as if by a
28629 call to the wcrtomb function.<sup><a href="#note402"><b>402)</b></a></sup>
28630 <p><!--para 5 -->
28631 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
28632 wide character that does not correspond to a valid multibyte character, an encoding error
28633 occurs: the wcstombs_s function stores the value (size_t)(-1) into *retval.
28634 Otherwise, the wcstombs_s function stores into *retval the number of bytes in the
28635 resulting multibyte character sequence, not including the terminating null character (if
28636 any).
28637 <p><!--para 6 -->
28638 All elements following the terminating null character (if any) written by wcstombs_s
28639 in the array of dstmax elements pointed to by dst take unspecified values when
28640 wcstombs_s returns.<sup><a href="#note403"><b>403)</b></a></sup>
28641 <p><!--para 7 -->
28642 If copying takes place between objects that overlap, the objects take on unspecified
28643 values.
28646 <!--page 628 -->
28647 <h6>Returns</h6>
28648 <p><!--para 8 -->
28649 The wcstombs_s function returns zero if no runtime-constraint violation and no
28650 encoding error occurred. Otherwise, a nonzero value is returned.
28652 <h6>footnotes</h6>
28653 <p><small><a name="note402" href="#note402">402)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
28654 include those necessary to reach the initial shift state immediately before the null byte. However, if
28655 the conversion stops before a terminating null wide character has been reached, the result will be null
28656 terminated, but might not end in the initial shift state.
28657 </small>
28658 <p><small><a name="note403" href="#note403">403)</a> When len is not less than dstmax, the implementation might fill the array before discovering a
28659 runtime-constraint violation.
28660 </small>
28662 <h4><a name="K.3.7" href="#K.3.7">K.3.7 String handling <string.h></a></h4>
28663 <p><!--para 1 -->
28664 The header <a href="#7.23">&lt;string.h&gt;</a> defines two types.
28665 <p><!--para 2 -->
28666 The types are
28667 <pre>
28668 errno_t</pre>
28669 which is type int; and
28670 <pre>
28671 rsize_t</pre>
28672 which is the type size_t.
28674 <h5><a name="K.3.7.1" href="#K.3.7.1">K.3.7.1 Copying functions</a></h5>
28676 <h5><a name="K.3.7.1.1" href="#K.3.7.1.1">K.3.7.1.1 The memcpy_s function</a></h5>
28677 <h6>Synopsis</h6>
28678 <p><!--para 1 -->
28679 <pre>
28680 #define __STDC_WANT_LIB_EXT1__ 1
28681 #include <a href="#7.23">&lt;string.h&gt;</a>
28682 errno_t memcpy_s(void * restrict s1, rsize_t s1max,
28683 const void * restrict s2, rsize_t n);</pre>
28684 Runtime-constraints
28685 <p><!--para 2 -->
28686 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
28687 RSIZE_MAX. n shall not be greater than s1max. Copying shall not take place between
28688 objects that overlap.
28689 <p><!--para 3 -->
28690 If there is a runtime-constraint violation, the memcpy_s function stores zeros in the first
28691 s1max characters of the object pointed to by s1 if s1 is not a null pointer and s1max is
28692 not greater than RSIZE_MAX.
28693 <h6>Description</h6>
28694 <p><!--para 4 -->
28695 The memcpy_s function copies n characters from the object pointed to by s2 into the
28696 object pointed to by s1.
28697 <h6>Returns</h6>
28698 <p><!--para 5 -->
28699 The memcpy_s function returns zero if there was no runtime-constraint violation.
28700 Otherwise, a nonzero value is returned.
28701 <!--page 629 -->
28703 <h5><a name="K.3.7.1.2" href="#K.3.7.1.2">K.3.7.1.2 The memmove_s function</a></h5>
28704 <h6>Synopsis</h6>
28705 <p><!--para 1 -->
28706 <pre>
28707 #define __STDC_WANT_LIB_EXT1__ 1
28708 #include <a href="#7.23">&lt;string.h&gt;</a>
28709 errno_t memmove_s(void *s1, rsize_t s1max,
28710 const void *s2, rsize_t n);</pre>
28711 Runtime-constraints
28712 <p><!--para 2 -->
28713 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
28714 RSIZE_MAX. n shall not be greater than s1max.
28715 <p><!--para 3 -->
28716 If there is a runtime-constraint violation, the memmove_s function stores zeros in the
28717 first s1max characters of the object pointed to by s1 if s1 is not a null pointer and
28718 s1max is not greater than RSIZE_MAX.
28719 <h6>Description</h6>
28720 <p><!--para 4 -->
28721 The memmove_s function copies n characters from the object pointed to by s2 into the
28722 object pointed to by s1. This copying takes place as if the n characters from the object
28723 pointed to by s2 are first copied into a temporary array of n characters that does not
28724 overlap the objects pointed to by s1 or s2, and then the n characters from the temporary
28725 array are copied into the object pointed to by s1.
28726 <h6>Returns</h6>
28727 <p><!--para 5 -->
28728 The memmove_s function returns zero if there was no runtime-constraint violation.
28729 Otherwise, a nonzero value is returned.
28731 <h5><a name="K.3.7.1.3" href="#K.3.7.1.3">K.3.7.1.3 The strcpy_s function</a></h5>
28732 <h6>Synopsis</h6>
28733 <p><!--para 1 -->
28734 <pre>
28735 #define __STDC_WANT_LIB_EXT1__ 1
28736 #include <a href="#7.23">&lt;string.h&gt;</a>
28737 errno_t strcpy_s(char * restrict s1,
28738 rsize_t s1max,
28739 const char * restrict s2);</pre>
28740 Runtime-constraints
28741 <p><!--para 2 -->
28742 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
28743 s1max shall not equal zero. s1max shall be greater than strnlen_s(s2, s1max).
28744 Copying shall not take place between objects that overlap.
28745 <p><!--para 3 -->
28746 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
28747 greater than zero and not greater than RSIZE_MAX, then strcpy_s sets s1[0] to the
28748 null character.
28749 <!--page 630 -->
28750 <h6>Description</h6>
28751 <p><!--para 4 -->
28752 The strcpy_s function copies the string pointed to by s2 (including the terminating
28753 null character) into the array pointed to by s1.
28754 <p><!--para 5 -->
28755 All elements following the terminating null character (if any) written by strcpy_s in
28756 the array of s1max characters pointed to by s1 take unspecified values when
28757 strcpy_s returns.<sup><a href="#note404"><b>404)</b></a></sup>
28758 <h6>Returns</h6>
28759 <p><!--para 6 -->
28760 The strcpy_s function returns zero<sup><a href="#note405"><b>405)</b></a></sup> if there was no runtime-constraint violation.
28761 Otherwise, a nonzero value is returned.
28763 <h6>footnotes</h6>
28764 <p><small><a name="note404" href="#note404">404)</a> This allows an implementation to copy characters from s2 to s1 while simultaneously checking if
28765 any of those characters are null. Such an approach might write a character to every element of s1
28766 before discovering that the first element should be set to the null character.
28767 </small>
28768 <p><small><a name="note405" href="#note405">405)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 fit
28769 within the array pointed to by s1 and that the result in s1 is null terminated.
28770 </small>
28772 <h5><a name="K.3.7.1.4" href="#K.3.7.1.4">K.3.7.1.4 The strncpy_s function</a></h5>
28773 <h6>Synopsis</h6>
28774 <p><!--para 1 -->
28775 <pre>
28776 #define __STDC_WANT_LIB_EXT1__ 1
28777 #include <a href="#7.23">&lt;string.h&gt;</a>
28778 errno_t strncpy_s(char * restrict s1,
28779 rsize_t s1max,
28780 const char * restrict s2,
28781 rsize_t n);</pre>
28782 Runtime-constraints
28783 <p><!--para 2 -->
28784 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
28785 RSIZE_MAX. s1max shall not equal zero. If n is not less than s1max, then s1max
28786 shall be greater than strnlen_s(s2, s1max). Copying shall not take place between
28787 objects that overlap.
28788 <p><!--para 3 -->
28789 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
28790 greater than zero and not greater than RSIZE_MAX, then strncpy_s sets s1[0] to the
28791 null character.
28792 <h6>Description</h6>
28793 <p><!--para 4 -->
28794 The strncpy_s function copies not more than n successive characters (characters that
28795 follow a null character are not copied) from the array pointed to by s2 to the array
28796 pointed to by s1. If no null character was copied from s2, then s1[n] is set to a null
28797 character.
28800 <!--page 631 -->
28801 <p><!--para 5 -->
28802 All elements following the terminating null character (if any) written by strncpy_s in
28803 the array of s1max characters pointed to by s1 take unspecified values when
28804 strncpy_s returns.<sup><a href="#note406"><b>406)</b></a></sup>
28805 <h6>Returns</h6>
28806 <p><!--para 6 -->
28807 The strncpy_s function returns zero<sup><a href="#note407"><b>407)</b></a></sup> if there was no runtime-constraint violation.
28808 Otherwise, a nonzero value is returned.
28809 <p><!--para 7 -->
28810 EXAMPLE 1 The strncpy_s function can be used to copy a string without the danger that the result
28811 will not be null terminated or that characters will be written past the end of the destination array.
28812 <pre>
28813 #define __STDC_WANT_LIB_EXT1__ 1
28814 #include <a href="#7.23">&lt;string.h&gt;</a>
28815 /* ... */
28816 char src1[100] = "hello";
28817 char src2[7] = {'g', 'o', 'o', 'd', 'b', 'y', 'e'};
28818 char dst1[6], dst2[5], dst3[5];
28819 int r1, r2, r3;
28820 r1 = strncpy_s(dst1, 6, src1, 100);
28821 r2 = strncpy_s(dst2, 5, src2, 7);
28822 r3 = strncpy_s(dst3, 5, src2, 4);</pre>
28823 The first call will assign to r1 the value zero and to dst1 the sequence hello\0.
28824 The second call will assign to r2 a nonzero value and to dst2 the sequence \0.
28825 The third call will assign to r3 the value zero and to dst3 the sequence good\0.
28828 <h6>footnotes</h6>
28829 <p><small><a name="note406" href="#note406">406)</a> This allows an implementation to copy characters from s2 to s1 while simultaneously checking if
28830 any of those characters are null. Such an approach might write a character to every element of s1
28831 before discovering that the first element should be set to the null character.
28832 </small>
28833 <p><small><a name="note407" href="#note407">407)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 fit
28834 within the array pointed to by s1 and that the result in s1 is null terminated.
28835 </small>
28837 <h5><a name="K.3.7.2" href="#K.3.7.2">K.3.7.2 Concatenation functions</a></h5>
28839 <h5><a name="K.3.7.2.1" href="#K.3.7.2.1">K.3.7.2.1 The strcat_s function</a></h5>
28840 <h6>Synopsis</h6>
28841 <p><!--para 1 -->
28842 <pre>
28843 #define __STDC_WANT_LIB_EXT1__ 1
28844 #include <a href="#7.23">&lt;string.h&gt;</a>
28845 errno_t strcat_s(char * restrict s1,
28846 rsize_t s1max,
28847 const char * restrict s2);</pre>
28848 Runtime-constraints
28849 <p><!--para 2 -->
28850 Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
28851 strcat_s.
28856 <!--page 632 -->
28857 <p><!--para 3 -->
28858 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
28859 s1max shall not equal zero. m shall not equal zero.<sup><a href="#note408"><b>408)</b></a></sup> m shall be greater than
28860 strnlen_s(s2, m). Copying shall not take place between objects that overlap.
28861 <p><!--para 4 -->
28862 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
28863 greater than zero and not greater than RSIZE_MAX, then strcat_s sets s1[0] to the
28864 null character.
28865 <h6>Description</h6>
28866 <p><!--para 5 -->
28867 The strcat_s function appends a copy of the string pointed to by s2 (including the
28868 terminating null character) to the end of the string pointed to by s1. The initial character
28869 from s2 overwrites the null character at the end of s1.
28870 <p><!--para 6 -->
28871 All elements following the terminating null character (if any) written by strcat_s in
28872 the array of s1max characters pointed to by s1 take unspecified values when
28873 strcat_s returns.<sup><a href="#note409"><b>409)</b></a></sup>
28874 <h6>Returns</h6>
28875 <p><!--para 7 -->
28876 The strcat_s function returns zero<sup><a href="#note410"><b>410)</b></a></sup> if there was no runtime-constraint violation.
28877 Otherwise, a nonzero value is returned.
28879 <h6>footnotes</h6>
28880 <p><small><a name="note408" href="#note408">408)</a> Zero means that s1 was not null terminated upon entry to strcat_s.
28881 </small>
28882 <p><small><a name="note409" href="#note409">409)</a> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
28883 any of those characters are null. Such an approach might write a character to every element of s1
28884 before discovering that the first element should be set to the null character.
28885 </small>
28886 <p><small><a name="note410" href="#note410">410)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 were
28887 appended to the string pointed to by s1 and that the result in s1 is null terminated.
28888 </small>
28890 <h5><a name="K.3.7.2.2" href="#K.3.7.2.2">K.3.7.2.2 The strncat_s function</a></h5>
28891 <h6>Synopsis</h6>
28892 <p><!--para 1 -->
28893 <pre>
28894 #define __STDC_WANT_LIB_EXT1__ 1
28895 #include <a href="#7.23">&lt;string.h&gt;</a>
28896 errno_t strncat_s(char * restrict s1,
28897 rsize_t s1max,
28898 const char * restrict s2,
28899 rsize_t n);</pre>
28900 Runtime-constraints
28901 <p><!--para 2 -->
28902 Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
28903 strncat_s.
28904 <p><!--para 3 -->
28905 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
28906 RSIZE_MAX. s1max shall not equal zero. m shall not equal zero.<sup><a href="#note411"><b>411)</b></a></sup> If n is not less
28909 <!--page 633 -->
28910 than m, then m shall be greater than strnlen_s(s2, m). Copying shall not take
28911 place between objects that overlap.
28912 <p><!--para 4 -->
28913 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
28914 greater than zero and not greater than RSIZE_MAX, then strncat_s sets s1[0] to the
28915 null character.
28916 <h6>Description</h6>
28917 <p><!--para 5 -->
28918 The strncat_s function appends not more than n successive characters (characters
28919 that follow a null character are not copied) from the array pointed to by s2 to the end of
28920 the string pointed to by s1. The initial character from s2 overwrites the null character at
28921 the end of s1. If no null character was copied from s2, then s1[s1max-m+n] is set to
28922 a null character.
28923 <p><!--para 6 -->
28924 All elements following the terminating null character (if any) written by strncat_s in
28925 the array of s1max characters pointed to by s1 take unspecified values when
28926 strncat_s returns.<sup><a href="#note412"><b>412)</b></a></sup>
28927 <h6>Returns</h6>
28928 <p><!--para 7 -->
28929 The strncat_s function returns zero<sup><a href="#note413"><b>413)</b></a></sup> if there was no runtime-constraint violation.
28930 Otherwise, a nonzero value is returned.
28931 <p><!--para 8 -->
28932 EXAMPLE 1 The strncat_s function can be used to copy a string without the danger that the result
28933 will not be null terminated or that characters will be written past the end of the destination array.
28934 <pre>
28935 #define __STDC_WANT_LIB_EXT1__ 1
28936 #include <a href="#7.23">&lt;string.h&gt;</a>
28937 /* ... */
28938 char s1[100] = "good";
28939 char s2[6] = "hello";
28940 char s3[6] = "hello";
28941 char s4[7] = "abc";
28942 char s5[1000] = "bye";
28943 int r1, r2, r3, r4;
28944 r1 = strncat_s(s1, 100, s5, 1000);
28945 r2 = strncat_s(s2, 6, "", 1);
28946 r3 = strncat_s(s3, 6, "X", 2);
28947 r4 = strncat_s(s4, 7, "defghijklmn", 3);</pre>
28948 After the first call r1 will have the value zero and s1 will contain the sequence goodbye\0.
28952 <!--page 634 -->
28953 After the second call r2 will have the value zero and s2 will contain the sequence hello\0.
28954 After the third call r3 will have a nonzero value and s3 will contain the sequence \0.
28955 After the fourth call r4 will have the value zero and s4 will contain the sequence abcdef\0.
28958 <h6>footnotes</h6>
28959 <p><small><a name="note411" href="#note411">411)</a> Zero means that s1 was not null terminated upon entry to strncat_s.
28960 </small>
28961 <p><small><a name="note412" href="#note412">412)</a> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
28962 any of those characters are null. Such an approach might write a character to every element of s1
28963 before discovering that the first element should be set to the null character.
28964 </small>
28965 <p><small><a name="note413" href="#note413">413)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 were
28966 appended to the string pointed to by s1 and that the result in s1 is null terminated.
28967 </small>
28969 <h5><a name="K.3.7.3" href="#K.3.7.3">K.3.7.3 Search functions</a></h5>
28971 <h5><a name="K.3.7.3.1" href="#K.3.7.3.1">K.3.7.3.1 The strtok_s function</a></h5>
28972 <h6>Synopsis</h6>
28973 <p><!--para 1 -->
28974 <pre>
28975 #define __STDC_WANT_LIB_EXT1__ 1
28976 #include <a href="#7.23">&lt;string.h&gt;</a>
28977 char *strtok_s(char * restrict s1,
28978 rsize_t * restrict s1max,
28979 const char * restrict s2,
28980 char ** restrict ptr);</pre>
28981 Runtime-constraints
28982 <p><!--para 2 -->
28983 None of s1max, s2, or ptr shall be a null pointer. If s1 is a null pointer, then *ptr
28984 shall not be a null pointer. The value of *s1max shall not be greater than RSIZE_MAX.
28985 The end of the token found shall occur within the first *s1max characters of s1 for the
28986 first call, and shall occur within the first *s1max characters of where searching resumes
28987 on subsequent calls.
28988 <p><!--para 3 -->
28989 If there is a runtime-constraint violation, the strtok_s function does not indirect
28990 through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr.
28991 <h6>Description</h6>
28992 <p><!--para 4 -->
28993 A sequence of calls to the strtok_s function breaks the string pointed to by s1 into a
28994 sequence of tokens, each of which is delimited by a character from the string pointed to
28995 by s2. The fourth argument points to a caller-provided char pointer into which the
28996 strtok_s function stores information necessary for it to continue scanning the same
28997 string.
28998 <p><!--para 5 -->
28999 The first call in a sequence has a non-null first argument and s1max points to an object
29000 whose value is the number of elements in the character array pointed to by the first
29001 argument. The first call stores an initial value in the object pointed to by ptr and
29002 updates the value pointed to by s1max to reflect the number of elements that remain in
29003 relation to ptr. Subsequent calls in the sequence have a null first argument and the
29004 objects pointed to by s1max and ptr are required to have the values stored by the
29005 previous call in the sequence, which are then updated. The separator string pointed to by
29006 s2 may be different from call to call.
29007 <p><!--para 6 -->
29008 The first call in the sequence searches the string pointed to by s1 for the first character
29009 that is not contained in the current separator string pointed to by s2. If no such character
29010 is found, then there are no tokens in the string pointed to by s1 and the strtok_s
29011 function returns a null pointer. If such a character is found, it is the start of the first token.
29012 <!--page 635 -->
29013 <p><!--para 7 -->
29014 The strtok_s function then searches from there for the first character in s1 that is
29015 contained in the current separator string. If no such character is found, the current token
29016 extends to the end of the string pointed to by s1, and subsequent searches in the same
29017 string for a token return a null pointer. If such a character is found, it is overwritten by a
29018 null character, which terminates the current token.
29019 <p><!--para 8 -->
29020 In all cases, the strtok_s function stores sufficient information in the pointer pointed
29021 to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
29022 value for ptr, shall start searching just past the element overwritten by a null character
29023 (if any).
29024 <h6>Returns</h6>
29025 <p><!--para 9 -->
29026 The strtok_s function returns a pointer to the first character of a token, or a null
29027 pointer if there is no token or there is a runtime-constraint violation.
29028 <p><!--para 10 -->
29029 EXAMPLE
29030 <pre>
29031 #define __STDC_WANT_LIB_EXT1__ 1
29032 #include <a href="#7.23">&lt;string.h&gt;</a>
29033 static char str1[] = "?a???b,,,#c";
29034 static char str2[] = "\t \t";
29035 char *t, *ptr1, *ptr2;
29036 rsize_t max1 = sizeof(str1);
29037 rsize_t max2 = sizeof(str2);
29038 t = strtok_s(str1, &amp;max1, "?", &amp;ptr1); // t points to the token "a"
29039 t = strtok_s(NULL, &amp;max1, ",", &amp;ptr1); // t points to the token "??b"
29040 t = strtok_s(str2, &amp;max2, " \t", &amp;ptr2); // t is a null pointer
29041 t = strtok_s(NULL, &amp;max1, "#,", &amp;ptr1); // t points to the token "c"
29042 t = strtok_s(NULL, &amp;max1, "?", &amp;ptr1); // t is a null pointer</pre>
29045 <h5><a name="K.3.7.4" href="#K.3.7.4">K.3.7.4 Miscellaneous functions</a></h5>
29047 <h5><a name="K.3.7.4.1" href="#K.3.7.4.1">K.3.7.4.1 The memset_s function</a></h5>
29048 <h6>Synopsis</h6>
29049 <p><!--para 1 -->
29050 <pre>
29051 #define __STDC_WANT_LIB_EXT1__ 1
29052 #include <a href="#7.23">&lt;string.h&gt;</a>
29053 errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)</pre>
29054 Runtime-constraints
29055 <p><!--para 2 -->
29056 s shall not be a null pointer. Neither smax nor n shall be greater than RSIZE_MAX. n
29057 shall not be greater than smax.
29058 <p><!--para 3 -->
29059 If there is a runtime-constraint violation, then if s is not a null pointer and smax is not
29060 greater than RSIZE_MAX, the memset_s function stores the value of c (converted to an
29061 unsigned char) into each of the first smax characters of the object pointed to by s.
29062 <!--page 636 -->
29063 <h6>Description</h6>
29064 <p><!--para 4 -->
29065 The memset_s function copies the value of c (converted to an unsigned char) into
29066 each of the first n characters of the object pointed to by s. Unlike memset, any call to
29067 the memset_s function shall be evaluated strictly according to the rules of the abstract
29068 machine as described in (<a href="#5.1.2.3">5.1.2.3</a>). That is, any call to the memset_s function shall
29069 assume that the memory indicated by s and n may be accessible in the future and thus
29070 must contain the values indicated by c.
29071 <h6>Returns</h6>
29072 <p><!--para 5 -->
29073 The memset_s function returns zero if there was no runtime-constraint violation.
29074 Otherwise, a nonzero value is returned.
29076 <h5><a name="K.3.7.4.2" href="#K.3.7.4.2">K.3.7.4.2 The strerror_s function</a></h5>
29077 <h6>Synopsis</h6>
29078 <p><!--para 1 -->
29079 <pre>
29080 #define __STDC_WANT_LIB_EXT1__ 1
29081 #include <a href="#7.23">&lt;string.h&gt;</a>
29082 errno_t strerror_s(char *s, rsize_t maxsize,
29083 errno_t errnum);</pre>
29084 Runtime-constraints
29085 <p><!--para 2 -->
29086 s shall not be a null pointer. maxsize shall not be greater than RSIZE_MAX.
29087 maxsize shall not equal zero.
29088 <p><!--para 3 -->
29089 If there is a runtime-constraint violation, then the array (if any) pointed to by s is not
29090 modified.
29091 <h6>Description</h6>
29092 <p><!--para 4 -->
29093 The strerror_s function maps the number in errnum to a locale-specific message
29094 string. Typically, the values for errnum come from errno, but strerror_s shall
29095 map any value of type int to a message.
29096 <p><!--para 5 -->
29097 If the length of the desired string is less than maxsize, then the string is copied to the
29098 array pointed to by s.
29099 <p><!--para 6 -->
29100 Otherwise, if maxsize is greater than zero, then maxsize-1 characters are copied
29101 from the string to the array pointed to by s and then s[maxsize-1] is set to the null
29102 character. Then, if maxsize is greater than 3, then s[maxsize-2],
29103 s[maxsize-3], and s[maxsize-4] are set to the character period (.).
29104 <h6>Returns</h6>
29105 <p><!--para 7 -->
29106 The strerror_s function returns zero if the length of the desired string was less than
29107 maxsize and there was no runtime-constraint violation. Otherwise, the strerror_s
29108 function returns a nonzero value.
29109 <!--page 637 -->
29111 <h5><a name="K.3.7.4.3" href="#K.3.7.4.3">K.3.7.4.3 The strerrorlen_s function</a></h5>
29112 <h6>Synopsis</h6>
29113 <p><!--para 1 -->
29114 <pre>
29115 #define __STDC_WANT_LIB_EXT1__ 1
29116 #include <a href="#7.23">&lt;string.h&gt;</a>
29117 size_t strerrorlen_s(errno_t errnum);</pre>
29118 <h6>Description</h6>
29119 <p><!--para 2 -->
29120 The strerrorlen_s function calculates the length of the (untruncated) locale-specific
29121 message string that the strerror_s function maps to errnum.
29122 <h6>Returns</h6>
29123 <p><!--para 3 -->
29124 The strerrorlen_s function returns the number of characters (not including the null
29125 character) in the full message string.
29127 <h5><a name="K.3.7.4.4" href="#K.3.7.4.4">K.3.7.4.4 The strnlen_s function</a></h5>
29128 <h6>Synopsis</h6>
29129 <p><!--para 1 -->
29130 <pre>
29131 #define __STDC_WANT_LIB_EXT1__ 1
29132 #include <a href="#7.23">&lt;string.h&gt;</a>
29133 size_t strnlen_s(const char *s, size_t maxsize);</pre>
29134 <h6>Description</h6>
29135 <p><!--para 2 -->
29136 The strnlen_s function computes the length of the string pointed to by s.
29137 <h6>Returns</h6>
29138 <p><!--para 3 -->
29139 If s is a null pointer,<sup><a href="#note414"><b>414)</b></a></sup> then the strnlen_s function returns zero.
29140 <p><!--para 4 -->
29141 Otherwise, the strnlen_s function returns the number of characters that precede the
29142 terminating null character. If there is no null character in the first maxsize characters of
29143 s then strnlen_s returns maxsize. At most the first maxsize characters of s shall
29144 be accessed by strnlen_s.
29149 <!--page 638 -->
29151 <h6>footnotes</h6>
29152 <p><small><a name="note414" href="#note414">414)</a> Note that the strnlen_s function has no runtime-constraints. This lack of runtime-constraints
29153 along with the values returned for a null pointer or an unterminated string argument make
29154 strnlen_s useful in algorithms that gracefully handle such exceptional data.
29155 </small>
29157 <h4><a name="K.3.8" href="#K.3.8">K.3.8 Date and time <time.h></a></h4>
29158 <p><!--para 1 -->
29159 The header <a href="#7.26">&lt;time.h&gt;</a> defines two types.
29160 <p><!--para 2 -->
29161 The types are
29162 <pre>
29163 errno_t</pre>
29164 which is type int; and
29165 <pre>
29166 rsize_t</pre>
29167 which is the type size_t.
29169 <h5><a name="K.3.8.1" href="#K.3.8.1">K.3.8.1 Components of time</a></h5>
29170 <p><!--para 1 -->
29171 A broken-down time is normalized if the values of the members of the tm structure are in
29172 their normal rages.<sup><a href="#note415"><b>415)</b></a></sup>
29174 <h6>footnotes</h6>
29175 <p><small><a name="note415" href="#note415">415)</a> The normal ranges are defined in <a href="#7.26.1">7.26.1</a>.
29176 </small>
29178 <h5><a name="K.3.8.2" href="#K.3.8.2">K.3.8.2 Time conversion functions</a></h5>
29179 <p><!--para 1 -->
29180 Like the strftime function, the asctime_s and ctime_s functions do not return a
29181 pointer to a static object, and other library functions are permitted to call them.
29183 <h5><a name="K.3.8.2.1" href="#K.3.8.2.1">K.3.8.2.1 The asctime_s function</a></h5>
29184 <h6>Synopsis</h6>
29185 <p><!--para 1 -->
29186 <pre>
29187 #define __STDC_WANT_LIB_EXT1__ 1
29188 #include <a href="#7.26">&lt;time.h&gt;</a>
29189 errno_t asctime_s(char *s, rsize_t maxsize,
29190 const struct tm *timeptr);</pre>
29191 Runtime-constraints
29192 <p><!--para 2 -->
29193 Neither s nor timeptr shall be a null pointer. maxsize shall not be less than 26 and
29194 shall not be greater than RSIZE_MAX. The broken-down time pointed to by timeptr
29195 shall be normalized. The calendar year represented by the broken-down time pointed to
29196 by timeptr shall not be less than calendar year 0 and shall not be greater than calendar
29197 year 9999.
29198 <p><!--para 3 -->
29199 If there is a runtime-constraint violation, there is no attempt to convert the time, and
29200 s[0] is set to a null character if s is not a null pointer and maxsize is not zero and is
29201 not greater than RSIZE_MAX.
29202 <h6>Description</h6>
29203 <p><!--para 4 -->
29204 The asctime_s function converts the normalized broken-down time in the structure
29205 pointed to by timeptr into a 26 character (including the null character) string in the
29208 <!--page 639 -->
29209 form
29210 <pre>
29211 Sun Sep 16 01:03:52 1973\n\0</pre>
29212 The fields making up this string are (in order):
29213 <ol>
29214 <li> The name of the day of the week represented by timeptr-&gt;tm_wday using the
29215 following three character weekday names: Sun, Mon, Tue, Wed, Thu, Fri, and Sat.
29216 <li> The character space.
29217 <li> The name of the month represented by timeptr-&gt;tm_mon using the following
29218 three character month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct,
29219 Nov, and Dec.
29220 <li> The character space.
29221 <li> The value of timeptr-&gt;tm_mday as if printed using the fprintf format
29222 "%2d".
29223 <li> The character space.
29224 <li> The value of timeptr-&gt;tm_hour as if printed using the fprintf format
29225 "%.2d".
29226 <li> The character colon.
29227 <li> The value of timeptr-&gt;tm_min as if printed using the fprintf format
29228 "%.2d".
29229 <li> The character colon.
29230 <li> The value of timeptr-&gt;tm_sec as if printed using the fprintf format
29231 "%.2d".
29232 <li> The character space.
29233 <li> The value of timeptr-&gt;tm_year + 1900 as if printed using the fprintf
29234 format "%4d".
29235 <li> The character new line.
29236 <li> The null character.
29237 </ol>
29238 <h6>Recommended practice</h6>
29239 The strftime function allows more flexible formatting and supports locale-specific
29240 behavior. If you do not require the exact form of the result string produced by the
29241 asctime_s function, consider using the strftime function instead.
29242 <h6>Returns</h6>
29243 <p><!--para 5 -->
29244 The asctime_s function returns zero if the time was successfully converted and stored
29245 into the array pointed to by s. Otherwise, it returns a nonzero value.
29246 <!--page 640 -->
29248 <h5><a name="K.3.8.2.2" href="#K.3.8.2.2">K.3.8.2.2 The ctime_s function</a></h5>
29249 <h6>Synopsis</h6>
29250 <p><!--para 1 -->
29251 <pre>
29252 #define __STDC_WANT_LIB_EXT1__ 1
29253 #include <a href="#7.26">&lt;time.h&gt;</a>
29254 errno_t ctime_s(char *s, rsize_t maxsize,
29255 const time_t *timer);</pre>
29256 Runtime-constraints
29257 <p><!--para 2 -->
29258 Neither s nor timer shall be a null pointer. maxsize shall not be less than 26 and
29259 shall not be greater than RSIZE_MAX.
29260 <p><!--para 3 -->
29261 If there is a runtime-constraint violation, s[0] is set to a null character if s is not a null
29262 pointer and maxsize is not equal zero and is not greater than RSIZE_MAX.
29263 <h6>Description</h6>
29264 <p><!--para 4 -->
29265 The ctime_s function converts the calendar time pointed to by timer to local time in
29266 the form of a string. It is equivalent to
29267 <pre>
29268 asctime_s(s, maxsize, localtime_s(timer))</pre>
29269 <h6>Recommended practice</h6>
29270 The strftime function allows more flexible formatting and supports locale-specific
29271 behavior. If you do not require the exact form of the result string produced by the
29272 ctime_s function, consider using the strftime function instead.
29273 <h6>Returns</h6>
29274 <p><!--para 5 -->
29275 The ctime_s function returns zero if the time was successfully converted and stored
29276 into the array pointed to by s. Otherwise, it returns a nonzero value.
29278 <h5><a name="K.3.8.2.3" href="#K.3.8.2.3">K.3.8.2.3 The gmtime_s function</a></h5>
29279 <h6>Synopsis</h6>
29280 <p><!--para 1 -->
29281 <pre>
29282 #define __STDC_WANT_LIB_EXT1__ 1
29283 #include <a href="#7.26">&lt;time.h&gt;</a>
29284 struct tm *gmtime_s(const time_t * restrict timer,
29285 struct tm * restrict result);</pre>
29286 Runtime-constraints
29287 <p><!--para 2 -->
29288 Neither timer nor result shall be a null pointer.
29289 <p><!--para 3 -->
29290 If there is a runtime-constraint violation, there is no attempt to convert the time.
29291 <h6>Description</h6>
29292 <p><!--para 4 -->
29293 The gmtime_s function converts the calendar time pointed to by timer into a broken-
29294 down time, expressed as UTC. The broken-down time is stored in the structure pointed
29295 <!--page 641 -->
29296 to by result.
29297 <h6>Returns</h6>
29298 <p><!--para 5 -->
29299 The gmtime_s function returns result, or a null pointer if the specified time cannot
29300 be converted to UTC or there is a runtime-constraint violation.
29302 <h5><a name="K.3.8.2.4" href="#K.3.8.2.4">K.3.8.2.4 The localtime_s function</a></h5>
29303 <h6>Synopsis</h6>
29304 <p><!--para 1 -->
29305 <pre>
29306 #define __STDC_WANT_LIB_EXT1__ 1
29307 #include <a href="#7.26">&lt;time.h&gt;</a>
29308 struct tm *localtime_s(const time_t * restrict timer,
29309 struct tm * restrict result);</pre>
29310 Runtime-constraints
29311 <p><!--para 2 -->
29312 Neither timer nor result shall be a null pointer.
29313 <p><!--para 3 -->
29314 If there is a runtime-constraint violation, there is no attempt to convert the time.
29315 <h6>Description</h6>
29316 <p><!--para 4 -->
29317 The localtime_s function converts the calendar time pointed to by timer into a
29318 broken-down time, expressed as local time. The broken-down time is stored in the
29319 structure pointed to by result.
29320 <h6>Returns</h6>
29321 <p><!--para 5 -->
29322 The localtime_s function returns result, or a null pointer if the specified time
29323 cannot be converted to local time or there is a runtime-constraint violation.
29325 <h4><a name="K.3.9" href="#K.3.9">K.3.9 Extended multibyte and wide character utilities <wchar.h></a></h4>
29326 <p><!--para 1 -->
29327 The header <a href="#7.28">&lt;wchar.h&gt;</a> defines two types.
29328 <p><!--para 2 -->
29329 The types are
29330 <pre>
29331 errno_t</pre>
29332 which is type int; and
29333 <pre>
29334 rsize_t</pre>
29335 which is the type size_t.
29336 <p><!--para 3 -->
29337 Unless explicitly stated otherwise, if the execution of a function described in this
29338 subclause causes copying to take place between objects that overlap, the objects take on
29339 unspecified values.
29340 <!--page 642 -->
29342 <h5><a name="K.3.9.1" href="#K.3.9.1">K.3.9.1 Formatted wide character input/output functions</a></h5>
29344 <h5><a name="K.3.9.1.1" href="#K.3.9.1.1">K.3.9.1.1 The fwprintf_s function</a></h5>
29345 <h6>Synopsis</h6>
29346 <p><!--para 1 -->
29347 <pre>
29348 #define __STDC_WANT_LIB_EXT1__ 1
29349 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29350 int fwprintf_s(FILE * restrict stream,
29351 const wchar_t * restrict format, ...);</pre>
29352 Runtime-constraints
29353 <p><!--para 2 -->
29354 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note416"><b>416)</b></a></sup> (modified or
29355 not by flags, field width, or precision) shall not appear in the wide string pointed to by
29356 format. Any argument to fwprintf_s corresponding to a %s specifier shall not be a
29357 null pointer.
29358 <p><!--para 3 -->
29359 If there is a runtime-constraint violation, the fwprintf_s function does not attempt to
29360 produce further output, and it is unspecified to what extent fwprintf_s produced
29361 output before discovering the runtime-constraint violation.
29362 <h6>Description</h6>
29363 <p><!--para 4 -->
29364 The fwprintf_s function is equivalent to the fwprintf function except for the
29365 explicit runtime-constraints listed above.
29366 <h6>Returns</h6>
29367 <p><!--para 5 -->
29368 The fwprintf_s function returns the number of wide characters transmitted, or a
29369 negative value if an output error, encoding error, or runtime-constraint violation occurred.
29371 <h6>footnotes</h6>
29372 <p><small><a name="note416" href="#note416">416)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29373 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29374 example, if the entire format string was L"%%n".
29375 </small>
29377 <h5><a name="K.3.9.1.2" href="#K.3.9.1.2">K.3.9.1.2 The fwscanf_s function</a></h5>
29378 <h6>Synopsis</h6>
29379 <p><!--para 1 -->
29380 <pre>
29381 #define __STDC_WANT_LIB_EXT1__ 1
29382 #include <a href="#7.21">&lt;stdio.h&gt;</a>
29383 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29384 int fwscanf_s(FILE * restrict stream,
29385 const wchar_t * restrict format, ...);</pre>
29386 Runtime-constraints
29387 <p><!--para 2 -->
29388 Neither stream nor format shall be a null pointer. Any argument indirected though in
29389 order to store converted input shall not be a null pointer.
29392 <!--page 643 -->
29393 <p><!--para 3 -->
29394 If there is a runtime-constraint violation, the fwscanf_s function does not attempt to
29395 perform further input, and it is unspecified to what extent fwscanf_s performed input
29396 before discovering the runtime-constraint violation.
29397 <h6>Description</h6>
29398 <p><!--para 4 -->
29399 The fwscanf_s function is equivalent to fwscanf except that the c, s, and [
29400 conversion specifiers apply to a pair of arguments (unless assignment suppression is
29401 indicated by a *). The first of these arguments is the same as for fwscanf. That
29402 argument is immediately followed in the argument list by the second argument, which has
29403 type size_t and gives the number of elements in the array pointed to by the first
29404 argument of the pair. If the first argument points to a scalar object, it is considered to be
29405 an array of one element.<sup><a href="#note417"><b>417)</b></a></sup>
29406 <p><!--para 5 -->
29407 A matching failure occurs if the number of elements in a receiving object is insufficient to
29408 hold the converted input (including any trailing null character).
29409 <h6>Returns</h6>
29410 <p><!--para 6 -->
29411 The fwscanf_s function returns the value of the macro EOF if an input failure occurs
29412 before any conversion or if there is a runtime-constraint violation. Otherwise, the
29413 fwscanf_s function returns the number of input items assigned, which can be fewer
29414 than provided for, or even zero, in the event of an early matching failure.
29416 <h6>footnotes</h6>
29417 <p><small><a name="note417" href="#note417">417)</a> If the format is known at translation time, an implementation may issue a diagnostic for any argument
29418 used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
29419 argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
29420 the format is not known at translation time. For example, an implementation may issue a diagnostic
29421 for each argument after format that has of type pointer to one of char, signed char,
29422 unsigned char, or void that is not followed by an argument of a type compatible with
29423 rsize_t. The diagnostic could warn that unless the pointer is being used with a conversion specifier
29424 using the hh length modifier, a length argument must follow the pointer argument. Another useful
29425 diagnostic could flag any non-pointer argument following format that did not have a type
29426 compatible with rsize_t.
29427 </small>
29429 <h5><a name="K.3.9.1.3" href="#K.3.9.1.3">K.3.9.1.3 The snwprintf_s function</a></h5>
29430 <h6>Synopsis</h6>
29431 <p><!--para 1 -->
29432 <pre>
29433 #define __STDC_WANT_LIB_EXT1__ 1
29434 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29435 int snwprintf_s(wchar_t * restrict s,
29436 rsize_t n,
29437 const wchar_t * restrict format, ...);</pre>
29438 Runtime-constraints
29439 <p><!--para 2 -->
29440 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
29441 than RSIZE_MAX. The %n specifier<sup><a href="#note418"><b>418)</b></a></sup> (modified or not by flags, field width, or
29443 <!--page 644 -->
29444 precision) shall not appear in the wide string pointed to by format. Any argument to
29445 snwprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
29446 error shall occur.
29447 <p><!--para 3 -->
29448 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
29449 than zero and less than RSIZE_MAX, then the snwprintf_s function sets s[0] to the
29450 null wide character.
29451 <h6>Description</h6>
29452 <p><!--para 4 -->
29453 The snwprintf_s function is equivalent to the swprintf function except for the
29454 explicit runtime-constraints listed above.
29455 <p><!--para 5 -->
29456 The snwprintf_s function, unlike swprintf_s, will truncate the result to fit within
29457 the array pointed to by s.
29458 <h6>Returns</h6>
29459 <p><!--para 6 -->
29460 The snwprintf_s function returns the number of wide characters that would have
29461 been written had n been sufficiently large, not counting the terminating wide null
29462 character, or a negative value if a runtime-constraint violation occurred. Thus, the null-
29463 terminated output has been completely written if and only if the returned value is
29464 nonnegative and less than n.
29466 <h6>footnotes</h6>
29467 <p><small><a name="note418" href="#note418">418)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29468 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29469 example, if the entire format string was L"%%n".
29470 </small>
29472 <h5><a name="K.3.9.1.4" href="#K.3.9.1.4">K.3.9.1.4 The swprintf_s function</a></h5>
29473 <h6>Synopsis</h6>
29474 <p><!--para 1 -->
29475 <pre>
29476 #define __STDC_WANT_LIB_EXT1__ 1
29477 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29478 int swprintf_s(wchar_t * restrict s, rsize_t n,
29479 const wchar_t * restrict format, ...);</pre>
29480 Runtime-constraints
29481 <p><!--para 2 -->
29482 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
29483 than RSIZE_MAX. The number of wide characters (including the trailing null) required
29484 for the result to be written to the array pointed to by s shall not be greater than n. The %n
29485 specifier<sup><a href="#note419"><b>419)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
29486 wide string pointed to by format. Any argument to swprintf_s corresponding to a
29487 %s specifier shall not be a null pointer. No encoding error shall occur.
29490 <!--page 645 -->
29491 <p><!--para 3 -->
29492 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
29493 than zero and less than RSIZE_MAX, then the swprintf_s function sets s[0] to the
29494 null wide character.
29495 <h6>Description</h6>
29496 <p><!--para 4 -->
29497 The swprintf_s function is equivalent to the swprintf function except for the
29498 explicit runtime-constraints listed above.
29499 <p><!--para 5 -->
29500 The swprintf_s function, unlike snwprintf_s, treats a result too big for the array
29501 pointed to by s as a runtime-constraint violation.
29502 <h6>Returns</h6>
29503 <p><!--para 6 -->
29504 If no runtime-constraint violation occurred, the swprintf_s function returns the
29505 number of wide characters written in the array, not counting the terminating null wide
29506 character. If an encoding error occurred or if n or more wide characters are requested to
29507 be written, swprintf_s returns a negative value. If any other runtime-constraint
29508 violation occurred, swprintf_s returns zero.
29510 <h6>footnotes</h6>
29511 <p><small><a name="note419" href="#note419">419)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29512 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29513 example, if the entire format string was L"%%n".
29514 </small>
29516 <h5><a name="K.3.9.1.5" href="#K.3.9.1.5">K.3.9.1.5 The swscanf_s function</a></h5>
29517 <h6>Synopsis</h6>
29518 <p><!--para 1 -->
29519 <pre>
29520 #define __STDC_WANT_LIB_EXT1__ 1
29521 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29522 int swscanf_s(const wchar_t * restrict s,
29523 const wchar_t * restrict format, ...);</pre>
29524 Runtime-constraints
29525 <p><!--para 2 -->
29526 Neither s nor format shall be a null pointer. Any argument indirected though in order
29527 to store converted input shall not be a null pointer.
29528 <p><!--para 3 -->
29529 If there is a runtime-constraint violation, the swscanf_s function does not attempt to
29530 perform further input, and it is unspecified to what extent swscanf_s performed input
29531 before discovering the runtime-constraint violation.
29532 <h6>Description</h6>
29533 <p><!--para 4 -->
29534 The swscanf_s function is equivalent to fwscanf_s, except that the argument s
29535 specifies a wide string from which the input is to be obtained, rather than from a stream.
29536 Reaching the end of the wide string is equivalent to encountering end-of-file for the
29537 fwscanf_s function.
29538 <h6>Returns</h6>
29539 <p><!--para 5 -->
29540 The swscanf_s function returns the value of the macro EOF if an input failure occurs
29541 before any conversion or if there is a runtime-constraint violation. Otherwise, the
29542 swscanf_s function returns the number of input items assigned, which can be fewer
29543 than provided for, or even zero, in the event of an early matching failure.
29544 <!--page 646 -->
29546 <h5><a name="K.3.9.1.6" href="#K.3.9.1.6">K.3.9.1.6 The vfwprintf_s function</a></h5>
29547 <h6>Synopsis</h6>
29548 <p><!--para 1 -->
29549 <pre>
29550 #define __STDC_WANT_LIB_EXT1__ 1
29551 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29552 #include <a href="#7.21">&lt;stdio.h&gt;</a>
29553 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29554 int vfwprintf_s(FILE * restrict stream,
29555 const wchar_t * restrict format,
29556 va_list arg);</pre>
29557 Runtime-constraints
29558 <p><!--para 2 -->
29559 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note420"><b>420)</b></a></sup> (modified or
29560 not by flags, field width, or precision) shall not appear in the wide string pointed to by
29561 format. Any argument to vfwprintf_s corresponding to a %s specifier shall not be
29562 a null pointer.
29563 <p><!--para 3 -->
29564 If there is a runtime-constraint violation, the vfwprintf_s function does not attempt
29565 to produce further output, and it is unspecified to what extent vfwprintf_s produced
29566 output before discovering the runtime-constraint violation.
29567 <h6>Description</h6>
29568 <p><!--para 4 -->
29569 The vfwprintf_s function is equivalent to the vfwprintf function except for the
29570 explicit runtime-constraints listed above.
29571 <h6>Returns</h6>
29572 <p><!--para 5 -->
29573 The vfwprintf_s function returns the number of wide characters transmitted, or a
29574 negative value if an output error, encoding error, or runtime-constraint violation occurred.
29576 <h6>footnotes</h6>
29577 <p><small><a name="note420" href="#note420">420)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29578 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29579 example, if the entire format string was L"%%n".
29580 </small>
29582 <h5><a name="K.3.9.1.7" href="#K.3.9.1.7">K.3.9.1.7 The vfwscanf_s function</a></h5>
29583 <h6>Synopsis</h6>
29584 <p><!--para 1 -->
29585 <pre>
29586 #define __STDC_WANT_LIB_EXT1__ 1
29587 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29588 #include <a href="#7.21">&lt;stdio.h&gt;</a>
29589 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29590 int vfwscanf_s(FILE * restrict stream,
29591 const wchar_t * restrict format, va_list arg);</pre>
29595 <!--page 647 -->
29596 Runtime-constraints
29597 <p><!--para 2 -->
29598 Neither stream nor format shall be a null pointer. Any argument indirected though in
29599 order to store converted input shall not be a null pointer.
29600 <p><!--para 3 -->
29601 If there is a runtime-constraint violation, the vfwscanf_s function does not attempt to
29602 perform further input, and it is unspecified to what extent vfwscanf_s performed input
29603 before discovering the runtime-constraint violation.
29604 <h6>Description</h6>
29605 <p><!--para 4 -->
29606 The vfwscanf_s function is equivalent to fwscanf_s, with the variable argument
29607 list replaced by arg, which shall have been initialized by the va_start macro (and
29608 possibly subsequent va_arg calls). The vfwscanf_s function does not invoke the
29609 va_end macro.<sup><a href="#note421"><b>421)</b></a></sup>
29610 <h6>Returns</h6>
29611 <p><!--para 5 -->
29612 The vfwscanf_s function returns the value of the macro EOF if an input failure occurs
29613 before any conversion or if there is a runtime-constraint violation. Otherwise, the
29614 vfwscanf_s function returns the number of input items assigned, which can be fewer
29615 than provided for, or even zero, in the event of an early matching failure.
29617 <h6>footnotes</h6>
29618 <p><small><a name="note421" href="#note421">421)</a> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
29619 value of arg after the return is indeterminate.
29620 </small>
29622 <h5><a name="K.3.9.1.8" href="#K.3.9.1.8">K.3.9.1.8 The vsnwprintf_s function</a></h5>
29623 <h6>Synopsis</h6>
29624 <p><!--para 1 -->
29625 <pre>
29626 #define __STDC_WANT_LIB_EXT1__ 1
29627 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29628 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29629 int vsnwprintf_s(wchar_t * restrict s,
29630 rsize_t n,
29631 const wchar_t * restrict format,
29632 va_list arg);</pre>
29633 Runtime-constraints
29634 <p><!--para 2 -->
29635 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
29636 than RSIZE_MAX. The %n specifier<sup><a href="#note422"><b>422)</b></a></sup> (modified or not by flags, field width, or
29637 precision) shall not appear in the wide string pointed to by format. Any argument to
29638 vsnwprintf_s corresponding to a %s specifier shall not be a null pointer. No
29639 encoding error shall occur.
29641 <!--page 648 -->
29642 <p><!--para 3 -->
29643 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
29644 than zero and less than RSIZE_MAX, then the vsnwprintf_s function sets s[0] to
29645 the null wide character.
29646 <h6>Description</h6>
29647 <p><!--para 4 -->
29648 The vsnwprintf_s function is equivalent to the vswprintf function except for the
29649 explicit runtime-constraints listed above.
29650 <p><!--para 5 -->
29651 The vsnwprintf_s function, unlike vswprintf_s, will truncate the result to fit
29652 within the array pointed to by s.
29653 <h6>Returns</h6>
29654 <p><!--para 6 -->
29655 The vsnwprintf_s function returns the number of wide characters that would have
29656 been written had n been sufficiently large, not counting the terminating null character, or
29657 a negative value if a runtime-constraint violation occurred. Thus, the null-terminated
29658 output has been completely written if and only if the returned value is nonnegative and
29659 less than n.
29661 <h6>footnotes</h6>
29662 <p><small><a name="note422" href="#note422">422)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29663 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29664 example, if the entire format string was L"%%n".
29665 </small>
29667 <h5><a name="K.3.9.1.9" href="#K.3.9.1.9">K.3.9.1.9 The vswprintf_s function</a></h5>
29668 <h6>Synopsis</h6>
29669 <p><!--para 1 -->
29670 <pre>
29671 #define __STDC_WANT_LIB_EXT1__ 1
29672 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29673 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29674 int vswprintf_s(wchar_t * restrict s,
29675 rsize_t n,
29676 const wchar_t * restrict format,
29677 va_list arg);</pre>
29678 Runtime-constraints
29679 <p><!--para 2 -->
29680 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
29681 than RSIZE_MAX. The number of wide characters (including the trailing null) required
29682 for the result to be written to the array pointed to by s shall not be greater than n. The %n
29683 specifier<sup><a href="#note423"><b>423)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
29684 wide string pointed to by format. Any argument to vswprintf_s corresponding to a
29685 %s specifier shall not be a null pointer. No encoding error shall occur.
29686 <p><!--para 3 -->
29687 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
29688 than zero and less than RSIZE_MAX, then the vswprintf_s function sets s[0] to the
29689 null wide character.
29691 <!--page 649 -->
29692 <h6>Description</h6>
29693 <p><!--para 4 -->
29694 The vswprintf_s function is equivalent to the vswprintf function except for the
29695 explicit runtime-constraints listed above.
29696 <p><!--para 5 -->
29697 The vswprintf_s function, unlike vsnwprintf_s, treats a result too big for the
29698 array pointed to by s as a runtime-constraint violation.
29699 <h6>Returns</h6>
29700 <p><!--para 6 -->
29701 If no runtime-constraint violation occurred, the vswprintf_s function returns the
29702 number of wide characters written in the array, not counting the terminating null wide
29703 character. If an encoding error occurred or if n or more wide characters are requested to
29704 be written, vswprintf_s returns a negative value. If any other runtime-constraint
29705 violation occurred, vswprintf_s returns zero.
29707 <h6>footnotes</h6>
29708 <p><small><a name="note423" href="#note423">423)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29709 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29710 example, if the entire format string was L"%%n".
29711 </small>
29713 <h5><a name="K.3.9.1.10" href="#K.3.9.1.10">K.3.9.1.10 The vswscanf_s function</a></h5>
29714 <h6>Synopsis</h6>
29715 <p><!--para 1 -->
29716 <pre>
29717 #define __STDC_WANT_LIB_EXT1__ 1
29718 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29719 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29720 int vswscanf_s(const wchar_t * restrict s,
29721 const wchar_t * restrict format,
29722 va_list arg);</pre>
29723 Runtime-constraints
29724 <p><!--para 2 -->
29725 Neither s nor format shall be a null pointer. Any argument indirected though in order
29726 to store converted input shall not be a null pointer.
29727 <p><!--para 3 -->
29728 If there is a runtime-constraint violation, the vswscanf_s function does not attempt to
29729 perform further input, and it is unspecified to what extent vswscanf_s performed input
29730 before discovering the runtime-constraint violation.
29731 <h6>Description</h6>
29732 <p><!--para 4 -->
29733 The vswscanf_s function is equivalent to swscanf_s, with the variable argument
29734 list replaced by arg, which shall have been initialized by the va_start macro (and
29735 possibly subsequent va_arg calls). The vswscanf_s function does not invoke the
29736 va_end macro.<sup><a href="#note424"><b>424)</b></a></sup>
29741 <!--page 650 -->
29742 <h6>Returns</h6>
29743 <p><!--para 5 -->
29744 The vswscanf_s function returns the value of the macro EOF if an input failure occurs
29745 before any conversion or if there is a runtime-constraint violation. Otherwise, the
29746 vswscanf_s function returns the number of input items assigned, which can be fewer
29747 than provided for, or even zero, in the event of an early matching failure.
29749 <h6>footnotes</h6>
29750 <p><small><a name="note424" href="#note424">424)</a> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
29751 value of arg after the return is indeterminate.
29752 </small>
29754 <h5><a name="K.3.9.1.11" href="#K.3.9.1.11">K.3.9.1.11 The vwprintf_s function</a></h5>
29755 <h6>Synopsis</h6>
29756 <p><!--para 1 -->
29757 <pre>
29758 #define __STDC_WANT_LIB_EXT1__ 1
29759 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29760 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29761 int vwprintf_s(const wchar_t * restrict format,
29762 va_list arg);</pre>
29763 Runtime-constraints
29764 <p><!--para 2 -->
29765 format shall not be a null pointer. The %n specifier<sup><a href="#note425"><b>425)</b></a></sup> (modified or not by flags, field
29766 width, or precision) shall not appear in the wide string pointed to by format. Any
29767 argument to vwprintf_s corresponding to a %s specifier shall not be a null pointer.
29768 <p><!--para 3 -->
29769 If there is a runtime-constraint violation, the vwprintf_s function does not attempt to
29770 produce further output, and it is unspecified to what extent vwprintf_s produced
29771 output before discovering the runtime-constraint violation.
29772 <h6>Description</h6>
29773 <p><!--para 4 -->
29774 The vwprintf_s function is equivalent to the vwprintf function except for the
29775 explicit runtime-constraints listed above.
29776 <h6>Returns</h6>
29777 <p><!--para 5 -->
29778 The vwprintf_s function returns the number of wide characters transmitted, or a
29779 negative value if an output error, encoding error, or runtime-constraint violation occurred.
29784 <!--page 651 -->
29786 <h6>footnotes</h6>
29787 <p><small><a name="note425" href="#note425">425)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29788 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29789 example, if the entire format string was L"%%n".
29790 </small>
29792 <h5><a name="K.3.9.1.12" href="#K.3.9.1.12">K.3.9.1.12 The vwscanf_s function</a></h5>
29793 <h6>Synopsis</h6>
29794 <p><!--para 1 -->
29795 <pre>
29796 #define __STDC_WANT_LIB_EXT1__ 1
29797 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
29798 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29799 int vwscanf_s(const wchar_t * restrict format,
29800 va_list arg);</pre>
29801 Runtime-constraints
29802 <p><!--para 2 -->
29803 format shall not be a null pointer. Any argument indirected though in order to store
29804 converted input shall not be a null pointer.
29805 <p><!--para 3 -->
29806 If there is a runtime-constraint violation, the vwscanf_s function does not attempt to
29807 perform further input, and it is unspecified to what extent vwscanf_s performed input
29808 before discovering the runtime-constraint violation.
29809 <h6>Description</h6>
29810 <p><!--para 4 -->
29811 The vwscanf_s function is equivalent to wscanf_s, with the variable argument list
29812 replaced by arg, which shall have been initialized by the va_start macro (and
29813 possibly subsequent va_arg calls). The vwscanf_s function does not invoke the
29814 va_end macro.<sup><a href="#note426"><b>426)</b></a></sup>
29815 <h6>Returns</h6>
29816 <p><!--para 5 -->
29817 The vwscanf_s function returns the value of the macro EOF if an input failure occurs
29818 before any conversion or if there is a runtime-constraint violation. Otherwise, the
29819 vwscanf_s function returns the number of input items assigned, which can be fewer
29820 than provided for, or even zero, in the event of an early matching failure.
29822 <h6>footnotes</h6>
29823 <p><small><a name="note426" href="#note426">426)</a> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
29824 value of arg after the return is indeterminate.
29825 </small>
29827 <h5><a name="K.3.9.1.13" href="#K.3.9.1.13">K.3.9.1.13 The wprintf_s function</a></h5>
29828 <h6>Synopsis</h6>
29829 <p><!--para 1 -->
29830 <pre>
29831 #define __STDC_WANT_LIB_EXT1__ 1
29832 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29833 int wprintf_s(const wchar_t * restrict format, ...);</pre>
29834 Runtime-constraints
29835 <p><!--para 2 -->
29836 format shall not be a null pointer. The %n specifier<sup><a href="#note427"><b>427)</b></a></sup> (modified or not by flags, field
29838 <!--page 652 -->
29839 width, or precision) shall not appear in the wide string pointed to by format. Any
29840 argument to wprintf_s corresponding to a %s specifier shall not be a null pointer.
29841 <p><!--para 3 -->
29842 If there is a runtime-constraint violation, the wprintf_s function does not attempt to
29843 produce further output, and it is unspecified to what extent wprintf_s produced output
29844 before discovering the runtime-constraint violation.
29845 <h6>Description</h6>
29846 <p><!--para 4 -->
29847 The wprintf_s function is equivalent to the wprintf function except for the explicit
29848 runtime-constraints listed above.
29849 <h6>Returns</h6>
29850 <p><!--para 5 -->
29851 The wprintf_s function returns the number of wide characters transmitted, or a
29852 negative value if an output error, encoding error, or runtime-constraint violation occurred.
29854 <h6>footnotes</h6>
29855 <p><small><a name="note427" href="#note427">427)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
29856 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
29857 example, if the entire format string was L"%%n".
29858 </small>
29860 <h5><a name="K.3.9.1.14" href="#K.3.9.1.14">K.3.9.1.14 The wscanf_s function</a></h5>
29861 <h6>Synopsis</h6>
29862 <p><!--para 1 -->
29863 <pre>
29864 #define __STDC_WANT_LIB_EXT1__ 1
29865 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29866 int wscanf_s(const wchar_t * restrict format, ...);</pre>
29867 Runtime-constraints
29868 <p><!--para 2 -->
29869 format shall not be a null pointer. Any argument indirected though in order to store
29870 converted input shall not be a null pointer.
29871 <p><!--para 3 -->
29872 If there is a runtime-constraint violation, the wscanf_s function does not attempt to
29873 perform further input, and it is unspecified to what extent wscanf_s performed input
29874 before discovering the runtime-constraint violation.
29875 <h6>Description</h6>
29876 <p><!--para 4 -->
29877 The wscanf_s function is equivalent to fwscanf_s with the argument stdin
29878 interposed before the arguments to wscanf_s.
29879 <h6>Returns</h6>
29880 <p><!--para 5 -->
29881 The wscanf_s function returns the value of the macro EOF if an input failure occurs
29882 before any conversion or if there is a runtime-constraint violation. Otherwise, the
29883 wscanf_s function returns the number of input items assigned, which can be fewer than
29884 provided for, or even zero, in the event of an early matching failure.
29885 <!--page 653 -->
29887 <h5><a name="K.3.9.2" href="#K.3.9.2">K.3.9.2 General wide string utilities</a></h5>
29889 <h5><a name="K.3.9.2.1" href="#K.3.9.2.1">K.3.9.2.1 Wide string copying functions</a></h5>
29891 <h5><a name="K.3.9.2.1.1" href="#K.3.9.2.1.1">K.3.9.2.1.1 The wcscpy_s function</a></h5>
29892 <h6>Synopsis</h6>
29893 <p><!--para 1 -->
29894 <pre>
29895 #define __STDC_WANT_LIB_EXT1__ 1
29896 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29897 errno_t wcscpy_s(wchar_t * restrict s1,
29898 rsize_t s1max,
29899 const wchar_t * restrict s2);</pre>
29900 Runtime-constraints
29901 <p><!--para 2 -->
29902 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
29903 s1max shall not equal zero. s1max shall be greater than wcsnlen_s(s2, s1max).
29904 Copying shall not take place between objects that overlap.
29905 <p><!--para 3 -->
29906 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
29907 greater than zero and not greater than RSIZE_MAX, then wcscpy_s sets s1[0] to the
29908 null wide character.
29909 <h6>Description</h6>
29910 <p><!--para 4 -->
29911 The wcscpy_s function copies the wide string pointed to by s2 (including the
29912 terminating null wide character) into the array pointed to by s1.
29913 <p><!--para 5 -->
29914 All elements following the terminating null wide character (if any) written by
29915 wcscpy_s in the array of s1max wide characters pointed to by s1 take unspecified
29916 values when wcscpy_s returns.<sup><a href="#note428"><b>428)</b></a></sup>
29917 <h6>Returns</h6>
29918 <p><!--para 6 -->
29919 The wcscpy_s function returns zero<sup><a href="#note429"><b>429)</b></a></sup> if there was no runtime-constraint violation.
29920 Otherwise, a nonzero value is returned.
29925 <!--page 654 -->
29927 <h6>footnotes</h6>
29928 <p><small><a name="note428" href="#note428">428)</a> This allows an implementation to copy wide characters from s2 to s1 while simultaneously checking
29929 if any of those wide characters are null. Such an approach might write a wide character to every
29930 element of s1 before discovering that the first element should be set to the null wide character.
29931 </small>
29932 <p><small><a name="note429" href="#note429">429)</a> A zero return value implies that all of the requested wide characters from the string pointed to by s2
29933 fit within the array pointed to by s1 and that the result in s1 is null terminated.
29934 </small>
29936 <h5><a name="K.3.9.2.1.2" href="#K.3.9.2.1.2">K.3.9.2.1.2 The wcsncpy_s function</a></h5>
29937 <h6>Synopsis</h6>
29938 <p><!--para 7 -->
29939 <pre>
29940 #define __STDC_WANT_LIB_EXT1__ 1
29941 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29942 errno_t wcsncpy_s(wchar_t * restrict s1,
29943 rsize_t s1max,
29944 const wchar_t * restrict s2,
29945 rsize_t n);</pre>
29946 Runtime-constraints
29947 <p><!--para 8 -->
29948 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
29949 RSIZE_MAX. s1max shall not equal zero. If n is not less than s1max, then s1max
29950 shall be greater than wcsnlen_s(s2, s1max). Copying shall not take place between
29951 objects that overlap.
29952 <p><!--para 9 -->
29953 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
29954 greater than zero and not greater than RSIZE_MAX, then wcsncpy_s sets s1[0] to the
29955 null wide character.
29956 <h6>Description</h6>
29957 <p><!--para 10 -->
29958 The wcsncpy_s function copies not more than n successive wide characters (wide
29959 characters that follow a null wide character are not copied) from the array pointed to by
29960 s2 to the array pointed to by s1. If no null wide character was copied from s2, then
29961 s1[n] is set to a null wide character.
29962 <p><!--para 11 -->
29963 All elements following the terminating null wide character (if any) written by
29964 wcsncpy_s in the array of s1max wide characters pointed to by s1 take unspecified
29965 values when wcsncpy_s returns.<sup><a href="#note430"><b>430)</b></a></sup>
29966 <h6>Returns</h6>
29967 <p><!--para 12 -->
29968 The wcsncpy_s function returns zero<sup><a href="#note431"><b>431)</b></a></sup> if there was no runtime-constraint violation.
29969 Otherwise, a nonzero value is returned.
29970 <p><!--para 13 -->
29971 EXAMPLE 1 The wcsncpy_s function can be used to copy a wide string without the danger that the
29972 result will not be null terminated or that wide characters will be written past the end of the destination
29973 array.
29978 <!--page 655 -->
29979 <pre>
29980 #define __STDC_WANT_LIB_EXT1__ 1
29981 #include <a href="#7.28">&lt;wchar.h&gt;</a>
29982 /* ... */
29983 wchar_t src1[100] = L"hello";
29984 wchar_t src2[7] = {L'g', L'o', L'o', L'd', L'b', L'y', L'e'};
29985 wchar_t dst1[6], dst2[5], dst3[5];
29986 int r1, r2, r3;
29987 r1 = wcsncpy_s(dst1, 6, src1, 100);
29988 r2 = wcsncpy_s(dst2, 5, src2, 7);
29989 r3 = wcsncpy_s(dst3, 5, src2, 4);</pre>
29990 The first call will assign to r1 the value zero and to dst1 the sequence of wide characters hello\0.
29991 The second call will assign to r2 a nonzero value and to dst2 the sequence of wide characters \0.
29992 The third call will assign to r3 the value zero and to dst3 the sequence of wide characters good\0.
29995 <h6>footnotes</h6>
29996 <p><small><a name="note430" href="#note430">430)</a> This allows an implementation to copy wide characters from s2 to s1 while simultaneously checking
29997 if any of those wide characters are null. Such an approach might write a wide character to every
29998 element of s1 before discovering that the first element should be set to the null wide character.
29999 </small>
30000 <p><small><a name="note431" href="#note431">431)</a> A zero return value implies that all of the requested wide characters from the string pointed to by s2
30001 fit within the array pointed to by s1 and that the result in s1 is null terminated.
30002 </small>
30004 <h5><a name="K.3.9.2.1.3" href="#K.3.9.2.1.3">K.3.9.2.1.3 The wmemcpy_s function</a></h5>
30005 <h6>Synopsis</h6>
30006 <p><!--para 14 -->
30007 <pre>
30008 #define __STDC_WANT_LIB_EXT1__ 1
30009 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30010 errno_t wmemcpy_s(wchar_t * restrict s1,
30011 rsize_t s1max,
30012 const wchar_t * restrict s2,
30013 rsize_t n);</pre>
30014 Runtime-constraints
30015 <p><!--para 15 -->
30016 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
30017 RSIZE_MAX. n shall not be greater than s1max. Copying shall not take place between
30018 objects that overlap.
30019 <p><!--para 16 -->
30020 If there is a runtime-constraint violation, the wmemcpy_s function stores zeros in the
30021 first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and
30022 s1max is not greater than RSIZE_MAX.
30023 <h6>Description</h6>
30024 <p><!--para 17 -->
30025 The wmemcpy_s function copies n successive wide characters from the object pointed
30026 to by s2 into the object pointed to by s1.
30027 <h6>Returns</h6>
30028 <p><!--para 18 -->
30029 The wmemcpy_s function returns zero if there was no runtime-constraint violation.
30030 Otherwise, a nonzero value is returned.
30031 <!--page 656 -->
30033 <h5><a name="K.3.9.2.1.4" href="#K.3.9.2.1.4">K.3.9.2.1.4 The wmemmove_s function</a></h5>
30034 <h6>Synopsis</h6>
30035 <p><!--para 19 -->
30036 <pre>
30037 #define __STDC_WANT_LIB_EXT1__ 1
30038 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30039 errno_t wmemmove_s(wchar_t *s1, rsize_t s1max,
30040 const wchar_t *s2, rsize_t n);</pre>
30041 Runtime-constraints
30042 <p><!--para 20 -->
30043 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
30044 RSIZE_MAX. n shall not be greater than s1max.
30045 <p><!--para 21 -->
30046 If there is a runtime-constraint violation, the wmemmove_s function stores zeros in the
30047 first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and
30048 s1max is not greater than RSIZE_MAX.
30049 <h6>Description</h6>
30050 <p><!--para 22 -->
30051 The wmemmove_s function copies n successive wide characters from the object pointed
30052 to by s2 into the object pointed to by s1. This copying takes place as if the n wide
30053 characters from the object pointed to by s2 are first copied into a temporary array of n
30054 wide characters that does not overlap the objects pointed to by s1 or s2, and then the n
30055 wide characters from the temporary array are copied into the object pointed to by s1.
30056 <h6>Returns</h6>
30057 <p><!--para 23 -->
30058 The wmemmove_s function returns zero if there was no runtime-constraint violation.
30059 Otherwise, a nonzero value is returned.
30061 <h5><a name="K.3.9.2.2" href="#K.3.9.2.2">K.3.9.2.2 Wide string concatenation functions</a></h5>
30063 <h5><a name="K.3.9.2.2.1" href="#K.3.9.2.2.1">K.3.9.2.2.1 The wcscat_s function</a></h5>
30064 <h6>Synopsis</h6>
30065 <p><!--para 1 -->
30066 <pre>
30067 #define __STDC_WANT_LIB_EXT1__ 1
30068 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30069 errno_t wcscat_s(wchar_t * restrict s1,
30070 rsize_t s1max,
30071 const wchar_t * restrict s2);</pre>
30072 Runtime-constraints
30073 <p><!--para 2 -->
30074 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
30075 wcscat_s.
30076 <p><!--para 3 -->
30077 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
30078 s1max shall not equal zero. m shall not equal zero.<sup><a href="#note432"><b>432)</b></a></sup> m shall be greater than
30079 wcsnlen_s(s2, m). Copying shall not take place between objects that overlap.
30080 <!--page 657 -->
30081 <p><!--para 4 -->
30082 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
30083 greater than zero and not greater than RSIZE_MAX, then wcscat_s sets s1[0] to the
30084 null wide character.
30085 <h6>Description</h6>
30086 <p><!--para 5 -->
30087 The wcscat_s function appends a copy of the wide string pointed to by s2 (including
30088 the terminating null wide character) to the end of the wide string pointed to by s1. The
30089 initial wide character from s2 overwrites the null wide character at the end of s1.
30090 <p><!--para 6 -->
30091 All elements following the terminating null wide character (if any) written by
30092 wcscat_s in the array of s1max wide characters pointed to by s1 take unspecified
30093 values when wcscat_s returns.<sup><a href="#note433"><b>433)</b></a></sup>
30094 <h6>Returns</h6>
30095 <p><!--para 7 -->
30096 The wcscat_s function returns zero<sup><a href="#note434"><b>434)</b></a></sup> if there was no runtime-constraint violation.
30097 Otherwise, a nonzero value is returned.
30099 <h6>footnotes</h6>
30100 <p><small><a name="note432" href="#note432">432)</a> Zero means that s1 was not null terminated upon entry to wcscat_s.
30101 </small>
30102 <p><small><a name="note433" href="#note433">433)</a> This allows an implementation to append wide characters from s2 to s1 while simultaneously
30103 checking if any of those wide characters are null. Such an approach might write a wide character to
30104 every element of s1 before discovering that the first element should be set to the null wide character.
30105 </small>
30106 <p><small><a name="note434" href="#note434">434)</a> A zero return value implies that all of the requested wide characters from the wide string pointed to by
30107 s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
30108 </small>
30110 <h5><a name="K.3.9.2.2.2" href="#K.3.9.2.2.2">K.3.9.2.2.2 The wcsncat_s function</a></h5>
30111 <h6>Synopsis</h6>
30112 <p><!--para 8 -->
30113 <pre>
30114 #define __STDC_WANT_LIB_EXT1__ 1
30115 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30116 errno_t wcsncat_s(wchar_t * restrict s1,
30117 rsize_t s1max,
30118 const wchar_t * restrict s2,
30119 rsize_t n);</pre>
30120 Runtime-constraints
30121 <p><!--para 9 -->
30122 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
30123 wcsncat_s.
30124 <p><!--para 10 -->
30125 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
30126 RSIZE_MAX. s1max shall not equal zero. m shall not equal zero.<sup><a href="#note435"><b>435)</b></a></sup> If n is not less
30127 than m, then m shall be greater than wcsnlen_s(s2, m). Copying shall not take
30128 place between objects that overlap.
30131 <!--page 658 -->
30132 <p><!--para 11 -->
30133 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
30134 greater than zero and not greater than RSIZE_MAX, then wcsncat_s sets s1[0] to the
30135 null wide character.
30136 <h6>Description</h6>
30137 <p><!--para 12 -->
30138 The wcsncat_s function appends not more than n successive wide characters (wide
30139 characters that follow a null wide character are not copied) from the array pointed to by
30140 s2 to the end of the wide string pointed to by s1. The initial wide character from s2
30141 overwrites the null wide character at the end of s1. If no null wide character was copied
30142 from s2, then s1[s1max-m+n] is set to a null wide character.
30143 <p><!--para 13 -->
30144 All elements following the terminating null wide character (if any) written by
30145 wcsncat_s in the array of s1max wide characters pointed to by s1 take unspecified
30146 values when wcsncat_s returns.<sup><a href="#note436"><b>436)</b></a></sup>
30147 <h6>Returns</h6>
30148 <p><!--para 14 -->
30149 The wcsncat_s function returns zero<sup><a href="#note437"><b>437)</b></a></sup> if there was no runtime-constraint violation.
30150 Otherwise, a nonzero value is returned.
30151 <p><!--para 15 -->
30152 EXAMPLE 1 The wcsncat_s function can be used to copy a wide string without the danger that the
30153 result will not be null terminated or that wide characters will be written past the end of the destination
30154 array.
30155 <pre>
30156 #define __STDC_WANT_LIB_EXT1__ 1
30157 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30158 /* ... */
30159 wchar_t s1[100] = L"good";
30160 wchar_t s2[6] = L"hello";
30161 wchar_t s3[6] = L"hello";
30162 wchar_t s4[7] = L"abc";
30163 wchar_t s5[1000] = L"bye";
30164 int r1, r2, r3, r4;
30165 r1 = wcsncat_s(s1, 100, s5, 1000);
30166 r2 = wcsncat_s(s2, 6, L"", 1);
30167 r3 = wcsncat_s(s3, 6, L"X", 2);
30168 r4 = wcsncat_s(s4, 7, L"defghijklmn", 3);</pre>
30169 After the first call r1 will have the value zero and s1 will be the wide character sequence goodbye\0.
30170 After the second call r2 will have the value zero and s2 will be the wide character sequence hello\0.
30171 After the third call r3 will have a nonzero value and s3 will be the wide character sequence \0.
30172 After the fourth call r4 will have the value zero and s4 will be the wide character sequence abcdef\0.
30177 <!--page 659 -->
30179 <h6>footnotes</h6>
30180 <p><small><a name="note435" href="#note435">435)</a> Zero means that s1 was not null terminated upon entry to wcsncat_s.
30181 </small>
30182 <p><small><a name="note436" href="#note436">436)</a> This allows an implementation to append wide characters from s2 to s1 while simultaneously
30183 checking if any of those wide characters are null. Such an approach might write a wide character to
30184 every element of s1 before discovering that the first element should be set to the null wide character.
30185 </small>
30186 <p><small><a name="note437" href="#note437">437)</a> A zero return value implies that all of the requested wide characters from the wide string pointed to by
30187 s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
30188 </small>
30190 <h5><a name="K.3.9.2.3" href="#K.3.9.2.3">K.3.9.2.3 Wide string search functions</a></h5>
30192 <h5><a name="K.3.9.2.3.1" href="#K.3.9.2.3.1">K.3.9.2.3.1 The wcstok_s function</a></h5>
30193 <h6>Synopsis</h6>
30194 <p><!--para 1 -->
30195 <pre>
30196 #define __STDC_WANT_LIB_EXT1__ 1
30197 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30198 wchar_t *wcstok_s(wchar_t * restrict s1,
30199 rsize_t * restrict s1max,
30200 const wchar_t * restrict s2,
30201 wchar_t ** restrict ptr);</pre>
30202 Runtime-constraints
30203 <p><!--para 2 -->
30204 None of s1max, s2, or ptr shall be a null pointer. If s1 is a null pointer, then *ptr
30205 shall not be a null pointer. The value of *s1max shall not be greater than RSIZE_MAX.
30206 The end of the token found shall occur within the first *s1max wide characters of s1 for
30207 the first call, and shall occur within the first *s1max wide characters of where searching
30208 resumes on subsequent calls.
30209 <p><!--para 3 -->
30210 If there is a runtime-constraint violation, the wcstok_s function does not indirect
30211 through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr.
30212 <h6>Description</h6>
30213 <p><!--para 4 -->
30214 A sequence of calls to the wcstok_s function breaks the wide string pointed to by s1
30215 into a sequence of tokens, each of which is delimited by a wide character from the wide
30216 string pointed to by s2. The fourth argument points to a caller-provided wchar_t
30217 pointer into which the wcstok_s function stores information necessary for it to
30218 continue scanning the same wide string.
30219 <p><!--para 5 -->
30220 The first call in a sequence has a non-null first argument and s1max points to an object
30221 whose value is the number of elements in the wide character array pointed to by the first
30222 argument. The first call stores an initial value in the object pointed to by ptr and
30223 updates the value pointed to by s1max to reflect the number of elements that remain in
30224 relation to ptr. Subsequent calls in the sequence have a null first argument and the
30225 objects pointed to by s1max and ptr are required to have the values stored by the
30226 previous call in the sequence, which are then updated. The separator wide string pointed
30227 to by s2 may be different from call to call.
30228 <p><!--para 6 -->
30229 The first call in the sequence searches the wide string pointed to by s1 for the first wide
30230 character that is not contained in the current separator wide string pointed to by s2. If no
30231 such wide character is found, then there are no tokens in the wide string pointed to by s1
30232 and the wcstok_s function returns a null pointer. If such a wide character is found, it is
30233 the start of the first token.
30234 <!--page 660 -->
30235 <p><!--para 7 -->
30236 The wcstok_s function then searches from there for the first wide character in s1 that
30237 is contained in the current separator wide string. If no such wide character is found, the
30238 current token extends to the end of the wide string pointed to by s1, and subsequent
30239 searches in the same wide string for a token return a null pointer. If such a wide character
30240 is found, it is overwritten by a null wide character, which terminates the current token.
30241 <p><!--para 8 -->
30242 In all cases, the wcstok_s function stores sufficient information in the pointer pointed
30243 to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
30244 value for ptr, shall start searching just past the element overwritten by a null wide
30245 character (if any).
30246 <h6>Returns</h6>
30247 <p><!--para 9 -->
30248 The wcstok_s function returns a pointer to the first wide character of a token, or a null
30249 pointer if there is no token or there is a runtime-constraint violation.
30250 <p><!--para 10 -->
30251 EXAMPLE
30252 <pre>
30253 #define __STDC_WANT_LIB_EXT1__ 1
30254 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30255 static wchar_t str1[] = L"?a???b,,,#c";
30256 static wchar_t str2[] = L"\t \t";
30257 wchar_t *t, *ptr1, *ptr2;
30258 rsize_t max1 = wcslen(str1)+1;
30259 rsize_t max2 = wcslen(str2)+1;
30260 t = wcstok_s(str1, &amp;max1, "?", &amp;ptr1); // t points to the token "a"
30261 t = wcstok_s(NULL, &amp;max1, ",", &amp;ptr1); // t points to the token "??b"
30262 t = wcstok_s(str2, &amp;max2, " \t", &amp;ptr2); // t is a null pointer
30263 t = wcstok_s(NULL, &amp;max1, "#,", &amp;ptr1); // t points to the token "c"
30264 t = wcstok_s(NULL, &amp;max1, "?", &amp;ptr1); // t is a null pointer</pre>
30267 <h5><a name="K.3.9.2.4" href="#K.3.9.2.4">K.3.9.2.4 Miscellaneous functions</a></h5>
30269 <h5><a name="K.3.9.2.4.1" href="#K.3.9.2.4.1">K.3.9.2.4.1 The wcsnlen_s function</a></h5>
30270 <h6>Synopsis</h6>
30271 <p><!--para 1 -->
30272 <pre>
30273 #define __STDC_WANT_LIB_EXT1__ 1
30274 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30275 size_t wcsnlen_s(const wchar_t *s, size_t maxsize);</pre>
30276 <h6>Description</h6>
30277 <p><!--para 2 -->
30278 The wcsnlen_s function computes the length of the wide string pointed to by s.
30279 <h6>Returns</h6>
30280 <p><!--para 3 -->
30281 If s is a null pointer,<sup><a href="#note438"><b>438)</b></a></sup> then the wcsnlen_s function returns zero.
30282 <p><!--para 4 -->
30283 Otherwise, the wcsnlen_s function returns the number of wide characters that precede
30284 the terminating null wide character. If there is no null wide character in the first
30285 maxsize wide characters of s then wcsnlen_s returns maxsize. At most the first
30286 <!--page 661 -->
30287 maxsize wide characters of s shall be accessed by wcsnlen_s.
30289 <h6>footnotes</h6>
30290 <p><small><a name="note438" href="#note438">438)</a> Note that the wcsnlen_s function has no runtime-constraints. This lack of runtime-constraints
30291 along with the values returned for a null pointer or an unterminated wide string argument make
30292 wcsnlen_s useful in algorithms that gracefully handle such exceptional data.
30293 </small>
30295 <h5><a name="K.3.9.3" href="#K.3.9.3">K.3.9.3 Extended multibyte/wide character conversion utilities</a></h5>
30297 <h5><a name="K.3.9.3.1" href="#K.3.9.3.1">K.3.9.3.1 Restartable multibyte/wide character conversion functions</a></h5>
30298 <p><!--para 1 -->
30299 Unlike wcrtomb, wcrtomb_s does not permit the ps parameter (the pointer to the
30300 conversion state) to be a null pointer.
30302 <h5><a name="K.3.9.3.1.1" href="#K.3.9.3.1.1">K.3.9.3.1.1 The wcrtomb_s function</a></h5>
30303 <h6>Synopsis</h6>
30304 <p><!--para 2 -->
30305 <pre>
30306 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30307 errno_t wcrtomb_s(size_t * restrict retval,
30308 char * restrict s, rsize_t smax,
30309 wchar_t wc, mbstate_t * restrict ps);</pre>
30310 Runtime-constraints
30311 <p><!--para 3 -->
30312 Neither retval nor ps shall be a null pointer. If s is not a null pointer, then smax
30313 shall not equal zero and shall not be greater than RSIZE_MAX. If s is not a null pointer,
30314 then smax shall be not be less than the number of bytes to be stored in the array pointed
30315 to by s. If s is a null pointer, then smax shall equal zero.
30316 <p><!--para 4 -->
30317 If there is a runtime-constraint violation, then wcrtomb_s does the following. If s is
30318 not a null pointer and smax is greater than zero and not greater than RSIZE_MAX, then
30319 wcrtomb_s sets s[0] to the null character. If retval is not a null pointer, then
30320 wcrtomb_s sets *retval to (size_t)(-1).
30321 <h6>Description</h6>
30322 <p><!--para 5 -->
30323 If s is a null pointer, the wcrtomb_s function is equivalent to the call
30324 <pre>
30325 wcrtomb_s(&amp;retval, buf, sizeof buf, L'\0', ps)</pre>
30326 where retval and buf are internal variables of the appropriate types, and the size of
30327 buf is greater than MB_CUR_MAX.
30328 <p><!--para 6 -->
30329 If s is not a null pointer, the wcrtomb_s function determines the number of bytes
30330 needed to represent the multibyte character that corresponds to the wide character given
30331 by wc (including any shift sequences), and stores the multibyte character representation
30332 in the array whose first element is pointed to by s. At most MB_CUR_MAX bytes are
30333 stored. If wc is a null wide character, a null byte is stored, preceded by any shift
30334 sequence needed to restore the initial shift state; the resulting state described is the initial
30335 conversion state.
30337 <!--page 662 -->
30338 <p><!--para 7 -->
30339 If wc does not correspond to a valid multibyte character, an encoding error occurs: the
30340 wcrtomb_s function stores the value (size_t)(-1) into *retval and the
30341 conversion state is unspecified. Otherwise, the wcrtomb_s function stores into
30342 *retval the number of bytes (including any shift sequences) stored in the array pointed
30343 to by s.
30344 <h6>Returns</h6>
30345 <p><!--para 8 -->
30346 The wcrtomb_s function returns zero if no runtime-constraint violation and no
30347 encoding error occurred. Otherwise, a nonzero value is returned.
30349 <h5><a name="K.3.9.3.2" href="#K.3.9.3.2">K.3.9.3.2 Restartable multibyte/wide string conversion functions</a></h5>
30350 <p><!--para 1 -->
30351 Unlike mbsrtowcs and wcsrtombs, mbsrtowcs_s and wcsrtombs_s do not
30352 permit the ps parameter (the pointer to the conversion state) to be a null pointer.
30354 <h5><a name="K.3.9.3.2.1" href="#K.3.9.3.2.1">K.3.9.3.2.1 The mbsrtowcs_s function</a></h5>
30355 <h6>Synopsis</h6>
30356 <p><!--para 2 -->
30357 <pre>
30358 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30359 errno_t mbsrtowcs_s(size_t * restrict retval,
30360 wchar_t * restrict dst, rsize_t dstmax,
30361 const char ** restrict src, rsize_t len,
30362 mbstate_t * restrict ps);</pre>
30363 Runtime-constraints
30364 <p><!--para 3 -->
30365 None of retval, src, *src, or ps shall be null pointers. If dst is not a null pointer,
30366 then neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null
30367 pointer, then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall
30368 not equal zero. If dst is not a null pointer and len is not less than dstmax, then a null
30369 character shall occur within the first dstmax multibyte characters of the array pointed to
30370 by *src.
30371 <p><!--para 4 -->
30372 If there is a runtime-constraint violation, then mbsrtowcs_s does the following. If
30373 retval is not a null pointer, then mbsrtowcs_s sets *retval to (size_t)(-1).
30374 If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
30375 then mbsrtowcs_s sets dst[0] to the null wide character.
30376 <h6>Description</h6>
30377 <p><!--para 5 -->
30378 The mbsrtowcs_s function converts a sequence of multibyte characters that begins in
30379 the conversion state described by the object pointed to by ps, from the array indirectly
30380 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
30381 pointer, the converted characters are stored into the array pointed to by dst. Conversion
30382 continues up to and including a terminating null character, which is also stored.
30383 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
30384 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
30385 <!--page 663 -->
30386 characters have been stored into the array pointed to by dst.<sup><a href="#note439"><b>439)</b></a></sup> If dst is not a null
30387 pointer and no null wide character was stored into the array pointed to by dst, then
30388 dst[len] is set to the null wide character. Each conversion takes place as if by a call
30389 to the mbrtowc function.
30390 <p><!--para 6 -->
30391 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
30392 pointer (if conversion stopped due to reaching a terminating null character) or the address
30393 just past the last multibyte character converted (if any). If conversion stopped due to
30394 reaching a terminating null character and if dst is not a null pointer, the resulting state
30395 described is the initial conversion state.
30396 <p><!--para 7 -->
30397 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
30398 sequence of bytes that do not form a valid multibyte character, an encoding error occurs:
30399 the mbsrtowcs_s function stores the value (size_t)(-1) into *retval and the
30400 conversion state is unspecified. Otherwise, the mbsrtowcs_s function stores into
30401 *retval the number of multibyte characters successfully converted, not including the
30402 terminating null character (if any).
30403 <p><!--para 8 -->
30404 All elements following the terminating null wide character (if any) written by
30405 mbsrtowcs_s in the array of dstmax wide characters pointed to by dst take
30406 unspecified values when mbsrtowcs_s returns.<sup><a href="#note440"><b>440)</b></a></sup>
30407 <p><!--para 9 -->
30408 If copying takes place between objects that overlap, the objects take on unspecified
30409 values.
30410 <h6>Returns</h6>
30411 <p><!--para 10 -->
30412 The mbsrtowcs_s function returns zero if no runtime-constraint violation and no
30413 encoding error occurred. Otherwise, a nonzero value is returned.
30415 <h6>footnotes</h6>
30416 <p><small><a name="note439" href="#note439">439)</a> Thus, the value of len is ignored if dst is a null pointer.
30417 </small>
30418 <p><small><a name="note440" href="#note440">440)</a> This allows an implementation to attempt converting the multibyte string before discovering a
30419 terminating null character did not occur where required.
30420 </small>
30422 <h5><a name="K.3.9.3.2.2" href="#K.3.9.3.2.2">K.3.9.3.2.2 The wcsrtombs_s function</a></h5>
30423 <h6>Synopsis</h6>
30424 <p><!--para 11 -->
30425 <pre>
30426 #include <a href="#7.28">&lt;wchar.h&gt;</a>
30427 errno_t wcsrtombs_s(size_t * restrict retval,
30428 char * restrict dst, rsize_t dstmax,
30429 const wchar_t ** restrict src, rsize_t len,
30430 mbstate_t * restrict ps);</pre>
30435 <!--page 664 -->
30436 Runtime-constraints
30437 <p><!--para 12 -->
30438 None of retval, src, *src, or ps shall be null pointers. If dst is not a null pointer,
30439 then neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null
30440 pointer, then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall
30441 not equal zero. If dst is not a null pointer and len is not less than dstmax, then the
30442 conversion shall have been stopped (see below) because a terminating null wide character
30443 was reached or because an encoding error occurred.
30444 <p><!--para 13 -->
30445 If there is a runtime-constraint violation, then wcsrtombs_s does the following. If
30446 retval is not a null pointer, then wcsrtombs_s sets *retval to (size_t)(-1).
30447 If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
30448 then wcsrtombs_s sets dst[0] to the null character.
30449 <h6>Description</h6>
30450 <p><!--para 14 -->
30451 The wcsrtombs_s function converts a sequence of wide characters from the array
30452 indirectly pointed to by src into a sequence of corresponding multibyte characters that
30453 begins in the conversion state described by the object pointed to by ps. If dst is not a
30454 null pointer, the converted characters are then stored into the array pointed to by dst.
30455 Conversion continues up to and including a terminating null wide character, which is also
30456 stored. Conversion stops earlier in two cases:
30457 <ul>
30458 <li> when a wide character is reached that does not correspond to a valid multibyte
30459 character;
30460 <li> (if dst is not a null pointer) when the next multibyte character would exceed the
30461 limit of n total bytes to be stored into the array pointed to by dst. If the wide
30462 character being converted is the null wide character, then n is the lesser of len or
30463 dstmax. Otherwise, n is the lesser of len or dstmax-1.
30464 </ul>
30465 If the conversion stops without converting a null wide character and dst is not a null
30466 pointer, then a null character is stored into the array pointed to by dst immediately
30467 following any multibyte characters already stored. Each conversion takes place as if by a
30468 call to the wcrtomb function.<sup><a href="#note441"><b>441)</b></a></sup>
30469 <p><!--para 15 -->
30470 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
30471 pointer (if conversion stopped due to reaching a terminating null wide character) or the
30472 address just past the last wide character converted (if any). If conversion stopped due to
30473 reaching a terminating null wide character, the resulting state described is the initial
30474 conversion state.
30477 <!--page 665 -->
30478 <p><!--para 16 -->
30479 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
30480 wide character that does not correspond to a valid multibyte character, an encoding error
30481 occurs: the wcsrtombs_s function stores the value (size_t)(-1) into *retval
30482 and the conversion state is unspecified. Otherwise, the wcsrtombs_s function stores
30483 into *retval the number of bytes in the resulting multibyte character sequence, not
30484 including the terminating null character (if any).
30485 <p><!--para 17 -->
30486 All elements following the terminating null character (if any) written by wcsrtombs_s
30487 in the array of dstmax elements pointed to by dst take unspecified values when
30488 wcsrtombs_s returns.<sup><a href="#note442"><b>442)</b></a></sup>
30489 <p><!--para 18 -->
30490 If copying takes place between objects that overlap, the objects take on unspecified
30491 values.
30492 <h6>Returns</h6>
30493 <p><!--para 19 -->
30494 The wcsrtombs_s function returns zero if no runtime-constraint violation and no
30495 encoding error occurred. Otherwise, a nonzero value is returned.
30500 <!--page 666 -->
30502 <h6>footnotes</h6>
30503 <p><small><a name="note441" href="#note441">441)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
30504 include those necessary to reach the initial shift state immediately before the null byte. However, if
30505 the conversion stops before a terminating null wide character has been reached, the result will be null
30506 terminated, but might not end in the initial shift state.
30507 </small>
30508 <p><small><a name="note442" href="#note442">442)</a> When len is not less than dstmax, the implementation might fill the array before discovering a
30509 runtime-constraint violation.
30510 </small>
30512 <h2><a name="L" href="#L">Annex L</a></h2>
30513 <pre>
30514 (normative)
30515 Analyzability</pre>
30517 <h3><a name="L.1" href="#L.1">L.1 Scope</a></h3>
30518 <p><!--para 1 -->
30519 This annex specifies optional behavior that can aid in the analyzability of C programs.
30520 <p><!--para 2 -->
30521 An implementation that defines __STDC_ANALYZABLE__ shall conform to the
30522 specifications in this annex.<sup><a href="#note443"><b>443)</b></a></sup>
30524 <h6>footnotes</h6>
30525 <p><small><a name="note443" href="#note443">443)</a> Implementations that do not define __STDC_ANALYZABLE__ are not required to conform to these
30526 specifications.
30527 </small>
30529 <h3><a name="L.2" href="#L.2">L.2 Definitions</a></h3>
30531 <h4><a name="L.2.1" href="#L.2.1">L.2.1</a></h4>
30532 <p><!--para 1 -->
30533 out-of-bounds store
30534 an (attempted) access (<a href="#3.1">3.1</a>) that, at run time, for a given computational state, would
30535 modify (or, for an object declared volatile, fetch) one or more bytes that lie outside
30536 the bounds permitted by this Standard.
30538 <h4><a name="L.2.2" href="#L.2.2">L.2.2</a></h4>
30539 <p><!--para 1 -->
30540 bounded undefined behavior
30541 undefined behavior (<a href="#3.4.3">3.4.3</a>) that does not perform an out-of-bounds store.
30542 <p><!--para 2 -->
30543 NOTE 1 The behavior might perform a trap.
30545 <p><!--para 3 -->
30546 NOTE 2 Any values produced or stored might be indeterminate values.
30549 <h4><a name="L.2.3" href="#L.2.3">L.2.3</a></h4>
30550 <p><!--para 1 -->
30551 critical undefined behavior
30552 undefined behavior that is not bounded undefined behavior.
30553 <p><!--para 2 -->
30554 NOTE The behavior might perform an out-of-bounds store or perform a trap.
30559 <!--page 667 -->
30561 <h3><a name="L.3" href="#L.3">L.3 Requirements</a></h3>
30562 <p><!--para 1 -->
30563 If the program performs a trap (<a href="#3.19.5">3.19.5</a>), the implementation is permitted to invoke a
30564 runtime-constraint handler. Any such semantics are implementation-defined.
30565 <p><!--para 2 -->
30566 All undefined behavior shall be limited to bounded undefined behavior, except for the
30567 following which are permitted to result in critical undefined behavior:
30568 <ul>
30569 <li> An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
30570 <li> An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
30571 <li> A pointer is used to call a function whose type is not compatible with the referenced
30572 type (<a href="#6.3.2.3">6.3.2.3</a>).
30573 <li> The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
30574 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
30575 integer type produces a result that points just beyond the array object and is used as
30576 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
30577 <li> An argument to a library function has an invalid value or a type not expected by a
30578 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
30579 <li> The value of a pointer that refers to space deallocated by a call to the free or realloc
30580 function is used (<a href="#7.22.3">7.22.3</a>).
30581 <li> A string or wide string utility function is instructed to access an array beyond the end
30582 of an object (<a href="#7.23.1">7.23.1</a>, <a href="#7.28.4">7.28.4</a>).
30583 <!--page 668 -->
30584 </ul>
30586 <h2><a name="Bibliography" href="#Bibliography">Bibliography</a></h2>
30587 <ol>
30588 <li> ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
30589 published in The C Programming Language by Brian W. Kernighan and Dennis
30590 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
30591 <li> 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
30592 California, USA, November 1984.
30593 <li> ANSI X3/TR-1-82 (1982), American National Dictionary for Information
30594 Processing Systems, Information Processing Systems Technical Report.
30595 <li> ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
30596 Arithmetic.
30597 <li> ANSI/IEEE 854-1988, American National Standard for Radix-Independent
30598 Floating-Point Arithmetic.
30599 <li> IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
30600 second edition (previously designated IEC 559:1989).
30601 <li> ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
30602 symbols for use in the physical sciences and technology.
30603 <li> ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
30604 information interchange.
30605 <li> ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
30606 Fundamental terms.
30607 <li> ISO 4217:1995, Codes for the representation of currencies and funds.
30608 <li> ISO 8601:1988, Data elements and interchange formats -- Information
30609 interchange -- Representation of dates and times.
30610 <li> ISO/IEC 9899:1990, Programming languages -- C.
30611 <li> ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
30612 <li> ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
30613 <li> ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
30614 <li> ISO/IEC 9899:1999, Programming languages -- C.
30615 <li> ISO/IEC 9899:1999/Cor.1:2001, Technical Corrigendum 1.
30616 <li> ISO/IEC 9899:1999/Cor.2:2004, Technical Corrigendum 2.
30617 <li> ISO/IEC 9899:1999/Cor.3:2007, Technical Corrigendum 3.
30618 <!--page 669 -->
30619 <li> ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
30620 Interface (POSIX) -- Part 2: Shell and Utilities.
30621 <li> ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
30622 preparation of programming language standards.
30623 <li> ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
30624 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
30625 <li> ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
30626 ISO/IEC 10646-1:1993.
30627 <li> ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
30628 ISO/IEC 10646-1:1993.
30629 <li> ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
30630 Transformation Format for 16 planes of group 00 (UTF-16).
30631 <li> ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
30632 Transformation Format 8 (UTF-8).
30633 <li> ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
30634 <li> ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
30635 <li> ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
30636 syllables.
30637 <li> ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993
30638 Tibetan.
30639 <li> ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
30640 additional characters.
30641 <li> ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
30642 <li> ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
30643 Identifiers for characters.
30644 <li> ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
30645 Ethiopic.
30646 <li> ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
30647 Unified Canadian Aboriginal Syllabics.
30648 <li> ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
30649 Cherokee.
30650 <li> ISO/IEC 10967-1:1994, Information technology -- Language independent
30651 arithmetic -- Part 1: Integer and floating point arithmetic.
30652 <!--page 670 -->
30653 <li> ISO/IEC TR 19769:2004, Information technology -- Programming languages,
30654 their environments and system software interfaces -- Extensions for the
30655 programming language C to support new character data types.
30656 <li> ISO/IEC TR 24731-1:2007, Information technology -- Programming languages,
30657 their environments and system software interfaces -- Extensions to the C library
30658 -- Part 1: Bounds-checking interfaces.
30659 <!--page 671 -->
30660 </ol>
30662 <h2><a name="Index" href="#Index">Index</a></h2>
30663 <pre>
30664 [^ x ^], <a href="#3.20">3.20</a> , (comma operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.17">6.5.17</a>
30665 , (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>,
30666 [_ x _], <a href="#3.21">3.21</a> <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a>
30667 ! (logical negation operator), <a href="#6.5.3.3">6.5.3.3</a> - (subtraction operator), <a href="#6.2.6.2">6.2.6.2</a>, <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>
30668 != (inequality operator), <a href="#6.5.9">6.5.9</a> - (unary minus operator), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a>
30669 # operator, <a href="#6.10.3.2">6.10.3.2</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>
30670 # preprocessing directive, <a href="#6.10.7">6.10.7</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>
30671 # punctuator, <a href="#6.10">6.10</a> -= (subtraction assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
30672 ## operator, <a href="#6.10.3.3">6.10.3.3</a> -&gt; (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
30673 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> . (structure/union member operator), <a href="#6.3.2.1">6.3.2.1</a>,
30674 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.5.2.3">6.5.2.3</a>
30675 #else preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.9">6.7.9</a>
30676 #endif 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.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a>
30677 #error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> / (division operator), <a href="#6.2.6.2">6.2.6.2</a>, <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>
30678 #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 delimiters), <a href="#6.4.9">6.4.9</a>
30679 <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a> // (comment delimiter), <a href="#6.4.9">6.4.9</a>
30680 #ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a> /= (division assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
30681 #ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> : (colon punctuator), <a href="#6.7.2.1">6.7.2.1</a>
30682 #include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, :&gt; (alternative spelling of ]), <a href="#6.4.6">6.4.6</a>
30683 <a href="#6.10.2">6.10.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>,
30684 #line preprocessing directive, <a href="#6.10.4">6.10.4</a> <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>
30685 #pragma preprocessing directive, <a href="#6.10.6">6.10.6</a> &lt; (less-than operator), <a href="#6.5.8">6.5.8</a>
30686 #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>
30687 <a href="#7.1.4">7.1.4</a> &lt;: (alternative spelling of [), <a href="#6.4.6">6.4.6</a>
30688 % (remainder operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a> &lt;&lt; (left-shift operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
30689 %: (alternative spelling of #), <a href="#6.4.6">6.4.6</a> &lt;&lt;= (left-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
30690 %:%: (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>
30691 %= (remainder assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.2">&lt;assert.h&gt;</a> header, <a href="#7.2">7.2</a>
30692 %&gt; (alternative spelling of }), <a href="#6.4.6">6.4.6</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="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>,
30693 &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.3">7.3</a>, <a href="#7.24">7.24</a>, <a href="#7.30.1">7.30.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
30694 &amp; (bitwise AND operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a> <a href="#7.4">&lt;ctype.h&gt;</a> header, <a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a>
30695 &amp;&amp; (logical AND operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a> <a href="#7.5">&lt;errno.h&gt;</a> header, <a href="#7.5">7.5</a>, <a href="#7.30.3">7.30.3</a>, <a href="#K.3.2">K.3.2</a>
30696 &amp;= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</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>,
30697 ' ' (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="#H">H</a>
30698 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.29.2.1.3">7.29.2.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.22.1.3">7.22.1.3</a>,
30699 ( ) (cast operator), <a href="#6.5.4">6.5.4</a> <a href="#7.28.4.1.1">7.28.4.1.1</a>
30700 ( ) (function-call operator), <a href="#6.5.2.2">6.5.2.2</a> <a href="#7.8">&lt;inttypes.h&gt;</a> header, <a href="#7.8">7.8</a>, <a href="#7.30.4">7.30.4</a>
30701 ( ) (parentheses punctuator), <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> <a href="#7.9">&lt;iso646.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.9">7.9</a>
30702 ( ){ } (compound-literal operator), <a href="#6.5.2.5">6.5.2.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>
30703 * (asterisk punctuator), <a href="#6.7.6.1">6.7.6.1</a>, <a href="#6.7.6.2">6.7.6.2</a> <a href="#7.11">&lt;locale.h&gt;</a> header, <a href="#7.11">7.11</a>, <a href="#7.30.5">7.30.5</a>
30704 * (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="#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.24">7.24</a>, <a href="#F">F</a>,
30705 * (multiplication operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10">F.10</a>, <a href="#J.5.17">J.5.17</a>
30706 <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>
30707 *= (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.30.6">7.30.6</a>
30708 + (addition operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, <a href="#7.15">&lt;stdalign.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.15">7.15</a>
30709 <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> <a href="#7.16">&lt;stdarg.h&gt;</a> header, <a href="#4">4</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#7.16">7.16</a>
30710 + (unary plus operator), <a href="#6.5.3.3">6.5.3.3</a> <a href="#7.17">&lt;stdatomic.h&gt;</a> header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.17">7.17</a>
30711 ++ (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="#7.18">&lt;stdbool.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.30.7">7.30.7</a>, <a href="#H">H</a>
30712 ++ (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.19">&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>,
30713 += (addition assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
30714 <!--page 672 -->
30715 <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.19">7.19</a>, <a href="#K.3.3">K.3.3</a> \x hexadecimal digits (hexadecimal-character
30716 <a href="#7.20">&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>, escape sequence), <a href="#6.4.4.4">6.4.4.4</a>
30717 <a href="#7.20">7.20</a>, <a href="#7.30.8">7.30.8</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a> ^ (bitwise exclusive OR operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
30718 <a href="#7.21">&lt;stdio.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21">7.21</a>, <a href="#7.30.9">7.30.9</a>, <a href="#F">F</a>, ^= (bitwise exclusive OR assignment operator),
30719 <a href="#K.3.5">K.3.5</a> <a href="#6.5.16.2">6.5.16.2</a>
30720 <a href="#7.22">&lt;stdlib.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.22">7.22</a>, <a href="#7.30.10">7.30.10</a>, <a href="#F">F</a>, __alignas_is_defined macro, <a href="#7.15">7.15</a>
30721 <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a> __bool_true_false_are_defined
30722 <a href="#7.23">&lt;string.h&gt;</a> header, <a href="#7.23">7.23</a>, <a href="#7.30.11">7.30.11</a>, <a href="#K.3.7">K.3.7</a> macro, <a href="#7.18">7.18</a>
30723 <a href="#7.24">&lt;tgmath.h&gt;</a> header, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> __cplusplus macro, <a href="#6.10.8">6.10.8</a>
30724 <a href="#7.25">&lt;threads.h&gt;</a> header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.25">7.25</a> __DATE__ macro, <a href="#6.10.8.1">6.10.8.1</a>
30725 <a href="#7.26">&lt;time.h&gt;</a> header, <a href="#7.26">7.26</a>, <a href="#K.3.8">K.3.8</a> __FILE__ macro, <a href="#6.10.8.1">6.10.8.1</a>, <a href="#7.2.1.1">7.2.1.1</a>
30726 <a href="#7.27">&lt;uchar.h&gt;</a> header, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.27">7.27</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>
30727 <a href="#7.28">&lt;wchar.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.28">7.28</a>, __LINE__ macro, <a href="#6.10.8.1">6.10.8.1</a>, <a href="#7.2.1.1">7.2.1.1</a>
30728 <a href="#7.30.12">7.30.12</a>, <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a> __STDC_, <a href="#6.11.9">6.11.9</a>
30729 <a href="#7.29">&lt;wctype.h&gt;</a> header, <a href="#7.29">7.29</a>, <a href="#7.30.13">7.30.13</a> __STDC__ macro, <a href="#6.10.8.1">6.10.8.1</a>
30730 = (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.9">6.7.9</a> __STDC_ANALYZABLE__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#L.1">L.1</a>
30731 = (simple assignment operator), <a href="#6.5.16.1">6.5.16.1</a> __STDC_HOSTED__ macro, <a href="#6.10.8.1">6.10.8.1</a>
30732 == (equality operator), <a href="#6.5.9">6.5.9</a> __STDC_IEC_559__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#F.1">F.1</a>
30733 &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
30734 &gt;= (greater-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a> <a href="#6.10.8.3">6.10.8.3</a>, <a href="#G.1">G.1</a>
30735 &gt;&gt; (right-shift operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a> __STDC_ISO_10646__ macro, <a href="#6.10.8.2">6.10.8.2</a>
30736 &gt;&gt;= (right-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a> __STDC_LIB_EXT1__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#K.2">K.2</a>
30737 ? : (conditional operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.15">6.5.15</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
30738 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.19">7.19</a>
30739 [ ] (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> __STDC_NO_COMPLEX__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
30740 [ ] (brackets punctuator), <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a> <a href="#7.3.1">7.3.1</a>
30741 \ (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> __STDC_NO_THREADS__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
30742 \ (escape character), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.17.1">7.17.1</a>, <a href="#7.25.1">7.25.1</a>
30743 \" (double-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, __STDC_NO_VLA__ macro, <a href="#6.10.8.3">6.10.8.3</a>
30744 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> __STDC_UTF_16__ macro, <a href="#6.10.8.2">6.10.8.2</a>
30745 \\ (backslash escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a> __STDC_UTF_32__ macro, <a href="#6.10.8.2">6.10.8.2</a>
30746 \' (single-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> __STDC_VERSION__ macro, <a href="#6.10.8.1">6.10.8.1</a>
30747 \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> __STDC_WANT_LIB_EXT1__ macro, <a href="#K.3.1.1">K.3.1.1</a>
30748 padding of binary stream, <a href="#7.21.2">7.21.2</a> __TIME__ macro, <a href="#6.10.8.1">6.10.8.1</a>
30749 \? (question-mark escape sequence), <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>
30750 \a (alert escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> _Alignas, <a href="#6.7.5">6.7.5</a>
30751 \b (backspace escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> _Atomic type qualifier, <a href="#6.7.3">6.7.3</a>
30752 \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>, _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>, <a href="#7.17.1">7.17.1</a>,
30753 <a href="#7.4.1.10">7.4.1.10</a> <a href="#F.4">F.4</a>
30754 \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>, _Bool type conversions, <a href="#6.3.1.2">6.3.1.2</a>
30755 <a href="#7.4.1.10">7.4.1.10</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>
30756 \octal digits (octal-character escape sequence), _Complex_I macro, <a href="#7.3.1">7.3.1</a>
30757 <a href="#6.4.4.4">6.4.4.4</a> _Exit function, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>
30758 \r (carriage-return escape sequence), <a href="#5.2.2">5.2.2</a>, _Imaginary keyword, <a href="#G.2">G.2</a>
30759 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a> _Imaginary types, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>
30760 \t (horizontal-tab escape sequence), <a href="#5.2.2">5.2.2</a>, _Imaginary_I macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a>
30761 <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.29.2.1.3">7.29.2.1.3</a> _IOFBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a>
30762 \U (universal character names), <a href="#6.4.3">6.4.3</a> _IOLBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.6">7.21.5.6</a>
30763 \u (universal character names), <a href="#6.4.3">6.4.3</a> _IONBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a>
30764 \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>, _Noreturn, <a href="#6.7.4">6.7.4</a>
30765 <a href="#7.4.1.10">7.4.1.10</a> _Pragma operator, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a>
30766 <!--page 673 -->
30767 _Static_assert, <a href="#6.7.10">6.7.10</a>, <a href="#7.2">7.2</a> allocated storage, order and contiguity, <a href="#7.22.3">7.22.3</a>
30768 _Thread_local storage-class specifier, <a href="#6.2.4">6.2.4</a>, and macro, <a href="#7.9">7.9</a>
30769 <a href="#6.7.1">6.7.1</a> AND operators
30770 { } (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.9">6.7.9</a>, bitwise (&amp;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a>
30771 <a href="#6.8.2">6.8.2</a> bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a>
30772 { } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a> logical (&amp;&amp;), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a>
30773 | (bitwise inclusive OR operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a> and_eq macro, <a href="#7.9">7.9</a>
30774 |= (bitwise inclusive OR assignment operator), anonymous structure, <a href="#6.7.2.1">6.7.2.1</a>
30775 <a href="#6.5.16.2">6.5.16.2</a> anonymous union, <a href="#6.7.2.1">6.7.2.1</a>
30776 || (logical OR operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a> ANSI/IEEE 754, <a href="#F.1">F.1</a>
30777 ~ (bitwise complement operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a> ANSI/IEEE 854, <a href="#F.1">F.1</a>
30778 argc (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a>
30779 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.21.3">7.21.3</a>, argument, <a href="#3.3">3.3</a>
30780 <a href="#7.22.4.1">7.22.4.1</a>, <a href="#7.25.3.6">7.25.3.6</a>, <a href="#K.3.6.1.2">K.3.6.1.2</a> array, <a href="#6.9.1">6.9.1</a>
30781 abort_handler_s function, <a href="#K.3.6.1.2">K.3.6.1.2</a> default promotions, <a href="#6.5.2.2">6.5.2.2</a>
30782 abs function, <a href="#7.22.6.1">7.22.6.1</a> function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
30783 absolute-value functions macro, substitution, <a href="#6.10.3.1">6.10.3.1</a>
30784 complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a> argument, complex, <a href="#7.3.9.1">7.3.9.1</a>
30785 integer, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.22.6.1">7.22.6.1</a> argv (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a>
30786 real, <a href="#7.12.7">7.12.7</a>, <a href="#F.10.4">F.10.4</a> arithmetic constant expression, <a href="#6.6">6.6</a>
30787 abstract declarator, <a href="#6.7.7">6.7.7</a> arithmetic conversions, usual, see usual arithmetic
30788 abstract machine, <a href="#5.1.2.3">5.1.2.3</a> conversions
30789 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a>, <a href="#L.2.1">L.2.1</a> arithmetic operators
30790 accuracy, see floating-point accuracy additive, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a>
30791 acos functions, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#F.10.1.1">F.10.1.1</a> bitwise, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</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>
30792 acos type-generic macro, <a href="#7.24">7.24</a> 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>
30793 acosh functions, <a href="#7.12.5.1">7.12.5.1</a>, <a href="#F.10.2.1">F.10.2.1</a> multiplicative, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
30794 acosh type-generic macro, <a href="#7.24">7.24</a> shift, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
30795 acquire fence, <a href="#7.17.4">7.17.4</a> unary, <a href="#6.5.3.3">6.5.3.3</a>
30796 acquire operation, <a href="#5.1.2.4">5.1.2.4</a> arithmetic types, <a href="#6.2.5">6.2.5</a>
30797 active position, <a href="#5.2.2">5.2.2</a> arithmetic, pointer, <a href="#6.5.6">6.5.6</a>
30798 actual argument, <a href="#3.3">3.3</a> array
30799 actual parameter (deprecated), <a href="#3.3">3.3</a> argument, <a href="#6.9.1">6.9.1</a>
30800 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> declarator, <a href="#6.7.6.2">6.7.6.2</a>
30801 addition operator (+), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, initialization, <a href="#6.7.9">6.7.9</a>
30802 <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> multidimensional, <a href="#6.5.2.1">6.5.2.1</a>
30803 additive expressions, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> parameter, <a href="#6.9.1">6.9.1</a>
30804 address constant, <a href="#6.6">6.6</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
30805 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> subscript operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>
30806 address-free, <a href="#7.17.5">7.17.5</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
30807 aggregate initialization, <a href="#6.7.9">6.7.9</a> type, <a href="#6.2.5">6.2.5</a>
30808 aggregate types, <a href="#6.2.5">6.2.5</a> type conversion, <a href="#6.3.2.1">6.3.2.1</a>
30809 alert escape sequence (\a), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> variable length, <a href="#6.7.6">6.7.6</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a>
30810 aliasing, <a href="#6.5">6.5</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
30811 alignas macro, <a href="#7.15">7.15</a> as-if rule, <a href="#5.1.2.3">5.1.2.3</a>
30812 aligned_alloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.1">7.22.3.1</a> ASCII code set, <a href="#5.2.1.1">5.2.1.1</a>
30813 alignment, <a href="#3.2">3.2</a>, <a href="#6.2.8">6.2.8</a>, <a href="#7.22.3.1">7.22.3.1</a> asctime function, <a href="#7.26.3.1">7.26.3.1</a>
30814 pointer, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.3">6.3.2.3</a> asctime_s function, <a href="#K.3.8.2">K.3.8.2</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>
30815 structure/union member, <a href="#6.7.2.1">6.7.2.1</a> asin functions, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#F.10.1.2">F.10.1.2</a>
30816 alignment specifier, <a href="#6.7.5">6.7.5</a> asin type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
30817 alignof operator, <a href="#6.5.3">6.5.3</a>, <a href="#6.5.3.4">6.5.3.4</a> asinh functions, <a href="#7.12.5.2">7.12.5.2</a>, <a href="#F.10.2.2">F.10.2.2</a>
30818 <!--page 674 -->
30819 asinh type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> atomic_is_lock_free generic function,
30820 asm keyword, <a href="#J.5.10">J.5.10</a> <a href="#7.17.5.1">7.17.5.1</a>
30821 assert macro, <a href="#7.2.1.1">7.2.1.1</a> ATOMIC_LLONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
30822 assert.h header, <a href="#7.2">7.2</a> atomic_load generic functions, <a href="#7.17.7.2">7.17.7.2</a>
30823 assignment ATOMIC_LONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
30824 compound, <a href="#6.5.16.2">6.5.16.2</a> ATOMIC_SHORT_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
30825 conversion, <a href="#6.5.16.1">6.5.16.1</a> atomic_signal_fence function, <a href="#7.17.4.2">7.17.4.2</a>
30826 expression, <a href="#6.5.16">6.5.16</a> atomic_store generic functions, <a href="#7.17.7.1">7.17.7.1</a>
30827 operators, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a> atomic_thread_fence function, <a href="#7.17.4.1">7.17.4.1</a>
30828 simple, <a href="#6.5.16.1">6.5.16.1</a> ATOMIC_VAR_INIT macro, <a href="#7.17.2.1">7.17.2.1</a>
30829 associativity of operators, <a href="#6.5">6.5</a> ATOMIC_WCHAR_T_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
30830 asterisk punctuator (*), <a href="#6.7.6.1">6.7.6.1</a>, <a href="#6.7.6.2">6.7.6.2</a> atomics header, <a href="#7.17">7.17</a>
30831 at_quick_exit function, <a href="#7.22.4.2">7.22.4.2</a>, <a href="#7.22.4.3">7.22.4.3</a>, auto storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
30832 <a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a> automatic storage duration, <a href="#5.2.3">5.2.3</a>, <a href="#6.2.4">6.2.4</a>
30833 atan functions, <a href="#7.12.4.3">7.12.4.3</a>, <a href="#F.10.1.3">F.10.1.3</a>
30834 atan type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</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>
30835 atan2 functions, <a href="#7.12.4.4">7.12.4.4</a>, <a href="#F.10.1.4">F.10.1.4</a> backslash escape sequence (\\), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a>
30836 atan2 type-generic macro, <a href="#7.24">7.24</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>
30837 atanh functions, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#F.10.2.3">F.10.2.3</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>
30838 atanh type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> basic types, <a href="#6.2.5">6.2.5</a>
30839 atexit function, <a href="#7.22.4.2">7.22.4.2</a>, <a href="#7.22.4.3">7.22.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a>, behavior, <a href="#3.4">3.4</a>
30840 <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>, <a href="#J.5.13">J.5.13</a> binary streams, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>,
30841 atof function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.1">7.22.1.1</a> <a href="#7.21.9.4">7.21.9.4</a>
30842 atoi function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a> bit, <a href="#3.5">3.5</a>
30843 atol function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a> high order, <a href="#3.6">3.6</a>
30844 atoll function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a> low order, <a href="#3.6">3.6</a>
30845 atomic lock-free macros, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.5">7.17.5</a> bit-field, <a href="#6.7.2.1">6.7.2.1</a>
30846 atomic operations, <a href="#5.1.2.4">5.1.2.4</a> bitand macro, <a href="#7.9">7.9</a>
30847 atomic types, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.2.5">6.2.5</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, bitor macro, <a href="#7.9">7.9</a>
30848 <a href="#6.5.2.3">6.5.2.3</a>, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.16.2">6.5.16.2</a>, <a href="#6.7.2.4">6.7.2.4</a>, <a href="#6.10.8.3">6.10.8.3</a>, bitwise operators, <a href="#6.5">6.5</a>
30849 <a href="#7.17.6">7.17.6</a> AND, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a>
30850 atomic_address type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.6">7.17.6</a> AND assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a>
30851 ATOMIC_ADDRESS_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a> complement (~), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a>
30852 atomic_bool type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.6">7.17.6</a> exclusive OR, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
30853 ATOMIC_CHAR16_T_LOCK_FREE macro, exclusive OR assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
30854 <a href="#7.17.1">7.17.1</a> inclusive OR, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>
30855 ATOMIC_CHAR32_T_LOCK_FREE macro, inclusive OR assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
30856 <a href="#7.17.1">7.17.1</a> shift, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
30857 ATOMIC_CHAR_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a> blank character, <a href="#7.4.1.3">7.4.1.3</a>
30858 atomic_compare_exchange generic 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>
30859 functions, <a href="#7.17.7.4">7.17.7.4</a> block scope, <a href="#6.2.1">6.2.1</a>
30860 atomic_exchange generic functions, <a href="#7.17.7.3">7.17.7.3</a> block structure, <a href="#6.2.1">6.2.1</a>
30861 atomic_fetch and modify generic functions, bold type convention, <a href="#6.1">6.1</a>
30862 <a href="#7.17.7.5">7.17.7.5</a> bool macro, <a href="#7.18">7.18</a>
30863 atomic_flag type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.8">7.17.8</a> boolean type, <a href="#6.3.1.2">6.3.1.2</a>
30864 atomic_flag_clear functions, <a href="#7.17.8.2">7.17.8.2</a> 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>
30865 ATOMIC_FLAG_INIT macro, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.8">7.17.8</a> bounded undefined behavior, <a href="#L.2.2">L.2.2</a>
30866 atomic_flag_test_and_set functions, 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.9">6.7.9</a>,
30867 <a href="#7.17.8.1">7.17.8.1</a> <a href="#6.8.2">6.8.2</a>
30868 atomic_init generic function, <a href="#7.17.2.2">7.17.2.2</a> brackets operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>
30869 ATOMIC_INT_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a> brackets punctuator ([ ]), <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a>
30870 <!--page 675 -->
30871 branch cuts, <a href="#7.3.3">7.3.3</a> type-generic macro for, <a href="#7.24">7.24</a>
30872 break statement, <a href="#6.8.6.3">6.8.6.3</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>
30873 broken-down time, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.3">7.26.2.3</a>, <a href="#7.26.3">7.26.3</a>, type-generic macro for, <a href="#7.24">7.24</a>
30874 <a href="#7.26.3.1">7.26.3.1</a>, <a href="#7.26.3.3">7.26.3.3</a>, <a href="#7.26.3.4">7.26.3.4</a>, <a href="#7.26.3.5">7.26.3.5</a>, ceil functions, <a href="#7.12.9.1">7.12.9.1</a>, <a href="#F.10.6.1">F.10.6.1</a>
30875 <a href="#K.3.8.2.1">K.3.8.2.1</a>, <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a> ceil type-generic macro, <a href="#7.24">7.24</a>
30876 bsearch function, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.1">7.22.5.1</a> cerf function, <a href="#7.30.1">7.30.1</a>
30877 bsearch_s function, <a href="#K.3.6.3">K.3.6.3</a>, <a href="#K.3.6.3.1">K.3.6.3.1</a> cerfc function, <a href="#7.30.1">7.30.1</a>
30878 btowc function, <a href="#7.28.6.1.1">7.28.6.1.1</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>
30879 BUFSIZ macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.5">7.21.5.5</a> type-generic macro for, <a href="#7.24">7.24</a>
30880 byte, <a href="#3.6">3.6</a>, <a href="#6.5.3.4">6.5.3.4</a> cexp2 function, <a href="#7.30.1">7.30.1</a>
30881 byte input/output functions, <a href="#7.21.1">7.21.1</a> cexpm1 function, <a href="#7.30.1">7.30.1</a>
30882 byte-oriented stream, <a href="#7.21.2">7.21.2</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>, <a href="#K.3.5.3.2">K.3.5.3.2</a>,
30883 <a href="#K.3.9.1.2">K.3.9.1.2</a>
30884 <a href="#C">C</a> program, <a href="#5.1.1.1">5.1.1.1</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>,
30885 c16rtomb function, <a href="#7.27.1.2">7.27.1.2</a> <a href="#6.3.1.8">6.3.1.8</a>
30886 c32rtomb function, <a href="#7.27.1.4">7.27.1.4</a> char16_t type, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.27">7.27</a>
30887 cabs functions, <a href="#7.3.8.1">7.3.8.1</a>, <a href="#G.6">G.6</a> char32_t type, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.27">7.27</a>
30888 type-generic macro for, <a href="#7.24">7.24</a> CHAR_BIT macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.7.2.1">6.7.2.1</a>
30889 cacos functions, <a href="#7.3.5.1">7.3.5.1</a>, <a href="#G.6.1.1">G.6.1.1</a> 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>
30890 type-generic macro for, <a href="#7.24">7.24</a> CHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
30891 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, <a href="#3.7">3.7</a>, <a href="#3.7.1">3.7.1</a>
30892 type-generic macro for, <a href="#7.24">7.24</a> character array initialization, <a href="#6.7.9">6.7.9</a>
30893 calendar time, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.2">7.26.2.2</a>, <a href="#7.26.2.3">7.26.2.3</a>, <a href="#7.26.2.4">7.26.2.4</a>, character case mapping functions, <a href="#7.4.2">7.4.2</a>
30894 <a href="#7.26.3.2">7.26.3.2</a>, <a href="#7.26.3.3">7.26.3.3</a>, <a href="#7.26.3.4">7.26.3.4</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>, wide character, <a href="#7.29.3.1">7.29.3.1</a>
30895 <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a> extensible, <a href="#7.29.3.2">7.29.3.2</a>
30896 call by value, <a href="#6.5.2.2">6.5.2.2</a> character classification functions, <a href="#7.4.1">7.4.1</a>
30897 call_once function, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.2.1">7.25.2.1</a> wide character, <a href="#7.29.2.1">7.29.2.1</a>
30898 calloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.2">7.22.3.2</a> extensible, <a href="#7.29.2.2">7.29.2.2</a>
30899 carg functions, <a href="#7.3.9.1">7.3.9.1</a>, <a href="#G.6">G.6</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>
30900 carg type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> character display semantics, <a href="#5.2.2">5.2.2</a>
30901 carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>, character handling header, <a href="#7.4">7.4</a>, <a href="#7.11.1.1">7.11.1.1</a>
30902 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a> character input/output functions, <a href="#7.21.7">7.21.7</a>, <a href="#K.3.5.4">K.3.5.4</a>
30903 carries a dependency, <a href="#5.1.2.4">5.1.2.4</a> wide character, <a href="#7.28.3">7.28.3</a>
30904 case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> character sets, <a href="#5.2.1">5.2.1</a>
30905 case mapping functions character string literal, see string literal
30906 character, <a href="#7.4.2">7.4.2</a> character type conversion, <a href="#6.3.1.1">6.3.1.1</a>
30907 wide character, <a href="#7.29.3.1">7.29.3.1</a> character types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.9">6.7.9</a>
30908 extensible, <a href="#7.29.3.2">7.29.3.2</a> cimag functions, <a href="#7.3.9.2">7.3.9.2</a>, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a>
30909 casin functions, <a href="#7.3.5.2">7.3.5.2</a>, <a href="#G.6">G.6</a> cimag type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
30910 type-generic macro for, <a href="#7.24">7.24</a> cis function, <a href="#G.6">G.6</a>
30911 casinh functions, <a href="#7.3.6.2">7.3.6.2</a>, <a href="#G.6.2.2">G.6.2.2</a> classification functions
30912 type-generic macro for, <a href="#7.24">7.24</a> character, <a href="#7.4.1">7.4.1</a>
30913 cast expression, <a href="#6.5.4">6.5.4</a> floating-point, <a href="#7.12.3">7.12.3</a>
30914 cast operator (( )), <a href="#6.5.4">6.5.4</a> wide character, <a href="#7.29.2.1">7.29.2.1</a>
30915 catan functions, <a href="#7.3.5.3">7.3.5.3</a>, <a href="#G.6">G.6</a> extensible, <a href="#7.29.2.2">7.29.2.2</a>
30916 type-generic macro for, <a href="#7.24">7.24</a> clearerr function, <a href="#7.21.10.1">7.21.10.1</a>
30917 catanh functions, <a href="#7.3.6.3">7.3.6.3</a>, <a href="#G.6.2.3">G.6.2.3</a> clgamma function, <a href="#7.30.1">7.30.1</a>
30918 type-generic macro for, <a href="#7.24">7.24</a> clock function, <a href="#7.26.2.1">7.26.2.1</a>
30919 cbrt functions, <a href="#7.12.7.1">7.12.7.1</a>, <a href="#F.10.4.1">F.10.4.1</a> clock_t type, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.1">7.26.2.1</a>
30920 cbrt type-generic macro, <a href="#7.24">7.24</a> CLOCKS_PER_SEC macro, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.1">7.26.2.1</a>
30921 ccos functions, <a href="#7.3.5.4">7.3.5.4</a>, <a href="#G.6">G.6</a> clog functions, <a href="#7.3.7.2">7.3.7.2</a>, <a href="#G.6.3.2">G.6.3.2</a>
30922 <!--page 676 -->
30923 type-generic macro for, <a href="#7.24">7.24</a> string, <a href="#7.23.3">7.23.3</a>, <a href="#K.3.7.2">K.3.7.2</a>
30924 clog10 function, <a href="#7.30.1">7.30.1</a> wide string, <a href="#7.28.4.3">7.28.4.3</a>, <a href="#K.3.9.2.2">K.3.9.2.2</a>
30925 clog1p function, <a href="#7.30.1">7.30.1</a> concatenation, preprocessing, see preprocessing
30926 clog2 function, <a href="#7.30.1">7.30.1</a> concatenation
30927 CMPLX macros, <a href="#7.3.9.3">7.3.9.3</a> conceptual models, <a href="#5.1">5.1</a>
30928 cnd_broadcast function, <a href="#7.25.3.1">7.25.3.1</a>, <a href="#7.25.3.5">7.25.3.5</a>, conditional features, <a href="#4">4</a>, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a>,
30929 <a href="#7.25.3.6">7.25.3.6</a> <a href="#7.1.2">7.1.2</a>, <a href="#F.1">F.1</a>, <a href="#G.1">G.1</a>, <a href="#K.2">K.2</a>, <a href="#L.1">L.1</a>
30930 cnd_destroy function, <a href="#7.25.3.2">7.25.3.2</a> conditional inclusion, <a href="#6.10.1">6.10.1</a>
30931 cnd_init function, <a href="#7.25.3.3">7.25.3.3</a> conditional operator (? :), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.15">6.5.15</a>
30932 cnd_signal function, <a href="#7.25.3.4">7.25.3.4</a>, <a href="#7.25.3.5">7.25.3.5</a>, conflict, <a href="#5.1.2.4">5.1.2.4</a>
30933 <a href="#7.25.3.6">7.25.3.6</a> conformance, <a href="#4">4</a>
30934 cnd_t type, <a href="#7.25.1">7.25.1</a> conj functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a>
30935 cnd_timedwait function, <a href="#7.25.3.5">7.25.3.5</a> conj type-generic macro, <a href="#7.24">7.24</a>
30936 cnd_wait function, <a href="#7.25.3.3">7.25.3.3</a>, <a href="#7.25.3.6">7.25.3.6</a> const type qualifier, <a href="#6.7.3">6.7.3</a>
30937 collating sequences, <a href="#5.2.1">5.2.1</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>
30938 colon punctuator (:), <a href="#6.7.2.1">6.7.2.1</a> constant expression, <a href="#6.6">6.6</a>, <a href="#F.8.4">F.8.4</a>
30939 comma operator (,), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.17">6.5.17</a> constants, <a href="#6.4.4">6.4.4</a>
30940 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>, as primary expression, <a href="#6.5.1">6.5.1</a>
30941 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a> character, <a href="#6.4.4.4">6.4.4.4</a>
30942 command processor, <a href="#7.22.4.8">7.22.4.8</a> enumeration, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
30943 comment delimiters (/* */ and //), <a href="#6.4.9">6.4.9</a> floating, <a href="#6.4.4.2">6.4.4.2</a>
30944 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> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
30945 common extensions, <a href="#J.5">J.5</a> integer, <a href="#6.4.4.1">6.4.4.1</a>
30946 common initial sequence, <a href="#6.5.2.3">6.5.2.3</a> octal, <a href="#6.4.4.1">6.4.4.1</a>
30947 common real type, <a href="#6.3.1.8">6.3.1.8</a> constraint, <a href="#3.8">3.8</a>, <a href="#4">4</a>
30948 common warnings, <a href="#I">I</a> constraint_handler_t type, <a href="#K.3.6">K.3.6</a>
30949 comparison functions, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.1">7.22.5.1</a>, <a href="#7.22.5.2">7.22.5.2</a>, consume operation, <a href="#5.1.2.4">5.1.2.4</a>
30950 <a href="#K.3.6.3">K.3.6.3</a>, <a href="#K.3.6.3.1">K.3.6.3.1</a>, <a href="#K.3.6.3.2">K.3.6.3.2</a> content of structure/union/enumeration, <a href="#6.7.2.3">6.7.2.3</a>
30951 string, <a href="#7.23.4">7.23.4</a> contiguity of allocated storage, <a href="#7.22.3">7.22.3</a>
30952 wide string, <a href="#7.28.4.4">7.28.4.4</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
30953 comparison macros, <a href="#7.12.14">7.12.14</a> contracted expression, <a href="#6.5">6.5</a>, <a href="#7.12.2">7.12.2</a>, <a href="#F.7">F.7</a>
30954 comparison, pointer, <a href="#6.5.8">6.5.8</a> control character, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>
30955 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.6">6.7.6</a> control wide character, <a href="#7.29.2">7.29.2</a>
30956 compl macro, <a href="#7.9">7.9</a> conversion, <a href="#6.3">6.3</a>
30957 complement operator (~), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
30958 complete type, <a href="#6.2.5">6.2.5</a> array argument, <a href="#6.9.1">6.9.1</a>
30959 complex macro, <a href="#7.3.1">7.3.1</a> array parameter, <a href="#6.9.1">6.9.1</a>
30960 complex numbers, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a> arrays, <a href="#6.3.2.1">6.3.2.1</a>
30961 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> boolean, <a href="#6.3.1.2">6.3.1.2</a>
30962 complex type domain, <a href="#6.2.5">6.2.5</a> boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>
30963 complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#G">G</a> by assignment, <a href="#6.5.16.1">6.5.16.1</a>
30964 complex.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, by return statement, <a href="#6.8.6.4">6.8.6.4</a>
30965 <a href="#7.3">7.3</a>, <a href="#7.24">7.24</a>, <a href="#7.30.1">7.30.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a> complex types, <a href="#6.3.1.6">6.3.1.6</a>
30966 compliance, see conformance explicit, <a href="#6.3">6.3</a>
30967 components of time, <a href="#7.26.1">7.26.1</a>, <a href="#K.3.8.1">K.3.8.1</a> function, <a href="#6.3.2.1">6.3.2.1</a>
30968 composite type, <a href="#6.2.7">6.2.7</a> function argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
30969 compound assignment, <a href="#6.5.16.2">6.5.16.2</a> function designators, <a href="#6.3.2.1">6.3.2.1</a>
30970 compound literals, <a href="#6.5.2.5">6.5.2.5</a> function parameter, <a href="#6.9.1">6.9.1</a>
30971 compound statement, <a href="#6.8.2">6.8.2</a> imaginary, <a href="#G.4.1">G.4.1</a>
30972 compound-literal operator (( ){ }), <a href="#6.5.2.5">6.5.2.5</a> imaginary and complex, <a href="#G.4.3">G.4.3</a>
30973 concatenation functions implicit, <a href="#6.3">6.3</a>
30974 <!--page 677 -->
30975 lvalues, <a href="#6.3.2.1">6.3.2.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>
30976 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.24">7.24</a>
30977 real and complex, <a href="#6.3.1.7">6.3.1.7</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>
30978 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.24">7.24</a>
30979 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> ctan functions, <a href="#7.3.5.6">7.3.5.6</a>, <a href="#G.6">G.6</a>
30980 real floating types, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#F.3">F.3</a> type-generic macro for, <a href="#7.24">7.24</a>
30981 signed and unsigned integers, <a href="#6.3.1.3">6.3.1.3</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>
30982 usual arithmetic, see usual arithmetic type-generic macro for, <a href="#7.24">7.24</a>
30983 conversions ctgamma function, <a href="#7.30.1">7.30.1</a>
30984 void type, <a href="#6.3.2.2">6.3.2.2</a> ctime function, <a href="#7.26.3.2">7.26.3.2</a>
30985 conversion functions ctime_s function, <a href="#K.3.8.2">K.3.8.2</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>
30986 multibyte/wide character, <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a> ctype.h header, <a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a>
30987 extended, <a href="#7.28.6">7.28.6</a>, <a href="#K.3.9.3">K.3.9.3</a> current object, <a href="#6.7.9">6.7.9</a>
30988 restartable, <a href="#7.27.1">7.27.1</a>, <a href="#7.28.6.3">7.28.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a> CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
30989 multibyte/wide string, <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>
30990 restartable, <a href="#7.28.6.4">7.28.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> data race, <a href="#5.1.2.4">5.1.2.4</a>, <a href="#7.1.4">7.1.4</a>, <a href="#7.22.2.1">7.22.2.1</a>, <a href="#7.22.4.6">7.22.4.6</a>,
30991 numeric, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a> <a href="#7.23.5.8">7.23.5.8</a>, <a href="#7.23.6.2">7.23.6.2</a>, <a href="#7.26.3">7.26.3</a>, <a href="#7.27.1">7.27.1</a>, <a href="#7.28.6.3">7.28.6.3</a>,
30992 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.28.4.1">7.28.4.1</a> <a href="#7.28.6.4">7.28.6.4</a>
30993 single byte/wide character, <a href="#7.28.6.1">7.28.6.1</a> data stream, see streams
30994 time, <a href="#7.26.3">7.26.3</a>, <a href="#K.3.8.2">K.3.8.2</a> date and time header, <a href="#7.26">7.26</a>, <a href="#K.3.8">K.3.8</a>
30995 wide character, <a href="#7.28.5">7.28.5</a> Daylight Saving Time, <a href="#7.26.1">7.26.1</a>
30996 conversion specifier, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, DBL_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
30997 <a href="#7.28.2.2">7.28.2.2</a> DBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
30998 conversion state, <a href="#7.22.7">7.22.7</a>, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.1.1">7.27.1.1</a>, DBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
30999 <a href="#7.27.1.2">7.27.1.2</a>, <a href="#7.27.1.3">7.27.1.3</a>, <a href="#7.27.1.4">7.27.1.4</a>, <a href="#7.28.6">7.28.6</a>, DBL_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31000 <a href="#7.28.6.2.1">7.28.6.2.1</a>, <a href="#7.28.6.3">7.28.6.3</a>, <a href="#7.28.6.3.2">7.28.6.3.2</a>, <a href="#7.28.6.3.3">7.28.6.3.3</a>, DBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31001 <a href="#7.28.6.4">7.28.6.4</a>, <a href="#7.28.6.4.1">7.28.6.4.1</a>, <a href="#7.28.6.4.2">7.28.6.4.2</a>, <a href="#K.3.6.4">K.3.6.4</a>, DBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31002 <a href="#K.3.9.3.1">K.3.9.3.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>, DBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31003 <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a> DBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31004 conversion state functions, <a href="#7.28.6.2">7.28.6.2</a> DBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31005 copying functions DBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31006 string, <a href="#7.23.2">7.23.2</a>, <a href="#K.3.7.1">K.3.7.1</a> DBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31007 wide string, <a href="#7.28.4.2">7.28.4.2</a>, <a href="#K.3.9.2.1">K.3.9.2.1</a> DBL_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31008 copysign functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#7.12.11.1">7.12.11.1</a>, <a href="#F.3">F.3</a>, decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
31009 <a href="#F.10.8.1">F.10.8.1</a> decimal digit, <a href="#5.2.1">5.2.1</a>
31010 copysign type-generic macro, <a href="#7.24">7.24</a> decimal-point character, <a href="#7.1.1">7.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
31011 correctly rounded result, <a href="#3.9">3.9</a> DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.6.1">7.21.6.1</a>,
31012 corresponding real type, <a href="#6.2.5">6.2.5</a> <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#F.5">F.5</a>
31013 cos functions, <a href="#7.12.4.5">7.12.4.5</a>, <a href="#F.10.1.5">F.10.1.5</a> declaration specifiers, <a href="#6.7">6.7</a>
31014 cos type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> declarations, <a href="#6.7">6.7</a>
31015 cosh functions, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#F.10.2.4">F.10.2.4</a> function, <a href="#6.7.6.3">6.7.6.3</a>
31016 cosh type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> pointer, <a href="#6.7.6.1">6.7.6.1</a>
31017 cpow functions, <a href="#7.3.8.2">7.3.8.2</a>, <a href="#G.6.4.1">G.6.4.1</a> structure/union, <a href="#6.7.2.1">6.7.2.1</a>
31018 type-generic macro for, <a href="#7.24">7.24</a> typedef, <a href="#6.7.8">6.7.8</a>
31019 cproj functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a> declarator, <a href="#6.7.6">6.7.6</a>
31020 cproj type-generic macro, <a href="#7.24">7.24</a> abstract, <a href="#6.7.7">6.7.7</a>
31021 creal functions, <a href="#7.3.9.6">7.3.9.6</a>, <a href="#G.6">G.6</a> declarator type derivation, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.6">6.7.6</a>
31022 creal type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> decrement operators, see arithmetic operators,
31023 critical undefined behavior, <a href="#L.2.3">L.2.3</a> increment and decrement
31024 csin functions, <a href="#7.3.5.5">7.3.5.5</a>, <a href="#G.6">G.6</a> default argument promotions, <a href="#6.5.2.2">6.5.2.2</a>
31025 type-generic macro for, <a href="#7.24">7.24</a> default initialization, <a href="#6.7.9">6.7.9</a>
31026 <!--page 678 -->
31027 default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> elif preprocessing directive, <a href="#6.10.1">6.10.1</a>
31028 define preprocessing directive, <a href="#6.10.3">6.10.3</a> ellipsis punctuator (...), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a>
31029 defined operator, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.8">6.10.8</a> else preprocessing directive, <a href="#6.10.1">6.10.1</a>
31030 definition, <a href="#6.7">6.7</a> else statement, <a href="#6.8.4.1">6.8.4.1</a>
31031 function, <a href="#6.9.1">6.9.1</a> empty statement, <a href="#6.8.3">6.8.3</a>
31032 dependency-ordered before, <a href="#5.1.2.4">5.1.2.4</a> encoding error, <a href="#7.21.3">7.21.3</a>, <a href="#7.27.1.1">7.27.1.1</a>, <a href="#7.27.1.2">7.27.1.2</a>,
31033 derived declarator types, <a href="#6.2.5">6.2.5</a> <a href="#7.27.1.3">7.27.1.3</a>, <a href="#7.27.1.4">7.27.1.4</a>, <a href="#7.28.3.1">7.28.3.1</a>, <a href="#7.28.3.3">7.28.3.3</a>,
31034 derived types, <a href="#6.2.5">6.2.5</a> <a href="#7.28.6.3.2">7.28.6.3.2</a>, <a href="#7.28.6.3.3">7.28.6.3.3</a>, <a href="#7.28.6.4.1">7.28.6.4.1</a>, <a href="#7.28.6.4.2">7.28.6.4.2</a>,
31035 designated initializer, <a href="#6.7.9">6.7.9</a> <a href="#K.3.6.5.1">K.3.6.5.1</a>, <a href="#K.3.6.5.2">K.3.6.5.2</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>,
31036 destringizing, <a href="#6.10.9">6.10.9</a> <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>
31037 device input/output, <a href="#5.1.2.3">5.1.2.3</a> end-of-file, <a href="#7.28.1">7.28.1</a>
31038 diagnostic message, <a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a> end-of-file indicator, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.1">7.21.7.1</a>,
31039 diagnostics, <a href="#5.1.1.3">5.1.1.3</a> <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>,
31040 diagnostics header, <a href="#7.2">7.2</a> <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.10.1">7.21.10.1</a>, <a href="#7.21.10.2">7.21.10.2</a>, <a href="#7.28.3.1">7.28.3.1</a>,
31041 difftime function, <a href="#7.26.2.2">7.26.2.2</a> <a href="#7.28.3.10">7.28.3.10</a>
31042 digit, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> end-of-file macro, see EOF macro
31043 digraphs, <a href="#6.4.6">6.4.6</a> end-of-line indicator, <a href="#5.2.1">5.2.1</a>
31044 direct input/output functions, <a href="#7.21.8">7.21.8</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
31045 display device, <a href="#5.2.2">5.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>
31046 div function, <a href="#7.22.6.2">7.22.6.2</a> enumerated type, <a href="#6.2.5">6.2.5</a>
31047 div_t type, <a href="#7.22">7.22</a> enumeration, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.2">6.7.2.2</a>
31048 division assignment operator (/=), <a href="#6.5.16.2">6.5.16.2</a> enumeration constant, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
31049 division operator (/), <a href="#6.2.6.2">6.2.6.2</a>, <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> enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
31050 do statement, <a href="#6.8.5.2">6.8.5.2</a> enumeration members, <a href="#6.7.2.2">6.7.2.2</a>
31051 documentation of implementation, <a href="#4">4</a> enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
31052 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>, enumeration tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
31053 <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>, enumerator, <a href="#6.7.2.2">6.7.2.2</a>
31054 <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>, environment, <a href="#5">5</a>
31055 <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>, environment functions, <a href="#7.22.4">7.22.4</a>, <a href="#K.3.6.2">K.3.6.2</a>
31056 <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> environment list, <a href="#7.22.4.6">7.22.4.6</a>, <a href="#K.3.6.2.1">K.3.6.2.1</a>
31057 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> environmental considerations, <a href="#5.2">5.2</a>
31058 double _Complex type, <a href="#6.2.5">6.2.5</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.21.2">7.21.2</a>,
31059 double _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.4.4">7.21.4.4</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.22.2.1">7.22.2.1</a>, <a href="#7.22.4.2">7.22.4.2</a>,
31060 <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.22.4.3">7.22.4.3</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>
31061 double _Imaginary type, <a href="#G.2">G.2</a> EOF macro, <a href="#7.4">7.4</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.1">7.21.5.1</a>, <a href="#7.21.5.2">7.21.5.2</a>,
31062 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.21.6.2">7.21.6.2</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.11">7.21.6.11</a>,
31063 <a href="#7.28.2.2">7.28.2.2</a>, <a href="#F.2">F.2</a> <a href="#7.21.6.14">7.21.6.14</a>, <a href="#7.21.7.1">7.21.7.1</a>, <a href="#7.21.7.3">7.21.7.3</a>, <a href="#7.21.7.4">7.21.7.4</a>,
31064 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>, <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.21.7.8">7.21.7.8</a>, <a href="#7.21.7.9">7.21.7.9</a>,
31065 <a href="#6.3.1.8">6.3.1.8</a> <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#7.28.2.4">7.28.2.4</a>,
31066 double-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.8">7.28.2.8</a>, <a href="#7.28.2.10">7.28.2.10</a>, <a href="#7.28.2.12">7.28.2.12</a>,
31067 double-quote escape sequence (\"), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.28.3.4">7.28.3.4</a>, <a href="#7.28.6.1.1">7.28.6.1.1</a>, <a href="#7.28.6.1.2">7.28.6.1.2</a>, <a href="#K.3.5.3.7">K.3.5.3.7</a>,
31068 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>,
31069 double_t type, <a href="#7.12">7.12</a>, <a href="#J.5.6">J.5.6</a> <a href="#K.3.9.1.5">K.3.9.1.5</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>,
31070 <a href="#K.3.9.1.14">K.3.9.1.14</a>
31071 EDOM macro, <a href="#7.5">7.5</a>, <a href="#7.12.1">7.12.1</a>, see also domain error 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.9">6.7.9</a>
31072 effective type, <a href="#6.5">6.5</a> equal-to operator, see equality operator
31073 EILSEQ macro, <a href="#7.5">7.5</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.27.1.1">7.27.1.1</a>, <a href="#7.27.1.2">7.27.1.2</a>, equality expressions, <a href="#6.5.9">6.5.9</a>
31074 <a href="#7.27.1.3">7.27.1.3</a>, <a href="#7.27.1.4">7.27.1.4</a>, <a href="#7.28.3.1">7.28.3.1</a>, <a href="#7.28.3.3">7.28.3.3</a>, equality operator (==), <a href="#6.5.9">6.5.9</a>
31075 <a href="#7.28.6.3.2">7.28.6.3.2</a>, <a href="#7.28.6.3.3">7.28.6.3.3</a>, <a href="#7.28.6.4.1">7.28.6.4.1</a>, <a href="#7.28.6.4.2">7.28.6.4.2</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>,
31076 see also encoding error <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>, see
31077 element type, <a href="#6.2.5">6.2.5</a> also range error, pole error
31078 <!--page 679 -->
31079 erf functions, <a href="#7.12.8.1">7.12.8.1</a>, <a href="#F.10.5.1">F.10.5.1</a> exp2 functions, <a href="#7.12.6.2">7.12.6.2</a>, <a href="#F.10.3.2">F.10.3.2</a>
31080 erf type-generic macro, <a href="#7.24">7.24</a> exp2 type-generic macro, <a href="#7.24">7.24</a>
31081 erfc functions, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#F.10.5.2">F.10.5.2</a> explicit conversion, <a href="#6.3">6.3</a>
31082 erfc type-generic macro, <a href="#7.24">7.24</a> expm1 functions, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#F.10.3.3">F.10.3.3</a>
31083 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>, expm1 type-generic macro, <a href="#7.24">7.24</a>
31084 <a href="#7.12.1">7.12.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.10.4">7.21.10.4</a>, exponent part, <a href="#6.4.4.2">6.4.4.2</a>
31085 <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.23.6.2">7.23.6.2</a>, <a href="#7.27.1.1">7.27.1.1</a>, exponential functions
31086 <a href="#7.27.1.2">7.27.1.2</a>, <a href="#7.27.1.3">7.27.1.3</a>, <a href="#7.27.1.4">7.27.1.4</a>, <a href="#7.28.3.1">7.28.3.1</a>, complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
31087 <a href="#7.28.3.3">7.28.3.3</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>, <a href="#7.28.6.3.2">7.28.6.3.2</a>, real, <a href="#7.12.6">7.12.6</a>, <a href="#F.10.3">F.10.3</a>
31088 <a href="#7.28.6.3.3">7.28.6.3.3</a>, <a href="#7.28.6.4.1">7.28.6.4.1</a>, <a href="#7.28.6.4.2">7.28.6.4.2</a>, <a href="#J.5.17">J.5.17</a>, expression, <a href="#6.5">6.5</a>
31089 <a href="#K.3.1.3">K.3.1.3</a>, <a href="#K.3.7.4.2">K.3.7.4.2</a> assignment, <a href="#6.5.16">6.5.16</a>
31090 errno.h header, <a href="#7.5">7.5</a>, <a href="#7.30.3">7.30.3</a>, <a href="#K.3.2">K.3.2</a> cast, <a href="#6.5.4">6.5.4</a>
31091 errno_t type, <a href="#K.3.2">K.3.2</a>, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.6">K.3.6</a>, <a href="#K.3.6.1.1">K.3.6.1.1</a>, constant, <a href="#6.6">6.6</a>
31092 <a href="#K.3.7">K.3.7</a>, <a href="#K.3.8">K.3.8</a>, <a href="#K.3.9">K.3.9</a> evaluation, <a href="#5.1.2.3">5.1.2.3</a>
31093 error full, <a href="#6.8">6.8</a>
31094 domain, see domain error order of evaluation, see order of evaluation
31095 encoding, see encoding error parenthesized, <a href="#6.5.1">6.5.1</a>
31096 pole, see pole error primary, <a href="#6.5.1">6.5.1</a>
31097 range, see range error unary, <a href="#6.5.3">6.5.3</a>
31098 error conditions, <a href="#7.12.1">7.12.1</a> expression statement, <a href="#6.8.3">6.8.3</a>
31099 error functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.10.5">F.10.5</a> extended alignment, <a href="#6.2.8">6.2.8</a>
31100 error indicator, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.1">7.21.7.1</a>, 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>
31101 <a href="#7.21.7.3">7.21.7.3</a>, <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.21.7.7">7.21.7.7</a>, extended characters, <a href="#5.2.1">5.2.1</a>
31102 <a href="#7.21.7.8">7.21.7.8</a>, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.10.1">7.21.10.1</a>, <a href="#7.21.10.3">7.21.10.3</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>,
31103 <a href="#7.28.3.1">7.28.3.1</a>, <a href="#7.28.3.3">7.28.3.3</a> <a href="#7.20">7.20</a>
31104 error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> extended multibyte/wide character conversion
31105 error-handling functions, <a href="#7.21.10">7.21.10</a>, <a href="#7.23.6.2">7.23.6.2</a>, utilities, <a href="#7.28.6">7.28.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
31106 <a href="#K.3.7.4.2">K.3.7.4.2</a>, <a href="#K.3.7.4.3">K.3.7.4.3</a> extensible wide character case mapping functions,
31107 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.29.3.2">7.29.3.2</a>
31108 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> extensible wide character classification functions,
31109 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> <a href="#7.29.2.2">7.29.2.2</a>
31110 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.8.5">F.8.5</a> extern storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.7.1">6.7.1</a>
31111 evaluation of expression, <a href="#5.1.2.3">5.1.2.3</a> external definition, <a href="#6.9">6.9</a>
31112 evaluation order, see order of evaluation external identifiers, underscore, <a href="#7.1.3">7.1.3</a>
31113 exceptional condition, <a href="#6.5">6.5</a> external linkage, <a href="#6.2.2">6.2.2</a>
31114 excess precision, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> external name, <a href="#6.4.2.1">6.4.2.1</a>
31115 excess range, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> external object definitions, <a href="#6.9.2">6.9.2</a>
31116 exclusive OR operators
31117 bitwise (^), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a> fabs functions, <a href="#7.12.7.2">7.12.7.2</a>, <a href="#F.3">F.3</a>, <a href="#F.10.4.2">F.10.4.2</a>
31118 bitwise assignment (^=), <a href="#6.5.16.2">6.5.16.2</a> fabs type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
31119 executable program, <a href="#5.1.1.1">5.1.1.1</a> false macro, <a href="#7.18">7.18</a>
31120 execution character set, <a href="#5.2.1">5.2.1</a> fclose function, <a href="#7.21.5.1">7.21.5.1</a>
31121 execution environment, <a href="#5">5</a>, <a href="#5.1.2">5.1.2</a>, see also fdim functions, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#F.10.9.1">F.10.9.1</a>
31122 environmental limits fdim type-generic macro, <a href="#7.24">7.24</a>
31123 execution sequence, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.8">6.8</a> FE_ALL_EXCEPT macro, <a href="#7.6">7.6</a>
31124 exit function, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a>, FE_DFL_ENV macro, <a href="#7.6">7.6</a>
31125 <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</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>
31126 EXIT_FAILURE macro, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a> FE_DOWNWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
31127 EXIT_SUCCESS macro, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a> FE_INEXACT macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
31128 exp functions, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#F.10.3.1">F.10.3.1</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>
31129 exp type-generic macro, <a href="#7.24">7.24</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>
31130 <!--page 680 -->
31131 FE_TONEAREST macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> float _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>,
31132 FE_TOWARDZERO macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
31133 FE_UNDERFLOW macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> float _Imaginary type, <a href="#G.2">G.2</a>
31134 FE_UPWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> 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>
31135 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> 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>,
31136 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> <a href="#6.3.1.8">6.3.1.8</a>
31137 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> 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.22.1.3">7.22.1.3</a>,
31138 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> <a href="#7.28.4.1.1">7.28.4.1.1</a>
31139 feholdexcept function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.3">7.6.4.3</a>, float_t type, <a href="#7.12">7.12</a>, <a href="#J.5.6">J.5.6</a>
31140 <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a> floating constant, <a href="#6.4.4.2">6.4.4.2</a>
31141 fence, <a href="#5.1.2.4">5.1.2.4</a> floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a>
31142 fences, <a href="#7.17.4">7.17.4</a> 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>,
31143 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> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
31144 FENV_ACCESS pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.6.1">7.6.1</a>, <a href="#F.8">F.8</a>, <a href="#F.9">F.9</a>, floating types, <a href="#6.2.5">6.2.5</a>, <a href="#6.11.1">6.11.1</a>
31145 <a href="#F.10">F.10</a> 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>,
31146 fenv_t type, <a href="#7.6">7.6</a> <a href="#7.22.1.3">7.22.1.3</a>, <a href="#F.5">F.5</a>, see also contracted expression
31147 feof function, <a href="#7.21.10.2">7.21.10.2</a> floating-point arithmetic functions, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a>
31148 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> floating-point classification functions, <a href="#7.12.3">7.12.3</a>
31149 ferror function, <a href="#7.21.10.3">7.21.10.3</a> floating-point control mode, <a href="#7.6">7.6</a>, <a href="#F.8.6">F.8.6</a>
31150 fesetenv function, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#F.3">F.3</a> floating-point environment, <a href="#7.6">7.6</a>, <a href="#F.8">F.8</a>, <a href="#F.8.6">F.8.6</a>
31151 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> floating-point exception, <a href="#7.6">7.6</a>, <a href="#7.6.2">7.6.2</a>, <a href="#F.10">F.10</a>
31152 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> 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>
31153 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> floating-point rounding mode, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31154 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> floating-point status flag, <a href="#7.6">7.6</a>, <a href="#F.8.6">F.8.6</a>
31155 fexcept_t type, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> floor functions, <a href="#7.12.9.2">7.12.9.2</a>, <a href="#F.10.6.2">F.10.6.2</a>
31156 fflush function, <a href="#7.21.5.2">7.21.5.2</a>, <a href="#7.21.5.3">7.21.5.3</a> floor type-generic macro, <a href="#7.24">7.24</a>
31157 fgetc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.7.1">7.21.7.1</a>, FLT_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31158 <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.8.1">7.21.8.1</a> FLT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31159 fgetpos function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.3">7.21.9.3</a> FLT_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31160 fgets function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.2">7.21.7.2</a>, <a href="#K.3.5.4.1">K.3.5.4.1</a> FLT_EVAL_METHOD macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.6">6.6</a>, <a href="#7.12">7.12</a>,
31161 fgetwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.28.3.1">7.28.3.1</a>, <a href="#F.10.11">F.10.11</a>
31162 <a href="#7.28.3.6">7.28.3.6</a> FLT_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31163 fgetws function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.2">7.28.3.2</a> FLT_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31164 field width, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a> FLT_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31165 file, <a href="#7.21.3">7.21.3</a> FLT_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31166 access functions, <a href="#7.21.5">7.21.5</a>, <a href="#K.3.5.2">K.3.5.2</a> FLT_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31167 name, <a href="#7.21.3">7.21.3</a> FLT_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31168 operations, <a href="#7.21.4">7.21.4</a>, <a href="#K.3.5.1">K.3.5.1</a> FLT_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31169 position indicator, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, FLT_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31170 <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.1">7.21.7.1</a>, <a href="#7.21.7.3">7.21.7.3</a>, <a href="#7.21.7.10">7.21.7.10</a>, FLT_RADIX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.22.1.3">7.22.1.3</a>,
31171 <a href="#7.21.8.1">7.21.8.1</a>, <a href="#7.21.8.2">7.21.8.2</a>, <a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.4.1.1">7.28.4.1.1</a>
31172 <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.9.4">7.21.9.4</a>, <a href="#7.21.9.5">7.21.9.5</a>, <a href="#7.28.3.1">7.28.3.1</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>
31173 <a href="#7.28.3.3">7.28.3.3</a>, <a href="#7.28.3.10">7.28.3.10</a> FLT_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31174 positioning functions, <a href="#7.21.9">7.21.9</a> fma functions, <a href="#7.12">7.12</a>, <a href="#7.12.13.1">7.12.13.1</a>, <a href="#F.10.10.1">F.10.10.1</a>
31175 file scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.9">6.9</a> fma type-generic macro, <a href="#7.24">7.24</a>
31176 FILE type, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> fmax functions, <a href="#7.12.12.2">7.12.12.2</a>, <a href="#F.10.9.2">F.10.9.2</a>
31177 FILENAME_MAX macro, <a href="#7.21.1">7.21.1</a> fmax type-generic macro, <a href="#7.24">7.24</a>
31178 flags, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a>, see also floating-point fmin functions, <a href="#7.12.12.3">7.12.12.3</a>, <a href="#F.10.9.3">F.10.9.3</a>
31179 status flag fmin type-generic macro, <a href="#7.24">7.24</a>
31180 flexible array member, <a href="#6.7.2.1">6.7.2.1</a> fmod functions, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#F.10.7.1">F.10.7.1</a>
31181 float _Complex type, <a href="#6.2.5">6.2.5</a> fmod type-generic macro, <a href="#7.24">7.24</a>
31182 <!--page 681 -->
31183 fopen function, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.5.4">7.21.5.4</a>, <a href="#K.3.5.2.1">K.3.5.2.1</a> <a href="#K.3.5.3.7">K.3.5.3.7</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>
31184 FOPEN_MAX macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.4.3">7.21.4.3</a>, fseek function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.10">7.21.7.10</a>,
31185 <a href="#K.3.5.1.1">K.3.5.1.1</a> <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a>, <a href="#7.21.9.5">7.21.9.5</a>, <a href="#7.28.3.10">7.28.3.10</a>
31186 fopen_s function, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.2.1">K.3.5.2.1</a>, fsetpos function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.10">7.21.7.10</a>,
31187 <a href="#K.3.5.2.2">K.3.5.2.2</a> <a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.28.3.10">7.28.3.10</a>
31188 for statement, <a href="#6.8.5">6.8.5</a>, <a href="#6.8.5.3">6.8.5.3</a> ftell function, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a>
31189 form-feed character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> full declarator, <a href="#6.7.6">6.7.6</a>
31190 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>, full expression, <a href="#6.8">6.8</a>
31191 <a href="#7.4.1.10">7.4.1.10</a> fully buffered stream, <a href="#7.21.3">7.21.3</a>
31192 formal argument (deprecated), <a href="#3.16">3.16</a> function
31193 formal parameter, <a href="#3.16">3.16</a> argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
31194 formatted input/output functions, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.6">7.21.6</a>, body, <a href="#6.9.1">6.9.1</a>
31195 <a href="#K.3.5.3">K.3.5.3</a> call, <a href="#6.5.2.2">6.5.2.2</a>
31196 wide character, <a href="#7.28.2">7.28.2</a>, <a href="#K.3.9.1">K.3.9.1</a> library, <a href="#7.1.4">7.1.4</a>
31197 fortran keyword, <a href="#J.5.9">J.5.9</a> declarator, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.11.6">6.11.6</a>
31198 forward reference, <a href="#3.11">3.11</a> definition, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.7">6.11.7</a>
31199 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 designator, <a href="#6.3.2.1">6.3.2.1</a>
31200 also contracted expression image, <a href="#5.2.3">5.2.3</a>
31201 FP_FAST_FMA macro, <a href="#7.12">7.12</a> inline, <a href="#6.7.4">6.7.4</a>
31202 FP_FAST_FMAF macro, <a href="#7.12">7.12</a> library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.4">7.1.4</a>
31203 FP_FAST_FMAL macro, <a href="#7.12">7.12</a> 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>
31204 FP_ILOGB0 macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a> no-return, <a href="#6.7.4">6.7.4</a>
31205 FP_ILOGBNAN macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a> 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>
31206 FP_INFINITE macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> 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>,
31207 FP_NAN macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> <a href="#6.7.6.3">6.7.6.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>
31208 FP_NORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> prototype scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.7.6.2">6.7.6.2</a>
31209 FP_SUBNORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> recursive call, <a href="#6.5.2.2">6.5.2.2</a>
31210 FP_ZERO macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> return, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
31211 fpclassify macro, <a href="#7.12.3.1">7.12.3.1</a>, <a href="#F.3">F.3</a> scope, <a href="#6.2.1">6.2.1</a>
31212 fpos_t type, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a> type, <a href="#6.2.5">6.2.5</a>
31213 fprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.1">7.21.6.1</a>, type conversion, <a href="#6.3.2.1">6.3.2.1</a>
31214 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.21.6.5">7.21.6.5</a>, <a href="#7.21.6.6">7.21.6.6</a>, function specifiers, <a href="#6.7.4">6.7.4</a>
31215 <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#F.3">F.3</a>, <a href="#K.3.5.3.1">K.3.5.3.1</a> function type, <a href="#6.2.5">6.2.5</a>
31216 fprintf_s function, <a href="#K.3.5.3.1">K.3.5.3.1</a> function-call operator (( )), <a href="#6.5.2.2">6.5.2.2</a>
31217 fputc function, <a href="#5.2.2">5.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.7.3">7.21.7.3</a>, function-like macro, <a href="#6.10.3">6.10.3</a>
31218 <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.21.8.2">7.21.8.2</a> fundamental alignment, <a href="#6.2.8">6.2.8</a>
31219 fputs function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.4">7.21.7.4</a> future directions
31220 fputwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.28.3.3">7.28.3.3</a>, language, <a href="#6.11">6.11</a>
31221 <a href="#7.28.3.8">7.28.3.8</a> library, <a href="#7.30">7.30</a>
31222 fputws function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.4">7.28.3.4</a> fwide function, <a href="#7.21.2">7.21.2</a>, <a href="#7.28.3.5">7.28.3.5</a>
31223 fread function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.8.1">7.21.8.1</a> fwprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
31224 free function, <a href="#7.22.3.3">7.22.3.3</a>, <a href="#7.22.3.5">7.22.3.5</a> <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#7.28.2.3">7.28.2.3</a>, <a href="#7.28.2.5">7.28.2.5</a>,
31225 freestanding execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>, <a href="#7.28.2.11">7.28.2.11</a>, <a href="#K.3.9.1.1">K.3.9.1.1</a>
31226 <a href="#5.1.2.1">5.1.2.1</a> fwprintf_s function, <a href="#K.3.9.1.1">K.3.9.1.1</a>
31227 freopen function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.4">7.21.5.4</a> fwrite function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.8.2">7.21.8.2</a>
31228 freopen_s function, <a href="#K.3.5.2.2">K.3.5.2.2</a> fwscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.2">7.28.2.2</a>,
31229 frexp functions, <a href="#7.12.6.4">7.12.6.4</a>, <a href="#F.10.3.4">F.10.3.4</a> <a href="#7.28.2.4">7.28.2.4</a>, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.12">7.28.2.12</a>, <a href="#7.28.3.10">7.28.3.10</a>,
31230 frexp type-generic macro, <a href="#7.24">7.24</a> <a href="#K.3.9.1.2">K.3.9.1.2</a>
31231 fscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, fwscanf_s function, <a href="#K.3.9.1.2">K.3.9.1.2</a>, <a href="#K.3.9.1.5">K.3.9.1.5</a>,
31232 <a href="#7.21.6.4">7.21.6.4</a>, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#F.3">F.3</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a> <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a>
31233 fscanf_s function, <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>,
31234 <!--page 682 -->
31235 gamma functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.10.5">F.10.5</a> name spaces, <a href="#6.2.3">6.2.3</a>
31236 general utilities, <a href="#7.22">7.22</a>, <a href="#K.3.6">K.3.6</a> reserved, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a>, <a href="#K.3.1.2">K.3.1.2</a>
31237 wide string, <a href="#7.28.4">7.28.4</a>, <a href="#K.3.9.2">K.3.9.2</a> scope, <a href="#6.2.1">6.2.1</a>
31238 general wide string utilities, <a href="#7.28.4">7.28.4</a>, <a href="#K.3.9.2">K.3.9.2</a> type, <a href="#6.2.5">6.2.5</a>
31239 generic parameters, <a href="#7.24">7.24</a> identifier list, <a href="#6.7.6">6.7.6</a>
31240 generic selection, <a href="#6.5.1.1">6.5.1.1</a> identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a>
31241 getc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a> IEC 559, <a href="#F.1">F.1</a>
31242 getchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.6">7.21.7.6</a> 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.3">6.10.8.3</a>, <a href="#7.3.3">7.3.3</a>,
31243 getenv function, <a href="#7.22.4.6">7.22.4.6</a> <a href="#7.6">7.6</a>, <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>,
31244 getenv_s function, <a href="#K.3.6.2.1">K.3.6.2.1</a> <a href="#H.1">H.1</a>
31245 gets function, <a href="#K.3.5.4.1">K.3.5.4.1</a> IEEE 754, <a href="#F.1">F.1</a>
31246 gets_s function, <a href="#K.3.5.4.1">K.3.5.4.1</a> IEEE 854, <a href="#F.1">F.1</a>
31247 getwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.6">7.28.3.6</a>, <a href="#7.28.3.7">7.28.3.7</a> IEEE floating-point arithmetic standard, see
31248 getwchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.7">7.28.3.7</a> IEC 60559, ANSI/IEEE 754,
31249 gmtime function, <a href="#7.26.3.3">7.26.3.3</a> ANSI/IEEE 854
31250 gmtime_s function, <a href="#K.3.8.2.3">K.3.8.2.3</a> 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>,
31251 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> <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a>
31252 graphic characters, <a href="#5.2.1">5.2.1</a> if statement, <a href="#6.8.4.1">6.8.4.1</a>
31253 greater-than operator (&gt;), <a href="#6.5.8">6.5.8</a> ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a>
31254 greater-than-or-equal-to operator (&gt;=), <a href="#6.5.8">6.5.8</a> ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a>
31255 ignore_handler_s function, <a href="#K.3.6.1.3">K.3.6.1.3</a>
31256 happens before, <a href="#5.1.2.4">5.1.2.4</a> ilogb functions, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.10.3.5">F.10.3.5</a>
31257 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 ilogb type-generic macro, <a href="#7.24">7.24</a>
31258 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> imaginary macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a>
31259 hexadecimal constant, <a href="#6.4.4.1">6.4.4.1</a> imaginary numbers, <a href="#G">G</a>
31260 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> imaginary type domain, <a href="#G.2">G.2</a>
31261 hexadecimal prefix, <a href="#6.4.4.1">6.4.4.1</a> imaginary types, <a href="#G">G</a>
31262 hexadecimal-character escape sequence imaxabs function, <a href="#7.8.2.1">7.8.2.1</a>
31263 (\x hexadecimal digits), <a href="#6.4.4.4">6.4.4.4</a> imaxdiv function, <a href="#7.8">7.8</a>, <a href="#7.8.2.2">7.8.2.2</a>
31264 high-order bit, <a href="#3.6">3.6</a> imaxdiv_t type, <a href="#7.8">7.8</a>
31265 horizontal-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> implementation, <a href="#3.12">3.12</a>
31266 horizontal-tab escape sequence (\r), <a href="#7.29.2.1.3">7.29.2.1.3</a> 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>,
31267 horizontal-tab escape sequence (\t), <a href="#5.2.2">5.2.2</a>, <a href="#6.7.6">6.7.6</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#E">E</a>, see also environmental
31268 <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> limits
31269 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> implementation-defined behavior, <a href="#3.4.1">3.4.1</a>, <a href="#4">4</a>, <a href="#J.3">J.3</a>
31270 HUGE_VAL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>, implementation-defined value, <a href="#3.19.1">3.19.1</a>
31271 <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#F.10">F.10</a> implicit conversion, <a href="#6.3">6.3</a>
31272 HUGE_VALF macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>, implicit initialization, <a href="#6.7.9">6.7.9</a>
31273 <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#F.10">F.10</a> include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.2">6.10.2</a>
31274 HUGE_VALL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>, inclusive OR operators
31275 <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#F.10">F.10</a> bitwise (|), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>
31276 hyperbolic functions bitwise assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
31277 complex, <a href="#7.3.6">7.3.6</a>, <a href="#G.6.2">G.6.2</a> incomplete type, <a href="#6.2.5">6.2.5</a>
31278 real, <a href="#7.12.5">7.12.5</a>, <a href="#F.10.2">F.10.2</a> increment operators, see arithmetic operators,
31279 hypot functions, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#F.10.4.3">F.10.4.3</a> increment and decrement
31280 hypot type-generic macro, <a href="#7.24">7.24</a> indeterminate value, <a href="#3.19.2">3.19.2</a>
31281 indeterminately sequenced, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>,
31282 <a href="#I">I</a> macro, <a href="#7.3.1">7.3.1</a>, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a> <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.16.2">6.5.16.2</a>, see also sequenced before,
31283 identifier, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.5.1">6.5.1</a> unsequenced
31284 linkage, see linkage indirection operator (*), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>
31285 maximum length, <a href="#6.4.2.1">6.4.2.1</a> inequality operator (!=), <a href="#6.5.9">6.5.9</a>
31286 <!--page 683 -->
31287 infinitary, <a href="#7.12.1">7.12.1</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.20">7.20</a>
31288 INFINITY macro, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> inter-thread happens before, <a href="#5.1.2.4">5.1.2.4</a>
31289 initial position, <a href="#5.2.2">5.2.2</a> interactive device, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.3">7.21.5.3</a>
31290 initial shift state, <a href="#5.2.1.2">5.2.1.2</a> internal linkage, <a href="#6.2.2">6.2.2</a>
31291 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.9">6.7.9</a>, internal name, <a href="#6.4.2.1">6.4.2.1</a>
31292 <a href="#F.8.5">F.8.5</a> interrupt, <a href="#5.2.3">5.2.3</a>
31293 in blocks, <a href="#6.8">6.8</a> INTMAX_C macro, <a href="#7.20.4.2">7.20.4.2</a>
31294 initializer, <a href="#6.7.9">6.7.9</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.20.2.5">7.20.2.5</a>
31295 permitted form, <a href="#6.6">6.6</a> 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.20.2.5">7.20.2.5</a>
31296 string literal, <a href="#6.3.2.1">6.3.2.1</a> intmax_t type, <a href="#7.20.1.5">7.20.1.5</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
31297 inline, <a href="#6.7.4">6.7.4</a> <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>
31298 inner scope, <a href="#6.2.1">6.2.1</a> INTN_C macros, <a href="#7.20.4.1">7.20.4.1</a>
31299 input failure, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.8">7.28.2.8</a>, <a href="#7.28.2.10">7.28.2.10</a>, INTN_MAX macros, <a href="#7.20.2.1">7.20.2.1</a>
31300 <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>, <a href="#K.3.5.3.7">K.3.5.3.7</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, INTN_MIN macros, <a href="#7.20.2.1">7.20.2.1</a>
31301 <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>, <a href="#K.3.9.1.5">K.3.9.1.5</a>, intN_t types, <a href="#7.20.1.1">7.20.1.1</a>
31302 <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a> INTPTR_MAX macro, <a href="#7.20.2.4">7.20.2.4</a>
31303 input/output functions INTPTR_MIN macro, <a href="#7.20.2.4">7.20.2.4</a>
31304 character, <a href="#7.21.7">7.21.7</a>, <a href="#K.3.5.4">K.3.5.4</a> intptr_t type, <a href="#7.20.1.4">7.20.1.4</a>
31305 direct, <a href="#7.21.8">7.21.8</a> inttypes.h header, <a href="#7.8">7.8</a>, <a href="#7.30.4">7.30.4</a>
31306 formatted, <a href="#7.21.6">7.21.6</a>, <a href="#K.3.5.3">K.3.5.3</a> 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>
31307 wide character, <a href="#7.28.2">7.28.2</a>, <a href="#K.3.9.1">K.3.9.1</a> isalpha function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a>
31308 wide character, <a href="#7.28.3">7.28.3</a> isblank function, <a href="#7.4.1.3">7.4.1.3</a>
31309 formatted, <a href="#7.28.2">7.28.2</a>, <a href="#K.3.9.1">K.3.9.1</a> 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>,
31310 input/output header, <a href="#7.21">7.21</a>, <a href="#K.3.5">K.3.5</a> <a href="#7.4.1.11">7.4.1.11</a>
31311 input/output, device, <a href="#5.1.2.3">5.1.2.3</a> 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>,
31312 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> <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>
31313 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>, isfinite macro, <a href="#7.12.3.2">7.12.3.2</a>, <a href="#F.3">F.3</a>
31314 <a href="#6.3.1.8">6.3.1.8</a> isgraph function, <a href="#7.4.1.6">7.4.1.6</a>
31315 INT_FASTN_MAX macros, <a href="#7.20.2.3">7.20.2.3</a> isgreater macro, <a href="#7.12.14.1">7.12.14.1</a>, <a href="#F.3">F.3</a>
31316 INT_FASTN_MIN macros, <a href="#7.20.2.3">7.20.2.3</a> isgreaterequal macro, <a href="#7.12.14.2">7.12.14.2</a>, <a href="#F.3">F.3</a>
31317 int_fastN_t types, <a href="#7.20.1.3">7.20.1.3</a> isinf macro, <a href="#7.12.3.3">7.12.3.3</a>
31318 INT_LEASTN_MAX macros, <a href="#7.20.2.2">7.20.2.2</a> isless macro, <a href="#7.12.14.3">7.12.14.3</a>, <a href="#F.3">F.3</a>
31319 INT_LEASTN_MIN macros, <a href="#7.20.2.2">7.20.2.2</a> islessequal macro, <a href="#7.12.14.4">7.12.14.4</a>, <a href="#F.3">F.3</a>
31320 int_leastN_t types, <a href="#7.20.1.2">7.20.1.2</a> islessgreater macro, <a href="#7.12.14.5">7.12.14.5</a>, <a href="#F.3">F.3</a>
31321 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> 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>,
31322 INT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a> <a href="#7.4.2.2">7.4.2.2</a>
31323 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>, isnan macro, <a href="#7.12.3.4">7.12.3.4</a>, <a href="#F.3">F.3</a>
31324 <a href="#7.22.6">7.22.6</a> isnormal macro, <a href="#7.12.3.5">7.12.3.5</a>
31325 integer character constant, <a href="#6.4.4.4">6.4.4.4</a> ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>
31326 integer constant, <a href="#6.4.4.1">6.4.4.1</a> ISO 4217, <a href="#2">2</a>, <a href="#7.11.2.1">7.11.2.1</a>
31327 integer constant expression, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.6">6.6</a>, <a href="#6.7.2.1">6.7.2.1</a>, ISO 8601, <a href="#2">2</a>, <a href="#7.26.3.5">7.26.3.5</a>
31328 <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.7.10">6.7.10</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#6.10.1">6.10.1</a>, 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.2">6.10.8.2</a>
31329 <a href="#7.1.4">7.1.4</a> ISO/IEC 10976-1, <a href="#H.1">H.1</a>
31330 integer conversion rank, <a href="#6.3.1.1">6.3.1.1</a> ISO/IEC 2382-1, <a href="#2">2</a>, <a href="#3">3</a>
31331 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>, ISO/IEC 646, <a href="#2">2</a>, <a href="#5.2.1.1">5.2.1.1</a>
31332 <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.20.2">7.20.2</a>, <a href="#7.20.3">7.20.3</a>, ISO/IEC 9945-2, <a href="#7.11">7.11</a>
31333 <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a> iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> *
31334 integer suffix, <a href="#6.4.4.1">6.4.4.1</a> isprint function, <a href="#5.2.2">5.2.2</a>, <a href="#7.4.1.8">7.4.1.8</a>
31335 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>, 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>,
31336 <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> <a href="#7.4.1.11">7.4.1.11</a>
31337 integer types, <a href="#6.2.5">6.2.5</a>, <a href="#7.20">7.20</a> 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>,
31338 <!--page 684 -->
31339 <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.21.6.2">7.21.6.2</a>, <a href="#7.22.1.3">7.22.1.3</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>
31340 <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.28.2.2">7.28.2.2</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.23.4.3">7.23.4.3</a>,
31341 isunordered macro, <a href="#7.12.14.6">7.12.14.6</a>, <a href="#F.3">F.3</a> <a href="#7.28.4.4.2">7.28.4.4.2</a>
31342 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>, LC_CTYPE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.22">7.22</a>, <a href="#7.22.7">7.22.7</a>,
31343 <a href="#7.4.2.2">7.4.2.2</a> <a href="#7.22.8">7.22.8</a>, <a href="#7.28.6">7.28.6</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a>, <a href="#7.29.2.2.2">7.29.2.2.2</a>,
31344 iswalnum function, <a href="#7.29.2.1.1">7.29.2.1.1</a>, <a href="#7.29.2.1.9">7.29.2.1.9</a>, <a href="#7.29.3.2.1">7.29.3.2.1</a>, <a href="#7.29.3.2.2">7.29.3.2.2</a>, <a href="#K.3.6.4">K.3.6.4</a>, <a href="#K.3.6.5">K.3.6.5</a>
31345 <a href="#7.29.2.1.10">7.29.2.1.10</a>, <a href="#7.29.2.2.1">7.29.2.2.1</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>
31346 iswalpha function, <a href="#7.29.2.1.1">7.29.2.1.1</a>, <a href="#7.29.2.1.2">7.29.2.1.2</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>
31347 <a href="#7.29.2.2.1">7.29.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.26.3.5">7.26.3.5</a>
31348 iswblank function, <a href="#7.29.2.1.3">7.29.2.1.3</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> lconv structure type, <a href="#7.11">7.11</a>
31349 iswcntrl function, <a href="#7.29.2.1.2">7.29.2.1.2</a>, <a href="#7.29.2.1.4">7.29.2.1.4</a>, LDBL_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31350 <a href="#7.29.2.1.7">7.29.2.1.7</a>, <a href="#7.29.2.1.11">7.29.2.1.11</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> LDBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31351 iswctype function, <a href="#7.29.2.2.1">7.29.2.2.1</a>, <a href="#7.29.2.2.2">7.29.2.2.2</a> LDBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31352 iswdigit function, <a href="#7.29.2.1.1">7.29.2.1.1</a>, <a href="#7.29.2.1.2">7.29.2.1.2</a>, LDBL_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31353 <a href="#7.29.2.1.5">7.29.2.1.5</a>, <a href="#7.29.2.1.7">7.29.2.1.7</a>, <a href="#7.29.2.1.11">7.29.2.1.11</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> LDBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31354 iswgraph function, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.1.6">7.29.2.1.6</a>, LDBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31355 <a href="#7.29.2.1.10">7.29.2.1.10</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> LDBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31356 iswlower function, <a href="#7.29.2.1.2">7.29.2.1.2</a>, <a href="#7.29.2.1.7">7.29.2.1.7</a>, LDBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31357 <a href="#7.29.2.2.1">7.29.2.2.1</a>, <a href="#7.29.3.1.1">7.29.3.1.1</a>, <a href="#7.29.3.1.2">7.29.3.1.2</a> LDBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31358 iswprint function, <a href="#7.29.2.1.6">7.29.2.1.6</a>, <a href="#7.29.2.1.8">7.29.2.1.8</a>, LDBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31359 <a href="#7.29.2.2.1">7.29.2.2.1</a> LDBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31360 iswpunct function, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.1.2">7.29.2.1.2</a>, LDBL_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31361 <a href="#7.29.2.1.7">7.29.2.1.7</a>, <a href="#7.29.2.1.9">7.29.2.1.9</a>, <a href="#7.29.2.1.10">7.29.2.1.10</a>, ldexp functions, <a href="#7.12.6.6">7.12.6.6</a>, <a href="#F.10.3.6">F.10.3.6</a>
31362 <a href="#7.29.2.1.11">7.29.2.1.11</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> ldexp type-generic macro, <a href="#7.24">7.24</a>
31363 iswspace function, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>, ldiv function, <a href="#7.22.6.2">7.22.6.2</a>
31364 <a href="#7.28.4.1.1">7.28.4.1.1</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>, <a href="#7.29.2.1.2">7.29.2.1.2</a>, <a href="#7.29.2.1.6">7.29.2.1.6</a>, ldiv_t type, <a href="#7.22">7.22</a>
31365 <a href="#7.29.2.1.7">7.29.2.1.7</a>, <a href="#7.29.2.1.9">7.29.2.1.9</a>, <a href="#7.29.2.1.10">7.29.2.1.10</a>, leading underscore in identifiers, <a href="#7.1.3">7.1.3</a>
31366 <a href="#7.29.2.1.11">7.29.2.1.11</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> left-shift assignment operator (&lt;&lt;=), <a href="#6.5.16.2">6.5.16.2</a>
31367 iswupper function, <a href="#7.29.2.1.2">7.29.2.1.2</a>, <a href="#7.29.2.1.11">7.29.2.1.11</a>, left-shift operator (&lt;&lt;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
31368 <a href="#7.29.2.2.1">7.29.2.2.1</a>, <a href="#7.29.3.1.1">7.29.3.1.1</a>, <a href="#7.29.3.1.2">7.29.3.1.2</a> length
31369 iswxdigit function, <a href="#7.29.2.1.12">7.29.2.1.12</a>, <a href="#7.29.2.2.1">7.29.2.2.1</a> 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>
31370 isxdigit function, <a href="#7.4.1.12">7.4.1.12</a>, <a href="#7.11.1.1">7.11.1.1</a> 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>
31371 italic type convention, <a href="#3">3</a>, <a href="#6.1">6.1</a> identifier, <a href="#6.4.2.1">6.4.2.1</a>
31372 iteration statements, <a href="#6.8.5">6.8.5</a> internal name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
31373 length function, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.23.6.3">7.23.6.3</a>, <a href="#7.28.4.6.1">7.28.4.6.1</a>,
31374 jmp_buf type, <a href="#7.13">7.13</a> <a href="#7.28.6.3.1">7.28.6.3.1</a>, <a href="#K.3.7.4.4">K.3.7.4.4</a>, <a href="#K.3.9.2.4.1">K.3.9.2.4.1</a>
31375 jump statements, <a href="#6.8.6">6.8.6</a> length modifier, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>,
31376 <a href="#7.28.2.2">7.28.2.2</a>
31377 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> less-than operator (&lt;), <a href="#6.5.8">6.5.8</a>
31378 kill_dependency macro, <a href="#5.1.2.4">5.1.2.4</a>, <a href="#7.17.3.1">7.17.3.1</a> less-than-or-equal-to operator (&lt;=), <a href="#6.5.8">6.5.8</a>
31379 known constant size, <a href="#6.2.5">6.2.5</a> letter, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>
31380 lexical elements, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>
31381 L_tmpnam macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.4">7.21.4.4</a> lgamma functions, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#F.10.5.3">F.10.5.3</a>
31382 L_tmpnam_s macro, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a> lgamma type-generic macro, <a href="#7.24">7.24</a>
31383 label name, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.3">6.2.3</a> library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7">7</a>, <a href="#K.3">K.3</a>
31384 labeled statement, <a href="#6.8.1">6.8.1</a> future directions, <a href="#7.30">7.30</a>
31385 labs function, <a href="#7.22.6.1">7.22.6.1</a> summary, <a href="#B">B</a>
31386 language, <a href="#6">6</a> terms, <a href="#7.1.1">7.1.1</a>
31387 future directions, <a href="#6.11">6.11</a> use of functions, <a href="#7.1.4">7.1.4</a>
31388 syntax summary, <a href="#A">A</a> lifetime, <a href="#6.2.4">6.2.4</a>
31389 Latin alphabet, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.2.1">6.4.2.1</a> limits
31390 <!--page 685 -->
31391 environmental, see environmental 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>
31392 implementation, see implementation limits long double _Imaginary type, <a href="#G.2">G.2</a>
31393 numerical, see numerical limits long double suffix, l or <a href="#L">L</a>, <a href="#6.4.4.2">6.4.4.2</a>
31394 translation, see translation 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>,
31395 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> <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#F.2">F.2</a>
31396 line buffered stream, <a href="#7.21.3">7.21.3</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>,
31397 line number, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8.1">6.10.8.1</a> <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
31398 line preprocessing directive, <a href="#6.10.4">6.10.4</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.21.6.1">7.21.6.1</a>,
31399 lines, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#7.21.2">7.21.2</a> <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>
31400 preprocessing directive, <a href="#6.10">6.10</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>,
31401 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.6.2">6.7.6.2</a>, <a href="#6.9">6.9</a>, <a href="#6.9.2">6.9.2</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
31402 <a href="#6.11.2">6.11.2</a> long integer suffix, l or <a href="#L">L</a>, <a href="#6.4.4.1">6.4.4.1</a>
31403 llabs function, <a href="#7.22.6.1">7.22.6.1</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>,
31404 lldiv function, <a href="#7.22.6.2">7.22.6.2</a> <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>
31405 lldiv_t type, <a href="#7.22">7.22</a> long long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>,
31406 LLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</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="#6.3.1.8">6.3.1.8</a>
31407 <a href="#7.28.4.1.2">7.28.4.1.2</a> long long integer suffix, ll or LL, <a href="#6.4.4.1">6.4.4.1</a>
31408 LLONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, LONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>
31409 <a href="#7.28.4.1.2">7.28.4.1.2</a> LONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>
31410 llrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10.6.5">F.10.6.5</a> 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.22.4.4">7.22.4.4</a>,
31411 llrint type-generic macro, <a href="#7.24">7.24</a> <a href="#7.22.4.7">7.22.4.7</a>
31412 llround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.7">F.10.6.7</a> loop body, <a href="#6.8.5">6.8.5</a>
31413 llround type-generic macro, <a href="#7.24">7.24</a> low-order bit, <a href="#3.6">3.6</a>
31414 local time, <a href="#7.26.1">7.26.1</a> lowercase letter, <a href="#5.2.1">5.2.1</a>
31415 locale, <a href="#3.4.2">3.4.2</a> lrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10.6.5">F.10.6.5</a>
31416 locale-specific behavior, <a href="#3.4.2">3.4.2</a>, <a href="#J.4">J.4</a> lrint type-generic macro, <a href="#7.24">7.24</a>
31417 locale.h header, <a href="#7.11">7.11</a>, <a href="#7.30.5">7.30.5</a> lround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.7">F.10.6.7</a>
31418 localeconv function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a> lround type-generic macro, <a href="#7.24">7.24</a>
31419 localization, <a href="#7.11">7.11</a> 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>,
31420 localtime function, <a href="#7.26.3.4">7.26.3.4</a> <a href="#6.7.2.4">6.7.2.4</a>
31421 localtime_s function, <a href="#K.3.8.2.4">K.3.8.2.4</a> lvalue conversion, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a>, <a href="#6.5.16.1">6.5.16.1</a>,
31422 log functions, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#F.10.3.7">F.10.3.7</a> <a href="#6.5.16.2">6.5.16.2</a>
31423 log type-generic macro, <a href="#7.24">7.24</a>
31424 log10 functions, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#F.10.3.8">F.10.3.8</a> macro argument substitution, <a href="#6.10.3.1">6.10.3.1</a>
31425 log10 type-generic macro, <a href="#7.24">7.24</a> macro definition
31426 log1p functions, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#F.10.3.9">F.10.3.9</a> library function, <a href="#7.1.4">7.1.4</a>
31427 log1p type-generic macro, <a href="#7.24">7.24</a> macro invocation, <a href="#6.10.3">6.10.3</a>
31428 log2 functions, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#F.10.3.10">F.10.3.10</a> macro name, <a href="#6.10.3">6.10.3</a>
31429 log2 type-generic macro, <a href="#7.24">7.24</a> length, <a href="#5.2.4.1">5.2.4.1</a>
31430 logarithmic functions predefined, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
31431 complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a> redefinition, <a href="#6.10.3">6.10.3</a>
31432 real, <a href="#7.12.6">7.12.6</a>, <a href="#F.10.3">F.10.3</a> scope, <a href="#6.10.3.5">6.10.3.5</a>
31433 logb functions, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#F.3">F.3</a>, <a href="#F.10.3.11">F.10.3.11</a> macro parameter, <a href="#6.10.3">6.10.3</a>
31434 logb type-generic macro, <a href="#7.24">7.24</a> macro preprocessor, <a href="#6.10">6.10</a>
31435 logical operators macro replacement, <a href="#6.10.3">6.10.3</a>
31436 AND (&amp;&amp;), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a> magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a>
31437 negation (!), <a href="#6.5.3.3">6.5.3.3</a> 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>,
31438 OR (||), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a> <a href="#7.21.3">7.21.3</a>
31439 logical source lines, <a href="#5.1.1.2">5.1.1.2</a> malloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.4">7.22.3.4</a>, <a href="#7.22.3.5">7.22.3.5</a>
31440 long double _Complex type, <a href="#6.2.5">6.2.5</a> manipulation functions
31441 long double _Complex type conversion, complex, <a href="#7.3.9">7.3.9</a>
31442 <!--page 686 -->
31443 real, <a href="#7.12.11">7.12.11</a>, <a href="#F.10.8">F.10.8</a> modf functions, <a href="#7.12.6.12">7.12.6.12</a>, <a href="#F.10.3.12">F.10.3.12</a>
31444 matching failure, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.8">7.28.2.8</a>, <a href="#7.28.2.10">7.28.2.10</a>, modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
31445 <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a> modification order, <a href="#5.1.2.4">5.1.2.4</a>
31446 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.24">7.24</a>, <a href="#F">F</a>, modulus functions, <a href="#7.12.6.12">7.12.6.12</a>
31447 <a href="#F.10">F.10</a>, <a href="#J.5.17">J.5.17</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
31448 MATH_ERREXCEPT macro, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a> mtx_destroy function, <a href="#7.25.4.1">7.25.4.1</a>
31449 math_errhandling macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a> mtx_init function, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.4.2">7.25.4.2</a>
31450 MATH_ERRNO macro, <a href="#7.12">7.12</a> mtx_lock function, <a href="#7.25.4.3">7.25.4.3</a>
31451 max_align_t type, <a href="#7.19">7.19</a> mtx_t type, <a href="#7.25.1">7.25.1</a>
31452 maximum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a> mtx_timedlock function, <a href="#7.25.4.4">7.25.4.4</a>
31453 MB_CUR_MAX macro, <a href="#7.1.1">7.1.1</a>, <a href="#7.22">7.22</a>, <a href="#7.22.7.2">7.22.7.2</a>, mtx_trylock function, <a href="#7.25.4.5">7.25.4.5</a>
31454 <a href="#7.22.7.3">7.22.7.3</a>, <a href="#7.27.1.2">7.27.1.2</a>, <a href="#7.27.1.4">7.27.1.4</a>, <a href="#7.28.6.3.3">7.28.6.3.3</a>, mtx_unlock function, <a href="#7.25.4.3">7.25.4.3</a>, <a href="#7.25.4.4">7.25.4.4</a>,
31455 <a href="#K.3.6.4.1">K.3.6.4.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a> <a href="#7.25.4.5">7.25.4.5</a>, <a href="#7.25.4.6">7.25.4.6</a>
31456 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.22">7.22</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>
31457 mblen function, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.28.6.3">7.28.6.3</a> multibyte conversion functions
31458 mbrlen function, <a href="#7.28.6.3.1">7.28.6.3.1</a> wide character, <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a>
31459 mbrtoc16 function, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.27.1.1">7.27.1.1</a> extended, <a href="#7.28.6">7.28.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
31460 mbrtoc32 function, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.27.1.3">7.27.1.3</a> restartable, <a href="#7.27.1">7.27.1</a>, <a href="#7.28.6.3">7.28.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>
31461 mbrtowc function, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, wide string, <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>
31462 <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#7.28.6.3.1">7.28.6.3.1</a>, <a href="#7.28.6.3.2">7.28.6.3.2</a>, restartable, <a href="#7.28.6.4">7.28.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
31463 <a href="#7.28.6.4.1">7.28.6.4.1</a>, <a href="#K.3.6.5.1">K.3.6.5.1</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a> multibyte string, <a href="#7.1.1">7.1.1</a>
31464 mbsinit function, <a href="#7.28.6.2.1">7.28.6.2.1</a> multibyte/wide character conversion functions,
31465 mbsrtowcs function, <a href="#7.28.6.4.1">7.28.6.4.1</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a>
31466 mbsrtowcs_s function, <a href="#K.3.9.3.2">K.3.9.3.2</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a> extended, <a href="#7.28.6">7.28.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
31467 mbstate_t type, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, restartable, <a href="#7.27.1">7.27.1</a>, <a href="#7.28.6.3">7.28.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>
31468 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.27">7.27</a>, <a href="#7.27.1">7.27.1</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.28.2.1">7.28.2.1</a>, multibyte/wide string conversion functions,
31469 <a href="#7.28.2.2">7.28.2.2</a>, <a href="#7.28.6">7.28.6</a>, <a href="#7.28.6.2.1">7.28.6.2.1</a>, <a href="#7.28.6.3">7.28.6.3</a>, <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>
31470 <a href="#7.28.6.3.1">7.28.6.3.1</a>, <a href="#7.28.6.4">7.28.6.4</a> restartable, <a href="#7.28.6.4">7.28.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
31471 mbstowcs function, <a href="#6.4.5">6.4.5</a>, <a href="#7.22.8.1">7.22.8.1</a>, <a href="#7.28.6.4">7.28.6.4</a> multidimensional array, <a href="#6.5.2.1">6.5.2.1</a>
31472 mbstowcs_s function, <a href="#K.3.6.5.1">K.3.6.5.1</a> multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>
31473 mbtowc function, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.22.7.2">7.22.7.2</a>, multiplication operator (*), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>,
31474 <a href="#7.22.8.1">7.22.8.1</a>, <a href="#7.28.6.3">7.28.6.3</a> <a href="#G.5.1">G.5.1</a>
31475 member access operators (. and -&gt;), <a href="#6.5.2.3">6.5.2.3</a> multiplicative expressions, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
31476 member alignment, <a href="#6.7.2.1">6.7.2.1</a>
31477 memchr function, <a href="#7.23.5.1">7.23.5.1</a> n-char sequence, <a href="#7.22.1.3">7.22.1.3</a>
31478 memcmp function, <a href="#7.23.4">7.23.4</a>, <a href="#7.23.4.1">7.23.4.1</a> n-wchar sequence, <a href="#7.28.4.1.1">7.28.4.1.1</a>
31479 memcpy function, <a href="#7.23.2.1">7.23.2.1</a> name
31480 memcpy_s function, <a href="#K.3.7.1.1">K.3.7.1.1</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>
31481 memmove function, <a href="#7.23.2.2">7.23.2.2</a> file, <a href="#7.21.3">7.21.3</a>
31482 memmove_s function, <a href="#K.3.7.1.2">K.3.7.1.2</a> internal, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
31483 memory location, <a href="#3.14">3.14</a> label, <a href="#6.2.3">6.2.3</a>
31484 memory management functions, <a href="#7.22.3">7.22.3</a> structure/union member, <a href="#6.2.3">6.2.3</a>
31485 memory_order type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.3">7.17.3</a> name spaces, <a href="#6.2.3">6.2.3</a>
31486 memset function, <a href="#7.23.6.1">7.23.6.1</a>, <a href="#K.3.7.4.1">K.3.7.4.1</a> named label, <a href="#6.8.1">6.8.1</a>
31487 memset_s function, <a href="#K.3.7.4.1">K.3.7.4.1</a> NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31488 minimum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a> 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.10.8.2">F.10.8.2</a>
31489 minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a> NAN macro, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a>
31490 miscellaneous functions NDEBUG macro, <a href="#7.2">7.2</a>
31491 string, <a href="#7.23.6">7.23.6</a>, <a href="#K.3.7.4">K.3.7.4</a> 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>,
31492 wide string, <a href="#7.28.4.6">7.28.4.6</a>, <a href="#K.3.9.2.4">K.3.9.2.4</a> <a href="#F.10.6.3">F.10.6.3</a>
31493 mktime function, <a href="#7.26.2.3">7.26.2.3</a> nearbyint type-generic macro, <a href="#7.24">7.24</a>
31494 <!--page 687 -->
31495 nearest integer functions, <a href="#7.12.9">7.12.9</a>, <a href="#F.10.6">F.10.6</a> operating system, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#7.22.4.8">7.22.4.8</a>
31496 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> operations on files, <a href="#7.21.4">7.21.4</a>, <a href="#K.3.5.1">K.3.5.1</a>
31497 negative zero, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.12.11.1">7.12.11.1</a> operator, <a href="#6.4.6">6.4.6</a>
31498 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> operators, <a href="#6.5">6.5</a>
31499 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>, additive, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>
31500 <a href="#7.4.1.10">7.4.1.10</a> alignof, <a href="#6.5.3.4">6.5.3.4</a>
31501 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>, assignment, <a href="#6.5.16">6.5.16</a>
31502 <a href="#F.10.8.3">F.10.8.3</a> associativity, <a href="#6.5">6.5</a>
31503 nextafter type-generic macro, <a href="#7.24">7.24</a> equality, <a href="#6.5.9">6.5.9</a>
31504 nexttoward functions, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, <a href="#F.10.8.4">F.10.8.4</a> multiplicative, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
31505 nexttoward type-generic macro, <a href="#7.24">7.24</a> postfix, <a href="#6.5.2">6.5.2</a>
31506 no linkage, <a href="#6.2.2">6.2.2</a> precedence, <a href="#6.5">6.5</a>
31507 no-return function, <a href="#6.7.4">6.7.4</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>
31508 non-stop floating-point control mode, <a href="#7.6.4.2">7.6.4.2</a> relational, <a href="#6.5.8">6.5.8</a>
31509 nongraphic characters, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> shift, <a href="#6.5.7">6.5.7</a>
31510 nonlocal jumps header, <a href="#7.13">7.13</a> sizeof, <a href="#6.5.3.4">6.5.3.4</a>
31511 norm, complex, <a href="#7.3.8.1">7.3.8.1</a> unary, <a href="#6.5.3">6.5.3</a>
31512 normalized broken-down time, <a href="#K.3.8.1">K.3.8.1</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a> unary arithmetic, <a href="#6.5.3.3">6.5.3.3</a>
31513 not macro, <a href="#7.9">7.9</a> optional features, see conditional features
31514 not-equal-to operator, see inequality operator or macro, <a href="#7.9">7.9</a>
31515 not_eq macro, <a href="#7.9">7.9</a> OR operators
31516 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> bitwise exclusive (^), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
31517 padding of binary stream, <a href="#7.21.2">7.21.2</a> bitwise exclusive assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
31518 NULL macro, <a href="#7.11">7.11</a>, <a href="#7.19">7.19</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.22">7.22</a>, <a href="#7.23.1">7.23.1</a>, bitwise inclusive (|), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>
31519 <a href="#7.26.1">7.26.1</a>, <a href="#7.28.1">7.28.1</a> bitwise inclusive assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
31520 null pointer, <a href="#6.3.2.3">6.3.2.3</a> logical (||), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a>
31521 null pointer constant, <a href="#6.3.2.3">6.3.2.3</a> or_eq macro, <a href="#7.9">7.9</a>
31522 null preprocessing directive, <a href="#6.10.7">6.10.7</a> order of allocated storage, <a href="#7.22.3">7.22.3</a>
31523 null statement, <a href="#6.8.3">6.8.3</a> order of evaluation, <a href="#6.5">6.5</a>, <a href="#6.5.16">6.5.16</a>, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>,
31524 null wide character, <a href="#7.1.1">7.1.1</a> see also sequence points
31525 number classification macros, <a href="#7.12">7.12</a>, <a href="#7.12.3.1">7.12.3.1</a> ordinary identifier name space, <a href="#6.2.3">6.2.3</a>
31526 numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a> orientation of stream, <a href="#7.21.2">7.21.2</a>, <a href="#7.28.3.5">7.28.3.5</a>
31527 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.28.4.1">7.28.4.1</a> out-of-bounds store, <a href="#L.2.1">L.2.1</a>
31528 numerical limits, <a href="#5.2.4.2">5.2.4.2</a> outer scope, <a href="#6.2.1">6.2.1</a>
31529 over-aligned, <a href="#6.2.8">6.2.8</a>
31530 object, <a href="#3.15">3.15</a>
31531 object representation, <a href="#6.2.6.1">6.2.6.1</a> padding
31532 object type, <a href="#6.2.5">6.2.5</a> binary stream, <a href="#7.21.2">7.21.2</a>
31533 object-like macro, <a href="#6.10.3">6.10.3</a> bits, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.20.1.1">7.20.1.1</a>
31534 observable behavior, <a href="#5.1.2.3">5.1.2.3</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>
31535 obsolescence, <a href="#6.11">6.11</a>, <a href="#7.30">7.30</a> parameter, <a href="#3.16">3.16</a>
31536 octal constant, <a href="#6.4.4.1">6.4.4.1</a> array, <a href="#6.9.1">6.9.1</a>
31537 octal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.4">6.4.4.4</a> ellipsis, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a>
31538 octal-character escape sequence (\octal digits), 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>
31539 <a href="#6.4.4.4">6.4.4.4</a> macro, <a href="#6.10.3">6.10.3</a>
31540 offsetof macro, <a href="#7.19">7.19</a> main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>
31541 on-off switch, <a href="#6.10.6">6.10.6</a> program, <a href="#5.1.2.2.1">5.1.2.2.1</a>
31542 once_flag type, <a href="#7.25.1">7.25.1</a> parameter type list, <a href="#6.7.6.3">6.7.6.3</a>
31543 ONCE_FLAG_INIT macro, <a href="#7.25.1">7.25.1</a> parentheses punctuator (( )), <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a>
31544 ones' complement, <a href="#6.2.6.2">6.2.6.2</a> parenthesized expression, <a href="#6.5.1">6.5.1</a>
31545 operand, <a href="#6.4.6">6.4.6</a>, <a href="#6.5">6.5</a> parse state, <a href="#7.21.2">7.21.2</a>
31546 <!--page 688 -->
31547 perform a trap, <a href="#3.19.5">3.19.5</a> preprocessor, <a href="#6.10">6.10</a>
31548 permitted form of initializer, <a href="#6.6">6.6</a> PRIcFASTN macros, <a href="#7.8.1">7.8.1</a>
31549 perror function, <a href="#7.21.10.4">7.21.10.4</a> PRIcLEASTN macros, <a href="#7.8.1">7.8.1</a>
31550 phase angle, complex, <a href="#7.3.9.1">7.3.9.1</a> PRIcMAX macros, <a href="#7.8.1">7.8.1</a>
31551 physical source lines, <a href="#5.1.1.2">5.1.1.2</a> PRIcN macros, <a href="#7.8.1">7.8.1</a>
31552 placemarker, <a href="#6.10.3.3">6.10.3.3</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
31553 plus operator, unary, <a href="#6.5.3.3">6.5.3.3</a> primary expression, <a href="#6.5.1">6.5.1</a>
31554 pointer arithmetic, <a href="#6.5.6">6.5.6</a> printf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.21.6.10">7.21.6.10</a>,
31555 pointer comparison, <a href="#6.5.8">6.5.8</a> <a href="#K.3.5.3.3">K.3.5.3.3</a>
31556 pointer declarator, <a href="#6.7.6.1">6.7.6.1</a> printf_s function, <a href="#K.3.5.3.3">K.3.5.3.3</a>
31557 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.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>
31558 pointer to function, <a href="#6.5.2.2">6.5.2.2</a> printing wide character, <a href="#7.29.2">7.29.2</a>
31559 pointer type, <a href="#6.2.5">6.2.5</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
31560 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 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>
31561 pointer, null, <a href="#6.3.2.3">6.3.2.3</a> program file, <a href="#5.1.1.1">5.1.1.1</a>
31562 pole 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.6.7">7.12.6.7</a>, <a href="#7.12.6.8">7.12.6.8</a>, program image, <a href="#5.1.1.2">5.1.1.2</a>
31563 <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>, <a href="#7.12.7.4">7.12.7.4</a>, program name (argv[0]), <a href="#5.1.2.2.1">5.1.2.2.1</a>
31564 <a href="#7.12.8.3">7.12.8.3</a>, <a href="#7.12.8.4">7.12.8.4</a> program parameters, <a href="#5.1.2.2.1">5.1.2.2.1</a>
31565 portability, <a href="#4">4</a>, <a href="#J">J</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>
31566 position indicator, file, see file position indicator program structure, <a href="#5.1.1.1">5.1.1.1</a>
31567 positive difference, <a href="#7.12.12.1">7.12.12.1</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>,
31568 positive difference functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a> <a href="#5.1.2.3">5.1.2.3</a>
31569 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> program, conforming, <a href="#4">4</a>
31570 postfix expressions, <a href="#6.5.2">6.5.2</a> program, strictly conforming, <a href="#4">4</a>
31571 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> promotions
31572 pow functions, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#F.10.4.4">F.10.4.4</a> default argument, <a href="#6.5.2.2">6.5.2.2</a>
31573 pow type-generic macro, <a href="#7.24">7.24</a> integer, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.3.1.1">6.3.1.1</a>
31574 power functions prototype, see function prototype
31575 complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a> pseudo-random sequence functions, <a href="#7.22.2">7.22.2</a>
31576 real, <a href="#7.12.7">7.12.7</a>, <a href="#F.10.4">F.10.4</a> PTRDIFF_MAX macro, <a href="#7.20.3">7.20.3</a>
31577 pp-number, <a href="#6.4.8">6.4.8</a> PTRDIFF_MIN macro, <a href="#7.20.3">7.20.3</a>
31578 pragma operator, <a href="#6.10.9">6.10.9</a> ptrdiff_t type, <a href="#7.17.1">7.17.1</a>, <a href="#7.19">7.19</a>, <a href="#7.20.3">7.20.3</a>, <a href="#7.21.6.1">7.21.6.1</a>,
31579 pragma preprocessing directive, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a> <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>
31580 precedence of operators, <a href="#6.5">6.5</a> punctuators, <a href="#6.4.6">6.4.6</a>
31581 precedence of syntax rules, <a href="#5.1.1.2">5.1.1.2</a> putc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.21.7.8">7.21.7.8</a>
31582 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.21.6.1">7.21.6.1</a>, <a href="#7.28.2.1">7.28.2.1</a> putchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.8">7.21.7.8</a>
31583 excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> puts function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.9">7.21.7.9</a>
31584 predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a> putwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.8">7.28.3.8</a>, <a href="#7.28.3.9">7.28.3.9</a>
31585 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> putwchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.9">7.28.3.9</a>
31586 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>
31587 preprocessing concatenation, <a href="#6.10.3.3">6.10.3.3</a> qsort function, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.2">7.22.5.2</a>
31588 preprocessing directives, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10">6.10</a> qsort_s function, <a href="#K.3.6.3">K.3.6.3</a>, <a href="#K.3.6.3.2">K.3.6.3.2</a>
31589 preprocessing file, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.10">6.10</a> qualified types, <a href="#6.2.5">6.2.5</a>
31590 preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a> qualified version of type, <a href="#6.2.5">6.2.5</a>
31591 preprocessing operators question-mark escape sequence (\?), <a href="#6.4.4.4">6.4.4.4</a>
31592 #, <a href="#6.10.3.2">6.10.3.2</a> quick_exit function, <a href="#7.22.4.3">7.22.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a>,
31593 ##, <a href="#6.10.3.3">6.10.3.3</a> <a href="#7.22.4.7">7.22.4.7</a>
31594 _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> quiet NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31595 defined, <a href="#6.10.1">6.10.1</a>
31596 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> 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.22.4.1">7.22.4.1</a>
31597 preprocessing translation unit, <a href="#5.1.1.1">5.1.1.1</a> rand function, <a href="#7.22">7.22</a>, <a href="#7.22.2.1">7.22.2.1</a>, <a href="#7.22.2.2">7.22.2.2</a>
31598 <!--page 689 -->
31599 RAND_MAX macro, <a href="#7.22">7.22</a>, <a href="#7.22.2.1">7.22.2.1</a> restrict-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a>
31600 range return statement, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
31601 excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> rewind function, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.5">7.21.9.5</a>,
31602 range error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#7.28.3.10">7.28.3.10</a>
31603 <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>, <a href="#7.12.6.6">7.12.6.6</a>, right-shift assignment operator (&gt;&gt;=), <a href="#6.5.16.2">6.5.16.2</a>
31604 <a href="#7.12.6.13">7.12.6.13</a>, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.8.2">7.12.8.2</a>, right-shift operator (&gt;&gt;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
31605 <a href="#7.12.8.3">7.12.8.3</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.12.9.7">7.12.9.7</a>, rint functions, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, <a href="#F.10.6.4">F.10.6.4</a>
31606 <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#7.12.13.1">7.12.13.1</a> rint type-generic macro, <a href="#7.24">7.24</a>
31607 rank, see integer conversion rank round functions, <a href="#7.12.9.6">7.12.9.6</a>, <a href="#F.10.6.6">F.10.6.6</a>
31608 read-modify-write operations, <a href="#5.1.2.4">5.1.2.4</a> round type-generic macro, <a href="#7.24">7.24</a>
31609 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>, rounding mode, floating point, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31610 <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> RSIZE_MAX macro, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>,
31611 real floating types, <a href="#6.2.5">6.2.5</a> <a href="#K.3.5.3.5">K.3.5.3.5</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a>, <a href="#K.3.5.3.12">K.3.5.3.12</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>,
31612 real type domain, <a href="#6.2.5">6.2.5</a> <a href="#K.3.5.4.1">K.3.5.4.1</a>, <a href="#K.3.6.2.1">K.3.6.2.1</a>, <a href="#K.3.6.3.1">K.3.6.3.1</a>, <a href="#K.3.6.3.2">K.3.6.3.2</a>,
31613 real types, <a href="#6.2.5">6.2.5</a> <a href="#K.3.6.4.1">K.3.6.4.1</a>, <a href="#K.3.6.5.1">K.3.6.5.1</a>, <a href="#K.3.6.5.2">K.3.6.5.2</a>, <a href="#K.3.7.1.1">K.3.7.1.1</a>,
31614 real-floating, <a href="#7.12.3">7.12.3</a> <a href="#K.3.7.1.2">K.3.7.1.2</a>, <a href="#K.3.7.1.3">K.3.7.1.3</a>, <a href="#K.3.7.1.4">K.3.7.1.4</a>, <a href="#K.3.7.2.1">K.3.7.2.1</a>,
31615 realloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.5">7.22.3.5</a> <a href="#K.3.7.2.2">K.3.7.2.2</a>, <a href="#K.3.7.3.1">K.3.7.3.1</a>, <a href="#K.3.7.4.1">K.3.7.4.1</a>, <a href="#K.3.7.4.2">K.3.7.4.2</a>,
31616 recommended practice, <a href="#3.17">3.17</a> <a href="#K.3.8.2.1">K.3.8.2.1</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>, <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a>,
31617 recursion, <a href="#6.5.2.2">6.5.2.2</a> <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#K.3.9.1.9">K.3.9.1.9</a>, <a href="#K.3.9.2.1.1">K.3.9.2.1.1</a>, <a href="#K.3.9.2.1.2">K.3.9.2.1.2</a>,
31618 recursive function call, <a href="#6.5.2.2">6.5.2.2</a> <a href="#K.3.9.2.1.3">K.3.9.2.1.3</a>, <a href="#K.3.9.2.1.4">K.3.9.2.1.4</a>, <a href="#K.3.9.2.2.1">K.3.9.2.2.1</a>,
31619 redefinition of macro, <a href="#6.10.3">6.10.3</a> <a href="#K.3.9.2.2.2">K.3.9.2.2.2</a>, <a href="#K.3.9.2.3.1">K.3.9.2.3.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>,
31620 reentrancy, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a> <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>
31621 library functions, <a href="#7.1.4">7.1.4</a> rsize_t type, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>,
31622 referenced type, <a href="#6.2.5">6.2.5</a> <a href="#K.3.6">K.3.6</a>, <a href="#K.3.7">K.3.7</a>, <a href="#K.3.8">K.3.8</a>, <a href="#K.3.9">K.3.9</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>
31623 register storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a> runtime-constraint, <a href="#3.18">3.18</a>
31624 relational expressions, <a href="#6.5.8">6.5.8</a> Runtime-constraint handling functions, <a href="#K.3.6.1">K.3.6.1</a>
31625 relaxed atomic operations, <a href="#5.1.2.4">5.1.2.4</a> rvalue, <a href="#6.3.2.1">6.3.2.1</a>
31626 release fence, <a href="#7.17.4">7.17.4</a>
31627 release operation, <a href="#5.1.2.4">5.1.2.4</a> same scope, <a href="#6.2.1">6.2.1</a>
31628 release sequence, <a href="#5.1.2.4">5.1.2.4</a> save calling environment function, <a href="#7.13.1">7.13.1</a>
31629 reliability of data, interrupted, <a href="#5.1.2.3">5.1.2.3</a> scalar types, <a href="#6.2.5">6.2.5</a>
31630 remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a> scalbln function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.10.3.13">F.10.3.13</a>
31631 remainder functions, <a href="#7.12.10">7.12.10</a>, <a href="#F.10.7">F.10.7</a> scalbln type-generic macro, <a href="#7.24">7.24</a>
31632 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>, scalbn function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.10.3.13">F.10.3.13</a>
31633 <a href="#F.10.7.2">F.10.7.2</a> scalbn type-generic macro, <a href="#7.24">7.24</a>
31634 remainder operator (%), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a> scanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.4">7.21.6.4</a>, <a href="#7.21.6.11">7.21.6.11</a>
31635 remainder type-generic macro, <a href="#7.24">7.24</a> scanf_s function, <a href="#K.3.5.3.4">K.3.5.3.4</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>
31636 remove function, <a href="#7.21.4.1">7.21.4.1</a>, <a href="#7.21.4.4">7.21.4.4</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a> scanlist, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>
31637 remquo functions, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>, <a href="#F.10.7.3">F.10.7.3</a> scanset, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>
31638 remquo type-generic macro, <a href="#7.24">7.24</a> SCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
31639 rename function, <a href="#7.21.4.2">7.21.4.2</a> SCHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
31640 representations of types, <a href="#6.2.6">6.2.6</a> SCNcFASTN macros, <a href="#7.8.1">7.8.1</a>
31641 pointer, <a href="#6.2.5">6.2.5</a> SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>
31642 rescanning and replacement, <a href="#6.10.3.4">6.10.3.4</a> SCNcMAX macros, <a href="#7.8.1">7.8.1</a>
31643 reserved identifiers, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a>, <a href="#K.3.1.2">K.3.1.2</a> SCNcN macros, <a href="#7.8.1">7.8.1</a>
31644 restartable multibyte/wide character conversion SCNcPTR macros, <a href="#7.8.1">7.8.1</a>
31645 functions, <a href="#7.27.1">7.27.1</a>, <a href="#7.28.6.3">7.28.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a> scope of identifier, <a href="#6.2.1">6.2.1</a>, <a href="#6.9.2">6.9.2</a>
31646 restartable multibyte/wide string conversion search functions
31647 functions, <a href="#7.28.6.4">7.28.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> string, <a href="#7.23.5">7.23.5</a>, <a href="#K.3.7.3">K.3.7.3</a>
31648 restore calling environment function, <a href="#7.13.2">7.13.2</a> utility, <a href="#7.22.5">7.22.5</a>, <a href="#K.3.6.3">K.3.6.3</a>
31649 restrict type qualifier, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a> wide string, <a href="#7.28.4.5">7.28.4.5</a>, <a href="#K.3.9.2.3">K.3.9.2.3</a>
31650 <!--page 690 -->
31651 SEEK_CUR macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.9.2">7.21.9.2</a> sign and magnitude, <a href="#6.2.6.2">6.2.6.2</a>
31652 SEEK_END macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.9.2">7.21.9.2</a> sign bit, <a href="#6.2.6.2">6.2.6.2</a>
31653 SEEK_SET macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.9.2">7.21.9.2</a> signal function, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>
31654 selection statements, <a href="#6.8.4">6.8.4</a> 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>
31655 self-referential structure, <a href="#6.7.2.3">6.7.2.3</a> signal handling functions, <a href="#7.14.1">7.14.1</a>
31656 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>, signal.h header, <a href="#7.14">7.14</a>, <a href="#7.30.6">7.30.6</a>
31657 <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a> signaling NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#F.2.1">F.2.1</a>
31658 separate compilation, <a href="#5.1.1.1">5.1.1.1</a> 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>
31659 separate translation, <a href="#5.1.1.1">5.1.1.1</a> signbit macro, <a href="#7.12.3.6">7.12.3.6</a>, <a href="#F.3">F.3</a>
31660 sequence points, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.13">6.5.13</a>, <a href="#6.5.14">6.5.14</a>, signed char type, <a href="#6.2.5">6.2.5</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
31661 <a href="#6.5.15">6.5.15</a>, <a href="#6.5.17">6.5.17</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a>, <a href="#6.7.6">6.7.6</a>, <a href="#6.8">6.8</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>
31662 <a href="#7.1.4">7.1.4</a>, <a href="#7.21.6">7.21.6</a>, <a href="#7.22.5">7.22.5</a>, <a href="#7.28.2">7.28.2</a>, <a href="#C">C</a>, <a href="#K.3.6.3">K.3.6.3</a> signed character, <a href="#6.3.1.1">6.3.1.1</a>
31663 sequenced after, see sequenced before 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>
31664 sequenced before, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.2.4">6.5.2.4</a>, 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>,
31665 <a href="#6.5.16">6.5.16</a>, see also indeterminately sequenced, <a href="#6.3.1.8">6.3.1.8</a>
31666 unsequenced signed types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>
31667 sequencing of statements, <a href="#6.8">6.8</a> significand part, <a href="#6.4.4.2">6.4.4.2</a>
31668 set_constraint_handler_s function, SIGSEGV macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
31669 <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6.1.1">K.3.6.1.1</a>, <a href="#K.3.6.1.2">K.3.6.1.2</a>, <a href="#K.3.6.1.3">K.3.6.1.3</a> SIGTERM macro, <a href="#7.14">7.14</a>
31670 setbuf function, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.1">7.21.5.1</a>, <a href="#7.21.5.5">7.21.5.5</a> simple assignment operator (=), <a href="#6.5.16.1">6.5.16.1</a>
31671 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> sin functions, <a href="#7.12.4.6">7.12.4.6</a>, <a href="#F.10.1.6">F.10.1.6</a>
31672 setjmp.h header, <a href="#7.13">7.13</a> sin type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
31673 setlocale function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a> single-byte character, <a href="#3.7.1">3.7.1</a>, <a href="#5.2.1.2">5.2.1.2</a>
31674 setvbuf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.1">7.21.5.1</a>, single-byte/wide character conversion functions,
31675 <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a> <a href="#7.28.6.1">7.28.6.1</a>
31676 shall, <a href="#4">4</a> single-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a>
31677 shift expressions, <a href="#6.5.7">6.5.7</a> single-quote escape sequence (\'), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>
31678 shift sequence, <a href="#7.1.1">7.1.1</a> singularity, <a href="#7.12.1">7.12.1</a>
31679 shift states, <a href="#5.2.1.2">5.2.1.2</a> sinh functions, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#F.10.2.5">F.10.2.5</a>
31680 short identifier, character, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.3">6.4.3</a> sinh type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
31681 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.21.6.1">7.21.6.1</a>, SIZE_MAX macro, <a href="#7.20.3">7.20.3</a>
31682 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a> size_t type, <a href="#6.2.8">6.2.8</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#7.19">7.19</a>, <a href="#7.20.3">7.20.3</a>, <a href="#7.21.1">7.21.1</a>,
31683 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>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22">7.22</a>, <a href="#7.23.1">7.23.1</a>, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>,
31684 <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a> <a href="#7.28.1">7.28.1</a>, <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>,
31685 SHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> <a href="#K.3.5">K.3.5</a>, <a href="#K.3.6">K.3.6</a>, <a href="#K.3.7">K.3.7</a>, <a href="#K.3.8">K.3.8</a>, <a href="#K.3.9">K.3.9</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>
31686 SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> 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>
31687 side effects, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.3.2.2">6.3.2.2</a>, <a href="#6.5">6.5</a>, <a href="#6.5.2.4">6.5.2.4</a>, snprintf function, <a href="#7.21.6.5">7.21.6.5</a>, <a href="#7.21.6.12">7.21.6.12</a>,
31688 <a href="#6.5.16">6.5.16</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.8.3">6.8.3</a>, <a href="#7.6">7.6</a>, <a href="#7.6.1">7.6.1</a>, <a href="#7.21.7.5">7.21.7.5</a>, <a href="#K.3.5.3.5">K.3.5.3.5</a>
31689 <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.28.3.6">7.28.3.6</a>, <a href="#7.28.3.8">7.28.3.8</a>, <a href="#F.8.1">F.8.1</a>, <a href="#F.9.1">F.9.1</a>, snprintf_s function, <a href="#K.3.5.3.5">K.3.5.3.5</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a>
31690 <a href="#F.9.3">F.9.3</a> snwprintf_s function, <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a>
31691 SIG_ATOMIC_MAX macro, <a href="#7.20.3">7.20.3</a> sorting utility functions, <a href="#7.22.5">7.22.5</a>, <a href="#K.3.6.3">K.3.6.3</a>
31692 SIG_ATOMIC_MIN macro, <a href="#7.20.3">7.20.3</a> source character set, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>
31693 sig_atomic_t type, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, source file, <a href="#5.1.1.1">5.1.1.1</a>
31694 <a href="#7.20.3">7.20.3</a> name, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8.1">6.10.8.1</a>
31695 SIG_DFL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> source file inclusion, <a href="#6.10.2">6.10.2</a>
31696 SIG_ERR macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> source lines, <a href="#5.1.1.2">5.1.1.2</a>
31697 SIG_IGN macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> source text, <a href="#5.1.1.2">5.1.1.2</a>
31698 SIGABRT macro, <a href="#7.14">7.14</a>, <a href="#7.22.4.1">7.22.4.1</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>,
31699 SIGFPE macro, <a href="#7.12.1">7.12.1</a>, <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> <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.29.2.1.3">7.29.2.1.3</a>
31700 SIGILL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sprintf function, <a href="#7.21.6.6">7.21.6.6</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a>
31701 SIGINT macro, <a href="#7.14">7.14</a> sprintf_s function, <a href="#K.3.5.3.5">K.3.5.3.5</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a>
31702 <!--page 691 -->
31703 sqrt functions, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10.4.5">F.10.4.5</a> do, <a href="#6.8.5.2">6.8.5.2</a>
31704 sqrt type-generic macro, <a href="#7.24">7.24</a> else, <a href="#6.8.4.1">6.8.4.1</a>
31705 srand function, <a href="#7.22.2.2">7.22.2.2</a> expression, <a href="#6.8.3">6.8.3</a>
31706 sscanf function, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.14">7.21.6.14</a> for, <a href="#6.8.5.3">6.8.5.3</a>
31707 sscanf_s function, <a href="#K.3.5.3.7">K.3.5.3.7</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a> goto, <a href="#6.8.6.1">6.8.6.1</a>
31708 standard error stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.10.4">7.21.10.4</a> if, <a href="#6.8.4.1">6.8.4.1</a>
31709 standard headers, <a href="#4">4</a>, <a href="#7.1.2">7.1.2</a> iteration, <a href="#6.8.5">6.8.5</a>
31710 <a href="#7.2">&lt;assert.h&gt;</a>, <a href="#7.2">7.2</a> jump, <a href="#6.8.6">6.8.6</a>
31711 <a href="#7.3">&lt;complex.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.3">7.3</a>, labeled, <a href="#6.8.1">6.8.1</a>
31712 <a href="#7.24">7.24</a>, <a href="#7.30.1">7.30.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a> null, <a href="#6.8.3">6.8.3</a>
31713 <a href="#7.4">&lt;ctype.h&gt;</a>, <a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a> return, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
31714 <a href="#7.5">&lt;errno.h&gt;</a>, <a href="#7.5">7.5</a>, <a href="#7.30.3">7.30.3</a>, <a href="#K.3.2">K.3.2</a> selection, <a href="#6.8.4">6.8.4</a>
31715 <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> sequencing, <a href="#6.8">6.8</a>
31716 <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.22.1.3">7.22.1.3</a>, switch, <a href="#6.8.4.2">6.8.4.2</a>
31717 <a href="#7.28.4.1.1">7.28.4.1.1</a> while, <a href="#6.8.5.1">6.8.5.1</a>
31718 <a href="#7.8">&lt;inttypes.h&gt;</a>, <a href="#7.8">7.8</a>, <a href="#7.30.4">7.30.4</a> static assertions, <a href="#6.7.10">6.7.10</a>
31719 <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#4">4</a>, <a href="#7.9">7.9</a> static storage duration, <a href="#6.2.4">6.2.4</a>
31720 <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> 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>
31721 <a href="#7.11">&lt;locale.h&gt;</a>, <a href="#7.11">7.11</a>, <a href="#7.30.5">7.30.5</a> static, in array declarators, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.6.3">6.7.6.3</a>
31722 <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.24">7.24</a>, <a href="#F">F</a>, <a href="#F.10">F.10</a>, static_assert declaration, <a href="#6.7.10">6.7.10</a>
31723 <a href="#J.5.17">J.5.17</a> static_assert macro, <a href="#7.2">7.2</a>
31724 <a href="#7.13">&lt;setjmp.h&gt;</a>, <a href="#7.13">7.13</a> stdalign.h header, <a href="#4">4</a>, <a href="#7.15">7.15</a>
31725 <a href="#7.14">&lt;signal.h&gt;</a>, <a href="#7.14">7.14</a>, <a href="#7.30.6">7.30.6</a> stdarg.h header, <a href="#4">4</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#7.16">7.16</a>
31726 <a href="#7.15">&lt;stdalign.h&gt;</a>, <a href="#4">4</a>, <a href="#7.15">7.15</a> stdatomic.h header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.17">7.17</a>
31727 <a href="#7.16">&lt;stdarg.h&gt;</a>, <a href="#4">4</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#7.16">7.16</a> stdbool.h header, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.30.7">7.30.7</a>, <a href="#H">H</a>
31728 <a href="#7.17">&lt;stdatomic.h&gt;</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.17">7.17</a> STDC, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a>
31729 <a href="#7.18">&lt;stdbool.h&gt;</a>, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.30.7">7.30.7</a>, <a href="#H">H</a> stddef.h header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>,
31730 <a href="#7.19">&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>, <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.19">7.19</a>, <a href="#K.3.3">K.3.3</a>
31731 <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.19">7.19</a>, <a href="#K.3.3">K.3.3</a> stderr macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>
31732 <a href="#7.20">&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.20">7.20</a>, stdin macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.4">7.21.6.4</a>,
31733 <a href="#7.30.8">7.30.8</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a> <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.28.2.12">7.28.2.12</a>, <a href="#7.28.3.7">7.28.3.7</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>,
31734 <a href="#7.21">&lt;stdio.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21">7.21</a>, <a href="#7.30.9">7.30.9</a>, <a href="#F">F</a>, <a href="#K.3.5">K.3.5</a> <a href="#K.3.5.4.1">K.3.5.4.1</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a>
31735 <a href="#7.22">&lt;stdlib.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.22">7.22</a>, <a href="#7.30.10">7.30.10</a>, <a href="#F">F</a>, stdint.h header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.20">7.20</a>,
31736 <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a> <a href="#7.30.8">7.30.8</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>
31737 <a href="#7.23">&lt;string.h&gt;</a>, <a href="#7.23">7.23</a>, <a href="#7.30.11">7.30.11</a>, <a href="#K.3.7">K.3.7</a> stdio.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21">7.21</a>, <a href="#7.30.9">7.30.9</a>, <a href="#F">F</a>, <a href="#K.3.5">K.3.5</a>
31738 <a href="#7.24">&lt;tgmath.h&gt;</a>, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> stdlib.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.22">7.22</a>, <a href="#7.30.10">7.30.10</a>, <a href="#F">F</a>,
31739 <a href="#7.25">&lt;threads.h&gt;</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.25">7.25</a> <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a>
31740 <a href="#7.26">&lt;time.h&gt;</a>, <a href="#7.26">7.26</a>, <a href="#K.3.8">K.3.8</a> stdout macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.3">7.21.6.3</a>,
31741 <a href="#7.27">&lt;uchar.h&gt;</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.27">7.27</a> <a href="#7.21.7.8">7.21.7.8</a>, <a href="#7.21.7.9">7.21.7.9</a>, <a href="#7.28.2.11">7.28.2.11</a>, <a href="#7.28.3.9">7.28.3.9</a>
31742 <a href="#7.28">&lt;wchar.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.28">7.28</a>, <a href="#7.30.12">7.30.12</a>, storage duration, <a href="#6.2.4">6.2.4</a>
31743 <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a> storage order of array, <a href="#6.5.2.1">6.5.2.1</a>
31744 <a href="#7.29">&lt;wctype.h&gt;</a>, <a href="#7.29">7.29</a>, <a href="#7.30.13">7.30.13</a> storage unit (bit-field), <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.7.2.1">6.7.2.1</a>
31745 standard input stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> storage-class specifiers, <a href="#6.7.1">6.7.1</a>, <a href="#6.11.5">6.11.5</a>
31746 standard integer types, <a href="#6.2.5">6.2.5</a> strcat function, <a href="#7.23.3.1">7.23.3.1</a>
31747 standard output stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> strcat_s function, <a href="#K.3.7.2.1">K.3.7.2.1</a>
31748 standard signed integer types, <a href="#6.2.5">6.2.5</a> strchr function, <a href="#7.23.5.2">7.23.5.2</a>
31749 state-dependent encoding, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a> strcmp function, <a href="#7.23.4">7.23.4</a>, <a href="#7.23.4.2">7.23.4.2</a>
31750 statements, <a href="#6.8">6.8</a> strcoll function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.4.3">7.23.4.3</a>, <a href="#7.23.4.5">7.23.4.5</a>
31751 break, <a href="#6.8.6.3">6.8.6.3</a> strcpy function, <a href="#7.23.2.3">7.23.2.3</a>
31752 compound, <a href="#6.8.2">6.8.2</a> strcpy_s function, <a href="#K.3.7.1.3">K.3.7.1.3</a>
31753 continue, <a href="#6.8.6.2">6.8.6.2</a> strcspn function, <a href="#7.23.5.3">7.23.5.3</a>
31754 <!--page 692 -->
31755 streams, <a href="#7.21.2">7.21.2</a>, <a href="#7.22.4.4">7.22.4.4</a> <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.28.2.2">7.28.2.2</a>
31756 fully buffered, <a href="#7.21.3">7.21.3</a> strtoull function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1.2">7.22.1.2</a>, <a href="#7.22.1.4">7.22.1.4</a>
31757 line buffered, <a href="#7.21.3">7.21.3</a> strtoumax function, <a href="#7.8.2.3">7.8.2.3</a>
31758 orientation, <a href="#7.21.2">7.21.2</a> struct hack, see flexible array member
31759 standard error, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> struct lconv, <a href="#7.11">7.11</a>
31760 standard input, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> struct tm, <a href="#7.26.1">7.26.1</a>
31761 standard output, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> structure
31762 unbuffered, <a href="#7.21.3">7.21.3</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
31763 strerror function, <a href="#7.21.10.4">7.21.10.4</a>, <a href="#7.23.6.2">7.23.6.2</a> content, <a href="#6.7.2.3">6.7.2.3</a>
31764 strerror_s function, <a href="#K.3.7.4.2">K.3.7.4.2</a>, <a href="#K.3.7.4.3">K.3.7.4.3</a> dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>
31765 strerrorlen_s function, <a href="#K.3.7.4.3">K.3.7.4.3</a> initialization, <a href="#6.7.9">6.7.9</a>
31766 strftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.26.3">7.26.3</a>, <a href="#7.26.3.5">7.26.3.5</a>, member alignment, <a href="#6.7.2.1">6.7.2.1</a>
31767 <a href="#7.28.5.1">7.28.5.1</a>, <a href="#K.3.8.2">K.3.8.2</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a> member name space, <a href="#6.2.3">6.2.3</a>
31768 stricter, <a href="#6.2.8">6.2.8</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>
31769 strictly conforming program, <a href="#4">4</a> pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
31770 string, <a href="#7.1.1">7.1.1</a> specifier, <a href="#6.7.2.1">6.7.2.1</a>
31771 comparison functions, <a href="#7.23.4">7.23.4</a> tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
31772 concatenation functions, <a href="#7.23.3">7.23.3</a>, <a href="#K.3.7.2">K.3.7.2</a> type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a>
31773 conversion functions, <a href="#7.11.1.1">7.11.1.1</a> strxfrm function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.4.5">7.23.4.5</a>
31774 copying functions, <a href="#7.23.2">7.23.2</a>, <a href="#K.3.7.1">K.3.7.1</a> subnormal floating-point numbers, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31775 library function conventions, <a href="#7.23.1">7.23.1</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
31776 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.9">6.7.9</a> subtraction assignment operator (-=), <a href="#6.5.16.2">6.5.16.2</a>
31777 miscellaneous functions, <a href="#7.23.6">7.23.6</a>, <a href="#K.3.7.4">K.3.7.4</a> subtraction operator (-), <a href="#6.2.6.2">6.2.6.2</a>, <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>
31778 numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a> suffix
31779 search functions, <a href="#7.23.5">7.23.5</a>, <a href="#K.3.7.3">K.3.7.3</a> floating constant, <a href="#6.4.4.2">6.4.4.2</a>
31780 string handling header, <a href="#7.23">7.23</a>, <a href="#K.3.7">K.3.7</a> integer constant, <a href="#6.4.4.1">6.4.4.1</a>
31781 string.h header, <a href="#7.23">7.23</a>, <a href="#7.30.11">7.30.11</a>, <a href="#K.3.7">K.3.7</a> switch body, <a href="#6.8.4.2">6.8.4.2</a>
31782 stringizing, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.9">6.10.9</a> switch case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
31783 strlen function, <a href="#7.23.6.3">7.23.6.3</a> switch default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
31784 strncat function, <a href="#7.23.3.2">7.23.3.2</a> switch statement, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
31785 strncat_s function, <a href="#K.3.7.2.2">K.3.7.2.2</a> swprintf function, <a href="#7.28.2.3">7.28.2.3</a>, <a href="#7.28.2.7">7.28.2.7</a>,
31786 strncmp function, <a href="#7.23.4">7.23.4</a>, <a href="#7.23.4.4">7.23.4.4</a> <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a>
31787 strncpy function, <a href="#7.23.2.4">7.23.2.4</a> swprintf_s function, <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a>
31788 strncpy_s function, <a href="#K.3.7.1.4">K.3.7.1.4</a> swscanf function, <a href="#7.28.2.4">7.28.2.4</a>, <a href="#7.28.2.8">7.28.2.8</a>
31789 strnlen_s function, <a href="#K.3.7.4.4">K.3.7.4.4</a> swscanf_s function, <a href="#K.3.9.1.5">K.3.9.1.5</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>
31790 stronger, <a href="#6.2.8">6.2.8</a> symbols, <a href="#3">3</a>
31791 strpbrk function, <a href="#7.23.5.4">7.23.5.4</a> synchronization operation, <a href="#5.1.2.4">5.1.2.4</a>
31792 strrchr function, <a href="#7.23.5.5">7.23.5.5</a> synchronize with, <a href="#5.1.2.4">5.1.2.4</a>
31793 strspn function, <a href="#7.23.5.6">7.23.5.6</a> syntactic categories, <a href="#6.1">6.1</a>
31794 strstr function, <a href="#7.23.5.7">7.23.5.7</a> syntax notation, <a href="#6.1">6.1</a>
31795 strtod function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.3">7.22.1.3</a>, syntax rule precedence, <a href="#5.1.1.2">5.1.1.2</a>
31796 <a href="#7.28.2.2">7.28.2.2</a>, <a href="#F.3">F.3</a> syntax summary, language, <a href="#A">A</a>
31797 strtof function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.22.1.3">7.22.1.3</a>, <a href="#F.3">F.3</a> system function, <a href="#7.22.4.8">7.22.4.8</a>
31798 strtoimax function, <a href="#7.8.2.3">7.8.2.3</a>
31799 strtok function, <a href="#7.23.5.8">7.23.5.8</a> tab characters, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
31800 strtok_s function, <a href="#K.3.7.3.1">K.3.7.3.1</a> tag compatibility, <a href="#6.2.7">6.2.7</a>
31801 strtol function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.2">7.22.1.2</a>, tag name space, <a href="#6.2.3">6.2.3</a>
31802 <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.28.2.2">7.28.2.2</a> tags, <a href="#6.7.2.3">6.7.2.3</a>
31803 strtold function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.22.1.3">7.22.1.3</a>, <a href="#F.3">F.3</a> tan functions, <a href="#7.12.4.7">7.12.4.7</a>, <a href="#F.10.1.7">F.10.1.7</a>
31804 strtoll function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1.2">7.22.1.2</a>, <a href="#7.22.1.4">7.22.1.4</a> tan type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
31805 strtoul function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.2">7.22.1.2</a>, tanh functions, <a href="#7.12.5.6">7.12.5.6</a>, <a href="#F.10.2.6">F.10.2.6</a>
31806 <!--page 693 -->
31807 tanh type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> toupper function, <a href="#7.4.2.2">7.4.2.2</a>
31808 temporary lifetime, <a href="#6.2.4">6.2.4</a> towctrans function, <a href="#7.29.3.2.1">7.29.3.2.1</a>, <a href="#7.29.3.2.2">7.29.3.2.2</a>
31809 tentative definition, <a href="#6.9.2">6.9.2</a> towlower function, <a href="#7.29.3.1.1">7.29.3.1.1</a>, <a href="#7.29.3.2.1">7.29.3.2.1</a>
31810 terms, <a href="#3">3</a> towupper function, <a href="#7.29.3.1.2">7.29.3.1.2</a>, <a href="#7.29.3.2.1">7.29.3.2.1</a>
31811 text streams, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a> translation environment, <a href="#5">5</a>, <a href="#5.1.1">5.1.1</a>
31812 tgamma functions, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#F.10.5.4">F.10.5.4</a> translation limits, <a href="#5.2.4.1">5.2.4.1</a>
31813 tgamma type-generic macro, <a href="#7.24">7.24</a> translation phases, <a href="#5.1.1.2">5.1.1.2</a>
31814 tgmath.h header, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a> translation unit, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.9">6.9</a>
31815 thrd_create function, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.5.1">7.25.5.1</a> trap, see perform a trap
31816 thrd_current function, <a href="#7.25.5.2">7.25.5.2</a> trap representation, <a href="#3.19.4">3.19.4</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.2.6.2">6.2.6.2</a>,
31817 thrd_detach function, <a href="#7.25.5.3">7.25.5.3</a> <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.5.2.3">6.5.2.3</a>
31818 thrd_equal function, <a href="#7.25.5.4">7.25.5.4</a> trigonometric functions
31819 thrd_exit function, <a href="#7.25.5.5">7.25.5.5</a> complex, <a href="#7.3.5">7.3.5</a>, <a href="#G.6.1">G.6.1</a>
31820 thrd_join function, <a href="#7.25.5.6">7.25.5.6</a> real, <a href="#7.12.4">7.12.4</a>, <a href="#F.10.1">F.10.1</a>
31821 thrd_sleep function, <a href="#7.25.5.7">7.25.5.7</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>
31822 thrd_start_t type, <a href="#7.25.1">7.25.1</a> true macro, <a href="#7.18">7.18</a>
31823 thrd_t type, <a href="#7.25.1">7.25.1</a> trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.10.6.8">F.10.6.8</a>
31824 thrd_yield function, <a href="#7.25.5.8">7.25.5.8</a> trunc type-generic macro, <a href="#7.24">7.24</a>
31825 thread of execution, <a href="#5.1.2.4">5.1.2.4</a>, <a href="#7.1.4">7.1.4</a>, <a href="#7.6">7.6</a>, <a href="#7.22.4.6">7.22.4.6</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.21.3">7.21.3</a>, <a href="#7.21.5.3">7.21.5.3</a>
31826 thread storage duration, <a href="#6.2.4">6.2.4</a>, <a href="#7.6">7.6</a> truncation toward zero, <a href="#6.5.5">6.5.5</a>
31827 threads header, <a href="#7.25">7.25</a> tss_create function, <a href="#7.25.6.1">7.25.6.1</a>
31828 threads.h header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.25">7.25</a> tss_delete function, <a href="#7.25.6.2">7.25.6.2</a>
31829 time TSS_DTOR_ITERATIONS macro, <a href="#7.25.1">7.25.1</a>
31830 broken down, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.3">7.26.2.3</a>, <a href="#7.26.3">7.26.3</a>, <a href="#7.26.3.1">7.26.3.1</a>, tss_dtor_t type, <a href="#7.25.1">7.25.1</a>
31831 <a href="#7.26.3.3">7.26.3.3</a>, <a href="#7.26.3.4">7.26.3.4</a>, <a href="#7.26.3.5">7.26.3.5</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>, tss_get function, <a href="#7.25.6.3">7.25.6.3</a>
31832 <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a> tss_set function, <a href="#7.25.6.4">7.25.6.4</a>
31833 calendar, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.2">7.26.2.2</a>, <a href="#7.26.2.3">7.26.2.3</a>, <a href="#7.26.2.4">7.26.2.4</a>, tss_t type, <a href="#7.25.1">7.25.1</a>
31834 <a href="#7.26.3.2">7.26.3.2</a>, <a href="#7.26.3.3">7.26.3.3</a>, <a href="#7.26.3.4">7.26.3.4</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>, two's complement, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.20.1.1">7.20.1.1</a>
31835 <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a> type category, <a href="#6.2.5">6.2.5</a>
31836 components, <a href="#7.26.1">7.26.1</a>, <a href="#K.3.8.1">K.3.8.1</a> type conversion, <a href="#6.3">6.3</a>
31837 conversion functions, <a href="#7.26.3">7.26.3</a>, <a href="#K.3.8.2">K.3.8.2</a> type definitions, <a href="#6.7.8">6.7.8</a>
31838 wide character, <a href="#7.28.5">7.28.5</a> type domain, <a href="#6.2.5">6.2.5</a>, <a href="#G.2">G.2</a>
31839 local, <a href="#7.26.1">7.26.1</a> type names, <a href="#6.7.7">6.7.7</a>
31840 manipulation functions, <a href="#7.26.2">7.26.2</a> type punning, <a href="#6.5.2.3">6.5.2.3</a>
31841 normalized broken down, <a href="#K.3.8.1">K.3.8.1</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a> type qualifiers, <a href="#6.7.3">6.7.3</a>
31842 time function, <a href="#7.26.2.4">7.26.2.4</a> type specifiers, <a href="#6.7.2">6.7.2</a>
31843 time.h header, <a href="#7.26">7.26</a>, <a href="#K.3.8">K.3.8</a> type-generic macro, <a href="#7.24">7.24</a>, <a href="#G.7">G.7</a>
31844 time_t type, <a href="#7.26.1">7.26.1</a> typedef declaration, <a href="#6.7.8">6.7.8</a>
31845 TIME_UTC macro, <a href="#7.25.7.1">7.25.7.1</a> typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.8">6.7.8</a>
31846 tm structure type, <a href="#7.26.1">7.26.1</a>, <a href="#7.28.1">7.28.1</a>, <a href="#K.3.8.1">K.3.8.1</a> types, <a href="#6.2.5">6.2.5</a>
31847 TMP_MAX macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.21.4.4">7.21.4.4</a> atomic, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.2.5">6.2.5</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a>,
31848 TMP_MAX_S macro, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a> <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.16.2">6.5.16.2</a>, <a href="#6.7.2.4">6.7.2.4</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.17.6">7.17.6</a>
31849 tmpfile function, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a> character, <a href="#6.7.9">6.7.9</a>
31850 tmpfile_s function, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</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.6">6.7.6</a>
31851 tmpnam function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.21.4.4">7.21.4.4</a>, complex, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a>
31852 <a href="#K.3.5.1.2">K.3.5.1.2</a> composite, <a href="#6.2.7">6.2.7</a>
31853 tmpnam_s function, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a> const qualified, <a href="#6.7.3">6.7.3</a>
31854 token, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, see also preprocessing tokens conversions, <a href="#6.3">6.3</a>
31855 token concatenation, <a href="#6.10.3.3">6.10.3.3</a> imaginary, <a href="#G">G</a>
31856 token pasting, <a href="#6.10.3.3">6.10.3.3</a> restrict qualified, <a href="#6.7.3">6.7.3</a>
31857 tolower function, <a href="#7.4.2.1">7.4.2.1</a> volatile qualified, <a href="#6.7.3">6.7.3</a>
31858 <!--page 694 -->
31859 uchar.h header, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.27">7.27</a> universal character name, <a href="#6.4.3">6.4.3</a>
31860 UCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> unnormalized floating-point numbers, <a href="#5.2.4.2.2">5.2.4.2.2</a>
31861 UINT_FASTN_MAX macros, <a href="#7.20.2.3">7.20.2.3</a> unqualified type, <a href="#6.2.5">6.2.5</a>
31862 uint_fastN_t types, <a href="#7.20.1.3">7.20.1.3</a> unqualified version of type, <a href="#6.2.5">6.2.5</a>
31863 uint_least16_t type, <a href="#7.27">7.27</a> unsequenced, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a>, <a href="#6.5.16">6.5.16</a>, see also
31864 uint_least32_t type, <a href="#7.27">7.27</a> indeterminately sequenced, sequenced
31865 UINT_LEASTN_MAX macros, <a href="#7.20.2.2">7.20.2.2</a> before
31866 uint_leastN_t types, <a href="#7.20.1.2">7.20.1.2</a> unsigned char type, <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>
31867 UINT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> unsigned integer suffix, u or <a href="#U">U</a>, <a href="#6.4.4.1">6.4.4.1</a>
31868 UINTMAX_C macro, <a href="#7.20.4.2">7.20.4.2</a> 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>
31869 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.20.2.5">7.20.2.5</a> 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>,
31870 uintmax_t type, <a href="#7.20.1.5">7.20.1.5</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
31871 <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a> unsigned types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
31872 UINTN_C macros, <a href="#7.20.4.1">7.20.4.1</a> <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>
31873 UINTN_MAX macros, <a href="#7.20.2.1">7.20.2.1</a> unspecified behavior, <a href="#3.4.4">3.4.4</a>, <a href="#4">4</a>, <a href="#J.1">J.1</a>
31874 uintN_t types, <a href="#7.20.1.1">7.20.1.1</a> unspecified value, <a href="#3.19.3">3.19.3</a>
31875 UINTPTR_MAX macro, <a href="#7.20.2.4">7.20.2.4</a> uppercase letter, <a href="#5.2.1">5.2.1</a>
31876 uintptr_t type, <a href="#7.20.1.4">7.20.1.4</a> use of library functions, <a href="#7.1.4">7.1.4</a>
31877 ULLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, USHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
31878 <a href="#7.28.4.1.2">7.28.4.1.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>,
31879 ULONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</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>
31880 <a href="#7.28.4.1.2">7.28.4.1.2</a> UTF-16, <a href="#6.10.8.2">6.10.8.2</a>
31881 unary arithmetic operators, <a href="#6.5.3.3">6.5.3.3</a> UTF-32, <a href="#6.10.8.2">6.10.8.2</a>
31882 unary expression, <a href="#6.5.3">6.5.3</a> UTF-8 string literal, see string literal
31883 unary minus operator (-), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a> utilities, general, <a href="#7.22">7.22</a>, <a href="#K.3.6">K.3.6</a>
31884 unary operators, <a href="#6.5.3">6.5.3</a> wide string, <a href="#7.28.4">7.28.4</a>, <a href="#K.3.9.2">K.3.9.2</a>
31885 unary plus operator (+), <a href="#6.5.3.3">6.5.3.3</a>
31886 unbuffered stream, <a href="#7.21.3">7.21.3</a> va_arg macro, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.1">7.16.1.1</a>, <a href="#7.16.1.2">7.16.1.2</a>,
31887 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.16.1.4">7.16.1.4</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>,
31888 <a href="#7.1.4">7.1.4</a> <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>,
31889 undefined behavior, <a href="#3.4.3">3.4.3</a>, <a href="#4">4</a>, <a href="#J.2">J.2</a> <a href="#7.28.2.5">7.28.2.5</a>, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.7">7.28.2.7</a>, <a href="#7.28.2.8">7.28.2.8</a>,
31890 underscore character, <a href="#6.4.2.1">6.4.2.1</a> <a href="#7.28.2.9">7.28.2.9</a>, <a href="#7.28.2.10">7.28.2.10</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
31891 underscore, leading, in identifier, <a href="#7.1.3">7.1.3</a> <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>
31892 ungetc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>, va_copy macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.1">7.16.1.1</a>,
31893 <a href="#7.21.9.3">7.21.9.3</a> <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a>
31894 ungetwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3.10">7.28.3.10</a> va_end macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.3">7.16.1.3</a>,
31895 Unicode, <a href="#7.27">7.27</a>, see also char16_t type, <a href="#7.16.1.4">7.16.1.4</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>,
31896 char32_t type, wchar_t type <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>,
31897 Unicode required set, <a href="#6.10.8.2">6.10.8.2</a> <a href="#7.28.2.5">7.28.2.5</a>, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.2.7">7.28.2.7</a>, <a href="#7.28.2.8">7.28.2.8</a>,
31898 union <a href="#7.28.2.9">7.28.2.9</a>, <a href="#7.28.2.10">7.28.2.10</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
31899 arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>
31900 content, <a href="#6.7.2.3">6.7.2.3</a> va_list type, <a href="#7.16">7.16</a>, <a href="#7.16.1.3">7.16.1.3</a>
31901 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> va_start macro, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.1">7.16.1.1</a>,
31902 initialization, <a href="#6.7.9">6.7.9</a> <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a>, <a href="#7.16.1.4">7.16.1.4</a>, <a href="#7.21.6.8">7.21.6.8</a>,
31903 member alignment, <a href="#6.7.2.1">6.7.2.1</a> <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>, <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>,
31904 member name space, <a href="#6.2.3">6.2.3</a> <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>, <a href="#7.28.2.5">7.28.2.5</a>, <a href="#7.28.2.6">7.28.2.6</a>,
31905 member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a> <a href="#7.28.2.7">7.28.2.7</a>, <a href="#7.28.2.8">7.28.2.8</a>, <a href="#7.28.2.9">7.28.2.9</a>, <a href="#7.28.2.10">7.28.2.10</a>,
31906 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>,
31907 specifier, <a href="#6.7.2.1">6.7.2.1</a> <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>
31908 tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a> value, <a href="#3.19">3.19</a>
31909 type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a> value bits, <a href="#6.2.6.2">6.2.6.2</a>
31910 <!--page 695 -->
31911 variable arguments, <a href="#6.10.3">6.10.3</a>, <a href="#7.16">7.16</a> vswscanf function, <a href="#7.28.2.8">7.28.2.8</a>
31912 variable arguments header, <a href="#7.16">7.16</a> vswscanf_s function, <a href="#K.3.9.1.10">K.3.9.1.10</a>
31913 variable length array, <a href="#6.7.6">6.7.6</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a> vwprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.9">7.28.2.9</a>, <a href="#K.3.9.1.11">K.3.9.1.11</a>
31914 variably modified type, <a href="#6.7.6">6.7.6</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a> vwprintf_s function, <a href="#K.3.9.1.11">K.3.9.1.11</a>
31915 vertical-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> vwscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.10">7.28.2.10</a>, <a href="#7.28.3.10">7.28.3.10</a>
31916 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>, vwscanf_s function, <a href="#K.3.9.1.12">K.3.9.1.12</a>
31917 <a href="#7.4.1.10">7.4.1.10</a>
31918 vfprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#K.3.5.3.8">K.3.5.3.8</a> warnings, <a href="#I">I</a>
31919 vfprintf_s function, <a href="#K.3.5.3.8">K.3.5.3.8</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, wchar.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.28">7.28</a>, <a href="#7.30.12">7.30.12</a>,
31920 <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a> <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a>
31921 vfscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a> WCHAR_MAX macro, <a href="#7.20.3">7.20.3</a>, <a href="#7.28.1">7.28.1</a>
31922 vfscanf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, WCHAR_MIN macro, <a href="#7.20.3">7.20.3</a>, <a href="#7.28.1">7.28.1</a>
31923 <a href="#K.3.5.3.14">K.3.5.3.14</a> wchar_t type, <a href="#3.7.3">3.7.3</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.19">7.19</a>,
31924 vfwprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.5">7.28.2.5</a>, <a href="#K.3.9.1.6">K.3.9.1.6</a> <a href="#7.20.3">7.20.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22">7.22</a>, <a href="#7.28.1">7.28.1</a>,
31925 vfwprintf_s function, <a href="#K.3.9.1.6">K.3.9.1.6</a> <a href="#7.28.2.1">7.28.2.1</a>, <a href="#7.28.2.2">7.28.2.2</a>
31926 vfwscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.6">7.28.2.6</a>, <a href="#7.28.3.10">7.28.3.10</a> wcrtomb function, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>,
31927 vfwscanf_s function, <a href="#K.3.9.1.7">K.3.9.1.7</a> <a href="#7.28.6.3.3">7.28.6.3.3</a>, <a href="#7.28.6.4.2">7.28.6.4.2</a>, <a href="#K.3.6.5.2">K.3.6.5.2</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>,
31928 visibility of identifier, <a href="#6.2.1">6.2.1</a> <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>
31929 visible sequence of side effects, <a href="#5.1.2.4">5.1.2.4</a> wcrtomb_s function, <a href="#K.3.9.3.1">K.3.9.3.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>
31930 visible side effect, <a href="#5.1.2.4">5.1.2.4</a> wcscat function, <a href="#7.28.4.3.1">7.28.4.3.1</a>
31931 VLA, see variable length array wcscat_s function, <a href="#K.3.9.2.2.1">K.3.9.2.2.1</a>
31932 void expression, <a href="#6.3.2.2">6.3.2.2</a> wcschr function, <a href="#7.28.4.5.1">7.28.4.5.1</a>
31933 void function parameter, <a href="#6.7.6.3">6.7.6.3</a> wcscmp function, <a href="#7.28.4.4.1">7.28.4.4.1</a>, <a href="#7.28.4.4.4">7.28.4.4.4</a>
31934 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>, <a href="#K.3.5.3.2">K.3.5.3.2</a>, wcscoll function, <a href="#7.28.4.4.2">7.28.4.4.2</a>, <a href="#7.28.4.4.4">7.28.4.4.4</a>
31935 <a href="#K.3.9.1.2">K.3.9.1.2</a> wcscpy function, <a href="#7.28.4.2.1">7.28.4.2.1</a>
31936 void type conversion, <a href="#6.3.2.2">6.3.2.2</a> wcscpy_s function, <a href="#K.3.9.2.1.1">K.3.9.2.1.1</a>
31937 volatile storage, <a href="#5.1.2.3">5.1.2.3</a> wcscspn function, <a href="#7.28.4.5.2">7.28.4.5.2</a>
31938 volatile type qualifier, <a href="#6.7.3">6.7.3</a> wcsftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.28.5.1">7.28.5.1</a>
31939 volatile-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a> wcslen function, <a href="#7.28.4.6.1">7.28.4.6.1</a>
31940 vprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.10">7.21.6.10</a>, wcsncat function, <a href="#7.28.4.3.2">7.28.4.3.2</a>
31941 <a href="#K.3.5.3.10">K.3.5.3.10</a> wcsncat_s function, <a href="#K.3.9.2.2.2">K.3.9.2.2.2</a>
31942 vprintf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.10">K.3.5.3.10</a>, wcsncmp function, <a href="#7.28.4.4.3">7.28.4.4.3</a>
31943 <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a> wcsncpy function, <a href="#7.28.4.2.2">7.28.4.2.2</a>
31944 vscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.11">7.21.6.11</a> wcsncpy_s function, <a href="#K.3.9.2.1.2">K.3.9.2.1.2</a>
31945 vscanf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, wcsnlen_s function, <a href="#K.3.9.2.4.1">K.3.9.2.4.1</a>
31946 <a href="#K.3.5.3.14">K.3.5.3.14</a> wcspbrk function, <a href="#7.28.4.5.3">7.28.4.5.3</a>
31947 vsnprintf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.12">7.21.6.12</a>, wcsrchr function, <a href="#7.28.4.5.4">7.28.4.5.4</a>
31948 <a href="#K.3.5.3.12">K.3.5.3.12</a> wcsrtombs function, <a href="#7.28.6.4.2">7.28.6.4.2</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
31949 vsnprintf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, wcsrtombs_s function, <a href="#K.3.9.3.2">K.3.9.3.2</a>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>
31950 <a href="#K.3.5.3.12">K.3.5.3.12</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a> wcsspn function, <a href="#7.28.4.5.5">7.28.4.5.5</a>
31951 vsnwprintf_s function, <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#K.3.9.1.9">K.3.9.1.9</a> wcsstr function, <a href="#7.28.4.5.6">7.28.4.5.6</a>
31952 vsprintf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.13">7.21.6.13</a>, wcstod function, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>
31953 <a href="#K.3.5.3.13">K.3.5.3.13</a> wcstod function, <a href="#7.28.4.1.1">7.28.4.1.1</a>
31954 vsprintf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, wcstof function, <a href="#7.28.4.1.1">7.28.4.1.1</a>
31955 <a href="#K.3.5.3.12">K.3.5.3.12</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a> wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a>
31956 vsscanf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.14">7.21.6.14</a> wcstok function, <a href="#7.28.4.5.7">7.28.4.5.7</a>
31957 vsscanf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, wcstok_s function, <a href="#K.3.9.2.3.1">K.3.9.2.3.1</a>
31958 <a href="#K.3.5.3.14">K.3.5.3.14</a> wcstol function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>,
31959 vswprintf function, <a href="#7.28.2.7">7.28.2.7</a>, <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>
31960 <a href="#K.3.9.1.9">K.3.9.1.9</a> wcstold function, <a href="#7.28.4.1.1">7.28.4.1.1</a>
31961 vswprintf_s function, <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#K.3.9.1.9">K.3.9.1.9</a> wcstoll function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a>
31962 <!--page 696 -->
31963 wcstombs function, <a href="#7.22.8.2">7.22.8.2</a>, <a href="#7.28.6.4">7.28.6.4</a> <a href="#7.29.1">7.29.1</a>
31964 wcstombs_s function, <a href="#K.3.6.5.2">K.3.6.5.2</a> wmemchr function, <a href="#7.28.4.5.8">7.28.4.5.8</a>
31965 wcstoul function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28.2.2">7.28.2.2</a>, wmemcmp function, <a href="#7.28.4.4.5">7.28.4.4.5</a>
31966 <a href="#7.28.4.1.2">7.28.4.1.2</a> wmemcpy function, <a href="#7.28.4.2.3">7.28.4.2.3</a>
31967 wcstoull function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.28.4.1.2">7.28.4.1.2</a> wmemcpy_s function, <a href="#K.3.9.2.1.3">K.3.9.2.1.3</a>
31968 wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a> wmemmove function, <a href="#7.28.4.2.4">7.28.4.2.4</a>
31969 wcsxfrm function, <a href="#7.28.4.4.4">7.28.4.4.4</a> wmemmove_s function, <a href="#K.3.9.2.1.4">K.3.9.2.1.4</a>
31970 wctob function, <a href="#7.28.6.1.2">7.28.6.1.2</a>, <a href="#7.29.2.1">7.29.2.1</a> wmemset function, <a href="#7.28.4.6.2">7.28.4.6.2</a>
31971 wctomb function, <a href="#7.22.7.3">7.22.7.3</a>, <a href="#7.22.8.2">7.22.8.2</a>, <a href="#7.28.6.3">7.28.6.3</a> wprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.9">7.28.2.9</a>, <a href="#7.28.2.11">7.28.2.11</a>,
31972 wctomb_s function, <a href="#K.3.6.4.1">K.3.6.4.1</a> <a href="#K.3.9.1.13">K.3.9.1.13</a>
31973 wctrans function, <a href="#7.29.3.2.1">7.29.3.2.1</a>, <a href="#7.29.3.2.2">7.29.3.2.2</a> wprintf_s function, <a href="#K.3.9.1.13">K.3.9.1.13</a>
31974 wctrans_t type, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.3.2.2">7.29.3.2.2</a> wscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.2.10">7.28.2.10</a>, <a href="#7.28.2.12">7.28.2.12</a>,
31975 wctype function, <a href="#7.29.2.2.1">7.29.2.2.1</a>, <a href="#7.29.2.2.2">7.29.2.2.2</a> <a href="#7.28.3.10">7.28.3.10</a>
31976 wctype.h header, <a href="#7.29">7.29</a>, <a href="#7.30.13">7.30.13</a> wscanf_s function, <a href="#K.3.9.1.12">K.3.9.1.12</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a>
31977 wctype_t type, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.2.2">7.29.2.2.2</a>
31978 weaker, <a href="#6.2.8">6.2.8</a> xor macro, <a href="#7.9">7.9</a>
31979 WEOF macro, <a href="#7.28.1">7.28.1</a>, <a href="#7.28.3.1">7.28.3.1</a>, <a href="#7.28.3.3">7.28.3.3</a>, <a href="#7.28.3.6">7.28.3.6</a>, xor_eq macro, <a href="#7.9">7.9</a>
31980 <a href="#7.28.3.7">7.28.3.7</a>, <a href="#7.28.3.8">7.28.3.8</a>, <a href="#7.28.3.9">7.28.3.9</a>, <a href="#7.28.3.10">7.28.3.10</a>, xtime type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.3.5">7.25.3.5</a>, <a href="#7.25.4.4">7.25.4.4</a>, <a href="#7.25.5.7">7.25.5.7</a>,
31981 <a href="#7.28.6.1.1">7.28.6.1.1</a>, <a href="#7.29.1">7.29.1</a> <a href="#7.25.7.1">7.25.7.1</a>
31982 while statement, <a href="#6.8.5.1">6.8.5.1</a> xtime_get function, <a href="#7.25.7.1">7.25.7.1</a>
31983 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>,
31984 <a href="#7.29.2.1.10">7.29.2.1.10</a>
31985 white-space characters, <a href="#6.4">6.4</a>
31986 wide character, <a href="#3.7.3">3.7.3</a>
31987 case mapping functions, <a href="#7.29.3.1">7.29.3.1</a>
31988 extensible, <a href="#7.29.3.2">7.29.3.2</a>
31989 classification functions, <a href="#7.29.2.1">7.29.2.1</a>
31990 extensible, <a href="#7.29.2.2">7.29.2.2</a>
31991 constant, <a href="#6.4.4.4">6.4.4.4</a>
31992 formatted input/output functions, <a href="#7.28.2">7.28.2</a>,
31993 <a href="#K.3.9.1">K.3.9.1</a>
31994 input functions, <a href="#7.21.1">7.21.1</a>
31995 input/output functions, <a href="#7.21.1">7.21.1</a>, <a href="#7.28.3">7.28.3</a>
31996 output functions, <a href="#7.21.1">7.21.1</a>
31997 single-byte conversion functions, <a href="#7.28.6.1">7.28.6.1</a>
31998 wide string, <a href="#7.1.1">7.1.1</a>
31999 wide string comparison functions, <a href="#7.28.4.4">7.28.4.4</a>
32000 wide string concatenation functions, <a href="#7.28.4.3">7.28.4.3</a>,
32001 <a href="#K.3.9.2.2">K.3.9.2.2</a>
32002 wide string copying functions, <a href="#7.28.4.2">7.28.4.2</a>, <a href="#K.3.9.2.1">K.3.9.2.1</a>
32003 wide string literal, see string literal
32004 wide string miscellaneous functions, <a href="#7.28.4.6">7.28.4.6</a>,
32005 <a href="#K.3.9.2.4">K.3.9.2.4</a>
32006 wide string numeric conversion functions, <a href="#7.8.2.4">7.8.2.4</a>,
32007 <a href="#7.28.4.1">7.28.4.1</a>
32008 wide string search functions, <a href="#7.28.4.5">7.28.4.5</a>, <a href="#K.3.9.2.3">K.3.9.2.3</a>
32009 wide-oriented stream, <a href="#7.21.2">7.21.2</a>
32010 width, <a href="#6.2.6.2">6.2.6.2</a>
32011 WINT_MAX macro, <a href="#7.20.3">7.20.3</a>
32012 WINT_MIN macro, <a href="#7.20.3">7.20.3</a>
32013 wint_t type, <a href="#7.20.3">7.20.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.28.2.1">7.28.2.1</a>,
32014 </pre>
32015 </body></html>