add #1.2.3p4 style paragraph links
[c-standard] / n1570.html
1 <html><head><title>N1570   April 12, 2011  ISO/IEC 9899:201x</title></head><body>
2 <pre><!--page 1 -->
3 N1570                      Committee Draft -- April 12, 2011          ISO/IEC 9899:201x
4
5
6
7
8 INTERNATIONAL STANDARD                         (C)ISO/IEC              ISO/IEC 9899:201x
9
10
11
12
13 </pre>
14
15 <p><small><a href="#Contents">Contents</a></small>
16 <h1>Programming languages -- C</h1>
17 <pre>
18
19
20                                        ABSTRACT
21
22
23
24                      (Cover sheet to be provided by ISO Secretariat.)
25
26 This International Standard specifies the form and establishes the interpretation of
27 programs expressed in the programming language C. Its purpose is to promote
28 portability, reliability, maintainability, and efficient execution of C language programs on
29 a variety of computing systems.
30
31 Clauses are included that detail the C language itself and the contents of the C language
32 execution library. Annexes summarize aspects of both of them, and enumerate factors
33 that influence the portability of C programs.
34
35 Although this International Standard is intended to guide knowledgeable C language
36 programmers as well as implementors of C language translation systems, the document
37 itself is not designed to serve as a tutorial.
38
39 Recipients of this draft are invited to submit, with their comments, notification of any
40 relevant patent rights of which they are aware and to provide supporting documentation.
41
42 Changes from the previous draft (N1539) are indicated by ''diff marks'' in the right
43 margin: deleted text is marked with ''*'', new or changed text with '' ''.
44 <!--page 2 -->
45 <!--page 3 -->
46 </pre>
47
48 <p><small><a href="#Contents">Contents</a></small>
49 <h2><a name="Contents" href="#Contents">Contents</a></h2>
50 <ul>
51 <li><a href="#Foreword">Foreword</a>
52 <li><a href="#Introduction">Introduction</a>
53 <li><a href="#1">1. Scope</a>
54 <li><a href="#2">2. Normative references</a>
55 <li><a href="#3">3. Terms, definitions, and symbols</a>
56 <li><a href="#4">4. Conformance</a>
57 <li><a href="#5">5. Environment</a>
58 <ul>
59 <li><a href="#5.1">   5.1 Conceptual models</a>
60 <ul>
61 <li><a href="#5.1.1">        5.1.1  Translation environment</a>
62 <li><a href="#5.1.2">        5.1.2  Execution environments</a>
63 </ul>
64 <li><a href="#5.2">   5.2 Environmental considerations</a>
65 <ul>
66 <li><a href="#5.2.1">        5.2.1  Character sets</a>
67 <li><a href="#5.2.2">        5.2.2  Character display semantics</a>
68 <li><a href="#5.2.3">        5.2.3  Signals and interrupts</a>
69 <li><a href="#5.2.4">        5.2.4  Environmental limits</a>
70 </ul>
71 </ul>
72 <li><a href="#6">6. Language</a>
73 <ul>
74 <li><a href="#6.1">   6.1 Notation</a>
75 <li><a href="#6.2">   6.2 Concepts</a>
76 <ul>
77 <li><a href="#6.2.1">        6.2.1   Scopes of identifiers</a>
78 <li><a href="#6.2.2">        6.2.2   Linkages of identifiers</a>
79 <li><a href="#6.2.3">        6.2.3   Name spaces of identifiers</a>
80 <li><a href="#6.2.4">        6.2.4   Storage durations of objects</a>
81 <li><a href="#6.2.5">        6.2.5   Types</a>
82 <li><a href="#6.2.6">        6.2.6   Representations of types</a>
83 <li><a href="#6.2.7">        6.2.7   Compatible type and composite type</a>
84 <li><a href="#6.2.8">        6.2.8   Alignment of objects</a>
85 </ul>
86 <li><a href="#6.3">   6.3 Conversions</a>
87 <ul>
88 <li><a href="#6.3.1">        6.3.1   Arithmetic operands</a>
89 <li><a href="#6.3.2">        6.3.2   Other operands</a>
90 </ul>
91 <li><a href="#6.4">   6.4 Lexical elements</a>
92 <ul>
93 <li><a href="#6.4.1">        6.4.1   Keywords</a>
94 <li><a href="#6.4.2">        6.4.2   Identifiers</a>
95 <li><a href="#6.4.3">        6.4.3   Universal character names</a>
96 <li><a href="#6.4.4">        6.4.4   Constants</a>
97 <li><a href="#6.4.5">        6.4.5   String literals</a>
98 <li><a href="#6.4.6">        6.4.6   Punctuators</a>
99 <li><a href="#6.4.7">        6.4.7   Header names</a>
100 <li><a href="#6.4.8">        6.4.8   Preprocessing numbers</a>
101 <li><a href="#6.4.9">        6.4.9   Comments</a>
102 <!--page 4 -->
103 </ul>
104 <li><a href="#6.5">     6.5  Expressions</a>
105 <ul>
106 <li><a href="#6.5.1">          6.5.1   Primary expressions</a>
107 <li><a href="#6.5.2">          6.5.2   Postfix operators</a>
108 <li><a href="#6.5.3">          6.5.3   Unary operators</a>
109 <li><a href="#6.5.4">          6.5.4   Cast operators</a>
110 <li><a href="#6.5.5">          6.5.5   Multiplicative operators</a>
111 <li><a href="#6.5.6">          6.5.6   Additive operators</a>
112 <li><a href="#6.5.7">          6.5.7   Bitwise shift operators</a>
113 <li><a href="#6.5.8">          6.5.8   Relational operators</a>
114 <li><a href="#6.5.9">          6.5.9   Equality operators</a>
115 <li><a href="#6.5.10">          6.5.10 Bitwise AND operator</a>
116 <li><a href="#6.5.11">          6.5.11 Bitwise exclusive OR operator</a>
117 <li><a href="#6.5.12">          6.5.12 Bitwise inclusive OR operator</a>
118 <li><a href="#6.5.13">          6.5.13 Logical AND operator</a>
119 <li><a href="#6.5.14">          6.5.14 Logical OR operator</a>
120 <li><a href="#6.5.15">          6.5.15 Conditional operator</a>
121 <li><a href="#6.5.16">          6.5.16 Assignment operators</a>
122 <li><a href="#6.5.17">          6.5.17 Comma operator</a>
123 </ul>
124 <li><a href="#6.6">     6.6 Constant expressions</a>
125 <li><a href="#6.7">     6.7 Declarations</a>
126 <ul>
127 <li><a href="#6.7.1">          6.7.1   Storage-class specifiers</a>
128 <li><a href="#6.7.2">          6.7.2   Type specifiers</a>
129 <li><a href="#6.7.3">          6.7.3   Type qualifiers</a>
130 <li><a href="#6.7.4">          6.7.4   Function specifiers</a>
131 <li><a href="#6.7.5">          6.7.5   Alignment specifier</a>
132 <li><a href="#6.7.6">          6.7.6   Declarators</a>
133 <li><a href="#6.7.7">          6.7.7   Type names</a>
134 <li><a href="#6.7.8">          6.7.8   Type definitions</a>
135 <li><a href="#6.7.9">          6.7.9   Initialization</a>
136 <li><a href="#6.7.10">          6.7.10 Static assertions</a>
137 </ul>
138 <li><a href="#6.8">     6.8 Statements and blocks</a>
139 <ul>
140 <li><a href="#6.8.1">          6.8.1   Labeled statements</a>
141 <li><a href="#6.8.2">          6.8.2   Compound statement</a>
142 <li><a href="#6.8.3">          6.8.3   Expression and null statements</a>
143 <li><a href="#6.8.4">          6.8.4   Selection statements</a>
144 <li><a href="#6.8.5">          6.8.5   Iteration statements</a>
145 <li><a href="#6.8.6">          6.8.6   Jump statements</a>
146 </ul>
147 <li><a href="#6.9">     6.9 External definitions</a>
148 <ul>
149 <li><a href="#6.9.1">          6.9.1   Function definitions</a>
150 <li><a href="#6.9.2">          6.9.2   External object definitions</a>
151 </ul>
152 <li><a href="#6.10">     6.10 Preprocessing directives</a>
153 <ul>
154 <li><a href="#6.10.1">          6.10.1 Conditional inclusion</a>
155 <li><a href="#6.10.2">          6.10.2 Source file inclusion</a>
156 <li><a href="#6.10.3">          6.10.3 Macro replacement</a>
157 <!--page 5 -->
158 <li><a href="#6.10.4">       6.10.4 Line control</a>
159 <li><a href="#6.10.5">       6.10.5 Error directive</a>
160 <li><a href="#6.10.6">       6.10.6 Pragma directive</a>
161 <li><a href="#6.10.7">       6.10.7 Null directive</a>
162 <li><a href="#6.10.8">       6.10.8 Predefined macro names</a>
163 <li><a href="#6.10.9">       6.10.9 Pragma operator</a>
164 </ul>
165 <li><a href="#6.11">  6.11 Future language directions</a>
166 <ul>
167 <li><a href="#6.11.1">       6.11.1 Floating types</a>
168 <li><a href="#6.11.2">       6.11.2 Linkages of identifiers</a>
169 <li><a href="#6.11.3">       6.11.3 External names</a>
170 <li><a href="#6.11.4">       6.11.4 Character escape sequences</a>
171 <li><a href="#6.11.5">       6.11.5 Storage-class specifiers</a>
172 <li><a href="#6.11.6">       6.11.6 Function declarators</a>
173 <li><a href="#6.11.7">       6.11.7 Function definitions</a>
174 <li><a href="#6.11.8">       6.11.8 Pragma directives</a>
175 <li><a href="#6.11.9">       6.11.9 Predefined macro names</a>
176 </ul>
177 </ul>
178 <li><a href="#7">7. Library</a>
179 <ul>
180 <li><a href="#7.1">   7.1 Introduction</a>
181 <ul>
182 <li><a href="#7.1.1">         7.1.1 Definitions of terms</a>
183 <li><a href="#7.1.2">         7.1.2 Standard headers</a>
184 <li><a href="#7.1.3">         7.1.3 Reserved identifiers</a>
185 <li><a href="#7.1.4">         7.1.4 Use of library functions</a>
186 </ul>
187 <li><a href="#7.2">   7.2 Diagnostics &lt;assert.h&gt;</a>
188 <ul>
189 <li><a href="#7.2.1">         7.2.1 Program diagnostics</a>
190 </ul>
191 <li><a href="#7.3">   7.3 Complex arithmetic &lt;complex.h&gt;</a>
192 <ul>
193 <li><a href="#7.3.1">         7.3.1 Introduction</a>
194 <li><a href="#7.3.2">         7.3.2 Conventions</a>
195 <li><a href="#7.3.3">         7.3.3 Branch cuts</a>
196 <li><a href="#7.3.4">         7.3.4 The CX_LIMITED_RANGE pragma</a>
197 <li><a href="#7.3.5">         7.3.5 Trigonometric functions</a>
198 <li><a href="#7.3.6">         7.3.6 Hyperbolic functions</a>
199 <li><a href="#7.3.7">         7.3.7 Exponential and logarithmic functions</a>
200 <li><a href="#7.3.8">         7.3.8 Power and absolute-value functions</a>
201 <li><a href="#7.3.9">         7.3.9 Manipulation functions</a>
202 </ul>
203 <li><a href="#7.4">   7.4 Character handling &lt;ctype.h&gt;</a>
204 <ul>
205 <li><a href="#7.4.1">         7.4.1 Character classification functions</a>
206 <li><a href="#7.4.2">         7.4.2 Character case mapping functions</a>
207 </ul>
208 <li><a href="#7.5">   7.5 Errors &lt;errno.h&gt;</a>
209 <li><a href="#7.6">   7.6 Floating-point environment &lt;fenv.h&gt;</a>
210 <ul>
211 <li><a href="#7.6.1">         7.6.1 The FENV_ACCESS pragma</a>
212 <li><a href="#7.6.2">         7.6.2 Floating-point exceptions</a>
213 <li><a href="#7.6.3">         7.6.3 Rounding</a>
214 <li><a href="#7.6.4">         7.6.4 Environment</a>
215 </ul>
216 <li><a href="#7.7">   7.7 Characteristics of floating types &lt;float.h&gt;</a>
217 <!--page 6 -->
218 <li><a href="#7.8">     7.8    Format conversion of integer types &lt;inttypes.h&gt;</a>
219 <ul>
220 <li><a href="#7.8.1">            7.8.1    Macros for format specifiers</a>
221 <li><a href="#7.8.2">            7.8.2    Functions for greatest-width integer types</a>
222 </ul>
223 <li><a href="#7.9">     7.9    Alternative spellings &lt;iso646.h&gt;</a>
224 <li><a href="#7.10">     7.10   Sizes of integer types &lt;limits.h&gt;</a>
225 <li><a href="#7.11">     7.11   Localization &lt;locale.h&gt;</a>
226 <ul>
227 <li><a href="#7.11.1">            7.11.1 Locale control</a>
228 <li><a href="#7.11.2">            7.11.2 Numeric formatting convention inquiry</a>
229 </ul>
230 <li><a href="#7.12">     7.12   Mathematics &lt;math.h&gt;</a>
231 <ul>
232 <li><a href="#7.12.1">            7.12.1 Treatment of error conditions</a>
233 <li><a href="#7.12.2">            7.12.2 The FP_CONTRACT pragma</a>
234 <li><a href="#7.12.3">            7.12.3 Classification macros</a>
235 <li><a href="#7.12.4">            7.12.4 Trigonometric functions</a>
236 <li><a href="#7.12.5">            7.12.5 Hyperbolic functions</a>
237 <li><a href="#7.12.6">            7.12.6 Exponential and logarithmic functions</a>
238 <li><a href="#7.12.7">            7.12.7 Power and absolute-value functions</a>
239 <li><a href="#7.12.8">            7.12.8 Error and gamma functions</a>
240 <li><a href="#7.12.9">            7.12.9 Nearest integer functions</a>
241 <li><a href="#7.12.10">            7.12.10 Remainder functions</a>
242 <li><a href="#7.12.11">            7.12.11 Manipulation functions</a>
243 <li><a href="#7.12.12">            7.12.12 Maximum, minimum, and positive difference functions</a>
244 <li><a href="#7.12.13">            7.12.13 Floating multiply-add</a>
245 <li><a href="#7.12.14">            7.12.14 Comparison macros</a>
246 </ul>
247 <li><a href="#7.13">     7.13   Nonlocal jumps &lt;setjmp.h&gt;</a>
248 <ul>
249 <li><a href="#7.13.1">            7.13.1 Save calling environment</a>
250 <li><a href="#7.13.2">            7.13.2 Restore calling environment</a>
251 </ul>
252 <li><a href="#7.14">     7.14   Signal handling &lt;signal.h&gt;</a>
253 <ul>
254 <li><a href="#7.14.1">            7.14.1 Specify signal handling</a>
255 <li><a href="#7.14.2">            7.14.2 Send signal</a>
256 </ul>
257 <li><a href="#7.15">     7.15   Alignment &lt;stdalign.h&gt;</a>
258 <li><a href="#7.16">     7.16   Variable arguments &lt;stdarg.h&gt;</a>
259 <ul>
260 <li><a href="#7.16.1">            7.16.1 Variable argument list access macros</a>
261 </ul>
262 <li><a href="#7.17">     7.17   Atomics &lt;stdatomic.h&gt;</a>
263 <ul>
264 <li><a href="#7.17.1">            7.17.1 Introduction</a>
265 <li><a href="#7.17.2">            7.17.2 Initialization</a>
266 <li><a href="#7.17.3">            7.17.3 Order and consistency</a>
267 <li><a href="#7.17.4">            7.17.4 Fences</a>
268 <li><a href="#7.17.5">            7.17.5 Lock-free property</a>
269 <li><a href="#7.17.6">            7.17.6 Atomic integer types</a>
270 <li><a href="#7.17.7">            7.17.7 Operations on atomic types</a>
271 <li><a href="#7.17.8">            7.17.8 Atomic flag type and operations</a>
272 </ul>
273 <li><a href="#7.18">     7.18   Boolean type and values &lt;stdbool.h&gt;</a>
274 <li><a href="#7.19">     7.19   Common definitions &lt;stddef.h&gt;</a>
275 <li><a href="#7.20">     7.20   Integer types &lt;stdint.h&gt;</a>
276 <!--page 7 -->
277 <ul>
278 <li><a href="#7.20.1">         7.20.1 Integer types</a>
279 <li><a href="#7.20.2">         7.20.2 Limits of specified-width integer types</a>
280 <li><a href="#7.20.3">         7.20.3 Limits of other integer types</a>
281 <li><a href="#7.20.4">         7.20.4 Macros for integer constants</a>
282 </ul>
283 <li><a href="#7.21">  7.21   Input/output &lt;stdio.h&gt;</a>
284 <ul>
285 <li><a href="#7.21.1">         7.21.1 Introduction</a>
286 <li><a href="#7.21.2">         7.21.2 Streams</a>
287 <li><a href="#7.21.3">         7.21.3 Files</a>
288 <li><a href="#7.21.4">         7.21.4 Operations on files</a>
289 <li><a href="#7.21.5">         7.21.5 File access functions</a>
290 <li><a href="#7.21.6">         7.21.6 Formatted input/output functions</a>
291 <li><a href="#7.21.7">         7.21.7 Character input/output functions</a>
292 <li><a href="#7.21.8">         7.21.8 Direct input/output functions</a>
293 <li><a href="#7.21.9">         7.21.9 File positioning functions</a>
294 <li><a href="#7.21.10">         7.21.10 Error-handling functions</a>
295 </ul>
296 <li><a href="#7.22">  7.22   General utilities &lt;stdlib.h&gt;</a>
297 <ul>
298 <li><a href="#7.22.1">         7.22.1 Numeric conversion functions</a>
299 <li><a href="#7.22.2">         7.22.2 Pseudo-random sequence generation functions</a>
300 <li><a href="#7.22.3">         7.22.3 Memory management functions</a>
301 <li><a href="#7.22.4">         7.22.4 Communication with the environment</a>
302 <li><a href="#7.22.5">         7.22.5 Searching and sorting utilities</a>
303 <li><a href="#7.22.6">         7.22.6 Integer arithmetic functions</a>
304 <li><a href="#7.22.7">         7.22.7 Multibyte/wide character conversion functions</a>
305 <li><a href="#7.22.8">         7.22.8 Multibyte/wide string conversion functions</a>
306 </ul>
307 <li><a href="#7.23">  7.23   _Noreturn &lt;stdnoreturn.h&gt;</a>
308 <li><a href="#7.24">  7.24   String handling &lt;string.h&gt;</a>
309 <ul>
310 <li><a href="#7.24.1">         7.24.1 String function conventions</a>
311 <li><a href="#7.24.2">         7.24.2 Copying functions</a>
312 <li><a href="#7.24.3">         7.24.3 Concatenation functions</a>
313 <li><a href="#7.24.4">         7.24.4 Comparison functions</a>
314 <li><a href="#7.24.5">         7.24.5 Search functions</a>
315 <li><a href="#7.24.6">         7.24.6 Miscellaneous functions</a>
316 </ul>
317 <li><a href="#7.25">  7.25   Type-generic math &lt;tgmath.h&gt;</a>
318 <li><a href="#7.26">  7.26   Threads &lt;threads.h&gt;</a>
319 <ul>
320 <li><a href="#7.26.1">         7.26.1 Introduction</a>
321 <li><a href="#7.26.2">         7.26.2 Initialization functions</a>
322 <li><a href="#7.26.3">         7.26.3 Condition variable functions</a>
323 <li><a href="#7.26.4">         7.26.4 Mutex functions</a>
324 <li><a href="#7.26.5">         7.26.5 Thread functions</a>
325 <li><a href="#7.26.6">         7.26.6 Thread-specific storage functions</a>
326 </ul>
327 <li><a href="#7.27">  7.27   Date and time &lt;time.h&gt;</a>
328 <ul>
329 <li><a href="#7.27.1">         7.27.1 Components of time</a>
330 <li><a href="#7.27.2">         7.27.2 Time manipulation functions</a>
331 <li><a href="#7.27.3">         7.27.3 Time conversion functions</a>
332 <!--page 8 -->
333 </ul>
334 <li><a href="#7.28">   7.28 Unicode utilities &lt;uchar.h&gt;</a>
335 <ul>
336 <li><a href="#7.28.1">        7.28.1 Restartable multibyte/wide character conversion functions</a>
337 </ul>
338 <li><a href="#7.29">   7.29 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
339 <ul>
340 <li><a href="#7.29.1">        7.29.1 Introduction</a>
341 <li><a href="#7.29.2">        7.29.2 Formatted wide character input/output functions</a>
342 <li><a href="#7.29.3">        7.29.3 Wide character input/output functions</a>
343 <li><a href="#7.29.4">        7.29.4 General wide string utilities</a>
344 <ul>
345 <li><a href="#7.29.4.1">                 7.29.4.1 Wide string numeric conversion functions</a>
346 <li><a href="#7.29.4.2">                 7.29.4.2 Wide string copying functions</a>
347 <li><a href="#7.29.4.3">                 7.29.4.3 Wide string concatenation functions</a>
348 <li><a href="#7.29.4.4">                 7.29.4.4 Wide string comparison functions</a>
349 <li><a href="#7.29.4.5">                 7.29.4.5 Wide string search functions</a>
350 <li><a href="#7.29.4.6">                 7.29.4.6 Miscellaneous functions</a>
351 </ul>
352 <li><a href="#7.29.5">        7.29.5 Wide character time conversion functions</a>
353 <li><a href="#7.29.6">        7.29.6 Extended multibyte/wide character conversion utilities</a>
354 <ul>
355 <li><a href="#7.29.6.1">                 7.29.6.1 Single-byte/wide character conversion functions</a>
356 <li><a href="#7.29.6.2">                 7.29.6.2 Conversion state functions</a>
357 <li><a href="#7.29.6.3">                 7.29.6.3 Restartable multibyte/wide character conversion functions</a>
358 <li><a href="#7.29.6.4">                 7.29.6.4 Restartable multibyte/wide string conversion functions</a>
359 </ul>
360 </ul>
361 <li><a href="#7.30">   7.30 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
362 <ul>
363 <li><a href="#7.30.1">        7.30.1 Introduction</a>
364 <li><a href="#7.30.2">        7.30.2 Wide character classification utilities</a>
365 <ul>
366 <li><a href="#7.30.2.1">                 7.30.2.1 Wide character classification functions</a>
367 <li><a href="#7.30.2.2">                 7.30.2.2 Extensible wide character classification functions</a>
368 </ul>
369 <li><a href="#7.30.3">        7.30.3 Wide character case mapping utilities</a>
370 <ul>
371 <li><a href="#7.30.3.1">                 7.30.3.1 Wide character case mapping functions</a>
372 <li><a href="#7.30.3.2">                 7.30.3.2 Extensible wide character case mapping functions</a>
373 </ul>
374 </ul>
375 <li><a href="#7.31">   7.31 Future library directions</a>
376 <ul>
377 <li><a href="#7.31.1">        7.31.1 Complex arithmetic &lt;complex.h&gt;</a>
378 <li><a href="#7.31.2">        7.31.2 Character handling &lt;ctype.h&gt;</a>
379 <li><a href="#7.31.3">        7.31.3 Errors &lt;errno.h&gt;</a>
380 <li><a href="#7.31.4">        7.31.4 Floating-point environment &lt;fenv.h&gt;</a>
381 <li><a href="#7.31.5">        7.31.5 Format conversion of integer types &lt;inttypes.h&gt;</a>
382 <li><a href="#7.31.6">        7.31.6 Localization &lt;locale.h&gt;</a>
383 <li><a href="#7.31.7">        7.31.7 Signal handling &lt;signal.h&gt;</a>
384 <li><a href="#7.31.8">        7.31.8 Atomics &lt;stdatomic.h&gt;</a>
385 <li><a href="#7.31.9">        7.31.9 Boolean type and values &lt;stdbool.h&gt;</a>
386 <li><a href="#7.31.10">        7.31.10 Integer types &lt;stdint.h&gt;</a>
387 <li><a href="#7.31.11">        7.31.11 Input/output &lt;stdio.h&gt;</a>
388 <li><a href="#7.31.12">        7.31.12 General utilities &lt;stdlib.h&gt;</a>
389 <!--page 9 -->
390 <li><a href="#7.31.13">        7.31.13 String handling &lt;string.h&gt;</a>
391 <li><a href="#7.31.14">        7.31.14 Date and time &lt;time.h&gt;</a>
392 <li><a href="#7.31.15">        7.31.15 Threads &lt;threads.h&gt;</a>
393 <li><a href="#7.31.16">        7.31.16 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
394 <li><a href="#7.31.17">        7.31.17 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
395 </ul>
396 </ul>
397 <li><a href="#A">Annex A (informative) Language syntax summary</a>
398 <ul>
399 <li><a href="#A.1">  A.1 Lexical grammar</a>
400 <li><a href="#A.2">  A.2 Phrase structure grammar</a>
401 <li><a href="#A.3">  A.3 Preprocessing directives</a>
402 </ul>
403 <li><a href="#B">Annex B (informative) Library summary</a>
404 <ul>
405 <li><a href="#B.1">  B.1 Diagnostics &lt;assert.h&gt;</a>
406 <li><a href="#B.2">  B.2 Complex &lt;complex.h&gt;</a>
407 <li><a href="#B.3">  B.3 Character handling &lt;ctype.h&gt;</a>
408 <li><a href="#B.4">  B.4 Errors &lt;errno.h&gt;</a>
409 <li><a href="#B.5">  B.5 Floating-point environment &lt;fenv.h&gt;</a>
410 <li><a href="#B.6">  B.6 Characteristics of floating types &lt;float.h&gt;</a>
411 <li><a href="#B.7">  B.7 Format conversion of integer types &lt;inttypes.h&gt;</a>
412 <li><a href="#B.8">  B.8 Alternative spellings &lt;iso646.h&gt;</a>
413 <li><a href="#B.9">  B.9 Sizes of integer types &lt;limits.h&gt;</a>
414 <li><a href="#B.10">  B.10 Localization &lt;locale.h&gt;</a>
415 <li><a href="#B.11">  B.11 Mathematics &lt;math.h&gt;</a>
416 <li><a href="#B.12">  B.12 Nonlocal jumps &lt;setjmp.h&gt;</a>
417 <li><a href="#B.13">  B.13 Signal handling &lt;signal.h&gt;</a>
418 <li><a href="#B.14">  B.14 Alignment &lt;stdalign.h&gt;</a>
419 <li><a href="#B.15">  B.15 Variable arguments &lt;stdarg.h&gt;</a>
420 <li><a href="#B.16">  B.16 Atomics &lt;stdatomic.h&gt;</a>
421 <li><a href="#B.17">  B.17 Boolean type and values &lt;stdbool.h&gt;</a>
422 <li><a href="#B.18">  B.18 Common definitions &lt;stddef.h&gt;</a>
423 <li><a href="#B.19">  B.19 Integer types &lt;stdint.h&gt;</a>
424 <li><a href="#B.20">  B.20 Input/output &lt;stdio.h&gt;</a>
425 <li><a href="#B.21">  B.21 General utilities &lt;stdlib.h&gt;</a>
426 <li><a href="#B.22">  B.22 _Noreturn &lt;stdnoreturn.h&gt;</a>
427 <li><a href="#B.23">  B.23 String handling &lt;string.h&gt;</a>
428 <li><a href="#B.24">  B.24 Type-generic math &lt;tgmath.h&gt;</a>
429 <li><a href="#B.25">  B.25 Threads &lt;threads.h&gt;</a>
430 <li><a href="#B.26">  B.26 Date and time &lt;time.h&gt;</a>
431 <li><a href="#B.27">  B.27 Unicode utilities &lt;uchar.h&gt;</a>
432 <li><a href="#B.28">  B.28 Extended multibyte/wide character utilities &lt;wchar.h&gt;</a>
433 <li><a href="#B.29">  B.29 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
434 </ul>
435 <li><a href="#C">Annex C (informative) Sequence points</a>
436 <!--page 10 -->
437 <li><a href="#D">Annex D (normative) Universal character names for identifiers</a>
438 <ul>
439 <li><a href="#D.1">  D.1 Ranges of characters allowed</a>
440 <li><a href="#D.2">  D.2 Ranges of characters disallowed initially</a>
441 </ul>
442 <li><a href="#E">Annex E (informative) Implementation limits</a>
443 <li><a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic</a>
444 <ul>
445 <li><a href="#F.1">  F.1 Introduction</a>
446 <li><a href="#F.2">  F.2 Types</a>
447 <li><a href="#F.3">  F.3 Operators and functions</a>
448 <li><a href="#F.4">  F.4 Floating to integer conversion</a>
449 <li><a href="#F.5">  F.5 Binary-decimal conversion</a>
450 <li><a href="#F.6">  F.6 The return statement</a>
451 <li><a href="#F.7">  F.7 Contracted expressions</a>
452 <li><a href="#F.8">  F.8 Floating-point environment</a>
453 <li><a href="#F.9">  F.9 Optimization</a>
454 <li><a href="#F.10">  F.10 Mathematics &lt;math.h&gt;</a>
455 <ul>
456 <li><a href="#F.10.1">        F.10.1 Trigonometric functions</a>
457 <li><a href="#F.10.2">        F.10.2 Hyperbolic functions</a>
458 <li><a href="#F.10.3">        F.10.3 Exponential and logarithmic functions</a>
459 <li><a href="#F.10.4">        F.10.4 Power and absolute value functions</a>
460 <li><a href="#F.10.5">        F.10.5 Error and gamma functions</a>
461 <li><a href="#F.10.6">        F.10.6 Nearest integer functions</a>
462 <li><a href="#F.10.7">        F.10.7 Remainder functions</a>
463 <li><a href="#F.10.8">        F.10.8 Manipulation functions</a>
464 <li><a href="#F.10.9">        F.10.9 Maximum, minimum, and positive difference functions</a>
465 <li><a href="#F.10.10">        F.10.10 Floating multiply-add</a>
466 <li><a href="#F.10.11">        F.10.11 Comparison macros</a>
467 </ul>
468 </ul>
469 <li><a href="#G">Annex G (normative) IEC 60559-compatible complex arithmetic</a>
470 <ul>
471 <li><a href="#G.1">  G.1 Introduction</a>
472 <li><a href="#G.2">  G.2 Types</a>
473 <li><a href="#G.3">  G.3 Conventions</a>
474 <li><a href="#G.4">  G.4 Conversions</a>
475 <ul>
476 <li><a href="#G.4.1">       G.4.1 Imaginary types</a>
477 <li><a href="#G.4.2">       G.4.2 Real and imaginary</a>
478 <li><a href="#G.4.3">       G.4.3 Imaginary and complex</a>
479 </ul>
480 <li><a href="#G.5">  G.5 Binary operators</a>
481 <ul>
482 <li><a href="#G.5.1">       G.5.1 Multiplicative operators</a>
483 <li><a href="#G.5.2">       G.5.2 Additive operators</a>
484 </ul>
485 <li><a href="#G.6">  G.6 Complex arithmetic &lt;complex.h&gt;</a>
486 <ul>
487 <li><a href="#G.6.1">       G.6.1 Trigonometric functions</a>
488 <li><a href="#G.6.2">       G.6.2 Hyperbolic functions</a>
489 <li><a href="#G.6.3">       G.6.3 Exponential and logarithmic functions</a>
490 <li><a href="#G.6.4">       G.6.4 Power and absolute-value functions</a>
491 </ul>
492 <li><a href="#G.7">  G.7 Type-generic math &lt;tgmath.h&gt;</a>
493 <!--page 11 -->
494 </ul>
495 <li><a href="#H">Annex H (informative) Language independent arithmetic</a>
496 <ul>
497 <li><a href="#H.1">  H.1 Introduction</a>
498 <li><a href="#H.2">  H.2 Types</a>
499 <li><a href="#H.3">  H.3 Notification</a>
500 </ul>
501 <li><a href="#I">Annex I (informative) Common warnings</a>
502 <li><a href="#J">Annex J (informative) Portability issues</a>
503 <ul>
504 <li><a href="#J.1">  J.1 Unspecified behavior</a>
505 <li><a href="#J.2">  J.2 Undefined behavior</a>
506 <li><a href="#J.3">  J.3 Implementation-defined behavior</a>
507 <li><a href="#J.4">  J.4 Locale-specific behavior</a>
508 <li><a href="#J.5">  J.5 Common extensions</a>
509 </ul>
510 <li><a href="#K">Annex K (normative) Bounds-checking interfaces</a>
511 <ul>
512 <li><a href="#K.1">  K.1 Background</a>
513 <li><a href="#K.2">  K.2 Scope</a>
514 <li><a href="#K.3">  K.3 Library</a>
515 <ul>
516 <li><a href="#K.3.1">       K.3.1 Introduction</a>
517 <ul>
518 <li><a href="#K.3.1.1">                K.3.1.1 Standard headers</a>
519 <li><a href="#K.3.1.2">                K.3.1.2 Reserved identifiers</a>
520 <li><a href="#K.3.1.3">                K.3.1.3 Use of errno</a>
521 <li><a href="#K.3.1.4">                K.3.1.4 Runtime-constraint violations</a>
522 </ul>
523 <li><a href="#K.3.2">       K.3.2 Errors &lt;errno.h&gt;</a>
524 <li><a href="#K.3.3">       K.3.3 Common definitions &lt;stddef.h&gt;</a>
525 <li><a href="#K.3.4">       K.3.4 Integer types &lt;stdint.h&gt;</a>
526 <li><a href="#K.3.5">       K.3.5 Input/output &lt;stdio.h&gt;</a>
527 <ul>
528 <li><a href="#K.3.5.1">                K.3.5.1 Operations on files</a>
529 <li><a href="#K.3.5.2">                K.3.5.2 File access functions</a>
530 <li><a href="#K.3.5.3">                K.3.5.3 Formatted input/output functions</a>
531 <li><a href="#K.3.5.4">                K.3.5.4 Character input/output functions</a>
532 </ul>
533 <li><a href="#K.3.6">       K.3.6 General utilities &lt;stdlib.h&gt;</a>
534 <ul>
535 <li><a href="#K.3.6.1">                K.3.6.1 Runtime-constraint handling</a>
536 <li><a href="#K.3.6.2">                K.3.6.2 Communication with the environment</a>
537 <li><a href="#K.3.6.3">                K.3.6.3 Searching and sorting utilities</a>
538 <li><a href="#K.3.6.4">                K.3.6.4 Multibyte/wide character conversion functions</a>
539 <li><a href="#K.3.6.5">                K.3.6.5 Multibyte/wide string conversion functions</a>
540 </ul>
541 <li><a href="#K.3.7">       K.3.7 String handling &lt;string.h&gt;</a>
542 <ul>
543 <li><a href="#K.3.7.1">                K.3.7.1 Copying functions</a>
544 <li><a href="#K.3.7.2">                K.3.7.2 Concatenation functions</a>
545 <li><a href="#K.3.7.3">                K.3.7.3 Search functions</a>
546 <li><a href="#K.3.7.4">                K.3.7.4 Miscellaneous functions</a>
547 </ul>
548 <li><a href="#K.3.8">       K.3.8 Date and time &lt;time.h&gt;</a>
549 <ul>
550 <li><a href="#K.3.8.1">                K.3.8.1 Components of time</a>
551 <li><a href="#K.3.8.2">                K.3.8.2 Time conversion functions</a>
552 <!--page 12 -->
553 </ul>
554 <li><a href="#K.3.9">        K.3.9   Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
555 <ul>
556 <li><a href="#K.3.9.1">                K.3.9.1 Formatted wide character input/output functions</a>
557 <li><a href="#K.3.9.2">                K.3.9.2 General wide string utilities</a>
558 <li><a href="#K.3.9.3">                K.3.9.3 Extended multibyte/wide character conversion utilities</a>
559 </ul>
560 </ul>
561 </ul>
562 <li><a href="#L">Annex L (normative) Analyzability</a>
563 <ul>
564 <li><a href="#L.1">  L.1 Scope</a>
565 <li><a href="#L.2">  L.2 Definitions</a>
566 <li><a href="#L.3">  L.3 Requirements</a>
567 </ul>
568 <li><a href="#Bibliography">Bibliography</a>
569 <li><a href="#Index">Index</a>
570 <!--page 13 -->
571 </ul>
572
573 <p><small><a href="#Contents">Contents</a></small>
574 <h2><a name="Foreword" href="#Foreword">Foreword</a></h2>
575 <p><a name="Forewordp1" href="#Forewordp1"><small>1</small></a>
576  ISO (the International Organization for Standardization) and IEC (the International
577  Electrotechnical Commission) form the specialized system for worldwide
578  standardization. National bodies that are member of ISO or IEC participate in the
579  development of International Standards through technical committees established by the
580  respective organization to deal with particular fields of technical activity. ISO and IEC
581  technical committees collaborate in fields of mutual interest. Other international
582  organizations, governmental and non-governmental, in liaison with ISO and IEC, also
583  take part in the work.
584 <p><a name="Forewordp2" href="#Forewordp2"><small>2</small></a>
585  International Standards are drafted in accordance with the rules given in the ISO/IEC
586  Directives, Part 2. This International Standard was drafted in accordance with the fifth
587  edition (2004).
588 <p><a name="Forewordp3" href="#Forewordp3"><small>3</small></a>
589  In the field of information technology, ISO and IEC have established a joint technical
590  committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
591  committee are circulated to national bodies for voting. Publication as an International
592  Standard requires approval by at least 75% of the national bodies casting a vote.
593 <p><a name="Forewordp4" href="#Forewordp4"><small>4</small></a>
594  Attention is drawn to the possibility that some of the elements of this document may be
595  the subject of patent rights. ISO and IEC shall not be held responsible for identifying any
596  or all such patent rights.
597 <p><a name="Forewordp5" href="#Forewordp5"><small>5</small></a>
598  This International Standard was prepared by Joint Technical Committee ISO/IEC JTC 1,
599  Information technology, Subcommittee SC 22, Programming languages, their
600  environments and system software interfaces. The Working Group responsible for this
601  standard (WG 14) maintains a site on the World Wide Web at http://www.open-
602  std.org/JTC1/SC22/WG14/ containing additional information relevant to this
603  standard such as a Rationale for many of the decisions made during its preparation and a
604  log of Defect Reports and Responses.
605 <p><a name="Forewordp6" href="#Forewordp6"><small>6</small></a>
606  This third edition cancels and replaces the second edition, ISO/IEC 9899:1999, as
607  corrected by ISO/IEC 9899:1999/Cor 1:2001, ISO/IEC 9899:1999/Cor 2:2004, and
608  ISO/IEC 9899:1999/Cor 3:2007. Major changes from the previous edition include:
609 <ul>
610 <li>  conditional (optional) features (including some that were previously mandatory)
611 <li>  support for multiple threads of execution including an improved memory sequencing
612  model, atomic objects, and thread-local storage (<a href="#7.17">&lt;stdatomic.h&gt;</a> and
613  <a href="#7.26">&lt;threads.h&gt;</a>)
614 <li>  additional floating-point characteristic macros (<a href="#7.7">&lt;float.h&gt;</a>)
615 <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>)
616 <li>  Unicode characters and           strings   (<a href="#7.28">&lt;uchar.h&gt;</a>)       (originally   specified    in
617  ISO/IEC TR 19769:2004)
618 <li>  type-generic expressions
619 <!--page 14 -->
620 <li>  static assertions
621 <li>  anonymous structures and unions
622 <li>  no-return functions
623 <li>  macros to create complex numbers (<a href="#7.3">&lt;complex.h&gt;</a>)
624 <li>  support for opening files for exclusive access
625 <li>  removed the gets function (<a href="#7.21">&lt;stdio.h&gt;</a>)
626 <li>  added the aligned_alloc, at_quick_exit, and quick_exit functions
627  (<a href="#7.22">&lt;stdlib.h&gt;</a>)
628 <li>  (conditional) support for bounds-checking interfaces (originally specified in
629  ISO/IEC TR 24731-1:2007)
630 <li>  (conditional) support for analyzability
631 </ul>
632 <p><a name="Forewordp7" href="#Forewordp7"><small>7</small></a>
633  Major changes in the second edition included:
634 <ul>
635 <li>  restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
636  in AMD1)
637 <li>  wide character library support in <a href="#7.29">&lt;wchar.h&gt;</a> and <a href="#7.30">&lt;wctype.h&gt;</a> (originally
638  specified in AMD1)
639 <li>  more precise aliasing rules via effective type
640 <li>  restricted pointers
641 <li>  variable length arrays
642 <li>  flexible array members
643 <li>  static and type qualifiers in parameter array declarators
644 <li>  complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
645 <li>  type-generic math macros in <a href="#7.25">&lt;tgmath.h&gt;</a>
646 <li>  the long long int type and library functions
647 <li>  increased minimum translation limits
648 <li>  additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
649 <li>  remove implicit int
650 <li>  reliable integer division
651 <li>  universal character names (\u and \U)
652 <li>  extended identifiers
653 <li>  hexadecimal floating-point constants and %a and %A printf/scanf conversion
654  specifiers
655 <!--page 15 -->
656 <li>  compound literals
657 <li>  designated initializers
658 <li>  // comments
659 <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>
660 <li>  remove implicit function declaration
661 <li>  preprocessor arithmetic done in intmax_t/uintmax_t
662 <li>  mixed declarations and code
663 <li>  new block scopes for selection and iteration statements
664 <li>  integer constant type rules
665 <li>  integer promotion rules
666 <li>  macros with a variable number of arguments
667 <li>  the vscanf family of functions in <a href="#7.21">&lt;stdio.h&gt;</a> and <a href="#7.29">&lt;wchar.h&gt;</a>
668 <li>  additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
669 <li>  treatment of error conditions by math library functions (math_errhandling)
670 <li>  floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
671 <li>  IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
672 <li>  trailing comma allowed in enum declaration
673 <li>  %lf conversion specifier allowed in printf
674 <li>  inline functions
675 <li>  the snprintf family of functions in <a href="#7.21">&lt;stdio.h&gt;</a>
676 <li>  boolean type in <a href="#7.18">&lt;stdbool.h&gt;</a>
677 <li>  idempotent type qualifiers
678 <li>  empty macro arguments
679 <li>  new structure type compatibility rules (tag compatibility)
680 <li>  additional predefined macro names
681 <li>  _Pragma preprocessing operator
682 <li>  standard pragmas
683 <li>  __func__ predefined identifier
684 <li>  va_copy macro
685 <li>  additional strftime conversion specifiers
686 <li>  LIA compatibility annex
687 <!--page 16 -->
688 <li>  deprecate ungetc at the beginning of a binary file
689 <li>  remove deprecation of aliased array parameters
690 <li>  conversion of array to pointer not limited to lvalues
691 <li>  relaxed constraints on aggregate and union initialization
692 <li>  relaxed restrictions on portable header names
693 <li>  return without expression not permitted in function that returns a value (and vice
694  versa)
695 </ul>
696 <p><a name="Forewordp8" href="#Forewordp8"><small>8</small></a>
697  Annexes D, F, G, K, and L form a normative part of this standard; annexes A, B, C, E, H,
698  I, J, the bibliography, and the index are for information only. In accordance with Part 2 of
699  the ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples
700  are also for information only.
701 <!--page 17 -->
702
703 <p><small><a href="#Contents">Contents</a></small>
704 <h2><a name="Introduction" href="#Introduction">Introduction</a></h2>
705 <p><a name="Introductionp1" href="#Introductionp1"><small>1</small></a>
706  With the introduction of new devices and extended character sets, new features may be
707  added to this International Standard. Subclauses in the language and library clauses warn
708  implementors and programmers of usages which, though valid in themselves, may
709  conflict with future additions.
710 <p><a name="Introductionp2" href="#Introductionp2"><small>2</small></a>
711  Certain features are obsolescent, which means that they may be considered for
712  withdrawal in future revisions of this International Standard. They are retained because
713  of their widespread use, but their use in new implementations (for implementation
714  features) or new programs (for language [<a href="#6.11">6.11</a>] or library features [<a href="#7.31">7.31</a>]) is discouraged.
715 <p><a name="Introductionp3" href="#Introductionp3"><small>3</small></a>
716  This International Standard is divided into four major subdivisions:
717 <ul>
718 <li>  preliminary elements (clauses 1-4);
719 <li>  the characteristics of environments that translate and execute C programs (clause 5);
720 <li>  the language syntax, constraints, and semantics (clause 6);
721 <li>  the library facilities (clause 7).
722 </ul>
723 <p><a name="Introductionp4" href="#Introductionp4"><small>4</small></a>
724  Examples are provided to illustrate possible forms of the constructions described.
725  Footnotes are provided to emphasize consequences of the rules described in that
726  subclause or elsewhere in this International Standard. References are used to refer to
727  other related subclauses. Recommendations are provided to give advice or guidance to
728  implementors. Annexes provide additional information and summarize the information
729  contained in this International Standard. A bibliography lists documents that were
730  referred to during the preparation of the standard.
731 <p><a name="Introductionp5" href="#Introductionp5"><small>5</small></a>
732  The language clause (clause 6) is derived from ''The C Reference Manual''.
733 <p><a name="Introductionp6" href="#Introductionp6"><small>6</small></a>
734  The library clause (clause 7) is based on the 1984 /usr/group Standard.
735 <!--page 18 -->
736 <!--page 19 -->
737
738 <p><small><a href="#Contents">Contents</a></small>
739 <h1>Programming languages -- C</h1>
740  
741  
742  
743
744 <p><small><a href="#Contents">Contents</a></small>
745 <h2><a name="1" href="#1">1. Scope</a></h2>
746 <p><a name="1p1" href="#1p1"><small>1</small></a>
747  This International Standard specifies the form and establishes the interpretation of
748  programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
749 <ul>
750 <li>  the representation of C programs;
751 <li>  the syntax and constraints of the C language;
752 <li>  the semantic rules for interpreting C programs;
753 <li>  the representation of input data to be processed by C programs;
754 <li>  the representation of output data produced by C programs;
755 <li>  the restrictions and limits imposed by a conforming implementation of C.
756 </ul>
757 <p><a name="1p2" href="#1p2"><small>2</small></a>
758  This International Standard does not specify
759 <ul>
760 <li>  the mechanism by which C programs are transformed for use by a data-processing
761  system;
762 <li>  the mechanism by which C programs are invoked for use by a data-processing
763  system;
764 <li>  the mechanism by which input data are transformed for use by a C program;
765 <li>  the mechanism by which output data are transformed after being produced by a C
766  program;
767 <li>  the size or complexity of a program and its data that will exceed the capacity of any
768  specific data-processing system or the capacity of a particular processor;
769 <li>  all minimal requirements of a data-processing system that is capable of supporting a
770  conforming implementation.
771  
772  
773 <!--page 20 -->
774 </ul>
775
776 <p><b>Footnotes</b>
777 <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
778  data-processing systems. It is intended for use by implementors and programmers.
779 </small>
780
781 <p><small><a href="#Contents">Contents</a></small>
782 <h2><a name="2" href="#2">2. Normative references</a></h2>
783 <p><a name="2p1" href="#2p1"><small>1</small></a>
784  The following referenced documents are indispensable for the application of this
785  document. For dated references, only the edition cited applies. For undated references,
786  the latest edition of the referenced document (including any amendments) applies.
787 <p><a name="2p2" href="#2p2"><small>2</small></a>
788  ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
789  use in the physical sciences and technology.
790 <p><a name="2p3" href="#2p3"><small>3</small></a>
791  ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
792  interchange.
793 <p><a name="2p4" href="#2p4"><small>4</small></a>
794  ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
795  terms.
796 <p><a name="2p5" href="#2p5"><small>5</small></a>
797  ISO 4217, Codes for the representation of currencies and funds.
798 <p><a name="2p6" href="#2p6"><small>6</small></a>
799  ISO 8601, Data elements and interchange formats -- Information interchange --
800  Representation of dates and times.
801 <p><a name="2p7" href="#2p7"><small>7</small></a>
802  ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
803  Character Set (UCS).
804 <p><a name="2p8" href="#2p8"><small>8</small></a>
805  IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
806  designated IEC 559:1989).
807 <!--page 21 -->
808
809 <p><small><a href="#Contents">Contents</a></small>
810 <h2><a name="3" href="#3">3. Terms, definitions, and symbols</a></h2>
811 <p><a name="3p1" href="#3p1"><small>1</small></a>
812  For the purposes of this International Standard, the following definitions apply. Other
813  terms are defined where they appear in italic type or on the left side of a syntax rule.
814  Terms explicitly defined in this International Standard are not to be presumed to refer
815  implicitly to similar terms defined elsewhere. Terms not defined in this International
816  Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
817  defined in this International Standard are to be interpreted according to ISO 31-11.
818
819 <p><small><a href="#Contents">Contents</a></small>
820 <h3><a name="3.1" href="#3.1">3.1</a></h3>
821 <p><a name="3.1p1" href="#3.1p1"><small>1</small></a>
822 <b> access</b><br>
823  &lt;execution-time action&gt; to read or modify the value of an object
824 <p><a name="3.1p2" href="#3.1p2"><small>2</small></a>
825  NOTE 1   Where only one of these two actions is meant, ''read'' or ''modify'' is used.
826  
827 <p><a name="3.1p3" href="#3.1p3"><small>3</small></a>
828  NOTE 2   ''Modify'' includes the case where the new value being stored is the same as the previous value.
829  
830 <p><a name="3.1p4" href="#3.1p4"><small>4</small></a>
831  NOTE 3   Expressions that are not evaluated do not access objects.
832  
833
834 <p><small><a href="#Contents">Contents</a></small>
835 <h3><a name="3.2" href="#3.2">3.2</a></h3>
836 <p><a name="3.2p1" href="#3.2p1"><small>1</small></a>
837 <b> alignment</b><br>
838  requirement that objects of a particular type be located on storage boundaries with
839  addresses that are particular multiples of a byte address
840
841 <p><small><a href="#Contents">Contents</a></small>
842 <h3><a name="3.3" href="#3.3">3.3</a></h3>
843 <p><a name="3.3p1" href="#3.3p1"><small>1</small></a>
844 <b> argument</b><br>
845  actual argument
846  actual parameter (deprecated)
847  expression in the comma-separated list bounded by the parentheses in a function call
848  expression, or a sequence of preprocessing tokens in the comma-separated list bounded
849  by the parentheses in a function-like macro invocation
850
851 <p><small><a href="#Contents">Contents</a></small>
852 <h3><a name="3.4" href="#3.4">3.4</a></h3>
853 <p><a name="3.4p1" href="#3.4p1"><small>1</small></a>
854 <b> behavior</b><br>
855  external appearance or action
856
857 <p><small><a href="#Contents">Contents</a></small>
858 <h4><a name="3.4.1" href="#3.4.1">3.4.1</a></h4>
859 <p><a name="3.4.1p1" href="#3.4.1p1"><small>1</small></a>
860 <b> implementation-defined behavior</b><br>
861  unspecified behavior where each implementation documents how the choice is made
862 <p><a name="3.4.1p2" href="#3.4.1p2"><small>2</small></a>
863  EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
864  when a signed integer is shifted right.
865  
866
867 <p><small><a href="#Contents">Contents</a></small>
868 <h4><a name="3.4.2" href="#3.4.2">3.4.2</a></h4>
869 <p><a name="3.4.2p1" href="#3.4.2p1"><small>1</small></a>
870 <b> locale-specific behavior</b><br>
871  behavior that depends on local conventions of nationality, culture, and language that each
872  implementation documents
873 <!--page 22 -->
874 <p><a name="3.4.2p2" href="#3.4.2p2"><small>2</small></a>
875  EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
876  characters other than the 26 lowercase Latin letters.
877  
878
879 <p><small><a href="#Contents">Contents</a></small>
880 <h4><a name="3.4.3" href="#3.4.3">3.4.3</a></h4>
881 <p><a name="3.4.3p1" href="#3.4.3p1"><small>1</small></a>
882 <b> undefined behavior</b><br>
883  behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
884  for which this International Standard imposes no requirements
885 <p><a name="3.4.3p2" href="#3.4.3p2"><small>2</small></a>
886  NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
887  results, to behaving during translation or program execution in a documented manner characteristic of the
888  environment (with or without the issuance of a diagnostic message), to terminating a translation or
889  execution (with the issuance of a diagnostic message).
890  
891 <p><a name="3.4.3p3" href="#3.4.3p3"><small>3</small></a>
892  EXAMPLE        An example of undefined behavior is the behavior on integer overflow.
893  
894
895 <p><small><a href="#Contents">Contents</a></small>
896 <h4><a name="3.4.4" href="#3.4.4">3.4.4</a></h4>
897 <p><a name="3.4.4p1" href="#3.4.4p1"><small>1</small></a>
898 <b> unspecified behavior</b><br>
899  use of an unspecified value, or other behavior where this International Standard provides
900  two or more possibilities and imposes no further requirements on which is chosen in any
901  instance
902 <p><a name="3.4.4p2" href="#3.4.4p2"><small>2</small></a>
903  EXAMPLE        An example of unspecified behavior is the order in which the arguments to a function are
904  evaluated.
905  
906
907 <p><small><a href="#Contents">Contents</a></small>
908 <h3><a name="3.5" href="#3.5">3.5</a></h3>
909 <p><a name="3.5p1" href="#3.5p1"><small>1</small></a>
910 <b> bit</b><br>
911  unit of data storage in the execution environment large enough to hold an object that may
912  have one of two values
913 <p><a name="3.5p2" href="#3.5p2"><small>2</small></a>
914  NOTE     It need not be possible to express the address of each individual bit of an object.
915  
916
917 <p><small><a href="#Contents">Contents</a></small>
918 <h3><a name="3.6" href="#3.6">3.6</a></h3>
919 <p><a name="3.6p1" href="#3.6p1"><small>1</small></a>
920 <b> byte</b><br>
921  addressable unit of data storage large enough to hold any member of the basic character
922  set of the execution environment
923 <p><a name="3.6p2" href="#3.6p2"><small>2</small></a>
924  NOTE 1     It is possible to express the address of each individual byte of an object uniquely.
925  
926 <p><a name="3.6p3" href="#3.6p3"><small>3</small></a>
927  NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
928  defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
929  bit.
930  
931
932 <p><small><a href="#Contents">Contents</a></small>
933 <h3><a name="3.7" href="#3.7">3.7</a></h3>
934 <p><a name="3.7p1" href="#3.7p1"><small>1</small></a>
935 <b> character</b><br>
936  &lt;abstract&gt; member of a set of elements used for the organization, control, or
937  representation of data
938
939 <p><small><a href="#Contents">Contents</a></small>
940 <h4><a name="3.7.1" href="#3.7.1">3.7.1</a></h4>
941 <p><a name="3.7.1p1" href="#3.7.1p1"><small>1</small></a>
942 <b> character</b><br>
943  single-byte character
944  &lt;C&gt; bit representation that fits in a byte
945 <!--page 23 -->
946
947 <p><small><a href="#Contents">Contents</a></small>
948 <h4><a name="3.7.2" href="#3.7.2">3.7.2</a></h4>
949 <p><a name="3.7.2p1" href="#3.7.2p1"><small>1</small></a>
950 <b> multibyte character</b><br>
951  sequence of one or more bytes representing a member of the extended character set of
952  either the source or the execution environment
953 <p><a name="3.7.2p2" href="#3.7.2p2"><small>2</small></a>
954  NOTE    The extended character set is a superset of the basic character set.
955  
956
957 <p><small><a href="#Contents">Contents</a></small>
958 <h4><a name="3.7.3" href="#3.7.3">3.7.3</a></h4>
959 <p><a name="3.7.3p1" href="#3.7.3p1"><small>1</small></a>
960 <b> wide character</b><br>
961  value representable by an object of type wchar_t, capable of representing any character
962  in the current locale
963
964 <p><small><a href="#Contents">Contents</a></small>
965 <h3><a name="3.8" href="#3.8">3.8</a></h3>
966 <p><a name="3.8p1" href="#3.8p1"><small>1</small></a>
967 <b> constraint</b><br>
968  restriction, either syntactic or semantic, by which the exposition of language elements is
969  to be interpreted
970
971 <p><small><a href="#Contents">Contents</a></small>
972 <h3><a name="3.9" href="#3.9">3.9</a></h3>
973 <p><a name="3.9p1" href="#3.9p1"><small>1</small></a>
974 <b> correctly rounded result</b><br>
975  representation in the result format that is nearest in value, subject to the current rounding
976  mode, to what the result would be given unlimited range and precision
977
978 <p><small><a href="#Contents">Contents</a></small>
979 <h3><a name="3.10" href="#3.10">3.10</a></h3>
980 <p><a name="3.10p1" href="#3.10p1"><small>1</small></a>
981 <b> diagnostic message</b><br>
982  message belonging to an implementation-defined subset of the implementation's message
983  output
984
985 <p><small><a href="#Contents">Contents</a></small>
986 <h3><a name="3.11" href="#3.11">3.11</a></h3>
987 <p><a name="3.11p1" href="#3.11p1"><small>1</small></a>
988 <b> forward reference</b><br>
989  reference to a later subclause of this International Standard that contains additional
990  information relevant to this subclause
991
992 <p><small><a href="#Contents">Contents</a></small>
993 <h3><a name="3.12" href="#3.12">3.12</a></h3>
994 <p><a name="3.12p1" href="#3.12p1"><small>1</small></a>
995 <b> implementation</b><br>
996  particular set of software, running in a particular translation environment under particular
997  control options, that performs translation of programs for, and supports execution of
998  functions in, a particular execution environment
999
1000 <p><small><a href="#Contents">Contents</a></small>
1001 <h3><a name="3.13" href="#3.13">3.13</a></h3>
1002 <p><a name="3.13p1" href="#3.13p1"><small>1</small></a>
1003 <b> implementation limit</b><br>
1004  restriction imposed upon programs by the implementation
1005
1006 <p><small><a href="#Contents">Contents</a></small>
1007 <h3><a name="3.14" href="#3.14">3.14</a></h3>
1008 <p><a name="3.14p1" href="#3.14p1"><small>1</small></a>
1009 <b> memory location</b><br>
1010  either an object of scalar type, or a maximal sequence of adjacent bit-fields all having
1011  nonzero width
1012 <!--page 24 -->
1013 <p><a name="3.14p2" href="#3.14p2"><small>2</small></a>
1014  NOTE 1 Two threads of execution can update and access separate memory locations without interfering
1015  with each other.
1016  
1017 <p><a name="3.14p3" href="#3.14p3"><small>3</small></a>
1018  NOTE 2 A bit-field and an adjacent non-bit-field member are in separate memory locations. The same
1019  applies to two bit-fields, if one is declared inside a nested structure declaration and the other is not, or if the
1020  two are separated by a zero-length bit-field declaration, or if they are separated by a non-bit-field member
1021  declaration. It is not safe to concurrently update two non-atomic bit-fields in the same structure if all
1022  members declared between them are also (non-zero-length) bit-fields, no matter what the sizes of those
1023  intervening bit-fields happen to be.
1024  
1025 <p><a name="3.14p4" href="#3.14p4"><small>4</small></a>
1026  EXAMPLE        A structure declared as
1027 <pre>
1028           struct {
1029                 char a;
1030                 int b:5, c:11, :0, d:8;
1031                 struct { int ee:8; } e;
1032           }
1033 </pre>
1034  contains four separate memory locations: The member a, and bit-fields d and e.ee are each separate
1035  memory locations, and can be modified concurrently without interfering with each other. The bit-fields b
1036  and c together constitute the fourth memory location. The bit-fields b and c cannot be concurrently
1037  modified, but b and a, for example, can be.
1038  
1039
1040 <p><small><a href="#Contents">Contents</a></small>
1041 <h3><a name="3.15" href="#3.15">3.15</a></h3>
1042 <p><a name="3.15p1" href="#3.15p1"><small>1</small></a>
1043 <b> object</b><br>
1044  region of data storage in the execution environment, the contents of which can represent
1045  values
1046 <p><a name="3.15p2" href="#3.15p2"><small>2</small></a>
1047  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>.
1048  
1049
1050 <p><small><a href="#Contents">Contents</a></small>
1051 <h3><a name="3.16" href="#3.16">3.16</a></h3>
1052 <p><a name="3.16p1" href="#3.16p1"><small>1</small></a>
1053 <b> parameter</b><br>
1054  formal parameter
1055  formal argument (deprecated)
1056  object declared as part of a function declaration or definition that acquires a value on
1057  entry to the function, or an identifier from the comma-separated list bounded by the
1058  parentheses immediately following the macro name in a function-like macro definition
1059
1060 <p><small><a href="#Contents">Contents</a></small>
1061 <h3><a name="3.17" href="#3.17">3.17</a></h3>
1062 <p><a name="3.17p1" href="#3.17p1"><small>1</small></a>
1063 <b> recommended practice</b><br>
1064  specification that is strongly recommended as being in keeping with the intent of the
1065  standard, but that may be impractical for some implementations
1066
1067 <p><small><a href="#Contents">Contents</a></small>
1068 <h3><a name="3.18" href="#3.18">3.18</a></h3>
1069 <p><a name="3.18p1" href="#3.18p1"><small>1</small></a>
1070 <b> runtime-constraint</b><br>
1071  requirement on a program when calling a library function
1072 <p><a name="3.18p2" href="#3.18p2"><small>2</small></a>
1073  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
1074  need not be diagnosed at translation time.
1075  
1076 <p><a name="3.18p3" href="#3.18p3"><small>3</small></a>
1077  NOTE 2 Implementations that support the extensions in <a href="#K">annex K</a> are required to verify that the runtime-
1078  constraints for a library function are not violated by the program; see <a href="#K.3.1.4">K.3.1.4</a>.
1079 <!--page 25 -->
1080
1081 <p><small><a href="#Contents">Contents</a></small>
1082 <h3><a name="3.19" href="#3.19">3.19</a></h3>
1083 <p><a name="3.19p1" href="#3.19p1"><small>1</small></a>
1084 <b> value</b><br>
1085  precise meaning of the contents of an object when interpreted as having a specific type
1086
1087 <p><small><a href="#Contents">Contents</a></small>
1088 <h4><a name="3.19.1" href="#3.19.1">3.19.1</a></h4>
1089 <p><a name="3.19.1p1" href="#3.19.1p1"><small>1</small></a>
1090 <b> implementation-defined value</b><br>
1091  unspecified value where each implementation documents how the choice is made
1092
1093 <p><small><a href="#Contents">Contents</a></small>
1094 <h4><a name="3.19.2" href="#3.19.2">3.19.2</a></h4>
1095 <p><a name="3.19.2p1" href="#3.19.2p1"><small>1</small></a>
1096 <b> indeterminate value</b><br>
1097  either an unspecified value or a trap representation
1098
1099 <p><small><a href="#Contents">Contents</a></small>
1100 <h4><a name="3.19.3" href="#3.19.3">3.19.3</a></h4>
1101 <p><a name="3.19.3p1" href="#3.19.3p1"><small>1</small></a>
1102 <b> unspecified value</b><br>
1103  valid value of the relevant type where this International Standard imposes no
1104  requirements on which value is chosen in any instance
1105 <p><a name="3.19.3p2" href="#3.19.3p2"><small>2</small></a>
1106  NOTE     An unspecified value cannot be a trap representation.
1107  
1108
1109 <p><small><a href="#Contents">Contents</a></small>
1110 <h4><a name="3.19.4" href="#3.19.4">3.19.4</a></h4>
1111 <p><a name="3.19.4p1" href="#3.19.4p1"><small>1</small></a>
1112 <b> trap representation</b><br>
1113  an object representation that need not represent a value of the object type
1114
1115 <p><small><a href="#Contents">Contents</a></small>
1116 <h4><a name="3.19.5" href="#3.19.5">3.19.5</a></h4>
1117 <p><a name="3.19.5p1" href="#3.19.5p1"><small>1</small></a>
1118 <b> perform a trap</b><br>
1119  interrupt execution of the program such that no further operations are performed
1120 <p><a name="3.19.5p2" href="#3.19.5p2"><small>2</small></a>
1121  NOTE In this International Standard, when the word ''trap'' is not immediately followed by
1122  ''representation'', this is the intended usage.<sup><a href="#note2"><b>2)</b></a></sup>
1123  
1124
1125 <p><b>Footnotes</b>
1126 <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
1127  representation might perform a trap but is not required to (see <a href="#6.2.6.1">6.2.6.1</a>).
1128 </small>
1129
1130 <p><small><a href="#Contents">Contents</a></small>
1131 <h3><a name="3.20" href="#3.20">3.20</a></h3>
1132 <p><a name="3.20p1" href="#3.20p1"><small>1</small></a>
1133 <b> [^ x^]</b><br>
1134  ceiling of x: the least integer greater than or equal to x
1135 <p><a name="3.20p2" href="#3.20p2"><small>2</small></a>
1136  EXAMPLE       [^2.4^] is 3, [^-2.4^] is -2.
1137  
1138
1139 <p><small><a href="#Contents">Contents</a></small>
1140 <h3><a name="3.21" href="#3.21">3.21</a></h3>
1141 <p><a name="3.21p1" href="#3.21p1"><small>1</small></a>
1142 <b> [_ x_]</b><br>
1143  floor of x: the greatest integer less than or equal to x
1144 <p><a name="3.21p2" href="#3.21p2"><small>2</small></a>
1145  EXAMPLE       [_2.4_] is 2, [_-2.4_] is -3.
1146  
1147  
1148  
1149  
1150 <!--page 26 -->
1151
1152 <p><small><a href="#Contents">Contents</a></small>
1153 <h2><a name="4" href="#4">4. Conformance</a></h2>
1154 <p><a name="4p1" href="#4p1"><small>1</small></a>
1155  In this International Standard, ''shall'' is to be interpreted as a requirement on an
1156  implementation or on a program; conversely, ''shall not'' is to be interpreted as a
1157  prohibition.
1158 <p><a name="4p2" href="#4p2"><small>2</small></a>
1159  If a ''shall'' or ''shall not'' requirement that appears outside of a constraint or runtime-
1160  constraint is violated, the behavior is undefined. Undefined behavior is otherwise
1161  indicated in this International Standard by the words ''undefined behavior'' or by the
1162  omission of any explicit definition of behavior. There is no difference in emphasis among
1163  these three; they all describe ''behavior that is undefined''.
1164 <p><a name="4p3" href="#4p3"><small>3</small></a>
1165  A program that is correct in all other aspects, operating on correct data, containing
1166  unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
1167 <p><a name="4p4" href="#4p4"><small>4</small></a>
1168  The implementation shall not successfully translate a preprocessing translation unit
1169  containing a #error preprocessing directive unless it is part of a group skipped by
1170  conditional inclusion.
1171 <p><a name="4p5" href="#4p5"><small>5</small></a>
1172  A strictly conforming program shall use only those features of the language and library
1173  specified in this International Standard.<sup><a href="#note3"><b>3)</b></a></sup> It shall not produce output dependent on any
1174  unspecified, undefined, or implementation-defined behavior, and shall not exceed any
1175  minimum implementation limit.
1176 <p><a name="4p6" href="#4p6"><small>6</small></a>
1177  The two forms of conforming implementation are hosted and freestanding. A conforming
1178  hosted implementation shall accept any strictly conforming program. A conforming
1179  freestanding implementation shall accept any strictly conforming program in which the *
1180  use of the features specified in the library clause (clause 7) is confined to the contents of
1181  the standard headers <a href="#7.7">&lt;float.h&gt;</a>, <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>,
1182  <a href="#7.16">&lt;stdarg.h&gt;</a>,           <a href="#7.18">&lt;stdbool.h&gt;</a>,           <a href="#7.19">&lt;stddef.h&gt;</a>,           <a href="#7.20">&lt;stdint.h&gt;</a>,         and
1183  <a href="#7.23">&lt;stdnoreturn.h&gt;</a>. A conforming implementation may have extensions (including
1184  additional library functions), provided they do not alter the behavior of any strictly
1185  conforming program.<sup><a href="#note4"><b>4)</b></a></sup>
1186  
1187  
1188  
1189 <!--page 27 -->
1190 <p><a name="4p7" href="#4p7"><small>7</small></a>
1191  A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note5"><b>5)</b></a></sup>
1192 <p><a name="4p8" href="#4p8"><small>8</small></a>
1193  An implementation shall be accompanied by a document that defines all implementation-
1194  defined and locale-specific characteristics and all extensions.
1195 <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>),
1196  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>
1197  (<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>),
1198  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>
1199  (<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>),
1200  <a href="#7.23">&lt;stdnoreturn.h&gt;</a> (<a href="#7.23">7.23</a>).
1201  
1202  
1203  
1204  
1205 <!--page 28 -->
1206
1207 <p><b>Footnotes</b>
1208 <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
1209  by an appropriate conditional inclusion preprocessing directive using the related macro. For example:
1210
1211 <pre>
1212          #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
1213             /* ... */
1214             fesetround(FE_UPWARD);
1215             /* ... */
1216          #endif
1217 </pre>
1218  
1219 </small>
1220 <p><small><a name="note4" href="#note4">4)</a> This implies that a conforming implementation reserves no identifiers other than those explicitly
1221  reserved in this International Standard.
1222 </small>
1223 <p><small><a name="note5" href="#note5">5)</a> Strictly conforming programs are intended to be maximally portable among conforming
1224  implementations. Conforming programs may depend upon nonportable features of a conforming
1225  implementation.
1226 </small>
1227
1228 <p><small><a href="#Contents">Contents</a></small>
1229 <h2><a name="5" href="#5">5. Environment</a></h2>
1230 <p><a name="5p1" href="#5p1"><small>1</small></a>
1231  An implementation translates C source files and executes C programs in two data-
1232  processing-system environments, which will be called the translation environment and
1233  the execution environment in this International Standard. Their characteristics define and
1234  constrain the results of executing conforming C programs constructed according to the
1235  syntactic and semantic rules for conforming implementations.
1236 <p><b> Forward references</b>: In this clause, only a few of many possible forward references
1237  have been noted.
1238
1239 <p><small><a href="#Contents">Contents</a></small>
1240 <h3><a name="5.1" href="#5.1">5.1 Conceptual models</a></h3>
1241
1242 <p><small><a href="#Contents">Contents</a></small>
1243 <h4><a name="5.1.1" href="#5.1.1">5.1.1 Translation environment</a></h4>
1244
1245 <p><small><a href="#Contents">Contents</a></small>
1246 <h5><a name="5.1.1.1" href="#5.1.1.1">5.1.1.1 Program structure</a></h5>
1247 <p><a name="5.1.1.1p1" href="#5.1.1.1p1"><small>1</small></a>
1248  A C program need not all be translated at the same time. The text of the program is kept
1249  in units called source files, (or preprocessing files) in this International Standard. A
1250  source file together with all the headers and source files included via the preprocessing
1251  directive #include is known as a preprocessing translation unit. After preprocessing, a
1252  preprocessing translation unit is called a translation unit. Previously translated translation
1253  units may be preserved individually or in libraries. The separate translation units of a
1254  program communicate by (for example) calls to functions whose identifiers have external
1255  linkage, manipulation of objects whose identifiers have external linkage, or manipulation
1256  of data files. Translation units may be separately translated and then later linked to
1257  produce an executable program.
1258 <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>),
1259  preprocessing directives (<a href="#6.10">6.10</a>).
1260
1261 <p><small><a href="#Contents">Contents</a></small>
1262 <h5><a name="5.1.1.2" href="#5.1.1.2">5.1.1.2 Translation phases</a></h5>
1263 <p><a name="5.1.1.2p1" href="#5.1.1.2p1"><small>1</small></a>
1264  The precedence among the syntax rules of translation is specified by the following
1265  phases.<sup><a href="#note6"><b>6)</b></a></sup>
1266 <ol>
1267 <li>  Physical source file multibyte characters are mapped, in an implementation-
1268  defined manner, to the source character set (introducing new-line characters for
1269  end-of-line indicators) if necessary. Trigraph sequences are replaced by
1270  corresponding single-character internal representations.
1271  
1272  
1273  
1274 <!--page 29 -->
1275 <li>  Each instance of a backslash character (\) immediately followed by a new-line
1276  character is deleted, splicing physical source lines to form logical source lines.
1277  Only the last backslash on any physical source line shall be eligible for being part
1278  of such a splice. A source file that is not empty shall end in a new-line character,
1279  which shall not be immediately preceded by a backslash character before any such
1280  splicing takes place.
1281 <li>  The source file is decomposed into preprocessing tokens<sup><a href="#note7"><b>7)</b></a></sup> and sequences of
1282  white-space characters (including comments). A source file shall not end in a
1283  partial preprocessing token or in a partial comment. Each comment is replaced by
1284  one space character. New-line characters are retained. Whether each nonempty
1285  sequence of white-space characters other than new-line is retained or replaced by
1286  one space character is implementation-defined.
1287 <li>  Preprocessing directives are executed, macro invocations are expanded, and
1288  _Pragma unary operator expressions are executed. If a character sequence that
1289  matches the syntax of a universal character name is produced by token
1290  concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
1291  directive causes the named header or source file to be processed from phase 1
1292  through phase 4, recursively. All preprocessing directives are then deleted.
1293 <li>  Each source character set member and escape sequence in character constants and
1294  string literals is converted to the corresponding member of the execution character
1295  set; if there is no corresponding member, it is converted to an implementation-
1296  defined member other than the null (wide) character.<sup><a href="#note8"><b>8)</b></a></sup>
1297 <li>  Adjacent string literal tokens are concatenated.
1298 <li>  White-space characters separating tokens are no longer significant. Each
1299  preprocessing token is converted into a token. The resulting tokens are
1300  syntactically and semantically analyzed and translated as a translation unit.
1301 <li>  All external object and function references are resolved. Library components are
1302  linked to satisfy external references to functions and objects not defined in the
1303  current translation. All such translator output is collected into a program image
1304  which contains information needed for execution in its execution environment.
1305 </ol>
1306 <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>),
1307  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>).
1308  
1309  
1310  
1311 <!--page 30 -->
1312
1313 <p><b>Footnotes</b>
1314 <p><small><a name="note6" href="#note6">6)</a> Implementations shall behave as if these separate phases occur, even though many are typically folded
1315  together in practice. Source files, translation units, and translated translation units need not
1316  necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
1317  and any external representation. The description is conceptual only, and does not specify any
1318  particular implementation.
1319 </small>
1320 <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
1321  context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
1322 </small>
1323 <p><small><a name="note8" href="#note8">8)</a> An implementation need not convert all non-corresponding source characters to the same execution
1324  character.
1325 </small>
1326
1327 <p><small><a href="#Contents">Contents</a></small>
1328 <h5><a name="5.1.1.3" href="#5.1.1.3">5.1.1.3 Diagnostics</a></h5>
1329 <p><a name="5.1.1.3p1" href="#5.1.1.3p1"><small>1</small></a>
1330  A conforming implementation shall produce at least one diagnostic message (identified in
1331  an implementation-defined manner) if a preprocessing translation unit or translation unit
1332  contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
1333  specified as undefined or implementation-defined. Diagnostic messages need not be
1334  produced in other circumstances.<sup><a href="#note9"><b>9)</b></a></sup>
1335 <p><a name="5.1.1.3p2" href="#5.1.1.3p2"><small>2</small></a>
1336  EXAMPLE        An implementation shall issue a diagnostic for the translation unit:
1337 <pre>
1338           char i;
1339           int i;
1340 </pre>
1341  because in those cases where wording in this International Standard describes the behavior for a construct
1342  as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
1343  
1344
1345 <p><b>Footnotes</b>
1346 <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
1347  violation. Of course, an implementation is free to produce any number of diagnostics as long as a
1348  valid program is still correctly translated. It may also successfully translate an invalid program.
1349 </small>
1350
1351 <p><small><a href="#Contents">Contents</a></small>
1352 <h4><a name="5.1.2" href="#5.1.2">5.1.2 Execution environments</a></h4>
1353 <p><a name="5.1.2p1" href="#5.1.2p1"><small>1</small></a>
1354  Two execution environments are defined: freestanding and hosted. In both cases,
1355  program startup occurs when a designated C function is called by the execution
1356  environment. All objects with static storage duration shall be initialized (set to their
1357  initial values) before program startup. The manner and timing of such initialization are
1358  otherwise unspecified. Program termination returns control to the execution
1359  environment.
1360 <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>).
1361
1362 <p><small><a href="#Contents">Contents</a></small>
1363 <h5><a name="5.1.2.1" href="#5.1.2.1">5.1.2.1 Freestanding environment</a></h5>
1364 <p><a name="5.1.2.1p1" href="#5.1.2.1p1"><small>1</small></a>
1365  In a freestanding environment (in which C program execution may take place without any
1366  benefit of an operating system), the name and type of the function called at program
1367  startup are implementation-defined. Any library facilities available to a freestanding
1368  program, other than the minimal set required by clause 4, are implementation-defined.
1369 <p><a name="5.1.2.1p2" href="#5.1.2.1p2"><small>2</small></a>
1370  The effect of program termination in a freestanding environment is implementation-
1371  defined.
1372
1373 <p><small><a href="#Contents">Contents</a></small>
1374 <h5><a name="5.1.2.2" href="#5.1.2.2">5.1.2.2 Hosted environment</a></h5>
1375 <p><a name="5.1.2.2p1" href="#5.1.2.2p1"><small>1</small></a>
1376  A hosted environment need not be provided, but shall conform to the following
1377  specifications if present.
1378  
1379  
1380  
1381  
1382 <!--page 31 -->
1383
1384 <p><small><a href="#Contents">Contents</a></small>
1385 <h5><a name="5.1.2.2.1" href="#5.1.2.2.1">5.1.2.2.1 Program startup</a></h5>
1386 <p><a name="5.1.2.2.1p1" href="#5.1.2.2.1p1"><small>1</small></a>
1387  The function called at program startup is named main. The implementation declares no
1388  prototype for this function. It shall be defined with a return type of int and with no
1389  parameters:
1390 <pre>
1391          int main(void) { /* ... */ }
1392 </pre>
1393  or with two parameters (referred to here as argc and argv, though any names may be
1394  used, as they are local to the function in which they are declared):
1395 <pre>
1396          int main(int argc, char *argv[]) { /* ... */ }
1397 </pre>
1398  or equivalent;<sup><a href="#note10"><b>10)</b></a></sup> or in some other implementation-defined manner.
1399 <p><a name="5.1.2.2.1p2" href="#5.1.2.2.1p2"><small>2</small></a>
1400  If they are declared, the parameters to the main function shall obey the following
1401  constraints:
1402 <ul>
1403 <li>  The value of argc shall be nonnegative.
1404 <li>  argv[argc] shall be a null pointer.
1405 <li>  If the value of argc is greater than zero, the array members argv[0] through
1406  argv[argc-1] inclusive shall contain pointers to strings, which are given
1407  implementation-defined values by the host environment prior to program startup. The
1408  intent is to supply to the program information determined prior to program startup
1409  from elsewhere in the hosted environment. If the host environment is not capable of
1410  supplying strings with letters in both uppercase and lowercase, the implementation
1411  shall ensure that the strings are received in lowercase.
1412 <li>  If the value of argc is greater than zero, the string pointed to by argv[0]
1413  represents the program name; argv[0][0] shall be the null character if the
1414  program name is not available from the host environment. If the value of argc is
1415  greater than one, the strings pointed to by argv[1] through argv[argc-1]
1416  represent the program parameters.
1417 <li>  The parameters argc and argv and the strings pointed to by the argv array shall
1418  be modifiable by the program, and retain their last-stored values between program
1419  startup and program termination.
1420 </ul>
1421
1422 <p><b>Footnotes</b>
1423 <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
1424  char ** argv, and so on.
1425 </small>
1426
1427 <p><small><a href="#Contents">Contents</a></small>
1428 <h5><a name="5.1.2.2.2" href="#5.1.2.2.2">5.1.2.2.2 Program execution</a></h5>
1429 <p><a name="5.1.2.2.2p1" href="#5.1.2.2.2p1"><small>1</small></a>
1430  In a hosted environment, a program may use all the functions, macros, type definitions,
1431  and objects described in the library clause (clause 7).
1432  
1433  
1434  
1435  
1436 <!--page 32 -->
1437
1438 <p><small><a href="#Contents">Contents</a></small>
1439 <h5><a name="5.1.2.2.3" href="#5.1.2.2.3">5.1.2.2.3 Program termination</a></h5>
1440 <p><a name="5.1.2.2.3p1" href="#5.1.2.2.3p1"><small>1</small></a>
1441  If the return type of the main function is a type compatible with int, a return from the
1442  initial call to the main function is equivalent to calling the exit function with the value
1443  returned by the main function as its argument;<sup><a href="#note11"><b>11)</b></a></sup> reaching the } that terminates the
1444  main function returns a value of 0. If the return type is not compatible with int, the
1445  termination status returned to the host environment is unspecified.
1446 <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>).
1447
1448 <p><b>Footnotes</b>
1449 <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
1450  will have ended in the former case, even where they would not have in the latter.
1451 </small>
1452
1453 <p><small><a href="#Contents">Contents</a></small>
1454 <h5><a name="5.1.2.3" href="#5.1.2.3">5.1.2.3 Program execution</a></h5>
1455 <p><a name="5.1.2.3p1" href="#5.1.2.3p1"><small>1</small></a>
1456  The semantic descriptions in this International Standard describe the behavior of an
1457  abstract machine in which issues of optimization are irrelevant.
1458 <p><a name="5.1.2.3p2" href="#5.1.2.3p2"><small>2</small></a>
1459  Accessing a volatile object, modifying an object, modifying a file, or calling a function
1460  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
1461  the execution environment. Evaluation of an expression in general includes both value
1462  computations and initiation of side effects. Value computation for an lvalue expression
1463  includes determining the identity of the designated object.
1464 <p><a name="5.1.2.3p3" href="#5.1.2.3p3"><small>3</small></a>
1465  Sequenced before is an asymmetric, transitive, pair-wise relation between evaluations
1466  executed by a single thread, which induces a partial order among those evaluations.
1467  Given any two evaluations A and B, if A is sequenced before B, then the execution of A
1468  shall precede the execution of B. (Conversely, if A is sequenced before B, then B is
1469  sequenced after A.) If A is not sequenced before or after B, then A and B are
1470  unsequenced. Evaluations A and B are indeterminately sequenced when A is sequenced
1471  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
1472  between the evaluation of expressions A and B implies that every value computation and
1473  side effect associated with A is sequenced before every value computation and side effect
1474  associated with B. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
1475 <p><a name="5.1.2.3p4" href="#5.1.2.3p4"><small>4</small></a>
1476  In the abstract machine, all expressions are evaluated as specified by the semantics. An
1477  actual implementation need not evaluate part of an expression if it can deduce that its
1478  value is not used and that no needed side effects are produced (including any caused by
1479  
1480 <!--page 33 -->
1481  calling a function or accessing a volatile object).
1482 <p><a name="5.1.2.3p5" href="#5.1.2.3p5"><small>5</small></a>
1483  When the processing of the abstract machine is interrupted by receipt of a signal, the
1484  values of objects that are neither lock-free atomic objects nor of type volatile
1485  sig_atomic_t are unspecified, as is the state of the floating-point environment. The
1486  value of any object modified by the handler that is neither a lock-free atomic object nor of
1487  type volatile sig_atomic_t becomes indeterminate when the handler exits, as
1488  does the state of the floating-point environment if it is modified by the handler and not
1489  restored to its original state.
1490 <p><a name="5.1.2.3p6" href="#5.1.2.3p6"><small>6</small></a>
1491  The least requirements on a conforming implementation are:
1492 <ul>
1493 <li>  Accesses to volatile objects are evaluated strictly according to the rules of the abstract
1494  machine.
1495 <li>  At program termination, all data written into files shall be identical to the result that
1496  execution of the program according to the abstract semantics would have produced.
1497 <li>  The input and output dynamics of interactive devices shall take place as specified in
1498  <a href="#7.21.3">7.21.3</a>. The intent of these requirements is that unbuffered or line-buffered output
1499  appear as soon as possible, to ensure that prompting messages actually appear prior to
1500  a program waiting for input.
1501 </ul>
1502  This is the observable behavior of the program.
1503 <p><a name="5.1.2.3p7" href="#5.1.2.3p7"><small>7</small></a>
1504  What constitutes an interactive device is implementation-defined.
1505 <p><a name="5.1.2.3p8" href="#5.1.2.3p8"><small>8</small></a>
1506  More stringent correspondences between abstract and actual semantics may be defined by
1507  each implementation.
1508 <p><a name="5.1.2.3p9" href="#5.1.2.3p9"><small>9</small></a>
1509  EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
1510  semantics: at every sequence point, the values of the actual objects would agree with those specified by the
1511  abstract semantics. The keyword volatile would then be redundant.
1512 <p><a name="5.1.2.3p10" href="#5.1.2.3p10"><small>10</small></a>
1513  Alternatively, an implementation might perform various optimizations within each translation unit, such
1514  that the actual semantics would agree with the abstract semantics only when making function calls across
1515  translation unit boundaries. In such an implementation, at the time of each function entry and function
1516  return where the calling function and the called function are in different translation units, the values of all
1517  externally linked objects and of all objects accessible via pointers therein would agree with the abstract
1518  semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
1519  function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
1520  type of implementation, objects referred to by interrupt service routines activated by the signal function
1521  would require explicit specification of volatile storage, as well as other implementation-defined
1522  restrictions.
1523  
1524 <p><a name="5.1.2.3p11" href="#5.1.2.3p11"><small>11</small></a>
1525  EXAMPLE 2       In executing the fragment
1526 <pre>
1527           char c1, c2;
1528           /* ... */
1529           c1 = c1 + c2;
1530 </pre>
1531  the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
1532  and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
1533 <!--page 34 -->
1534  overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
1535  produce the same result, possibly omitting the promotions.
1536  
1537 <p><a name="5.1.2.3p12" href="#5.1.2.3p12"><small>12</small></a>
1538  EXAMPLE 3       Similarly, in the fragment
1539 <pre>
1540           float f1, f2;
1541           double d;
1542           /* ... */
1543           f1 = f2 * d;
1544 </pre>
1545  the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
1546  that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
1547  were replaced by the constant 2.0, which has type double).
1548  
1549 <p><a name="5.1.2.3p13" href="#5.1.2.3p13"><small>13</small></a>
1550  EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1551  semantics. Values are independent of whether they are represented in a register or in memory. For
1552  example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1553  is required to round to the precision of the storage type. In particular, casts and assignments are required to
1554  perform their specified conversion. For the fragment
1555 <pre>
1556           double d1, d2;
1557           float f;
1558           d1 = f = expression;
1559           d2 = (float) expression;
1560 </pre>
1561  the values assigned to d1 and d2 are required to have been converted to float.
1562  
1563 <p><a name="5.1.2.3p14" href="#5.1.2.3p14"><small>14</small></a>
1564  EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1565  precision as well as range. The implementation cannot generally apply the mathematical associative rules
1566  for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1567  overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1568  rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1569  numbers are often not valid (see <a href="#F.9">F.9</a>).
1570 <pre>
1571           double x, y, z;
1572           /* ... */
1573           x = (x * y) * z;            //   not equivalent to x   *= y * z;
1574           z = (x - y) + y ;           //   not equivalent to z   = x;
1575           z = x + x * y;              //   not equivalent to z   = x * (1.0 + y);
1576           y = x / 5.0;                //   not equivalent to y   = x * 0.2;
1577 </pre>
1578  
1579 <p><a name="5.1.2.3p15" href="#5.1.2.3p15"><small>15</small></a>
1580  EXAMPLE 6       To illustrate the grouping behavior of expressions, in the following fragment
1581 <pre>
1582           int a, b;
1583           /* ... */
1584           a = a + 32760 + b + 5;
1585 </pre>
1586  the expression statement behaves exactly the same as
1587 <pre>
1588           a = (((a + 32760) + b) + 5);
1589 </pre>
1590  due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1591  next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1592  which overflows produce an explicit trap and in which the range of values representable by an int is
1593  [-32768, +32767], the implementation cannot rewrite this expression as
1594 <pre>
1595           a = ((a + b) + 32765);
1596 </pre>
1597  since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1598 <!--page 35 -->
1599  while the original expression would not; nor can the expression be rewritten either as
1600 <pre>
1601           a = ((a + 32765) + b);
1602 </pre>
1603  or
1604 <pre>
1605           a = (a + (b + 32765));
1606 </pre>
1607  since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1608  in which overflow silently generates some value and where positive and negative overflows cancel, the
1609  above expression statement can be rewritten by the implementation in any of the above ways because the
1610  same result will occur.
1611  
1612 <p><a name="5.1.2.3p16" href="#5.1.2.3p16"><small>16</small></a>
1613  EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1614  following fragment
1615 <pre>
1616           #include <a href="#7.21">&lt;stdio.h&gt;</a>
1617           int sum;
1618           char *p;
1619           /* ... */
1620           sum = sum * 10 - '0' + (*p++ = getchar());
1621 </pre>
1622  the expression statement is grouped as if it were written as
1623 <pre>
1624           sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));
1625 </pre>
1626  but the actual increment of p can occur at any time between the previous sequence point and the next
1627  sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1628  value.
1629  
1630 <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>), floating-
1631  point environment <a href="#7.6">&lt;fenv.h&gt;</a> (<a href="#7.6">7.6</a>), the signal function (<a href="#7.14">7.14</a>), files (<a href="#7.21.3">7.21.3</a>).
1632
1633 <p><b>Footnotes</b>
1634 <p><small><a name="note12" href="#note12">12)</a> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
1635  flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
1636  values of floating-point operations. Implementations that support such floating-point state are
1637  required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
1638  environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
1639  effects matter, freeing the implementations in other cases.
1640 </small>
1641 <p><small><a name="note13" href="#note13">13)</a> The executions of unsequenced evaluations can interleave. Indeterminately sequenced evaluations
1642  cannot interleave, but can be executed in any order.
1643 </small>
1644
1645 <p><small><a href="#Contents">Contents</a></small>
1646 <h5><a name="5.1.2.4" href="#5.1.2.4">5.1.2.4 Multi-threaded executions and data races</a></h5>
1647 <p><a name="5.1.2.4p1" href="#5.1.2.4p1"><small>1</small></a>
1648  Under a hosted implementation, a program can have more than one thread of execution
1649  (or thread) running concurrently. The execution of each thread proceeds as defined by
1650  the remainder of this standard. The execution of the entire program consists of an
1651  execution of all of its threads.<sup><a href="#note14"><b>14)</b></a></sup> Under a freestanding implementation, it is
1652  implementation-defined whether a program can have more than one thread of execution.
1653 <p><a name="5.1.2.4p2" href="#5.1.2.4p2"><small>2</small></a>
1654  The value of an object visible to a thread T at a particular point is the initial value of the
1655  object, a value stored in the object by T , or a value stored in the object by another thread,
1656  according to the rules below.
1657 <p><a name="5.1.2.4p3" href="#5.1.2.4p3"><small>3</small></a>
1658  NOTE 1 In some cases, there may instead be undefined behavior. Much of this section is motivated by
1659  the desire to support atomic operations with explicit and detailed visibility constraints. However, it also
1660  implicitly supports a simpler view for more restricted programs.
1661  
1662 <p><a name="5.1.2.4p4" href="#5.1.2.4p4"><small>4</small></a>
1663  Two expression evaluations conflict if one of them modifies a memory location and the
1664  other one reads or modifies the same memory location.
1665  
1666  
1667 <!--page 36 -->
1668 <p><a name="5.1.2.4p5" href="#5.1.2.4p5"><small>5</small></a>
1669  The library defines a number of atomic operations (<a href="#7.17">7.17</a>) and operations on mutexes
1670  (<a href="#7.26.4">7.26.4</a>) that are specially identified as synchronization operations. These operations play
1671  a special role in making assignments in one thread visible to another. A synchronization
1672  operation on one or more memory locations is either an acquire operation, a release
1673  operation, both an acquire and release operation, or a consume operation. A
1674  synchronization operation without an associated memory location is a fence and can be
1675  either an acquire fence, a release fence, or both an acquire and release fence. In addition,
1676  there are relaxed atomic operations, which are not synchronization operations, and
1677  atomic read-modify-write operations, which have special characteristics.
1678 <p><a name="5.1.2.4p6" href="#5.1.2.4p6"><small>6</small></a>
1679  NOTE 2 For example, a call that acquires a mutex will perform an acquire operation on the locations
1680  composing the mutex. Correspondingly, a call that releases the same mutex will perform a release
1681  operation on those same locations. Informally, performing a release operation on A forces prior side effects
1682  on other memory locations to become visible to other threads that later perform an acquire or consume
1683  operation on A. We do not include relaxed atomic operations as synchronization operations although, like
1684  synchronization operations, they cannot contribute to data races.
1685  
1686 <p><a name="5.1.2.4p7" href="#5.1.2.4p7"><small>7</small></a>
1687  All modifications to a particular atomic object M occur in some particular total order,
1688  called the modification order of M. If A and B are modifications of an atomic object M,
1689  and A happens before B, then A shall precede B in the modification order of M, which is
1690  defined below.
1691 <p><a name="5.1.2.4p8" href="#5.1.2.4p8"><small>8</small></a>
1692  NOTE 3     This states that the modification orders must respect the ''happens before'' relation.
1693  
1694 <p><a name="5.1.2.4p9" href="#5.1.2.4p9"><small>9</small></a>
1695  NOTE 4 There is a separate order for each atomic object. There is no requirement that these can be
1696  combined into a single total order for all objects. In general this will be impossible since different threads
1697  may observe modifications to different variables in inconsistent orders.
1698  
1699 <p><a name="5.1.2.4p10" href="#5.1.2.4p10"><small>10</small></a>
1700  A release sequence headed by a release operation A on an atomic object M is a maximal
1701  contiguous sub-sequence of side effects in the modification order of M, where the first
1702  operation is A and every subsequent operation either is performed by the same thread that
1703  performed the release or is an atomic read-modify-write operation.
1704 <p><a name="5.1.2.4p11" href="#5.1.2.4p11"><small>11</small></a>
1705  Certain library calls synchronize with other library calls performed by another thread. In
1706  particular, an atomic operation A that performs a release operation on an object M
1707  synchronizes with an atomic operation B that performs an acquire operation on M and
1708  reads a value written by any side effect in the release sequence headed by A.
1709 <p><a name="5.1.2.4p12" href="#5.1.2.4p12"><small>12</small></a>
1710  NOTE 5 Except in the specified cases, reading a later value does not necessarily ensure visibility as
1711  described below. Such a requirement would sometimes interfere with efficient implementation.
1712  
1713 <p><a name="5.1.2.4p13" href="#5.1.2.4p13"><small>13</small></a>
1714  NOTE 6 The specifications of the synchronization operations define when one reads the value written by
1715  another. For atomic variables, the definition is clear. All operations on a given mutex occur in a single total
1716  order. Each mutex acquisition ''reads the value written'' by the last mutex release.
1717  
1718 <p><a name="5.1.2.4p14" href="#5.1.2.4p14"><small>14</small></a>
1719  An evaluation A carries a dependency <sup><a href="#note15"><b>15)</b></a></sup> to an evaluation B if:
1720  
1721  
1722 <!--page 37 -->
1723 <ul>
1724 <li>  the value of A is used as an operand of B, unless:
1725 <ul>
1726 <li> B is an invocation of the kill_dependency macro,
1727  
1728 <li> A is the left operand of a &amp;&amp; or || operator,
1729  
1730 <li> A is the left operand of a ? : operator, or
1731  
1732 <li> A is the left operand of a , operator;
1733 </ul>
1734    or
1735 <li>  A writes a scalar object or bit-field M, B reads from M the value written by A, and A
1736  is sequenced before B, or
1737 <li>  for some evaluation X, A carries a dependency to X and X carries a dependency to B.
1738 </ul>
1739 <p><a name="5.1.2.4p15" href="#5.1.2.4p15"><small>15</small></a>
1740  An evaluation A is dependency-ordered before<sup><a href="#note16"><b>16)</b></a></sup> an evaluation B if:
1741 <ul>
1742 <li>  A performs a release operation on an atomic object M, and, in another thread, B
1743  performs a consume operation on M and reads a value written by any side effect in
1744  the release sequence headed by A, or
1745 <li>  for some evaluation X, A is dependency-ordered before X and X carries a
1746  dependency to B.
1747 </ul>
1748 <p><a name="5.1.2.4p16" href="#5.1.2.4p16"><small>16</small></a>
1749  An evaluation A inter-thread happens before an evaluation B if A synchronizes with B, A
1750  is dependency-ordered before B, or, for some evaluation X:
1751 <ul>
1752 <li>  A synchronizes with X and X is sequenced before B,
1753 <li>  A is sequenced before X and X inter-thread happens before B, or
1754 <li>  A inter-thread happens before X and X inter-thread happens before B.
1755 </ul>
1756 <p><a name="5.1.2.4p17" href="#5.1.2.4p17"><small>17</small></a>
1757  NOTE 7 The ''inter-thread happens before'' relation describes arbitrary concatenations of ''sequenced
1758  before'', ''synchronizes with'', and ''dependency-ordered before'' relationships, with two exceptions. The
1759  first exception is that a concatenation is not permitted to end with ''dependency-ordered before'' followed
1760  by ''sequenced before''. The reason for this limitation is that a consume operation participating in a
1761  ''dependency-ordered before'' relationship provides ordering only with respect to operations to which this
1762  consume operation actually carries a dependency. The reason that this limitation applies only to the end of
1763  such a concatenation is that any subsequent release operation will provide the required ordering for a prior
1764  consume operation. The second exception is that a concatenation is not permitted to consist entirely of
1765  ''sequenced before''. The reasons for this limitation are (1) to permit ''inter-thread happens before'' to be
1766  transitively closed and (2) the ''happens before'' relation, defined below, provides for relationships
1767  consisting entirely of ''sequenced before''.
1768  
1769 <p><a name="5.1.2.4p18" href="#5.1.2.4p18"><small>18</small></a>
1770  An evaluation A happens before an evaluation B if A is sequenced before B or A inter-
1771  thread happens before B.
1772  
1773  
1774  
1775 <!--page 38 -->
1776 <p><a name="5.1.2.4p19" href="#5.1.2.4p19"><small>19</small></a>
1777  A visible side effect A on an object M with respect to a value computation B of M
1778  satisfies the conditions:
1779 <ul>
1780 <li>  A happens before B, and
1781 <li>  there is no other side effect X to M such that A happens before X and X happens
1782    before B.
1783 </ul>
1784  The value of a non-atomic scalar object M, as determined by evaluation B, shall be the
1785  value stored by the visible side effect A.
1786 <p><a name="5.1.2.4p20" href="#5.1.2.4p20"><small>20</small></a>
1787  NOTE 8 If there is ambiguity about which side effect to a non-atomic object is visible, then there is a data
1788  race and the behavior is undefined.
1789  
1790 <p><a name="5.1.2.4p21" href="#5.1.2.4p21"><small>21</small></a>
1791  NOTE 9 This states that operations on ordinary variables are not visibly reordered. This is not actually
1792  detectable without data races, but it is necessary to ensure that data races, as defined here, and with suitable
1793  restrictions on the use of atomics, correspond to data races in a simple interleaved (sequentially consistent)
1794  execution.
1795  
1796 <p><a name="5.1.2.4p22" href="#5.1.2.4p22"><small>22</small></a>
1797  The visible sequence of side effects on an atomic object M, with respect to a value
1798  computation B of M, is a maximal contiguous sub-sequence of side effects in the
1799  modification order of M, where the first side effect is visible with respect to B, and for
1800  every subsequent side effect, it is not the case that B happens before it. The value of an
1801  atomic object M, as determined by evaluation B, shall be the value stored by some
1802  operation in the visible sequence of M with respect to B. Furthermore, if a value
1803  computation A of an atomic object M happens before a value computation B of M, and
1804  the value computed by A corresponds to the value stored by side effect X, then the value
1805  computed by B shall either equal the value computed by A, or be the value stored by side
1806  effect Y , where Y follows X in the modification order of M.
1807 <p><a name="5.1.2.4p23" href="#5.1.2.4p23"><small>23</small></a>
1808  NOTE 10 This effectively disallows compiler reordering of atomic operations to a single object, even if
1809  both operations are ''relaxed'' loads. By doing so, we effectively make the ''cache coherence'' guarantee
1810  provided by most hardware available to C atomic operations.
1811  
1812 <p><a name="5.1.2.4p24" href="#5.1.2.4p24"><small>24</small></a>
1813  NOTE 11 The visible sequence depends on the ''happens before'' relation, which in turn depends on the
1814  values observed by loads of atomics, which we are restricting here. The intended reading is that there must
1815  exist an association of atomic loads with modifications they observe that, together with suitably chosen
1816  modification orders and the ''happens before'' relation derived as described above, satisfy the resulting
1817  constraints as imposed here.
1818  
1819 <p><a name="5.1.2.4p25" href="#5.1.2.4p25"><small>25</small></a>
1820  The execution of a program contains a data race if it contains two conflicting actions in
1821  different threads, at least one of which is not atomic, and neither happens before the
1822  other. Any such data race results in undefined behavior.
1823 <p><a name="5.1.2.4p26" href="#5.1.2.4p26"><small>26</small></a>
1824  NOTE 12 It can be shown that programs that correctly use simple mutexes and
1825  memory_order_seq_cst operations to prevent all data races, and use no other synchronization
1826  operations, behave as though the operations executed by their constituent threads were simply interleaved,
1827  with each value computation of an object being the last value stored in that interleaving. This is normally
1828  referred to as ''sequential consistency''. However, this applies only to data-race-free programs, and data-
1829  race-free programs cannot observe most program transformations that do not change single-threaded
1830  program semantics. In fact, most single-threaded program transformations continue to be allowed, since
1831  any program that behaves differently as a result must contain undefined behavior.
1832 <!--page 39 -->
1833 <p><a name="5.1.2.4p27" href="#5.1.2.4p27"><small>27</small></a>
1834  NOTE 13 Compiler transformations that introduce assignments to a potentially shared memory location
1835  that would not be modified by the abstract machine are generally precluded by this standard, since such an
1836  assignment might overwrite another assignment by a different thread in cases in which an abstract machine
1837  execution would not have encountered a data race. This includes implementations of data member
1838  assignment that overwrite adjacent members in separate memory locations. We also generally preclude
1839  reordering of atomic loads in cases in which the atomics in question may alias, since this may violate the
1840  "visible sequence" rules.
1841  
1842 <p><a name="5.1.2.4p28" href="#5.1.2.4p28"><small>28</small></a>
1843  NOTE 14 Transformations that introduce a speculative read of a potentially shared memory location may
1844  not preserve the semantics of the program as defined in this standard, since they potentially introduce a data
1845  race. However, they are typically valid in the context of an optimizing compiler that targets a specific
1846  machine with well-defined semantics for data races. They would be invalid for a hypothetical machine that
1847  is not tolerant of races or provides hardware race detection.
1848 <!--page 40 -->
1849
1850 <p><b>Footnotes</b>
1851 <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
1852  atomic operations, for example, allow executions inconsistent with a simple interleaving as described
1853  below.
1854 </small>
1855 <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
1856  strictly intra-thread.
1857 </small>
1858 <p><small><a name="note16" href="#note16">16)</a> The ''dependency-ordered before'' relation is analogous to the ''synchronizes with'' relation, but uses
1859  release/consume in place of release/acquire.
1860 </small>
1861
1862 <p><small><a href="#Contents">Contents</a></small>
1863 <h3><a name="5.2" href="#5.2">5.2 Environmental considerations</a></h3>
1864
1865 <p><small><a href="#Contents">Contents</a></small>
1866 <h4><a name="5.2.1" href="#5.2.1">5.2.1 Character sets</a></h4>
1867 <p><a name="5.2.1p1" href="#5.2.1p1"><small>1</small></a>
1868  Two sets of characters and their associated collating sequences shall be defined: the set in
1869  which source files are written (the source character set), and the set interpreted in the
1870  execution environment (the execution character set). Each set is further divided into a
1871  basic character set, whose contents are given by this subclause, and a set of zero or more
1872  locale-specific members (which are not members of the basic character set) called
1873  extended characters. The combined set is also called the extended character set. The
1874  values of the members of the execution character set are implementation-defined.
1875 <p><a name="5.2.1p2" href="#5.2.1p2"><small>2</small></a>
1876  In a character constant or string literal, members of the execution character set shall be
1877  represented by corresponding members of the source character set or by escape
1878  sequences consisting of the backslash \ followed by one or more characters. A byte with
1879  all bits set to 0, called the null character, shall exist in the basic execution character set; it
1880  is used to terminate a character string.
1881 <p><a name="5.2.1p3" href="#5.2.1p3"><small>3</small></a>
1882  Both the basic source and basic execution character sets shall have the following
1883  members: the 26 uppercase letters of the Latin alphabet
1884 <pre>
1885          A    B   C      D   E     F   G   H    I    J    K    L   M
1886          N    O   P      Q   R     S   T   U    V    W    X    Y   Z
1887 </pre>
1888  the 26 lowercase letters of the Latin alphabet
1889 <pre>
1890          a    b   c      d   e     f   g   h    i    j    k    l   m
1891          n    o   p      q   r     s   t   u    v    w    x    y   z
1892 </pre>
1893  the 10 decimal digits
1894 <pre>
1895          0    1   2      3   4     5   6   7    8    9
1896 </pre>
1897  the following 29 graphic characters
1898 <pre>
1899          !    "   #      %   &amp;     '   (   )    *    +    ,    -   .    /    :
1900          ;    &lt;   =      &gt;   ?     [   \   ]    ^    _    {    |   }    ~
1901 </pre>
1902  the space character, and control characters representing horizontal tab, vertical tab, and
1903  form feed. The representation of each member of the source and execution basic
1904  character sets shall fit in a byte. In both the source and execution basic character sets, the
1905  value of each character after 0 in the above list of decimal digits shall be one greater than
1906  the value of the previous. In source files, there shall be some way of indicating the end of
1907  each line of text; this International Standard treats such an end-of-line indicator as if it
1908  were a single new-line character. In the basic execution character set, there shall be
1909  control characters representing alert, backspace, carriage return, and new line. If any
1910  other characters are encountered in a source file (except in an identifier, a character
1911  constant, a string literal, a header name, a comment, or a preprocessing token that is never
1912 <!--page 41 -->
1913  converted to a token), the behavior is undefined.
1914 <p><a name="5.2.1p4" href="#5.2.1p4"><small>4</small></a>
1915  A letter is an uppercase letter or a lowercase letter as defined above; in this International
1916  Standard the term does not include other characters that are letters in other alphabets.
1917 <p><a name="5.2.1p5" href="#5.2.1p5"><small>5</small></a>
1918  The universal character name construct provides a way to name other characters.
1919 <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>),
1920  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>).
1921
1922 <p><small><a href="#Contents">Contents</a></small>
1923 <h5><a name="5.2.1.1" href="#5.2.1.1">5.2.1.1 Trigraph sequences</a></h5>
1924 <p><a name="5.2.1.1p1" href="#5.2.1.1p1"><small>1</small></a>
1925  Before any other processing takes place, each occurrence of one of the following
1926  sequences of three characters (called trigraph sequences<sup><a href="#note17"><b>17)</b></a></sup>) is replaced with the
1927  corresponding single character.
1928 <pre>
1929         ??=      #                       ??)      ]                       ??!     |
1930         ??(      [                       ??'      ^                       ??&gt;     }
1931         ??/      \                       ??&lt;      {                       ??-     ~
1932 </pre>
1933  No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1934  above is not changed.
1935 <p><a name="5.2.1.1p2" href="#5.2.1.1p2"><small>2</small></a>
1936  EXAMPLE 1
1937 <pre>
1938            ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)
1939 </pre>
1940  becomes
1941 <pre>
1942            #define arraycheck(a, b) a[b] || b[a]
1943 </pre>
1944  
1945 <p><a name="5.2.1.1p3" href="#5.2.1.1p3"><small>3</small></a>
1946  EXAMPLE 2      The following source line
1947 <pre>
1948            printf("Eh???/n");
1949 </pre>
1950  becomes (after replacement of the trigraph sequence ??/)
1951 <pre>
1952            printf("Eh?\n");
1953 </pre>
1954  
1955
1956 <p><b>Footnotes</b>
1957 <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
1958  described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1959 </small>
1960
1961 <p><small><a href="#Contents">Contents</a></small>
1962 <h5><a name="5.2.1.2" href="#5.2.1.2">5.2.1.2 Multibyte characters</a></h5>
1963 <p><a name="5.2.1.2p1" href="#5.2.1.2p1"><small>1</small></a>
1964  The source character set may contain multibyte characters, used to represent members of
1965  the extended character set. The execution character set may also contain multibyte
1966  characters, which need not have the same encoding as for the source character set. For
1967  both character sets, the following shall hold:
1968 <ul>
1969 <li>  The basic character set shall be present and each character shall be encoded as a
1970  single byte.
1971 <li>  The presence, meaning, and representation of any additional members is locale-
1972  specific.
1973  
1974 <!--page 42 -->
1975 <li>  A multibyte character set may have a state-dependent encoding, wherein each
1976  sequence of multibyte characters begins in an initial shift state and enters other
1977  locale-specific shift states when specific multibyte characters are encountered in the
1978  sequence. While in the initial shift state, all single-byte characters retain their usual
1979  interpretation and do not alter the shift state. The interpretation for subsequent bytes
1980  in the sequence is a function of the current shift state.
1981 <li>  A byte with all bits zero shall be interpreted as a null character independent of shift
1982  state. Such a byte shall not occur as part of any other multibyte character.
1983 </ul>
1984 <p><a name="5.2.1.2p2" href="#5.2.1.2p2"><small>2</small></a>
1985  For source files, the following shall hold:
1986 <ul>
1987 <li>  An identifier, comment, string literal, character constant, or header name shall begin
1988  and end in the initial shift state.
1989 <li>  An identifier, comment, string literal, character constant, or header name shall consist
1990  of a sequence of valid multibyte characters.
1991 </ul>
1992
1993 <p><small><a href="#Contents">Contents</a></small>
1994 <h4><a name="5.2.2" href="#5.2.2">5.2.2 Character display semantics</a></h4>
1995 <p><a name="5.2.2p1" href="#5.2.2p1"><small>1</small></a>
1996  The active position is that location on a display device where the next character output by
1997  the fputc function would appear. The intent of writing a printing character (as defined
1998  by the isprint function) to a display device is to display a graphic representation of
1999  that character at the active position and then advance the active position to the next
2000  position on the current line. The direction of writing is locale-specific. If the active
2001  position is at the final position of a line (if there is one), the behavior of the display device
2002  is unspecified.
2003 <p><a name="5.2.2p2" href="#5.2.2p2"><small>2</small></a>
2004  Alphabetic escape sequences representing nongraphic characters in the execution
2005  character set are intended to produce actions on display devices as follows:
2006  \a (alert) Produces an audible or visible alert without changing the active position.
2007  \b (backspace) Moves the active position to the previous position on the current line. If
2008 <pre>
2009     the active position is at the initial position of a line, the behavior of the display
2010     device is unspecified.
2011 </pre>
2012  \f ( form feed) Moves the active position to the initial position at the start of the next
2013 <pre>
2014     logical page.
2015 </pre>
2016  \n (new line) Moves the active position to the initial position of the next line.
2017  \r (carriage return) Moves the active position to the initial position of the current line.
2018  \t (horizontal tab) Moves the active position to the next horizontal tabulation position
2019 <pre>
2020     on the current line. If the active position is at or past the last defined horizontal
2021     tabulation position, the behavior of the display device is unspecified.
2022 </pre>
2023  \v (vertical tab) Moves the active position to the initial position of the next vertical
2024 <!--page 43 -->
2025 <pre>
2026     tabulation position. If the active position is at or past the last defined vertical
2027       tabulation position, the behavior of the display device is unspecified.
2028 </pre>
2029 <p><a name="5.2.2p3" href="#5.2.2p3"><small>3</small></a>
2030  Each of these escape sequences shall produce a unique implementation-defined value
2031  which can be stored in a single char object. The external representations in a text file
2032  need not be identical to the internal representations, and are outside the scope of this
2033  International Standard.
2034 <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>).
2035
2036 <p><small><a href="#Contents">Contents</a></small>
2037 <h4><a name="5.2.3" href="#5.2.3">5.2.3 Signals and interrupts</a></h4>
2038 <p><a name="5.2.3p1" href="#5.2.3p1"><small>1</small></a>
2039  Functions shall be implemented such that they may be interrupted at any time by a signal,
2040  or may be called by a signal handler, or both, with no alteration to earlier, but still active,
2041  invocations' control flow (after the interruption), function return values, or objects with
2042  automatic storage duration. All such objects shall be maintained outside the function
2043  image (the instructions that compose the executable representation of a function) on a
2044  per-invocation basis.
2045
2046 <p><small><a href="#Contents">Contents</a></small>
2047 <h4><a name="5.2.4" href="#5.2.4">5.2.4 Environmental limits</a></h4>
2048 <p><a name="5.2.4p1" href="#5.2.4p1"><small>1</small></a>
2049  Both the translation and execution environments constrain the implementation of
2050  language translators and libraries. The following summarizes the language-related
2051  environmental limits on a conforming implementation; the library-related limits are
2052  discussed in clause 7.
2053
2054 <p><small><a href="#Contents">Contents</a></small>
2055 <h5><a name="5.2.4.1" href="#5.2.4.1">5.2.4.1 Translation limits</a></h5>
2056 <p><a name="5.2.4.1p1" href="#5.2.4.1p1"><small>1</small></a>
2057  The implementation shall be able to translate and execute at least one program that
2058  contains at least one instance of every one of the following limits:<sup><a href="#note18"><b>18)</b></a></sup>
2059 <ul>
2060 <li>  127 nesting levels of blocks
2061 <li>  63 nesting levels of conditional inclusion
2062 <li>  12 pointer, array, and function declarators (in any combinations) modifying an
2063  arithmetic, structure, union, or void type in a declaration
2064 <li>  63 nesting levels of parenthesized declarators within a full declarator
2065 <li>  63 nesting levels of parenthesized expressions within a full expression
2066 <li>  63 significant initial characters in an internal identifier or a macro name (each
2067  universal character name or extended source character is considered a single
2068  character)
2069 <li>  31 significant initial characters in an external identifier (each universal character name
2070  specifying a short identifier of 0000FFFF or less is considered 6 characters, each
2071  
2072  
2073 <!--page 44 -->
2074 <pre>
2075     universal character name specifying a short identifier of 00010000 or more is
2076     considered 10 characters, and each extended source character is considered the same
2077     number of characters as the corresponding universal character name, if any)<sup><a href="#note19"><b>19)</b></a></sup>
2078 </pre>
2079 <li>  4095 external identifiers in one translation unit
2080 <li>  511 identifiers with block scope declared in one block
2081 <li>  4095 macro identifiers simultaneously defined in one preprocessing translation unit
2082 <li>  127 parameters in one function definition
2083 <li>  127 arguments in one function call
2084 <li>  127 parameters in one macro definition
2085 <li>  127 arguments in one macro invocation
2086 <li>  4095 characters in a logical source line
2087 <li>  4095 characters in a string literal (after concatenation)
2088 <li>  65535 bytes in an object (in a hosted environment only)
2089 <li>  15 nesting levels for #included files
2090 <li>  1023 case labels for a switch statement (excluding those for any nested switch
2091  statements)
2092 <li>  1023 members in a single structure or union
2093 <li>  1023 enumeration constants in a single enumeration
2094 <li>  63 levels of nested structure or union definitions in a single struct-declaration-list
2095 </ul>
2096
2097 <p><b>Footnotes</b>
2098 <p><small><a name="note18" href="#note18">18)</a> Implementations should avoid imposing fixed translation limits whenever possible.
2099 </small>
2100 <p><small><a name="note19" href="#note19">19)</a> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
2101 </small>
2102
2103 <p><small><a href="#Contents">Contents</a></small>
2104 <h5><a name="5.2.4.2" href="#5.2.4.2">5.2.4.2 Numerical limits</a></h5>
2105 <p><a name="5.2.4.2p1" href="#5.2.4.2p1"><small>1</small></a>
2106  An implementation is required to document all the limits specified in this subclause,
2107  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
2108  specified in <a href="#7.20">&lt;stdint.h&gt;</a>.
2109 <p><b> Forward references</b>: integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>).
2110
2111 <p><small><a href="#Contents">Contents</a></small>
2112 <h5><a name="5.2.4.2.1" href="#5.2.4.2.1">5.2.4.2.1 Sizes of integer types &lt;limits.h&gt;</a></h5>
2113 <p><a name="5.2.4.2.1p1" href="#5.2.4.2.1p1"><small>1</small></a>
2114  The values given below shall be replaced by constant expressions suitable for use in #if
2115  preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
2116  following shall be replaced by expressions that have the same type as would an
2117  expression that is an object of the corresponding type converted according to the integer
2118  promotions. Their implementation-defined values shall be equal or greater in magnitude
2119  
2120  
2121 <!--page 45 -->
2122  (absolute value) to those shown, with the same sign.
2123 <ul>
2124 <li>  number of bits for smallest object that is not a bit-field (byte)
2125  CHAR_BIT                                            8
2126 <li>  minimum value for an object of type signed char
2127  SCHAR_MIN                                -127 // -(27 - 1)
2128 <li>  maximum value for an object of type signed char
2129  SCHAR_MAX                                +127 // 27 - 1
2130 <li>  maximum value for an object of type unsigned char
2131  UCHAR_MAX                                 255 // 28 - 1
2132 <li>  minimum value for an object of type char
2133  CHAR_MIN                               see below
2134 <li>  maximum value for an object of type char
2135  CHAR_MAX                              see below
2136 <li>  maximum number of bytes in a multibyte character, for any supported locale
2137  MB_LEN_MAX                                    1
2138 <li>  minimum value for an object of type short int
2139  SHRT_MIN                               -32767 // -(215 - 1)
2140 <li>  maximum value for an object of type short int
2141  SHRT_MAX                               +32767 // 215 - 1
2142 <li>  maximum value for an object of type unsigned short int
2143  USHRT_MAX                               65535 // 216 - 1
2144 <li>  minimum value for an object of type int
2145  INT_MIN                                 -32767 // -(215 - 1)
2146 <li>  maximum value for an object of type int
2147  INT_MAX                                +32767 // 215 - 1
2148 <li>  maximum value for an object of type unsigned int
2149  UINT_MAX                                65535 // 216 - 1
2150 <li>  minimum value for an object of type long int
2151  LONG_MIN                         -2147483647 // -(231 - 1)
2152 <li>  maximum value for an object of type long int
2153  LONG_MAX                         +2147483647 // 231 - 1
2154 <li>  maximum value for an object of type unsigned long int
2155  ULONG_MAX                         4294967295 // 232 - 1
2156 <!--page 46 -->
2157 <li>  minimum value for an object of type long long int
2158  LLONG_MIN          -9223372036854775807 // -(263 - 1)
2159 <li>  maximum value for an object of type long long int
2160  LLONG_MAX          +9223372036854775807 // 263 - 1
2161 <li>  maximum value for an object of type unsigned long long int
2162  ULLONG_MAX         18446744073709551615 // 264 - 1
2163 </ul>
2164 <p><a name="5.2.4.2.1p2" href="#5.2.4.2.1p2"><small>2</small></a>
2165  If the value of an object of type char is treated as a signed integer when used in an
2166  expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
2167  value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
2168  CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
2169  UCHAR_MAX.<sup><a href="#note20"><b>20)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
2170 <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>).
2171
2172 <p><b>Footnotes</b>
2173 <p><small><a name="note20" href="#note20">20)</a> See <a href="#6.2.5">6.2.5</a>.
2174 </small>
2175
2176 <p><small><a href="#Contents">Contents</a></small>
2177 <h5><a name="5.2.4.2.2" href="#5.2.4.2.2">5.2.4.2.2 Characteristics of floating types &lt;float.h&gt;</a></h5>
2178 <p><a name="5.2.4.2.2p1" href="#5.2.4.2.2p1"><small>1</small></a>
2179  The characteristics of floating types are defined in terms of a model that describes a
2180  representation of floating-point numbers and values that provide information about an
2181  implementation's floating-point arithmetic.<sup><a href="#note21"><b>21)</b></a></sup> The following parameters are used to
2182  define the model for each floating-point type:
2183 <pre>
2184         s          sign ((+-)1)
2185         b          base or radix of exponent representation (an integer &gt; 1)
2186         e          exponent (an integer between a minimum emin and a maximum emax )
2187         p          precision (the number of base-b digits in the significand)
2188          fk        nonnegative integers less than b (the significand digits)
2189 </pre>
2190 <p><a name="5.2.4.2.2p2" href="#5.2.4.2.2p2"><small>2</small></a>
2191  A floating-point number (x) is defined by the following model:
2192 <pre>
2193                     p
2194         x = sb e   (Sum) f k b-k ,
2195                    k=1
2196                                  emin &lt;= e &lt;= emax
2197 </pre>
2198  
2199 <p><a name="5.2.4.2.2p3" href="#5.2.4.2.2p3"><small>3</small></a>
2200  In addition to normalized floating-point numbers ( f 1 &gt; 0 if x != 0), floating types may be
2201  able to contain other kinds of floating-point numbers, such as subnormal floating-point
2202  numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
2203  e &gt; emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
2204  NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
2205  through almost every arithmetic operation without raising a floating-point exception; a
2206  signaling NaN generally raises a floating-point exception when occurring as an
2207  
2208  
2209 <!--page 47 -->
2210  arithmetic operand.<sup><a href="#note22"><b>22)</b></a></sup>
2211 <p><a name="5.2.4.2.2p4" href="#5.2.4.2.2p4"><small>4</small></a>
2212  An implementation may give zero and values that are not floating-point numbers (such as
2213  infinities and NaNs) a sign or may leave them unsigned. Wherever such values are
2214  unsigned, any requirement in this International Standard to retrieve the sign shall produce
2215  an unspecified sign, and any requirement to set the sign shall be ignored.
2216 <p><a name="5.2.4.2.2p5" href="#5.2.4.2.2p5"><small>5</small></a>
2217  The minimum range of representable values for a floating type is the most negative finite
2218  floating-point number representable in that type through the most positive finite floating-
2219  point number representable in that type. In addition, if negative infinity is representable
2220  in a type, the range of that type is extended to all negative real numbers; likewise, if
2221  positive infinity is representable in a type, the range of that type is extended to all positive
2222  real numbers.
2223 <p><a name="5.2.4.2.2p6" href="#5.2.4.2.2p6"><small>6</small></a>
2224  The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
2225  <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-
2226  defined, as is the accuracy of the conversion between floating-point internal
2227  representations and string representations performed by the library functions in
2228  <a href="#7.21">&lt;stdio.h&gt;</a>, <a href="#7.22">&lt;stdlib.h&gt;</a>, and <a href="#7.29">&lt;wchar.h&gt;</a>. The implementation may state that the
2229  accuracy is unknown.
2230 <p><a name="5.2.4.2.2p7" href="#5.2.4.2.2p7"><small>7</small></a>
2231  All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
2232  expressions suitable for use in #if preprocessing directives; all floating values shall be
2233  constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
2234  and FLT_ROUNDS have separate names for all three floating-point types. The floating-
2235  point model representation is provided for all values except FLT_EVAL_METHOD and
2236  FLT_ROUNDS.
2237 <p><a name="5.2.4.2.2p8" href="#5.2.4.2.2p8"><small>8</small></a>
2238  The rounding mode for floating-point addition is characterized by the implementation-
2239  defined value of FLT_ROUNDS:<sup><a href="#note23"><b>23)</b></a></sup>
2240 <pre>
2241        -1      indeterminable
2242         0      toward zero
2243         1      to nearest
2244         2      toward positive infinity
2245         3      toward negative infinity
2246 </pre>
2247  All other values for FLT_ROUNDS characterize implementation-defined rounding
2248  behavior.
2249  
2250  
2251 <!--page 48 -->
2252 <p><a name="5.2.4.2.2p9" href="#5.2.4.2.2p9"><small>9</small></a>
2253  Except for assignment and cast (which remove all extra range and precision), the values
2254  yielded by operators with floating operands and values subject to the usual arithmetic
2255  conversions and of floating constants are evaluated to a format whose range and precision
2256  may be greater than required by the type. The use of evaluation formats is characterized
2257  by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note24"><b>24)</b></a></sup>
2258 <pre>
2259         -1         indeterminable;
2260           0       evaluate all operations and constants just to the range and precision of the
2261                   type;
2262           1       evaluate operations and constants of type float and double to the
2263                   range and precision of the double type, evaluate long double
2264                   operations and constants to the range and precision of the long double
2265                   type;
2266           2       evaluate all operations and constants to the range and precision of the
2267                   long double type.
2268 </pre>
2269  All other negative values for FLT_EVAL_METHOD characterize implementation-defined
2270  behavior.
2271 <p><a name="5.2.4.2.2p10" href="#5.2.4.2.2p10"><small>10</small></a>
2272  The presence or absence of subnormal numbers is characterized by the implementation-
2273  defined     values     of    FLT_HAS_SUBNORM,          DBL_HAS_SUBNORM,           and
2274  LDBL_HAS_SUBNORM:
2275 <pre>
2276         -1       indeterminable<sup><a href="#note25"><b>25)</b></a></sup>
2277          0       absent<sup><a href="#note26"><b>26)</b></a></sup> (type does not support subnormal numbers)
2278          1       present (type does support subnormal numbers)
2279 </pre>
2280 <p><a name="5.2.4.2.2p11" href="#5.2.4.2.2p11"><small>11</small></a>
2281  The values given in the following list shall be replaced by constant expressions with
2282  implementation-defined values that are greater or equal in magnitude (absolute value) to
2283  those shown, with the same sign:
2284 <ul>
2285 <li>  radix of exponent representation, b
2286  FLT_RADIX                                                    2
2287  
2288  
2289  
2290  
2291 <!--page 49 -->
2292 <li>  number of base-FLT_RADIX digits in the floating-point significand, p
2293   FLT_MANT_DIG
2294   DBL_MANT_DIG
2295   LDBL_MANT_DIG
2296 <li>  number of decimal digits, n, such that any floating-point number with p radix b digits
2297  can be rounded to a floating-point number with n decimal digits and back again
2298  without change to the value,
2299 <pre>
2300       { p log10 b        if b is a power of 10
2301       {
2302       { [^1 + p log10 b^] otherwise
2303 </pre>
2304   FLT_DECIMAL_DIG                                   6
2305   DBL_DECIMAL_DIG                                  10
2306   LDBL_DECIMAL_DIG                                 10
2307 <li>  number of decimal digits, n, such that any floating-point number in the widest
2308  supported floating type with pmax radix b digits can be rounded to a floating-point
2309  number with n decimal digits and back again without change to the value,
2310 <pre>
2311       { pmax log10 b       if b is a power of 10
2312       {
2313       { [^1 + pmax log10 b^] otherwise
2314 </pre>
2315   DECIMAL_DIG                                     10
2316 <li>  number of decimal digits, q, such that any floating-point number with q decimal digits
2317  can be rounded into a floating-point number with p radix b digits and back again
2318  without change to the q decimal digits,
2319 <pre>
2320       { p log10 b          if b is a power of 10
2321       {
2322       { [_( p - 1) log10 b_] otherwise
2323 </pre>
2324   FLT_DIG                                          6
2325   DBL_DIG                                         10
2326   LDBL_DIG                                        10
2327 <li>  minimum negative integer such that FLT_RADIX raised to one less than that power is
2328  a normalized floating-point number, emin
2329   FLT_MIN_EXP
2330   DBL_MIN_EXP
2331   LDBL_MIN_EXP
2332 <!--page 50 -->
2333 <li>  minimum negative integer such that 10 raised to that power is in the range of
2334  normalized floating-point numbers, [^log10 b emin -1 ^]
2335 <pre>
2336                                    [                  ]
2337 </pre>
2338  FLT_MIN_10_EXP                                 -37
2339  DBL_MIN_10_EXP                                 -37
2340  LDBL_MIN_10_EXP                                -37
2341 <li>  maximum integer such that FLT_RADIX raised to one less than that power is a
2342  representable finite floating-point number, emax
2343 <pre>
2344     FLT_MAX_EXP
2345     DBL_MAX_EXP
2346     LDBL_MAX_EXP
2347 </pre>
2348 <li>  maximum integer such that 10 raised to that power is in the range of representable
2349  finite floating-point numbers, [_log10 ((1 - b- p )b emax )_]
2350 <pre>
2351     FLT_MAX_10_EXP                               +37
2352     DBL_MAX_10_EXP                               +37
2353     LDBL_MAX_10_EXP                              +37
2354 </pre>
2355 </ul>
2356 <p><a name="5.2.4.2.2p12" href="#5.2.4.2.2p12"><small>12</small></a>
2357  The values given in the following list shall be replaced by constant expressions with
2358  implementation-defined values that are greater than or equal to those shown:
2359 <ul>
2360 <li>  maximum representable finite floating-point number, (1 - b- p )b emax
2361 <pre>
2362     FLT_MAX                                   1E+37
2363     DBL_MAX                                   1E+37
2364     LDBL_MAX                                  1E+37
2365 </pre>
2366 </ul>
2367 <p><a name="5.2.4.2.2p13" href="#5.2.4.2.2p13"><small>13</small></a>
2368  The values given in the following list shall be replaced by constant expressions with
2369  implementation-defined (positive) values that are less than or equal to those shown:
2370 <ul>
2371 <li>  the difference between 1 and the least value greater than 1 that is representable in the
2372  given floating point type, b1- p
2373 <pre>
2374     FLT_EPSILON                                1E-5
2375     DBL_EPSILON                                1E-9
2376     LDBL_EPSILON                               1E-9
2377 </pre>
2378 <li>  minimum normalized positive floating-point number, b emin -1
2379 <!--page 51 -->
2380 <pre>
2381     FLT_MIN                                   1E-37
2382     DBL_MIN                                   1E-37
2383     LDBL_MIN                                  1E-37
2384 </pre>
2385 <li>  minimum positive floating-point number<sup><a href="#note27"><b>27)</b></a></sup>
2386    FLT_TRUE_MIN                                       1E-37
2387    DBL_TRUE_MIN                                       1E-37
2388    LDBL_TRUE_MIN                                      1E-37
2389 </ul>
2390 <p><b>Recommended practice</b>
2391 <p><a name="5.2.4.2.2p14" href="#5.2.4.2.2p14"><small>14</small></a>
2392  Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
2393  should be the identity function.
2394 <p><a name="5.2.4.2.2p15" href="#5.2.4.2.2p15"><small>15</small></a>
2395  EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
2396  requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
2397  float:
2398 <pre>
2399                     6
2400        x = s16e    (Sum) f k 16-k ,
2401                    k=1
2402                                    -31 &lt;= e &lt;= +32
2403 </pre>
2404  
2405 <pre>
2406          FLT_RADIX                                    16
2407          FLT_MANT_DIG                                  6
2408          FLT_EPSILON                     9.53674316E-07F
2409          FLT_DECIMAL_DIG                               9
2410          FLT_DIG                                       6
2411          FLT_MIN_EXP                                 -31
2412          FLT_MIN                         2.93873588E-39F
2413          FLT_MIN_10_EXP                              -38
2414          FLT_MAX_EXP                                 +32
2415          FLT_MAX                         3.40282347E+38F
2416          FLT_MAX_10_EXP                              +38
2417 </pre>
2418  
2419 <p><a name="5.2.4.2.2p16" href="#5.2.4.2.2p16"><small>16</small></a>
2420  EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
2421  single-precision and double-precision numbers in IEC 60559,<sup><a href="#note28"><b>28)</b></a></sup> and the appropriate values in a
2422  <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
2423 <pre>
2424                    24
2425        x f = s2e   (Sum) f k 2-k ,
2426                    k=1
2427                                   -125 &lt;= e &lt;= +128
2428 </pre>
2429  
2430 <pre>
2431                    53
2432        x d = s2e   (Sum) f k 2-k ,
2433                    k=1
2434                                   -1021 &lt;= e &lt;= +1024
2435 </pre>
2436  
2437 <pre>
2438          FLT_RADIX                                     2
2439          DECIMAL_DIG                                  17
2440          FLT_MANT_DIG                                 24
2441          FLT_EPSILON                     1.19209290E-07F // decimal constant
2442          FLT_EPSILON                            0X1P-23F // hex constant
2443          FLT_DECIMAL_DIG                               9
2444 </pre>
2445  
2446  
2447 <!--page 52 -->
2448 <pre>
2449          FLT_DIG                             6
2450          FLT_MIN_EXP                      -125
2451          FLT_MIN               1.17549435E-38F               //   decimal constant
2452          FLT_MIN                     0X1P-126F               //   hex constant
2453          FLT_TRUE_MIN          1.40129846E-45F               //   decimal constant
2454          FLT_TRUE_MIN                0X1P-149F               //   hex constant
2455          FLT_HAS_SUBNORM                     1
2456          FLT_MIN_10_EXP                    -37
2457          FLT_MAX_EXP                      +128
2458          FLT_MAX               3.40282347E+38F               // decimal constant
2459          FLT_MAX               0X1.fffffeP127F               // hex constant
2460          FLT_MAX_10_EXP                    +38
2461          DBL_MANT_DIG                       53
2462          DBL_EPSILON    2.2204460492503131E-16               // decimal constant
2463          DBL_EPSILON                   0X1P-52               // hex constant
2464          DBL_DECIMAL_DIG                    17
2465          DBL_DIG                            15
2466          DBL_MIN_EXP                     -1021
2467          DBL_MIN      2.2250738585072014E-308                //   decimal constant
2468          DBL_MIN                     0X1P-1022               //   hex constant
2469          DBL_TRUE_MIN 4.9406564584124654E-324                //   decimal constant
2470          DBL_TRUE_MIN                0X1P-1074               //   hex constant
2471          DBL_HAS_SUBNORM                     1
2472          DBL_MIN_10_EXP                   -307
2473          DBL_MAX_EXP                     +1024
2474          DBL_MAX      1.7976931348623157E+308                // decimal constant
2475          DBL_MAX        0X1.fffffffffffffP1023               // hex constant
2476          DBL_MAX_10_EXP                   +308
2477 </pre>
2478  If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
2479  example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
2480  precision), then DECIMAL_DIG would be 21.
2481  
2482 <p><b> Forward references</b>:        conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
2483  <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.29">&lt;wchar.h&gt;</a>
2484  (<a href="#7.29">7.29</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>
2485  (<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>).
2486 <!--page 53 -->
2487
2488 <p><b>Footnotes</b>
2489 <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
2490  does not require the floating-point arithmetic of the implementation to be identical.
2491 </small>
2492 <p><small><a name="note22" href="#note22">22)</a> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
2493  IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
2494  similar behavior.
2495 </small>
2496 <p><small><a name="note23" href="#note23">23)</a> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
2497  the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
2498 </small>
2499 <p><small><a name="note24" href="#note24">24)</a> The evaluation method determines evaluation formats of expressions involving all floating types, not
2500  just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
2501  _Complex operands is represented in the double _Complex format, and its parts are evaluated to
2502  double.
2503 </small>
2504 <p><small><a name="note25" href="#note25">25)</a> Characterization as indeterminable is intended if floating-point operations do not consistently interpret
2505  subnormal representations as zero, nor as nonzero.
2506 </small>
2507 <p><small><a name="note26" href="#note26">26)</a> Characterization as absent is intended if no floating-point operations produce subnormal results from
2508  non-subnormal inputs, even if the type format includes representations of subnormal numbers.
2509 </small>
2510 <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
2511  positive number no greater than the minimum normalized positive number for the type.
2512 </small>
2513 <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
2514  limits are one less than shown here.
2515 </small>
2516
2517 <p><small><a href="#Contents">Contents</a></small>
2518 <h2><a name="6" href="#6">6. Language</a></h2>
2519
2520 <p><small><a href="#Contents">Contents</a></small>
2521 <h3><a name="6.1" href="#6.1">6.1 Notation</a></h3>
2522 <p><a name="6.1p1" href="#6.1p1"><small>1</small></a>
2523  In the syntax notation used in this clause, syntactic categories (nonterminals) are
2524  indicated by italic type, and literal words and character set members (terminals) by bold
2525  type. A colon (:) following a nonterminal introduces its definition. Alternative
2526  definitions are listed on separate lines, except when prefaced by the words ''one of''. An
2527  optional symbol is indicated by the subscript ''opt'', so that
2528 <pre>
2529           { expression<sub>opt</sub> }
2530 </pre>
2531  indicates an optional expression enclosed in braces.
2532 <p><a name="6.1p2" href="#6.1p2"><small>2</small></a>
2533  When syntactic categories are referred to in the main text, they are not italicized and
2534  words are separated by spaces instead of hyphens.
2535 <p><a name="6.1p3" href="#6.1p3"><small>3</small></a>
2536  A summary of the language syntax is given in <a href="#A">annex A</a>.
2537
2538 <p><small><a href="#Contents">Contents</a></small>
2539 <h3><a name="6.2" href="#6.2">6.2 Concepts</a></h3>
2540
2541 <p><small><a href="#Contents">Contents</a></small>
2542 <h4><a name="6.2.1" href="#6.2.1">6.2.1 Scopes of identifiers</a></h4>
2543 <p><a name="6.2.1p1" href="#6.2.1p1"><small>1</small></a>
2544  An identifier can denote an object; a function; a tag or a member of a structure, union, or
2545  enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
2546  same identifier can denote different entities at different points in the program. A member
2547  of an enumeration is called an enumeration constant. Macro names and macro
2548  parameters are not considered further here, because prior to the semantic phase of
2549  program translation any occurrences of macro names in the source file are replaced by the
2550  preprocessing token sequences that constitute their macro definitions.
2551 <p><a name="6.2.1p2" href="#6.2.1p2"><small>2</small></a>
2552  For each different entity that an identifier designates, the identifier is visible (i.e., can be
2553  used) only within a region of program text called its scope. Different entities designated
2554  by the same identifier either have different scopes, or are in different name spaces. There
2555  are four kinds of scopes: function, file, block, and function prototype. (A function
2556  prototype is a declaration of a function that declares the types of its parameters.)
2557 <p><a name="6.2.1p3" href="#6.2.1p3"><small>3</small></a>
2558  A label name is the only kind of identifier that has function scope. It can be used (in a
2559  goto statement) anywhere in the function in which it appears, and is declared implicitly
2560  by its syntactic appearance (followed by a : and a statement).
2561 <p><a name="6.2.1p4" href="#6.2.1p4"><small>4</small></a>
2562  Every other identifier has scope determined by the placement of its declaration (in a
2563  declarator or type specifier). If the declarator or type specifier that declares the identifier
2564  appears outside of any block or list of parameters, the identifier has file scope, which
2565  terminates at the end of the translation unit. If the declarator or type specifier that
2566  declares the identifier appears inside a block or within the list of parameter declarations in
2567  a function definition, the identifier has block scope, which terminates at the end of the
2568  associated block. If the declarator or type specifier that declares the identifier appears
2569 <!--page 54 -->
2570  within the list of parameter declarations in a function prototype (not part of a function
2571  definition), the identifier has function prototype scope, which terminates at the end of the
2572  function declarator. If an identifier designates two different entities in the same name
2573  space, the scopes might overlap. If so, the scope of one entity (the inner scope) will end
2574  strictly before the scope of the other entity (the outer scope). Within the inner scope, the
2575  identifier designates the entity declared in the inner scope; the entity declared in the outer
2576  scope is hidden (and not visible) within the inner scope.
2577 <p><a name="6.2.1p5" href="#6.2.1p5"><small>5</small></a>
2578  Unless explicitly stated otherwise, where this International Standard uses the term
2579  ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
2580  entity in the relevant name space whose declaration is visible at the point the identifier
2581  occurs.
2582 <p><a name="6.2.1p6" href="#6.2.1p6"><small>6</small></a>
2583  Two identifiers have the same scope if and only if their scopes terminate at the same
2584  point.
2585 <p><a name="6.2.1p7" href="#6.2.1p7"><small>7</small></a>
2586  Structure, union, and enumeration tags have scope that begins just after the appearance of
2587  the tag in a type specifier that declares the tag. Each enumeration constant has scope that
2588  begins just after the appearance of its defining enumerator in an enumerator list. Any
2589  other identifier has scope that begins just after the completion of its declarator.
2590 <p><a name="6.2.1p8" href="#6.2.1p8"><small>8</small></a>
2591  As a special case, a type name (which is not a declaration of an identifier) is considered to
2592  have a scope that begins just after the place within the type name where the omitted
2593  identifier would appear were it not omitted.
2594 <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
2595  (<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>),
2596  source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
2597
2598 <p><small><a href="#Contents">Contents</a></small>
2599 <h4><a name="6.2.2" href="#6.2.2">6.2.2 Linkages of identifiers</a></h4>
2600 <p><a name="6.2.2p1" href="#6.2.2p1"><small>1</small></a>
2601  An identifier declared in different scopes or in the same scope more than once can be
2602  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
2603  three kinds of linkage: external, internal, and none.
2604 <p><a name="6.2.2p2" href="#6.2.2p2"><small>2</small></a>
2605  In the set of translation units and libraries that constitutes an entire program, each
2606  declaration of a particular identifier with external linkage denotes the same object or
2607  function. Within one translation unit, each declaration of an identifier with internal
2608  linkage denotes the same object or function. Each declaration of an identifier with no
2609  linkage denotes a unique entity.
2610 <p><a name="6.2.2p3" href="#6.2.2p3"><small>3</small></a>
2611  If the declaration of a file scope identifier for an object or a function contains the storage-
2612  class specifier static, the identifier has internal linkage.<sup><a href="#note30"><b>30)</b></a></sup>
2613  
2614  
2615  
2616 <!--page 55 -->
2617 <p><a name="6.2.2p4" href="#6.2.2p4"><small>4</small></a>
2618  For an identifier declared with the storage-class specifier extern in a scope in which a
2619  prior declaration of that identifier is visible,<sup><a href="#note31"><b>31)</b></a></sup> if the prior declaration specifies internal or
2620  external linkage, the linkage of the identifier at the later declaration is the same as the
2621  linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
2622  declaration specifies no linkage, then the identifier has external linkage.
2623 <p><a name="6.2.2p5" href="#6.2.2p5"><small>5</small></a>
2624  If the declaration of an identifier for a function has no storage-class specifier, its linkage
2625  is determined exactly as if it were declared with the storage-class specifier extern. If
2626  the declaration of an identifier for an object has file scope and no storage-class specifier,
2627  its linkage is external.
2628 <p><a name="6.2.2p6" href="#6.2.2p6"><small>6</small></a>
2629  The following identifiers have no linkage: an identifier declared to be anything other than
2630  an object or a function; an identifier declared to be a function parameter; a block scope
2631  identifier for an object declared without the storage-class specifier extern.
2632 <p><a name="6.2.2p7" href="#6.2.2p7"><small>7</small></a>
2633  If, within a translation unit, the same identifier appears with both internal and external
2634  linkage, the behavior is undefined.
2635 <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>),
2636  statements (<a href="#6.8">6.8</a>).
2637
2638 <p><b>Footnotes</b>
2639 <p><small><a name="note29" href="#note29">29)</a> There is no linkage between different identifiers.
2640 </small>
2641 <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
2642  <a href="#6.7.1">6.7.1</a>.
2643 </small>
2644 <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.
2645 </small>
2646
2647 <p><small><a href="#Contents">Contents</a></small>
2648 <h4><a name="6.2.3" href="#6.2.3">6.2.3 Name spaces of identifiers</a></h4>
2649 <p><a name="6.2.3p1" href="#6.2.3p1"><small>1</small></a>
2650  If more than one declaration of a particular identifier is visible at any point in a
2651  translation unit, the syntactic context disambiguates uses that refer to different entities.
2652  Thus, there are separate name spaces for various categories of identifiers, as follows:
2653 <ul>
2654 <li>  label names (disambiguated by the syntax of the label declaration and use);
2655 <li>  the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note32"><b>32)</b></a></sup>
2656  of the keywords struct, union, or enum);
2657 <li>  the members of structures or unions; each structure or union has a separate name
2658  space for its members (disambiguated by the type of the expression used to access the
2659  member via the . or -&gt; operator);
2660 <li>  all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
2661  enumeration constants).
2662 </ul>
2663 <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>),
2664  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
2665  (<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>).
2666  
2667 <!--page 56 -->
2668
2669 <p><b>Footnotes</b>
2670 <p><small><a name="note32" href="#note32">32)</a> There is only one name space for tags even though three are possible.
2671 </small>
2672
2673 <p><small><a href="#Contents">Contents</a></small>
2674 <h4><a name="6.2.4" href="#6.2.4">6.2.4 Storage durations of objects</a></h4>
2675 <p><a name="6.2.4p1" href="#6.2.4p1"><small>1</small></a>
2676  An object has a storage duration that determines its lifetime. There are four storage
2677  durations: static, thread, automatic, and allocated. Allocated storage is described in
2678  <a href="#7.22.3">7.22.3</a>.
2679 <p><a name="6.2.4p2" href="#6.2.4p2"><small>2</small></a>
2680  The lifetime of an object is the portion of program execution during which storage is
2681  guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note33"><b>33)</b></a></sup> and retains
2682  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
2683  lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
2684  the object it points to (or just past) reaches the end of its lifetime.
2685 <p><a name="6.2.4p3" href="#6.2.4p3"><small>3</small></a>
2686  An object whose identifier is declared without the storage-class specifier
2687  _Thread_local, and either with external or internal linkage or with the storage-class
2688  specifier static, has static storage duration. Its lifetime is the entire execution of the
2689  program and its stored value is initialized only once, prior to program startup.
2690 <p><a name="6.2.4p4" href="#6.2.4p4"><small>4</small></a>
2691  An object whose identifier is declared with the storage-class specifier _Thread_local
2692  has thread storage duration. Its lifetime is the entire execution of the thread for which it
2693  is created, and its stored value is initialized when the thread is started. There is a distinct
2694  object per thread, and use of the declared name in an expression refers to the object
2695  associated with the thread evaluating the expression. The result of attempting to
2696  indirectly access an object with thread storage duration from a thread other than the one
2697  with which the object is associated is implementation-defined.
2698 <p><a name="6.2.4p5" href="#6.2.4p5"><small>5</small></a>
2699  An object whose identifier is declared with no linkage and without the storage-class
2700  specifier static has automatic storage duration, as do some compound literals. The
2701  result of attempting to indirectly access an object with automatic storage duration from a
2702  thread other than the one with which the object is associated is implementation-defined.
2703 <p><a name="6.2.4p6" href="#6.2.4p6"><small>6</small></a>
2704  For such an object that does not have a variable length array type, its lifetime extends
2705  from entry into the block with which it is associated until execution of that block ends in
2706  any way. (Entering an enclosed block or calling a function suspends, but does not end,
2707  execution of the current block.) If the block is entered recursively, a new instance of the
2708  object is created each time. The initial value of the object is indeterminate. If an
2709  initialization is specified for the object, it is performed each time the declaration or
2710  compound literal is reached in the execution of the block; otherwise, the value becomes
2711  indeterminate each time the declaration is reached.
2712  
2713  
2714  
2715 <!--page 57 -->
2716 <p><a name="6.2.4p7" href="#6.2.4p7"><small>7</small></a>
2717  For such an object that does have a variable length array type, its lifetime extends from
2718  the declaration of the object until execution of the program leaves the scope of the
2719  declaration.<sup><a href="#note35"><b>35)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
2720  each time. The initial value of the object is indeterminate.
2721 <p><a name="6.2.4p8" href="#6.2.4p8"><small>8</small></a>
2722  A non-lvalue expression with structure or union type, where the structure or union
2723  contains a member with array type (including, recursively, members of all contained
2724  structures and unions) refers to an object with automatic storage duration and temporary
2725  lifetime.<sup><a href="#note36"><b>36)</b></a></sup> Its lifetime begins when the expression is evaluated and its initial value is the
2726  value of the expression. Its lifetime ends when the evaluation of the containing full
2727  expression or full declarator ends. Any attempt to modify an object with temporary
2728  lifetime results in undefined behavior.
2729 <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
2730  (<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>).
2731
2732 <p><b>Footnotes</b>
2733 <p><small><a name="note33" href="#note33">33)</a> The term ''constant address'' means that two pointers to the object constructed at possibly different
2734  times will compare equal. The address may be different during two different executions of the same
2735  program.
2736 </small>
2737 <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.
2738 </small>
2739 <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
2740  embedded block prior to the declaration, leaves the scope of the declaration.
2741 </small>
2742 <p><small><a name="note36" href="#note36">36)</a> The address of such an object is taken implicitly when an array member is accessed.
2743 </small>
2744
2745 <p><small><a href="#Contents">Contents</a></small>
2746 <h4><a name="6.2.5" href="#6.2.5">6.2.5 Types</a></h4>
2747 <p><a name="6.2.5p1" href="#6.2.5p1"><small>1</small></a>
2748  The meaning of a value stored in an object or returned by a function is determined by the
2749  type of the expression used to access it. (An identifier declared to be an object is the
2750  simplest such expression; the type is specified in the declaration of the identifier.) Types
2751  are partitioned into object types (types that describe objects) and function types (types
2752  that describe functions). At various points within a translation unit an object type may be
2753  incomplete (lacking sufficient information to determine the size of objects of that type) or
2754  complete (having sufficient information).<sup><a href="#note37"><b>37)</b></a></sup>
2755 <p><a name="6.2.5p2" href="#6.2.5p2"><small>2</small></a>
2756  An object declared as type _Bool is large enough to store the values 0 and 1.
2757 <p><a name="6.2.5p3" href="#6.2.5p3"><small>3</small></a>
2758  An object declared as type char is large enough to store any member of the basic
2759  execution character set. If a member of the basic execution character set is stored in a
2760  char object, its value is guaranteed to be nonnegative. If any other character is stored in
2761  a char object, the resulting value is implementation-defined but shall be within the range
2762  of values that can be represented in that type.
2763 <p><a name="6.2.5p4" href="#6.2.5p4"><small>4</small></a>
2764  There are five standard signed integer types, designated as signed char, short
2765  int, int, long int, and long long int. (These and other types may be
2766  designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
2767  implementation-defined extended signed integer types.<sup><a href="#note38"><b>38)</b></a></sup> The standard and extended
2768  signed integer types are collectively called signed integer types.<sup><a href="#note39"><b>39)</b></a></sup>
2769  
2770 <!--page 58 -->
2771 <p><a name="6.2.5p5" href="#6.2.5p5"><small>5</small></a>
2772  An object declared as type signed char occupies the same amount of storage as a
2773  ''plain'' char object. A ''plain'' int object has the natural size suggested by the
2774  architecture of the execution environment (large enough to contain any value in the range
2775  INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
2776 <p><a name="6.2.5p6" href="#6.2.5p6"><small>6</small></a>
2777  For each of the signed integer types, there is a corresponding (but different) unsigned
2778  integer type (designated with the keyword unsigned) that uses the same amount of
2779  storage (including sign information) and has the same alignment requirements. The type
2780  _Bool and the unsigned integer types that correspond to the standard signed integer
2781  types are the standard unsigned integer types. The unsigned integer types that
2782  correspond to the extended signed integer types are the extended unsigned integer types.
2783  The standard and extended unsigned integer types are collectively called unsigned integer
2784  types.<sup><a href="#note40"><b>40)</b></a></sup>
2785 <p><a name="6.2.5p7" href="#6.2.5p7"><small>7</small></a>
2786  The standard signed integer types and standard unsigned integer types are collectively
2787  called the standard integer types, the extended signed integer types and extended
2788  unsigned integer types are collectively called the extended integer types.
2789 <p><a name="6.2.5p8" href="#6.2.5p8"><small>8</small></a>
2790  For any two integer types with the same signedness and different integer conversion rank
2791  (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
2792  subrange of the values of the other type.
2793 <p><a name="6.2.5p9" href="#6.2.5p9"><small>9</small></a>
2794  The range of nonnegative values of a signed integer type is a subrange of the
2795  corresponding unsigned integer type, and the representation of the same value in each
2796  type is the same.<sup><a href="#note41"><b>41)</b></a></sup> A computation involving unsigned operands can never overflow,
2797  because a result that cannot be represented by the resulting unsigned integer type is
2798  reduced modulo the number that is one greater than the largest value that can be
2799  represented by the resulting type.
2800 <p><a name="6.2.5p10" href="#6.2.5p10"><small>10</small></a>
2801  There are three real floating types, designated as float, double, and long
2802  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
2803  type double; the set of values of the type double is a subset of the set of values of the
2804  type long double.
2805  
2806  
2807 <!--page 59 -->
2808 <p><a name="6.2.5p11" href="#6.2.5p11"><small>11</small></a>
2809  There are three complex types, designated as float _Complex, double
2810  _Complex, and long double _Complex.<sup><a href="#note43"><b>43)</b></a></sup> (Complex types are a conditional
2811  feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.) The real floating and
2812  complex types are collectively called the floating types.
2813 <p><a name="6.2.5p12" href="#6.2.5p12"><small>12</small></a>
2814  For each floating type there is a corresponding real type, which is always a real floating
2815  type. For real floating types, it is the same type. For complex types, it is the type given
2816  by deleting the keyword _Complex from the type name.
2817 <p><a name="6.2.5p13" href="#6.2.5p13"><small>13</small></a>
2818  Each complex type has the same representation and alignment requirements as an array
2819  type containing exactly two elements of the corresponding real type; the first element is
2820  equal to the real part, and the second element to the imaginary part, of the complex
2821  number.
2822 <p><a name="6.2.5p14" href="#6.2.5p14"><small>14</small></a>
2823  The type char, the signed and unsigned integer types, and the floating types are
2824  collectively called the basic types. The basic types are complete object types. Even if the
2825  implementation defines two or more basic types to have the same representation, they are
2826  nevertheless different types.<sup><a href="#note44"><b>44)</b></a></sup>
2827 <p><a name="6.2.5p15" href="#6.2.5p15"><small>15</small></a>
2828  The three types char, signed char, and unsigned char are collectively called
2829  the character types. The implementation shall define char to have the same range,
2830  representation, and behavior as either signed char or unsigned char.<sup><a href="#note45"><b>45)</b></a></sup>
2831 <p><a name="6.2.5p16" href="#6.2.5p16"><small>16</small></a>
2832  An enumeration comprises a set of named integer constant values. Each distinct
2833  enumeration constitutes a different enumerated type.
2834 <p><a name="6.2.5p17" href="#6.2.5p17"><small>17</small></a>
2835  The type char, the signed and unsigned integer types, and the enumerated types are
2836  collectively called integer types. The integer and real floating types are collectively called
2837  real types.
2838 <p><a name="6.2.5p18" href="#6.2.5p18"><small>18</small></a>
2839  Integer and floating types are collectively called arithmetic types. Each arithmetic type
2840  belongs to one type domain: the real type domain comprises the real types, the complex
2841  type domain comprises the complex types.
2842 <p><a name="6.2.5p19" href="#6.2.5p19"><small>19</small></a>
2843  The void type comprises an empty set of values; it is an incomplete object type that
2844  cannot be completed.
2845  
2846  
2847  
2848 <!--page 60 -->
2849 <p><a name="6.2.5p20" href="#6.2.5p20"><small>20</small></a>
2850  Any number of derived types can be constructed from the object and function types, as
2851  follows:
2852 <ul>
2853 <li>  An array type describes a contiguously allocated nonempty set of objects with a
2854  particular member object type, called the element type. The element type shall be
2855  complete whenever the array type is specified. Array types are characterized by their
2856  element type and by the number of elements in the array. An array type is said to be
2857  derived from its element type, and if its element type is T , the array type is sometimes
2858  called ''array of T ''. The construction of an array type from an element type is called
2859  ''array type derivation''.
2860 <li>  A structure type describes a sequentially allocated nonempty set of member objects
2861  (and, in certain circumstances, an incomplete array), each of which has an optionally
2862  specified name and possibly distinct type.
2863 <li>  A union type describes an overlapping nonempty set of member objects, each of
2864  which has an optionally specified name and possibly distinct type.
2865 <li>  A function type describes a function with specified return type. A function type is
2866  characterized by its return type and the number and types of its parameters. A
2867  function type is said to be derived from its return type, and if its return type is T , the
2868  function type is sometimes called ''function returning T ''. The construction of a
2869  function type from a return type is called ''function type derivation''.
2870 <li>  A pointer type may be derived from a function type or an object type, called the
2871  referenced type. A pointer type describes an object whose value provides a reference
2872  to an entity of the referenced type. A pointer type derived from the referenced type T
2873  is sometimes called ''pointer to T ''. The construction of a pointer type from a
2874  referenced type is called ''pointer type derivation''. A pointer type is a complete
2875  object type.
2876 <li>  An atomic type describes the type designated by the construct _Atomic ( type-
2877  name ). (Atomic types are a conditional feature that implementations need not
2878  support; see <a href="#6.10.8.3">6.10.8.3</a>.)
2879 </ul>
2880  These methods of constructing derived types can be applied recursively.
2881 <p><a name="6.2.5p21" href="#6.2.5p21"><small>21</small></a>
2882  Arithmetic types and pointer types are collectively called scalar types. Array and
2883  structure types are collectively called aggregate types.<sup><a href="#note46"><b>46)</b></a></sup>
2884 <p><a name="6.2.5p22" href="#6.2.5p22"><small>22</small></a>
2885  An array type of unknown size is an incomplete type. It is completed, for an identifier of
2886  that type, by specifying the size in a later declaration (with internal or external linkage).
2887  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
2888  
2889  
2890 <!--page 61 -->
2891  type. It is completed, for all declarations of that type, by declaring the same structure or
2892  union tag with its defining content later in the same scope.
2893 <p><a name="6.2.5p23" href="#6.2.5p23"><small>23</small></a>
2894  A type has known constant size if the type is not incomplete and is not a variable length
2895  array type.
2896 <p><a name="6.2.5p24" href="#6.2.5p24"><small>24</small></a>
2897  Array, function, and pointer types are collectively called derived declarator types. A
2898  declarator type derivation from a type T is the construction of a derived declarator type
2899  from T by the application of an array-type, a function-type, or a pointer-type derivation to
2900  T.
2901 <p><a name="6.2.5p25" href="#6.2.5p25"><small>25</small></a>
2902  A type is characterized by its type category, which is either the outermost derivation of a
2903  derived type (as noted above in the construction of derived types), or the type itself if the
2904  type consists of no derived types.
2905 <p><a name="6.2.5p26" href="#6.2.5p26"><small>26</small></a>
2906  Any type so far mentioned is an unqualified type. Each unqualified type has several
2907  qualified versions of its type,<sup><a href="#note47"><b>47)</b></a></sup> corresponding to the combinations of one, two, or all
2908  three of the const, volatile, and restrict qualifiers. The qualified or unqualified
2909  versions of a type are distinct types that belong to the same type category and have the
2910  same representation and alignment requirements.<sup><a href="#note48"><b>48)</b></a></sup> A derived type is not qualified by the
2911  qualifiers (if any) of the type from which it is derived.
2912 <p><a name="6.2.5p27" href="#6.2.5p27"><small>27</small></a>
2913  Further, there is the _Atomic qualifier. The presence of the _Atomic qualifier
2914  designates an atomic type. The size, representation, and alignment of an atomic type
2915  need not be the same as those of the corresponding unqualified type. Therefore, this
2916  Standard explicitly uses the phrase ''atomic, qualified or unqualified type'' whenever the
2917  atomic version of a type is permitted along with the other qualified versions of a type.
2918  The phrase ''qualified or unqualified type'', without specific mention of atomic, does not
2919  include the atomic types.
2920 <p><a name="6.2.5p28" href="#6.2.5p28"><small>28</small></a>
2921  A pointer to void shall have the same representation and alignment requirements as a
2922  pointer to a character type.<sup><a href="#note48"><b>48)</b></a></sup> Similarly, pointers to qualified or unqualified versions of
2923  compatible types shall have the same representation and alignment requirements. All
2924  pointers to structure types shall have the same representation and alignment requirements
2925  as each other. All pointers to union types shall have the same representation and
2926  alignment requirements as each other. Pointers to other types need not have the same
2927  representation or alignment requirements.
2928 <p><a name="6.2.5p29" href="#6.2.5p29"><small>29</small></a>
2929  EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
2930  pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
2931  whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
2932  
2933  
2934 <!--page 62 -->
2935  qualified float'' and is a pointer to a qualified type.
2936  
2937 <p><a name="6.2.5p30" href="#6.2.5p30"><small>30</small></a>
2938  EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
2939  function returning struct tag''. The array has length five and the function has a single parameter of type
2940  float. Its type category is array.
2941  
2942 <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>).
2943
2944 <p><b>Footnotes</b>
2945 <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
2946  different points within a translation unit.
2947 </small>
2948 <p><small><a name="note38" href="#note38">38)</a> Implementation-defined keywords shall have the form of an identifier reserved for any use as
2949  described in <a href="#7.1.3">7.1.3</a>.
2950 </small>
2951 <p><small><a name="note39" href="#note39">39)</a> Therefore, any statement in this Standard about signed integer types also applies to the extended
2952  signed integer types.
2953 </small>
2954 <p><small><a name="note40" href="#note40">40)</a> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
2955  unsigned integer types.
2956 </small>
2957 <p><small><a name="note41" href="#note41">41)</a> The same representation and alignment requirements are meant to imply interchangeability as
2958  arguments to functions, return values from functions, and members of unions.
2959 </small>
2960 <p><small><a name="note42" href="#note42">42)</a> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
2961 </small>
2962 <p><small><a name="note43" href="#note43">43)</a> A specification for imaginary types is in <a href="#G">annex G</a>.
2963 </small>
2964 <p><small><a name="note44" href="#note44">44)</a> An implementation may define new keywords that provide alternative ways to designate a basic (or
2965  any other) type; this does not violate the requirement that all basic types be different.
2966  Implementation-defined keywords shall have the form of an identifier reserved for any use as
2967  described in <a href="#7.1.3">7.1.3</a>.
2968 </small>
2969 <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
2970  used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
2971  other two and is not compatible with either.
2972 </small>
2973 <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
2974  contain one member at a time.
2975 </small>
2976 <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.
2977 </small>
2978 <p><small><a name="note48" href="#note48">48)</a> The same representation and alignment requirements are meant to imply interchangeability as
2979  arguments to functions, return values from functions, and members of unions.
2980 </small>
2981
2982 <p><small><a href="#Contents">Contents</a></small>
2983 <h4><a name="6.2.6" href="#6.2.6">6.2.6 Representations of types</a></h4>
2984
2985 <p><small><a href="#Contents">Contents</a></small>
2986 <h5><a name="6.2.6.1" href="#6.2.6.1">6.2.6.1 General</a></h5>
2987 <p><a name="6.2.6.1p1" href="#6.2.6.1p1"><small>1</small></a>
2988  The representations of all types are unspecified except as stated in this subclause.
2989 <p><a name="6.2.6.1p2" href="#6.2.6.1p2"><small>2</small></a>
2990  Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
2991  the number, order, and encoding of which are either explicitly specified or
2992  implementation-defined.
2993 <p><a name="6.2.6.1p3" href="#6.2.6.1p3"><small>3</small></a>
2994  Values stored in unsigned bit-fields and objects of type unsigned char shall be
2995  represented using a pure binary notation.<sup><a href="#note49"><b>49)</b></a></sup>
2996 <p><a name="6.2.6.1p4" href="#6.2.6.1p4"><small>4</small></a>
2997  Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
2998  bits, where n is the size of an object of that type, in bytes. The value may be copied into
2999  an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
3000  called the object representation of the value. Values stored in bit-fields consist of m bits,
3001  where m is the size specified for the bit-field. The object representation is the set of m
3002  bits the bit-field comprises in the addressable storage unit holding it. Two values (other
3003  than NaNs) with the same object representation compare equal, but values that compare
3004  equal may have different object representations.
3005 <p><a name="6.2.6.1p5" href="#6.2.6.1p5"><small>5</small></a>
3006  Certain object representations need not represent a value of the object type. If the stored
3007  value of an object has such a representation and is read by an lvalue expression that does
3008  not have character type, the behavior is undefined. If such a representation is produced
3009  by a side effect that modifies all or any part of the object by an lvalue expression that
3010  does not have character type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup> Such a representation is called
3011  a trap representation.
3012 <p><a name="6.2.6.1p6" href="#6.2.6.1p6"><small>6</small></a>
3013  When a value is stored in an object of structure or union type, including in a member
3014  object, the bytes of the object representation that correspond to any padding bytes take
3015  unspecified values.<sup><a href="#note51"><b>51)</b></a></sup> The value of a structure or union object is never a trap
3016  
3017  
3018 <!--page 63 -->
3019  representation, even though the value of a member of the structure or union object may be
3020  a trap representation.
3021 <p><a name="6.2.6.1p7" href="#6.2.6.1p7"><small>7</small></a>
3022  When a value is stored in a member of an object of union type, the bytes of the object
3023  representation that do not correspond to that member but do correspond to other members
3024  take unspecified values.
3025 <p><a name="6.2.6.1p8" href="#6.2.6.1p8"><small>8</small></a>
3026  Where an operator is applied to a value that has more than one object representation,
3027  which object representation is used shall not affect the value of the result.<sup><a href="#note52"><b>52)</b></a></sup> Where a
3028  value is stored in an object using a type that has more than one object representation for
3029  that value, it is unspecified which representation is used, but a trap representation shall
3030  not be generated.
3031 <p><a name="6.2.6.1p9" href="#6.2.6.1p9"><small>9</small></a>
3032  Loads and stores of objects with                            atomic       types     are     done      with
3033  memory_order_seq_cst semantics.
3034 <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
3035  designators (<a href="#6.3.2.1">6.3.2.1</a>), order and consistency (<a href="#7.17.3">7.17.3</a>).
3036
3037 <p><b>Footnotes</b>
3038 <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
3039  represented by successive bits are additive, begin with 1, and are multiplied by successive integral
3040  powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
3041  Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
3042  type unsigned char range from 0 to 2
3043
3044 <pre>
3045                                            CHAR_BIT
3046                                                      - 1.
3047 </pre>
3048 </small>
3049 <p><small><a name="note50" href="#note50">50)</a> Thus, an automatic variable can be initialized to a trap representation without causing undefined
3050  behavior, but the value of the variable cannot be used until a proper value is stored in it.
3051 </small>
3052 <p><small><a name="note51" href="#note51">51)</a> Thus, for example, structure assignment need not copy any padding bits.
3053 </small>
3054 <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
3055  accessed as objects of type T, but to have different values in other contexts. In particular, if == is
3056  defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
3057  Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
3058  on values of type T may distinguish between them.
3059 </small>
3060
3061 <p><small><a href="#Contents">Contents</a></small>
3062 <h5><a name="6.2.6.2" href="#6.2.6.2">6.2.6.2 Integer types</a></h5>
3063 <p><a name="6.2.6.2p1" href="#6.2.6.2p1"><small>1</small></a>
3064  For unsigned integer types other than unsigned char, the bits of the object
3065  representation shall be divided into two groups: value bits and padding bits (there need
3066  not be any of the latter). If there are N value bits, each bit shall represent a different
3067  power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
3068  representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
3069  known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note53"><b>53)</b></a></sup>
3070 <p><a name="6.2.6.2p2" href="#6.2.6.2p2"><small>2</small></a>
3071  For signed integer types, the bits of the object representation shall be divided into three
3072  groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
3073  signed char shall not have any padding bits. There shall be exactly one sign bit.
3074  Each bit that is a value bit shall have the same value as the same bit in the object
3075  representation of the corresponding unsigned type (if there are M value bits in the signed
3076  type and N in the unsigned type, then M &lt;= N ). If the sign bit is zero, it shall not affect
3077  
3078 <!--page 64 -->
3079  the resulting value. If the sign bit is one, the value shall be modified in one of the
3080  following ways:
3081 <ul>
3082 <li>  the corresponding value with sign bit 0 is negated (sign and magnitude);
3083 <li>  the sign bit has the value -(2 M ) (two's complement);
3084 <li>  the sign bit has the value -(2 M - 1) (ones' complement).
3085 </ul>
3086  Which of these applies is implementation-defined, as is whether the value with sign bit 1
3087  and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
3088  complement), is a trap representation or a normal value. In the case of sign and
3089  magnitude and ones' complement, if this representation is a normal value it is called a
3090  negative zero.
3091 <p><a name="6.2.6.2p3" href="#6.2.6.2p3"><small>3</small></a>
3092  If the implementation supports negative zeros, they shall be generated only by:
3093 <ul>
3094 <li>  the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with operands that produce such a value;
3095 <li>  the +, -, *, /, and % operators where one operand is a negative zero and the result is
3096  zero;
3097 <li>  compound assignment operators based on the above cases.
3098 </ul>
3099  It is unspecified whether these cases actually generate a negative zero or a normal zero,
3100  and whether a negative zero becomes a normal zero when stored in an object.
3101 <p><a name="6.2.6.2p4" href="#6.2.6.2p4"><small>4</small></a>
3102  If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
3103  and &gt;&gt; operators with operands that would produce such a value is undefined.
3104 <p><a name="6.2.6.2p5" href="#6.2.6.2p5"><small>5</small></a>
3105  The values of any padding bits are unspecified.<sup><a href="#note54"><b>54)</b></a></sup> A valid (non-trap) object representation
3106  of a signed integer type where the sign bit is zero is a valid object representation of the
3107  corresponding unsigned type, and shall represent the same value. For any integer type,
3108  the object representation where all the bits are zero shall be a representation of the value
3109  zero in that type.
3110 <p><a name="6.2.6.2p6" href="#6.2.6.2p6"><small>6</small></a>
3111  The precision of an integer type is the number of bits it uses to represent values,
3112  excluding any sign and padding bits. The width of an integer type is the same but
3113  including any sign bit; thus for unsigned integer types the two values are the same, while
3114  for signed integer types the width is one greater than the precision.
3115  
3116  
3117  
3118  
3119 <!--page 65 -->
3120
3121 <p><b>Footnotes</b>
3122 <p><small><a name="note53" href="#note53">53)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
3123  bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
3124  representation other than as part of an exceptional condition such as an overflow, and this cannot occur
3125  with unsigned types. All other combinations of padding bits are alternative object representations of
3126  the value specified by the value bits.
3127 </small>
3128 <p><small><a name="note54" href="#note54">54)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
3129  bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
3130  representation other than as part of an exceptional condition such as an overflow. All other
3131  combinations of padding bits are alternative object representations of the value specified by the value
3132  bits.
3133 </small>
3134
3135 <p><small><a href="#Contents">Contents</a></small>
3136 <h4><a name="6.2.7" href="#6.2.7">6.2.7 Compatible type and composite type</a></h4>
3137 <p><a name="6.2.7p1" href="#6.2.7p1"><small>1</small></a>
3138  Two types have compatible type if their types are the same. Additional rules for
3139  determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
3140  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,
3141  union, or enumerated types declared in separate translation units are compatible if their
3142  tags and members satisfy the following requirements: If one is declared with a tag, the
3143  other shall be declared with the same tag. If both are completed anywhere within their
3144  respective translation units, then the following additional requirements apply: there shall
3145  be a one-to-one correspondence between their members such that each pair of
3146  corresponding members are declared with compatible types; if one member of the pair is
3147  declared with an alignment specifier, the other is declared with an equivalent alignment
3148  specifier; and if one member of the pair is declared with a name, the other is declared
3149  with the same name. For two structures, corresponding members shall be declared in the
3150  same order. For two structures or unions, corresponding bit-fields shall have the same
3151  widths. For two enumerations, corresponding members shall have the same values.
3152 <p><a name="6.2.7p2" href="#6.2.7p2"><small>2</small></a>
3153  All declarations that refer to the same object or function shall have compatible type;
3154  otherwise, the behavior is undefined.
3155 <p><a name="6.2.7p3" href="#6.2.7p3"><small>3</small></a>
3156  A composite type can be constructed from two types that are compatible; it is a type that
3157  is compatible with both of the two types and satisfies the following conditions:
3158 <ul>
3159 <li>  If both types are array types, the following rules are applied:
3160 <ul>
3161 <li> If one type is an array of known constant size, the composite type is an array of
3162  that size.
3163 <li> Otherwise, if one type is a variable length array whose size is specified by an
3164  expression that is not evaluated, the behavior is undefined.
3165 <li> Otherwise, if one type is a variable length array whose size is specified, the
3166  composite type is a variable length array of that size.
3167 <li> Otherwise, if one type is a variable length array of unspecified size, the composite
3168  type is a variable length array of unspecified size.
3169 <li> Otherwise, both types are arrays of unknown size and the composite type is an
3170  array of unknown size.
3171 </ul>
3172    The element type of the composite type is the composite type of the two element
3173    types.
3174 <li>  If only one type is a function type with a parameter type list (a function prototype),
3175  the composite type is a function prototype with the parameter type list.
3176  
3177  
3178 <!--page 66 -->
3179 <li>  If both types are function types with parameter type lists, the type of each parameter
3180  in the composite parameter type list is the composite type of the corresponding
3181  parameters.
3182 </ul>
3183  These rules apply recursively to the types from which the two types are derived.
3184 <p><a name="6.2.7p4" href="#6.2.7p4"><small>4</small></a>
3185  For an identifier with internal or external linkage declared in a scope in which a prior
3186  declaration of that identifier is visible,<sup><a href="#note56"><b>56)</b></a></sup> if the prior declaration specifies internal or
3187  external linkage, the type of the identifier at the later declaration becomes the composite
3188  type.
3189 <p><b> Forward references</b>: array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
3190 <p><a name="6.2.7p5" href="#6.2.7p5"><small>5</small></a>
3191  EXAMPLE        Given the following two file scope declarations:
3192 <pre>
3193           int f(int (*)(), double (*)[3]);
3194           int f(int (*)(char *), double (*)[]);
3195 </pre>
3196  The resulting composite type for the function is:
3197 <pre>
3198           int f(int (*)(char *), double (*)[3]);
3199 </pre>
3200  
3201
3202 <p><b>Footnotes</b>
3203 <p><small><a name="note55" href="#note55">55)</a> Two types need not be identical to be compatible.
3204 </small>
3205 <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.
3206 </small>
3207
3208 <p><small><a href="#Contents">Contents</a></small>
3209 <h4><a name="6.2.8" href="#6.2.8">6.2.8 Alignment of objects</a></h4>
3210 <p><a name="6.2.8p1" href="#6.2.8p1"><small>1</small></a>
3211  Complete object types have alignment requirements which place restrictions on the
3212  addresses at which objects of that type may be allocated. An alignment is an
3213  implementation-defined integer value representing the number of bytes between
3214  successive addresses at which a given object can be allocated. An object type imposes an
3215  alignment requirement on every object of that type: stricter alignment can be requested
3216  using the _Alignas keyword.
3217 <p><a name="6.2.8p2" href="#6.2.8p2"><small>2</small></a>
3218  A fundamental alignment is represented by an alignment less than or equal to the greatest
3219  alignment supported by the implementation in all contexts, which is equal to
3220  _Alignof (max_align_t).
3221 <p><a name="6.2.8p3" href="#6.2.8p3"><small>3</small></a>
3222  An extended alignment is represented by an alignment greater than
3223  _Alignof (max_align_t). It is implementation-defined whether any extended
3224  alignments are supported and the contexts in which they are supported. A type having an
3225  extended alignment requirement is an over-aligned type.<sup><a href="#note57"><b>57)</b></a></sup>
3226 <p><a name="6.2.8p4" href="#6.2.8p4"><small>4</small></a>
3227  Alignments are represented as values of the type size_t. Valid alignments include only
3228  those values returned by an _Alignof expression for fundamental types, plus an
3229  additional implementation-defined set of values, which may be empty. Every valid
3230  alignment value shall be a nonnegative integral power of two.
3231  
3232  
3233 <!--page 67 -->
3234 <p><a name="6.2.8p5" href="#6.2.8p5"><small>5</small></a>
3235  Alignments have an order from weaker to stronger or stricter alignments. Stricter
3236  alignments have larger alignment values. An address that satisfies an alignment
3237  requirement also satisfies any weaker valid alignment requirement.
3238 <p><a name="6.2.8p6" href="#6.2.8p6"><small>6</small></a>
3239  The alignment requirement of a complete type can be queried using an _Alignof
3240  expression. The types char, signed char, and unsigned char shall have the
3241  weakest alignment requirement.
3242 <p><a name="6.2.8p7" href="#6.2.8p7"><small>7</small></a>
3243  Comparing alignments is meaningful and provides the obvious results:
3244 <ul>
3245 <li>  Two alignments are equal when their numeric values are equal.
3246 <li>  Two alignments are different when their numeric values are not equal.
3247 <li>  When an alignment is larger than another it represents a stricter alignment.
3248 <!--page 68 -->
3249 </ul>
3250
3251 <p><b>Footnotes</b>
3252 <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
3253  alignment has been applied.
3254 </small>
3255
3256 <p><small><a href="#Contents">Contents</a></small>
3257 <h3><a name="6.3" href="#6.3">6.3 Conversions</a></h3>
3258 <p><a name="6.3p1" href="#6.3p1"><small>1</small></a>
3259  Several operators convert operand values from one type to another automatically. This
3260  subclause specifies the result required from such an implicit conversion, as well as those
3261  that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
3262  the conversions performed by most ordinary operators; it is supplemented as required by
3263  the discussion of each operator in <a href="#6.5">6.5</a>.
3264 <p><a name="6.3p2" href="#6.3p2"><small>2</small></a>
3265  Conversion of an operand value to a compatible type causes no change to the value or the
3266  representation.
3267 <p><b> Forward references</b>: cast operators (<a href="#6.5.4">6.5.4</a>).
3268
3269 <p><small><a href="#Contents">Contents</a></small>
3270 <h4><a name="6.3.1" href="#6.3.1">6.3.1 Arithmetic operands</a></h4>
3271
3272 <p><small><a href="#Contents">Contents</a></small>
3273 <h5><a name="6.3.1.1" href="#6.3.1.1">6.3.1.1 Boolean, characters, and integers</a></h5>
3274 <p><a name="6.3.1.1p1" href="#6.3.1.1p1"><small>1</small></a>
3275  Every integer type has an integer conversion rank defined as follows:
3276 <ul>
3277 <li>  No two signed integer types shall have the same rank, even if they have the same
3278  representation.
3279 <li>  The rank of a signed integer type shall be greater than the rank of any signed integer
3280  type with less precision.
3281 <li>  The rank of long long int shall be greater than the rank of long int, which
3282  shall be greater than the rank of int, which shall be greater than the rank of short
3283  int, which shall be greater than the rank of signed char.
3284 <li>  The rank of any unsigned integer type shall equal the rank of the corresponding
3285  signed integer type, if any.
3286 <li>  The rank of any standard integer type shall be greater than the rank of any extended
3287  integer type with the same width.
3288 <li>  The rank of char shall equal the rank of signed char and unsigned char.
3289 <li>  The rank of _Bool shall be less than the rank of all other standard integer types.
3290 <li>  The rank of any enumerated type shall equal the rank of the compatible integer type
3291  (see <a href="#6.7.2.2">6.7.2.2</a>).
3292 <li>  The rank of any extended signed integer type relative to another extended signed
3293  integer type with the same precision is implementation-defined, but still subject to the
3294  other rules for determining the integer conversion rank.
3295 <li>  For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
3296  greater rank than T3, then T1 has greater rank than T3.
3297 </ul>
3298 <p><a name="6.3.1.1p2" href="#6.3.1.1p2"><small>2</small></a>
3299  The following may be used in an expression wherever an int or unsigned int may
3300  be used:
3301 <!--page 69 -->
3302 <ul>
3303 <li>  An object or expression with an integer type (other than int or unsigned int)
3304  whose integer conversion rank is less than or equal to the rank of int and
3305  unsigned int.
3306 <li>  A bit-field of type _Bool, int, signed int, or unsigned int.
3307 </ul>
3308  If an int can represent all values of the original type (as restricted by the width, for a
3309  bit-field), the value is converted to an int; otherwise, it is converted to an unsigned
3310  int. These are called the integer promotions.<sup><a href="#note58"><b>58)</b></a></sup> All other types are unchanged by the
3311  integer promotions.
3312 <p><a name="6.3.1.1p3" href="#6.3.1.1p3"><small>3</small></a>
3313  The integer promotions preserve value including sign. As discussed earlier, whether a
3314  ''plain'' char is treated as signed is implementation-defined.
3315 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
3316  (<a href="#6.7.2.1">6.7.2.1</a>).
3317
3318 <p><b>Footnotes</b>
3319 <p><small><a name="note58" href="#note58">58)</a> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
3320  argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
3321  shift operators, as specified by their respective subclauses.
3322 </small>
3323
3324 <p><small><a href="#Contents">Contents</a></small>
3325 <h5><a name="6.3.1.2" href="#6.3.1.2">6.3.1.2 Boolean type</a></h5>
3326 <p><a name="6.3.1.2p1" href="#6.3.1.2p1"><small>1</small></a>
3327  When any scalar value is converted to _Bool, the result is 0 if the value compares equal
3328  to 0; otherwise, the result is 1.<sup><a href="#note59"><b>59)</b></a></sup>
3329
3330 <p><b>Footnotes</b>
3331 <p><small><a name="note59" href="#note59">59)</a> NaNs do not compare equal to 0 and thus convert to 1.
3332 </small>
3333
3334 <p><small><a href="#Contents">Contents</a></small>
3335 <h5><a name="6.3.1.3" href="#6.3.1.3">6.3.1.3 Signed and unsigned integers</a></h5>
3336 <p><a name="6.3.1.3p1" href="#6.3.1.3p1"><small>1</small></a>
3337  When a value with integer type is converted to another integer type other than _Bool, if
3338  the value can be represented by the new type, it is unchanged.
3339 <p><a name="6.3.1.3p2" href="#6.3.1.3p2"><small>2</small></a>
3340  Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
3341  subtracting one more than the maximum value that can be represented in the new type
3342  until the value is in the range of the new type.<sup><a href="#note60"><b>60)</b></a></sup>
3343 <p><a name="6.3.1.3p3" href="#6.3.1.3p3"><small>3</small></a>
3344  Otherwise, the new type is signed and the value cannot be represented in it; either the
3345  result is implementation-defined or an implementation-defined signal is raised.
3346
3347 <p><b>Footnotes</b>
3348 <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.
3349 </small>
3350
3351 <p><small><a href="#Contents">Contents</a></small>
3352 <h5><a name="6.3.1.4" href="#6.3.1.4">6.3.1.4 Real floating and integer</a></h5>
3353 <p><a name="6.3.1.4p1" href="#6.3.1.4p1"><small>1</small></a>
3354  When a finite value of real floating type is converted to an integer type other than _Bool,
3355  the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
3356  the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note61"><b>61)</b></a></sup>
3357  
3358  
3359 <!--page 70 -->
3360 <p><a name="6.3.1.4p2" href="#6.3.1.4p2"><small>2</small></a>
3361  When a value of integer type is converted to a real floating type, if the value being
3362  converted can be represented exactly in the new type, it is unchanged. If the value being
3363  converted is in the range of values that can be represented but cannot be represented
3364  exactly, the result is either the nearest higher or nearest lower representable value, chosen
3365  in an implementation-defined manner. If the value being converted is outside the range of
3366  values that can be represented, the behavior is undefined. Results of some implicit
3367  conversions may be represented in greater range and precision than that required by the
3368  new type (see <a href="#6.3.1.8">6.3.1.8</a> and <a href="#6.8.6.4">6.8.6.4</a>).
3369
3370 <p><b>Footnotes</b>
3371 <p><small><a name="note61" href="#note61">61)</a> The remaindering operation performed when a value of integer type is converted to unsigned type
3372  need not be performed when a value of real floating type is converted to unsigned type. Thus, the
3373  range of portable real floating values is (-1, Utype_MAX+1).
3374 </small>
3375
3376 <p><small><a href="#Contents">Contents</a></small>
3377 <h5><a name="6.3.1.5" href="#6.3.1.5">6.3.1.5 Real floating types</a></h5>
3378 <p><a name="6.3.1.5p1" href="#6.3.1.5p1"><small>1</small></a>
3379  When a value of real floating type is converted to a real floating type, if the value being
3380  converted can be represented exactly in the new type, it is unchanged. If the value being
3381  converted is in the range of values that can be represented but cannot be represented
3382  exactly, the result is either the nearest higher or nearest lower representable value, chosen
3383  in an implementation-defined manner. If the value being converted is outside the range of
3384  values that can be represented, the behavior is undefined. Results of some implicit
3385  conversions may be represented in greater range and precision than that required by the
3386  new type (see <a href="#6.3.1.8">6.3.1.8</a> and <a href="#6.8.6.4">6.8.6.4</a>).
3387
3388 <p><small><a href="#Contents">Contents</a></small>
3389 <h5><a name="6.3.1.6" href="#6.3.1.6">6.3.1.6 Complex types</a></h5>
3390 <p><a name="6.3.1.6p1" href="#6.3.1.6p1"><small>1</small></a>
3391  When a value of complex type is converted to another complex type, both the real and
3392  imaginary parts follow the conversion rules for the corresponding real types.
3393
3394 <p><small><a href="#Contents">Contents</a></small>
3395 <h5><a name="6.3.1.7" href="#6.3.1.7">6.3.1.7 Real and complex</a></h5>
3396 <p><a name="6.3.1.7p1" href="#6.3.1.7p1"><small>1</small></a>
3397  When a value of real type is converted to a complex type, the real part of the complex
3398  result value is determined by the rules of conversion to the corresponding real type and
3399  the imaginary part of the complex result value is a positive zero or an unsigned zero.
3400 <p><a name="6.3.1.7p2" href="#6.3.1.7p2"><small>2</small></a>
3401  When a value of complex type is converted to a real type, the imaginary part of the
3402  complex value is discarded and the value of the real part is converted according to the
3403  conversion rules for the corresponding real type.
3404
3405 <p><small><a href="#Contents">Contents</a></small>
3406 <h5><a name="6.3.1.8" href="#6.3.1.8">6.3.1.8 Usual arithmetic conversions</a></h5>
3407 <p><a name="6.3.1.8p1" href="#6.3.1.8p1"><small>1</small></a>
3408  Many operators that expect operands of arithmetic type cause conversions and yield result
3409  types in a similar way. The purpose is to determine a common real type for the operands
3410  and result. For the specified operands, each operand is converted, without change of type
3411  domain, to a type whose corresponding real type is the common real type. Unless
3412  explicitly stated otherwise, the common real type is also the corresponding real type of
3413  the result, whose type domain is the type domain of the operands if they are the same,
3414  and complex otherwise. This pattern is called the usual arithmetic conversions:
3415 <!--page 71 -->
3416 <pre>
3417        First, if the corresponding real type of either operand is long double, the other
3418        operand is converted, without change of type domain, to a type whose
3419         corresponding real type is long double.
3420         Otherwise, if the corresponding real type of either operand is double, the other
3421         operand is converted, without change of type domain, to a type whose
3422         corresponding real type is double.
3423         Otherwise, if the corresponding real type of either operand is float, the other
3424         operand is converted, without change of type domain, to a type whose
3425         corresponding real type is float.<sup><a href="#note62"><b>62)</b></a></sup>
3426         Otherwise, the integer promotions are performed on both operands. Then the
3427         following rules are applied to the promoted operands:
3428                If both operands have the same type, then no further conversion is needed.
3429                Otherwise, if both operands have signed integer types or both have unsigned
3430                integer types, the operand with the type of lesser integer conversion rank is
3431                converted to the type of the operand with greater rank.
3432                Otherwise, if the operand that has unsigned integer type has rank greater or
3433                equal to the rank of the type of the other operand, then the operand with
3434                signed integer type is converted to the type of the operand with unsigned
3435                integer type.
3436                Otherwise, if the type of the operand with signed integer type can represent
3437                all of the values of the type of the operand with unsigned integer type, then
3438                the operand with unsigned integer type is converted to the type of the
3439                operand with signed integer type.
3440                Otherwise, both operands are converted to the unsigned integer type
3441                corresponding to the type of the operand with signed integer type.
3442 </pre>
3443 <p><a name="6.3.1.8p2" href="#6.3.1.8p2"><small>2</small></a>
3444  The values of floating operands and of the results of floating expressions may be
3445  represented in greater range and precision than that required by the type; the types are not
3446  changed thereby.<sup><a href="#note63"><b>63)</b></a></sup>
3447  
3448  
3449  
3450  
3451 <!--page 72 -->
3452
3453 <p><b>Footnotes</b>
3454 <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
3455  float operand to double (and yields a double _Complex result).
3456 </small>
3457 <p><small><a name="note63" href="#note63">63)</a> The cast and assignment operators are still required to remove extra range and precision.
3458 </small>
3459
3460 <p><small><a href="#Contents">Contents</a></small>
3461 <h4><a name="6.3.2" href="#6.3.2">6.3.2 Other operands</a></h4>
3462
3463 <p><small><a href="#Contents">Contents</a></small>
3464 <h5><a name="6.3.2.1" href="#6.3.2.1">6.3.2.1 Lvalues, arrays, and function designators</a></h5>
3465 <p><a name="6.3.2.1p1" href="#6.3.2.1p1"><small>1</small></a>
3466  An lvalue is an expression (with an object type other than void) that potentially
3467  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
3468  behavior is undefined. When an object is said to have a particular type, the type is
3469  specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that
3470  does not have array type, does not have an incomplete type, does not have a const-
3471  qualified type, and if it is a structure or union, does not have any member (including,
3472  recursively, any member or element of all contained aggregates or unions) with a const-
3473  qualified type.
3474 <p><a name="6.3.2.1p2" href="#6.3.2.1p2"><small>2</small></a>
3475  Except when it is the operand of the sizeof operator, the _Alignof operator, the
3476  unary &amp; operator, the ++ operator, the -- operator, or the left operand of the . operator
3477  or an assignment operator, an lvalue that does not have array type is converted to the
3478  value stored in the designated object (and is no longer an lvalue); this is called lvalue
3479  conversion. If the lvalue has qualified type, the value has the unqualified version of the
3480  type of the lvalue; additionally, if the lvalue has atomic type, the value has the non-atomic
3481  version of the type of the lvalue; otherwise, the value has the type of the lvalue. If the
3482  lvalue has an incomplete type and does not have array type, the behavior is undefined. If
3483  the lvalue designates an object of automatic storage duration that could have been
3484  declared with the register storage class (never had its address taken), and that object
3485  is uninitialized (not declared with an initializer and no assignment to it has been
3486  performed prior to use), the behavior is undefined.
3487 <p><a name="6.3.2.1p3" href="#6.3.2.1p3"><small>3</small></a>
3488  Except when it is the operand of the sizeof operator, the _Alignof operator, or the
3489  unary &amp; operator, or is a string literal used to initialize an array, an expression that has
3490  type ''array of type'' is converted to an expression with type ''pointer to type'' that points
3491  to the initial element of the array object and is not an lvalue. If the array object has
3492  register storage class, the behavior is undefined.
3493 <p><a name="6.3.2.1p4" href="#6.3.2.1p4"><small>4</small></a>
3494  A function designator is an expression that has function type. Except when it is the
3495  operand of the sizeof operator, the _Alignof operator,<sup><a href="#note65"><b>65)</b></a></sup> or the unary &amp; operator, a
3496  function designator with type ''function returning type'' is converted to an expression that
3497  
3498  
3499 <!--page 73 -->
3500  has type ''pointer to function returning type''.
3501 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
3502  (<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
3503  increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
3504  (<a href="#6.5.3.1">6.5.3.1</a>), the sizeof and _Alignof operators (<a href="#6.5.3.4">6.5.3.4</a>), structure and union members
3505  (<a href="#6.5.2.3">6.5.2.3</a>).
3506
3507 <p><b>Footnotes</b>
3508 <p><small><a name="note64" href="#note64">64)</a> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
3509  operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
3510  object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
3511  as the ''value of an expression''.
3512   An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
3513   expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
3514 </small>
3515 <p><small><a name="note65" href="#note65">65)</a> Because this conversion does not occur, the operand of the sizeof or _Alignof operator remains
3516  a function designator and violates the constraints in <a href="#6.5.3.4">6.5.3.4</a>.
3517 </small>
3518
3519 <p><small><a href="#Contents">Contents</a></small>
3520 <h5><a name="6.3.2.2" href="#6.3.2.2">6.3.2.2 void</a></h5>
3521 <p><a name="6.3.2.2p1" href="#6.3.2.2p1"><small>1</small></a>
3522  The (nonexistent) value of a void expression (an expression that has type void) shall not
3523  be used in any way, and implicit or explicit conversions (except to void) shall not be
3524  applied to such an expression. If an expression of any other type is evaluated as a void
3525  expression, its value or designator is discarded. (A void expression is evaluated for its
3526  side effects.)
3527
3528 <p><small><a href="#Contents">Contents</a></small>
3529 <h5><a name="6.3.2.3" href="#6.3.2.3">6.3.2.3 Pointers</a></h5>
3530 <p><a name="6.3.2.3p1" href="#6.3.2.3p1"><small>1</small></a>
3531  A pointer to void may be converted to or from a pointer to any object type. A pointer to
3532  any object type may be converted to a pointer to void and back again; the result shall
3533  compare equal to the original pointer.
3534 <p><a name="6.3.2.3p2" href="#6.3.2.3p2"><small>2</small></a>
3535  For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
3536  the q-qualified version of the type; the values stored in the original and converted pointers
3537  shall compare equal.
3538 <p><a name="6.3.2.3p3" href="#6.3.2.3p3"><small>3</small></a>
3539  An integer constant expression with the value 0, or such an expression cast to type
3540  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
3541  pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
3542  to a pointer to any object or function.
3543 <p><a name="6.3.2.3p4" href="#6.3.2.3p4"><small>4</small></a>
3544  Conversion of a null pointer to another pointer type yields a null pointer of that type.
3545  Any two null pointers shall compare equal.
3546 <p><a name="6.3.2.3p5" href="#6.3.2.3p5"><small>5</small></a>
3547  An integer may be converted to any pointer type. Except as previously specified, the
3548  result is implementation-defined, might not be correctly aligned, might not point to an
3549  entity of the referenced type, and might be a trap representation.<sup><a href="#note67"><b>67)</b></a></sup>
3550 <p><a name="6.3.2.3p6" href="#6.3.2.3p6"><small>6</small></a>
3551  Any pointer type may be converted to an integer type. Except as previously specified, the
3552  result is implementation-defined. If the result cannot be represented in the integer type,
3553  the behavior is undefined. The result need not be in the range of values of any integer
3554  type.
3555  
3556  
3557 <!--page 74 -->
3558 <p><a name="6.3.2.3p7" href="#6.3.2.3p7"><small>7</small></a>
3559  A pointer to an object type may be converted to a pointer to a different object type. If the
3560  resulting pointer is not correctly aligned<sup><a href="#note68"><b>68)</b></a></sup> for the referenced type, the behavior is
3561  undefined. Otherwise, when converted back again, the result shall compare equal to the
3562  original pointer. When a pointer to an object is converted to a pointer to a character type,
3563  the result points to the lowest addressed byte of the object. Successive increments of the
3564  result, up to the size of the object, yield pointers to the remaining bytes of the object.
3565 <p><a name="6.3.2.3p8" href="#6.3.2.3p8"><small>8</small></a>
3566  A pointer to a function of one type may be converted to a pointer to a function of another
3567  type and back again; the result shall compare equal to the original pointer. If a converted
3568  pointer is used to call a function whose type is not compatible with the referenced type,
3569  the behavior is undefined.
3570 <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
3571  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>).
3572  
3573  
3574  
3575  
3576 <!--page 75 -->
3577
3578 <p><b>Footnotes</b>
3579 <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>.
3580 </small>
3581 <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
3582  be consistent with the addressing structure of the execution environment.
3583 </small>
3584 <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
3585  pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
3586  correctly aligned for a pointer to type C.
3587 </small>
3588
3589 <p><small><a href="#Contents">Contents</a></small>
3590 <h3><a name="6.4" href="#6.4">6.4 Lexical elements</a></h3>
3591 <p><b>Syntax</b>
3592 <p><a name="6.4p1" href="#6.4p1"><small>1</small></a>
3593 <pre>
3594           token:
3595                    keyword
3596                    identifier
3597                    constant
3598                    string-literal
3599                    punctuator
3600           preprocessing-token:
3601                  header-name
3602                  identifier
3603                  pp-number
3604                  character-constant
3605                  string-literal
3606                  punctuator
3607                  each non-white-space character that cannot be one of the above
3608 </pre>
3609 <p><b>Constraints</b>
3610 <p><a name="6.4p2" href="#6.4p2"><small>2</small></a>
3611  Each preprocessing token that is converted to a token shall have the lexical form of a
3612  keyword, an identifier, a constant, a string literal, or a punctuator.
3613 <p><b>Semantics</b>
3614 <p><a name="6.4p3" href="#6.4p3"><small>3</small></a>
3615  A token is the minimal lexical element of the language in translation phases 7 and 8. The
3616  categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
3617  A preprocessing token is the minimal lexical element of the language in translation
3618  phases 3 through 6. The categories of preprocessing tokens are: header names,
3619  identifiers, preprocessing numbers, character constants, string literals, punctuators, and
3620  single non-white-space characters that do not lexically match the other preprocessing
3621  token categories.<sup><a href="#note69"><b>69)</b></a></sup> If a ' or a " character matches the last category, the behavior is
3622  undefined. Preprocessing tokens can be separated by white space; this consists of
3623  comments (described later), or white-space characters (space, horizontal tab, new-line,
3624  vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
3625  during translation phase 4, white space (or the absence thereof) serves as more than
3626  preprocessing token separation. White space may appear within a preprocessing token
3627  only as part of a header name or between the quotation characters in a character constant
3628  or string literal.
3629  
3630  
3631  
3632 <!--page 76 -->
3633 <p><a name="6.4p4" href="#6.4p4"><small>4</small></a>
3634  If the input stream has been parsed into preprocessing tokens up to a given character, the
3635  next preprocessing token is the longest sequence of characters that could constitute a
3636  preprocessing token. There is one exception to this rule: header name preprocessing
3637  tokens are recognized only within #include preprocessing directives and in
3638  implementation-defined locations within #pragma directives. In such contexts, a
3639  sequence of characters that could be either a header name or a string literal is recognized
3640  as the former.
3641 <p><a name="6.4p5" href="#6.4p5"><small>5</small></a>
3642  EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
3643  valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
3644  might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
3645  fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
3646  not E is a macro name.
3647  
3648 <p><a name="6.4p6" href="#6.4p6"><small>6</small></a>
3649  EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
3650  increment operators, even though the parse x ++ + ++ y might yield a correct expression.
3651  
3652 <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>),
3653  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
3654  increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
3655  (<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
3656  (<a href="#6.4.5">6.4.5</a>).
3657
3658 <p><b>Footnotes</b>
3659 <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
3660  occur in source files.
3661 </small>
3662
3663 <p><small><a href="#Contents">Contents</a></small>
3664 <h4><a name="6.4.1" href="#6.4.1">6.4.1 Keywords</a></h4>
3665 <p><b>Syntax</b>
3666 <p><a name="6.4.1p1" href="#6.4.1p1"><small>1</small></a>
3667 <pre>
3668           keyword: one of
3669                 auto                        * if                             unsigned
3670                 break                         inline                         void
3671                 case                          int                            volatile
3672                 char                          long                           while
3673                 const                         register                       _Alignas
3674                 continue                      restrict                       _Alignof
3675                 default                       return                         _Atomic
3676                 do                            short                          _Bool
3677                 double                        signed                         _Complex
3678                 else                          sizeof                         _Generic
3679                 enum                          static                         _Imaginary
3680                 extern                        struct                         _Noreturn
3681                 float                         switch                         _Static_assert
3682                 for                           typedef                        _Thread_local
3683                 goto                          union
3684 </pre>
3685 <p><b>Semantics</b>
3686 <p><a name="6.4.1p2" href="#6.4.1p2"><small>2</small></a>
3687  The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
3688  keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
3689 <!--page 77 -->
3690  specifying imaginary types.<sup><a href="#note70"><b>70)</b></a></sup>
3691
3692 <p><b>Footnotes</b>
3693 <p><small><a name="note70" href="#note70">70)</a> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
3694 </small>
3695
3696 <p><small><a href="#Contents">Contents</a></small>
3697 <h4><a name="6.4.2" href="#6.4.2">6.4.2 Identifiers</a></h4>
3698
3699 <p><small><a href="#Contents">Contents</a></small>
3700 <h5><a name="6.4.2.1" href="#6.4.2.1">6.4.2.1 General</a></h5>
3701 <p><b>Syntax</b>
3702 <p><a name="6.4.2.1p1" href="#6.4.2.1p1"><small>1</small></a>
3703 <pre>
3704           identifier:
3705                  identifier-nondigit
3706                  identifier identifier-nondigit
3707                  identifier digit
3708           identifier-nondigit:
3709                  nondigit
3710                  universal-character-name
3711                  other implementation-defined characters
3712           nondigit: one of
3713                  _ a b            c    d    e    f     g    h    i    j     k    l    m
3714                      n o          p    q    r    s     t    u    v    w     x    y    z
3715                      A B          C    D    E    F     G    H    I    J     K    L    M
3716                      N O          P    Q    R    S     T    U    V    W     X    Y    Z
3717           digit: one of
3718                  0 1        2     3    4    5    6     7    8    9
3719 </pre>
3720 <p><b>Semantics</b>
3721 <p><a name="6.4.2.1p2" href="#6.4.2.1p2"><small>2</small></a>
3722  An identifier is a sequence of nondigit characters (including the underscore _, the
3723  lowercase and uppercase Latin letters, and other characters) and digits, which designates
3724  one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
3725  There is no specific limit on the maximum length of an identifier.
3726 <p><a name="6.4.2.1p3" href="#6.4.2.1p3"><small>3</small></a>
3727  Each universal character name in an identifier shall designate a character whose encoding
3728  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
3729  shall not be a universal character name designating a character whose encoding falls into
3730  one of the ranges specified in <a href="#D.2">D.2</a>. An implementation may allow multibyte characters
3731  that are not part of the basic source character set to appear in identifiers; which characters
3732  and their correspondence to universal character names is implementation-defined.
3733  
3734  
3735  
3736 <!--page 78 -->
3737 <p><a name="6.4.2.1p4" href="#6.4.2.1p4"><small>4</small></a>
3738  When preprocessing tokens are converted to tokens during translation phase 7, if a
3739  preprocessing token could be converted to either a keyword or an identifier, it is converted
3740  to a keyword.
3741 <p><b>Implementation limits</b>
3742 <p><a name="6.4.2.1p5" href="#6.4.2.1p5"><small>5</small></a>
3743  As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
3744  characters in an identifier; the limit for an external name (an identifier that has external
3745  linkage) may be more restrictive than that for an internal name (a macro name or an
3746  identifier that does not have external linkage). The number of significant characters in an
3747  identifier is implementation-defined.
3748 <p><a name="6.4.2.1p6" href="#6.4.2.1p6"><small>6</small></a>
3749  Any identifiers that differ in a significant character are different identifiers. If two
3750  identifiers differ only in nonsignificant characters, the behavior is undefined.
3751 <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>).
3752
3753 <p><b>Footnotes</b>
3754 <p><small><a name="note71" href="#note71">71)</a> On systems in which linkers cannot accept extended characters, an encoding of the universal character
3755  name may be used in forming valid external identifiers. For example, some otherwise unused
3756  character or sequence of characters may be used to encode the \u in a universal character name.
3757  Extended characters may produce a long external identifier.
3758 </small>
3759
3760 <p><small><a href="#Contents">Contents</a></small>
3761 <h5><a name="6.4.2.2" href="#6.4.2.2">6.4.2.2 Predefined identifiers</a></h5>
3762 <p><b>Semantics</b>
3763 <p><a name="6.4.2.2p1" href="#6.4.2.2p1"><small>1</small></a>
3764  The identifier __func__ shall be implicitly declared by the translator as if,
3765  immediately following the opening brace of each function definition, the declaration
3766 <pre>
3767           static const char __func__[] = "function-name";
3768 </pre>
3769  appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note72"><b>72)</b></a></sup>
3770 <p><a name="6.4.2.2p2" href="#6.4.2.2p2"><small>2</small></a>
3771  This name is encoded as if the implicit declaration had been written in the source
3772  character set and then translated into the execution character set as indicated in translation
3773  phase 5.
3774 <p><a name="6.4.2.2p3" href="#6.4.2.2p3"><small>3</small></a>
3775  EXAMPLE        Consider the code fragment:
3776 <pre>
3777           #include <a href="#7.21">&lt;stdio.h&gt;</a>
3778           void myfunc(void)
3779           {
3780                 printf("%s\n", __func__);
3781                 /* ... */
3782           }
3783 </pre>
3784  Each time the function is called, it will print to the standard output stream:
3785 <pre>
3786           myfunc
3787 </pre>
3788  
3789 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
3790  
3791  
3792  
3793  
3794 <!--page 79 -->
3795
3796 <p><b>Footnotes</b>
3797 <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
3798  identifier is explicitly declared using the name __func__, the behavior is undefined.
3799 </small>
3800
3801 <p><small><a href="#Contents">Contents</a></small>
3802 <h4><a name="6.4.3" href="#6.4.3">6.4.3 Universal character names</a></h4>
3803 <p><b>Syntax</b>
3804 <p><a name="6.4.3p1" href="#6.4.3p1"><small>1</small></a>
3805 <pre>
3806           universal-character-name:
3807                  \u hex-quad
3808                  \U hex-quad hex-quad
3809           hex-quad:
3810                  hexadecimal-digit hexadecimal-digit
3811                               hexadecimal-digit hexadecimal-digit
3812 </pre>
3813 <p><b>Constraints</b>
3814 <p><a name="6.4.3p2" href="#6.4.3p2"><small>2</small></a>
3815  A universal character name shall not specify a character whose short identifier is less than
3816  00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
3817  DFFF inclusive.<sup><a href="#note73"><b>73)</b></a></sup>
3818 <p><b>Description</b>
3819 <p><a name="6.4.3p3" href="#6.4.3p3"><small>3</small></a>
3820  Universal character names may be used in identifiers, character constants, and string
3821  literals to designate characters that are not in the basic character set.
3822 <p><b>Semantics</b>
3823 <p><a name="6.4.3p4" href="#6.4.3p4"><small>4</small></a>
3824  The universal character name \Unnnnnnnn designates the character whose eight-digit
3825  short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note74"><b>74)</b></a></sup> Similarly, the universal
3826  character name \unnnn designates the character whose four-digit short identifier is nnnn
3827  (and whose eight-digit short identifier is 0000nnnn).
3828  
3829  
3830  
3831  
3832 <!--page 80 -->
3833
3834 <p><b>Footnotes</b>
3835 <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
3836  by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
3837  UTF-16).
3838  
3839 </small>
3840 <p><small><a name="note74" href="#note74">74)</a> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
3841 </small>
3842
3843 <p><small><a href="#Contents">Contents</a></small>
3844 <h4><a name="6.4.4" href="#6.4.4">6.4.4 Constants</a></h4>
3845 <p><b>Syntax</b>
3846 <p><a name="6.4.4p1" href="#6.4.4p1"><small>1</small></a>
3847 <pre>
3848           constant:
3849                  integer-constant
3850                  floating-constant
3851                  enumeration-constant
3852                  character-constant
3853 </pre>
3854 <p><b>Constraints</b>
3855 <p><a name="6.4.4p2" href="#6.4.4p2"><small>2</small></a>
3856  Each constant shall have a type and the value of a constant shall be in the range of
3857  representable values for its type.
3858 <p><b>Semantics</b>
3859 <p><a name="6.4.4p3" href="#6.4.4p3"><small>3</small></a>
3860  Each constant has a type, determined by its form and value, as detailed later.
3861
3862 <p><small><a href="#Contents">Contents</a></small>
3863 <h5><a name="6.4.4.1" href="#6.4.4.1">6.4.4.1 Integer constants</a></h5>
3864 <p><b>Syntax</b>
3865 <p><a name="6.4.4.1p1" href="#6.4.4.1p1"><small>1</small></a>
3866 <!--page 81 -->
3867 <pre>
3868           integer-constant:
3869                   decimal-constant integer-suffix<sub>opt</sub>
3870                   octal-constant integer-suffix<sub>opt</sub>
3871                   hexadecimal-constant integer-suffix<sub>opt</sub>
3872           decimal-constant:
3873                 nonzero-digit
3874                 decimal-constant digit
3875           octal-constant:
3876                  0
3877                  octal-constant octal-digit
3878           hexadecimal-constant:
3879                 hexadecimal-prefix hexadecimal-digit
3880                 hexadecimal-constant hexadecimal-digit
3881           hexadecimal-prefix: one of
3882                 0x 0X
3883           nonzero-digit: one of
3884                  1 2 3 4          5     6     7   8    9
3885           octal-digit: one of
3886                   0 1 2 3         4     5     6   7
3887          hexadecimal-digit:   one of
3888                0 1 2           3 4     5    6   7     8   9
3889                a b c           d e     f
3890                A B C           D E     F
3891          integer-suffix:
3892                  unsigned-suffix long-suffix<sub>opt</sub>
3893                  unsigned-suffix long-long-suffix
3894                  long-suffix unsigned-suffix<sub>opt</sub>
3895                  long-long-suffix unsigned-suffix<sub>opt</sub>
3896          unsigned-suffix: one of
3897                 u U
3898          long-suffix: one of
3899                 l L
3900          long-long-suffix: one of
3901                 ll LL
3902 </pre>
3903 <p><b>Description</b>
3904 <p><a name="6.4.4.1p2" href="#6.4.4.1p2"><small>2</small></a>
3905  An integer constant begins with a digit, but has no period or exponent part. It may have a
3906  prefix that specifies its base and a suffix that specifies its type.
3907 <p><a name="6.4.4.1p3" href="#6.4.4.1p3"><small>3</small></a>
3908  A decimal constant begins with a nonzero digit and consists of a sequence of decimal
3909  digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
3910  digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
3911  by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
3912  10 through 15 respectively.
3913 <p><b>Semantics</b>
3914 <p><a name="6.4.4.1p4" href="#6.4.4.1p4"><small>4</small></a>
3915  The value of a decimal constant is computed base 10; that of an octal constant, base 8;
3916  that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
3917 <p><a name="6.4.4.1p5" href="#6.4.4.1p5"><small>5</small></a>
3918  The type of an integer constant is the first of the corresponding list in which its value can
3919  be represented.
3920 <!--page 82 -->
3921 <pre>
3922                                                                   Octal or Hexadecimal
3923 </pre>
3924  Suffix                       Decimal Constant                           Constant
3925  
3926  none                int                                    int
3927 <pre>
3928                      long int                               unsigned int
3929                      long long int                          long int
3930                                                             unsigned long int
3931                                                             long long int
3932                                                             unsigned long long int
3933 </pre>
3934  
3935  u or U              unsigned int                           unsigned int
3936 <pre>
3937                      unsigned long int                      unsigned long int
3938                      unsigned long long int                 unsigned long long int
3939 </pre>
3940  
3941  l or L              long int                               long int
3942 <pre>
3943                      long long int                          unsigned long int
3944                                                             long long int
3945                                                             unsigned long long int
3946 </pre>
3947  
3948  Both u or U         unsigned long int                      unsigned long int
3949  and l or L          unsigned long long int                 unsigned long long int
3950  
3951  ll or LL            long long int                          long long int
3952 <pre>
3953                                                             unsigned long long int
3954 </pre>
3955  
3956  Both u or U         unsigned long long int                 unsigned long long int
3957  and ll or LL
3958 <p><a name="6.4.4.1p6" href="#6.4.4.1p6"><small>6</small></a>
3959  If an integer constant cannot be represented by any type in its list, it may have an
3960  extended integer type, if the extended integer type can represent its value. If all of the
3961  types in the list for the constant are signed, the extended integer type shall be signed. If
3962  all of the types in the list for the constant are unsigned, the extended integer type shall be
3963  unsigned. If the list contains both signed and unsigned types, the extended integer type
3964  may be signed or unsigned. If an integer constant cannot be represented by any type in
3965  its list and has no extended integer type, then the integer constant has no type.
3966 <!--page 83 -->
3967
3968 <p><small><a href="#Contents">Contents</a></small>
3969 <h5><a name="6.4.4.2" href="#6.4.4.2">6.4.4.2 Floating constants</a></h5>
3970 <p><b>Syntax</b>
3971 <p><a name="6.4.4.2p1" href="#6.4.4.2p1"><small>1</small></a>
3972 <!--page 84 -->
3973 <pre>
3974           floating-constant:
3975                  decimal-floating-constant
3976                  hexadecimal-floating-constant
3977           decimal-floating-constant:
3978                 fractional-constant exponent-part<sub>opt</sub> floating-suffix<sub>opt</sub>
3979                 digit-sequence exponent-part floating-suffix<sub>opt</sub>
3980           hexadecimal-floating-constant:
3981                 hexadecimal-prefix hexadecimal-fractional-constant
3982                                binary-exponent-part floating-suffix<sub>opt</sub>
3983                 hexadecimal-prefix hexadecimal-digit-sequence
3984                                binary-exponent-part floating-suffix<sub>opt</sub>
3985           fractional-constant:
3986                   digit-sequence<sub>opt</sub> . digit-sequence
3987                   digit-sequence .
3988           exponent-part:
3989                 e sign<sub>opt</sub> digit-sequence
3990                 E sign<sub>opt</sub> digit-sequence
3991           sign: one of
3992                  + -
3993           digit-sequence:
3994                   digit
3995                   digit-sequence digit
3996           hexadecimal-fractional-constant:
3997                 hexadecimal-digit-sequence<sub>opt</sub> .
3998                                hexadecimal-digit-sequence
3999                 hexadecimal-digit-sequence .
4000           binary-exponent-part:
4001                  p sign<sub>opt</sub> digit-sequence
4002                  P sign<sub>opt</sub> digit-sequence
4003           hexadecimal-digit-sequence:
4004                 hexadecimal-digit
4005                 hexadecimal-digit-sequence hexadecimal-digit
4006           floating-suffix: one of
4007                  f l F L
4008 </pre>
4009 <p><b>Description</b>
4010 <p><a name="6.4.4.2p2" href="#6.4.4.2p2"><small>2</small></a>
4011  A floating constant has a significand part that may be followed by an exponent part and a
4012  suffix that specifies its type. The components of the significand part may include a digit
4013  sequence representing the whole-number part, followed by a period (.), followed by a
4014  digit sequence representing the fraction part. The components of the exponent part are an
4015  e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
4016  Either the whole-number part or the fraction part has to be present; for decimal floating
4017  constants, either the period or the exponent part has to be present.
4018 <p><b>Semantics</b>
4019 <p><a name="6.4.4.2p3" href="#6.4.4.2p3"><small>3</small></a>
4020  The significand part is interpreted as a (decimal or hexadecimal) rational number; the
4021  digit sequence in the exponent part is interpreted as a decimal integer. For decimal
4022  floating constants, the exponent indicates the power of 10 by which the significand part is
4023  to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
4024  by which the significand part is to be scaled. For decimal floating constants, and also for
4025  hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
4026  the nearest representable value, or the larger or smaller representable value immediately
4027  adjacent to the nearest representable value, chosen in an implementation-defined manner.
4028  For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
4029  correctly rounded.
4030 <p><a name="6.4.4.2p4" href="#6.4.4.2p4"><small>4</small></a>
4031  An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
4032  type float. If suffixed by the letter l or L, it has type long double.
4033 <p><a name="6.4.4.2p5" href="#6.4.4.2p5"><small>5</small></a>
4034  Floating constants are converted to internal format as if at translation-time. The
4035  conversion of a floating constant shall not raise an exceptional condition or a floating-
4036  point exception at execution time. All floating constants of the same source form<sup><a href="#note75"><b>75)</b></a></sup> shall
4037  convert to the same internal format with the same value.
4038 <p><b>Recommended practice</b>
4039 <p><a name="6.4.4.2p6" href="#6.4.4.2p6"><small>6</small></a>
4040  The implementation should produce a diagnostic message if a hexadecimal constant
4041  cannot be represented exactly in its evaluation format; the implementation should then
4042  proceed with the translation of the program.
4043 <p><a name="6.4.4.2p7" href="#6.4.4.2p7"><small>7</small></a>
4044  The translation-time conversion of floating constants should match the execution-time
4045  conversion of character strings by library functions, such as strtod, given matching
4046  inputs suitable for both conversions, the same result format, and default execution-time
4047  rounding.<sup><a href="#note76"><b>76)</b></a></sup>
4048  
4049 <!--page 85 -->
4050
4051 <p><b>Footnotes</b>
4052 <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
4053  convert to the same internal format and value.
4054 </small>
4055 <p><small><a name="note76" href="#note76">76)</a> The specification for the library functions recommends more accurate conversion than required for
4056  floating constants (see <a href="#7.22.1.3">7.22.1.3</a>).
4057 </small>
4058
4059 <p><small><a href="#Contents">Contents</a></small>
4060 <h5><a name="6.4.4.3" href="#6.4.4.3">6.4.4.3 Enumeration constants</a></h5>
4061 <p><b>Syntax</b>
4062 <p><a name="6.4.4.3p1" href="#6.4.4.3p1"><small>1</small></a>
4063 <pre>
4064           enumeration-constant:
4065                 identifier
4066 </pre>
4067 <p><b>Semantics</b>
4068 <p><a name="6.4.4.3p2" href="#6.4.4.3p2"><small>2</small></a>
4069  An identifier declared as an enumeration constant has type int.
4070 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
4071
4072 <p><small><a href="#Contents">Contents</a></small>
4073 <h5><a name="6.4.4.4" href="#6.4.4.4">6.4.4.4 Character constants</a></h5>
4074 <p><b>Syntax</b>
4075 <p><a name="6.4.4.4p1" href="#6.4.4.4p1"><small>1</small></a>
4076 <!--page 86 -->
4077 <pre>
4078           character-constant:
4079                  ' c-char-sequence '
4080                  L' c-char-sequence '
4081                  u' c-char-sequence '
4082                  U' c-char-sequence '
4083           c-char-sequence:
4084                  c-char
4085                  c-char-sequence c-char
4086           c-char:
4087                     any member of the source character set except
4088                                  the single-quote ', backslash \, or new-line character
4089                     escape-sequence
4090           escape-sequence:
4091                  simple-escape-sequence
4092                  octal-escape-sequence
4093                  hexadecimal-escape-sequence
4094                  universal-character-name
4095           simple-escape-sequence: one of
4096                  \' \" \? \\
4097                  \a \b \f \n \r                  \t    \v
4098           octal-escape-sequence:
4099                   \ octal-digit
4100                   \ octal-digit octal-digit
4101                   \ octal-digit octal-digit octal-digit
4102         hexadecimal-escape-sequence:
4103               \x hexadecimal-digit
4104               hexadecimal-escape-sequence hexadecimal-digit
4105 </pre>
4106 <p><b>Description</b>
4107 <p><a name="6.4.4.4p2" href="#6.4.4.4p2"><small>2</small></a>
4108  An integer character constant is a sequence of one or more multibyte characters enclosed
4109  in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
4110  letter L, u, or U. With a few exceptions detailed later, the elements of the sequence are
4111  any members of the source character set; they are mapped in an implementation-defined
4112  manner to members of the execution character set.
4113 <p><a name="6.4.4.4p3" href="#6.4.4.4p3"><small>3</small></a>
4114  The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
4115  arbitrary integer values are representable according to the following table of escape
4116  sequences:
4117 <pre>
4118        single quote '            \'
4119        double quote "            \"
4120        question mark ?           \?
4121        backslash \               \\
4122        octal character           \octal digits
4123        hexadecimal character     \x hexadecimal digits
4124 </pre>
4125 <p><a name="6.4.4.4p4" href="#6.4.4.4p4"><small>4</small></a>
4126  The double-quote " and question-mark ? are representable either by themselves or by the
4127  escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
4128  shall be represented, respectively, by the escape sequences \' and \\.
4129 <p><a name="6.4.4.4p5" href="#6.4.4.4p5"><small>5</small></a>
4130  The octal digits that follow the backslash in an octal escape sequence are taken to be part
4131  of the construction of a single character for an integer character constant or of a single
4132  wide character for a wide character constant. The numerical value of the octal integer so
4133  formed specifies the value of the desired character or wide character.
4134 <p><a name="6.4.4.4p6" href="#6.4.4.4p6"><small>6</small></a>
4135  The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
4136  sequence are taken to be part of the construction of a single character for an integer
4137  character constant or of a single wide character for a wide character constant. The
4138  numerical value of the hexadecimal integer so formed specifies the value of the desired
4139  character or wide character.
4140 <p><a name="6.4.4.4p7" href="#6.4.4.4p7"><small>7</small></a>
4141  Each octal or hexadecimal escape sequence is the longest sequence of characters that can
4142  constitute the escape sequence.
4143 <p><a name="6.4.4.4p8" href="#6.4.4.4p8"><small>8</small></a>
4144  In addition, characters not in the basic character set are representable by universal
4145  character names and certain nongraphic characters are representable by escape sequences
4146  consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
4147  and \v.<sup><a href="#note77"><b>77)</b></a></sup>
4148 <!--page 87 -->
4149 <p><b>Constraints</b>
4150 <p><a name="6.4.4.4p9" href="#6.4.4.4p9"><small>9</small></a>
4151  The value of an octal or hexadecimal escape sequence shall be in the range of
4152  representable values for the corresponding type:
4153 <pre>
4154         Prefix      Corresponding Type
4155         none       unsigned char
4156         L          the unsigned type corresponding to wchar_t
4157         u          char16_t
4158         U          char32_t
4159 </pre>
4160 <p><b>Semantics</b>
4161 <p><a name="6.4.4.4p10" href="#6.4.4.4p10"><small>10</small></a>
4162  An integer character constant has type int. The value of an integer character constant
4163  containing a single character that maps to a single-byte execution character is the
4164  numerical value of the representation of the mapped character interpreted as an integer.
4165  The value of an integer character constant containing more than one character (e.g.,
4166  'ab'), or containing a character or escape sequence that does not map to a single-byte
4167  execution character, is implementation-defined. If an integer character constant contains
4168  a single character or escape sequence, its value is the one that results when an object with
4169  type char whose value is that of the single character or escape sequence is converted to
4170  type int.
4171 <p><a name="6.4.4.4p11" href="#6.4.4.4p11"><small>11</small></a>
4172  A wide character constant prefixed by the letter L has type wchar_t, an integer type
4173  defined in the <a href="#7.19">&lt;stddef.h&gt;</a> header; a wide character constant prefixed by the letter u or
4174  U has type char16_t or char32_t, respectively, unsigned integer types defined in the
4175  <a href="#7.28">&lt;uchar.h&gt;</a> header. The value of a wide character constant containing a single
4176  multibyte character that maps to a single member of the extended execution character set
4177  is the wide character corresponding to that multibyte character, as defined by the
4178  mbtowc, mbrtoc16, or mbrtoc32 function as appropriate for its type, with an
4179  implementation-defined current locale. The value of a wide character constant containing
4180  more than one multibyte character or a single multibyte character that maps to multiple
4181  members of the extended execution character set, or containing a multibyte character or
4182  escape sequence not represented in the extended execution character set, is
4183  implementation-defined.
4184 <p><a name="6.4.4.4p12" href="#6.4.4.4p12"><small>12</small></a>
4185  EXAMPLE 1      The construction '\0' is commonly used to represent the null character.
4186  
4187 <p><a name="6.4.4.4p13" href="#6.4.4.4p13"><small>13</small></a>
4188  EXAMPLE 2 Consider implementations that use two's complement representation for integers and eight
4189  bits for objects that have type char. In an implementation in which type char has the same range of
4190  values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
4191  same range of values as unsigned char, the character constant '\xFF' has the value +255.
4192  
4193  
4194  
4195  
4196 <!--page 88 -->
4197 <p><a name="6.4.4.4p14" href="#6.4.4.4p14"><small>14</small></a>
4198  EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
4199  specifies an integer character constant containing only one character, since a hexadecimal escape sequence
4200  is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
4201  two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
4202  escape sequence is terminated after three octal digits. (The value of this two-character integer character
4203  constant is implementation-defined.)
4204  
4205 <p><a name="6.4.4.4p15" href="#6.4.4.4p15"><small>15</small></a>
4206  EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
4207  L'\1234' specifies the implementation-defined value that results from the combination of the values
4208  0123 and '4'.
4209  
4210 <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
4211  (<a href="#7.22.7.2">7.22.7.2</a>), Unicode utilities <a href="#7.28">&lt;uchar.h&gt;</a> (<a href="#7.28">7.28</a>).
4212
4213 <p><b>Footnotes</b>
4214 <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,
4215  the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
4216 </small>
4217
4218 <p><small><a href="#Contents">Contents</a></small>
4219 <h4><a name="6.4.5" href="#6.4.5">6.4.5 String literals</a></h4>
4220 <p><b>Syntax</b>
4221 <p><a name="6.4.5p1" href="#6.4.5p1"><small>1</small></a>
4222 <pre>
4223           string-literal:
4224                   encoding-prefix<sub>opt</sub> " s-char-sequence<sub>opt</sub> "
4225           encoding-prefix:
4226                  u8
4227                  u
4228                  U
4229                  L
4230           s-char-sequence:
4231                  s-char
4232                  s-char-sequence s-char
4233           s-char:
4234                     any member of the source character set except
4235                                  the double-quote ", backslash \, or new-line character
4236                     escape-sequence
4237 </pre>
4238 <p><b>Constraints</b>
4239 <p><a name="6.4.5p2" href="#6.4.5p2"><small>2</small></a>
4240  A sequence of adjacent string literal tokens shall not include both a wide string literal and
4241  a UTF-8 string literal.
4242 <p><b>Description</b>
4243 <p><a name="6.4.5p3" href="#6.4.5p3"><small>3</small></a>
4244  A character string literal is a sequence of zero or more multibyte characters enclosed in
4245  double-quotes, as in "xyz". A UTF-8 string literal is the same, except prefixed by u8.
4246  A wide string literal is the same, except prefixed by the letter L, u, or U.
4247 <p><a name="6.4.5p4" href="#6.4.5p4"><small>4</small></a>
4248  The same considerations apply to each element of the sequence in a string literal as if it
4249  were in an integer character constant (for a character or UTF-8 string literal) or a wide
4250  character constant (for a wide string literal), except that the single-quote ' is
4251  representable either by itself or by the escape sequence \', but the double-quote " shall
4252 <!--page 89 -->
4253  be represented by the escape sequence \".
4254 <p><b>Semantics</b>
4255 <p><a name="6.4.5p5" href="#6.4.5p5"><small>5</small></a>
4256  In translation phase 6, the multibyte character sequences specified by any sequence of
4257  adjacent character and identically-prefixed string literal tokens are concatenated into a
4258  single multibyte character sequence. If any of the tokens has an encoding prefix, the
4259  resulting multibyte character sequence is treated as having the same prefix; otherwise, it
4260  is treated as a character string literal. Whether differently-prefixed wide string literal
4261  tokens can be concatenated and, if so, the treatment of the resulting multibyte character
4262  sequence are implementation-defined.
4263 <p><a name="6.4.5p6" href="#6.4.5p6"><small>6</small></a>
4264  In translation phase 7, a byte or code of value zero is appended to each multibyte
4265  character sequence that results from a string literal or literals.<sup><a href="#note78"><b>78)</b></a></sup> The multibyte character
4266  sequence is then used to initialize an array of static storage duration and length just
4267  sufficient to contain the sequence. For character string literals, the array elements have
4268  type char, and are initialized with the individual bytes of the multibyte character
4269  sequence. For UTF-8 string literals, the array elements have type char, and are
4270  initialized with the characters of the multibyte character sequence, as encoded in UTF-8.
4271  For wide string literals prefixed by the letter L, the array elements have type wchar_t
4272  and are initialized with the sequence of wide characters corresponding to the multibyte
4273  character sequence, as defined by the mbstowcs function with an implementation-
4274  defined current locale. For wide string literals prefixed by the letter u or U, the array
4275  elements have type char16_t or char32_t, respectively, and are initialized with the
4276  sequence of wide characters corresponding to the multibyte character sequence, as
4277  defined by successive calls to the mbrtoc16, or mbrtoc32 function as appropriate for
4278  its type, with an implementation-defined current locale. The value of a string literal
4279  containing a multibyte character or escape sequence not represented in the execution
4280  character set is implementation-defined.
4281 <p><a name="6.4.5p7" href="#6.4.5p7"><small>7</small></a>
4282  It is unspecified whether these arrays are distinct provided their elements have the
4283  appropriate values. If the program attempts to modify such an array, the behavior is
4284  undefined.
4285 <p><a name="6.4.5p8" href="#6.4.5p8"><small>8</small></a>
4286  EXAMPLE 1      This pair of adjacent character string literals
4287 <pre>
4288           "\x12" "3"
4289 </pre>
4290  produces a single character string literal containing the two characters whose values are '\x12' and '3',
4291  because escape sequences are converted into single members of the execution character set just prior to
4292  adjacent string literal concatenation.
4293  
4294 <p><a name="6.4.5p9" href="#6.4.5p9"><small>9</small></a>
4295  EXAMPLE 2      Each of the sequences of adjacent string literal tokens
4296  
4297  
4298  
4299 <!--page 90 -->
4300 <pre>
4301           "a" "b" L"c"
4302           "a" L"b" "c"
4303           L"a" "b" L"c"
4304           L"a" L"b" L"c"
4305 </pre>
4306  is equivalent to the string literal
4307 <pre>
4308           L"abc"
4309 </pre>
4310  Likewise, each of the sequences
4311 <pre>
4312           "a" "b" u"c"
4313           "a" u"b" "c"
4314           u"a" "b" u"c"
4315           u"a" u"b" u"c"
4316 </pre>
4317  is equivalent to
4318 <pre>
4319           u"abc"
4320 </pre>
4321  
4322 <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
4323  function (<a href="#7.22.8.1">7.22.8.1</a>), Unicode utilities <a href="#7.28">&lt;uchar.h&gt;</a> (<a href="#7.28">7.28</a>).
4324
4325 <p><b>Footnotes</b>
4326 <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
4327  \0 escape sequence.
4328 </small>
4329
4330 <p><small><a href="#Contents">Contents</a></small>
4331 <h4><a name="6.4.6" href="#6.4.6">6.4.6 Punctuators</a></h4>
4332 <p><b>Syntax</b>
4333 <p><a name="6.4.6p1" href="#6.4.6p1"><small>1</small></a>
4334 <pre>
4335           punctuator: one of
4336                  [ ] ( ) { } . -&gt;
4337                  ++ -- &amp; * + - ~ !
4338                  / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;=                             ==       !=    ^    |   &amp;&amp;   ||
4339                  ? : ; ...
4340                  = *= /= %= += -= &lt;&lt;=                            &gt;&gt;=       &amp;=       ^=   |=
4341                  , # ##
4342                  &lt;: :&gt; &lt;% %&gt; %: %:%:
4343 </pre>
4344 <p><b>Semantics</b>
4345 <p><a name="6.4.6p2" href="#6.4.6p2"><small>2</small></a>
4346  A punctuator is a symbol that has independent syntactic and semantic significance.
4347  Depending on context, it may specify an operation to be performed (which in turn may
4348  yield a value or a function designator, produce a side effect, or some combination thereof)
4349  in which case it is known as an operator (other forms of operator also exist in some
4350  contexts). An operand is an entity on which an operator acts.
4351 <!--page 91 -->
4352 <p><a name="6.4.6p3" href="#6.4.6p3"><small>3</small></a>
4353  In all aspects of the language, the six tokens<sup><a href="#note79"><b>79)</b></a></sup>
4354 <pre>
4355           &lt;:    :&gt;      &lt;%    %&gt;     %:     %:%:
4356 </pre>
4357  behave, respectively, the same as the six tokens
4358 <pre>
4359           [     ]       {     }      #      ##
4360 </pre>
4361  except for their spelling.<sup><a href="#note80"><b>80)</b></a></sup>
4362 <p><b> Forward references</b>: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
4363  (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
4364
4365 <p><b>Footnotes</b>
4366 <p><small><a name="note79" href="#note79">79)</a> These tokens are sometimes called ''digraphs''.
4367 </small>
4368 <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
4369  interchanged.
4370 </small>
4371
4372 <p><small><a href="#Contents">Contents</a></small>
4373 <h4><a name="6.4.7" href="#6.4.7">6.4.7 Header names</a></h4>
4374 <p><b>Syntax</b>
4375 <p><a name="6.4.7p1" href="#6.4.7p1"><small>1</small></a>
4376 <pre>
4377           header-name:
4378                  &lt; h-char-sequence &gt;
4379                  " q-char-sequence "
4380           h-char-sequence:
4381                  h-char
4382                  h-char-sequence h-char
4383           h-char:
4384                     any member of the source character set except
4385                                  the new-line character and &gt;
4386           q-char-sequence:
4387                  q-char
4388                  q-char-sequence q-char
4389           q-char:
4390                     any member of the source character set except
4391                                  the new-line character and "
4392 </pre>
4393 <p><b>Semantics</b>
4394 <p><a name="6.4.7p2" href="#6.4.7p2"><small>2</small></a>
4395  The sequences in both forms of header names are mapped in an implementation-defined
4396  manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
4397 <p><a name="6.4.7p3" href="#6.4.7p3"><small>3</small></a>
4398  If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
4399  the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
4400  
4401  
4402  
4403  
4404 <!--page 92 -->
4405  sequence between the " delimiters, the behavior is undefined.<sup><a href="#note81"><b>81)</b></a></sup> Header name
4406  preprocessing tokens are recognized only within #include preprocessing directives and
4407  in implementation-defined locations within #pragma directives.<sup><a href="#note82"><b>82)</b></a></sup>
4408 <p><a name="6.4.7p4" href="#6.4.7p4"><small>4</small></a>
4409  EXAMPLE       The following sequence of characters:
4410 <pre>
4411           0x3&lt;1/a.h&gt;1e2
4412           #include &lt;1/a.h&gt;
4413           #define const.member@$
4414 </pre>
4415  forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
4416  by a { on the left and a } on the right).
4417 <pre>
4418           {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
4419           {#}{include} {&lt;1/a.h&gt;}
4420           {#}{define} {const}{.}{member}{@}{$}
4421 </pre>
4422  
4423 <p><b> Forward references</b>: source file inclusion (<a href="#6.10.2">6.10.2</a>).
4424
4425 <p><b>Footnotes</b>
4426 <p><small><a name="note81" href="#note81">81)</a> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
4427 </small>
4428 <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>.
4429 </small>
4430
4431 <p><small><a href="#Contents">Contents</a></small>
4432 <h4><a name="6.4.8" href="#6.4.8">6.4.8 Preprocessing numbers</a></h4>
4433 <p><b>Syntax</b>
4434 <p><a name="6.4.8p1" href="#6.4.8p1"><small>1</small></a>
4435 <pre>
4436           pp-number:
4437                 digit
4438                 . digit
4439                 pp-number       digit
4440                 pp-number       identifier-nondigit
4441                 pp-number       e sign
4442                 pp-number       E sign
4443                 pp-number       p sign
4444                 pp-number       P sign
4445                 pp-number       .
4446 </pre>
4447 <p><b>Description</b>
4448 <p><a name="6.4.8p2" href="#6.4.8p2"><small>2</small></a>
4449  A preprocessing number begins with a digit optionally preceded by a period (.) and may
4450  be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
4451  p+, p-, P+, or P-.
4452 <p><a name="6.4.8p3" href="#6.4.8p3"><small>3</small></a>
4453  Preprocessing number tokens lexically include all floating and integer constant tokens.
4454 <p><b>Semantics</b>
4455 <p><a name="6.4.8p4" href="#6.4.8p4"><small>4</small></a>
4456  A preprocessing number does not have type or a value; it acquires both after a successful
4457  conversion (as part of translation phase 7) to a floating constant token or an integer
4458  constant token.
4459  
4460  
4461 <!--page 93 -->
4462
4463 <p><small><a href="#Contents">Contents</a></small>
4464 <h4><a name="6.4.9" href="#6.4.9">6.4.9 Comments</a></h4>
4465 <p><a name="6.4.9p1" href="#6.4.9p1"><small>1</small></a>
4466  Except within a character constant, a string literal, or a comment, the characters /*
4467  introduce a comment. The contents of such a comment are examined only to identify
4468  multibyte characters and to find the characters */ that terminate it.<sup><a href="#note83"><b>83)</b></a></sup>
4469 <p><a name="6.4.9p2" href="#6.4.9p2"><small>2</small></a>
4470  Except within a character constant, a string literal, or a comment, the characters //
4471  introduce a comment that includes all multibyte characters up to, but not including, the
4472  next new-line character. The contents of such a comment are examined only to identify
4473  multibyte characters and to find the terminating new-line character.
4474 <p><a name="6.4.9p3" href="#6.4.9p3"><small>3</small></a>
4475  EXAMPLE
4476 <pre>
4477           "a//b"                             //   four-character string literal
4478           #include "//e"                     //   undefined behavior
4479           // */                              //   comment, not syntax error
4480           f = g/**//h;                       //   equivalent to f = g / h;
4481           //\
4482           i();                               // part of a two-line comment
4483           /\
4484           / j();                             // part of a two-line comment
4485           #define glue(x,y) x##y
4486           glue(/,/) k();                     // syntax error, not comment
4487           /*//*/ l();                        // equivalent to l();
4488           m = n//**/o
4489              + p;                            // equivalent to m = n + p;
4490 </pre>
4491  
4492  
4493  
4494  
4495 <!--page 94 -->
4496
4497 <p><b>Footnotes</b>
4498 <p><small><a name="note83" href="#note83">83)</a> Thus, /* ... */ comments do not nest.
4499 </small>
4500
4501 <p><small><a href="#Contents">Contents</a></small>
4502 <h3><a name="6.5" href="#6.5">6.5 Expressions</a></h3>
4503 <p><a name="6.5p1" href="#6.5p1"><small>1</small></a>
4504  An expression is a sequence of operators and operands that specifies computation of a
4505  value, or that designates an object or a function, or that generates side effects, or that
4506  performs a combination thereof. The value computations of the operands of an operator
4507  are sequenced before the value computation of the result of the operator.
4508 <p><a name="6.5p2" href="#6.5p2"><small>2</small></a>
4509  If a side effect on a scalar object is unsequenced relative to either a different side effect
4510  on the same scalar object or a value computation using the value of the same scalar
4511  object, the behavior is undefined. If there are multiple allowable orderings of the
4512  subexpressions of an expression, the behavior is undefined if such an unsequenced side
4513  effect occurs in any of the orderings.<sup><a href="#note84"><b>84)</b></a></sup>
4514 <p><a name="6.5p3" href="#6.5p3"><small>3</small></a>
4515  The grouping of operators and operands is indicated by the syntax.<sup><a href="#note85"><b>85)</b></a></sup> Except as specified
4516  later, side effects and value computations of subexpressions are unsequenced.<sup><a href="#note86"><b>86)</b></a></sup>
4517 <p><a name="6.5p4" href="#6.5p4"><small>4</small></a>
4518  Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
4519  collectively described as bitwise operators) are required to have operands that have
4520  integer type. These operators yield values that depend on the internal representations of
4521  integers, and have implementation-defined and undefined aspects for signed types.
4522 <p><a name="6.5p5" href="#6.5p5"><small>5</small></a>
4523  If an exceptional condition occurs during the evaluation of an expression (that is, if the
4524  result is not mathematically defined or not in the range of representable values for its
4525  type), the behavior is undefined.
4526  
4527  
4528  
4529 <!--page 95 -->
4530 <p><a name="6.5p6" href="#6.5p6"><small>6</small></a>
4531  The effective type of an object for an access to its stored value is the declared type of the
4532  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
4533  lvalue having a type that is not a character type, then the type of the lvalue becomes the
4534  effective type of the object for that access and for subsequent accesses that do not modify
4535  the stored value. If a value is copied into an object having no declared type using
4536  memcpy or memmove, or is copied as an array of character type, then the effective type
4537  of the modified object for that access and for subsequent accesses that do not modify the
4538  value is the effective type of the object from which the value is copied, if it has one. For
4539  all other accesses to an object having no declared type, the effective type of the object is
4540  simply the type of the lvalue used for the access.
4541 <p><a name="6.5p7" href="#6.5p7"><small>7</small></a>
4542  An object shall have its stored value accessed only by an lvalue expression that has one of
4543  the following types:<sup><a href="#note88"><b>88)</b></a></sup>
4544 <ul>
4545 <li>  a type compatible with the effective type of the object,
4546 <li>  a qualified version of a type compatible with the effective type of the object,
4547 <li>  a type that is the signed or unsigned type corresponding to the effective type of the
4548  object,
4549 <li>  a type that is the signed or unsigned type corresponding to a qualified version of the
4550  effective type of the object,
4551 <li>  an aggregate or union type that includes one of the aforementioned types among its
4552  members (including, recursively, a member of a subaggregate or contained union), or
4553 <li>  a character type.
4554 </ul>
4555 <p><a name="6.5p8" href="#6.5p8"><small>8</small></a>
4556  A floating expression may be contracted, that is, evaluated as though it were a single
4557  operation, thereby omitting rounding errors implied by the source code and the
4558  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
4559  way to disallow contracted expressions. Otherwise, whether and how expressions are
4560  contracted is implementation-defined.<sup><a href="#note90"><b>90)</b></a></sup>
4561 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.24.2">7.24.2</a>).
4562  
4563  
4564 <!--page 96 -->
4565
4566 <p><b>Footnotes</b>
4567 <p><small><a name="note84" href="#note84">84)</a> This paragraph renders undefined statement expressions such as
4568
4569 <pre>
4570            i = ++i + 1;
4571            a[i++] = i;
4572 </pre>
4573   while allowing
4574
4575 <pre>
4576            i = i + 1;
4577            a[i] = i;
4578 </pre>
4579  
4580 </small>
4581 <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
4582  as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
4583  expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
4584  <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
4585  (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
4586  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
4587  the conditional operator ? : (<a href="#6.5.15">6.5.15</a>).
4588   Within each major subclause, the operators have the same precedence. Left- or right-associativity is
4589   indicated in each subclause by the syntax for the expressions discussed therein.
4590 </small>
4591 <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
4592  indeterminately sequenced evaluations of its subexpressions need not be performed consistently in
4593  different evaluations.
4594 </small>
4595 <p><small><a name="note87" href="#note87">87)</a> Allocated objects have no declared type.
4596 </small>
4597 <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.
4598 </small>
4599 <p><small><a name="note89" href="#note89">89)</a> The intermediate operations in the contracted expression are evaluated as if to infinite range and
4600  precision, while the final operation is rounded to the format determined by the expression evaluation
4601  method. A contracted expression might also omit the raising of floating-point exceptions.
4602 </small>
4603 <p><small><a name="note90" href="#note90">90)</a> This license is specifically intended to allow implementations to exploit fast machine instructions that
4604  combine multiple C operators. As contractions potentially undermine predictability, and can even
4605  decrease accuracy for containing expressions, their use needs to be well-defined and clearly
4606  documented.
4607 </small>
4608
4609 <p><small><a href="#Contents">Contents</a></small>
4610 <h4><a name="6.5.1" href="#6.5.1">6.5.1 Primary expressions</a></h4>
4611 <p><b>Syntax</b>
4612 <p><a name="6.5.1p1" href="#6.5.1p1"><small>1</small></a>
4613 <pre>
4614           primary-expression:
4615                  identifier
4616                  constant
4617                  string-literal
4618                  ( expression )
4619                  generic-selection
4620 </pre>
4621 <p><b>Semantics</b>
4622 <p><a name="6.5.1p2" href="#6.5.1p2"><small>2</small></a>
4623  An identifier is a primary expression, provided it has been declared as designating an
4624  object (in which case it is an lvalue) or a function (in which case it is a function
4625  designator).<sup><a href="#note91"><b>91)</b></a></sup>
4626 <p><a name="6.5.1p3" href="#6.5.1p3"><small>3</small></a>
4627  A constant is a primary expression. Its type depends on its form and value, as detailed in
4628  <a href="#6.4.4">6.4.4</a>.
4629 <p><a name="6.5.1p4" href="#6.5.1p4"><small>4</small></a>
4630  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>.
4631 <p><a name="6.5.1p5" href="#6.5.1p5"><small>5</small></a>
4632  A parenthesized expression is a primary expression. Its type and value are identical to
4633  those of the unparenthesized expression. It is an lvalue, a function designator, or a void
4634  expression if the unparenthesized expression is, respectively, an lvalue, a function
4635  designator, or a void expression.
4636 <p><a name="6.5.1p6" href="#6.5.1p6"><small>6</small></a>
4637  A generic selection is a primary expression. Its type and value depend on the selected
4638  generic association, as detailed in the following subclause.
4639 <p><b> Forward references</b>: declarations (<a href="#6.7">6.7</a>).
4640
4641 <p><b>Footnotes</b>
4642 <p><small><a name="note91" href="#note91">91)</a> Thus, an undeclared identifier is a violation of the syntax.
4643 </small>
4644
4645 <p><small><a href="#Contents">Contents</a></small>
4646 <h5><a name="6.5.1.1" href="#6.5.1.1">6.5.1.1 Generic selection</a></h5>
4647 <p><b>Syntax</b>
4648 <p><a name="6.5.1.1p1" href="#6.5.1.1p1"><small>1</small></a>
4649 <pre>
4650           generic-selection:
4651                  _Generic ( assignment-expression , generic-assoc-list )
4652           generic-assoc-list:
4653                  generic-association
4654                  generic-assoc-list , generic-association
4655           generic-association:
4656                  type-name : assignment-expression
4657                  default : assignment-expression
4658 </pre>
4659  
4660  
4661  
4662 <!--page 97 -->
4663 <p><b>Constraints</b>
4664 <p><a name="6.5.1.1p2" href="#6.5.1.1p2"><small>2</small></a>
4665  A generic selection shall have no more than one default generic association. The type
4666  name in a generic association shall specify a complete object type other than a variably
4667  modified type. No two generic associations in the same generic selection shall specify
4668  compatible types. The controlling expression of a generic selection shall have type
4669  compatible with at most one of the types named in its generic association list. If a
4670  generic selection has no default generic association, its controlling expression shall
4671  have type compatible with exactly one of the types named in its generic association list.
4672 <p><b>Semantics</b>
4673 <p><a name="6.5.1.1p3" href="#6.5.1.1p3"><small>3</small></a>
4674  The controlling expression of a generic selection is not evaluated. If a generic selection
4675  has a generic association with a type name that is compatible with the type of the
4676  controlling expression, then the result expression of the generic selection is the
4677  expression in that generic association. Otherwise, the result expression of the generic
4678  selection is the expression in the default generic association. None of the expressions
4679  from any other generic association of the generic selection is evaluated.
4680 <p><a name="6.5.1.1p4" href="#6.5.1.1p4"><small>4</small></a>
4681  The type and value of a generic selection are identical to those of its result expression. It
4682  is an lvalue, a function designator, or a void expression if its result expression is,
4683  respectively, an lvalue, a function designator, or a void expression.
4684 <p><a name="6.5.1.1p5" href="#6.5.1.1p5"><small>5</small></a>
4685  EXAMPLE      The cbrt type-generic macro could be implemented as follows:
4686 <pre>
4687           #define cbrt(X) _Generic((X),                                      \
4688                                   long double: cbrtl,                        \
4689                                   default: cbrt,                             \
4690                                   float: cbrtf                               \
4691                                   )(X)
4692 </pre>
4693  
4694
4695 <p><small><a href="#Contents">Contents</a></small>
4696 <h4><a name="6.5.2" href="#6.5.2">6.5.2 Postfix operators</a></h4>
4697 <p><b>Syntax</b>
4698 <p><a name="6.5.2p1" href="#6.5.2p1"><small>1</small></a>
4699 <!--page 98 -->
4700 <pre>
4701           postfix-expression:
4702                  primary-expression
4703                  postfix-expression [ expression ]
4704                  postfix-expression ( argument-expression-list<sub>opt</sub> )
4705                  postfix-expression . identifier
4706                  postfix-expression -&gt; identifier
4707                  postfix-expression ++
4708                  postfix-expression --
4709                  ( type-name ) { initializer-list }
4710                  ( type-name ) { initializer-list , }
4711           argument-expression-list:
4712                 assignment-expression
4713                 argument-expression-list , assignment-expression
4714 </pre>
4715
4716 <p><small><a href="#Contents">Contents</a></small>
4717 <h5><a name="6.5.2.1" href="#6.5.2.1">6.5.2.1 Array subscripting</a></h5>
4718 <p><b>Constraints</b>
4719 <p><a name="6.5.2.1p1" href="#6.5.2.1p1"><small>1</small></a>
4720  One of the expressions shall have type ''pointer to complete object type'', the other
4721  expression shall have integer type, and the result has type ''type''.
4722 <p><b>Semantics</b>
4723 <p><a name="6.5.2.1p2" href="#6.5.2.1p2"><small>2</small></a>
4724  A postfix expression followed by an expression in square brackets [] is a subscripted
4725  designation of an element of an array object. The definition of the subscript operator []
4726  is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
4727  apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
4728  initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
4729  element of E1 (counting from zero).
4730 <p><a name="6.5.2.1p3" href="#6.5.2.1p3"><small>3</small></a>
4731  Successive subscript operators designate an element of a multidimensional array object.
4732  If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
4733  other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
4734  dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
4735  implicitly as a result of subscripting, the result is the referenced (n - 1)-dimensional
4736  array, which itself is converted into a pointer if used as other than an lvalue. It follows
4737  from this that arrays are stored in row-major order (last subscript varies fastest).
4738 <p><a name="6.5.2.1p4" href="#6.5.2.1p4"><small>4</small></a>
4739  EXAMPLE        Consider the array object defined by the declaration
4740 <pre>
4741           int x[3][5];
4742 </pre>
4743  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
4744  array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
4745  a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
4746  entails multiplying i by the size of the object to which the pointer points, namely an array of five int
4747  objects. The results are added and indirection is applied to yield an array of five ints. When used in the
4748  expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
4749  yields an int.
4750  
4751 <p><b> Forward references</b>: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
4752  (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
4753 <!--page 99 -->
4754
4755 <p><small><a href="#Contents">Contents</a></small>
4756 <h5><a name="6.5.2.2" href="#6.5.2.2">6.5.2.2 Function calls</a></h5>
4757 <p><b>Constraints</b>
4758 <p><a name="6.5.2.2p1" href="#6.5.2.2p1"><small>1</small></a>
4759  The expression that denotes the called function<sup><a href="#note92"><b>92)</b></a></sup> shall have type pointer to function
4760  returning void or returning a complete object type other than an array type.
4761 <p><a name="6.5.2.2p2" href="#6.5.2.2p2"><small>2</small></a>
4762  If the expression that denotes the called function has a type that includes a prototype, the
4763  number of arguments shall agree with the number of parameters. Each argument shall
4764  have a type such that its value may be assigned to an object with the unqualified version
4765  of the type of its corresponding parameter.
4766 <p><b>Semantics</b>
4767 <p><a name="6.5.2.2p3" href="#6.5.2.2p3"><small>3</small></a>
4768  A postfix expression followed by parentheses () containing a possibly empty, comma-
4769  separated list of expressions is a function call. The postfix expression denotes the called
4770  function. The list of expressions specifies the arguments to the function.
4771 <p><a name="6.5.2.2p4" href="#6.5.2.2p4"><small>4</small></a>
4772  An argument may be an expression of any complete object type. In preparing for the call
4773  to a function, the arguments are evaluated, and each parameter is assigned the value of the
4774  corresponding argument.<sup><a href="#note93"><b>93)</b></a></sup>
4775 <p><a name="6.5.2.2p5" href="#6.5.2.2p5"><small>5</small></a>
4776  If the expression that denotes the called function has type pointer to function returning an
4777  object type, the function call expression has the same type as that object type, and has the
4778  value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void.
4779 <p><a name="6.5.2.2p6" href="#6.5.2.2p6"><small>6</small></a>
4780  If the expression that denotes the called function has a type that does not include a
4781  prototype, the integer promotions are performed on each argument, and arguments that
4782  have type float are promoted to double. These are called the default argument
4783  promotions. If the number of arguments does not equal the number of parameters, the
4784  behavior is undefined. If the function is defined with a type that includes a prototype, and
4785  either the prototype ends with an ellipsis (, ...) or the types of the arguments after
4786  promotion are not compatible with the types of the parameters, the behavior is undefined.
4787  If the function is defined with a type that does not include a prototype, and the types of
4788  the arguments after promotion are not compatible with those of the parameters after
4789  promotion, the behavior is undefined, except for the following cases:
4790 <ul>
4791 <li>  one promoted type is a signed integer type, the other promoted type is the
4792  corresponding unsigned integer type, and the value is representable in both types;
4793  
4794  
4795  
4796 <!--page 100 -->
4797 <li>  both types are pointers to qualified or unqualified versions of a character type or
4798  void.
4799 </ul>
4800 <p><a name="6.5.2.2p7" href="#6.5.2.2p7"><small>7</small></a>
4801  If the expression that denotes the called function has a type that does include a prototype,
4802  the arguments are implicitly converted, as if by assignment, to the types of the
4803  corresponding parameters, taking the type of each parameter to be the unqualified version
4804  of its declared type. The ellipsis notation in a function prototype declarator causes
4805  argument type conversion to stop after the last declared parameter. The default argument
4806  promotions are performed on trailing arguments.
4807 <p><a name="6.5.2.2p8" href="#6.5.2.2p8"><small>8</small></a>
4808  No other conversions are performed implicitly; in particular, the number and types of
4809  arguments are not compared with those of the parameters in a function definition that
4810  does not include a function prototype declarator.
4811 <p><a name="6.5.2.2p9" href="#6.5.2.2p9"><small>9</small></a>
4812  If the function is defined with a type that is not compatible with the type (of the
4813  expression) pointed to by the expression that denotes the called function, the behavior is
4814  undefined.
4815 <p><a name="6.5.2.2p10" href="#6.5.2.2p10"><small>10</small></a>
4816  There is a sequence point after the evaluations of the function designator and the actual
4817  arguments but before the actual call. Every evaluation in the calling function (including
4818  other function calls) that is not otherwise specifically sequenced before or after the
4819  execution of the body of the called function is indeterminately sequenced with respect to
4820  the execution of the called function.<sup><a href="#note94"><b>94)</b></a></sup>
4821 <p><a name="6.5.2.2p11" href="#6.5.2.2p11"><small>11</small></a>
4822  Recursive function calls shall be permitted, both directly and indirectly through any chain
4823  of other functions.
4824 <p><a name="6.5.2.2p12" href="#6.5.2.2p12"><small>12</small></a>
4825  EXAMPLE        In the function call
4826 <pre>
4827           (*pf[f1()]) (f2(), f3() + f4())
4828 </pre>
4829  the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
4830  the function pointed to by pf[f1()] is called.
4831  
4832 <p><b> Forward references</b>: function declarators (including prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), function
4833  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>).
4834
4835 <p><b>Footnotes</b>
4836 <p><small><a name="note92" href="#note92">92)</a> Most often, this is the result of converting an identifier that is a function designator.
4837 </small>
4838 <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
4839  arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
4840  change the value of the object pointed to. A parameter declared to have array or function type is
4841  adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
4842 </small>
4843 <p><small><a name="note94" href="#note94">94)</a> In other words, function executions do not ''interleave'' with each other.
4844 </small>
4845
4846 <p><small><a href="#Contents">Contents</a></small>
4847 <h5><a name="6.5.2.3" href="#6.5.2.3">6.5.2.3 Structure and union members</a></h5>
4848 <p><b>Constraints</b>
4849 <p><a name="6.5.2.3p1" href="#6.5.2.3p1"><small>1</small></a>
4850  The first operand of the . operator shall have an atomic, qualified, or unqualified
4851  structure or union type, and the second operand shall name a member of that type.
4852 <p><a name="6.5.2.3p2" href="#6.5.2.3p2"><small>2</small></a>
4853  The first operand of the -&gt; operator shall have type ''pointer to atomic, qualified, or
4854  unqualified structure'' or ''pointer to atomic, qualified, or unqualified union'', and the
4855  second operand shall name a member of the type pointed to.
4856  
4857  
4858 <!--page 101 -->
4859 <p><b>Semantics</b>
4860 <p><a name="6.5.2.3p3" href="#6.5.2.3p3"><small>3</small></a>
4861  A postfix expression followed by the . operator and an identifier designates a member of
4862  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
4863  the first expression is an lvalue. If the first expression has qualified type, the result has
4864  the so-qualified version of the type of the designated member.
4865 <p><a name="6.5.2.3p4" href="#6.5.2.3p4"><small>4</small></a>
4866  A postfix expression followed by the -&gt; operator and an identifier designates a member
4867  of a structure or union object. The value is that of the named member of the object to
4868  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
4869  a qualified type, the result has the so-qualified version of the type of the designated
4870  member.
4871 <p><a name="6.5.2.3p5" href="#6.5.2.3p5"><small>5</small></a>
4872  Accessing a member of an atomic structure or union object results in undefined
4873  behavior.<sup><a href="#note97"><b>97)</b></a></sup>
4874 <p><a name="6.5.2.3p6" href="#6.5.2.3p6"><small>6</small></a>
4875  One special guarantee is made in order to simplify the use of unions: if a union contains
4876  several structures that share a common initial sequence (see below), and if the union
4877  object currently contains one of these structures, it is permitted to inspect the common
4878  initial part of any of them anywhere that a declaration of the completed type of the union
4879  is visible. Two structures share a common initial sequence if corresponding members
4880  have compatible types (and, for bit-fields, the same widths) for a sequence of one or more
4881  initial members.
4882 <p><a name="6.5.2.3p7" href="#6.5.2.3p7"><small>7</small></a>
4883  EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
4884  union, f().x is a valid postfix expression but is not an lvalue.
4885  
4886 <p><a name="6.5.2.3p8" href="#6.5.2.3p8"><small>8</small></a>
4887  EXAMPLE 2       In:
4888 <pre>
4889           struct s { int i; const int ci; };
4890           struct s s;
4891           const struct s cs;
4892           volatile struct s vs;
4893 </pre>
4894  the various members have the types:
4895  
4896  
4897  
4898  
4899 <!--page 102 -->
4900 <pre>
4901           s.i        int
4902           s.ci       const int
4903           cs.i       const int
4904           cs.ci      const int
4905           vs.i       volatile int
4906           vs.ci      volatile const int
4907 </pre>
4908  
4909 <p><a name="6.5.2.3p9" href="#6.5.2.3p9"><small>9</small></a>
4910  EXAMPLE 3       The following is a valid fragment:
4911 <pre>
4912           union {
4913                   struct {
4914                         int      alltypes;
4915                   } n;
4916                   struct {
4917                         int      type;
4918                         int      intnode;
4919                   } ni;
4920                   struct {
4921                         int      type;
4922                         double doublenode;
4923                   } nf;
4924           } u;
4925           u.nf.type = 1;
4926           u.nf.doublenode = <a href="#3.14">3.14</a>;
4927           /* ... */
4928           if (u.n.alltypes == 1)
4929                   if (sin(u.nf.doublenode) == 0.0)
4930                         /* ... */
4931 </pre>
4932  The following is not a valid fragment (because the union type is not visible within function f):
4933 <pre>
4934           struct t1 { int m; };
4935           struct t2 { int m; };
4936           int f(struct t1 *p1, struct t2 *p2)
4937           {
4938                 if (p1-&gt;m &lt; 0)
4939                         p2-&gt;m = -p2-&gt;m;
4940                 return p1-&gt;m;
4941           }
4942           int g()
4943           {
4944                 union {
4945                         struct t1 s1;
4946                         struct t2 s2;
4947                 } u;
4948                 /* ... */
4949                 return f(&amp;u.s1, &amp;u.s2);
4950           }
4951 </pre>
4952  
4953 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
4954  specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
4955 <!--page 103 -->
4956
4957 <p><b>Footnotes</b>
4958 <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
4959  store a value in the object, the appropriate part of the object representation of the value is reinterpreted
4960  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
4961  punning''). This might be a trap representation.
4962 </small>
4963 <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
4964  its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
4965 </small>
4966 <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
4967  with access to a member from another thread, where at least one access is a modification. Members
4968  can be safely accessed using a non-atomic object which is assigned to or from the atomic object.
4969 </small>
4970
4971 <p><small><a href="#Contents">Contents</a></small>
4972 <h5><a name="6.5.2.4" href="#6.5.2.4">6.5.2.4 Postfix increment and decrement operators</a></h5>
4973 <p><b>Constraints</b>
4974 <p><a name="6.5.2.4p1" href="#6.5.2.4p1"><small>1</small></a>
4975  The operand of the postfix increment or decrement operator shall have atomic, qualified,
4976  or unqualified real or pointer type, and shall be a modifiable lvalue.
4977 <p><b>Semantics</b>
4978 <p><a name="6.5.2.4p2" href="#6.5.2.4p2"><small>2</small></a>
4979  The result of the postfix ++ operator is the value of the operand. As a side effect, the
4980  value of the operand object is incremented (that is, the value 1 of the appropriate type is
4981  added to it). See the discussions of additive operators and compound assignment for
4982  information on constraints, types, and conversions and the effects of operations on
4983  pointers. The value computation of the result is sequenced before the side effect of
4984  updating the stored value of the operand. With respect to an indeterminately-sequenced
4985  function call, the operation of postfix ++ is a single evaluation. Postfix ++ on an object
4986  with atomic type is a read-modify-write operation with memory_order_seq_cst
4987  memory order semantics.<sup><a href="#note98"><b>98)</b></a></sup>
4988 <p><a name="6.5.2.4p3" href="#6.5.2.4p3"><small>3</small></a>
4989  The postfix -- operator is analogous to the postfix ++ operator, except that the value of
4990  the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
4991  it).
4992 <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>).
4993
4994 <p><b>Footnotes</b>
4995 <p><small><a name="note98" href="#note98">98)</a> Where a pointer to an atomic object can be formed and E has integer type, E++ is equivalent to the
4996  following code sequence where T is the type of E:
4997
4998 <pre>
4999            T *addr = &amp;E;
5000            T old = *addr;
5001            T new;
5002            do {
5003                   new = old + 1;
5004            } while (!atomic_compare_exchange_strong(addr, &amp;old, new));
5005 </pre>
5006   with old being the result of the operation.
5007   Special care must be taken if E has floating type; see <a href="#6.5.16.2">6.5.16.2</a>.
5008 </small>
5009
5010 <p><small><a href="#Contents">Contents</a></small>
5011 <h5><a name="6.5.2.5" href="#6.5.2.5">6.5.2.5 Compound literals</a></h5>
5012 <p><b>Constraints</b>
5013 <p><a name="6.5.2.5p1" href="#6.5.2.5p1"><small>1</small></a>
5014  The type name shall specify a complete object type or an array of unknown size, but not a
5015  variable length array type.
5016 <p><a name="6.5.2.5p2" href="#6.5.2.5p2"><small>2</small></a>
5017  All the constraints for initializer lists in <a href="#6.7.9">6.7.9</a> also apply to compound literals.
5018 <p><b>Semantics</b>
5019 <p><a name="6.5.2.5p3" href="#6.5.2.5p3"><small>3</small></a>
5020  A postfix expression that consists of a parenthesized type name followed by a brace-
5021  enclosed list of initializers is a compound literal. It provides an unnamed object whose
5022  
5023 <!--page 104 -->
5024  value is given by the initializer list.<sup><a href="#note99"><b>99)</b></a></sup>
5025 <p><a name="6.5.2.5p4" href="#6.5.2.5p4"><small>4</small></a>
5026  If the type name specifies an array of unknown size, the size is determined by the
5027  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
5028  completed array type. Otherwise (when the type name specifies an object type), the type
5029  of the compound literal is that specified by the type name. In either case, the result is an
5030  lvalue.
5031 <p><a name="6.5.2.5p5" href="#6.5.2.5p5"><small>5</small></a>
5032  The value of the compound literal is that of an unnamed object initialized by the
5033  initializer list. If the compound literal occurs outside the body of a function, the object
5034  has static storage duration; otherwise, it has automatic storage duration associated with
5035  the enclosing block.
5036 <p><a name="6.5.2.5p6" href="#6.5.2.5p6"><small>6</small></a>
5037  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>
5038 <p><a name="6.5.2.5p7" href="#6.5.2.5p7"><small>7</small></a>
5039  String literals, and compound literals with const-qualified types, need not designate
5040  distinct objects.<sup><a href="#note101"><b>101)</b></a></sup>
5041 <p><a name="6.5.2.5p8" href="#6.5.2.5p8"><small>8</small></a>
5042  EXAMPLE 1       The file scope definition
5043 <pre>
5044           int *p = (int []){2, 4};
5045 </pre>
5046  initializes p to point to the first element of an array of two ints, the first having the value two and the
5047  second, four. The expressions in this compound literal are required to be constant. The unnamed object
5048  has static storage duration.
5049  
5050 <p><a name="6.5.2.5p9" href="#6.5.2.5p9"><small>9</small></a>
5051  EXAMPLE 2       In contrast, in
5052 <pre>
5053           void f(void)
5054           {
5055                 int *p;
5056                 /*...*/
5057                 p = (int [2]){*p};
5058                 /*...*/
5059           }
5060 </pre>
5061  p is assigned the address of the first element of an array of two ints, the first having the value previously
5062  pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
5063  unnamed object has automatic storage duration.
5064  
5065 <p><a name="6.5.2.5p10" href="#6.5.2.5p10"><small>10</small></a>
5066  EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
5067  created using compound literals can be passed to functions without depending on member order:
5068 <pre>
5069           drawline((struct point){.x=1, .y=1},
5070                 (struct point){.x=3, .y=4});
5071 </pre>
5072  
5073  
5074  
5075 <!--page 105 -->
5076  Or, if drawline instead expected pointers to struct point:
5077 <pre>
5078           drawline(&amp;(struct point){.x=1, .y=1},
5079                 &amp;(struct point){.x=3, .y=4});
5080 </pre>
5081  
5082 <p><a name="6.5.2.5p11" href="#6.5.2.5p11"><small>11</small></a>
5083  EXAMPLE 4        A read-only compound literal can be specified through constructions like:
5084 <pre>
5085           (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}
5086 </pre>
5087  
5088 <p><a name="6.5.2.5p12" href="#6.5.2.5p12"><small>12</small></a>
5089  EXAMPLE 5        The following three expressions have different meanings:
5090 <pre>
5091           "/tmp/fileXXXXXX"
5092           (char []){"/tmp/fileXXXXXX"}
5093           (const char []){"/tmp/fileXXXXXX"}
5094 </pre>
5095  The first always has static storage duration and has type array of char, but need not be modifiable; the last
5096  two have automatic storage duration when they occur within the body of a function, and the first of these
5097  two is modifiable.
5098  
5099 <p><a name="6.5.2.5p13" href="#6.5.2.5p13"><small>13</small></a>
5100  EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
5101  and can even be shared. For example,
5102 <pre>
5103           (const char []){"abc"} == "abc"
5104 </pre>
5105  might yield 1 if the literals' storage is shared.
5106  
5107 <p><a name="6.5.2.5p14" href="#6.5.2.5p14"><small>14</small></a>
5108  EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
5109  linked object. For example, there is no way to write a self-referential compound literal that could be used
5110  as the function argument in place of the named object endless_zeros below:
5111 <pre>
5112           struct int_list { int car; struct int_list *cdr; };
5113           struct int_list endless_zeros = {0, &amp;endless_zeros};
5114           eval(endless_zeros);
5115 </pre>
5116  
5117 <p><a name="6.5.2.5p15" href="#6.5.2.5p15"><small>15</small></a>
5118  EXAMPLE 8        Each compound literal creates only a single object in a given scope:
5119 <pre>
5120           struct s { int i; };
5121           int f (void)
5122           {
5123                 struct s *p = 0, *q;
5124                 int j = 0;
5125           again:
5126                     q = p, p = &amp;((struct s){ j++ });
5127                     if (j &lt; 2) goto again;
5128                     return p == q &amp;&amp; q-&gt;i == 1;
5129           }
5130 </pre>
5131  The function f() always returns the value 1.
5132 <p><a name="6.5.2.5p16" href="#6.5.2.5p16"><small>16</small></a>
5133  Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
5134  lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
5135  have an indeterminate value, which would result in undefined behavior.
5136  
5137 <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>).
5138 <!--page 106 -->
5139
5140 <p><b>Footnotes</b>
5141 <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
5142  or void only, and the result of a cast expression is not an lvalue.
5143 </small>
5144 <p><small><a name="note100" href="#note100">100)</a> For example, subobjects without explicit initializers are initialized to zero.
5145 </small>
5146 <p><small><a name="note101" href="#note101">101)</a> This allows implementations to share storage for string literals and constant compound literals with
5147  the same or overlapping representations.
5148 </small>
5149
5150 <p><small><a href="#Contents">Contents</a></small>
5151 <h4><a name="6.5.3" href="#6.5.3">6.5.3 Unary operators</a></h4>
5152 <p><b>Syntax</b>
5153 <p><a name="6.5.3p1" href="#6.5.3p1"><small>1</small></a>
5154 <pre>
5155           unary-expression:
5156                  postfix-expression
5157                  ++ unary-expression
5158                  -- unary-expression
5159                  unary-operator cast-expression
5160                  sizeof unary-expression
5161                  sizeof ( type-name )
5162                  _Alignof ( type-name )
5163           unary-operator: one of
5164                  &amp; * + - ~             !
5165 </pre>
5166
5167 <p><small><a href="#Contents">Contents</a></small>
5168 <h5><a name="6.5.3.1" href="#6.5.3.1">6.5.3.1 Prefix increment and decrement operators</a></h5>
5169 <p><b>Constraints</b>
5170 <p><a name="6.5.3.1p1" href="#6.5.3.1p1"><small>1</small></a>
5171  The operand of the prefix increment or decrement operator shall have atomic, qualified,
5172  or unqualified real or pointer type, and shall be a modifiable lvalue.
5173 <p><b>Semantics</b>
5174 <p><a name="6.5.3.1p2" href="#6.5.3.1p2"><small>2</small></a>
5175  The value of the operand of the prefix ++ operator is incremented. The result is the new
5176  value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
5177  See the discussions of additive operators and compound assignment for information on
5178  constraints, types, side effects, and conversions and the effects of operations on pointers.
5179 <p><a name="6.5.3.1p3" href="#6.5.3.1p3"><small>3</small></a>
5180  The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
5181  operand is decremented.
5182 <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>).
5183
5184 <p><small><a href="#Contents">Contents</a></small>
5185 <h5><a name="6.5.3.2" href="#6.5.3.2">6.5.3.2 Address and indirection operators</a></h5>
5186 <p><b>Constraints</b>
5187 <p><a name="6.5.3.2p1" href="#6.5.3.2p1"><small>1</small></a>
5188  The operand of the unary &amp; operator shall be either a function designator, the result of a
5189  [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
5190  not declared with the register storage-class specifier.
5191 <p><a name="6.5.3.2p2" href="#6.5.3.2p2"><small>2</small></a>
5192  The operand of the unary * operator shall have pointer type.
5193 <p><b>Semantics</b>
5194 <p><a name="6.5.3.2p3" href="#6.5.3.2p3"><small>3</small></a>
5195  The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
5196  the result has type ''pointer to type''. If the operand is the result of a unary * operator,
5197  neither that operator nor the &amp; operator is evaluated and the result is as if both were
5198  omitted, except that the constraints on the operators still apply and the result is not an
5199 <!--page 107 -->
5200  lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
5201  the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
5202  were removed and the [] operator were changed to a + operator. Otherwise, the result is
5203  a pointer to the object or function designated by its operand.
5204 <p><a name="6.5.3.2p4" href="#6.5.3.2p4"><small>4</small></a>
5205  The unary * operator denotes indirection. If the operand points to a function, the result is
5206  a function designator; if it points to an object, the result is an lvalue designating the
5207  object. If the operand has type ''pointer to type'', the result has type ''type''. If an
5208  invalid value has been assigned to the pointer, the behavior of the unary * operator is
5209  undefined.<sup><a href="#note102"><b>102)</b></a></sup>
5210 <p><b> Forward references</b>: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
5211  (<a href="#6.7.2.1">6.7.2.1</a>).
5212
5213 <p><b>Footnotes</b>
5214 <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
5215  always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
5216  operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
5217  an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
5218  Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
5219  address inappropriately aligned for the type of object pointed to, and the address of an object after the
5220  end of its lifetime.
5221 </small>
5222
5223 <p><small><a href="#Contents">Contents</a></small>
5224 <h5><a name="6.5.3.3" href="#6.5.3.3">6.5.3.3 Unary arithmetic operators</a></h5>
5225 <p><b>Constraints</b>
5226 <p><a name="6.5.3.3p1" href="#6.5.3.3p1"><small>1</small></a>
5227  The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
5228  integer type; of the ! operator, scalar type.
5229 <p><b>Semantics</b>
5230 <p><a name="6.5.3.3p2" href="#6.5.3.3p2"><small>2</small></a>
5231  The result of the unary + operator is the value of its (promoted) operand. The integer
5232  promotions are performed on the operand, and the result has the promoted type.
5233 <p><a name="6.5.3.3p3" href="#6.5.3.3p3"><small>3</small></a>
5234  The result of the unary - operator is the negative of its (promoted) operand. The integer
5235  promotions are performed on the operand, and the result has the promoted type.
5236 <p><a name="6.5.3.3p4" href="#6.5.3.3p4"><small>4</small></a>
5237  The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
5238  each bit in the result is set if and only if the corresponding bit in the converted operand is
5239  not set). The integer promotions are performed on the operand, and the result has the
5240  promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
5241  to the maximum value representable in that type minus E.
5242 <p><a name="6.5.3.3p5" href="#6.5.3.3p5"><small>5</small></a>
5243  The result of the logical negation operator ! is 0 if the value of its operand compares
5244  unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
5245  The expression !E is equivalent to (0==E).
5246  
5247  
5248  
5249 <!--page 108 -->
5250
5251 <p><small><a href="#Contents">Contents</a></small>
5252 <h5><a name="6.5.3.4" href="#6.5.3.4">6.5.3.4 The sizeof and _Alignof operators</a></h5>
5253 <p><b>Constraints</b>
5254 <p><a name="6.5.3.4p1" href="#6.5.3.4p1"><small>1</small></a>
5255  The sizeof operator shall not be applied to an expression that has function type or an
5256  incomplete type, to the parenthesized name of such a type, or to an expression that
5257  designates a bit-field member. The _Alignof operator shall not be applied to a
5258  function type or an incomplete type.
5259 <p><b>Semantics</b>
5260 <p><a name="6.5.3.4p2" href="#6.5.3.4p2"><small>2</small></a>
5261  The sizeof operator yields the size (in bytes) of its operand, which may be an
5262  expression or the parenthesized name of a type. The size is determined from the type of
5263  the operand. The result is an integer. If the type of the operand is a variable length array
5264  type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
5265  integer constant.
5266 <p><a name="6.5.3.4p3" href="#6.5.3.4p3"><small>3</small></a>
5267  The _Alignof operator yields the alignment requirement of its operand type. The
5268  operand is not evaluated and the result is an integer constant. When applied to an array
5269  type, the result is the alignment requirement of the element type.
5270 <p><a name="6.5.3.4p4" href="#6.5.3.4p4"><small>4</small></a>
5271  When sizeof is applied to an operand that has type char, unsigned char, or
5272  signed char, (or a qualified version thereof) the result is 1. When applied to an
5273  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
5274  applied to an operand that has structure or union type, the result is the total number of
5275  bytes in such an object, including internal and trailing padding.
5276 <p><a name="6.5.3.4p5" href="#6.5.3.4p5"><small>5</small></a>
5277  The value of the result of both operators is implementation-defined, and its type (an
5278  unsigned integer type) is size_t, defined in <a href="#7.19">&lt;stddef.h&gt;</a> (and other headers).
5279 <p><a name="6.5.3.4p6" href="#6.5.3.4p6"><small>6</small></a>
5280  EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
5281  allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
5282  allocate and return a pointer to void. For example:
5283 <pre>
5284          extern void *alloc(size_t);
5285          double *dp = alloc(sizeof *dp);
5286 </pre>
5287  The implementation of the alloc function should ensure that its return value is aligned suitably for
5288  conversion to a pointer to double.
5289  
5290 <p><a name="6.5.3.4p7" href="#6.5.3.4p7"><small>7</small></a>
5291  EXAMPLE 2      Another use of the sizeof operator is to compute the number of elements in an array:
5292 <pre>
5293          sizeof array / sizeof array[0]
5294 </pre>
5295  
5296 <p><a name="6.5.3.4p8" href="#6.5.3.4p8"><small>8</small></a>
5297  EXAMPLE 3      In this example, the size of a variable length array is computed and returned from a
5298  function:
5299 <pre>
5300          #include <a href="#7.19">&lt;stddef.h&gt;</a>
5301 </pre>
5302  
5303  
5304  
5305 <!--page 109 -->
5306 <pre>
5307           size_t fsize3(int n)
5308           {
5309                 char b[n+3];                  // variable length array
5310                 return sizeof b;              // execution time sizeof
5311           }
5312           int main()
5313           {
5314                 size_t size;
5315                 size = fsize3(10); // fsize3 returns 13
5316                 return 0;
5317           }
5318 </pre>
5319  
5320 <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>),
5321  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>).
5322
5323 <p><b>Footnotes</b>
5324 <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
5325  size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
5326 </small>
5327
5328 <p><small><a href="#Contents">Contents</a></small>
5329 <h4><a name="6.5.4" href="#6.5.4">6.5.4 Cast operators</a></h4>
5330 <p><b>Syntax</b>
5331 <p><a name="6.5.4p1" href="#6.5.4p1"><small>1</small></a>
5332 <pre>
5333           cast-expression:
5334                  unary-expression
5335                  ( type-name ) cast-expression
5336 </pre>
5337 <p><b>Constraints</b>
5338 <p><a name="6.5.4p2" href="#6.5.4p2"><small>2</small></a>
5339  Unless the type name specifies a void type, the type name shall specify atomic, qualified,
5340  or unqualified scalar type, and the operand shall have scalar type.
5341 <p><a name="6.5.4p3" href="#6.5.4p3"><small>3</small></a>
5342  Conversions that involve pointers, other than where permitted by the constraints of
5343  <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
5344 <p><a name="6.5.4p4" href="#6.5.4p4"><small>4</small></a>
5345  A pointer type shall not be converted to any floating type. A floating type shall not be
5346  converted to any pointer type.
5347 <p><b>Semantics</b>
5348 <p><a name="6.5.4p5" href="#6.5.4p5"><small>5</small></a>
5349  Preceding an expression by a parenthesized type name converts the value of the
5350  expression to the named type. This construction is called a cast.<sup><a href="#note104"><b>104)</b></a></sup> A cast that specifies
5351  no conversion has no effect on the type or value of an expression.
5352 <p><a name="6.5.4p6" href="#6.5.4p6"><small>6</small></a>
5353  If the value of the expression is represented with greater range or precision than required
5354  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
5355  type of the expression is the same as the named type and removes any extra range and
5356  precision.
5357 <p><b> Forward references</b>: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
5358  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>).
5359  
5360 <!--page 110 -->
5361
5362 <p><b>Footnotes</b>
5363 <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
5364  unqualified version of the type.
5365 </small>
5366
5367 <p><small><a href="#Contents">Contents</a></small>
5368 <h4><a name="6.5.5" href="#6.5.5">6.5.5 Multiplicative operators</a></h4>
5369 <p><b>Syntax</b>
5370 <p><a name="6.5.5p1" href="#6.5.5p1"><small>1</small></a>
5371 <pre>
5372           multiplicative-expression:
5373                   cast-expression
5374                   multiplicative-expression * cast-expression
5375                   multiplicative-expression / cast-expression
5376                   multiplicative-expression % cast-expression
5377 </pre>
5378 <p><b>Constraints</b>
5379 <p><a name="6.5.5p2" href="#6.5.5p2"><small>2</small></a>
5380  Each of the operands shall have arithmetic type. The operands of the % operator shall
5381  have integer type.
5382 <p><b>Semantics</b>
5383 <p><a name="6.5.5p3" href="#6.5.5p3"><small>3</small></a>
5384  The usual arithmetic conversions are performed on the operands.
5385 <p><a name="6.5.5p4" href="#6.5.5p4"><small>4</small></a>
5386  The result of the binary * operator is the product of the operands.
5387 <p><a name="6.5.5p5" href="#6.5.5p5"><small>5</small></a>
5388  The result of the / operator is the quotient from the division of the first operand by the
5389  second; the result of the % operator is the remainder. In both operations, if the value of
5390  the second operand is zero, the behavior is undefined.
5391 <p><a name="6.5.5p6" href="#6.5.5p6"><small>6</small></a>
5392  When integers are divided, the result of the / operator is the algebraic quotient with any
5393  fractional part discarded.<sup><a href="#note105"><b>105)</b></a></sup> If the quotient a/b is representable, the expression
5394  (a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is
5395  undefined.
5396
5397 <p><b>Footnotes</b>
5398 <p><small><a name="note105" href="#note105">105)</a> This is often called ''truncation toward zero''.
5399 </small>
5400
5401 <p><small><a href="#Contents">Contents</a></small>
5402 <h4><a name="6.5.6" href="#6.5.6">6.5.6 Additive operators</a></h4>
5403 <p><b>Syntax</b>
5404 <p><a name="6.5.6p1" href="#6.5.6p1"><small>1</small></a>
5405 <pre>
5406           additive-expression:
5407                  multiplicative-expression
5408                  additive-expression + multiplicative-expression
5409                  additive-expression - multiplicative-expression
5410 </pre>
5411 <p><b>Constraints</b>
5412 <p><a name="6.5.6p2" href="#6.5.6p2"><small>2</small></a>
5413  For addition, either both operands shall have arithmetic type, or one operand shall be a
5414  pointer to a complete object type and the other shall have integer type. (Incrementing is
5415  equivalent to adding 1.)
5416 <p><a name="6.5.6p3" href="#6.5.6p3"><small>3</small></a>
5417  For subtraction, one of the following shall hold:
5418  
5419  
5420  
5421  
5422 <!--page 111 -->
5423 <ul>
5424 <li>  both operands have arithmetic type;
5425 <li>  both operands are pointers to qualified or unqualified versions of compatible complete
5426  object types; or
5427 <li>  the left operand is a pointer to a complete object type and the right operand has
5428  integer type.
5429 </ul>
5430  (Decrementing is equivalent to subtracting 1.)
5431 <p><b>Semantics</b>
5432 <p><a name="6.5.6p4" href="#6.5.6p4"><small>4</small></a>
5433  If both operands have arithmetic type, the usual arithmetic conversions are performed on
5434  them.
5435 <p><a name="6.5.6p5" href="#6.5.6p5"><small>5</small></a>
5436  The result of the binary + operator is the sum of the operands.
5437 <p><a name="6.5.6p6" href="#6.5.6p6"><small>6</small></a>
5438  The result of the binary - operator is the difference resulting from the subtraction of the
5439  second operand from the first.
5440 <p><a name="6.5.6p7" href="#6.5.6p7"><small>7</small></a>
5441  For the purposes of these operators, a pointer to an object that is not an element of an
5442  array behaves the same as a pointer to the first element of an array of length one with the
5443  type of the object as its element type.
5444 <p><a name="6.5.6p8" href="#6.5.6p8"><small>8</small></a>
5445  When an expression that has integer type is added to or subtracted from a pointer, the
5446  result has the type of the pointer operand. If the pointer operand points to an element of
5447  an array object, and the array is large enough, the result points to an element offset from
5448  the original element such that the difference of the subscripts of the resulting and original
5449  array elements equals the integer expression. In other words, if the expression P points to
5450  the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
5451  (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
5452  the array object, provided they exist. Moreover, if the expression P points to the last
5453  element of an array object, the expression (P)+1 points one past the last element of the
5454  array object, and if the expression Q points one past the last element of an array object,
5455  the expression (Q)-1 points to the last element of the array object. If both the pointer
5456  operand and the result point to elements of the same array object, or one past the last
5457  element of the array object, the evaluation shall not produce an overflow; otherwise, the
5458  behavior is undefined. If the result points one past the last element of the array object, it
5459  shall not be used as the operand of a unary * operator that is evaluated.
5460 <p><a name="6.5.6p9" href="#6.5.6p9"><small>9</small></a>
5461  When two pointers are subtracted, both shall point to elements of the same array object,
5462  or one past the last element of the array object; the result is the difference of the
5463  subscripts of the two array elements. The size of the result is implementation-defined,
5464  and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.19">&lt;stddef.h&gt;</a> header.
5465  If the result is not representable in an object of that type, the behavior is undefined. In
5466  other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
5467  an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
5468 <!--page 112 -->
5469  object of type ptrdiff_t. Moreover, if the expression P points either to an element of
5470  an array object or one past the last element of an array object, and the expression Q points
5471  to the last element of the same array object, the expression ((Q)+1)-(P) has the same
5472  value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
5473  expression P points one past the last element of the array object, even though the
5474  expression (Q)+1 does not point to an element of the array object.<sup><a href="#note106"><b>106)</b></a></sup>
5475 <p><a name="6.5.6p10" href="#6.5.6p10"><small>10</small></a>
5476  EXAMPLE        Pointer arithmetic is well defined with pointers to variable length array types.
5477 <pre>
5478           {
5479                    int n = 4, m = 3;
5480                    int a[n][m];
5481                    int (*p)[m] = a;            //   p == &amp;a[0]
5482                    p += 1;                     //   p == &amp;a[1]
5483                    (*p)[2] = 99;               //   a[1][2] == 99
5484                    n = p - a;                  //   n == 1
5485           }
5486 </pre>
5487 <p><a name="6.5.6p11" href="#6.5.6p11"><small>11</small></a>
5488  If array a in the above example were declared to be an array of known constant size, and pointer p were
5489  declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
5490  the same.
5491  
5492 <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>
5493  (<a href="#7.19">7.19</a>).
5494
5495 <p><b>Footnotes</b>
5496 <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
5497  this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
5498  by the size of the object originally pointed to, and the resulting pointer is converted back to the
5499  original type. For pointer subtraction, the result of the difference between the character pointers is
5500  similarly divided by the size of the object originally pointed to.
5501  When viewed in this way, an implementation need only provide one extra byte (which may overlap
5502  another object in the program) just after the end of the object in order to satisfy the ''one past the last
5503  element'' requirements.
5504 </small>
5505
5506 <p><small><a href="#Contents">Contents</a></small>
5507 <h4><a name="6.5.7" href="#6.5.7">6.5.7 Bitwise shift operators</a></h4>
5508 <p><b>Syntax</b>
5509 <p><a name="6.5.7p1" href="#6.5.7p1"><small>1</small></a>
5510 <pre>
5511           shift-expression:
5512                   additive-expression
5513                   shift-expression &lt;&lt; additive-expression
5514                   shift-expression &gt;&gt; additive-expression
5515 </pre>
5516 <p><b>Constraints</b>
5517 <p><a name="6.5.7p2" href="#6.5.7p2"><small>2</small></a>
5518  Each of the operands shall have integer type.
5519 <p><b>Semantics</b>
5520 <p><a name="6.5.7p3" href="#6.5.7p3"><small>3</small></a>
5521  The integer promotions are performed on each of the operands. The type of the result is
5522  that of the promoted left operand. If the value of the right operand is negative or is
5523  
5524 <!--page 113 -->
5525  greater than or equal to the width of the promoted left operand, the behavior is undefined.
5526 <p><a name="6.5.7p4" href="#6.5.7p4"><small>4</small></a>
5527  The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
5528  zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
5529  one more than the maximum value representable in the result type. If E1 has a signed
5530  type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
5531  the resulting value; otherwise, the behavior is undefined.
5532 <p><a name="6.5.7p5" href="#6.5.7p5"><small>5</small></a>
5533  The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
5534  or if E1 has a signed type and a nonnegative value, the value of the result is the integral
5535  part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
5536  resulting value is implementation-defined.
5537
5538 <p><small><a href="#Contents">Contents</a></small>
5539 <h4><a name="6.5.8" href="#6.5.8">6.5.8 Relational operators</a></h4>
5540 <p><b>Syntax</b>
5541 <p><a name="6.5.8p1" href="#6.5.8p1"><small>1</small></a>
5542 <pre>
5543           relational-expression:
5544                   shift-expression
5545                   relational-expression   &lt;    shift-expression
5546                   relational-expression   &gt;    shift-expression
5547                   relational-expression   &lt;=   shift-expression
5548                   relational-expression   &gt;=   shift-expression
5549 </pre>
5550 <p><b>Constraints</b>
5551 <p><a name="6.5.8p2" href="#6.5.8p2"><small>2</small></a>
5552  One of the following shall hold:
5553 <ul>
5554 <li>  both operands have real type; or
5555 <li>  both operands are pointers to qualified or unqualified versions of compatible object
5556  types.
5557 </ul>
5558 <p><b>Semantics</b>
5559 <p><a name="6.5.8p3" href="#6.5.8p3"><small>3</small></a>
5560  If both of the operands have arithmetic type, the usual arithmetic conversions are
5561  performed.
5562 <p><a name="6.5.8p4" href="#6.5.8p4"><small>4</small></a>
5563  For the purposes of these operators, a pointer to an object that is not an element of an
5564  array behaves the same as a pointer to the first element of an array of length one with the
5565  type of the object as its element type.
5566 <p><a name="6.5.8p5" href="#6.5.8p5"><small>5</small></a>
5567  When two pointers are compared, the result depends on the relative locations in the
5568  address space of the objects pointed to. If two pointers to object types both point to the
5569  same object, or both point one past the last element of the same array object, they
5570  compare equal. If the objects pointed to are members of the same aggregate object,
5571  pointers to structure members declared later compare greater than pointers to members
5572  declared earlier in the structure, and pointers to array elements with larger subscript
5573  values compare greater than pointers to elements of the same array with lower subscript
5574 <!--page 114 -->
5575  values. All pointers to members of the same union object compare equal. If the
5576  expression P points to an element of an array object and the expression Q points to the
5577  last element of the same array object, the pointer expression Q+1 compares greater than
5578  P. In all other cases, the behavior is undefined.
5579 <p><a name="6.5.8p6" href="#6.5.8p6"><small>6</small></a>
5580  Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
5581  (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is
5582  false.<sup><a href="#note107"><b>107)</b></a></sup> The result has type int.
5583
5584 <p><b>Footnotes</b>
5585 <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
5586  means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
5587 </small>
5588
5589 <p><small><a href="#Contents">Contents</a></small>
5590 <h4><a name="6.5.9" href="#6.5.9">6.5.9 Equality operators</a></h4>
5591 <p><b>Syntax</b>
5592 <p><a name="6.5.9p1" href="#6.5.9p1"><small>1</small></a>
5593 <pre>
5594           equality-expression:
5595                  relational-expression
5596                  equality-expression == relational-expression
5597                  equality-expression != relational-expression
5598 </pre>
5599 <p><b>Constraints</b>
5600 <p><a name="6.5.9p2" href="#6.5.9p2"><small>2</small></a>
5601  One of the following shall hold:
5602 <ul>
5603 <li>  both operands have arithmetic type;
5604 <li>  both operands are pointers to qualified or unqualified versions of compatible types;
5605 <li>  one operand is a pointer to an object type and the other is a pointer to a qualified or
5606  unqualified version of void; or
5607 <li>  one operand is a pointer and the other is a null pointer constant.
5608 </ul>
5609 <p><b>Semantics</b>
5610 <p><a name="6.5.9p3" href="#6.5.9p3"><small>3</small></a>
5611  The == (equal to) and != (not equal to) operators are analogous to the relational
5612  operators except for their lower precedence.<sup><a href="#note108"><b>108)</b></a></sup> Each of the operators yields 1 if the
5613  specified relation is true and 0 if it is false. The result has type int. For any pair of
5614  operands, exactly one of the relations is true.
5615 <p><a name="6.5.9p4" href="#6.5.9p4"><small>4</small></a>
5616  If both of the operands have arithmetic type, the usual arithmetic conversions are
5617  performed. Values of complex types are equal if and only if both their real parts are equal
5618  and also their imaginary parts are equal. Any two values of arithmetic types from
5619  different type domains are equal if and only if the results of their conversions to the
5620  (complex) result type determined by the usual arithmetic conversions are equal.
5621  
5622  
5623  
5624 <!--page 115 -->
5625 <p><a name="6.5.9p5" href="#6.5.9p5"><small>5</small></a>
5626  Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
5627  null pointer constant, the null pointer constant is converted to the type of the pointer. If
5628  one operand is a pointer to an object type and the other is a pointer to a qualified or
5629  unqualified version of void, the former is converted to the type of the latter.
5630 <p><a name="6.5.9p6" href="#6.5.9p6"><small>6</small></a>
5631  Two pointers compare equal if and only if both are null pointers, both are pointers to the
5632  same object (including a pointer to an object and a subobject at its beginning) or function,
5633  both are pointers to one past the last element of the same array object, or one is a pointer
5634  to one past the end of one array object and the other is a pointer to the start of a different
5635  array object that happens to immediately follow the first array object in the address
5636  space.<sup><a href="#note109"><b>109)</b></a></sup>
5637 <p><a name="6.5.9p7" href="#6.5.9p7"><small>7</small></a>
5638  For the purposes of these operators, a pointer to an object that is not an element of an
5639  array behaves the same as a pointer to the first element of an array of length one with the
5640  type of the object as its element type.
5641
5642 <p><b>Footnotes</b>
5643 <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.
5644 </small>
5645 <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
5646  adjacent members of a structure with no padding between them, or because the implementation chose
5647  to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
5648  outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
5649  behavior.
5650 </small>
5651
5652 <p><small><a href="#Contents">Contents</a></small>
5653 <h4><a name="6.5.10" href="#6.5.10">6.5.10 Bitwise AND operator</a></h4>
5654 <p><b>Syntax</b>
5655 <p><a name="6.5.10p1" href="#6.5.10p1"><small>1</small></a>
5656 <pre>
5657           AND-expression:
5658                 equality-expression
5659                 AND-expression &amp; equality-expression
5660 </pre>
5661 <p><b>Constraints</b>
5662 <p><a name="6.5.10p2" href="#6.5.10p2"><small>2</small></a>
5663  Each of the operands shall have integer type.
5664 <p><b>Semantics</b>
5665 <p><a name="6.5.10p3" href="#6.5.10p3"><small>3</small></a>
5666  The usual arithmetic conversions are performed on the operands.
5667 <p><a name="6.5.10p4" href="#6.5.10p4"><small>4</small></a>
5668  The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
5669  the result is set if and only if each of the corresponding bits in the converted operands is
5670  set).
5671  
5672  
5673  
5674  
5675 <!--page 116 -->
5676
5677 <p><small><a href="#Contents">Contents</a></small>
5678 <h4><a name="6.5.11" href="#6.5.11">6.5.11 Bitwise exclusive OR operator</a></h4>
5679 <p><b>Syntax</b>
5680 <p><a name="6.5.11p1" href="#6.5.11p1"><small>1</small></a>
5681 <pre>
5682           exclusive-OR-expression:
5683                   AND-expression
5684                   exclusive-OR-expression ^ AND-expression
5685 </pre>
5686 <p><b>Constraints</b>
5687 <p><a name="6.5.11p2" href="#6.5.11p2"><small>2</small></a>
5688  Each of the operands shall have integer type.
5689 <p><b>Semantics</b>
5690 <p><a name="6.5.11p3" href="#6.5.11p3"><small>3</small></a>
5691  The usual arithmetic conversions are performed on the operands.
5692 <p><a name="6.5.11p4" href="#6.5.11p4"><small>4</small></a>
5693  The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
5694  in the result is set if and only if exactly one of the corresponding bits in the converted
5695  operands is set).
5696
5697 <p><small><a href="#Contents">Contents</a></small>
5698 <h4><a name="6.5.12" href="#6.5.12">6.5.12 Bitwise inclusive OR operator</a></h4>
5699 <p><b>Syntax</b>
5700 <p><a name="6.5.12p1" href="#6.5.12p1"><small>1</small></a>
5701 <pre>
5702           inclusive-OR-expression:
5703                   exclusive-OR-expression
5704                   inclusive-OR-expression | exclusive-OR-expression
5705 </pre>
5706 <p><b>Constraints</b>
5707 <p><a name="6.5.12p2" href="#6.5.12p2"><small>2</small></a>
5708  Each of the operands shall have integer type.
5709 <p><b>Semantics</b>
5710 <p><a name="6.5.12p3" href="#6.5.12p3"><small>3</small></a>
5711  The usual arithmetic conversions are performed on the operands.
5712 <p><a name="6.5.12p4" href="#6.5.12p4"><small>4</small></a>
5713  The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
5714  the result is set if and only if at least one of the corresponding bits in the converted
5715  operands is set).
5716 <!--page 117 -->
5717
5718 <p><small><a href="#Contents">Contents</a></small>
5719 <h4><a name="6.5.13" href="#6.5.13">6.5.13 Logical AND operator</a></h4>
5720 <p><b>Syntax</b>
5721 <p><a name="6.5.13p1" href="#6.5.13p1"><small>1</small></a>
5722 <pre>
5723            logical-AND-expression:
5724                    inclusive-OR-expression
5725                    logical-AND-expression &amp;&amp; inclusive-OR-expression
5726 </pre>
5727 <p><b>Constraints</b>
5728 <p><a name="6.5.13p2" href="#6.5.13p2"><small>2</small></a>
5729  Each of the operands shall have scalar type.
5730 <p><b>Semantics</b>
5731 <p><a name="6.5.13p3" href="#6.5.13p3"><small>3</small></a>
5732  The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
5733  yields 0. The result has type int.
5734 <p><a name="6.5.13p4" href="#6.5.13p4"><small>4</small></a>
5735  Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
5736  if the second operand is evaluated, there is a sequence point between the evaluations of
5737  the first and second operands. If the first operand compares equal to 0, the second
5738  operand is not evaluated.
5739
5740 <p><small><a href="#Contents">Contents</a></small>
5741 <h4><a name="6.5.14" href="#6.5.14">6.5.14 Logical OR operator</a></h4>
5742 <p><b>Syntax</b>
5743 <p><a name="6.5.14p1" href="#6.5.14p1"><small>1</small></a>
5744 <pre>
5745            logical-OR-expression:
5746                    logical-AND-expression
5747                    logical-OR-expression || logical-AND-expression
5748 </pre>
5749 <p><b>Constraints</b>
5750 <p><a name="6.5.14p2" href="#6.5.14p2"><small>2</small></a>
5751  Each of the operands shall have scalar type.
5752 <p><b>Semantics</b>
5753 <p><a name="6.5.14p3" href="#6.5.14p3"><small>3</small></a>
5754  The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
5755  yields 0. The result has type int.
5756 <p><a name="6.5.14p4" href="#6.5.14p4"><small>4</small></a>
5757  Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; if the
5758  second operand is evaluated, there is a sequence point between the evaluations of the first
5759  and second operands. If the first operand compares unequal to 0, the second operand is
5760  not evaluated.
5761 <!--page 118 -->
5762
5763 <p><small><a href="#Contents">Contents</a></small>
5764 <h4><a name="6.5.15" href="#6.5.15">6.5.15 Conditional operator</a></h4>
5765 <p><b>Syntax</b>
5766 <p><a name="6.5.15p1" href="#6.5.15p1"><small>1</small></a>
5767 <pre>
5768           conditional-expression:
5769                  logical-OR-expression
5770                  logical-OR-expression ? expression : conditional-expression
5771 </pre>
5772 <p><b>Constraints</b>
5773 <p><a name="6.5.15p2" href="#6.5.15p2"><small>2</small></a>
5774  The first operand shall have scalar type.
5775 <p><a name="6.5.15p3" href="#6.5.15p3"><small>3</small></a>
5776  One of the following shall hold for the second and third operands:
5777 <ul>
5778 <li>  both operands have arithmetic type;
5779 <li>  both operands have the same structure or union type;
5780 <li>  both operands have void type;
5781 <li>  both operands are pointers to qualified or unqualified versions of compatible types;
5782 <li>  one operand is a pointer and the other is a null pointer constant; or
5783 <li>  one operand is a pointer to an object type and the other is a pointer to a qualified or
5784  unqualified version of void.
5785 </ul>
5786 <p><b>Semantics</b>
5787 <p><a name="6.5.15p4" href="#6.5.15p4"><small>4</small></a>
5788  The first operand is evaluated; there is a sequence point between its evaluation and the
5789  evaluation of the second or third operand (whichever is evaluated). The second operand
5790  is evaluated only if the first compares unequal to 0; the third operand is evaluated only if
5791  the first compares equal to 0; the result is the value of the second or third operand
5792  (whichever is evaluated), converted to the type described below.<sup><a href="#note110"><b>110)</b></a></sup>
5793 <p><a name="6.5.15p5" href="#6.5.15p5"><small>5</small></a>
5794  If both the second and third operands have arithmetic type, the result type that would be
5795  determined by the usual arithmetic conversions, were they applied to those two operands,
5796  is the type of the result. If both the operands have structure or union type, the result has
5797  that type. If both operands have void type, the result has void type.
5798 <p><a name="6.5.15p6" href="#6.5.15p6"><small>6</small></a>
5799  If both the second and third operands are pointers or one is a null pointer constant and the
5800  other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
5801  of the types referenced by both operands. Furthermore, if both operands are pointers to
5802  compatible types or to differently qualified versions of compatible types, the result type is
5803  a pointer to an appropriately qualified version of the composite type; if one operand is a
5804  null pointer constant, the result has the type of the other operand; otherwise, one operand
5805  is a pointer to void or a qualified version of void, in which case the result type is a
5806  pointer to an appropriately qualified version of void.
5807  
5808 <!--page 119 -->
5809 <p><a name="6.5.15p7" href="#6.5.15p7"><small>7</small></a>
5810  EXAMPLE The common type that results when the second and third operands are pointers is determined
5811  in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
5812  pointers have compatible types.
5813 <p><a name="6.5.15p8" href="#6.5.15p8"><small>8</small></a>
5814  Given the declarations
5815 <pre>
5816            const void *c_vp;
5817            void *vp;
5818            const int *c_ip;
5819            volatile int *v_ip;
5820            int *ip;
5821            const char *c_cp;
5822 </pre>
5823  the third column in the following table is the common type that is the result of a conditional expression in
5824  which the first two columns are the second and third operands (in either order):
5825 <pre>
5826            c_vp    c_ip      const void *
5827            v_ip    0         volatile int *
5828            c_ip    v_ip      const volatile int *
5829            vp      c_cp      const void *
5830            ip      c_ip      const int *
5831            vp      ip        void *
5832 </pre>
5833  
5834
5835 <p><b>Footnotes</b>
5836 <p><small><a name="note110" href="#note110">110)</a> A conditional expression does not yield an lvalue.
5837 </small>
5838
5839 <p><small><a href="#Contents">Contents</a></small>
5840 <h4><a name="6.5.16" href="#6.5.16">6.5.16 Assignment operators</a></h4>
5841 <p><b>Syntax</b>
5842 <p><a name="6.5.16p1" href="#6.5.16p1"><small>1</small></a>
5843 <pre>
5844           assignment-expression:
5845                  conditional-expression
5846                  unary-expression assignment-operator assignment-expression
5847           assignment-operator: one of
5848                  = *= /= %= +=                       -=     &lt;&lt;=      &gt;&gt;=      &amp;=     ^=     |=
5849 </pre>
5850 <p><b>Constraints</b>
5851 <p><a name="6.5.16p2" href="#6.5.16p2"><small>2</small></a>
5852  An assignment operator shall have a modifiable lvalue as its left operand.
5853 <p><b>Semantics</b>
5854 <p><a name="6.5.16p3" href="#6.5.16p3"><small>3</small></a>
5855  An assignment operator stores a value in the object designated by the left operand. An
5856  assignment expression has the value of the left operand after the assignment,<sup><a href="#note111"><b>111)</b></a></sup> but is not
5857  an lvalue. The type of an assignment expression is the type the left operand would have
5858  after lvalue conversion. The side effect of updating the stored value of the left operand is
5859  sequenced after the value computations of the left and right operands. The evaluations of
5860  the operands are unsequenced.
5861  
5862  
5863  
5864  
5865 <!--page 120 -->
5866
5867 <p><b>Footnotes</b>
5868 <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
5869  when the object has volatile-qualified type.
5870 </small>
5871
5872 <p><small><a href="#Contents">Contents</a></small>
5873 <h5><a name="6.5.16.1" href="#6.5.16.1">6.5.16.1 Simple assignment</a></h5>
5874 <p><b>Constraints</b>
5875 <p><a name="6.5.16.1p1" href="#6.5.16.1p1"><small>1</small></a>
5876  One of the following shall hold:<sup><a href="#note112"><b>112)</b></a></sup>
5877 <ul>
5878 <li>  the left operand has atomic, qualified, or unqualified arithmetic type, and the right has
5879  arithmetic type;
5880 <li>  the left operand has an atomic, qualified, or unqualified version of a structure or union
5881  type compatible with the type of the right;
5882 <li>  the left operand has atomic, qualified, or unqualified pointer type, and (considering
5883  the type the left operand would have after lvalue conversion) both operands are
5884  pointers to qualified or unqualified versions of compatible types, and the type pointed
5885  to by the left has all the qualifiers of the type pointed to by the right;
5886 <li>  the left operand has atomic, qualified, or unqualified pointer type, and (considering
5887  the type the left operand would have after lvalue conversion) one operand is a pointer
5888  to an object type, and the other is a pointer to a qualified or unqualified version of
5889  void, and the type pointed to by the left has all the qualifiers of the type pointed to
5890  by the right;
5891 <li>  the left operand is an atomic, qualified, or unqualified pointer, and the right is a null
5892  pointer constant; or
5893 <li>  the left operand has type atomic, qualified, or unqualified _Bool, and the right is a
5894  pointer.
5895 </ul>
5896 <p><b>Semantics</b>
5897 <p><a name="6.5.16.1p2" href="#6.5.16.1p2"><small>2</small></a>
5898  In simple assignment (=), the value of the right operand is converted to the type of the
5899  assignment expression and replaces the value stored in the object designated by the left
5900  operand.
5901 <p><a name="6.5.16.1p3" href="#6.5.16.1p3"><small>3</small></a>
5902  If the value being stored in an object is read from another object that overlaps in any way
5903  the storage of the first object, then the overlap shall be exact and the two objects shall
5904  have qualified or unqualified versions of a compatible type; otherwise, the behavior is
5905  undefined.
5906 <p><a name="6.5.16.1p4" href="#6.5.16.1p4"><small>4</small></a>
5907  EXAMPLE 1       In the program fragment
5908  
5909  
5910  
5911  
5912 <!--page 121 -->
5913 <pre>
5914          int f(void);
5915          char c;
5916          /* ... */
5917          if ((c = f()) == -1)
5918                  /* ... */
5919 </pre>
5920  the int value returned by the function may be truncated when stored in the char, and then converted back
5921  to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
5922  values as unsigned char (and char is narrower than int), the result of the conversion cannot be
5923  negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
5924  variable c should be declared as int.
5925  
5926 <p><a name="6.5.16.1p5" href="#6.5.16.1p5"><small>5</small></a>
5927  EXAMPLE 2       In the fragment:
5928 <pre>
5929          char c;
5930          int i;
5931          long l;
5932          l = (c = i);
5933 </pre>
5934  the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
5935  of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
5936  that is, long int type.
5937  
5938 <p><a name="6.5.16.1p6" href="#6.5.16.1p6"><small>6</small></a>
5939  EXAMPLE 3       Consider the fragment:
5940 <pre>
5941          const char **cpp;
5942          char *p;
5943          const char c = 'A';
5944          cpp = &amp;p;                  // constraint violation
5945          *cpp = &amp;c;                 // valid
5946          *p = 0;                    // valid
5947 </pre>
5948  The first assignment is unsafe because it would allow the following valid code to attempt to change the
5949  value of the const object c.
5950  
5951
5952 <p><b>Footnotes</b>
5953 <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
5954  (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
5955  qualifiers that were applied to the type category of the expression (for example, it removes const but
5956  not volatile from the type int volatile * const).
5957 </small>
5958
5959 <p><small><a href="#Contents">Contents</a></small>
5960 <h5><a name="6.5.16.2" href="#6.5.16.2">6.5.16.2 Compound assignment</a></h5>
5961 <p><b>Constraints</b>
5962 <p><a name="6.5.16.2p1" href="#6.5.16.2p1"><small>1</small></a>
5963  For the operators += and -= only, either the left operand shall be an atomic, qualified, or
5964  unqualified pointer to a complete object type, and the right shall have integer type; or the
5965  left operand shall have atomic, qualified, or unqualified arithmetic type, and the right
5966  shall have arithmetic type.
5967 <p><a name="6.5.16.2p2" href="#6.5.16.2p2"><small>2</small></a>
5968  For the other operators, the left operand shall have atomic, qualified, or unqualified
5969  arithmetic type, and (considering the type the left operand would have after lvalue
5970  conversion) each operand shall have arithmetic type consistent with those allowed by the
5971  corresponding binary operator.
5972 <p><b>Semantics</b>
5973 <p><a name="6.5.16.2p3" href="#6.5.16.2p3"><small>3</small></a>
5974  A compound assignment of the form E1 op = E2 is equivalent to the simple assignment
5975  expression E1 = E1 op (E2), except that the lvalue E1 is evaluated only once, and with
5976  respect to an indeterminately-sequenced function call, the operation of a compound
5977 <!--page 122 -->
5978  assignment is a single evaluation. If E1 has an atomic type, compound assignment is a
5979  read-modify-write operation with memory_order_seq_cst memory order
5980  semantics.<sup><a href="#note113"><b>113)</b></a></sup>
5981  
5982  
5983  
5984  
5985 <!--page 123 -->
5986
5987 <p><b>Footnotes</b>
5988 <p><small><a name="note113" href="#note113">113)</a> Where a pointer to an atomic object can be formed and E1 and E2 have integer type, this is equivalent
5989  to the following code sequence where T1 is the type of E1 and T2 is the type of E2:
5990
5991 <pre>
5992            T1 *addr = &amp;E1;
5993            T2 val = (E2);
5994            T1 old = *addr;
5995            T1 new;
5996            do {
5997                  new = old op val;
5998            } while (!atomic_compare_exchange_strong(addr, &amp;old, new));
5999 </pre>
6000   with new being the result of the operation.
6001   If E1 or E2 has floating type, then exceptional conditions or floating-point exceptions encountered
6002   during discarded evaluations of new should also be discarded in order to satisfy the equivalence of E1
6003   op = E2 and E1 = E1 op (E2). For example, if <a href="#F">annex F</a> is in effect, the floating types involved have
6004   IEC 60559 formats, and FLT_EVAL_METHOD is 0, the equivalent code would be:
6005
6006 <pre>
6007            #include <a href="#7.6">&lt;fenv.h&gt;</a>
6008            #pragma STDC FENV_ACCESS ON
6009            /* ... */
6010                    fenv_t fenv;
6011                    T1 *addr = &amp;E1;
6012                    T2 val = E2;
6013                    T1 old = *addr;
6014                    T1 new;
6015                    feholdexcept(&amp;fenv);
6016                    for (;;) {
6017                          new = old op val;
6018                          if (atomic_compare_exchange_strong(addr, &amp;old, new))
6019                                      break;
6020                          feclearexcept(FE_ALL_EXCEPT);
6021                    }
6022                    feupdateenv(&amp;fenv);
6023 </pre>
6024   If FLT_EVAL_METHOD is not 0, then T2 must be a type with the range and precision to which E2 is
6025   evaluated in order to satisfy the equivalence.
6026 </small>
6027
6028 <p><small><a href="#Contents">Contents</a></small>
6029 <h4><a name="6.5.17" href="#6.5.17">6.5.17 Comma operator</a></h4>
6030 <p><b>Syntax</b>
6031 <p><a name="6.5.17p1" href="#6.5.17p1"><small>1</small></a>
6032 <pre>
6033           expression:
6034                  assignment-expression
6035                  expression , assignment-expression
6036 </pre>
6037 <p><b>Semantics</b>
6038 <p><a name="6.5.17p2" href="#6.5.17p2"><small>2</small></a>
6039  The left operand of a comma operator is evaluated as a void expression; there is a
6040  sequence point between its evaluation and that of the right operand. Then the right
6041  operand is evaluated; the result has its type and value.<sup><a href="#note114"><b>114)</b></a></sup>
6042 <p><a name="6.5.17p3" href="#6.5.17p3"><small>3</small></a>
6043  EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
6044  appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
6045  of initializers). On the other hand, it can be used within a parenthesized expression or within the second
6046  expression of a conditional operator in such contexts. In the function call
6047 <pre>
6048            f(a, (t=3, t+2), c)
6049 </pre>
6050  the function has three arguments, the second of which has the value 5.
6051  
6052 <p><b> Forward references</b>: initialization (<a href="#6.7.9">6.7.9</a>).
6053  
6054  
6055  
6056  
6057 <!--page 124 -->
6058
6059 <p><b>Footnotes</b>
6060 <p><small><a name="note114" href="#note114">114)</a> A comma operator does not yield an lvalue.
6061 </small>
6062
6063 <p><small><a href="#Contents">Contents</a></small>
6064 <h3><a name="6.6" href="#6.6">6.6 Constant expressions</a></h3>
6065 <p><b>Syntax</b>
6066 <p><a name="6.6p1" href="#6.6p1"><small>1</small></a>
6067 <pre>
6068           constant-expression:
6069                  conditional-expression
6070 </pre>
6071 <p><b>Description</b>
6072 <p><a name="6.6p2" href="#6.6p2"><small>2</small></a>
6073  A constant expression can be evaluated during translation rather than runtime, and
6074  accordingly may be used in any place that a constant may be.
6075 <p><b>Constraints</b>
6076 <p><a name="6.6p3" href="#6.6p3"><small>3</small></a>
6077  Constant expressions shall not contain assignment, increment, decrement, function-call,
6078  or comma operators, except when they are contained within a subexpression that is not
6079  evaluated.<sup><a href="#note115"><b>115)</b></a></sup>
6080 <p><a name="6.6p4" href="#6.6p4"><small>4</small></a>
6081  Each constant expression shall evaluate to a constant that is in the range of representable
6082  values for its type.
6083 <p><b>Semantics</b>
6084 <p><a name="6.6p5" href="#6.6p5"><small>5</small></a>
6085  An expression that evaluates to a constant is required in several contexts. If a floating
6086  expression is evaluated in the translation environment, the arithmetic range and precision
6087  shall be at least as great as if the expression were being evaluated in the execution
6088  environment.<sup><a href="#note116"><b>116)</b></a></sup>
6089 <p><a name="6.6p6" href="#6.6p6"><small>6</small></a>
6090  An integer constant expression<sup><a href="#note117"><b>117)</b></a></sup> shall have integer type and shall only have operands
6091  that are integer constants, enumeration constants, character constants, sizeof
6092  expressions whose results are integer constants, _Alignof expressions, and floating
6093  constants that are the immediate operands of casts. Cast operators in an integer constant
6094  expression shall only convert arithmetic types to integer types, except as part of an
6095  operand to the sizeof or _Alignof operator.
6096 <p><a name="6.6p7" href="#6.6p7"><small>7</small></a>
6097  More latitude is permitted for constant expressions in initializers. Such a constant
6098  expression shall be, or evaluate to, one of the following:
6099 <ul>
6100 <li>  an arithmetic constant expression,
6101  
6102  
6103  
6104 <!--page 125 -->
6105 <li>  a null pointer constant,
6106 <li>  an address constant, or
6107 <li>  an address constant for a complete object type plus or minus an integer constant
6108  expression.
6109 </ul>
6110 <p><a name="6.6p8" href="#6.6p8"><small>8</small></a>
6111  An arithmetic constant expression shall have arithmetic type and shall only have
6112  operands that are integer constants, floating constants, enumeration constants, character
6113  constants, sizeof expressions whose results are integer constants, and _Alignof
6114  expressions. Cast operators in an arithmetic constant expression shall only convert
6115  arithmetic types to arithmetic types, except as part of an operand to a sizeof or
6116  _Alignof operator.
6117 <p><a name="6.6p9" href="#6.6p9"><small>9</small></a>
6118  An address constant is a null pointer, a pointer to an lvalue designating an object of static
6119  storage duration, or a pointer to a function designator; it shall be created explicitly using
6120  the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
6121  an expression of array or function type. The array-subscript [] and member-access .
6122  and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
6123  be used in the creation of an address constant, but the value of an object shall not be
6124  accessed by use of these operators.
6125 <p><a name="6.6p10" href="#6.6p10"><small>10</small></a>
6126  An implementation may accept other forms of constant expressions.
6127 <p><a name="6.6p11" href="#6.6p11"><small>11</small></a>
6128  The semantic rules for the evaluation of a constant expression are the same as for
6129  nonconstant expressions.<sup><a href="#note118"><b>118)</b></a></sup>
6130 <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>).
6131  
6132  
6133  
6134  
6135 <!--page 126 -->
6136
6137 <p><b>Footnotes</b>
6138 <p><small><a name="note115" href="#note115">115)</a> The operand of a sizeof or _Alignof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
6139 </small>
6140 <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
6141  the translation environment.
6142 </small>
6143 <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
6144  member of a structure, the value of an enumeration constant, and the size of a non-variable length
6145  array. Further constraints that apply to the integer constant expressions used in conditional-inclusion
6146  preprocessing directives are discussed in <a href="#6.10.1">6.10.1</a>.
6147 </small>
6148 <p><small><a name="note118" href="#note118">118)</a> Thus, in the following initialization,
6149
6150 <pre>
6151             static int i = 2 || 1 / 0;
6152 </pre>
6153    the expression is a valid integer constant expression with value one.
6154 </small>
6155
6156 <p><small><a href="#Contents">Contents</a></small>
6157 <h3><a name="6.7" href="#6.7">6.7 Declarations</a></h3>
6158 <p><b>Syntax</b>
6159 <p><a name="6.7p1" href="#6.7p1"><small>1</small></a>
6160 <pre>
6161           declaration:
6162                  declaration-specifiers init-declarator-list<sub>opt</sub> ;
6163                  static_assert-declaration
6164           declaration-specifiers:
6165                  storage-class-specifier declaration-specifiers<sub>opt</sub>
6166                  type-specifier declaration-specifiers<sub>opt</sub>
6167                  type-qualifier declaration-specifiers<sub>opt</sub>
6168                  function-specifier declaration-specifiers<sub>opt</sub>
6169                  alignment-specifier declaration-specifiers<sub>opt</sub>
6170           init-declarator-list:
6171                   init-declarator
6172                   init-declarator-list , init-declarator
6173           init-declarator:
6174                   declarator
6175                   declarator = initializer
6176 </pre>
6177 <p><b>Constraints</b>
6178 <p><a name="6.7p2" href="#6.7p2"><small>2</small></a>
6179  A declaration other than a static_assert declaration shall declare at least a declarator
6180  (other than the parameters of a function or the members of a structure or union), a tag, or
6181  the members of an enumeration.
6182 <p><a name="6.7p3" href="#6.7p3"><small>3</small></a>
6183  If an identifier has no linkage, there shall be no more than one declaration of the identifier
6184  (in a declarator or type specifier) with the same scope and in the same name space, except
6185  that:
6186 <ul>
6187 <li>  a typedef name may be redefined to denote the same type as it currently does,
6188  provided that type is not a variably modified type;
6189 <li>  tags may be redeclared as specified in <a href="#6.7.2.3">6.7.2.3</a>.
6190 </ul>
6191 <p><a name="6.7p4" href="#6.7p4"><small>4</small></a>
6192  All declarations in the same scope that refer to the same object or function shall specify
6193  compatible types.
6194 <p><b>Semantics</b>
6195 <p><a name="6.7p5" href="#6.7p5"><small>5</small></a>
6196  A declaration specifies the interpretation and attributes of a set of identifiers. A definition
6197  of an identifier is a declaration for that identifier that:
6198 <ul>
6199 <li>  for an object, causes storage to be reserved for that object;
6200 <li>  for a function, includes the function body;<sup><a href="#note119"><b>119)</b></a></sup>
6201 <!--page 127 -->
6202 <li>  for an enumeration constant, is the (only) declaration of the identifier;
6203 <li>  for a typedef name, is the first (or only) declaration of the identifier.
6204 </ul>
6205 <p><a name="6.7p6" href="#6.7p6"><small>6</small></a>
6206  The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
6207  storage duration, and part of the type of the entities that the declarators denote. The init-
6208  declarator-list is a comma-separated sequence of declarators, each of which may have
6209  additional type information, or an initializer, or both. The declarators contain the
6210  identifiers (if any) being declared.
6211 <p><a name="6.7p7" href="#6.7p7"><small>7</small></a>
6212  If an identifier for an object is declared with no linkage, the type for the object shall be
6213  complete by the end of its declarator, or by the end of its init-declarator if it has an
6214  initializer; in the case of function parameters (including in prototypes), it is the adjusted
6215  type (see <a href="#6.7.6.3">6.7.6.3</a>) that is required to be complete.
6216 <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
6217  (<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>).
6218
6219 <p><b>Footnotes</b>
6220 <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>.
6221 </small>
6222
6223 <p><small><a href="#Contents">Contents</a></small>
6224 <h4><a name="6.7.1" href="#6.7.1">6.7.1 Storage-class specifiers</a></h4>
6225 <p><b>Syntax</b>
6226 <p><a name="6.7.1p1" href="#6.7.1p1"><small>1</small></a>
6227 <pre>
6228           storage-class-specifier:
6229                  typedef
6230                  extern
6231                  static
6232                  _Thread_local
6233                  auto
6234                  register
6235 </pre>
6236 <p><b>Constraints</b>
6237 <p><a name="6.7.1p2" href="#6.7.1p2"><small>2</small></a>
6238  At most, one storage-class specifier may be given in the declaration specifiers in a
6239  declaration, except that _Thread_local may appear with static or extern.<sup><a href="#note120"><b>120)</b></a></sup>
6240 <p><a name="6.7.1p3" href="#6.7.1p3"><small>3</small></a>
6241  In the declaration of an object with block scope, if the declaration specifiers include
6242  _Thread_local, they shall also include either static or extern. If
6243  _Thread_local appears in any declaration of an object, it shall be present in every
6244  declaration of that object.
6245 <p><a name="6.7.1p4" href="#6.7.1p4"><small>4</small></a>
6246  _Thread_local shall not appear in the declaration specifiers of a function declaration.
6247  
6248  
6249  
6250  
6251 <!--page 128 -->
6252 <p><b>Semantics</b>
6253 <p><a name="6.7.1p5" href="#6.7.1p5"><small>5</small></a>
6254  The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
6255  only; it is discussed in <a href="#6.7.8">6.7.8</a>. The meanings of the various linkages and storage durations
6256  were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
6257 <p><a name="6.7.1p6" href="#6.7.1p6"><small>6</small></a>
6258  A declaration of an identifier for an object with storage-class specifier register
6259  suggests that access to the object be as fast as possible. The extent to which such
6260  suggestions are effective is implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
6261 <p><a name="6.7.1p7" href="#6.7.1p7"><small>7</small></a>
6262  The declaration of an identifier for a function that has block scope shall have no explicit
6263  storage-class specifier other than extern.
6264 <p><a name="6.7.1p8" href="#6.7.1p8"><small>8</small></a>
6265  If an aggregate or union object is declared with a storage-class specifier other than
6266  typedef, the properties resulting from the storage-class specifier, except with respect to
6267  linkage, also apply to the members of the object, and so on recursively for any aggregate
6268  or union member objects.
6269 <p><b> Forward references</b>: type definitions (<a href="#6.7.8">6.7.8</a>).
6270  
6271  
6272  
6273  
6274 <!--page 129 -->
6275
6276 <p><b>Footnotes</b>
6277 <p><small><a name="note120" href="#note120">120)</a> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
6278 </small>
6279 <p><small><a name="note121" href="#note121">121)</a> The implementation may treat any register declaration simply as an auto declaration. However,
6280  whether or not addressable storage is actually used, the address of any part of an object declared with
6281  storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
6282  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
6283  <a href="#6.3.2.1">6.3.2.1</a>). Thus, the only operators that can be applied to an array declared with storage-class specifier
6284  register are sizeof and _Alignof.
6285 </small>
6286
6287 <p><small><a href="#Contents">Contents</a></small>
6288 <h4><a name="6.7.2" href="#6.7.2">6.7.2 Type specifiers</a></h4>
6289 <p><b>Syntax</b>
6290 <p><a name="6.7.2p1" href="#6.7.2p1"><small>1</small></a>
6291 <pre>
6292           type-specifier:
6293                  void
6294                  char
6295                  short
6296                  int
6297                  long
6298                  float
6299                  double
6300                  signed
6301                  unsigned
6302                  _Bool
6303                  _Complex
6304                  atomic-type-specifier
6305                  struct-or-union-specifier
6306                  enum-specifier
6307                  typedef-name
6308 </pre>
6309 <p><b>Constraints</b>
6310 <p><a name="6.7.2p2" href="#6.7.2p2"><small>2</small></a>
6311  At least one type specifier shall be given in the declaration specifiers in each declaration,
6312  and in the specifier-qualifier list in each struct declaration and type name. Each list of
6313  type specifiers shall be one of the following multisets (delimited by commas, when there
6314  is more than one multiset per item); the type specifiers may occur in any order, possibly
6315  intermixed with the other declaration specifiers.
6316 <ul>
6317 <li>  void
6318 <li>  char
6319 <li>  signed char
6320 <li>  unsigned char
6321 <li>  short, signed short, short int, or signed short int
6322 <li>  unsigned short, or unsigned short int
6323 <li>  int, signed, or signed int
6324 <li>  unsigned, or unsigned int
6325 <li>  long, signed long, long int, or signed long int
6326 <li>  unsigned long, or unsigned long int
6327 <!--page 130 -->
6328 <li>  long long, signed long long, long long int, or
6329  signed long long int
6330 <li>  unsigned long long, or unsigned long long int
6331 <li>  float
6332 <li>  double
6333 <li>  long double
6334 <li>  _Bool
6335 <li>  float _Complex
6336 <li>  double _Complex
6337 <li>  long double _Complex
6338 <li>  atomic type specifier
6339 <li>  struct or union specifier
6340 <li>  enum specifier
6341 <li>  typedef name
6342 </ul>
6343 <p><a name="6.7.2p3" href="#6.7.2p3"><small>3</small></a>
6344  The type specifier _Complex shall not be used if the implementation does not support
6345  complex types (see <a href="#6.10.8.3">6.10.8.3</a>).
6346 <p><b>Semantics</b>
6347 <p><a name="6.7.2p4" href="#6.7.2p4"><small>4</small></a>
6348  Specifiers for structures, unions, enumerations, and atomic types are discussed in <a href="#6.7.2.1">6.7.2.1</a>
6349  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
6350  characteristics of the other types are discussed in <a href="#6.2.5">6.2.5</a>.
6351 <p><a name="6.7.2p5" href="#6.7.2p5"><small>5</small></a>
6352  Each of the comma-separated multisets designates the same type, except that for bit-
6353  fields, it is implementation-defined whether the specifier int designates the same type as
6354  signed int or the same type as unsigned int.
6355 <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>),
6356  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>).
6357
6358 <p><small><a href="#Contents">Contents</a></small>
6359 <h5><a name="6.7.2.1" href="#6.7.2.1">6.7.2.1 Structure and union specifiers</a></h5>
6360 <p><b>Syntax</b>
6361 <p><a name="6.7.2.1p1" href="#6.7.2.1p1"><small>1</small></a>
6362 <!--page 131 -->
6363 <pre>
6364           struct-or-union-specifier:
6365                   struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
6366                   struct-or-union identifier
6367          struct-or-union:
6368                  struct
6369                  union
6370          struct-declaration-list:
6371                  struct-declaration
6372                  struct-declaration-list struct-declaration
6373          struct-declaration:
6374                  specifier-qualifier-list struct-declarator-list<sub>opt</sub> ;
6375                  static_assert-declaration
6376          specifier-qualifier-list:
6377                 type-specifier specifier-qualifier-list<sub>opt</sub>
6378                 type-qualifier specifier-qualifier-list<sub>opt</sub>
6379          struct-declarator-list:
6380                  struct-declarator
6381                  struct-declarator-list , struct-declarator
6382          struct-declarator:
6383                  declarator
6384                  declarator<sub>opt</sub> : constant-expression
6385 </pre>
6386 <p><b>Constraints</b>
6387 <p><a name="6.7.2.1p2" href="#6.7.2.1p2"><small>2</small></a>
6388  A struct-declaration that does not declare an anonymous structure or anonymous union
6389  shall contain a struct-declarator-list.
6390 <p><a name="6.7.2.1p3" href="#6.7.2.1p3"><small>3</small></a>
6391  A structure or union shall not contain a member with incomplete or function type (hence,
6392  a structure shall not contain an instance of itself, but may contain a pointer to an instance
6393  of itself), except that the last member of a structure with more than one named member
6394  may have incomplete array type; such a structure (and any union containing, possibly
6395  recursively, a member that is such a structure) shall not be a member of a structure or an
6396  element of an array.
6397 <p><a name="6.7.2.1p4" href="#6.7.2.1p4"><small>4</small></a>
6398  The expression that specifies the width of a bit-field shall be an integer constant
6399  expression with a nonnegative value that does not exceed the width of an object of the
6400  type that would be specified were the colon and expression omitted.<sup><a href="#note122"><b>122)</b></a></sup> If the value is
6401  zero, the declaration shall have no declarator.
6402 <p><a name="6.7.2.1p5" href="#6.7.2.1p5"><small>5</small></a>
6403  A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
6404  int, unsigned int, or some other implementation-defined type. It is
6405  implementation-defined whether atomic types are permitted.
6406  
6407 <!--page 132 -->
6408 <p><b>Semantics</b>
6409 <p><a name="6.7.2.1p6" href="#6.7.2.1p6"><small>6</small></a>
6410  As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
6411  storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
6412  of members whose storage overlap.
6413 <p><a name="6.7.2.1p7" href="#6.7.2.1p7"><small>7</small></a>
6414  Structure and union specifiers have the same form. The keywords struct and union
6415  indicate that the type being specified is, respectively, a structure type or a union type.
6416 <p><a name="6.7.2.1p8" href="#6.7.2.1p8"><small>8</small></a>
6417  The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
6418  within a translation unit. The struct-declaration-list is a sequence of declarations for the
6419  members of the structure or union. If the struct-declaration-list does not contain any
6420  named members, either directly or via an anonymous structure or anonymous union, the
6421  behavior is undefined. The type is incomplete until immediately after the } that
6422  terminates the list, and complete thereafter.
6423 <p><a name="6.7.2.1p9" href="#6.7.2.1p9"><small>9</small></a>
6424  A member of a structure or union may have any complete object type other than a
6425  variably modified type.<sup><a href="#note123"><b>123)</b></a></sup> In addition, a member may be declared to consist of a
6426  specified number of bits (including a sign bit, if any). Such a member is called a
6427  bit-field;<sup><a href="#note124"><b>124)</b></a></sup> its width is preceded by a colon.
6428 <p><a name="6.7.2.1p10" href="#6.7.2.1p10"><small>10</small></a>
6429  A bit-field is interpreted as having a signed or unsigned integer type consisting of the
6430  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
6431  type _Bool, the value of the bit-field shall compare equal to the value stored; a _Bool
6432  bit-field has the semantics of a _Bool.
6433 <p><a name="6.7.2.1p11" href="#6.7.2.1p11"><small>11</small></a>
6434  An implementation may allocate any addressable storage unit large enough to hold a bit-
6435  field. If enough space remains, a bit-field that immediately follows another bit-field in a
6436  structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
6437  whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
6438  implementation-defined. The order of allocation of bit-fields within a unit (high-order to
6439  low-order or low-order to high-order) is implementation-defined. The alignment of the
6440  addressable storage unit is unspecified.
6441 <p><a name="6.7.2.1p12" href="#6.7.2.1p12"><small>12</small></a>
6442  A bit-field declaration with no declarator, but only a colon and a width, indicates an
6443  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
6444  
6445  
6446 <!--page 133 -->
6447  indicates that no further bit-field is to be packed into the unit in which the previous bit-
6448  field, if any, was placed.
6449 <p><a name="6.7.2.1p13" href="#6.7.2.1p13"><small>13</small></a>
6450  An unnamed member whose type specifier is a structure specifier with no tag is called an
6451  anonymous structure; an unnamed member whose type specifier is a union specifier with
6452  no tag is called an anonymous union. The members of an anonymous structure or union
6453  are considered to be members of the containing structure or union. This applies
6454  recursively if the containing structure or union is also anonymous.
6455 <p><a name="6.7.2.1p14" href="#6.7.2.1p14"><small>14</small></a>
6456  Each non-bit-field member of a structure or union object is aligned in an implementation-
6457  defined manner appropriate to its type.
6458 <p><a name="6.7.2.1p15" href="#6.7.2.1p15"><small>15</small></a>
6459  Within a structure object, the non-bit-field members and the units in which bit-fields
6460  reside have addresses that increase in the order in which they are declared. A pointer to a
6461  structure object, suitably converted, points to its initial member (or if that member is a
6462  bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
6463  padding within a structure object, but not at its beginning.
6464 <p><a name="6.7.2.1p16" href="#6.7.2.1p16"><small>16</small></a>
6465  The size of a union is sufficient to contain the largest of its members. The value of at
6466  most one of the members can be stored in a union object at any time. A pointer to a
6467  union object, suitably converted, points to each of its members (or if a member is a bit-
6468  field, then to the unit in which it resides), and vice versa.
6469 <p><a name="6.7.2.1p17" href="#6.7.2.1p17"><small>17</small></a>
6470  There may be unnamed padding at the end of a structure or union.
6471 <p><a name="6.7.2.1p18" href="#6.7.2.1p18"><small>18</small></a>
6472  As a special case, the last element of a structure with more than one named member may
6473  have an incomplete array type; this is called a flexible array member. In most situations,
6474  the flexible array member is ignored. In particular, the size of the structure is as if the
6475  flexible array member were omitted except that it may have more trailing padding than
6476  the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
6477  (a pointer to) a structure with a flexible array member and the right operand names that
6478  member, it behaves as if that member were replaced with the longest array (with the same
6479  element type) that would not make the structure larger than the object being accessed; the
6480  offset of the array shall remain that of the flexible array member, even if this would differ
6481  from that of the replacement array. If this array would have no elements, it behaves as if
6482  it had one element but the behavior is undefined if any attempt is made to access that
6483  element or to generate a pointer one past it.
6484 <p><a name="6.7.2.1p19" href="#6.7.2.1p19"><small>19</small></a>
6485  EXAMPLE 1    The following illustrates anonymous structures and unions:
6486 <!--page 134 -->
6487 <pre>
6488          struct v {
6489                union {      // anonymous union
6490                       struct { int i, j; };    // anonymous structure
6491                       struct { long k, l; } w;
6492                };
6493                int m;
6494          } v1;
6495           v1.i = 2;   // valid
6496           v1.k = 3;   // invalid: inner structure is not anonymous
6497           v1.w.k = 5; // valid
6498 </pre>
6499  
6500 <p><a name="6.7.2.1p20" href="#6.7.2.1p20"><small>20</small></a>
6501  EXAMPLE 2          After the declaration:
6502 <pre>
6503           struct s { int n; double d[]; };
6504 </pre>
6505  the structure struct s has a flexible array member d. A typical way to use this is:
6506 <pre>
6507           int m = /* some value */;
6508           struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));
6509 </pre>
6510  and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
6511  p had been declared as:
6512 <pre>
6513           struct { int n; double d[m]; } *p;
6514 </pre>
6515  (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
6516  not be the same).
6517 <p><a name="6.7.2.1p21" href="#6.7.2.1p21"><small>21</small></a>
6518  Following the above declaration:
6519 <pre>
6520           struct s t1 = { 0 };                         //   valid
6521           struct s t2 = { 1, { <a href="#4.2">4.2</a> }};                 //   invalid
6522           t1.n = 4;                                    //   valid
6523           t1.d[0] = <a href="#4.2">4.2</a>;                               //   might be undefined behavior
6524 </pre>
6525  The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
6526  contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
6527 <pre>
6528           sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)
6529 </pre>
6530  in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
6531  code.
6532 <p><a name="6.7.2.1p22" href="#6.7.2.1p22"><small>22</small></a>
6533  After the further declaration:
6534 <pre>
6535           struct ss { int n; };
6536 </pre>
6537  the expressions:
6538 <pre>
6539           sizeof (struct s) &gt;= sizeof (struct ss)
6540           sizeof (struct s) &gt;= offsetof(struct s, d)
6541 </pre>
6542  are always equal to 1.
6543 <p><a name="6.7.2.1p23" href="#6.7.2.1p23"><small>23</small></a>
6544  If sizeof (double) is 8, then after the following code is executed:
6545 <pre>
6546           struct s *s1;
6547           struct s *s2;
6548           s1 = malloc(sizeof (struct s) + 64);
6549           s2 = malloc(sizeof (struct s) + 46);
6550 </pre>
6551  and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
6552  purposes, as if the identifiers had been declared as:
6553 <pre>
6554           struct { int n; double d[8]; } *s1;
6555           struct { int n; double d[5]; } *s2;
6556 </pre>
6557 <p><a name="6.7.2.1p24" href="#6.7.2.1p24"><small>24</small></a>
6558  Following the further successful assignments:
6559 <!--page 135 -->
6560 <pre>
6561           s1 = malloc(sizeof (struct s) + 10);
6562           s2 = malloc(sizeof (struct s) + 6);
6563 </pre>
6564  they then behave as if the declarations were:
6565 <pre>
6566           struct { int n; double d[1]; } *s1, *s2;
6567 </pre>
6568  and:
6569 <pre>
6570           double *dp;
6571           dp = &amp;(s1-&gt;d[0]);          //   valid
6572           *dp = 42;                  //   valid
6573           dp = &amp;(s2-&gt;d[0]);          //   valid
6574           *dp = 42;                  //   undefined behavior
6575 </pre>
6576 <p><a name="6.7.2.1p25" href="#6.7.2.1p25"><small>25</small></a>
6577  The assignment:
6578 <pre>
6579           *s1 = *s2;
6580 </pre>
6581  only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
6582  of the structure, they might be copied or simply overwritten with indeterminate values.
6583  
6584 <p><a name="6.7.2.1p26" href="#6.7.2.1p26"><small>26</small></a>
6585  EXAMPLE 3 Because members of anonymous structures and unions are considered to be members of the
6586  containing structure or union, struct s in the following example has more than one named member and
6587  thus the use of a flexible array member is valid:
6588 <pre>
6589           struct s {
6590                 struct { int i; };
6591                 int a[];
6592           };
6593 </pre>
6594  
6595 <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>).
6596
6597 <p><b>Footnotes</b>
6598 <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
6599  value bits) of a _Bool may be just 1 bit.
6600 </small>
6601 <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
6602  are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
6603 </small>
6604 <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
6605  or arrays of bit-field objects.
6606 </small>
6607 <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,
6608  then it is implementation-defined whether the bit-field is signed or unsigned.
6609 </small>
6610 <p><small><a name="note126" href="#note126">126)</a> An unnamed bit-field structure member is useful for padding to conform to externally imposed
6611  layouts.
6612 </small>
6613
6614 <p><small><a href="#Contents">Contents</a></small>
6615 <h5><a name="6.7.2.2" href="#6.7.2.2">6.7.2.2 Enumeration specifiers</a></h5>
6616 <p><b>Syntax</b>
6617 <p><a name="6.7.2.2p1" href="#6.7.2.2p1"><small>1</small></a>
6618 <pre>
6619           enum-specifier:
6620                 enum identifier<sub>opt</sub> { enumerator-list }
6621                 enum identifier<sub>opt</sub> { enumerator-list , }
6622                 enum identifier
6623           enumerator-list:
6624                 enumerator
6625                 enumerator-list , enumerator
6626           enumerator:
6627                 enumeration-constant
6628                 enumeration-constant = constant-expression
6629 </pre>
6630 <p><b>Constraints</b>
6631 <p><a name="6.7.2.2p2" href="#6.7.2.2p2"><small>2</small></a>
6632  The expression that defines the value of an enumeration constant shall be an integer
6633  constant expression that has a value representable as an int.
6634 <!--page 136 -->
6635 <p><b>Semantics</b>
6636 <p><a name="6.7.2.2p3" href="#6.7.2.2p3"><small>3</small></a>
6637  The identifiers in an enumerator list are declared as constants that have type int and
6638  may appear wherever such are permitted.<sup><a href="#note127"><b>127)</b></a></sup> An enumerator with = defines its
6639  enumeration constant as the value of the constant expression. If the first enumerator has
6640  no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
6641  defines its enumeration constant as the value of the constant expression obtained by
6642  adding 1 to the value of the previous enumeration constant. (The use of enumerators with
6643  = may produce enumeration constants with values that duplicate other values in the same
6644  enumeration.) The enumerators of an enumeration are also known as its members.
6645 <p><a name="6.7.2.2p4" href="#6.7.2.2p4"><small>4</small></a>
6646  Each enumerated type shall be compatible with char, a signed integer type, or an
6647  unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note128"><b>128)</b></a></sup> but shall be
6648  capable of representing the values of all the members of the enumeration. The
6649  enumerated type is incomplete until immediately after the } that terminates the list of
6650  enumerator declarations, and complete thereafter.
6651 <p><a name="6.7.2.2p5" href="#6.7.2.2p5"><small>5</small></a>
6652  EXAMPLE       The following fragment:
6653 <pre>
6654          enum hue { chartreuse, burgundy, claret=20, winedark };
6655          enum hue col, *cp;
6656          col = claret;
6657          cp = &amp;col;
6658          if (*cp != burgundy)
6659                /* ... */
6660 </pre>
6661  makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
6662  pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
6663  
6664 <p><b> Forward references</b>: tags (<a href="#6.7.2.3">6.7.2.3</a>).
6665
6666 <p><b>Footnotes</b>
6667 <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
6668  each other and from other identifiers declared in ordinary declarators.
6669 </small>
6670 <p><small><a name="note128" href="#note128">128)</a> An implementation may delay the choice of which integer type until all enumeration constants have
6671  been seen.
6672 </small>
6673
6674 <p><small><a href="#Contents">Contents</a></small>
6675 <h5><a name="6.7.2.3" href="#6.7.2.3">6.7.2.3 Tags</a></h5>
6676 <p><b>Constraints</b>
6677 <p><a name="6.7.2.3p1" href="#6.7.2.3p1"><small>1</small></a>
6678  A specific type shall have its content defined at most once.
6679 <p><a name="6.7.2.3p2" href="#6.7.2.3p2"><small>2</small></a>
6680  Where two declarations that use the same tag declare the same type, they shall both use
6681  the same choice of struct, union, or enum.
6682 <p><a name="6.7.2.3p3" href="#6.7.2.3p3"><small>3</small></a>
6683  A type specifier of the form
6684 <pre>
6685          enum identifier
6686 </pre>
6687  without an enumerator list shall only appear after the type it specifies is complete.
6688  
6689  
6690 <!--page 137 -->
6691 <p><b>Semantics</b>
6692 <p><a name="6.7.2.3p4" href="#6.7.2.3p4"><small>4</small></a>
6693  All declarations of structure, union, or enumerated types that have the same scope and
6694  use the same tag declare the same type. Irrespective of whether there is a tag or what
6695  other declarations of the type are in the same translation unit, the type is incomplete<sup><a href="#note129"><b>129)</b></a></sup>
6696  until immediately after the closing brace of the list defining the content, and complete
6697  thereafter.
6698 <p><a name="6.7.2.3p5" href="#6.7.2.3p5"><small>5</small></a>
6699  Two declarations of structure, union, or enumerated types which are in different scopes or
6700  use different tags declare distinct types. Each declaration of a structure, union, or
6701  enumerated type which does not include a tag declares a distinct type.
6702 <p><a name="6.7.2.3p6" href="#6.7.2.3p6"><small>6</small></a>
6703  A type specifier of the form
6704 <pre>
6705           struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
6706 </pre>
6707  or
6708 <pre>
6709           enum identifier<sub>opt</sub> { enumerator-list }
6710 </pre>
6711  or
6712 <pre>
6713           enum identifier<sub>opt</sub> { enumerator-list , }
6714 </pre>
6715  declares a structure, union, or enumerated type. The list defines the structure content,
6716  union content, or enumeration content. If an identifier is provided,<sup><a href="#note130"><b>130)</b></a></sup> the type specifier
6717  also declares the identifier to be the tag of that type.
6718 <p><a name="6.7.2.3p7" href="#6.7.2.3p7"><small>7</small></a>
6719  A declaration of the form
6720 <pre>
6721           struct-or-union identifier ;
6722 </pre>
6723  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>
6724 <p><a name="6.7.2.3p8" href="#6.7.2.3p8"><small>8</small></a>
6725  If a type specifier of the form
6726 <pre>
6727           struct-or-union identifier
6728 </pre>
6729  occurs other than as part of one of the above forms, and no other declaration of the
6730  identifier as a tag is visible, then it declares an incomplete structure or union type, and
6731  declares the identifier as the tag of that type.<sup><a href="#note131"><b>131)</b></a></sup>
6732  
6733  
6734  
6735 <!--page 138 -->
6736 <p><a name="6.7.2.3p9" href="#6.7.2.3p9"><small>9</small></a>
6737  If a type specifier of the form
6738 <pre>
6739           struct-or-union identifier
6740 </pre>
6741  or
6742 <pre>
6743           enum identifier
6744 </pre>
6745  occurs other than as part of one of the above forms, and a declaration of the identifier as a
6746  tag is visible, then it specifies the same type as that other declaration, and does not
6747  redeclare the tag.
6748 <p><a name="6.7.2.3p10" href="#6.7.2.3p10"><small>10</small></a>
6749  EXAMPLE 1       This mechanism allows declaration of a self-referential structure.
6750 <pre>
6751           struct tnode {
6752                 int count;
6753                 struct tnode *left, *right;
6754           };
6755 </pre>
6756  specifies a structure that contains an integer and two pointers to objects of the same type. Once this
6757  declaration has been given, the declaration
6758 <pre>
6759           struct tnode s, *sp;
6760 </pre>
6761  declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
6762  these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
6763  which sp points; the expression s.right-&gt;count designates the count member of the right struct
6764  tnode pointed to from s.
6765 <p><a name="6.7.2.3p11" href="#6.7.2.3p11"><small>11</small></a>
6766  The following alternative formulation uses the typedef mechanism:
6767 <pre>
6768           typedef struct tnode TNODE;
6769           struct tnode {
6770                 int count;
6771                 TNODE *left, *right;
6772           };
6773           TNODE s, *sp;
6774 </pre>
6775  
6776 <p><a name="6.7.2.3p12" href="#6.7.2.3p12"><small>12</small></a>
6777  EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
6778  structures, the declarations
6779 <pre>
6780           struct s1 { struct s2 *s2p; /* ... */ }; // D1
6781           struct s2 { struct s1 *s1p; /* ... */ }; // D2
6782 </pre>
6783  specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
6784  declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
6785  D2. To eliminate this context sensitivity, the declaration
6786 <pre>
6787          struct s2;
6788 </pre>
6789  may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
6790  completes the specification of the new type.
6791  
6792 <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>).
6793 <!--page 139 -->
6794
6795 <p><b>Footnotes</b>
6796 <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
6797  needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
6798  when a pointer to or a function returning a structure or union is being declared. (See incomplete types
6799  in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
6800 </small>
6801 <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
6802  of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
6803  can make use of that typedef name to declare objects having the specified structure, union, or
6804  enumerated type.
6805 </small>
6806 <p><small><a name="note131" href="#note131">131)</a> A similar construction with enum does not exist.
6807 </small>
6808
6809 <p><small><a href="#Contents">Contents</a></small>
6810 <h5><a name="6.7.2.4" href="#6.7.2.4">6.7.2.4 Atomic type specifiers</a></h5>
6811 <p><b>Syntax</b>
6812 <p><a name="6.7.2.4p1" href="#6.7.2.4p1"><small>1</small></a>
6813 <pre>
6814           atomic-type-specifier:
6815                  _Atomic ( type-name )
6816 </pre>
6817 <p><b>Constraints</b>
6818 <p><a name="6.7.2.4p2" href="#6.7.2.4p2"><small>2</small></a>
6819  Atomic type specifiers shall not be used if the implementation does not support atomic
6820  types (see <a href="#6.10.8.3">6.10.8.3</a>).
6821 <p><a name="6.7.2.4p3" href="#6.7.2.4p3"><small>3</small></a>
6822  The type name in an atomic type specifier shall not refer to an array type, a function type,
6823  an atomic type, or a qualified type.
6824 <p><b>Semantics</b>
6825 <p><a name="6.7.2.4p4" href="#6.7.2.4p4"><small>4</small></a>
6826  The properties associated with atomic types are meaningful only for expressions that are
6827  lvalues. If the _Atomic keyword is immediately followed by a left parenthesis, it is
6828  interpreted as a type specifier (with a type name), not as a type qualifier.
6829
6830 <p><small><a href="#Contents">Contents</a></small>
6831 <h4><a name="6.7.3" href="#6.7.3">6.7.3 Type qualifiers</a></h4>
6832 <p><b>Syntax</b>
6833 <p><a name="6.7.3p1" href="#6.7.3p1"><small>1</small></a>
6834 <pre>
6835           type-qualifier:
6836                  const
6837                  restrict
6838                  volatile
6839                  _Atomic
6840 </pre>
6841 <p><b>Constraints</b>
6842 <p><a name="6.7.3p2" href="#6.7.3p2"><small>2</small></a>
6843  Types other than pointer types whose referenced type is an object type shall not be
6844  restrict-qualified.
6845 <p><a name="6.7.3p3" href="#6.7.3p3"><small>3</small></a>
6846  The type modified by the _Atomic qualifier shall not be an array type or a function
6847  type.
6848 <p><b>Semantics</b>
6849 <p><a name="6.7.3p4" href="#6.7.3p4"><small>4</small></a>
6850  The properties associated with qualified types are meaningful only for expressions that
6851  are lvalues.<sup><a href="#note132"><b>132)</b></a></sup>
6852 <p><a name="6.7.3p5" href="#6.7.3p5"><small>5</small></a>
6853  If the same qualifier appears more than once in the same specifier-qualifier-list, either
6854  directly or via one or more typedefs, the behavior is the same as if it appeared only
6855  once. If other qualifiers appear along with the _Atomic qualifier in a specifier-qualifier-
6856  
6857 <!--page 140 -->
6858  list, the resulting type is the so-qualified atomic type.
6859 <p><a name="6.7.3p6" href="#6.7.3p6"><small>6</small></a>
6860  If an attempt is made to modify an object defined with a const-qualified type through use
6861  of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
6862  made to refer to an object defined with a volatile-qualified type through use of an lvalue
6863  with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note133"><b>133)</b></a></sup>
6864 <p><a name="6.7.3p7" href="#6.7.3p7"><small>7</small></a>
6865  An object that has volatile-qualified type may be modified in ways unknown to the
6866  implementation or have other unknown side effects. Therefore any expression referring
6867  to such an object shall be evaluated strictly according to the rules of the abstract machine,
6868  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
6869  object shall agree with that prescribed by the abstract machine, except as modified by the
6870  unknown factors mentioned previously.<sup><a href="#note134"><b>134)</b></a></sup> What constitutes an access to an object that
6871  has volatile-qualified type is implementation-defined.
6872 <p><a name="6.7.3p8" href="#6.7.3p8"><small>8</small></a>
6873  An object that is accessed through a restrict-qualified pointer has a special association
6874  with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
6875  that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note135"><b>135)</b></a></sup> The intended
6876  use of the restrict qualifier (like the register storage class) is to promote
6877  optimization, and deleting all instances of the qualifier from all preprocessing translation
6878  units composing a conforming program does not change its meaning (i.e., observable
6879  behavior).
6880 <p><a name="6.7.3p9" href="#6.7.3p9"><small>9</small></a>
6881  If the specification of an array type includes any type qualifiers, the element type is so-
6882  qualified, not the array type. If the specification of a function type includes any type
6883  qualifiers, the behavior is undefined.<sup><a href="#note136"><b>136)</b></a></sup>
6884 <p><a name="6.7.3p10" href="#6.7.3p10"><small>10</small></a>
6885  For two qualified types to be compatible, both shall have the identically qualified version
6886  of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
6887  does not affect the specified type.
6888 <p><a name="6.7.3p11" href="#6.7.3p11"><small>11</small></a>
6889  EXAMPLE 1       An object declared
6890 <pre>
6891          extern const volatile int real_time_clock;
6892 </pre>
6893  
6894  
6895  
6896 <!--page 141 -->
6897  may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
6898  
6899 <p><a name="6.7.3p12" href="#6.7.3p12"><small>12</small></a>
6900  EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
6901  modify an aggregate type:
6902 <pre>
6903           const struct s { int mem; } cs = { 1 };
6904           struct s ncs; // the object ncs is modifiable
6905           typedef int A[2][3];
6906           const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
6907           int *pi;
6908           const int *pci;
6909           ncs = cs;               //   valid
6910           cs = ncs;               //   violates modifiable lvalue constraint for =
6911           pi = &amp;ncs.mem;          //   valid
6912           pi = &amp;cs.mem;           //   violates type constraints for =
6913           pci = &amp;cs.mem;          //   valid
6914           pi = a[0];              //   invalid: a[0] has type ''const int *''
6915 </pre>
6916  
6917 <p><a name="6.7.3p13" href="#6.7.3p13"><small>13</small></a>
6918  EXAMPLE 3       The declaration
6919 <pre>
6920           _Atomic volatile int *p;
6921 </pre>
6922  specifies that p has the type ''pointer to volatile atomic int'', a pointer to a volatile-qualified atomic type.
6923  
6924
6925 <p><b>Footnotes</b>
6926 <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
6927  storage. Moreover, the implementation need not allocate storage for such an object if its address is
6928  never used.
6929 </small>
6930 <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
6931  never actually defined as objects in the program (such as an object at a memory-mapped input/output
6932  address).
6933 </small>
6934 <p><small><a name="note134" href="#note134">134)</a> A volatile declaration may be used to describe an object corresponding to a memory-mapped
6935  input/output port or an object accessed by an asynchronously interrupting function. Actions on
6936  objects so declared shall not be ''optimized out'' by an implementation or reordered except as
6937  permitted by the rules for evaluating expressions.
6938 </small>
6939 <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
6940  association between the allocated object and the pointer.
6941 </small>
6942 <p><small><a name="note136" href="#note136">136)</a> Both of these can occur through the use of typedefs.
6943 </small>
6944
6945 <p><small><a href="#Contents">Contents</a></small>
6946 <h5><a name="6.7.3.1" href="#6.7.3.1">6.7.3.1 Formal definition of restrict</a></h5>
6947 <p><a name="6.7.3.1p1" href="#6.7.3.1p1"><small>1</small></a>
6948  Let D be a declaration of an ordinary identifier that provides a means of designating an
6949  object P as a restrict-qualified pointer to type T.
6950 <p><a name="6.7.3.1p2" href="#6.7.3.1p2"><small>2</small></a>
6951  If D appears inside a block and does not have storage class extern, let B denote the
6952  block. If D appears in the list of parameter declarations of a function definition, let B
6953  denote the associated block. Otherwise, let B denote the block of main (or the block of
6954  whatever function is called at program startup in a freestanding environment).
6955 <p><a name="6.7.3.1p3" href="#6.7.3.1p3"><small>3</small></a>
6956  In what follows, a pointer expression E is said to be based on object P if (at some
6957  sequence point in the execution of B prior to the evaluation of E) modifying P to point to
6958  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>
6959  Note that ''based'' is defined only for expressions with pointer types.
6960 <p><a name="6.7.3.1p4" href="#6.7.3.1p4"><small>4</small></a>
6961  During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
6962  access the value of the object X that it designates, and X is also modified (by any means),
6963  then the following requirements apply: T shall not be const-qualified. Every other lvalue
6964  used to access the value of X shall also have its address based on P. Every access that
6965  modifies X shall be considered also to modify P, for the purposes of this subclause. If P
6966  is assigned the value of a pointer expression E that is based on another restricted pointer
6967  
6968  
6969 <!--page 142 -->
6970  object P2, associated with block B2, then either the execution of B2 shall begin before
6971  the execution of B, or the execution of B2 shall end prior to the assignment. If these
6972  requirements are not met, then the behavior is undefined.
6973 <p><a name="6.7.3.1p5" href="#6.7.3.1p5"><small>5</small></a>
6974  Here an execution of B means that portion of the execution of the program that would
6975  correspond to the lifetime of an object with scalar type and automatic storage duration
6976  associated with B.
6977 <p><a name="6.7.3.1p6" href="#6.7.3.1p6"><small>6</small></a>
6978  A translator is free to ignore any or all aliasing implications of uses of restrict.
6979 <p><a name="6.7.3.1p7" href="#6.7.3.1p7"><small>7</small></a>
6980  EXAMPLE 1       The file scope declarations
6981 <pre>
6982          int * restrict a;
6983          int * restrict b;
6984          extern int c[];
6985 </pre>
6986  assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
6987  program, then it is never accessed using either of the other two.
6988  
6989 <p><a name="6.7.3.1p8" href="#6.7.3.1p8"><small>8</small></a>
6990  EXAMPLE 2       The function parameter declarations in the following example
6991 <pre>
6992          void f(int n, int * restrict p, int * restrict q)
6993          {
6994                while (n-- &gt; 0)
6995                      *p++ = *q++;
6996          }
6997 </pre>
6998  assert that, during each execution of the function, if an object is accessed through one of the pointer
6999  parameters, then it is not also accessed through the other.
7000 <p><a name="6.7.3.1p9" href="#6.7.3.1p9"><small>9</small></a>
7001  The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
7002  analysis of function f without examining any of the calls of f in the program. The cost is that the
7003  programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
7004  second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
7005  both p and q.
7006 <pre>
7007           void g(void)
7008           {
7009                 extern int d[100];
7010                 f(50, d + 50, d); // valid
7011                 f(50, d + 1, d); // undefined behavior
7012           }
7013 </pre>
7014  
7015 <p><a name="6.7.3.1p10" href="#6.7.3.1p10"><small>10</small></a>
7016  EXAMPLE 3       The function parameter declarations
7017 <pre>
7018          void h(int n, int * restrict p, int * restrict q, int * restrict r)
7019          {
7020                int i;
7021                for (i = 0; i &lt; n; i++)
7022                       p[i] = q[i] + r[i];
7023          }
7024 </pre>
7025  illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
7026  are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
7027  modified within function h.
7028 <!--page 143 -->
7029 <p><a name="6.7.3.1p11" href="#6.7.3.1p11"><small>11</small></a>
7030  EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
7031  function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
7032  between restricted pointers declared in nested blocks have defined behavior.
7033 <pre>
7034           {
7035                    int * restrict p1;
7036                    int * restrict q1;
7037                    p1 = q1; // undefined behavior
7038                    {
7039                          int * restrict p2 = p1; // valid
7040                          int * restrict q2 = q1; // valid
7041                          p1 = q2;                // undefined behavior
7042                          p2 = q2;                // undefined behavior
7043                    }
7044           }
7045 </pre>
7046 <p><a name="6.7.3.1p12" href="#6.7.3.1p12"><small>12</small></a>
7047  The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
7048  precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
7049  example, this permits new_vector to return a vector.
7050 <pre>
7051           typedef struct { int n; float * restrict v; } vector;
7052           vector new_vector(int n)
7053           {
7054                 vector t;
7055                 t.n = n;
7056                 t.v = malloc(n * sizeof (float));
7057                 return t;
7058           }
7059 </pre>
7060  
7061
7062 <p><b>Footnotes</b>
7063 <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
7064  indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
7065  expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
7066  expressions *p and p[1] are not.
7067 </small>
7068
7069 <p><small><a href="#Contents">Contents</a></small>
7070 <h4><a name="6.7.4" href="#6.7.4">6.7.4 Function specifiers</a></h4>
7071 <p><b>Syntax</b>
7072 <p><a name="6.7.4p1" href="#6.7.4p1"><small>1</small></a>
7073 <pre>
7074           function-specifier:
7075                  inline
7076                  _Noreturn
7077 </pre>
7078 <p><b>Constraints</b>
7079 <p><a name="6.7.4p2" href="#6.7.4p2"><small>2</small></a>
7080  Function specifiers shall be used only in the declaration of an identifier for a function.
7081 <p><a name="6.7.4p3" href="#6.7.4p3"><small>3</small></a>
7082  An inline definition of a function with external linkage shall not contain a definition of a
7083  modifiable object with static or thread storage duration, and shall not contain a reference
7084  to an identifier with internal linkage.
7085 <p><a name="6.7.4p4" href="#6.7.4p4"><small>4</small></a>
7086  In a hosted environment, no function specifier(s) shall appear in a declaration of main.
7087 <p><b>Semantics</b>
7088 <p><a name="6.7.4p5" href="#6.7.4p5"><small>5</small></a>
7089  A function specifier may appear more than once; the behavior is the same as if it
7090  appeared only once.
7091 <p><a name="6.7.4p6" href="#6.7.4p6"><small>6</small></a>
7092  A function declared with an inline function specifier is an inline function. Making a
7093  function an inline function suggests that calls to the function be as fast as possible.<sup><a href="#note138"><b>138)</b></a></sup>
7094 <!--page 144 -->
7095  The extent to which such suggestions are effective is implementation-defined.<sup><a href="#note139"><b>139)</b></a></sup>
7096 <p><a name="6.7.4p7" href="#6.7.4p7"><small>7</small></a>
7097  Any function with internal linkage can be an inline function. For a function with external
7098  linkage, the following restrictions apply: If a function is declared with an inline
7099  function specifier, then it shall also be defined in the same translation unit. If all of the
7100  file scope declarations for a function in a translation unit include the inline function
7101  specifier without extern, then the definition in that translation unit is an inline
7102  definition. An inline definition does not provide an external definition for the function,
7103  and does not forbid an external definition in another translation unit. An inline definition
7104  provides an alternative to an external definition, which a translator may use to implement
7105  any call to the function in the same translation unit. It is unspecified whether a call to the
7106  function uses the inline definition or the external definition.<sup><a href="#note140"><b>140)</b></a></sup>
7107 <p><a name="6.7.4p8" href="#6.7.4p8"><small>8</small></a>
7108  A function declared with a _Noreturn function specifier shall not return to its caller.
7109 <p><b>Recommended practice</b>
7110 <p><a name="6.7.4p9" href="#6.7.4p9"><small>9</small></a>
7111  The implementation should produce a diagnostic message for a function declared with a
7112  _Noreturn function specifier that appears to be capable of returning to its caller.
7113 <p><a name="6.7.4p10" href="#6.7.4p10"><small>10</small></a>
7114  EXAMPLE 1 The declaration of an inline function with external linkage can result in either an external
7115  definition, or a definition available for use only within the translation unit. A file scope declaration with
7116  extern creates an external definition. The following example shows an entire translation unit.
7117 <pre>
7118           inline double fahr(double t)
7119           {
7120                 return (9.0 * t) / 5.0 + 32.0;
7121           }
7122           inline double cels(double t)
7123           {
7124                 return (5.0 * (t - 32.0)) / 9.0;
7125           }
7126           extern double fahr(double);                  // creates an external definition
7127 </pre>
7128  
7129  
7130  
7131  
7132 <!--page 145 -->
7133 <pre>
7134           double convert(int is_fahr, double temp)
7135           {
7136                 /* A translator may perform inline substitutions */
7137                 return is_fahr ? cels(temp) : fahr(temp);
7138           }
7139 </pre>
7140 <p><a name="6.7.4p11" href="#6.7.4p11"><small>11</small></a>
7141  Note that the definition of fahr is an external definition because fahr is also declared with extern, but
7142  the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
7143  external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
7144  definition are distinct and either may be used for the call.
7145  
7146 <p><a name="6.7.4p12" href="#6.7.4p12"><small>12</small></a>
7147  EXAMPLE 2
7148 <pre>
7149           _Noreturn void f () {
7150                 abort(); // ok
7151           }
7152           _Noreturn void g (int i) { // causes undefined behavior if i &lt;= 0
7153                 if (i &gt; 0) abort();
7154           }
7155 </pre>
7156  
7157 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
7158
7159 <p><b>Footnotes</b>
7160 <p><small><a name="note138" href="#note138">138)</a> By using, for example, an alternative to the usual function call mechanism, such as ''inline
7161  substitution''. Inline substitution is not textual substitution, nor does it create a new function.
7162  Therefore, for example, the expansion of a macro used within the body of the function uses the
7163  definition it had at the point the function body appears, and not where the function is called; and
7164  identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
7165  single address, regardless of the number of inline definitions that occur in addition to the external
7166  definition.
7167 </small>
7168 <p><small><a name="note139" href="#note139">139)</a> For example, an implementation might never perform inline substitution, or might only perform inline
7169  substitutions to calls in the scope of an inline declaration.
7170 </small>
7171 <p><small><a name="note140" href="#note140">140)</a> Since an inline definition is distinct from the corresponding external definition and from any other
7172  corresponding inline definitions in other translation units, all corresponding objects with static storage
7173  duration are also distinct in each of the definitions.
7174 </small>
7175
7176 <p><small><a href="#Contents">Contents</a></small>
7177 <h4><a name="6.7.5" href="#6.7.5">6.7.5 Alignment specifier</a></h4>
7178 <p><b>Syntax</b>
7179 <p><a name="6.7.5p1" href="#6.7.5p1"><small>1</small></a>
7180 <pre>
7181           alignment-specifier:
7182                 _Alignas ( type-name )
7183                 _Alignas ( constant-expression )
7184 </pre>
7185 <p><b>Constraints</b>
7186 <p><a name="6.7.5p2" href="#6.7.5p2"><small>2</small></a>
7187  An alignment attribute shall not be specified in a declaration of a typedef, or a bit-field, or
7188  a function, or a parameter, or an object declared with the register storage-class
7189  specifier.
7190 <p><a name="6.7.5p3" href="#6.7.5p3"><small>3</small></a>
7191  The constant expression shall be an integer constant expression. It shall evaluate to a
7192  valid fundamental alignment, or to a valid extended alignment supported by the
7193  implementation in the context in which it appears, or to zero.
7194 <p><a name="6.7.5p4" href="#6.7.5p4"><small>4</small></a>
7195  The combined effect of all alignment attributes in a declaration shall not specify an
7196  alignment that is less strict than the alignment that would otherwise be required for the
7197  type of the object or member being declared.
7198 <p><b>Semantics</b>
7199 <p><a name="6.7.5p5" href="#6.7.5p5"><small>5</small></a>
7200  The first form is equivalent to _Alignas (_Alignof (type-name)).
7201 <p><a name="6.7.5p6" href="#6.7.5p6"><small>6</small></a>
7202  The alignment requirement of the declared object or member is taken to be the specified
7203  alignment. An alignment specification of zero has no effect.<sup><a href="#note141"><b>141)</b></a></sup> When multiple
7204  alignment specifiers occur in a declaration, the effective alignment requirement is the
7205  strictest specified alignment.
7206 <!--page 146 -->
7207 <p><a name="6.7.5p7" href="#6.7.5p7"><small>7</small></a>
7208  If the definition of an object has an alignment specifier, any other declaration of that
7209  object shall either specify equivalent alignment or have no alignment specifier. If the
7210  definition of an object does not have an alignment specifier, any other declaration of that
7211  object shall also have no alignment specifier. If declarations of an object in different
7212  translation units have different alignment specifiers, the behavior is undefined.
7213
7214 <p><b>Footnotes</b>
7215 <p><small><a name="note141" href="#note141">141)</a> An alignment specification of zero also does not affect other alignment specifications in the same
7216  declaration.
7217 </small>
7218
7219 <p><small><a href="#Contents">Contents</a></small>
7220 <h4><a name="6.7.6" href="#6.7.6">6.7.6 Declarators</a></h4>
7221 <p><b>Syntax</b>
7222 <p><a name="6.7.6p1" href="#6.7.6p1"><small>1</small></a>
7223 <pre>
7224           declarator:
7225                  pointer<sub>opt</sub> direct-declarator
7226           direct-declarator:
7227                   identifier
7228                   ( declarator )
7229                   direct-declarator [ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
7230                   direct-declarator [ static type-qualifier-list<sub>opt</sub> assignment-expression ]
7231                   direct-declarator [ type-qualifier-list static assignment-expression ]
7232                   direct-declarator [ type-qualifier-list<sub>opt</sub> * ]
7233                   direct-declarator ( parameter-type-list )
7234                   direct-declarator ( identifier-list<sub>opt</sub> )
7235           pointer:
7236                  * type-qualifier-list<sub>opt</sub>
7237                  * type-qualifier-list<sub>opt</sub> pointer
7238           type-qualifier-list:
7239                  type-qualifier
7240                  type-qualifier-list type-qualifier
7241           parameter-type-list:
7242                 parameter-list
7243                 parameter-list , ...
7244           parameter-list:
7245                 parameter-declaration
7246                 parameter-list , parameter-declaration
7247           parameter-declaration:
7248                 declaration-specifiers declarator
7249                 declaration-specifiers abstract-declarator<sub>opt</sub>
7250 </pre>
7251  
7252  
7253  
7254 <!--page 147 -->
7255 <pre>
7256           identifier-list:
7257                  identifier
7258                  identifier-list , identifier
7259 </pre>
7260 <p><b>Semantics</b>
7261 <p><a name="6.7.6p2" href="#6.7.6p2"><small>2</small></a>
7262  Each declarator declares one identifier, and asserts that when an operand of the same
7263  form as the declarator appears in an expression, it designates a function or object with the
7264  scope, storage duration, and type indicated by the declaration specifiers.
7265 <p><a name="6.7.6p3" href="#6.7.6p3"><small>3</small></a>
7266  A full declarator is a declarator that is not part of another declarator. The end of a full
7267  declarator is a sequence point. If, in the nested sequence of declarators in a full
7268  declarator, there is a declarator specifying a variable length array type, the type specified
7269  by the full declarator is said to be variably modified. Furthermore, any type derived by
7270  declarator type derivation from a variably modified type is itself variably modified.
7271 <p><a name="6.7.6p4" href="#6.7.6p4"><small>4</small></a>
7272  In the following subclauses, consider a declaration
7273 <pre>
7274           T D1
7275 </pre>
7276  where T contains the declaration specifiers that specify a type T (such as int) and D1 is
7277  a declarator that contains an identifier ident. The type specified for the identifier ident in
7278  the various forms of declarator is described inductively using this notation.
7279 <p><a name="6.7.6p5" href="#6.7.6p5"><small>5</small></a>
7280  If, in the declaration ''T D1'', D1 has the form
7281 <pre>
7282           identifier
7283 </pre>
7284  then the type specified for ident is T .
7285 <p><a name="6.7.6p6" href="#6.7.6p6"><small>6</small></a>
7286  If, in the declaration ''T D1'', D1 has the form
7287 <pre>
7288           ( D )
7289 </pre>
7290  then ident has the type specified by the declaration ''T D''. Thus, a declarator in
7291  parentheses is identical to the unparenthesized declarator, but the binding of complicated
7292  declarators may be altered by parentheses.
7293 <p><b>Implementation limits</b>
7294 <p><a name="6.7.6p7" href="#6.7.6p7"><small>7</small></a>
7295  As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
7296  function declarators that modify an arithmetic, structure, union, or void type, either
7297  directly or via one or more typedefs.
7298 <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>).
7299 <!--page 148 -->
7300
7301 <p><small><a href="#Contents">Contents</a></small>
7302 <h5><a name="6.7.6.1" href="#6.7.6.1">6.7.6.1 Pointer declarators</a></h5>
7303 <p><b>Semantics</b>
7304 <p><a name="6.7.6.1p1" href="#6.7.6.1p1"><small>1</small></a>
7305  If, in the declaration ''T D1'', D1 has the form
7306 <pre>
7307          * type-qualifier-list<sub>opt</sub> D
7308 </pre>
7309  and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
7310  T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
7311  pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
7312 <p><a name="6.7.6.1p2" href="#6.7.6.1p2"><small>2</small></a>
7313  For two pointer types to be compatible, both shall be identically qualified and both shall
7314  be pointers to compatible types.
7315 <p><a name="6.7.6.1p3" href="#6.7.6.1p3"><small>3</small></a>
7316  EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
7317  to a constant value'' and a ''constant pointer to a variable value''.
7318 <pre>
7319          const int *ptr_to_constant;
7320          int *const constant_ptr;
7321 </pre>
7322  The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
7323  but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
7324  int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
7325  same location.
7326 <p><a name="6.7.6.1p4" href="#6.7.6.1p4"><small>4</small></a>
7327  The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
7328  type ''pointer to int''.
7329 <pre>
7330          typedef int *int_ptr;
7331          const int_ptr constant_ptr;
7332 </pre>
7333  declares constant_ptr as an object that has type ''const-qualified pointer to int''.
7334  
7335
7336 <p><small><a href="#Contents">Contents</a></small>
7337 <h5><a name="6.7.6.2" href="#6.7.6.2">6.7.6.2 Array declarators</a></h5>
7338 <p><b>Constraints</b>
7339 <p><a name="6.7.6.2p1" href="#6.7.6.2p1"><small>1</small></a>
7340  In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
7341  an expression or *. If they delimit an expression (which specifies the size of an array), the
7342  expression shall have an integer type. If the expression is a constant expression, it shall
7343  have a value greater than zero. The element type shall not be an incomplete or function
7344  type. The optional type qualifiers and the keyword static shall appear only in a
7345  declaration of a function parameter with an array type, and then only in the outermost
7346  array type derivation.
7347 <p><a name="6.7.6.2p2" href="#6.7.6.2p2"><small>2</small></a>
7348  If an identifier is declared as having a variably modified type, it shall be an ordinary
7349  identifier (as defined in <a href="#6.2.3">6.2.3</a>), have no linkage, and have either block scope or function
7350  prototype scope. If an identifier is declared to be an object with static or thread storage
7351  duration, it shall not have a variable length array type.
7352 <!--page 149 -->
7353 <p><b>Semantics</b>
7354 <p><a name="6.7.6.2p3" href="#6.7.6.2p3"><small>3</small></a>
7355  If, in the declaration ''T D1'', D1 has one of the forms:
7356 <pre>
7357           D[ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
7358           D[ static type-qualifier-list<sub>opt</sub> assignment-expression ]
7359           D[ type-qualifier-list static assignment-expression ]
7360           D[ type-qualifier-list<sub>opt</sub> * ]
7361 </pre>
7362  and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
7363  T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note142"><b>142)</b></a></sup>
7364  (See <a href="#6.7.6.3">6.7.6.3</a> for the meaning of the optional type qualifiers and the keyword static.)
7365 <p><a name="6.7.6.2p4" href="#6.7.6.2p4"><small>4</small></a>
7366  If the size is not present, the array type is an incomplete type. If the size is * instead of
7367  being an expression, the array type is a variable length array type of unspecified size,
7368  which can only be used in declarations or type names with function prototype scope;<sup><a href="#note143"><b>143)</b></a></sup>
7369  such arrays are nonetheless complete types. If the size is an integer constant expression
7370  and the element type has a known constant size, the array type is not a variable length
7371  array type; otherwise, the array type is a variable length array type. (Variable length
7372  arrays are a conditional feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.)
7373 <p><a name="6.7.6.2p5" href="#6.7.6.2p5"><small>5</small></a>
7374  If the size is an expression that is not an integer constant expression: if it occurs in a
7375  declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
7376  each time it is evaluated it shall have a value greater than zero. The size of each instance
7377  of a variable length array type does not change during its lifetime. Where a size
7378  expression is part of the operand of a sizeof operator and changing the value of the
7379  size expression would not affect the result of the operator, it is unspecified whether or not
7380  the size expression is evaluated.
7381 <p><a name="6.7.6.2p6" href="#6.7.6.2p6"><small>6</small></a>
7382  For two array types to be compatible, both shall have compatible element types, and if
7383  both size specifiers are present, and are integer constant expressions, then both size
7384  specifiers shall have the same constant value. If the two array types are used in a context
7385  which requires them to be compatible, it is undefined behavior if the two size specifiers
7386  evaluate to unequal values.
7387 <p><a name="6.7.6.2p7" href="#6.7.6.2p7"><small>7</small></a>
7388  EXAMPLE 1
7389 <pre>
7390           float fa[11], *afp[17];
7391 </pre>
7392  declares an array of float numbers and an array of pointers to float numbers.
7393  
7394 <p><a name="6.7.6.2p8" href="#6.7.6.2p8"><small>8</small></a>
7395  EXAMPLE 2       Note the distinction between the declarations
7396  
7397  
7398  
7399  
7400 <!--page 150 -->
7401 <pre>
7402          extern int *x;
7403          extern int y[];
7404 </pre>
7405  The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
7406  (an incomplete type), the storage for which is defined elsewhere.
7407  
7408 <p><a name="6.7.6.2p9" href="#6.7.6.2p9"><small>9</small></a>
7409  EXAMPLE 3      The following declarations demonstrate the compatibility rules for variably modified types.
7410 <pre>
7411          extern int n;
7412          extern int m;
7413          void fcompat(void)
7414          {
7415                int a[n][6][m];
7416                int (*p)[4][n+1];
7417                int c[n][n][6][m];
7418                int (*r)[n][n][n+1];
7419                p = a;       // invalid: not compatible because 4 != 6
7420                r = c;       // compatible, but defined behavior only if
7421                             // n == 6 and m == n+1
7422          }
7423 </pre>
7424  
7425 <p><a name="6.7.6.2p10" href="#6.7.6.2p10"><small>10</small></a>
7426  EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
7427  function prototype scope. Array objects declared with the _Thread_local, static, or extern
7428  storage-class specifier cannot have a variable length array (VLA) type. However, an object declared with
7429  the static storage-class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all
7430  identifiers declared with a VM type have to be ordinary identifiers and cannot, therefore, be members of
7431  structures or unions.
7432 <pre>
7433          extern int n;
7434          int A[n];                                            // invalid: file scope VLA
7435          extern int (*p2)[n];                                 // invalid: file scope VM
7436          int B[100];                                          // valid: file scope but not VM
7437          void fvla(int m, int C[m][m]);                       // valid: VLA with prototype scope
7438          void fvla(int m, int C[m][m])                        // valid: adjusted to auto pointer to VLA
7439          {
7440                typedef int VLA[m][m];                         // valid: block scope typedef VLA
7441                   struct tag {
7442                         int (*y)[n];                          // invalid: y not ordinary identifier
7443                         int z[n];                             // invalid: z not ordinary identifier
7444                   };
7445                   int D[m];                                   //   valid: auto VLA
7446                   static int E[m];                            //   invalid: static block scope VLA
7447                   extern int F[m];                            //   invalid: F has linkage and is VLA
7448                   int (*s)[m];                                //   valid: auto pointer to VLA
7449                   extern int (*r)[m];                         //   invalid: r has linkage and points to VLA
7450                   static int (*q)[m] = &amp;B;                    //   valid: q is a static block pointer to VLA
7451          }
7452 </pre>
7453  
7454 <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>),
7455  initialization (<a href="#6.7.9">6.7.9</a>).
7456 <!--page 151 -->
7457
7458 <p><b>Footnotes</b>
7459 <p><small><a name="note142" href="#note142">142)</a> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
7460 </small>
7461 <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>).
7462 </small>
7463
7464 <p><small><a href="#Contents">Contents</a></small>
7465 <h5><a name="6.7.6.3" href="#6.7.6.3">6.7.6.3 Function declarators (including prototypes)</a></h5>
7466 <p><b>Constraints</b>
7467 <p><a name="6.7.6.3p1" href="#6.7.6.3p1"><small>1</small></a>
7468  A function declarator shall not specify a return type that is a function type or an array
7469  type.
7470 <p><a name="6.7.6.3p2" href="#6.7.6.3p2"><small>2</small></a>
7471  The only storage-class specifier that shall occur in a parameter declaration is register.
7472 <p><a name="6.7.6.3p3" href="#6.7.6.3p3"><small>3</small></a>
7473  An identifier list in a function declarator that is not part of a definition of that function
7474  shall be empty.
7475 <p><a name="6.7.6.3p4" href="#6.7.6.3p4"><small>4</small></a>
7476  After adjustment, the parameters in a parameter type list in a function declarator that is
7477  part of a definition of that function shall not have incomplete type.
7478 <p><b>Semantics</b>
7479 <p><a name="6.7.6.3p5" href="#6.7.6.3p5"><small>5</small></a>
7480  If, in the declaration ''T D1'', D1 has the form
7481 <pre>
7482          D( parameter-type-list )
7483 </pre>
7484  or
7485 <pre>
7486          D( identifier-list<sub>opt</sub> )
7487 </pre>
7488  and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
7489  T '', then the type specified for ident is ''derived-declarator-type-list function returning
7490  T ''.
7491 <p><a name="6.7.6.3p6" href="#6.7.6.3p6"><small>6</small></a>
7492  A parameter type list specifies the types of, and may declare identifiers for, the
7493  parameters of the function.
7494 <p><a name="6.7.6.3p7" href="#6.7.6.3p7"><small>7</small></a>
7495  A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
7496  type'', where the type qualifiers (if any) are those specified within the [ and ] of the
7497  array type derivation. If the keyword static also appears within the [ and ] of the
7498  array type derivation, then for each call to the function, the value of the corresponding
7499  actual argument shall provide access to the first element of an array with at least as many
7500  elements as specified by the size expression.
7501 <p><a name="6.7.6.3p8" href="#6.7.6.3p8"><small>8</small></a>
7502  A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
7503  function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
7504 <p><a name="6.7.6.3p9" href="#6.7.6.3p9"><small>9</small></a>
7505  If the list terminates with an ellipsis (, ...), no information about the number or types
7506  of the parameters after the comma is supplied.<sup><a href="#note144"><b>144)</b></a></sup>
7507 <p><a name="6.7.6.3p10" href="#6.7.6.3p10"><small>10</small></a>
7508  The special case of an unnamed parameter of type void as the only item in the list
7509  specifies that the function has no parameters.
7510  
7511  
7512  
7513 <!--page 152 -->
7514 <p><a name="6.7.6.3p11" href="#6.7.6.3p11"><small>11</small></a>
7515  If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
7516  parameter name, it shall be taken as a typedef name.
7517 <p><a name="6.7.6.3p12" href="#6.7.6.3p12"><small>12</small></a>
7518  If the function declarator is not part of a definition of that function, parameters may have
7519  incomplete type and may use the [*] notation in their sequences of declarator specifiers
7520  to specify variable length array types.
7521 <p><a name="6.7.6.3p13" href="#6.7.6.3p13"><small>13</small></a>
7522  The storage-class specifier in the declaration specifiers for a parameter declaration, if
7523  present, is ignored unless the declared parameter is one of the members of the parameter
7524  type list for a function definition.
7525 <p><a name="6.7.6.3p14" href="#6.7.6.3p14"><small>14</small></a>
7526  An identifier list declares only the identifiers of the parameters of the function. An empty
7527  list in a function declarator that is part of a definition of that function specifies that the
7528  function has no parameters. The empty list in a function declarator that is not part of a
7529  definition of that function specifies that no information about the number or types of the
7530  parameters is supplied.<sup><a href="#note145"><b>145)</b></a></sup>
7531 <p><a name="6.7.6.3p15" href="#6.7.6.3p15"><small>15</small></a>
7532  For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note146"><b>146)</b></a></sup>
7533  Moreover, the parameter type lists, if both are present, shall agree in the number of
7534  parameters and in use of the ellipsis terminator; corresponding parameters shall have
7535  compatible types. If one type has a parameter type list and the other type is specified by a
7536  function declarator that is not part of a function definition and that contains an empty
7537  identifier list, the parameter list shall not have an ellipsis terminator and the type of each
7538  parameter shall be compatible with the type that results from the application of the
7539  default argument promotions. If one type has a parameter type list and the other type is
7540  specified by a function definition that contains a (possibly empty) identifier list, both shall
7541  agree in the number of parameters, and the type of each prototype parameter shall be
7542  compatible with the type that results from the application of the default argument
7543  promotions to the type of the corresponding identifier. (In the determination of type
7544  compatibility and of a composite type, each parameter declared with function or array
7545  type is taken as having the adjusted type and each parameter declared with qualified type
7546  is taken as having the unqualified version of its declared type.)
7547 <p><a name="6.7.6.3p16" href="#6.7.6.3p16"><small>16</small></a>
7548  EXAMPLE 1       The declaration
7549 <pre>
7550           int f(void), *fip(), (*pfi)();
7551 </pre>
7552  declares a function f with no parameters returning an int, a function fip with no parameter specification
7553  returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
7554  int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
7555  declaration suggests, and the same construction in an expression requires, the calling of a function fip,
7556  and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
7557  extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
7558  
7559  
7560 <!--page 153 -->
7561  designator, which is then used to call the function; it returns an int.
7562 <p><a name="6.7.6.3p17" href="#6.7.6.3p17"><small>17</small></a>
7563  If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
7564  declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
7565  internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
7566  the identifier of the pointer pfi has block scope and no linkage.
7567  
7568 <p><a name="6.7.6.3p18" href="#6.7.6.3p18"><small>18</small></a>
7569  EXAMPLE 2        The declaration
7570 <pre>
7571            int (*apfi[3])(int *x, int *y);
7572 </pre>
7573  declares an array apfi of three pointers to functions returning int. Each of these functions has two
7574  parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
7575  go out of scope at the end of the declaration of apfi.
7576  
7577 <p><a name="6.7.6.3p19" href="#6.7.6.3p19"><small>19</small></a>
7578  EXAMPLE 3        The declaration
7579 <pre>
7580            int (*fpfi(int (*)(long), int))(int, ...);
7581 </pre>
7582  declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
7583  parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
7584  The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
7585  additional arguments of any type.
7586  
7587 <p><a name="6.7.6.3p20" href="#6.7.6.3p20"><small>20</small></a>
7588  EXAMPLE 4        The following prototype has a variably modified parameter.
7589 <pre>
7590            void addscalar(int n, int m,
7591                  double a[n][n*m+300], double x);
7592            int main()
7593            {
7594                  double b[4][308];
7595                  addscalar(4, 2, b, <a href="#2.17">2.17</a>);
7596                  return 0;
7597            }
7598            void addscalar(int n, int m,
7599                  double a[n][n*m+300], double x)
7600            {
7601                  for (int i = 0; i &lt; n; i++)
7602                        for (int j = 0, k = n*m+300; j &lt; k; j++)
7603                              // a is a pointer to a VLA with n*m+300 elements
7604                              a[i][j] += x;
7605            }
7606 </pre>
7607  
7608 <p><a name="6.7.6.3p21" href="#6.7.6.3p21"><small>21</small></a>
7609  EXAMPLE 5        The following are all compatible function prototype declarators.
7610 <pre>
7611            double    maximum(int       n,   int   m,   double     a[n][m]);
7612            double    maximum(int       n,   int   m,   double     a[*][*]);
7613            double    maximum(int       n,   int   m,   double     a[ ][*]);
7614            double    maximum(int       n,   int   m,   double     a[ ][m]);
7615 </pre>
7616  as are:
7617 <!--page 154 -->
7618 <pre>
7619            void   f(double      (* restrict a)[5]);
7620            void   f(double      a[restrict][5]);
7621            void   f(double      a[restrict 3][5]);
7622            void   f(double      a[restrict static 3][5]);
7623 </pre>
7624  (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
7625  non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
7626  
7627 <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>).
7628
7629 <p><b>Footnotes</b>
7630 <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
7631  correspond to the ellipsis.
7632 </small>
7633 <p><small><a name="note145" href="#note145">145)</a> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
7634 </small>
7635 <p><small><a name="note146" href="#note146">146)</a> If both function types are ''old style'', parameter types are not compared.
7636 </small>
7637
7638 <p><small><a href="#Contents">Contents</a></small>
7639 <h4><a name="6.7.7" href="#6.7.7">6.7.7 Type names</a></h4>
7640 <p><b>Syntax</b>
7641 <p><a name="6.7.7p1" href="#6.7.7p1"><small>1</small></a>
7642 <pre>
7643           type-name:
7644                  specifier-qualifier-list abstract-declarator<sub>opt</sub>
7645           abstract-declarator:
7646                  pointer
7647                  pointer<sub>opt</sub> direct-abstract-declarator
7648           direct-abstract-declarator:
7649                   ( abstract-declarator )
7650                   direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list<sub>opt</sub>
7651                                  assignment-expression<sub>opt</sub> ]
7652                   direct-abstract-declarator<sub>opt</sub> [ static type-qualifier-list<sub>opt</sub>
7653                                  assignment-expression ]
7654                   direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list static
7655                                  assignment-expression ]
7656                   direct-abstract-declarator<sub>opt</sub> [ * ]
7657                   direct-abstract-declarator<sub>opt</sub> ( parameter-type-list<sub>opt</sub> )
7658 </pre>
7659 <p><b>Semantics</b>
7660 <p><a name="6.7.7p2" href="#6.7.7p2"><small>2</small></a>
7661  In several contexts, it is necessary to specify a type. This is accomplished using a type
7662  name, which is syntactically a declaration for a function or an object of that type that
7663  omits the identifier.<sup><a href="#note147"><b>147)</b></a></sup>
7664 <p><a name="6.7.7p3" href="#6.7.7p3"><small>3</small></a>
7665  EXAMPLE        The constructions
7666 <pre>
7667           (a)      int
7668           (b)      int   *
7669           (c)      int   *[3]
7670           (d)      int   (*)[3]
7671           (e)      int   (*)[*]
7672           (f)      int   *()
7673           (g)      int   (*)(void)
7674           (h)      int   (*const [])(unsigned int, ...)
7675 </pre>
7676  name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
7677  array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
7678  with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
7679  
7680  
7681 <!--page 155 -->
7682  returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
7683  parameter that has type unsigned int and an unspecified number of other parameters, returning an
7684  int.
7685  
7686
7687 <p><b>Footnotes</b>
7688 <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
7689  parameter specification'', rather than redundant parentheses around the omitted identifier.
7690 </small>
7691
7692 <p><small><a href="#Contents">Contents</a></small>
7693 <h4><a name="6.7.8" href="#6.7.8">6.7.8 Type definitions</a></h4>
7694 <p><b>Syntax</b>
7695 <p><a name="6.7.8p1" href="#6.7.8p1"><small>1</small></a>
7696 <pre>
7697           typedef-name:
7698                  identifier
7699 </pre>
7700 <p><b>Constraints</b>
7701 <p><a name="6.7.8p2" href="#6.7.8p2"><small>2</small></a>
7702  If a typedef name specifies a variably modified type then it shall have block scope.
7703 <p><b>Semantics</b>
7704 <p><a name="6.7.8p3" href="#6.7.8p3"><small>3</small></a>
7705  In a declaration whose storage-class specifier is typedef, each declarator defines an
7706  identifier to be a typedef name that denotes the type specified for the identifier in the way
7707  described in <a href="#6.7.6">6.7.6</a>. Any array size expressions associated with variable length array
7708  declarators are evaluated each time the declaration of the typedef name is reached in the
7709  order of execution. A typedef declaration does not introduce a new type, only a
7710  synonym for the type so specified. That is, in the following declarations:
7711 <pre>
7712           typedef T type_ident;
7713           type_ident D;
7714 </pre>
7715  type_ident is defined as a typedef name with the type specified by the declaration
7716  specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
7717  type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
7718  typedef name shares the same name space as other identifiers declared in ordinary
7719  declarators.
7720 <p><a name="6.7.8p4" href="#6.7.8p4"><small>4</small></a>
7721  EXAMPLE 1       After
7722 <pre>
7723           typedef int MILES, KLICKSP();
7724           typedef struct { double hi, lo; } range;
7725 </pre>
7726  the constructions
7727 <pre>
7728           MILES distance;
7729           extern KLICKSP *metricp;
7730           range x;
7731           range z, *zp;
7732 </pre>
7733  are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
7734  parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
7735  such a structure. The object distance has a type compatible with any other int object.
7736  
7737 <p><a name="6.7.8p5" href="#6.7.8p5"><small>5</small></a>
7738  EXAMPLE 2       After the declarations
7739 <pre>
7740           typedef struct s1 { int x; } t1, *tp1;
7741           typedef struct s2 { int x; } t2, *tp2;
7742 </pre>
7743  type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
7744 <!--page 156 -->
7745  s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
7746  
7747 <p><a name="6.7.8p6" href="#6.7.8p6"><small>6</small></a>
7748  EXAMPLE 3       The following obscure constructions
7749 <pre>
7750           typedef signed int t;
7751           typedef int plain;
7752           struct tag {
7753                 unsigned t:4;
7754                 const t:5;
7755                 plain r:5;
7756           };
7757 </pre>
7758  declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
7759  with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
7760  qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
7761  [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
7762  (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
7763  unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
7764  type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
7765  in an inner scope by
7766 <pre>
7767           t f(t (t));
7768           long t;
7769 </pre>
7770  then a function f is declared with type ''function returning signed int with one unnamed parameter
7771  with type pointer to function returning signed int with one unnamed parameter with type signed
7772  int'', and an identifier t with type long int.
7773  
7774 <p><a name="6.7.8p7" href="#6.7.8p7"><small>7</small></a>
7775  EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
7776  following declarations of the signal function specify exactly the same type, the first without making use
7777  of any typedef names.
7778 <pre>
7779           typedef void fv(int), (*pfv)(int);
7780           void (*signal(int, void (*)(int)))(int);
7781           fv *signal(int, fv *);
7782           pfv signal(int, pfv);
7783 </pre>
7784  
7785 <p><a name="6.7.8p8" href="#6.7.8p8"><small>8</small></a>
7786  EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
7787  time the typedef name is defined, not each time it is used:
7788 <!--page 157 -->
7789 <pre>
7790           void copyt(int n)
7791           {
7792                 typedef int B[n];   //               B is n ints, n evaluated now
7793                 n += 1;
7794                 B a;                //               a is n ints, n without += 1
7795                 int b[n];           //               a and b are different sizes
7796                 for (int i = 1; i &lt; n;               i++)
7797                       a[i-1] = b[i];
7798           }
7799 </pre>
7800
7801 <p><small><a href="#Contents">Contents</a></small>
7802 <h4><a name="6.7.9" href="#6.7.9">6.7.9 Initialization</a></h4>
7803 <p><b>Syntax</b>
7804 <p><a name="6.7.9p1" href="#6.7.9p1"><small>1</small></a>
7805 <pre>
7806           initializer:
7807                    assignment-expression
7808                    { initializer-list }
7809                    { initializer-list , }
7810           initializer-list:
7811                    designation<sub>opt</sub> initializer
7812                    initializer-list , designation<sub>opt</sub> initializer
7813           designation:
7814                  designator-list =
7815           designator-list:
7816                  designator
7817                  designator-list designator
7818           designator:
7819                  [ constant-expression ]
7820                  . identifier
7821 </pre>
7822 <p><b>Constraints</b>
7823 <p><a name="6.7.9p2" href="#6.7.9p2"><small>2</small></a>
7824  No initializer shall attempt to provide a value for an object not contained within the entity
7825  being initialized.
7826 <p><a name="6.7.9p3" href="#6.7.9p3"><small>3</small></a>
7827  The type of the entity to be initialized shall be an array of unknown size or a complete
7828  object type that is not a variable length array type.
7829 <p><a name="6.7.9p4" href="#6.7.9p4"><small>4</small></a>
7830  All the expressions in an initializer for an object that has static or thread storage duration
7831  shall be constant expressions or string literals.
7832 <p><a name="6.7.9p5" href="#6.7.9p5"><small>5</small></a>
7833  If the declaration of an identifier has block scope, and the identifier has external or
7834  internal linkage, the declaration shall have no initializer for the identifier.
7835 <p><a name="6.7.9p6" href="#6.7.9p6"><small>6</small></a>
7836  If a designator has the form
7837 <pre>
7838           [ constant-expression ]
7839 </pre>
7840  then the current object (defined below) shall have array type and the expression shall be
7841  an integer constant expression. If the array is of unknown size, any nonnegative value is
7842  valid.
7843 <p><a name="6.7.9p7" href="#6.7.9p7"><small>7</small></a>
7844  If a designator has the form
7845 <pre>
7846           . identifier
7847 </pre>
7848  then the current object (defined below) shall have structure or union type and the
7849  identifier shall be the name of a member of that type.
7850 <!--page 158 -->
7851 <p><b>Semantics</b>
7852 <p><a name="6.7.9p8" href="#6.7.9p8"><small>8</small></a>
7853  An initializer specifies the initial value stored in an object.
7854 <p><a name="6.7.9p9" href="#6.7.9p9"><small>9</small></a>
7855  Except where explicitly stated otherwise, for the purposes of this subclause unnamed
7856  members of objects of structure and union type do not participate in initialization.
7857  Unnamed members of structure objects have indeterminate value even after initialization.
7858 <p><a name="6.7.9p10" href="#6.7.9p10"><small>10</small></a>
7859  If an object that has automatic storage duration is not initialized explicitly, its value is
7860  indeterminate. If an object that has static or thread storage duration is not initialized
7861  explicitly, then:
7862 <ul>
7863 <li>  if it has pointer type, it is initialized to a null pointer;
7864 <li>  if it has arithmetic type, it is initialized to (positive or unsigned) zero;
7865 <li>  if it is an aggregate, every member is initialized (recursively) according to these rules,
7866  and any padding is initialized to zero bits;
7867 <li>  if it is a union, the first named member is initialized (recursively) according to these
7868  rules, and any padding is initialized to zero bits;
7869 </ul>
7870 <p><a name="6.7.9p11" href="#6.7.9p11"><small>11</small></a>
7871  The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
7872  initial value of the object is that of the expression (after conversion); the same type
7873  constraints and conversions as for simple assignment apply, taking the type of the scalar
7874  to be the unqualified version of its declared type.
7875 <p><a name="6.7.9p12" href="#6.7.9p12"><small>12</small></a>
7876  The rest of this subclause deals with initializers for objects that have aggregate or union
7877  type.
7878 <p><a name="6.7.9p13" href="#6.7.9p13"><small>13</small></a>
7879  The initializer for a structure or union object that has automatic storage duration shall be
7880  either an initializer list as described below, or a single expression that has compatible
7881  structure or union type. In the latter case, the initial value of the object, including
7882  unnamed members, is that of the expression.
7883 <p><a name="6.7.9p14" href="#6.7.9p14"><small>14</small></a>
7884  An array of character type may be initialized by a character string literal or UTF-8 string
7885  literal, optionally enclosed in braces. Successive bytes of the string literal (including the
7886  terminating null character if there is room or if the array is of unknown size) initialize the
7887  elements of the array.
7888 <p><a name="6.7.9p15" href="#6.7.9p15"><small>15</small></a>
7889  An array with element type compatible with a qualified or unqualified version of
7890  wchar_t, char16_t, or char32_t may be initialized by a wide string literal with
7891  the corresponding encoding prefix (L, u, or U, respectively), optionally enclosed in
7892  braces. Successive wide characters of the wide string literal (including the terminating
7893  null wide character if there is room or if the array is of unknown size) initialize the
7894  elements of the array.
7895 <p><a name="6.7.9p16" href="#6.7.9p16"><small>16</small></a>
7896  Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
7897  enclosed list of initializers for the elements or named members.
7898 <!--page 159 -->
7899 <p><a name="6.7.9p17" href="#6.7.9p17"><small>17</small></a>
7900  Each brace-enclosed initializer list has an associated current object. When no
7901  designations are present, subobjects of the current object are initialized in order according
7902  to the type of the current object: array elements in increasing subscript order, structure
7903  members in declaration order, and the first named member of a union.<sup><a href="#note148"><b>148)</b></a></sup> In contrast, a
7904  designation causes the following initializer to begin initialization of the subobject
7905  described by the designator. Initialization then continues forward in order, beginning
7906  with the next subobject after that described by the designator.<sup><a href="#note149"><b>149)</b></a></sup>
7907 <p><a name="6.7.9p18" href="#6.7.9p18"><small>18</small></a>
7908  Each designator list begins its description with the current object associated with the
7909  closest surrounding brace pair. Each item in the designator list (in order) specifies a
7910  particular member of its current object and changes the current object for the next
7911  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
7912  designator list is the subobject to be initialized by the following initializer.
7913 <p><a name="6.7.9p19" href="#6.7.9p19"><small>19</small></a>
7914  The initialization shall occur in initializer list order, each initializer provided for a
7915  particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note151"><b>151)</b></a></sup>
7916  all subobjects that are not initialized explicitly shall be initialized implicitly the same as
7917  objects that have static storage duration.
7918 <p><a name="6.7.9p20" href="#6.7.9p20"><small>20</small></a>
7919  If the aggregate or union contains elements or members that are aggregates or unions,
7920  these rules apply recursively to the subaggregates or contained unions. If the initializer of
7921  a subaggregate or contained union begins with a left brace, the initializers enclosed by
7922  that brace and its matching right brace initialize the elements or members of the
7923  subaggregate or the contained union. Otherwise, only enough initializers from the list are
7924  taken to account for the elements or members of the subaggregate or the first member of
7925  the contained union; any remaining initializers are left to initialize the next element or
7926  member of the aggregate of which the current subaggregate or contained union is a part.
7927 <p><a name="6.7.9p21" href="#6.7.9p21"><small>21</small></a>
7928  If there are fewer initializers in a brace-enclosed list than there are elements or members
7929  of an aggregate, or fewer characters in a string literal used to initialize an array of known
7930  size than there are elements in the array, the remainder of the aggregate shall be
7931  initialized implicitly the same as objects that have static storage duration.
7932  
7933  
7934  
7935 <!--page 160 -->
7936 <p><a name="6.7.9p22" href="#6.7.9p22"><small>22</small></a>
7937  If an array of unknown size is initialized, its size is determined by the largest indexed
7938  element with an explicit initializer. The array type is completed at the end of its
7939  initializer list.
7940 <p><a name="6.7.9p23" href="#6.7.9p23"><small>23</small></a>
7941  The evaluations of the initialization list expressions are indeterminately sequenced with
7942  respect to one another and thus the order in which any side effects occur is
7943  unspecified.<sup><a href="#note152"><b>152)</b></a></sup>
7944 <p><a name="6.7.9p24" href="#6.7.9p24"><small>24</small></a>
7945  EXAMPLE 1       Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
7946 <pre>
7947           int i = <a href="#3.5">3.5</a>;
7948           double complex c = 5 + 3 * I;
7949 </pre>
7950  define and initialize i with the value 3 and c with the value 5.0 + i3.0.
7951  
7952 <p><a name="6.7.9p25" href="#6.7.9p25"><small>25</small></a>
7953  EXAMPLE 2       The declaration
7954 <pre>
7955           int x[] = { 1, 3, 5 };
7956 </pre>
7957  defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
7958  and there are three initializers.
7959  
7960 <p><a name="6.7.9p26" href="#6.7.9p26"><small>26</small></a>
7961  EXAMPLE 3       The declaration
7962 <pre>
7963           int y[4][3] =         {
7964                 { 1, 3,         5 },
7965                 { 2, 4,         6 },
7966                 { 3, 5,         7 },
7967           };
7968 </pre>
7969  is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
7970  y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
7971  y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
7972  been achieved by
7973 <pre>
7974           int y[4][3] = {
7975                 1, 3, 5, 2, 4, 6, 3, 5, 7
7976           };
7977 </pre>
7978  The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
7979  next three are taken successively for y[1] and y[2].
7980  
7981 <p><a name="6.7.9p27" href="#6.7.9p27"><small>27</small></a>
7982  EXAMPLE 4       The declaration
7983 <pre>
7984           int z[4][3] = {
7985                 { 1 }, { 2 }, { 3 }, { 4 }
7986           };
7987 </pre>
7988  initializes the first column of z as specified and initializes the rest with zeros.
7989  
7990 <p><a name="6.7.9p28" href="#6.7.9p28"><small>28</small></a>
7991  EXAMPLE 5       The declaration
7992 <pre>
7993           struct { int a[3], b; } w[] = { { 1 }, 2 };
7994 </pre>
7995  is a definition with an inconsistently bracketed initialization. It defines an array with two element
7996  
7997  
7998  
7999 <!--page 161 -->
8000  structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
8001  
8002 <p><a name="6.7.9p29" href="#6.7.9p29"><small>29</small></a>
8003  EXAMPLE 6         The declaration
8004 <pre>
8005            short q[4][3][2] = {
8006                  { 1 },
8007                  { 2, 3 },
8008                  { 4, 5, 6 }
8009            };
8010 </pre>
8011  contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
8012  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
8013  q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
8014  q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
8015  only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
8016  for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
8017  respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
8018  diagnostic message would have been issued. The same initialization result could have been achieved by:
8019 <pre>
8020            short q[4][3][2] = {
8021                  1, 0, 0, 0, 0, 0,
8022                  2, 3, 0, 0, 0, 0,
8023                  4, 5, 6
8024            };
8025 </pre>
8026  or by:
8027 <pre>
8028            short q[4][3][2] = {
8029                  {
8030                        { 1 },
8031                  },
8032                  {
8033                        { 2, 3 },
8034                  },
8035                  {
8036                        { 4, 5 },
8037                        { 6 },
8038                  }
8039            };
8040 </pre>
8041  in a fully bracketed form.
8042 <p><a name="6.7.9p30" href="#6.7.9p30"><small>30</small></a>
8043  Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
8044  cause confusion.
8045  
8046 <p><a name="6.7.9p31" href="#6.7.9p31"><small>31</small></a>
8047  EXAMPLE 7         One form of initialization that completes array types involves typedef names. Given the
8048  declaration
8049 <pre>
8050            typedef int A[];            // OK - declared with block scope
8051 </pre>
8052  the declaration
8053 <pre>
8054            A a = { 1, 2 }, b = { 3, 4, 5 };
8055 </pre>
8056  is identical to
8057 <pre>
8058            int a[] = { 1, 2 }, b[] = { 3, 4, 5 };
8059 </pre>
8060  due to the rules for incomplete types.
8061 <!--page 162 -->
8062 <p><a name="6.7.9p32" href="#6.7.9p32"><small>32</small></a>
8063  EXAMPLE 8       The declaration
8064 <pre>
8065           char s[] = "abc", t[3] = "abc";
8066 </pre>
8067  defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
8068  This declaration is identical to
8069 <pre>
8070           char s[] = { 'a', 'b', 'c', '\0' },
8071                t[] = { 'a', 'b', 'c' };
8072 </pre>
8073  The contents of the arrays are modifiable. On the other hand, the declaration
8074 <pre>
8075           char *p = "abc";
8076 </pre>
8077  defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
8078  with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
8079  modify the contents of the array, the behavior is undefined.
8080  
8081 <p><a name="6.7.9p33" href="#6.7.9p33"><small>33</small></a>
8082  EXAMPLE 9       Arrays can be initialized to correspond to the elements of an enumeration by using
8083  designators:
8084 <pre>
8085           enum { member_one,           member_two };
8086           const char *nm[] =           {
8087                 [member_two]           = "member two",
8088                 [member_one]           = "member one",
8089           };
8090 </pre>
8091  
8092 <p><a name="6.7.9p34" href="#6.7.9p34"><small>34</small></a>
8093  EXAMPLE 10       Structure members can be initialized to nonzero values without depending on their order:
8094 <pre>
8095           div_t answer = { .quot = 2, .rem = -1 };
8096 </pre>
8097  
8098 <p><a name="6.7.9p35" href="#6.7.9p35"><small>35</small></a>
8099  EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
8100  might be misunderstood:
8101 <pre>
8102           struct { int a[3], b; } w[] =
8103                 { [0].a = {1}, [1].a[0] = 2 };
8104 </pre>
8105  
8106 <p><a name="6.7.9p36" href="#6.7.9p36"><small>36</small></a>
8107  EXAMPLE 12       Space can be ''allocated'' from both ends of an array by using a single designator:
8108 <pre>
8109           int a[MAX] = {
8110                 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
8111           };
8112 </pre>
8113 <p><a name="6.7.9p37" href="#6.7.9p37"><small>37</small></a>
8114  In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
8115  than ten, some of the values provided by the first five initializers will be overridden by the second five.
8116  
8117 <p><a name="6.7.9p38" href="#6.7.9p38"><small>38</small></a>
8118  EXAMPLE 13       Any member of a union can be initialized:
8119 <pre>
8120           union { /* ... */ } u = { .any_member = 42 };
8121 </pre>
8122  
8123 <p><b> Forward references</b>: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>).
8124 <!--page 163 -->
8125
8126 <p><b>Footnotes</b>
8127 <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
8128  subobjects are initialized as usual, but the subaggregate or contained union does not become the
8129  current object: current objects are associated only with brace-enclosed initializer lists.
8130 </small>
8131 <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
8132  the next subobject of an object containing the union.
8133 </small>
8134 <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
8135  the surrounding brace pair. Note, too, that each separate designator list is independent.
8136 </small>
8137 <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
8138  not be evaluated at all.
8139 </small>
8140 <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.
8141 </small>
8142
8143 <p><small><a href="#Contents">Contents</a></small>
8144 <h4><a name="6.7.10" href="#6.7.10">6.7.10 Static assertions</a></h4>
8145 <p><b>Syntax</b>
8146 <p><a name="6.7.10p1" href="#6.7.10p1"><small>1</small></a>
8147 <pre>
8148           static_assert-declaration:
8149                   _Static_assert ( constant-expression , string-literal ) ;
8150 </pre>
8151 <p><b>Constraints</b>
8152 <p><a name="6.7.10p2" href="#6.7.10p2"><small>2</small></a>
8153  The constant expression shall compare unequal to 0.
8154 <p><b>Semantics</b>
8155 <p><a name="6.7.10p3" href="#6.7.10p3"><small>3</small></a>
8156  The constant expression shall be an integer constant expression. If the value of the
8157  constant expression compares unequal to 0, the declaration has no effect. Otherwise, the
8158  constraint is violated and the implementation shall produce a diagnostic message that
8159  includes the text of the string literal, except that characters not in the basic source
8160  character set are not required to appear in the message.
8161 <p><b> Forward references</b>: diagnostics (<a href="#7.2">7.2</a>).
8162 <!--page 164 -->
8163
8164 <p><small><a href="#Contents">Contents</a></small>
8165 <h3><a name="6.8" href="#6.8">6.8 Statements and blocks</a></h3>
8166 <p><b>Syntax</b>
8167 <p><a name="6.8p1" href="#6.8p1"><small>1</small></a>
8168 <pre>
8169           statement:
8170                  labeled-statement
8171                  compound-statement
8172                  expression-statement
8173                  selection-statement
8174                  iteration-statement
8175                  jump-statement
8176 </pre>
8177 <p><b>Semantics</b>
8178 <p><a name="6.8p2" href="#6.8p2"><small>2</small></a>
8179  A statement specifies an action to be performed. Except as indicated, statements are
8180  executed in sequence.
8181 <p><a name="6.8p3" href="#6.8p3"><small>3</small></a>
8182  A block allows a set of declarations and statements to be grouped into one syntactic unit.
8183  The initializers of objects that have automatic storage duration, and the variable length
8184  array declarators of ordinary identifiers with block scope, are evaluated and the values are
8185  stored in the objects (including storing an indeterminate value in objects without an
8186  initializer) each time the declaration is reached in the order of execution, as if it were a
8187  statement, and within each declaration in the order that declarators appear.
8188 <p><a name="6.8p4" href="#6.8p4"><small>4</small></a>
8189  A full expression is an expression that is not part of another expression or of a declarator.
8190  Each of the following is a full expression: an initializer that is not part of a compound
8191  literal; the expression in an expression statement; the controlling expression of a selection
8192  statement (if or switch); the controlling expression of a while or do statement; each
8193  of the (optional) expressions of a for statement; the (optional) expression in a return
8194  statement. There is a sequence point between the evaluation of a full expression and the
8195  evaluation of the next full expression to be evaluated.
8196 <p><b> Forward references</b>: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
8197  (<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>).
8198
8199 <p><small><a href="#Contents">Contents</a></small>
8200 <h4><a name="6.8.1" href="#6.8.1">6.8.1 Labeled statements</a></h4>
8201 <p><b>Syntax</b>
8202 <p><a name="6.8.1p1" href="#6.8.1p1"><small>1</small></a>
8203 <pre>
8204           labeled-statement:
8205                  identifier : statement
8206                  case constant-expression : statement
8207                  default : statement
8208 </pre>
8209 <p><b>Constraints</b>
8210 <p><a name="6.8.1p2" href="#6.8.1p2"><small>2</small></a>
8211  A case or default label shall appear only in a switch statement. Further
8212  constraints on such labels are discussed under the switch statement.
8213 <!--page 165 -->
8214 <p><a name="6.8.1p3" href="#6.8.1p3"><small>3</small></a>
8215  Label names shall be unique within a function.
8216 <p><b>Semantics</b>
8217 <p><a name="6.8.1p4" href="#6.8.1p4"><small>4</small></a>
8218  Any statement may be preceded by a prefix that declares an identifier as a label name.
8219  Labels in themselves do not alter the flow of control, which continues unimpeded across
8220  them.
8221 <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>).
8222
8223 <p><small><a href="#Contents">Contents</a></small>
8224 <h4><a name="6.8.2" href="#6.8.2">6.8.2 Compound statement</a></h4>
8225 <p><b>Syntax</b>
8226 <p><a name="6.8.2p1" href="#6.8.2p1"><small>1</small></a>
8227 <pre>
8228           compound-statement:
8229                 { block-item-list<sub>opt</sub> }
8230           block-item-list:
8231                   block-item
8232                   block-item-list block-item
8233           block-item:
8234                   declaration
8235                   statement
8236 </pre>
8237 <p><b>Semantics</b>
8238 <p><a name="6.8.2p2" href="#6.8.2p2"><small>2</small></a>
8239  A compound statement is a block.
8240
8241 <p><small><a href="#Contents">Contents</a></small>
8242 <h4><a name="6.8.3" href="#6.8.3">6.8.3 Expression and null statements</a></h4>
8243 <p><b>Syntax</b>
8244 <p><a name="6.8.3p1" href="#6.8.3p1"><small>1</small></a>
8245 <pre>
8246           expression-statement:
8247                  expression<sub>opt</sub> ;
8248 </pre>
8249 <p><b>Semantics</b>
8250 <p><a name="6.8.3p2" href="#6.8.3p2"><small>2</small></a>
8251  The expression in an expression statement is evaluated as a void expression for its side
8252  effects.<sup><a href="#note153"><b>153)</b></a></sup>
8253 <p><a name="6.8.3p3" href="#6.8.3p3"><small>3</small></a>
8254  A null statement (consisting of just a semicolon) performs no operations.
8255 <p><a name="6.8.3p4" href="#6.8.3p4"><small>4</small></a>
8256  EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
8257  discarding of its value may be made explicit by converting the expression to a void expression by means of
8258  a cast:
8259 <pre>
8260           int p(int);
8261           /* ... */
8262           (void)p(0);
8263 </pre>
8264  
8265  
8266  
8267 <!--page 166 -->
8268 <p><a name="6.8.3p5" href="#6.8.3p5"><small>5</small></a>
8269  EXAMPLE 2       In the program fragment
8270 <pre>
8271           char *s;
8272           /* ... */
8273           while (*s++ != '\0')
8274                   ;
8275 </pre>
8276  a null statement is used to supply an empty loop body to the iteration statement.
8277  
8278 <p><a name="6.8.3p6" href="#6.8.3p6"><small>6</small></a>
8279  EXAMPLE 3       A null statement may also be used to carry a label just before the closing } of a compound
8280  statement.
8281 <pre>
8282           while (loop1) {
8283                 /* ... */
8284                 while (loop2) {
8285                         /* ... */
8286                         if (want_out)
8287                                 goto end_loop1;
8288                         /* ... */
8289                 }
8290                 /* ... */
8291           end_loop1: ;
8292           }
8293 </pre>
8294  
8295 <p><b> Forward references</b>: iteration statements (<a href="#6.8.5">6.8.5</a>).
8296
8297 <p><b>Footnotes</b>
8298 <p><small><a name="note153" href="#note153">153)</a> Such as assignments, and function calls which have side effects.
8299 </small>
8300
8301 <p><small><a href="#Contents">Contents</a></small>
8302 <h4><a name="6.8.4" href="#6.8.4">6.8.4 Selection statements</a></h4>
8303 <p><b>Syntax</b>
8304 <p><a name="6.8.4p1" href="#6.8.4p1"><small>1</small></a>
8305 <pre>
8306           selection-statement:
8307                   if ( expression ) statement
8308                   if ( expression ) statement else statement
8309                   switch ( expression ) statement
8310 </pre>
8311 <p><b>Semantics</b>
8312 <p><a name="6.8.4p2" href="#6.8.4p2"><small>2</small></a>
8313  A selection statement selects among a set of statements depending on the value of a
8314  controlling expression.
8315 <p><a name="6.8.4p3" href="#6.8.4p3"><small>3</small></a>
8316  A selection statement is a block whose scope is a strict subset of the scope of its
8317  enclosing block. Each associated substatement is also a block whose scope is a strict
8318  subset of the scope of the selection statement.
8319
8320 <p><small><a href="#Contents">Contents</a></small>
8321 <h5><a name="6.8.4.1" href="#6.8.4.1">6.8.4.1 The if statement</a></h5>
8322 <p><b>Constraints</b>
8323 <p><a name="6.8.4.1p1" href="#6.8.4.1p1"><small>1</small></a>
8324  The controlling expression of an if statement shall have scalar type.
8325 <p><b>Semantics</b>
8326 <p><a name="6.8.4.1p2" href="#6.8.4.1p2"><small>2</small></a>
8327  In both forms, the first substatement is executed if the expression compares unequal to 0.
8328  In the else form, the second substatement is executed if the expression compares equal
8329 <!--page 167 -->
8330  to 0. If the first substatement is reached via a label, the second substatement is not
8331  executed.
8332 <p><a name="6.8.4.1p3" href="#6.8.4.1p3"><small>3</small></a>
8333  An else is associated with the lexically nearest preceding if that is allowed by the
8334  syntax.
8335
8336 <p><small><a href="#Contents">Contents</a></small>
8337 <h5><a name="6.8.4.2" href="#6.8.4.2">6.8.4.2 The switch statement</a></h5>
8338 <p><b>Constraints</b>
8339 <p><a name="6.8.4.2p1" href="#6.8.4.2p1"><small>1</small></a>
8340  The controlling expression of a switch statement shall have integer type.
8341 <p><a name="6.8.4.2p2" href="#6.8.4.2p2"><small>2</small></a>
8342  If a switch statement has an associated case or default label within the scope of an
8343  identifier with a variably modified type, the entire switch statement shall be within the
8344  scope of that identifier.<sup><a href="#note154"><b>154)</b></a></sup>
8345 <p><a name="6.8.4.2p3" href="#6.8.4.2p3"><small>3</small></a>
8346  The expression of each case label shall be an integer constant expression and no two of
8347  the case constant expressions in the same switch statement shall have the same value
8348  after conversion. There may be at most one default label in a switch statement.
8349  (Any enclosed switch statement may have a default label or case constant
8350  expressions with values that duplicate case constant expressions in the enclosing
8351  switch statement.)
8352 <p><b>Semantics</b>
8353 <p><a name="6.8.4.2p4" href="#6.8.4.2p4"><small>4</small></a>
8354  A switch statement causes control to jump to, into, or past the statement that is the
8355  switch body, depending on the value of a controlling expression, and on the presence of a
8356  default label and the values of any case labels on or in the switch body. A case or
8357  default label is accessible only within the closest enclosing switch statement.
8358 <p><a name="6.8.4.2p5" href="#6.8.4.2p5"><small>5</small></a>
8359  The integer promotions are performed on the controlling expression. The constant
8360  expression in each case label is converted to the promoted type of the controlling
8361  expression. If a converted value matches that of the promoted controlling expression,
8362  control jumps to the statement following the matched case label. Otherwise, if there is
8363  a default label, control jumps to the labeled statement. If no converted case constant
8364  expression matches and there is no default label, no part of the switch body is
8365  executed.
8366 <p><b>Implementation limits</b>
8367 <p><a name="6.8.4.2p6" href="#6.8.4.2p6"><small>6</small></a>
8368  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
8369  switch statement.
8370  
8371  
8372  
8373  
8374 <!--page 168 -->
8375 <p><a name="6.8.4.2p7" href="#6.8.4.2p7"><small>7</small></a>
8376  EXAMPLE        In the artificial program fragment
8377 <pre>
8378           switch (expr)
8379           {
8380                 int i = 4;
8381                 f(i);
8382           case 0:
8383                 i = 17;
8384                 /* falls through into default code */
8385           default:
8386                 printf("%d\n", i);
8387           }
8388 </pre>
8389  the object whose identifier is i exists with automatic storage duration (within the block) but is never
8390  initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
8391  access an indeterminate value. Similarly, the call to the function f cannot be reached.
8392  
8393
8394 <p><b>Footnotes</b>
8395 <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
8396  default label associated with the switch that is in the block containing the declaration.
8397 </small>
8398
8399 <p><small><a href="#Contents">Contents</a></small>
8400 <h4><a name="6.8.5" href="#6.8.5">6.8.5 Iteration statements</a></h4>
8401 <p><b>Syntax</b>
8402 <p><a name="6.8.5p1" href="#6.8.5p1"><small>1</small></a>
8403 <pre>
8404           iteration-statement:
8405                   while ( expression ) statement
8406                   do statement while ( expression ) ;
8407                   for ( expression<sub>opt</sub> ; expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
8408                   for ( declaration expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
8409 </pre>
8410 <p><b>Constraints</b>
8411 <p><a name="6.8.5p2" href="#6.8.5p2"><small>2</small></a>
8412  The controlling expression of an iteration statement shall have scalar type.
8413 <p><a name="6.8.5p3" href="#6.8.5p3"><small>3</small></a>
8414  The declaration part of a for statement shall only declare identifiers for objects having
8415  storage class auto or register.
8416 <p><b>Semantics</b>
8417 <p><a name="6.8.5p4" href="#6.8.5p4"><small>4</small></a>
8418  An iteration statement causes a statement called the loop body to be executed repeatedly
8419  until the controlling expression compares equal to 0. The repetition occurs regardless of
8420  whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note155"><b>155)</b></a></sup>
8421 <p><a name="6.8.5p5" href="#6.8.5p5"><small>5</small></a>
8422  An iteration statement is a block whose scope is a strict subset of the scope of its
8423  enclosing block. The loop body is also a block whose scope is a strict subset of the scope
8424  of the iteration statement.
8425 <p><a name="6.8.5p6" href="#6.8.5p6"><small>6</small></a>
8426  An iteration statement whose controlling expression is not a constant expression,<sup><a href="#note156"><b>156)</b></a></sup> that
8427  performs no input/output operations, does not access volatile objects, and performs no
8428  synchronization or atomic operations in its body, controlling expression, or (in the case of
8429  
8430 <!--page 169 -->
8431  a for statement) its expression-3, may be assumed by the implementation to
8432  terminate.<sup><a href="#note157"><b>157)</b></a></sup>
8433
8434 <p><b>Footnotes</b>
8435 <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
8436  statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
8437 </small>
8438 <p><small><a name="note156" href="#note156">156)</a> An omitted controlling expression is replaced by a nonzero constant, which is a constant expression.
8439 </small>
8440 <p><small><a name="note157" href="#note157">157)</a> This is intended to allow compiler transformations such as removal of empty loops even when
8441  termination cannot be proven.
8442 </small>
8443
8444 <p><small><a href="#Contents">Contents</a></small>
8445 <h5><a name="6.8.5.1" href="#6.8.5.1">6.8.5.1 The while statement</a></h5>
8446 <p><a name="6.8.5.1p1" href="#6.8.5.1p1"><small>1</small></a>
8447  The evaluation of the controlling expression takes place before each execution of the loop
8448  body.
8449
8450 <p><small><a href="#Contents">Contents</a></small>
8451 <h5><a name="6.8.5.2" href="#6.8.5.2">6.8.5.2 The do statement</a></h5>
8452 <p><a name="6.8.5.2p1" href="#6.8.5.2p1"><small>1</small></a>
8453  The evaluation of the controlling expression takes place after each execution of the loop
8454  body.
8455
8456 <p><small><a href="#Contents">Contents</a></small>
8457 <h5><a name="6.8.5.3" href="#6.8.5.3">6.8.5.3 The for statement</a></h5>
8458 <p><a name="6.8.5.3p1" href="#6.8.5.3p1"><small>1</small></a>
8459  The statement
8460 <pre>
8461           for ( clause-1 ; expression-2 ; expression-3 ) statement
8462 </pre>
8463  behaves as follows: The expression expression-2 is the controlling expression that is
8464  evaluated before each execution of the loop body. The expression expression-3 is
8465  evaluated as a void expression after each execution of the loop body. If clause-1 is a
8466  declaration, the scope of any identifiers it declares is the remainder of the declaration and
8467  the entire loop, including the other two expressions; it is reached in the order of execution
8468  before the first evaluation of the controlling expression. If clause-1 is an expression, it is
8469  evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note158"><b>158)</b></a></sup>
8470 <p><a name="6.8.5.3p2" href="#6.8.5.3p2"><small>2</small></a>
8471  Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
8472  nonzero constant.
8473
8474 <p><b>Footnotes</b>
8475 <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
8476  the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
8477  such that execution of the loop continues until the expression compares equal to 0; and expression-3
8478  specifies an operation (such as incrementing) that is performed after each iteration.
8479 </small>
8480
8481 <p><small><a href="#Contents">Contents</a></small>
8482 <h4><a name="6.8.6" href="#6.8.6">6.8.6 Jump statements</a></h4>
8483 <p><b>Syntax</b>
8484 <p><a name="6.8.6p1" href="#6.8.6p1"><small>1</small></a>
8485 <pre>
8486           jump-statement:
8487                  goto identifier ;
8488                  continue ;
8489                  break ;
8490                  return expression<sub>opt</sub> ;
8491 </pre>
8492  
8493  
8494  
8495  
8496 <!--page 170 -->
8497 <p><b>Semantics</b>
8498 <p><a name="6.8.6p2" href="#6.8.6p2"><small>2</small></a>
8499  A jump statement causes an unconditional jump to another place.
8500
8501 <p><small><a href="#Contents">Contents</a></small>
8502 <h5><a name="6.8.6.1" href="#6.8.6.1">6.8.6.1 The goto statement</a></h5>
8503 <p><b>Constraints</b>
8504 <p><a name="6.8.6.1p1" href="#6.8.6.1p1"><small>1</small></a>
8505  The identifier in a goto statement shall name a label located somewhere in the enclosing
8506  function. A goto statement shall not jump from outside the scope of an identifier having
8507  a variably modified type to inside the scope of that identifier.
8508 <p><b>Semantics</b>
8509 <p><a name="6.8.6.1p2" href="#6.8.6.1p2"><small>2</small></a>
8510  A goto statement causes an unconditional jump to the statement prefixed by the named
8511  label in the enclosing function.
8512 <p><a name="6.8.6.1p3" href="#6.8.6.1p3"><small>3</small></a>
8513  EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
8514  following outline presents one possible approach to a problem based on these three assumptions:
8515 <ol>
8516 <li>  The general initialization code accesses objects only visible to the current function.
8517 <li>  The general initialization code is too large to warrant duplication.
8518 <li>  The code to determine the next operation is at the head of the loop. (To allow it to be reached by
8519  continue statements, for example.)
8520 <!--page 171 -->
8521 <pre>
8522     /* ... */
8523     goto first_time;
8524     for (;;) {
8525             // determine next operation
8526             /* ... */
8527             if (need to reinitialize) {
8528                     // reinitialize-only code
8529                     /* ... */
8530             first_time:
8531                     // general initialization code
8532                     /* ... */
8533                     continue;
8534             }
8535             // handle other operations
8536             /* ... */
8537     }
8538 </pre>
8539 </ol>
8540 <p><a name="6.8.6.1p4" href="#6.8.6.1p4"><small>4</small></a>
8541  EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
8542  modified types. A jump within the scope, however, is permitted.
8543 <pre>
8544          goto lab3;                         // invalid: going INTO scope of VLA.
8545          {
8546                double a[n];
8547                a[j] = <a href="#4.4">4.4</a>;
8548          lab3:
8549                a[j] = <a href="#3.3">3.3</a>;
8550                goto lab4;                   // valid: going WITHIN scope of VLA.
8551                a[j] = <a href="#5.5">5.5</a>;
8552          lab4:
8553                a[j] = <a href="#6.6">6.6</a>;
8554          }
8555          goto lab4;                         // invalid: going INTO scope of VLA.
8556 </pre>
8557  
8558
8559 <p><small><a href="#Contents">Contents</a></small>
8560 <h5><a name="6.8.6.2" href="#6.8.6.2">6.8.6.2 The continue statement</a></h5>
8561 <p><b>Constraints</b>
8562 <p><a name="6.8.6.2p1" href="#6.8.6.2p1"><small>1</small></a>
8563  A continue statement shall appear only in or as a loop body.
8564 <p><b>Semantics</b>
8565 <p><a name="6.8.6.2p2" href="#6.8.6.2p2"><small>2</small></a>
8566  A continue statement causes a jump to the loop-continuation portion of the smallest
8567  enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
8568  of the statements
8569  while (/* ... */) {                  do {                                 for (/* ... */) {
8570 <pre>
8571     /* ... */                            /* ... */                            /* ... */
8572     continue;                            continue;                            continue;
8573     /* ... */                            /* ... */                            /* ... */
8574 </pre>
8575  contin: ;                            contin: ;                            contin: ;
8576  }                                    } while (/* ... */);                 }
8577  unless the continue statement shown is in an enclosed iteration statement (in which
8578  case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note159"><b>159)</b></a></sup>
8579
8580 <p><b>Footnotes</b>
8581 <p><small><a name="note159" href="#note159">159)</a> Following the contin: label is a null statement.
8582 </small>
8583
8584 <p><small><a href="#Contents">Contents</a></small>
8585 <h5><a name="6.8.6.3" href="#6.8.6.3">6.8.6.3 The break statement</a></h5>
8586 <p><b>Constraints</b>
8587 <p><a name="6.8.6.3p1" href="#6.8.6.3p1"><small>1</small></a>
8588  A break statement shall appear only in or as a switch body or loop body.
8589 <p><b>Semantics</b>
8590 <p><a name="6.8.6.3p2" href="#6.8.6.3p2"><small>2</small></a>
8591  A break statement terminates execution of the smallest enclosing switch or iteration
8592  statement.
8593  
8594  
8595  
8596 <!--page 172 -->
8597
8598 <p><small><a href="#Contents">Contents</a></small>
8599 <h5><a name="6.8.6.4" href="#6.8.6.4">6.8.6.4 The return statement</a></h5>
8600 <p><b>Constraints</b>
8601 <p><a name="6.8.6.4p1" href="#6.8.6.4p1"><small>1</small></a>
8602  A return statement with an expression shall not appear in a function whose return type
8603  is void. A return statement without an expression shall only appear in a function
8604  whose return type is void.
8605 <p><b>Semantics</b>
8606 <p><a name="6.8.6.4p2" href="#6.8.6.4p2"><small>2</small></a>
8607  A return statement terminates execution of the current function and returns control to
8608  its caller. A function may have any number of return statements.
8609 <p><a name="6.8.6.4p3" href="#6.8.6.4p3"><small>3</small></a>
8610  If a return statement with an expression is executed, the value of the expression is
8611  returned to the caller as the value of the function call expression. If the expression has a
8612  type different from the return type of the function in which it appears, the value is
8613  converted as if by assignment to an object having the return type of the function.<sup><a href="#note160"><b>160)</b></a></sup>
8614 <p><a name="6.8.6.4p4" href="#6.8.6.4p4"><small>4</small></a>
8615  EXAMPLE       In:
8616 <pre>
8617          struct s { double i; } f(void);
8618          union {
8619                struct {
8620                      int f1;
8621                      struct s f2;
8622                } u1;
8623                struct {
8624                      struct s f3;
8625                      int f4;
8626                } u2;
8627          } g;
8628          struct s f(void)
8629          {
8630                return g.u1.f2;
8631          }
8632          /* ... */
8633          g.u2.f3 = f();
8634 </pre>
8635  there is no undefined behavior, although there would be if the assignment were done directly (without using
8636  a function call to fetch the value).
8637  
8638  
8639  
8640  
8641 <!--page 173 -->
8642
8643 <p><b>Footnotes</b>
8644 <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
8645  apply to the case of function return. The representation of floating-point values may have wider range
8646  or precision than implied by the type; a cast may be used to remove this extra range and precision.
8647 </small>
8648
8649 <p><small><a href="#Contents">Contents</a></small>
8650 <h3><a name="6.9" href="#6.9">6.9 External definitions</a></h3>
8651 <p><b>Syntax</b>
8652 <p><a name="6.9p1" href="#6.9p1"><small>1</small></a>
8653 <pre>
8654           translation-unit:
8655                   external-declaration
8656                   translation-unit external-declaration
8657           external-declaration:
8658                  function-definition
8659                  declaration
8660 </pre>
8661 <p><b>Constraints</b>
8662 <p><a name="6.9p2" href="#6.9p2"><small>2</small></a>
8663  The storage-class specifiers auto and register shall not appear in the declaration
8664  specifiers in an external declaration.
8665 <p><a name="6.9p3" href="#6.9p3"><small>3</small></a>
8666  There shall be no more than one external definition for each identifier declared with
8667  internal linkage in a translation unit. Moreover, if an identifier declared with internal
8668  linkage is used in an expression (other than as a part of the operand of a sizeof or
8669  _Alignof operator whose result is an integer constant), there shall be exactly one
8670  external definition for the identifier in the translation unit.
8671 <p><b>Semantics</b>
8672 <p><a name="6.9p4" href="#6.9p4"><small>4</small></a>
8673  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,
8674  which consists of a sequence of external declarations. These are described as ''external''
8675  because they appear outside any function (and hence have file scope). As discussed in
8676  <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
8677  by the identifier is a definition.
8678 <p><a name="6.9p5" href="#6.9p5"><small>5</small></a>
8679  An external definition is an external declaration that is also a definition of a function
8680  (other than an inline definition) or an object. If an identifier declared with external
8681  linkage is used in an expression (other than as part of the operand of a sizeof or
8682  _Alignof operator whose result is an integer constant), somewhere in the entire
8683  program there shall be exactly one external definition for the identifier; otherwise, there
8684  shall be no more than one.<sup><a href="#note161"><b>161)</b></a></sup>
8685  
8686  
8687  
8688  
8689 <!--page 174 -->
8690
8691 <p><b>Footnotes</b>
8692 <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
8693  external definition for it.
8694 </small>
8695
8696 <p><small><a href="#Contents">Contents</a></small>
8697 <h4><a name="6.9.1" href="#6.9.1">6.9.1 Function definitions</a></h4>
8698 <p><b>Syntax</b>
8699 <p><a name="6.9.1p1" href="#6.9.1p1"><small>1</small></a>
8700 <pre>
8701           function-definition:
8702                  declaration-specifiers declarator declaration-list<sub>opt</sub> compound-statement
8703           declaration-list:
8704                  declaration
8705                  declaration-list declaration
8706 </pre>
8707 <p><b>Constraints</b>
8708 <p><a name="6.9.1p2" href="#6.9.1p2"><small>2</small></a>
8709  The identifier declared in a function definition (which is the name of the function) shall
8710  have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note162"><b>162)</b></a></sup>
8711 <p><a name="6.9.1p3" href="#6.9.1p3"><small>3</small></a>
8712  The return type of a function shall be void or a complete object type other than array
8713  type.
8714 <p><a name="6.9.1p4" href="#6.9.1p4"><small>4</small></a>
8715  The storage-class specifier, if any, in the declaration specifiers shall be either extern or
8716  static.
8717 <p><a name="6.9.1p5" href="#6.9.1p5"><small>5</small></a>
8718  If the declarator includes a parameter type list, the declaration of each parameter shall
8719  include an identifier, except for the special case of a parameter list consisting of a single
8720  parameter of type void, in which case there shall not be an identifier. No declaration list
8721  shall follow.
8722 <p><a name="6.9.1p6" href="#6.9.1p6"><small>6</small></a>
8723  If the declarator includes an identifier list, each declaration in the declaration list shall
8724  have at least one declarator, those declarators shall declare only identifiers from the
8725  identifier list, and every identifier in the identifier list shall be declared. An identifier
8726  declared as a typedef name shall not be redeclared as a parameter. The declarations in the
8727  declaration list shall contain no storage-class specifier other than register and no
8728  initializations.
8729  
8730  
8731  
8732 <!--page 175 -->
8733 <p><b>Semantics</b>
8734 <p><a name="6.9.1p7" href="#6.9.1p7"><small>7</small></a>
8735  The declarator in a function definition specifies the name of the function being defined
8736  and the identifiers of its parameters. If the declarator includes a parameter type list, the
8737  list also specifies the types of all the parameters; such a declarator also serves as a
8738  function prototype for later calls to the same function in the same translation unit. If the
8739  declarator includes an identifier list,<sup><a href="#note163"><b>163)</b></a></sup> the types of the parameters shall be declared in a
8740  following declaration list. In either case, the type of each parameter is adjusted as
8741  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
8742  type.
8743 <p><a name="6.9.1p8" href="#6.9.1p8"><small>8</small></a>
8744  If a function that accepts a variable number of arguments is defined without a parameter
8745  type list that ends with the ellipsis notation, the behavior is undefined.
8746 <p><a name="6.9.1p9" href="#6.9.1p9"><small>9</small></a>
8747  Each parameter has automatic storage duration; its identifier is an lvalue.<sup><a href="#note164"><b>164)</b></a></sup> The layout
8748  of the storage for parameters is unspecified.
8749 <p><a name="6.9.1p10" href="#6.9.1p10"><small>10</small></a>
8750  On entry to the function, the size expressions of each variably modified parameter are
8751  evaluated and the value of each argument expression is converted to the type of the
8752  corresponding parameter as if by assignment. (Array expressions and function
8753  designators as arguments were converted to pointers before the call.)
8754 <p><a name="6.9.1p11" href="#6.9.1p11"><small>11</small></a>
8755  After all parameters have been assigned, the compound statement that constitutes the
8756  body of the function definition is executed.
8757 <p><a name="6.9.1p12" href="#6.9.1p12"><small>12</small></a>
8758  If the } that terminates a function is reached, and the value of the function call is used by
8759  the caller, the behavior is undefined.
8760 <p><a name="6.9.1p13" href="#6.9.1p13"><small>13</small></a>
8761  EXAMPLE 1       In the following:
8762 <pre>
8763           extern int max(int a, int b)
8764           {
8765                 return a &gt; b ? a : b;
8766           }
8767 </pre>
8768  extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
8769  function declarator; and
8770 <pre>
8771           { return a &gt; b ? a : b; }
8772 </pre>
8773  is the function body. The following similar definition uses the identifier-list form for the parameter
8774  declarations:
8775  
8776  
8777  
8778  
8779 <!--page 176 -->
8780 <pre>
8781           extern int max(a, b)
8782           int a, b;
8783           {
8784                 return a &gt; b ? a : b;
8785           }
8786 </pre>
8787  Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
8788  that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
8789  to the function, whereas the second form does not.
8790  
8791 <p><a name="6.9.1p14" href="#6.9.1p14"><small>14</small></a>
8792  EXAMPLE 2           To pass one function to another, one might say
8793 <pre>
8794                       int f(void);
8795                       /* ... */
8796                       g(f);
8797 </pre>
8798  Then the definition of g might read
8799 <pre>
8800           void g(int (*funcp)(void))
8801           {
8802                 /* ... */
8803                 (*funcp)(); /* or funcp(); ...                    */
8804           }
8805 </pre>
8806  or, equivalently,
8807 <pre>
8808           void g(int func(void))
8809           {
8810                 /* ... */
8811                 func(); /* or (*func)(); ...                   */
8812           }
8813 </pre>
8814  
8815
8816 <p><b>Footnotes</b>
8817 <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:
8818
8819 <pre>
8820           typedef int F(void);                          //   type F is ''function with no parameters
8821                                                         //                  returning int''
8822           F f, g;                                       //   f and g both have type compatible with F
8823           F f { /* ... */ }                             //   WRONG: syntax/constraint error
8824           F g() { /* ... */ }                           //   WRONG: declares that g returns a function
8825           int f(void) { /* ... */ }                     //   RIGHT: f has type compatible with F
8826           int g() { /* ... */ }                         //   RIGHT: g has type compatible with F
8827           F *e(void) { /* ... */ }                      //   e returns a pointer to a function
8828           F *((e))(void) { /* ... */ }                  //   same: parentheses irrelevant
8829           int (*fp)(void);                              //   fp points to a function that has type F
8830           F *Fp;                                        //   Fp points to a function that has type F
8831 </pre>
8832 </small>
8833 <p><small><a name="note163" href="#note163">163)</a> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
8834 </small>
8835 <p><small><a name="note164" href="#note164">164)</a> A parameter identifier cannot be redeclared in the function body except in an enclosed block.
8836 </small>
8837
8838 <p><small><a href="#Contents">Contents</a></small>
8839 <h4><a name="6.9.2" href="#6.9.2">6.9.2 External object definitions</a></h4>
8840 <p><b>Semantics</b>
8841 <p><a name="6.9.2p1" href="#6.9.2p1"><small>1</small></a>
8842  If the declaration of an identifier for an object has file scope and an initializer, the
8843  declaration is an external definition for the identifier.
8844 <p><a name="6.9.2p2" href="#6.9.2p2"><small>2</small></a>
8845  A declaration of an identifier for an object that has file scope without an initializer, and
8846  without a storage-class specifier or with the storage-class specifier static, constitutes a
8847  tentative definition. If a translation unit contains one or more tentative definitions for an
8848  identifier, and the translation unit contains no external definition for that identifier, then
8849  the behavior is exactly as if the translation unit contains a file scope declaration of that
8850  identifier, with the composite type as of the end of the translation unit, with an initializer
8851  equal to 0.
8852 <p><a name="6.9.2p3" href="#6.9.2p3"><small>3</small></a>
8853  If the declaration of an identifier for an object is a tentative definition and has internal
8854  linkage, the declared type shall not be an incomplete type.
8855 <!--page 177 -->
8856 <p><a name="6.9.2p4" href="#6.9.2p4"><small>4</small></a>
8857  EXAMPLE 1
8858 <pre>
8859           int i1 = 1;                    // definition, external linkage
8860           static int i2 = 2;             // definition, internal linkage
8861           extern int i3 = 3;             // definition, external linkage
8862           int i4;                        // tentative definition, external linkage
8863           static int i5;                 // tentative definition, internal linkage
8864           int   i1;                      // valid tentative definition, refers to previous
8865           int   i2;                      // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
8866           int   i3;                      // valid tentative definition, refers to previous
8867           int   i4;                      // valid tentative definition, refers to previous
8868           int   i5;                      // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
8869           extern    int   i1;            // refers to previous, whose linkage is external
8870           extern    int   i2;            // refers to previous, whose linkage is internal
8871           extern    int   i3;            // refers to previous, whose linkage is external
8872           extern    int   i4;            // refers to previous, whose linkage is external
8873           extern    int   i5;            // refers to previous, whose linkage is internal
8874 </pre>
8875  
8876 <p><a name="6.9.2p5" href="#6.9.2p5"><small>5</small></a>
8877  EXAMPLE 2       If at the end of the translation unit containing
8878 <pre>
8879           int i[];
8880 </pre>
8881  the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
8882  zero on program startup.
8883 <!--page 178 -->
8884
8885 <p><small><a href="#Contents">Contents</a></small>
8886 <h3><a name="6.10" href="#6.10">6.10 Preprocessing directives</a></h3>
8887 <p><b>Syntax</b>
8888 <p><a name="6.10p1" href="#6.10p1"><small>1</small></a>
8889 <!--page 179 -->
8890 <pre>
8891           preprocessing-file:
8892                  group<sub>opt</sub>
8893           group:
8894                    group-part
8895                    group group-part
8896           group-part:
8897                  if-section
8898                  control-line
8899                  text-line
8900                  # non-directive
8901           if-section:
8902                    if-group elif-groups<sub>opt</sub> else-group<sub>opt</sub> endif-line
8903           if-group:
8904                   # if     constant-expression new-line group<sub>opt</sub>
8905                   # ifdef identifier new-line group<sub>opt</sub>
8906                   # ifndef identifier new-line group<sub>opt</sub>
8907           elif-groups:
8908                   elif-group
8909                   elif-groups elif-group
8910           elif-group:
8911                   # elif        constant-expression new-line group<sub>opt</sub>
8912           else-group:
8913                   # else        new-line group<sub>opt</sub>
8914           endif-line:
8915                   # endif       new-line
8916           control-line:
8917                  # include pp-tokens new-line
8918                  # define identifier replacement-list new-line
8919                  # define identifier lparen identifier-list<sub>opt</sub> )
8920                                                  replacement-list new-line
8921                  # define identifier lparen ... ) replacement-list new-line
8922                  # define identifier lparen identifier-list , ... )
8923                                                  replacement-list new-line
8924                  # undef   identifier new-line
8925                  # line    pp-tokens new-line
8926                  # error   pp-tokens<sub>opt</sub> new-line
8927                  # pragma pp-tokens<sub>opt</sub> new-line
8928                  #         new-line
8929           text-line:
8930                   pp-tokens<sub>opt</sub> new-line
8931           non-directive:
8932                  pp-tokens new-line
8933           lparen:
8934                     a ( character not immediately preceded by white-space
8935           replacement-list:
8936                  pp-tokens<sub>opt</sub>
8937           pp-tokens:
8938                  preprocessing-token
8939                  pp-tokens preprocessing-token
8940           new-line:
8941                  the new-line character
8942 </pre>
8943 <p><b>Description</b>
8944 <p><a name="6.10p2" href="#6.10p2"><small>2</small></a>
8945  A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
8946  following constraints: The first token in the sequence is a # preprocessing token that (at
8947  the start of translation phase 4) is either the first character in the source file (optionally
8948  after white space containing no new-line characters) or that follows white space
8949  containing at least one new-line character. The last token in the sequence is the first new-
8950  line character that follows the first token in the sequence.<sup><a href="#note165"><b>165)</b></a></sup> A new-line character ends
8951  the preprocessing directive even if it occurs within what would otherwise be an
8952  
8953 <!--page 180 -->
8954  invocation of a function-like macro.
8955 <p><a name="6.10p3" href="#6.10p3"><small>3</small></a>
8956  A text line shall not begin with a # preprocessing token. A non-directive shall not begin
8957  with any of the directive names appearing in the syntax.
8958 <p><a name="6.10p4" href="#6.10p4"><small>4</small></a>
8959  When in a group that is skipped (<a href="#6.10.1">6.10.1</a>), the directive syntax is relaxed to allow any
8960  sequence of preprocessing tokens to occur between the directive name and the following
8961  new-line character.
8962 <p><b>Constraints</b>
8963 <p><a name="6.10p5" href="#6.10p5"><small>5</small></a>
8964  The only white-space characters that shall appear between preprocessing tokens within a
8965  preprocessing directive (from just after the introducing # preprocessing token through
8966  just before the terminating new-line character) are space and horizontal-tab (including
8967  spaces that have replaced comments or possibly other white-space characters in
8968  translation phase 3).
8969 <p><b>Semantics</b>
8970 <p><a name="6.10p6" href="#6.10p6"><small>6</small></a>
8971  The implementation can process and skip sections of source files conditionally, include
8972  other source files, and replace macros. These capabilities are called preprocessing,
8973  because conceptually they occur before translation of the resulting translation unit.
8974 <p><a name="6.10p7" href="#6.10p7"><small>7</small></a>
8975  The preprocessing tokens within a preprocessing directive are not subject to macro
8976  expansion unless otherwise stated.
8977 <p><a name="6.10p8" href="#6.10p8"><small>8</small></a>
8978  EXAMPLE        In:
8979 <pre>
8980           #define EMPTY
8981           EMPTY # include &lt;file.h&gt;
8982 </pre>
8983  the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
8984  begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
8985  replaced.
8986  
8987
8988 <p><b>Footnotes</b>
8989 <p><small><a name="note165" href="#note165">165)</a> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
8990  significance, as all white space is equivalent except in certain situations during preprocessing (see the
8991  # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
8992 </small>
8993
8994 <p><small><a href="#Contents">Contents</a></small>
8995 <h4><a name="6.10.1" href="#6.10.1">6.10.1 Conditional inclusion</a></h4>
8996 <p><b>Constraints</b>
8997 <p><a name="6.10.1p1" href="#6.10.1p1"><small>1</small></a>
8998  The expression that controls conditional inclusion shall be an integer constant expression
8999  except that: identifiers (including those lexically identical to keywords) are interpreted as
9000  described below;<sup><a href="#note166"><b>166)</b></a></sup> and it may contain unary operator expressions of the form
9001 <pre>
9002       defined identifier
9003 </pre>
9004  or
9005 <pre>
9006       defined ( identifier )
9007 </pre>
9008  which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
9009  
9010  
9011 <!--page 181 -->
9012  predefined or if it has been the subject of a #define preprocessing directive without an
9013  intervening #undef directive with the same subject identifier), 0 if it is not.
9014 <p><a name="6.10.1p2" href="#6.10.1p2"><small>2</small></a>
9015  Each preprocessing token that remains (in the list of preprocessing tokens that will
9016  become the controlling expression) after all macro replacements have occurred shall be in
9017  the lexical form of a token (<a href="#6.4">6.4</a>).
9018 <p><b>Semantics</b>
9019 <p><a name="6.10.1p3" href="#6.10.1p3"><small>3</small></a>
9020  Preprocessing directives of the forms
9021 <pre>
9022     # if   constant-expression new-line group<sub>opt</sub>
9023     # elif constant-expression new-line group<sub>opt</sub>
9024 </pre>
9025  check whether the controlling constant expression evaluates to nonzero.
9026 <p><a name="6.10.1p4" href="#6.10.1p4"><small>4</small></a>
9027  Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
9028  the controlling constant expression are replaced (except for those macro names modified
9029  by the defined unary operator), just as in normal text. If the token defined is
9030  generated as a result of this replacement process or use of the defined unary operator
9031  does not match one of the two specified forms prior to macro replacement, the behavior is
9032  undefined. After all replacements due to macro expansion and the defined unary
9033  operator have been performed, all remaining identifiers (including those lexically
9034  identical to keywords) are replaced with the pp-number 0, and then each preprocessing
9035  token is converted into a token. The resulting tokens compose the controlling constant
9036  expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
9037  token conversion and evaluation, all signed integer types and all unsigned integer types
9038  act as if they have the same representation as, respectively, the types intmax_t and
9039  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
9040  character constants, which may involve converting escape sequences into execution
9041  character set members. Whether the numeric value for these character constants matches
9042  the value obtained when an identical character constant occurs in an expression (other
9043  than within a #if or #elif directive) is implementation-defined.<sup><a href="#note168"><b>168)</b></a></sup> Also, whether a
9044  single-character character constant may have a negative value is implementation-defined.
9045  
9046  
9047  
9048  
9049 <!--page 182 -->
9050 <p><a name="6.10.1p5" href="#6.10.1p5"><small>5</small></a>
9051  Preprocessing directives of the forms
9052 <pre>
9053     # ifdef identifier new-line group<sub>opt</sub>
9054     # ifndef identifier new-line group<sub>opt</sub>
9055 </pre>
9056  check whether the identifier is or is not currently defined as a macro name. Their
9057  conditions are equivalent to #if defined identifier and #if !defined identifier
9058  respectively.
9059 <p><a name="6.10.1p6" href="#6.10.1p6"><small>6</small></a>
9060  Each directive's condition is checked in order. If it evaluates to false (zero), the group
9061  that it controls is skipped: directives are processed only through the name that determines
9062  the directive in order to keep track of the level of nested conditionals; the rest of the
9063  directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
9064  group. Only the first group whose control condition evaluates to true (nonzero) is
9065  processed. If none of the conditions evaluates to true, and there is a #else directive, the
9066  group controlled by the #else is processed; lacking a #else directive, all the groups
9067  until the #endif are skipped.<sup><a href="#note169"><b>169)</b></a></sup>
9068 <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
9069  integer types (<a href="#7.20.1.5">7.20.1.5</a>).
9070
9071 <p><b>Footnotes</b>
9072 <p><small><a name="note166" href="#note166">166)</a> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
9073  either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
9074 </small>
9075 <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
9076  0x8000 is signed and positive within a #if expression even though it would be unsigned in
9077  translation phase 7.
9078 </small>
9079 <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
9080  evaluate to the same value in these two contexts.
9081
9082 <pre>
9083     #if 'z' - 'a' == 25
9084     if ('z' - 'a' == 25)
9085 </pre>
9086 </small>
9087 <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
9088  before the terminating new-line character. However, comments may appear anywhere in a source file,
9089  including within a preprocessing directive.
9090 </small>
9091
9092 <p><small><a href="#Contents">Contents</a></small>
9093 <h4><a name="6.10.2" href="#6.10.2">6.10.2 Source file inclusion</a></h4>
9094 <p><b>Constraints</b>
9095 <p><a name="6.10.2p1" href="#6.10.2p1"><small>1</small></a>
9096  A #include directive shall identify a header or source file that can be processed by the
9097  implementation.
9098 <p><b>Semantics</b>
9099 <p><a name="6.10.2p2" href="#6.10.2p2"><small>2</small></a>
9100  A preprocessing directive of the form
9101 <pre>
9102     # include &lt;h-char-sequence&gt; new-line
9103 </pre>
9104  searches a sequence of implementation-defined places for a header identified uniquely by
9105  the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
9106  directive by the entire contents of the header. How the places are specified or the header
9107  identified is implementation-defined.
9108 <p><a name="6.10.2p3" href="#6.10.2p3"><small>3</small></a>
9109  A preprocessing directive of the form
9110 <pre>
9111     # include "q-char-sequence" new-line
9112 </pre>
9113  causes the replacement of that directive by the entire contents of the source file identified
9114  by the specified sequence between the " delimiters. The named source file is searched
9115  
9116  
9117 <!--page 183 -->
9118  for in an implementation-defined manner. If this search is not supported, or if the search
9119  fails, the directive is reprocessed as if it read
9120 <pre>
9121     # include &lt;h-char-sequence&gt; new-line
9122 </pre>
9123  with the identical contained sequence (including &gt; characters, if any) from the original
9124  directive.
9125 <p><a name="6.10.2p4" href="#6.10.2p4"><small>4</small></a>
9126  A preprocessing directive of the form
9127 <pre>
9128     # include pp-tokens new-line
9129 </pre>
9130  (that does not match one of the two previous forms) is permitted. The preprocessing
9131  tokens after include in the directive are processed just as in normal text. (Each
9132  identifier currently defined as a macro name is replaced by its replacement list of
9133  preprocessing tokens.) The directive resulting after all replacements shall match one of
9134  the two previous forms.<sup><a href="#note170"><b>170)</b></a></sup> The method by which a sequence of preprocessing tokens
9135  between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
9136  single header name preprocessing token is implementation-defined.
9137 <p><a name="6.10.2p5" href="#6.10.2p5"><small>5</small></a>
9138  The implementation shall provide unique mappings for sequences consisting of one or
9139  more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
9140  first character shall not be a digit. The implementation may ignore distinctions of
9141  alphabetical case and restrict the mapping to eight significant characters before the
9142  period.
9143 <p><a name="6.10.2p6" href="#6.10.2p6"><small>6</small></a>
9144  A #include preprocessing directive may appear in a source file that has been read
9145  because of a #include directive in another file, up to an implementation-defined
9146  nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
9147 <p><a name="6.10.2p7" href="#6.10.2p7"><small>7</small></a>
9148  EXAMPLE 1       The most common uses of #include preprocessing directives are as in the following:
9149 <pre>
9150            #include <a href="#7.21">&lt;stdio.h&gt;</a>
9151            #include "myprog.h"
9152 </pre>
9153  
9154  
9155  
9156  
9157 <!--page 184 -->
9158 <p><a name="6.10.2p8" href="#6.10.2p8"><small>8</small></a>
9159  EXAMPLE 2     This illustrates macro-replaced #include directives:
9160 <pre>
9161         #if VERSION == 1
9162               #define INCFILE            "vers1.h"
9163         #elif VERSION == 2
9164               #define INCFILE            "vers2.h"        // and so on
9165         #else
9166                #define INCFILE           "versN.h"
9167         #endif
9168         #include INCFILE
9169 </pre>
9170  
9171 <p><b> Forward references</b>: macro replacement (<a href="#6.10.3">6.10.3</a>).
9172
9173 <p><b>Footnotes</b>
9174 <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
9175  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.
9176 </small>
9177
9178 <p><small><a href="#Contents">Contents</a></small>
9179 <h4><a name="6.10.3" href="#6.10.3">6.10.3 Macro replacement</a></h4>
9180 <p><b>Constraints</b>
9181 <p><a name="6.10.3p1" href="#6.10.3p1"><small>1</small></a>
9182  Two replacement lists are identical if and only if the preprocessing tokens in both have
9183  the same number, ordering, spelling, and white-space separation, where all white-space
9184  separations are considered identical.
9185 <p><a name="6.10.3p2" href="#6.10.3p2"><small>2</small></a>
9186  An identifier currently defined as an object-like macro shall not be redefined by another
9187  #define preprocessing directive unless the second definition is an object-like macro
9188  definition and the two replacement lists are identical. Likewise, an identifier currently
9189  defined as a function-like macro shall not be redefined by another #define
9190  preprocessing directive unless the second definition is a function-like macro definition
9191  that has the same number and spelling of parameters, and the two replacement lists are
9192  identical.
9193 <p><a name="6.10.3p3" href="#6.10.3p3"><small>3</small></a>
9194  There shall be white-space between the identifier and the replacement list in the definition
9195  of an object-like macro.
9196 <p><a name="6.10.3p4" href="#6.10.3p4"><small>4</small></a>
9197  If the identifier-list in the macro definition does not end with an ellipsis, the number of
9198  arguments (including those arguments consisting of no preprocessing tokens) in an
9199  invocation of a function-like macro shall equal the number of parameters in the macro
9200  definition. Otherwise, there shall be more arguments in the invocation than there are
9201  parameters in the macro definition (excluding the ...). There shall exist a )
9202  preprocessing token that terminates the invocation.
9203 <p><a name="6.10.3p5" href="#6.10.3p5"><small>5</small></a>
9204  The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
9205  macro that uses the ellipsis notation in the parameters.
9206 <p><a name="6.10.3p6" href="#6.10.3p6"><small>6</small></a>
9207  A parameter identifier in a function-like macro shall be uniquely declared within its
9208  scope.
9209 <p><b>Semantics</b>
9210 <p><a name="6.10.3p7" href="#6.10.3p7"><small>7</small></a>
9211  The identifier immediately following the define is called the macro name. There is one
9212  name space for macro names. Any white-space characters preceding or following the
9213  replacement list of preprocessing tokens are not considered part of the replacement list
9214 <!--page 185 -->
9215  for either form of macro.
9216 <p><a name="6.10.3p8" href="#6.10.3p8"><small>8</small></a>
9217  If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
9218  a preprocessing directive could begin, the identifier is not subject to macro replacement.
9219 <p><a name="6.10.3p9" href="#6.10.3p9"><small>9</small></a>
9220  A preprocessing directive of the form
9221 <pre>
9222     # define identifier replacement-list new-line
9223 </pre>
9224  defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note171"><b>171)</b></a></sup>
9225  to be replaced by the replacement list of preprocessing tokens that constitute the
9226  remainder of the directive. The replacement list is then rescanned for more macro names
9227  as specified below.
9228 <p><a name="6.10.3p10" href="#6.10.3p10"><small>10</small></a>
9229  A preprocessing directive of the form
9230 <pre>
9231     # define identifier lparen identifier-list<sub>opt</sub> ) replacement-list new-line
9232     # define identifier lparen ... ) replacement-list new-line
9233     # define identifier lparen identifier-list , ... ) replacement-list new-line
9234 </pre>
9235  defines a function-like macro with parameters, whose use is similar syntactically to a
9236  function call. The parameters are specified by the optional list of identifiers, whose scope
9237  extends from their declaration in the identifier list until the new-line character that
9238  terminates the #define preprocessing directive. Each subsequent instance of the
9239  function-like macro name followed by a ( as the next preprocessing token introduces the
9240  sequence of preprocessing tokens that is replaced by the replacement list in the definition
9241  (an invocation of the macro). The replaced sequence of preprocessing tokens is
9242  terminated by the matching ) preprocessing token, skipping intervening matched pairs of
9243  left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
9244  tokens making up an invocation of a function-like macro, new-line is considered a normal
9245  white-space character.
9246 <p><a name="6.10.3p11" href="#6.10.3p11"><small>11</small></a>
9247  The sequence of preprocessing tokens bounded by the outside-most matching parentheses
9248  forms the list of arguments for the function-like macro. The individual arguments within
9249  the list are separated by comma preprocessing tokens, but comma preprocessing tokens
9250  between matching inner parentheses do not separate arguments. If there are sequences of
9251  preprocessing tokens within the list of arguments that would otherwise act as
9252  preprocessing directives,<sup><a href="#note172"><b>172)</b></a></sup> the behavior is undefined.
9253 <p><a name="6.10.3p12" href="#6.10.3p12"><small>12</small></a>
9254  If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
9255  including any separating comma preprocessing tokens, are merged to form a single item:
9256  
9257  
9258 <!--page 186 -->
9259  the variable arguments. The number of arguments so combined is such that, following
9260  merger, the number of arguments is one more than the number of parameters in the macro
9261  definition (excluding the ...).
9262
9263 <p><b>Footnotes</b>
9264 <p><small><a name="note171" href="#note171">171)</a> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
9265  not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
9266  are never scanned for macro names or parameters.
9267 </small>
9268 <p><small><a name="note172" href="#note172">172)</a> Despite the name, a non-directive is a preprocessing directive.
9269 </small>
9270
9271 <p><small><a href="#Contents">Contents</a></small>
9272 <h5><a name="6.10.3.1" href="#6.10.3.1">6.10.3.1 Argument substitution</a></h5>
9273 <p><a name="6.10.3.1p1" href="#6.10.3.1p1"><small>1</small></a>
9274  After the arguments for the invocation of a function-like macro have been identified,
9275  argument substitution takes place. A parameter in the replacement list, unless preceded
9276  by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
9277  replaced by the corresponding argument after all macros contained therein have been
9278  expanded. Before being substituted, each argument's preprocessing tokens are
9279  completely macro replaced as if they formed the rest of the preprocessing file; no other
9280  preprocessing tokens are available.
9281 <p><a name="6.10.3.1p2" href="#6.10.3.1p2"><small>2</small></a>
9282  An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
9283  were a parameter, and the variable arguments shall form the preprocessing tokens used to
9284  replace it.
9285
9286 <p><small><a href="#Contents">Contents</a></small>
9287 <h5><a name="6.10.3.2" href="#6.10.3.2">6.10.3.2 The # operator</a></h5>
9288 <p><b>Constraints</b>
9289 <p><a name="6.10.3.2p1" href="#6.10.3.2p1"><small>1</small></a>
9290  Each # preprocessing token in the replacement list for a function-like macro shall be
9291  followed by a parameter as the next preprocessing token in the replacement list.
9292 <p><b>Semantics</b>
9293 <p><a name="6.10.3.2p2" href="#6.10.3.2p2"><small>2</small></a>
9294  If, in the replacement list, a parameter is immediately preceded by a # preprocessing
9295  token, both are replaced by a single character string literal preprocessing token that
9296  contains the spelling of the preprocessing token sequence for the corresponding
9297  argument. Each occurrence of white space between the argument's preprocessing tokens
9298  becomes a single space character in the character string literal. White space before the
9299  first preprocessing token and after the last preprocessing token composing the argument
9300  is deleted. Otherwise, the original spelling of each preprocessing token in the argument
9301  is retained in the character string literal, except for special handling for producing the
9302  spelling of string literals and character constants: a \ character is inserted before each "
9303  and \ character of a character constant or string literal (including the delimiting "
9304  characters), except that it is implementation-defined whether a \ character is inserted
9305  before the \ character beginning a universal character name. If the replacement that
9306  results is not a valid character string literal, the behavior is undefined. The character
9307  string literal corresponding to an empty argument is "". The order of evaluation of # and
9308  ## operators is unspecified.
9309 <!--page 187 -->
9310
9311 <p><small><a href="#Contents">Contents</a></small>
9312 <h5><a name="6.10.3.3" href="#6.10.3.3">6.10.3.3 The ## operator</a></h5>
9313 <p><b>Constraints</b>
9314 <p><a name="6.10.3.3p1" href="#6.10.3.3p1"><small>1</small></a>
9315  A ## preprocessing token shall not occur at the beginning or at the end of a replacement
9316  list for either form of macro definition.
9317 <p><b>Semantics</b>
9318 <p><a name="6.10.3.3p2" href="#6.10.3.3p2"><small>2</small></a>
9319  If, in the replacement list of a function-like macro, a parameter is immediately preceded
9320  or followed by a ## preprocessing token, the parameter is replaced by the corresponding
9321  argument's preprocessing token sequence; however, if an argument consists of no
9322  preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
9323  instead.<sup><a href="#note173"><b>173)</b></a></sup>
9324 <p><a name="6.10.3.3p3" href="#6.10.3.3p3"><small>3</small></a>
9325  For both object-like and function-like macro invocations, before the replacement list is
9326  reexamined for more macro names to replace, each instance of a ## preprocessing token
9327  in the replacement list (not from an argument) is deleted and the preceding preprocessing
9328  token is concatenated with the following preprocessing token. Placemarker
9329  preprocessing tokens are handled specially: concatenation of two placemarkers results in
9330  a single placemarker preprocessing token, and concatenation of a placemarker with a
9331  non-placemarker preprocessing token results in the non-placemarker preprocessing token.
9332  If the result is not a valid preprocessing token, the behavior is undefined. The resulting
9333  token is available for further macro replacement. The order of evaluation of ## operators
9334  is unspecified.
9335 <p><a name="6.10.3.3p4" href="#6.10.3.3p4"><small>4</small></a>
9336  EXAMPLE       In the following fragment:
9337 <pre>
9338          #define     hash_hash # ## #
9339          #define     mkstr(a) # a
9340          #define     in_between(a) mkstr(a)
9341          #define     join(c, d) in_between(c hash_hash d)
9342          char p[] = join(x, y); // equivalent to
9343                                 // char p[] = "x ## y";
9344 </pre>
9345  The expansion produces, at various stages:
9346 <pre>
9347          join(x, y)
9348          in_between(x hash_hash y)
9349          in_between(x ## y)
9350          mkstr(x ## y)
9351          "x ## y"
9352 </pre>
9353  In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
9354  this new token is not the ## operator.
9355  
9356  
9357 <!--page 188 -->
9358
9359 <p><b>Footnotes</b>
9360 <p><small><a name="note173" href="#note173">173)</a> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
9361  exist only within translation phase 4.
9362 </small>
9363
9364 <p><small><a href="#Contents">Contents</a></small>
9365 <h5><a name="6.10.3.4" href="#6.10.3.4">6.10.3.4 Rescanning and further replacement</a></h5>
9366 <p><a name="6.10.3.4p1" href="#6.10.3.4p1"><small>1</small></a>
9367  After all parameters in the replacement list have been substituted and # and ##
9368  processing has taken place, all placemarker preprocessing tokens are removed. The
9369  resulting preprocessing token sequence is then rescanned, along with all subsequent
9370  preprocessing tokens of the source file, for more macro names to replace.
9371 <p><a name="6.10.3.4p2" href="#6.10.3.4p2"><small>2</small></a>
9372  If the name of the macro being replaced is found during this scan of the replacement list
9373  (not including the rest of the source file's preprocessing tokens), it is not replaced.
9374  Furthermore, if any nested replacements encounter the name of the macro being replaced,
9375  it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
9376  available for further replacement even if they are later (re)examined in contexts in which
9377  that macro name preprocessing token would otherwise have been replaced.
9378 <p><a name="6.10.3.4p3" href="#6.10.3.4p3"><small>3</small></a>
9379  The resulting completely macro-replaced preprocessing token sequence is not processed
9380  as a preprocessing directive even if it resembles one, but all pragma unary operator
9381  expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
9382 <p><a name="6.10.3.4p4" href="#6.10.3.4p4"><small>4</small></a>
9383  EXAMPLE There are cases where it is not clear whether a replacement is nested or not. For example,
9384  given the following macro definitions:
9385 <pre>
9386          #define f(a) a*g
9387          #define g(a) f(a)
9388 </pre>
9389  the invocation
9390 <pre>
9391          f(2)(9)
9392 </pre>
9393  may expand to either
9394 <pre>
9395          2*f(9)
9396 </pre>
9397  or
9398 <pre>
9399          2*9*g
9400 </pre>
9401  Strictly conforming programs are not permitted to depend on such unspecified behavior.
9402  
9403
9404 <p><small><a href="#Contents">Contents</a></small>
9405 <h5><a name="6.10.3.5" href="#6.10.3.5">6.10.3.5 Scope of macro definitions</a></h5>
9406 <p><a name="6.10.3.5p1" href="#6.10.3.5p1"><small>1</small></a>
9407  A macro definition lasts (independent of block structure) until a corresponding #undef
9408  directive is encountered or (if none is encountered) until the end of the preprocessing
9409  translation unit. Macro definitions have no significance after translation phase 4.
9410 <p><a name="6.10.3.5p2" href="#6.10.3.5p2"><small>2</small></a>
9411  A preprocessing directive of the form
9412 <pre>
9413       # undef identifier new-line
9414 </pre>
9415  causes the specified identifier no longer to be defined as a macro name. It is ignored if
9416  the specified identifier is not currently defined as a macro name.
9417 <p><a name="6.10.3.5p3" href="#6.10.3.5p3"><small>3</small></a>
9418  EXAMPLE 1        The simplest use of this facility is to define a ''manifest constant'', as in
9419 <!--page 189 -->
9420 <pre>
9421          #define TABSIZE 100
9422           int table[TABSIZE];
9423 </pre>
9424  
9425 <p><a name="6.10.3.5p4" href="#6.10.3.5p4"><small>4</small></a>
9426  EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
9427  It has the advantages of working for any compatible types of the arguments and of generating in-line code
9428  without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
9429  arguments a second time (including side effects) and generating more code than a function if invoked
9430  several times. It also cannot have its address taken, as it has none.
9431 <pre>
9432           #define max(a, b) ((a) &gt; (b) ? (a) : (b))
9433 </pre>
9434  The parentheses ensure that the arguments and the resulting expression are bound properly.
9435  
9436 <p><a name="6.10.3.5p5" href="#6.10.3.5p5"><small>5</small></a>
9437  EXAMPLE 3      To illustrate the rules for redefinition and reexamination, the sequence
9438 <pre>
9439           #define    x          3
9440           #define    f(a)       f(x * (a))
9441           #undef     x
9442           #define    x          2
9443           #define    g          f
9444           #define    z          z[0]
9445           #define    h          g(~
9446           #define    m(a)       a(w)
9447           #define    w          0,1
9448           #define    t(a)       a
9449           #define    p()        int
9450           #define    q(x)       x
9451           #define    r(x,y)     x ## y
9452           #define    str(x)     # x
9453           f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
9454           g(x+(3,4)-w) | h 5) &amp; m
9455                 (f)^m(m);
9456           p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
9457           char c[2][6] = { str(hello), str() };
9458 </pre>
9459  results in
9460 <pre>
9461           f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
9462           f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
9463           int i[] = { 1, 23, 4, 5, };
9464           char c[2][6] = { "hello", "" };
9465 </pre>
9466  
9467 <p><a name="6.10.3.5p6" href="#6.10.3.5p6"><small>6</small></a>
9468  EXAMPLE 4      To illustrate the rules for creating character string literals and concatenating tokens, the
9469  sequence
9470 <!--page 190 -->
9471 <pre>
9472           #define str(s)      # s
9473           #define xstr(s)     str(s)
9474           #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
9475                                   x ## s, x ## t)
9476           #define INCFILE(n) vers ## n
9477           #define glue(a, b) a ## b
9478           #define xglue(a, b) glue(a, b)
9479           #define HIGHLOW     "hello"
9480           #define LOW         LOW ", world"
9481           debug(1, 2);
9482           fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
9483                 == 0) str(: @\n), s);
9484           #include xstr(INCFILE(2).h)
9485           glue(HIGH, LOW);
9486           xglue(HIGH, LOW)
9487 </pre>
9488  results in
9489 <pre>
9490           printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
9491           fputs(
9492             "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
9493             s);
9494           #include "vers2.h"    (after macro replacement, before file access)
9495           "hello";
9496           "hello" ", world"
9497 </pre>
9498  or, after concatenation of the character string literals,
9499 <pre>
9500           printf("x1= %d, x2= %s", x1, x2);
9501           fputs(
9502             "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
9503             s);
9504           #include "vers2.h"    (after macro replacement, before file access)
9505           "hello";
9506           "hello, world"
9507 </pre>
9508  Space around the # and ## tokens in the macro definition is optional.
9509  
9510 <p><a name="6.10.3.5p7" href="#6.10.3.5p7"><small>7</small></a>
9511  EXAMPLE 5        To illustrate the rules for placemarker preprocessing tokens, the sequence
9512 <pre>
9513           #define t(x,y,z) x ## y ## z
9514           int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
9515                      t(10,,), t(,11,), t(,,12), t(,,) };
9516 </pre>
9517  results in
9518 <pre>
9519           int j[] = { 123, 45, 67, 89,
9520                       10, 11, 12, };
9521 </pre>
9522  
9523 <p><a name="6.10.3.5p8" href="#6.10.3.5p8"><small>8</small></a>
9524  EXAMPLE 6        To demonstrate the redefinition rules, the following sequence is valid.
9525 <pre>
9526           #define      OBJ_LIKE      (1-1)
9527           #define      OBJ_LIKE      /* white space */ (1-1) /* other */
9528           #define      FUNC_LIKE(a)   ( a )
9529           #define      FUNC_LIKE( a )( /* note the white space */ \
9530                                        a /* other stuff on this line
9531                                            */ )
9532 </pre>
9533  But the following redefinitions are invalid:
9534 <pre>
9535           #define      OBJ_LIKE    (0)     // different token sequence
9536           #define      OBJ_LIKE    (1 - 1) // different white space
9537           #define      FUNC_LIKE(b) ( a ) // different parameter usage
9538           #define      FUNC_LIKE(b) ( b ) // different parameter spelling
9539 </pre>
9540  
9541 <p><a name="6.10.3.5p9" href="#6.10.3.5p9"><small>9</small></a>
9542  EXAMPLE 7        Finally, to show the variable argument list macro facilities:
9543 <!--page 191 -->
9544 <pre>
9545           #define debug(...)       fprintf(stderr, __VA_ARGS__)
9546           #define showlist(...)    puts(#__VA_ARGS__)
9547           #define report(test, ...) ((test)?puts(#test):\
9548                       printf(__VA_ARGS__))
9549           debug("Flag");
9550           debug("X = %d\n", x);
9551           showlist(The first, second, and third items.);
9552           report(x&gt;y, "x is %d but y is %d", x, y);
9553 </pre>
9554  results in
9555 <pre>
9556           fprintf(stderr, "Flag" );
9557           fprintf(stderr, "X = %d\n", x );
9558           puts( "The first, second, and third items." );
9559           ((x&gt;y)?puts("x&gt;y"):
9560                       printf("x is %d but y is %d", x, y));
9561 </pre>
9562  
9563
9564 <p><small><a href="#Contents">Contents</a></small>
9565 <h4><a name="6.10.4" href="#6.10.4">6.10.4 Line control</a></h4>
9566 <p><b>Constraints</b>
9567 <p><a name="6.10.4p1" href="#6.10.4p1"><small>1</small></a>
9568  The string literal of a #line directive, if present, shall be a character string literal.
9569 <p><b>Semantics</b>
9570 <p><a name="6.10.4p2" href="#6.10.4p2"><small>2</small></a>
9571  The line number of the current source line is one greater than the number of new-line
9572  characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
9573  file to the current token.
9574 <p><a name="6.10.4p3" href="#6.10.4p3"><small>3</small></a>
9575  A preprocessing directive of the form
9576 <pre>
9577     # line digit-sequence new-line
9578 </pre>
9579  causes the implementation to behave as if the following sequence of source lines begins
9580  with a source line that has a line number as specified by the digit sequence (interpreted as
9581  a decimal integer). The digit sequence shall not specify zero, nor a number greater than
9582  2147483647.
9583 <p><a name="6.10.4p4" href="#6.10.4p4"><small>4</small></a>
9584  A preprocessing directive of the form
9585 <pre>
9586     # line digit-sequence "s-char-sequence<sub>opt</sub>" new-line
9587 </pre>
9588  sets the presumed line number similarly and changes the presumed name of the source
9589  file to be the contents of the character string literal.
9590 <p><a name="6.10.4p5" href="#6.10.4p5"><small>5</small></a>
9591  A preprocessing directive of the form
9592 <pre>
9593     # line pp-tokens new-line
9594 </pre>
9595  (that does not match one of the two previous forms) is permitted. The preprocessing
9596  tokens after line on the directive are processed just as in normal text (each identifier
9597  currently defined as a macro name is replaced by its replacement list of preprocessing
9598  tokens). The directive resulting after all replacements shall match one of the two
9599  previous forms and is then processed as appropriate.
9600 <!--page 192 -->
9601
9602 <p><small><a href="#Contents">Contents</a></small>
9603 <h4><a name="6.10.5" href="#6.10.5">6.10.5 Error directive</a></h4>
9604 <p><b>Semantics</b>
9605 <p><a name="6.10.5p1" href="#6.10.5p1"><small>1</small></a>
9606  A preprocessing directive of the form
9607 <pre>
9608     # error pp-tokens<sub>opt</sub> new-line
9609 </pre>
9610  causes the implementation to produce a diagnostic message that includes the specified
9611  sequence of preprocessing tokens.
9612
9613 <p><small><a href="#Contents">Contents</a></small>
9614 <h4><a name="6.10.6" href="#6.10.6">6.10.6 Pragma directive</a></h4>
9615 <p><b>Semantics</b>
9616 <p><a name="6.10.6p1" href="#6.10.6p1"><small>1</small></a>
9617  A preprocessing directive of the form
9618 <pre>
9619     # pragma pp-tokens<sub>opt</sub> new-line
9620 </pre>
9621  where the preprocessing token STDC does not immediately follow pragma in the
9622  directive (prior to any macro replacement)<sup><a href="#note174"><b>174)</b></a></sup> causes the implementation to behave in an
9623  implementation-defined manner. The behavior might cause translation to fail or cause the
9624  translator or the resulting program to behave in a non-conforming manner. Any such
9625  pragma that is not recognized by the implementation is ignored.
9626 <p><a name="6.10.6p2" href="#6.10.6p2"><small>2</small></a>
9627  If the preprocessing token STDC does immediately follow pragma in the directive (prior
9628  to any macro replacement), then no macro replacement is performed on the directive, and
9629  the directive shall have one of the following forms<sup><a href="#note175"><b>175)</b></a></sup> whose meanings are described
9630  elsewhere:
9631 <pre>
9632     #pragma STDC FP_CONTRACT on-off-switch
9633     #pragma STDC FENV_ACCESS on-off-switch
9634     #pragma STDC CX_LIMITED_RANGE on-off-switch
9635     on-off-switch: one of
9636                 ON     OFF           DEFAULT
9637 </pre>
9638 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
9639  (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
9640  
9641  
9642  
9643  
9644 <!--page 193 -->
9645
9646 <p><b>Footnotes</b>
9647 <p><small><a name="note174" href="#note174">174)</a> An implementation is not required to perform macro replacement in pragmas, but it is permitted
9648  except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
9649  replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
9650  implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
9651  but is not required to.
9652 </small>
9653 <p><small><a name="note175" href="#note175">175)</a> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
9654 </small>
9655
9656 <p><small><a href="#Contents">Contents</a></small>
9657 <h4><a name="6.10.7" href="#6.10.7">6.10.7 Null directive</a></h4>
9658 <p><b>Semantics</b>
9659 <p><a name="6.10.7p1" href="#6.10.7p1"><small>1</small></a>
9660  A preprocessing directive of the form
9661 <pre>
9662     # new-line
9663 </pre>
9664  has no effect.
9665
9666 <p><small><a href="#Contents">Contents</a></small>
9667 <h4><a name="6.10.8" href="#6.10.8">6.10.8 Predefined macro names</a></h4>
9668 <p><a name="6.10.8p1" href="#6.10.8p1"><small>1</small></a>
9669  The values of the predefined macros listed in the following subclauses<sup><a href="#note176"><b>176)</b></a></sup> (except for
9670  __FILE__ and __LINE__) remain constant throughout the translation unit.
9671 <p><a name="6.10.8p2" href="#6.10.8p2"><small>2</small></a>
9672  None of these macro names, nor the identifier defined, shall be the subject of a
9673  #define or a #undef preprocessing directive. Any other predefined macro names
9674  shall begin with a leading underscore followed by an uppercase letter or a second
9675  underscore.
9676 <p><a name="6.10.8p3" href="#6.10.8p3"><small>3</small></a>
9677  The implementation shall not predefine the macro __cplusplus, nor shall it define it
9678  in any standard header.
9679 <p><b> Forward references</b>: standard headers (<a href="#7.1.2">7.1.2</a>).
9680
9681 <p><b>Footnotes</b>
9682 <p><small><a name="note176" href="#note176">176)</a> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
9683 </small>
9684
9685 <p><small><a href="#Contents">Contents</a></small>
9686 <h5><a name="6.10.8.1" href="#6.10.8.1">6.10.8.1 Mandatory macros</a></h5>
9687 <p><a name="6.10.8.1p1" href="#6.10.8.1p1"><small>1</small></a>
9688  The following macro names shall be defined by the implementation:
9689  __DATE__ The date of translation of the preprocessing translation unit: a character
9690 <pre>
9691             string literal of the form "Mmm dd yyyy", where the names of the
9692             months are the same as those generated by the asctime function, and the
9693             first character of dd is a space character if the value is less than 10. If the
9694             date of translation is not available, an implementation-defined valid date
9695             shall be supplied.
9696 </pre>
9697  __FILE__ The presumed name of the current source file (a character string literal).<sup><a href="#note177"><b>177)</b></a></sup>
9698  __LINE__ The presumed line number (within the current source file) of the current
9699 <pre>
9700             source line (an integer constant).<sup><a href="#note177"><b>177)</b></a></sup>
9701 </pre>
9702  __STDC__ The integer constant 1, intended to indicate a conforming implementation.
9703  __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
9704 <pre>
9705            implementation or the integer constant 0 if it is not.
9706 </pre>
9707  
9708  
9709  
9710  
9711 <!--page 194 -->
9712  __STDC_VERSION__ The integer constant 201ymmL.<sup><a href="#note178"><b>178)</b></a></sup>
9713  __TIME__ The time of translation of the preprocessing translation unit: a character
9714 <pre>
9715             string literal of the form "hh:mm:ss" as in the time generated by the
9716             asctime function. If the time of translation is not available, an
9717             implementation-defined valid time shall be supplied.
9718 </pre>
9719 <p><b> Forward references</b>: the asctime function (<a href="#7.27.3.1">7.27.3.1</a>).
9720
9721 <p><b>Footnotes</b>
9722 <p><small><a name="note177" href="#note177">177)</a> The presumed source file name and line number can be changed by the #line directive.
9723 </small>
9724 <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
9725  ISO/IEC 9899/AMD1:1995 and as 199901L in ISO/IEC 9899:1999. The intention is that this will
9726  remain an integer constant of type long int that is increased with each revision of this International
9727  Standard.
9728 </small>
9729
9730 <p><small><a href="#Contents">Contents</a></small>
9731 <h5><a name="6.10.8.2" href="#6.10.8.2">6.10.8.2 Environment macros</a></h5>
9732 <p><a name="6.10.8.2p1" href="#6.10.8.2p1"><small>1</small></a>
9733  The following macro names are conditionally defined by the implementation:
9734  __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
9735 <pre>
9736            199712L). If this symbol is defined, then every character in the Unicode
9737            required set, when stored in an object of type wchar_t, has the same
9738            value as the short identifier of that character. The Unicode required set
9739            consists of all the characters that are defined by ISO/IEC 10646, along with
9740            all amendments and technical corrigenda, as of the specified year and
9741            month. If some other encoding is used, the macro shall not be defined and
9742            the actual encoding used is implementation-defined.
9743 </pre>
9744  __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
9745 <pre>
9746            the encoding for wchar_t, a member of the basic character set need not
9747            have a code value equal to its value when used as the lone character in an
9748            integer character constant.
9749 </pre>
9750  __STDC_UTF_16__ The integer constant 1, intended to indicate that values of type
9751 <pre>
9752            char16_t are UTF-16 encoded. If some other encoding is used, the
9753            macro shall not be defined and the actual encoding used is implementation-
9754            defined.
9755 </pre>
9756  __STDC_UTF_32__ The integer constant 1, intended to indicate that values of type
9757 <pre>
9758            char32_t are UTF-32 encoded. If some other encoding is used, the
9759            macro shall not be defined and the actual encoding used is implementation-
9760            defined.
9761 </pre>
9762 <p><b> Forward references</b>: common definitions (<a href="#7.19">7.19</a>), unicode utilities (<a href="#7.28">7.28</a>).
9763  
9764  
9765  
9766  
9767 <!--page 195 -->
9768
9769 <p><small><a href="#Contents">Contents</a></small>
9770 <h5><a name="6.10.8.3" href="#6.10.8.3">6.10.8.3 Conditional feature macros</a></h5>
9771 <p><a name="6.10.8.3p1" href="#6.10.8.3p1"><small>1</small></a>
9772  The following macro names are conditionally defined by the implementation:
9773  __STDC_ANALYZABLE__ The integer constant 1, intended to indicate conformance to
9774 <pre>
9775            the specifications in <a href="#L">annex L</a> (Analyzability).
9776 </pre>
9777  __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
9778 <pre>
9779            specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
9780 </pre>
9781  __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
9782 <pre>
9783            adherence to the specifications in <a href="#G">annex G</a> (IEC 60559 compatible complex
9784            arithmetic).
9785 </pre>
9786  __STDC_LIB_EXT1__ The integer constant 201ymmL, intended to indicate support
9787 <pre>
9788            for the extensions defined in <a href="#K">annex K</a> (Bounds-checking interfaces).<sup><a href="#note179"><b>179)</b></a></sup>
9789 </pre>
9790  __STDC_NO_ATOMICS__ The integer constant 1, intended to indicate that the
9791 <pre>
9792            implementation does not support atomic types (including the _Atomic
9793            type qualifier) and the <a href="#7.17">&lt;stdatomic.h&gt;</a> header.
9794 </pre>
9795  __STDC_NO_COMPLEX__ The integer constant 1, intended to indicate that the
9796 <pre>
9797            implementation does not support complex types or the <a href="#7.3">&lt;complex.h&gt;</a>
9798            header.
9799 </pre>
9800  __STDC_NO_THREADS__ The integer constant 1, intended to indicate that the
9801 <pre>
9802            implementation does not support the <a href="#7.26">&lt;threads.h&gt;</a> header.
9803 </pre>
9804  __STDC_NO_VLA__ The integer constant 1, intended to indicate that the
9805 <pre>
9806            implementation does not support variable length arrays or variably
9807            modified types.
9808 </pre>
9809 <p><a name="6.10.8.3p2" href="#6.10.8.3p2"><small>2</small></a>
9810  An implementation that defines __STDC_NO_COMPLEX__ shall not define
9811  __STDC_IEC_559_COMPLEX__.
9812  
9813  
9814  
9815  
9816 <!--page 196 -->
9817
9818 <p><b>Footnotes</b>
9819 <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
9820  each revision of this International Standard.
9821 </small>
9822
9823 <p><small><a href="#Contents">Contents</a></small>
9824 <h4><a name="6.10.9" href="#6.10.9">6.10.9 Pragma operator</a></h4>
9825 <p><b>Semantics</b>
9826 <p><a name="6.10.9p1" href="#6.10.9p1"><small>1</small></a>
9827  A unary operator expression of the form:
9828 <pre>
9829     _Pragma ( string-literal )
9830 </pre>
9831  is processed as follows: The string literal is destringized by deleting any encoding prefix,
9832  deleting the leading and trailing double-quotes, replacing each escape sequence \" by a
9833  double-quote, and replacing each escape sequence \\ by a single backslash. The
9834  resulting sequence of characters is processed through translation phase 3 to produce
9835  preprocessing tokens that are executed as if they were the pp-tokens in a pragma
9836  directive. The original four preprocessing tokens in the unary operator expression are
9837  removed.
9838 <p><a name="6.10.9p2" href="#6.10.9p2"><small>2</small></a>
9839  EXAMPLE       A directive of the form:
9840 <pre>
9841           #pragma listing on "..\listing.dir"
9842 </pre>
9843  can also be expressed as:
9844 <pre>
9845           _Pragma ( "listing on \"..\\listing.dir\"" )
9846 </pre>
9847  The latter form is processed in the same way whether it appears literally as shown, or results from macro
9848  replacement, as in:
9849 <!--page 197 -->
9850 <pre>
9851           #define LISTING(x) PRAGMA(listing on #x)
9852           #define PRAGMA(x) _Pragma(#x)
9853           LISTING ( ..\listing.dir )
9854 </pre>
9855
9856 <p><small><a href="#Contents">Contents</a></small>
9857 <h3><a name="6.11" href="#6.11">6.11 Future language directions</a></h3>
9858
9859 <p><small><a href="#Contents">Contents</a></small>
9860 <h4><a name="6.11.1" href="#6.11.1">6.11.1 Floating types</a></h4>
9861 <p><a name="6.11.1p1" href="#6.11.1p1"><small>1</small></a>
9862  Future standardization may include additional floating-point types, including those with
9863  greater range, precision, or both than long double.
9864
9865 <p><small><a href="#Contents">Contents</a></small>
9866 <h4><a name="6.11.2" href="#6.11.2">6.11.2 Linkages of identifiers</a></h4>
9867 <p><a name="6.11.2p1" href="#6.11.2p1"><small>1</small></a>
9868  Declaring an identifier with internal linkage at file scope without the static storage-
9869  class specifier is an obsolescent feature.
9870
9871 <p><small><a href="#Contents">Contents</a></small>
9872 <h4><a name="6.11.3" href="#6.11.3">6.11.3 External names</a></h4>
9873 <p><a name="6.11.3p1" href="#6.11.3p1"><small>1</small></a>
9874  Restriction of the significance of an external name to fewer than 255 characters
9875  (considering each universal character name or extended source character as a single
9876  character) is an obsolescent feature that is a concession to existing implementations.
9877
9878 <p><small><a href="#Contents">Contents</a></small>
9879 <h4><a name="6.11.4" href="#6.11.4">6.11.4 Character escape sequences</a></h4>
9880 <p><a name="6.11.4p1" href="#6.11.4p1"><small>1</small></a>
9881  Lowercase letters as escape sequences are reserved for future standardization. Other
9882  characters may be used in extensions.
9883
9884 <p><small><a href="#Contents">Contents</a></small>
9885 <h4><a name="6.11.5" href="#6.11.5">6.11.5 Storage-class specifiers</a></h4>
9886 <p><a name="6.11.5p1" href="#6.11.5p1"><small>1</small></a>
9887  The placement of a storage-class specifier other than at the beginning of the declaration
9888  specifiers in a declaration is an obsolescent feature.
9889
9890 <p><small><a href="#Contents">Contents</a></small>
9891 <h4><a name="6.11.6" href="#6.11.6">6.11.6 Function declarators</a></h4>
9892 <p><a name="6.11.6p1" href="#6.11.6p1"><small>1</small></a>
9893  The use of function declarators with empty parentheses (not prototype-format parameter
9894  type declarators) is an obsolescent feature.
9895
9896 <p><small><a href="#Contents">Contents</a></small>
9897 <h4><a name="6.11.7" href="#6.11.7">6.11.7 Function definitions</a></h4>
9898 <p><a name="6.11.7p1" href="#6.11.7p1"><small>1</small></a>
9899  The use of function definitions with separate parameter identifier and declaration lists
9900  (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
9901
9902 <p><small><a href="#Contents">Contents</a></small>
9903 <h4><a name="6.11.8" href="#6.11.8">6.11.8 Pragma directives</a></h4>
9904 <p><a name="6.11.8p1" href="#6.11.8p1"><small>1</small></a>
9905  Pragmas whose first preprocessing token is STDC are reserved for future standardization.
9906
9907 <p><small><a href="#Contents">Contents</a></small>
9908 <h4><a name="6.11.9" href="#6.11.9">6.11.9 Predefined macro names</a></h4>
9909 <p><a name="6.11.9p1" href="#6.11.9p1"><small>1</small></a>
9910  Macro names beginning with __STDC_ are reserved for future standardization.
9911 <!--page 198 -->
9912
9913 <p><small><a href="#Contents">Contents</a></small>
9914 <h2><a name="7" href="#7">7. Library</a></h2>
9915
9916 <p><small><a href="#Contents">Contents</a></small>
9917 <h3><a name="7.1" href="#7.1">7.1 Introduction</a></h3>
9918
9919 <p><small><a href="#Contents">Contents</a></small>
9920 <h4><a name="7.1.1" href="#7.1.1">7.1.1 Definitions of terms</a></h4>
9921 <p><a name="7.1.1p1" href="#7.1.1p1"><small>1</small></a>
9922  A string is a contiguous sequence of characters terminated by and including the first null
9923  character. The term multibyte string is sometimes used instead to emphasize special
9924  processing given to multibyte characters contained in the string or to avoid confusion
9925  with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
9926  character. The length of a string is the number of bytes preceding the null character and
9927  the value of a string is the sequence of the values of the contained characters, in order.
9928 <p><a name="7.1.1p2" href="#7.1.1p2"><small>2</small></a>
9929  The decimal-point character is the character used by functions that convert floating-point
9930  numbers to or from character sequences to denote the beginning of the fractional part of
9931  such character sequences.<sup><a href="#note180"><b>180)</b></a></sup> It is represented in the text and examples by a period, but
9932  may be changed by the setlocale function.
9933 <p><a name="7.1.1p3" href="#7.1.1p3"><small>3</small></a>
9934  A null wide character is a wide character with code value zero.
9935 <p><a name="7.1.1p4" href="#7.1.1p4"><small>4</small></a>
9936  A wide string is a contiguous sequence of wide characters terminated by and including
9937  the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
9938  addressed) wide character. The length of a wide string is the number of wide characters
9939  preceding the null wide character and the value of a wide string is the sequence of code
9940  values of the contained wide characters, in order.
9941 <p><a name="7.1.1p5" href="#7.1.1p5"><small>5</small></a>
9942  A shift sequence is a contiguous sequence of bytes within a multibyte string that
9943  (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
9944  corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
9945  character.<sup><a href="#note181"><b>181)</b></a></sup>
9946 <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>).
9947  
9948  
9949  
9950  
9951 <!--page 199 -->
9952
9953 <p><b>Footnotes</b>
9954 <p><small><a name="note180" href="#note180">180)</a> The functions that make use of the decimal-point character are the numeric conversion functions
9955  (<a href="#7.22.1">7.22.1</a>, <a href="#7.29.4.1">7.29.4.1</a>) and the formatted input/output functions (<a href="#7.21.6">7.21.6</a>, <a href="#7.29.2">7.29.2</a>).
9956 </small>
9957 <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
9958  enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
9959  sequence of maximum length. Whether these counts provide for more than one shift sequence is the
9960  implementation's choice.
9961 </small>
9962
9963 <p><small><a href="#Contents">Contents</a></small>
9964 <h4><a name="7.1.2" href="#7.1.2">7.1.2 Standard headers</a></h4>
9965 <p><a name="7.1.2p1" href="#7.1.2p1"><small>1</small></a>
9966  Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note182"><b>182)</b></a></sup>
9967  whose contents are made available by the #include preprocessing directive. The
9968  header declares a set of related functions, plus any necessary types and additional macros
9969  needed to facilitate their use. Declarations of types described in this clause shall not
9970  include type qualifiers, unless explicitly stated otherwise.
9971 <p><a name="7.1.2p2" href="#7.1.2p2"><small>2</small></a>
9972  The standard headers are<sup><a href="#note183"><b>183)</b></a></sup>
9973 <pre>
9974         <a href="#7.2">&lt;assert.h&gt;</a>                     <a href="#7.12">&lt;math.h&gt;</a>                        <a href="#7.22">&lt;stdlib.h&gt;</a>
9975         <a href="#7.3">&lt;complex.h&gt;</a>                    <a href="#7.13">&lt;setjmp.h&gt;</a>                      <a href="#7.23">&lt;stdnoreturn.h&gt;</a>
9976         <a href="#7.4">&lt;ctype.h&gt;</a>                      <a href="#7.14">&lt;signal.h&gt;</a>                      <a href="#7.24">&lt;string.h&gt;</a>
9977         <a href="#7.5">&lt;errno.h&gt;</a>                      <a href="#7.15">&lt;stdalign.h&gt;</a>                    <a href="#7.25">&lt;tgmath.h&gt;</a>
9978         <a href="#7.6">&lt;fenv.h&gt;</a>                       <a href="#7.16">&lt;stdarg.h&gt;</a>                      <a href="#7.26">&lt;threads.h&gt;</a>
9979         <a href="#7.7">&lt;float.h&gt;</a>                      <a href="#7.17">&lt;stdatomic.h&gt;</a>                   <a href="#7.27">&lt;time.h&gt;</a>
9980         <a href="#7.8">&lt;inttypes.h&gt;</a>                   <a href="#7.18">&lt;stdbool.h&gt;</a>                     <a href="#7.28">&lt;uchar.h&gt;</a>
9981         <a href="#7.9">&lt;iso646.h&gt;</a>                     <a href="#7.19">&lt;stddef.h&gt;</a>                      <a href="#7.29">&lt;wchar.h&gt;</a>
9982         <a href="#7.10">&lt;limits.h&gt;</a>                     <a href="#7.20">&lt;stdint.h&gt;</a>                      <a href="#7.30">&lt;wctype.h&gt;</a>
9983         <a href="#7.11">&lt;locale.h&gt;</a>                     <a href="#7.21">&lt;stdio.h&gt;</a>
9984 </pre>
9985 <p><a name="7.1.2p3" href="#7.1.2p3"><small>3</small></a>
9986  If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
9987  provided as part of the implementation, is placed in any of the standard places that are
9988  searched for included source files, the behavior is undefined.
9989 <p><a name="7.1.2p4" href="#7.1.2p4"><small>4</small></a>
9990  Standard headers may be included in any order; each may be included more than once in
9991  a given scope, with no effect different from being included only once, except that the
9992  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
9993  used, a header shall be included outside of any external declaration or definition, and it
9994  shall first be included before the first reference to any of the functions or objects it
9995  declares, or to any of the types or macros it defines. However, if an identifier is declared
9996  or defined in more than one header, the second and subsequent associated headers may be
9997  included after the initial reference to the identifier. The program shall not have any
9998  macros with names lexically identical to keywords currently defined prior to the inclusion
9999  of the header or when any macro defined in the header is expanded.
10000 <p><a name="7.1.2p5" href="#7.1.2p5"><small>5</small></a>
10001  Any definition of an object-like macro described in this clause shall expand to code that is
10002  fully protected by parentheses where necessary, so that it groups in an arbitrary
10003  expression as if it were a single identifier.
10004  
10005  
10006 <!--page 200 -->
10007 <p><a name="7.1.2p6" href="#7.1.2p6"><small>6</small></a>
10008  Any declaration of a library function shall have external linkage.
10009 <p><a name="7.1.2p7" href="#7.1.2p7"><small>7</small></a>
10010  A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
10011 <p><b> Forward references</b>: diagnostics (<a href="#7.2">7.2</a>).
10012
10013 <p><b>Footnotes</b>
10014 <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
10015  necessarily valid source file names.
10016 </small>
10017 <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.26">&lt;threads.h&gt;</a> are conditional features that
10018  implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.
10019 </small>
10020
10021 <p><small><a href="#Contents">Contents</a></small>
10022 <h4><a name="7.1.3" href="#7.1.3">7.1.3 Reserved identifiers</a></h4>
10023 <p><a name="7.1.3p1" href="#7.1.3p1"><small>1</small></a>
10024  Each header declares or defines all identifiers listed in its associated subclause, and
10025  optionally declares or defines identifiers listed in its associated future library directions
10026  subclause and identifiers which are always reserved either for any use or for use as file
10027  scope identifiers.
10028 <ul>
10029 <li>  All identifiers that begin with an underscore and either an uppercase letter or another
10030  underscore are always reserved for any use.
10031 <li>  All identifiers that begin with an underscore are always reserved for use as identifiers
10032  with file scope in both the ordinary and tag name spaces.
10033 <li>  Each macro name in any of the following subclauses (including the future library
10034  directions) is reserved for use as specified if any of its associated headers is included;
10035  unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
10036 <li>  All identifiers with external linkage in any of the following subclauses (including the
10037  future library directions) and errno are always reserved for use as identifiers with
10038  external linkage.<sup><a href="#note184"><b>184)</b></a></sup>
10039 <li>  Each identifier with file scope listed in any of the following subclauses (including the
10040  future library directions) is reserved for use as a macro name and as an identifier with
10041  file scope in the same name space if any of its associated headers is included.
10042 </ul>
10043 <p><a name="7.1.3p2" href="#7.1.3p2"><small>2</small></a>
10044  No other identifiers are reserved. If the program declares or defines an identifier in a
10045  context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
10046  identifier as a macro name, the behavior is undefined.
10047 <p><a name="7.1.3p3" href="#7.1.3p3"><small>3</small></a>
10048  If the program removes (with #undef) any macro definition of an identifier in the first
10049  group listed above, the behavior is undefined.
10050  
10051  
10052  
10053  
10054 <!--page 201 -->
10055
10056 <p><b>Footnotes</b>
10057 <p><small><a name="note184" href="#note184">184)</a> The list of reserved identifiers with external linkage includes math_errhandling, setjmp,
10058  va_copy, and va_end.
10059 </small>
10060
10061 <p><small><a href="#Contents">Contents</a></small>
10062 <h4><a name="7.1.4" href="#7.1.4">7.1.4 Use of library functions</a></h4>
10063 <p><a name="7.1.4p1" href="#7.1.4p1"><small>1</small></a>
10064  Each of the following statements applies unless explicitly stated otherwise in the detailed
10065  descriptions that follow: If an argument to a function has an invalid value (such as a value
10066  outside the domain of the function, or a pointer outside the address space of the program,
10067  or a null pointer, or a pointer to non-modifiable storage when the corresponding
10068  parameter is not const-qualified) or a type (after promotion) not expected by a function
10069  with variable number of arguments, the behavior is undefined. If a function argument is
10070  described as being an array, the pointer actually passed to the function shall have a value
10071  such that all address computations and accesses to objects (that would be valid if the
10072  pointer did point to the first element of such an array) are in fact valid. Any function
10073  declared in a header may be additionally implemented as a function-like macro defined in
10074  the header, so if a library function is declared explicitly when its header is included, one
10075  of the techniques shown below can be used to ensure the declaration is not affected by
10076  such a macro. Any macro definition of a function can be suppressed locally by enclosing
10077  the name of the function in parentheses, because the name is then not followed by the left
10078  parenthesis that indicates expansion of a macro function name. For the same syntactic
10079  reason, it is permitted to take the address of a library function even if it is also defined as
10080  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
10081  actual function is referred to. Any invocation of a library function that is implemented as
10082  a macro shall expand to code that evaluates each of its arguments exactly once, fully
10083  protected by parentheses where necessary, so it is generally safe to use arbitrary
10084  expressions as arguments.<sup><a href="#note186"><b>186)</b></a></sup> Likewise, those function-like macros described in the
10085  following subclauses may be invoked in an expression anywhere a function with a
10086  compatible return type could be called.<sup><a href="#note187"><b>187)</b></a></sup> All object-like macros listed as expanding to
10087  
10088  
10089 <!--page 202 -->
10090  integer constant expressions shall additionally be suitable for use in #if preprocessing
10091  directives.
10092 <p><a name="7.1.4p2" href="#7.1.4p2"><small>2</small></a>
10093  Provided that a library function can be declared without reference to any type defined in a
10094  header, it is also permissible to declare the function and use it without including its
10095  associated header.
10096 <p><a name="7.1.4p3" href="#7.1.4p3"><small>3</small></a>
10097  There is a sequence point immediately before a library function returns.
10098 <p><a name="7.1.4p4" href="#7.1.4p4"><small>4</small></a>
10099  The functions in the standard library are not guaranteed to be reentrant and may modify
10100  objects with static or thread storage duration.<sup><a href="#note188"><b>188)</b></a></sup>
10101 <p><a name="7.1.4p5" href="#7.1.4p5"><small>5</small></a>
10102  Unless explicitly stated otherwise in the detailed descriptions that follow, library
10103  functions shall prevent data races as follows: A library function shall not directly or
10104  indirectly access objects accessible by threads other than the current thread unless the
10105  objects are accessed directly or indirectly via the function's arguments. A library
10106  function shall not directly or indirectly modify objects accessible by threads other than
10107  the current thread unless the objects are accessed directly or indirectly via the function's
10108  non-const arguments.<sup><a href="#note189"><b>189)</b></a></sup> Implementations may share their own internal objects between
10109  threads if the objects are not visible to users and are protected against data races.
10110 <p><a name="7.1.4p6" href="#7.1.4p6"><small>6</small></a>
10111  Unless otherwise specified, library functions shall perform all operations solely within the
10112  current thread if those operations have effects that are visible to users.<sup><a href="#note190"><b>190)</b></a></sup>
10113 <p><a name="7.1.4p7" href="#7.1.4p7"><small>7</small></a>
10114  EXAMPLE        The function atoi may be used in any of several ways:
10115 <ul>
10116 <li>  by use of its associated header (possibly generating a macro expansion)
10117 <pre>
10118             #include <a href="#7.22">&lt;stdlib.h&gt;</a>
10119             const char *str;
10120             /* ... */
10121             i = atoi(str);
10122 </pre>
10123 <li>  by use of its associated header (assuredly generating a true function reference)
10124  
10125  
10126  
10127  
10128 <!--page 203 -->
10129 <pre>
10130            #include <a href="#7.22">&lt;stdlib.h&gt;</a>
10131            #undef atoi
10132            const char *str;
10133            /* ... */
10134            i = atoi(str);
10135 </pre>
10136   or
10137 <pre>
10138            #include <a href="#7.22">&lt;stdlib.h&gt;</a>
10139            const char *str;
10140            /* ... */
10141            i = (atoi)(str);
10142 </pre>
10143 <li>  by explicit declaration
10144 <!--page 204 -->
10145 <pre>
10146            extern int atoi(const char *);
10147            const char *str;
10148            /* ... */
10149            i = atoi(str);
10150 </pre>
10151 </ul>
10152
10153 <p><b>Footnotes</b>
10154 <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
10155  also provides a macro for that function.
10156 </small>
10157 <p><small><a name="note186" href="#note186">186)</a> Such macros might not contain the sequence points that the corresponding function calls do.
10158 </small>
10159 <p><small><a name="note187" href="#note187">187)</a> Because external identifiers and some macro names beginning with an underscore are reserved,
10160  implementations may provide special semantics for such names. For example, the identifier
10161  _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
10162  appropriate header could specify
10163
10164 <pre>
10165           #define abs(x) _BUILTIN_abs(x)
10166 </pre>
10167  for a compiler whose code generator will accept it.
10168  In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
10169  function may write
10170
10171 <pre>
10172           #undef abs
10173 </pre>
10174  whether the implementation's header provides a macro implementation of abs or a built-in
10175  implementation. The prototype for the function, which precedes and is hidden by any macro
10176  definition, is thereby revealed also.
10177 </small>
10178 <p><small><a name="note188" href="#note188">188)</a> Thus, a signal handler cannot, in general, call standard library functions.
10179 </small>
10180 <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
10181  purposes without synchronization because it could cause a data race even in programs that do not
10182  explicitly share objects between threads. Similarly, an implementation of memcpy is not permitted to
10183  copy bytes beyond the specified length of the destination object and then restore the original values
10184  because it could cause a data race if the program shared those bytes between threads.
10185 </small>
10186 <p><small><a name="note190" href="#note190">190)</a> This allows implementations to parallelize operations if there are no visible side effects.
10187 </small>
10188
10189 <p><small><a href="#Contents">Contents</a></small>
10190 <h3><a name="7.2" href="#7.2">7.2 Diagnostics &lt;assert.h&gt;</a></h3>
10191 <p><a name="7.2p1" href="#7.2p1"><small>1</small></a>
10192  The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert and static_assert macros and
10193  refers to another macro,
10194 <pre>
10195          NDEBUG
10196 </pre>
10197  which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
10198  point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
10199  simply as
10200 <pre>
10201          #define assert(ignore) ((void)0)
10202 </pre>
10203  The assert macro is redefined according to the current state of NDEBUG each time that
10204  <a href="#7.2">&lt;assert.h&gt;</a> is included.
10205 <p><a name="7.2p2" href="#7.2p2"><small>2</small></a>
10206  The assert macro shall be implemented as a macro, not as an actual function. If the
10207  macro definition is suppressed in order to access an actual function, the behavior is
10208  undefined.
10209 <p><a name="7.2p3" href="#7.2p3"><small>3</small></a>
10210  The macro
10211 <pre>
10212          static_assert
10213 </pre>
10214  expands to _Static_assert.
10215
10216 <p><small><a href="#Contents">Contents</a></small>
10217 <h4><a name="7.2.1" href="#7.2.1">7.2.1 Program diagnostics</a></h4>
10218
10219 <p><small><a href="#Contents">Contents</a></small>
10220 <h5><a name="7.2.1.1" href="#7.2.1.1">7.2.1.1 The assert macro</a></h5>
10221 <p><b>Synopsis</b>
10222 <p><a name="7.2.1.1p1" href="#7.2.1.1p1"><small>1</small></a>
10223 <pre>
10224          #include <a href="#7.2">&lt;assert.h&gt;</a>
10225          void assert(scalar expression);
10226 </pre>
10227 <p><b>Description</b>
10228 <p><a name="7.2.1.1p2" href="#7.2.1.1p2"><small>2</small></a>
10229  The assert macro puts diagnostic tests into programs; it expands to a void expression.
10230  When it is executed, if expression (which shall have a scalar type) is false (that is,
10231  compares equal to 0), the assert macro writes information about the particular call that
10232  failed (including the text of the argument, the name of the source file, the source line
10233  number, and the name of the enclosing function -- the latter are respectively the values of
10234  the preprocessing macros __FILE__ and __LINE__ and of the identifier
10235  __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note191"><b>191)</b></a></sup> It
10236  then calls the abort function.
10237  
10238  
10239  
10240 <!--page 205 -->
10241 <p><b>Returns</b>
10242 <p><a name="7.2.1.1p3" href="#7.2.1.1p3"><small>3</small></a>
10243  The assert macro returns no value.
10244 <p><b> Forward references</b>: the abort function (<a href="#7.22.4.1">7.22.4.1</a>).
10245 <!--page 206 -->
10246
10247 <p><b>Footnotes</b>
10248 <p><small><a name="note191" href="#note191">191)</a> The message written might be of the form:
10249   Assertion failed: expression, function abc, file xyz, line nnn.
10250 </small>
10251
10252 <p><small><a href="#Contents">Contents</a></small>
10253 <h3><a name="7.3" href="#7.3">7.3 Complex arithmetic &lt;complex.h&gt;</a></h3>
10254
10255 <p><small><a href="#Contents">Contents</a></small>
10256 <h4><a name="7.3.1" href="#7.3.1">7.3.1 Introduction</a></h4>
10257 <p><a name="7.3.1p1" href="#7.3.1p1"><small>1</small></a>
10258  The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
10259  arithmetic.<sup><a href="#note192"><b>192)</b></a></sup>
10260 <p><a name="7.3.1p2" href="#7.3.1p2"><small>2</small></a>
10261  Implementations that define the macro __STDC_NO_COMPLEX__ need not provide
10262  this header nor support any of its facilities.
10263 <p><a name="7.3.1p3" href="#7.3.1p3"><small>3</small></a>
10264  Each synopsis specifies a family of functions consisting of a principal function with one
10265  or more double complex parameters and a double complex or double return
10266  value; and other functions with the same name but with f and l suffixes which are
10267  corresponding functions with float and long double parameters and return values.
10268 <p><a name="7.3.1p4" href="#7.3.1p4"><small>4</small></a>
10269  The macro
10270 <pre>
10271           complex
10272 </pre>
10273  expands to _Complex; the macro
10274 <pre>
10275           _Complex_I
10276 </pre>
10277  expands to a constant expression of type const float _Complex, with the value of
10278  the imaginary unit.<sup><a href="#note193"><b>193)</b></a></sup>
10279 <p><a name="7.3.1p5" href="#7.3.1p5"><small>5</small></a>
10280  The macros
10281 <pre>
10282           imaginary
10283 </pre>
10284  and
10285 <pre>
10286           _Imaginary_I
10287 </pre>
10288  are defined if and only if the implementation supports imaginary types;<sup><a href="#note194"><b>194)</b></a></sup> if defined,
10289  they expand to _Imaginary and a constant expression of type const float
10290  _Imaginary with the value of the imaginary unit.
10291 <p><a name="7.3.1p6" href="#7.3.1p6"><small>6</small></a>
10292  The macro
10293 <pre>
10294           I
10295 </pre>
10296  expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
10297  defined, I shall expand to _Complex_I.
10298 <p><a name="7.3.1p7" href="#7.3.1p7"><small>7</small></a>
10299  Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
10300  redefine the macros complex, imaginary, and I.
10301  
10302 <!--page 207 -->
10303 <p><b> Forward references</b>: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
10304
10305 <p><b>Footnotes</b>
10306 <p><small><a name="note192" href="#note192">192)</a> See ''future library directions'' (<a href="#7.31.1">7.31.1</a>).
10307 </small>
10308 <p><small><a name="note193" href="#note193">193)</a> The imaginary unit is a number i such that i 2 = -1.
10309 </small>
10310 <p><small><a name="note194" href="#note194">194)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
10311 </small>
10312
10313 <p><small><a href="#Contents">Contents</a></small>
10314 <h4><a name="7.3.2" href="#7.3.2">7.3.2 Conventions</a></h4>
10315 <p><a name="7.3.2p1" href="#7.3.2p1"><small>1</small></a>
10316  Values are interpreted as radians, not degrees. An implementation may set errno but is
10317  not required to.
10318
10319 <p><small><a href="#Contents">Contents</a></small>
10320 <h4><a name="7.3.3" href="#7.3.3">7.3.3 Branch cuts</a></h4>
10321 <p><a name="7.3.3p1" href="#7.3.3p1"><small>1</small></a>
10322  Some of the functions below have branch cuts, across which the function is
10323  discontinuous. For implementations with a signed zero (including all IEC 60559
10324  implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
10325  one side of a cut from another so the function is continuous (except for format
10326  limitations) as the cut is approached from either side. For example, for the square root
10327  function, which has a branch cut along the negative real axis, the top of the cut, with
10328  imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
10329  imaginary part -0, maps to the negative imaginary axis.
10330 <p><a name="7.3.3p2" href="#7.3.3p2"><small>2</small></a>
10331  Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
10332  sides of branch cuts. These implementations shall map a cut so the function is continuous
10333  as the cut is approached coming around the finite endpoint of the cut in a counter
10334  clockwise direction. (Branch cuts for the functions specified here have just one finite
10335  endpoint.) For example, for the square root function, coming counter clockwise around
10336  the finite endpoint of the cut along the negative real axis approaches the cut from above,
10337  so the cut maps to the positive imaginary axis.
10338
10339 <p><small><a href="#Contents">Contents</a></small>
10340 <h4><a name="7.3.4" href="#7.3.4">7.3.4 The CX_LIMITED_RANGE pragma</a></h4>
10341 <p><b>Synopsis</b>
10342 <p><a name="7.3.4p1" href="#7.3.4p1"><small>1</small></a>
10343 <pre>
10344           #include <a href="#7.3">&lt;complex.h&gt;</a>
10345           #pragma STDC CX_LIMITED_RANGE on-off-switch
10346 </pre>
10347 <p><b>Description</b>
10348 <p><a name="7.3.4p2" href="#7.3.4p2"><small>2</small></a>
10349  The usual mathematical formulas for complex multiply, divide, and absolute value are
10350  problematic because of their treatment of infinities and because of undue overflow and
10351  underflow. The CX_LIMITED_RANGE pragma can be used to inform the
10352  implementation that (where the state is ''on'') the usual mathematical formulas are
10353  acceptable.<sup><a href="#note195"><b>195)</b></a></sup> The pragma can occur either outside external declarations or preceding all
10354  explicit declarations and statements inside a compound statement. When outside external
10355  declarations, the pragma takes effect from its occurrence until another
10356  CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
10357  When inside a compound statement, the pragma takes effect from its occurrence until
10358  another CX_LIMITED_RANGE pragma is encountered (including within a nested
10359  compound statement), or until the end of the compound statement; at the end of a
10360  compound statement the state for the pragma is restored to its condition just before the
10361 <!--page 208 -->
10362  compound statement. If this pragma is used in any other context, the behavior is
10363  undefined. The default state for the pragma is ''off''.
10364
10365 <p><b>Footnotes</b>
10366 <p><small><a name="note195" href="#note195">195)</a> The purpose of the pragma is to allow the implementation to use the formulas:
10367
10368 <pre>
10369      (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
10370      (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
10371      | x + iy | = (sqrt) x 2 + y 2
10372                   -----
10373 </pre>
10374   where the programmer can determine they are safe.
10375 </small>
10376
10377 <p><small><a href="#Contents">Contents</a></small>
10378 <h4><a name="7.3.5" href="#7.3.5">7.3.5 Trigonometric functions</a></h4>
10379
10380 <p><small><a href="#Contents">Contents</a></small>
10381 <h5><a name="7.3.5.1" href="#7.3.5.1">7.3.5.1 The cacos functions</a></h5>
10382 <p><b>Synopsis</b>
10383 <p><a name="7.3.5.1p1" href="#7.3.5.1p1"><small>1</small></a>
10384 <pre>
10385           #include <a href="#7.3">&lt;complex.h&gt;</a>
10386           double complex cacos(double complex z);
10387           float complex cacosf(float complex z);
10388           long double complex cacosl(long double complex z);
10389 </pre>
10390 <p><b>Description</b>
10391 <p><a name="7.3.5.1p2" href="#7.3.5.1p2"><small>2</small></a>
10392  The cacos functions compute the complex arc cosine of z, with branch cuts outside the
10393  interval [-1, +1] along the real axis.
10394 <p><b>Returns</b>
10395 <p><a name="7.3.5.1p3" href="#7.3.5.1p3"><small>3</small></a>
10396  The cacos functions return the complex arc cosine value, in the range of a strip
10397  mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
10398  real axis.
10399
10400 <p><small><a href="#Contents">Contents</a></small>
10401 <h5><a name="7.3.5.2" href="#7.3.5.2">7.3.5.2 The casin functions</a></h5>
10402 <p><b>Synopsis</b>
10403 <p><a name="7.3.5.2p1" href="#7.3.5.2p1"><small>1</small></a>
10404 <pre>
10405           #include <a href="#7.3">&lt;complex.h&gt;</a>
10406           double complex casin(double complex z);
10407           float complex casinf(float complex z);
10408           long double complex casinl(long double complex z);
10409 </pre>
10410 <p><b>Description</b>
10411 <p><a name="7.3.5.2p2" href="#7.3.5.2p2"><small>2</small></a>
10412  The casin functions compute the complex arc sine of z, with branch cuts outside the
10413  interval [-1, +1] along the real axis.
10414 <p><b>Returns</b>
10415 <p><a name="7.3.5.2p3" href="#7.3.5.2p3"><small>3</small></a>
10416  The casin functions return the complex arc sine value, in the range of a strip
10417  mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
10418  
10419 <!--page 209 -->
10420  along the real axis.
10421
10422 <p><small><a href="#Contents">Contents</a></small>
10423 <h5><a name="7.3.5.3" href="#7.3.5.3">7.3.5.3 The catan functions</a></h5>
10424 <p><b>Synopsis</b>
10425 <p><a name="7.3.5.3p1" href="#7.3.5.3p1"><small>1</small></a>
10426 <pre>
10427          #include <a href="#7.3">&lt;complex.h&gt;</a>
10428          double complex catan(double complex z);
10429          float complex catanf(float complex z);
10430          long double complex catanl(long double complex z);
10431 </pre>
10432 <p><b>Description</b>
10433 <p><a name="7.3.5.3p2" href="#7.3.5.3p2"><small>2</small></a>
10434  The catan functions compute the complex arc tangent of z, with branch cuts outside the
10435  interval [-i, +i] along the imaginary axis.
10436 <p><b>Returns</b>
10437 <p><a name="7.3.5.3p3" href="#7.3.5.3p3"><small>3</small></a>
10438  The catan functions return the complex arc tangent value, in the range of a strip
10439  mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
10440  along the real axis.
10441
10442 <p><small><a href="#Contents">Contents</a></small>
10443 <h5><a name="7.3.5.4" href="#7.3.5.4">7.3.5.4 The ccos functions</a></h5>
10444 <p><b>Synopsis</b>
10445 <p><a name="7.3.5.4p1" href="#7.3.5.4p1"><small>1</small></a>
10446 <pre>
10447          #include <a href="#7.3">&lt;complex.h&gt;</a>
10448          double complex ccos(double complex z);
10449          float complex ccosf(float complex z);
10450          long double complex ccosl(long double complex z);
10451 </pre>
10452 <p><b>Description</b>
10453 <p><a name="7.3.5.4p2" href="#7.3.5.4p2"><small>2</small></a>
10454  The ccos functions compute the complex cosine of z.
10455 <p><b>Returns</b>
10456 <p><a name="7.3.5.4p3" href="#7.3.5.4p3"><small>3</small></a>
10457  The ccos functions return the complex cosine value.
10458
10459 <p><small><a href="#Contents">Contents</a></small>
10460 <h5><a name="7.3.5.5" href="#7.3.5.5">7.3.5.5 The csin functions</a></h5>
10461 <p><b>Synopsis</b>
10462 <p><a name="7.3.5.5p1" href="#7.3.5.5p1"><small>1</small></a>
10463 <pre>
10464          #include <a href="#7.3">&lt;complex.h&gt;</a>
10465          double complex csin(double complex z);
10466          float complex csinf(float complex z);
10467          long double complex csinl(long double complex z);
10468 </pre>
10469 <p><b>Description</b>
10470 <p><a name="7.3.5.5p2" href="#7.3.5.5p2"><small>2</small></a>
10471  The csin functions compute the complex sine of z.
10472 <!--page 210 -->
10473 <p><b>Returns</b>
10474 <p><a name="7.3.5.5p3" href="#7.3.5.5p3"><small>3</small></a>
10475  The csin functions return the complex sine value.
10476
10477 <p><small><a href="#Contents">Contents</a></small>
10478 <h5><a name="7.3.5.6" href="#7.3.5.6">7.3.5.6 The ctan functions</a></h5>
10479 <p><b>Synopsis</b>
10480 <p><a name="7.3.5.6p1" href="#7.3.5.6p1"><small>1</small></a>
10481 <pre>
10482         #include <a href="#7.3">&lt;complex.h&gt;</a>
10483         double complex ctan(double complex z);
10484         float complex ctanf(float complex z);
10485         long double complex ctanl(long double complex z);
10486 </pre>
10487 <p><b>Description</b>
10488 <p><a name="7.3.5.6p2" href="#7.3.5.6p2"><small>2</small></a>
10489  The ctan functions compute the complex tangent of z.
10490 <p><b>Returns</b>
10491 <p><a name="7.3.5.6p3" href="#7.3.5.6p3"><small>3</small></a>
10492  The ctan functions return the complex tangent value.
10493
10494 <p><small><a href="#Contents">Contents</a></small>
10495 <h4><a name="7.3.6" href="#7.3.6">7.3.6 Hyperbolic functions</a></h4>
10496
10497 <p><small><a href="#Contents">Contents</a></small>
10498 <h5><a name="7.3.6.1" href="#7.3.6.1">7.3.6.1 The cacosh functions</a></h5>
10499 <p><b>Synopsis</b>
10500 <p><a name="7.3.6.1p1" href="#7.3.6.1p1"><small>1</small></a>
10501 <pre>
10502         #include <a href="#7.3">&lt;complex.h&gt;</a>
10503         double complex cacosh(double complex z);
10504         float complex cacoshf(float complex z);
10505         long double complex cacoshl(long double complex z);
10506 </pre>
10507 <p><b>Description</b>
10508 <p><a name="7.3.6.1p2" href="#7.3.6.1p2"><small>2</small></a>
10509  The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
10510  cut at values less than 1 along the real axis.
10511 <p><b>Returns</b>
10512 <p><a name="7.3.6.1p3" href="#7.3.6.1p3"><small>3</small></a>
10513  The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
10514  half-strip of nonnegative values along the real axis and in the interval [-ipi , +ipi ] along the
10515  imaginary axis.
10516
10517 <p><small><a href="#Contents">Contents</a></small>
10518 <h5><a name="7.3.6.2" href="#7.3.6.2">7.3.6.2 The casinh functions</a></h5>
10519 <p><b>Synopsis</b>
10520 <p><a name="7.3.6.2p1" href="#7.3.6.2p1"><small>1</small></a>
10521 <!--page 211 -->
10522 <pre>
10523         #include <a href="#7.3">&lt;complex.h&gt;</a>
10524         double complex casinh(double complex z);
10525         float complex casinhf(float complex z);
10526         long double complex casinhl(long double complex z);
10527 </pre>
10528 <p><b>Description</b>
10529 <p><a name="7.3.6.2p2" href="#7.3.6.2p2"><small>2</small></a>
10530  The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
10531  outside the interval [-i, +i] along the imaginary axis.
10532 <p><b>Returns</b>
10533 <p><a name="7.3.6.2p3" href="#7.3.6.2p3"><small>3</small></a>
10534  The casinh functions return the complex arc hyperbolic sine value, in the range of a
10535  strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
10536  along the imaginary axis.
10537
10538 <p><small><a href="#Contents">Contents</a></small>
10539 <h5><a name="7.3.6.3" href="#7.3.6.3">7.3.6.3 The catanh functions</a></h5>
10540 <p><b>Synopsis</b>
10541 <p><a name="7.3.6.3p1" href="#7.3.6.3p1"><small>1</small></a>
10542 <pre>
10543          #include <a href="#7.3">&lt;complex.h&gt;</a>
10544          double complex catanh(double complex z);
10545          float complex catanhf(float complex z);
10546          long double complex catanhl(long double complex z);
10547 </pre>
10548 <p><b>Description</b>
10549 <p><a name="7.3.6.3p2" href="#7.3.6.3p2"><small>2</small></a>
10550  The catanh functions compute the complex arc hyperbolic tangent of z, with branch
10551  cuts outside the interval [-1, +1] along the real axis.
10552 <p><b>Returns</b>
10553 <p><a name="7.3.6.3p3" href="#7.3.6.3p3"><small>3</small></a>
10554  The catanh functions return the complex arc hyperbolic tangent value, in the range of a
10555  strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
10556  along the imaginary axis.
10557
10558 <p><small><a href="#Contents">Contents</a></small>
10559 <h5><a name="7.3.6.4" href="#7.3.6.4">7.3.6.4 The ccosh functions</a></h5>
10560 <p><b>Synopsis</b>
10561 <p><a name="7.3.6.4p1" href="#7.3.6.4p1"><small>1</small></a>
10562 <pre>
10563          #include <a href="#7.3">&lt;complex.h&gt;</a>
10564          double complex ccosh(double complex z);
10565          float complex ccoshf(float complex z);
10566          long double complex ccoshl(long double complex z);
10567 </pre>
10568 <p><b>Description</b>
10569 <p><a name="7.3.6.4p2" href="#7.3.6.4p2"><small>2</small></a>
10570  The ccosh functions compute the complex hyperbolic cosine of z.
10571 <p><b>Returns</b>
10572 <p><a name="7.3.6.4p3" href="#7.3.6.4p3"><small>3</small></a>
10573  The ccosh functions return the complex hyperbolic cosine value.
10574 <!--page 212 -->
10575
10576 <p><small><a href="#Contents">Contents</a></small>
10577 <h5><a name="7.3.6.5" href="#7.3.6.5">7.3.6.5 The csinh functions</a></h5>
10578 <p><b>Synopsis</b>
10579 <p><a name="7.3.6.5p1" href="#7.3.6.5p1"><small>1</small></a>
10580 <pre>
10581         #include <a href="#7.3">&lt;complex.h&gt;</a>
10582         double complex csinh(double complex z);
10583         float complex csinhf(float complex z);
10584         long double complex csinhl(long double complex z);
10585 </pre>
10586 <p><b>Description</b>
10587 <p><a name="7.3.6.5p2" href="#7.3.6.5p2"><small>2</small></a>
10588  The csinh functions compute the complex hyperbolic sine of z.
10589 <p><b>Returns</b>
10590 <p><a name="7.3.6.5p3" href="#7.3.6.5p3"><small>3</small></a>
10591  The csinh functions return the complex hyperbolic sine value.
10592
10593 <p><small><a href="#Contents">Contents</a></small>
10594 <h5><a name="7.3.6.6" href="#7.3.6.6">7.3.6.6 The ctanh functions</a></h5>
10595 <p><b>Synopsis</b>
10596 <p><a name="7.3.6.6p1" href="#7.3.6.6p1"><small>1</small></a>
10597 <pre>
10598         #include <a href="#7.3">&lt;complex.h&gt;</a>
10599         double complex ctanh(double complex z);
10600         float complex ctanhf(float complex z);
10601         long double complex ctanhl(long double complex z);
10602 </pre>
10603 <p><b>Description</b>
10604 <p><a name="7.3.6.6p2" href="#7.3.6.6p2"><small>2</small></a>
10605  The ctanh functions compute the complex hyperbolic tangent of z.
10606 <p><b>Returns</b>
10607 <p><a name="7.3.6.6p3" href="#7.3.6.6p3"><small>3</small></a>
10608  The ctanh functions return the complex hyperbolic tangent value.
10609
10610 <p><small><a href="#Contents">Contents</a></small>
10611 <h4><a name="7.3.7" href="#7.3.7">7.3.7 Exponential and logarithmic functions</a></h4>
10612
10613 <p><small><a href="#Contents">Contents</a></small>
10614 <h5><a name="7.3.7.1" href="#7.3.7.1">7.3.7.1 The cexp functions</a></h5>
10615 <p><b>Synopsis</b>
10616 <p><a name="7.3.7.1p1" href="#7.3.7.1p1"><small>1</small></a>
10617 <pre>
10618         #include <a href="#7.3">&lt;complex.h&gt;</a>
10619         double complex cexp(double complex z);
10620         float complex cexpf(float complex z);
10621         long double complex cexpl(long double complex z);
10622 </pre>
10623 <p><b>Description</b>
10624 <p><a name="7.3.7.1p2" href="#7.3.7.1p2"><small>2</small></a>
10625  The cexp functions compute the complex base-e exponential of z.
10626 <p><b>Returns</b>
10627 <p><a name="7.3.7.1p3" href="#7.3.7.1p3"><small>3</small></a>
10628  The cexp functions return the complex base-e exponential value.
10629 <!--page 213 -->
10630
10631 <p><small><a href="#Contents">Contents</a></small>
10632 <h5><a name="7.3.7.2" href="#7.3.7.2">7.3.7.2 The clog functions</a></h5>
10633 <p><b>Synopsis</b>
10634 <p><a name="7.3.7.2p1" href="#7.3.7.2p1"><small>1</small></a>
10635 <pre>
10636          #include <a href="#7.3">&lt;complex.h&gt;</a>
10637          double complex clog(double complex z);
10638          float complex clogf(float complex z);
10639          long double complex clogl(long double complex z);
10640 </pre>
10641 <p><b>Description</b>
10642 <p><a name="7.3.7.2p2" href="#7.3.7.2p2"><small>2</small></a>
10643  The clog functions compute the complex natural (base-e) logarithm of z, with a branch
10644  cut along the negative real axis.
10645 <p><b>Returns</b>
10646 <p><a name="7.3.7.2p3" href="#7.3.7.2p3"><small>3</small></a>
10647  The clog functions return the complex natural logarithm value, in the range of a strip
10648  mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
10649  imaginary axis.
10650
10651 <p><small><a href="#Contents">Contents</a></small>
10652 <h4><a name="7.3.8" href="#7.3.8">7.3.8 Power and absolute-value functions</a></h4>
10653
10654 <p><small><a href="#Contents">Contents</a></small>
10655 <h5><a name="7.3.8.1" href="#7.3.8.1">7.3.8.1 The cabs functions</a></h5>
10656 <p><b>Synopsis</b>
10657 <p><a name="7.3.8.1p1" href="#7.3.8.1p1"><small>1</small></a>
10658 <pre>
10659          #include <a href="#7.3">&lt;complex.h&gt;</a>
10660          double cabs(double complex z);
10661          float cabsf(float complex z);
10662          long double cabsl(long double complex z);
10663 </pre>
10664 <p><b>Description</b>
10665 <p><a name="7.3.8.1p2" href="#7.3.8.1p2"><small>2</small></a>
10666  The cabs functions compute the complex absolute value (also called norm, modulus, or
10667  magnitude) of z.
10668 <p><b>Returns</b>
10669 <p><a name="7.3.8.1p3" href="#7.3.8.1p3"><small>3</small></a>
10670  The cabs functions return the complex absolute value.
10671
10672 <p><small><a href="#Contents">Contents</a></small>
10673 <h5><a name="7.3.8.2" href="#7.3.8.2">7.3.8.2 The cpow functions</a></h5>
10674 <p><b>Synopsis</b>
10675 <p><a name="7.3.8.2p1" href="#7.3.8.2p1"><small>1</small></a>
10676 <!--page 214 -->
10677 <pre>
10678          #include <a href="#7.3">&lt;complex.h&gt;</a>
10679          double complex cpow(double complex x, double complex y);
10680          float complex cpowf(float complex x, float complex y);
10681          long double complex cpowl(long double complex x,
10682               long double complex y);
10683 </pre>
10684 <p><b>Description</b>
10685 <p><a name="7.3.8.2p2" href="#7.3.8.2p2"><small>2</small></a>
10686  The cpow functions compute the complex power function xy , with a branch cut for the
10687  first parameter along the negative real axis.
10688 <p><b>Returns</b>
10689 <p><a name="7.3.8.2p3" href="#7.3.8.2p3"><small>3</small></a>
10690  The cpow functions return the complex power function value.
10691
10692 <p><small><a href="#Contents">Contents</a></small>
10693 <h5><a name="7.3.8.3" href="#7.3.8.3">7.3.8.3 The csqrt functions</a></h5>
10694 <p><b>Synopsis</b>
10695 <p><a name="7.3.8.3p1" href="#7.3.8.3p1"><small>1</small></a>
10696 <pre>
10697         #include <a href="#7.3">&lt;complex.h&gt;</a>
10698         double complex csqrt(double complex z);
10699         float complex csqrtf(float complex z);
10700         long double complex csqrtl(long double complex z);
10701 </pre>
10702 <p><b>Description</b>
10703 <p><a name="7.3.8.3p2" href="#7.3.8.3p2"><small>2</small></a>
10704  The csqrt functions compute the complex square root of z, with a branch cut along the
10705  negative real axis.
10706 <p><b>Returns</b>
10707 <p><a name="7.3.8.3p3" href="#7.3.8.3p3"><small>3</small></a>
10708  The csqrt functions return the complex square root value, in the range of the right half-
10709  plane (including the imaginary axis).
10710
10711 <p><small><a href="#Contents">Contents</a></small>
10712 <h4><a name="7.3.9" href="#7.3.9">7.3.9 Manipulation functions</a></h4>
10713
10714 <p><small><a href="#Contents">Contents</a></small>
10715 <h5><a name="7.3.9.1" href="#7.3.9.1">7.3.9.1 The carg functions</a></h5>
10716 <p><b>Synopsis</b>
10717 <p><a name="7.3.9.1p1" href="#7.3.9.1p1"><small>1</small></a>
10718 <pre>
10719         #include <a href="#7.3">&lt;complex.h&gt;</a>
10720         double carg(double complex z);
10721         float cargf(float complex z);
10722         long double cargl(long double complex z);
10723 </pre>
10724 <p><b>Description</b>
10725 <p><a name="7.3.9.1p2" href="#7.3.9.1p2"><small>2</small></a>
10726  The carg functions compute the argument (also called phase angle) of z, with a branch
10727  cut along the negative real axis.
10728 <p><b>Returns</b>
10729 <p><a name="7.3.9.1p3" href="#7.3.9.1p3"><small>3</small></a>
10730  The carg functions return the value of the argument in the interval [-pi , +pi ].
10731 <!--page 215 -->
10732
10733 <p><small><a href="#Contents">Contents</a></small>
10734 <h5><a name="7.3.9.2" href="#7.3.9.2">7.3.9.2 The cimag functions</a></h5>
10735 <p><b>Synopsis</b>
10736 <p><a name="7.3.9.2p1" href="#7.3.9.2p1"><small>1</small></a>
10737 <pre>
10738          #include <a href="#7.3">&lt;complex.h&gt;</a>
10739          double cimag(double complex z);
10740          float cimagf(float complex z);
10741          long double cimagl(long double complex z);
10742 </pre>
10743 <p><b>Description</b>
10744 <p><a name="7.3.9.2p2" href="#7.3.9.2p2"><small>2</small></a>
10745  The cimag functions compute the imaginary part of z.<sup><a href="#note196"><b>196)</b></a></sup>
10746 <p><b>Returns</b>
10747 <p><a name="7.3.9.2p3" href="#7.3.9.2p3"><small>3</small></a>
10748  The cimag functions return the imaginary part value (as a real).
10749
10750 <p><b>Footnotes</b>
10751 <p><small><a name="note196" href="#note196">196)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
10752 </small>
10753
10754 <p><small><a href="#Contents">Contents</a></small>
10755 <h5><a name="7.3.9.3" href="#7.3.9.3">7.3.9.3 The CMPLX macros</a></h5>
10756 <p><b>Synopsis</b>
10757 <p><a name="7.3.9.3p1" href="#7.3.9.3p1"><small>1</small></a>
10758 <pre>
10759          #include <a href="#7.3">&lt;complex.h&gt;</a>
10760          double complex CMPLX(double x, double y);
10761          float complex CMPLXF(float x, float y);
10762          long double complex CMPLXL(long double x, long double y);
10763 </pre>
10764 <p><b>Description</b>
10765 <p><a name="7.3.9.3p2" href="#7.3.9.3p2"><small>2</small></a>
10766  The CMPLX macros expand to an expression of the specified complex type, with the real
10767  part having the (converted) value of x and the imaginary part having the (converted)
10768  value of y. The resulting expression shall be suitable for use as an initializer for an object
10769  with static or thread storage duration, provided both arguments are likewise suitable.
10770 <p><b>Returns</b>
10771 <p><a name="7.3.9.3p3" href="#7.3.9.3p3"><small>3</small></a>
10772  The CMPLX macros return the complex value x + i y.
10773 <p><a name="7.3.9.3p4" href="#7.3.9.3p4"><small>4</small></a>
10774  NOTE    These macros act as if the implementation supported imaginary types and the definitions were:
10775 <pre>
10776       #define CMPLX(x, y)  ((double complex)((double)(x) + \
10777                                     _Imaginary_I * (double)(y)))
10778       #define CMPLXF(x, y) ((float complex)((float)(x) + \
10779                                     _Imaginary_I * (float)(y)))
10780       #define CMPLXL(x, y) ((long double complex)((long double)(x) + \
10781                                     _Imaginary_I * (long double)(y)))
10782 </pre>
10783  
10784  
10785  
10786  
10787 <!--page 216 -->
10788
10789 <p><small><a href="#Contents">Contents</a></small>
10790 <h5><a name="7.3.9.4" href="#7.3.9.4">7.3.9.4 The conj functions</a></h5>
10791 <p><b>Synopsis</b>
10792 <p><a name="7.3.9.4p1" href="#7.3.9.4p1"><small>1</small></a>
10793 <pre>
10794         #include <a href="#7.3">&lt;complex.h&gt;</a>
10795         double complex conj(double complex z);
10796         float complex conjf(float complex z);
10797         long double complex conjl(long double complex z);
10798 </pre>
10799 <p><b>Description</b>
10800 <p><a name="7.3.9.4p2" href="#7.3.9.4p2"><small>2</small></a>
10801  The conj functions compute the complex conjugate of z, by reversing the sign of its
10802  imaginary part.
10803 <p><b>Returns</b>
10804 <p><a name="7.3.9.4p3" href="#7.3.9.4p3"><small>3</small></a>
10805  The conj functions return the complex conjugate value.
10806
10807 <p><small><a href="#Contents">Contents</a></small>
10808 <h5><a name="7.3.9.5" href="#7.3.9.5">7.3.9.5 The cproj functions</a></h5>
10809 <p><b>Synopsis</b>
10810 <p><a name="7.3.9.5p1" href="#7.3.9.5p1"><small>1</small></a>
10811 <pre>
10812         #include <a href="#7.3">&lt;complex.h&gt;</a>
10813         double complex cproj(double complex z);
10814         float complex cprojf(float complex z);
10815         long double complex cprojl(long double complex z);
10816 </pre>
10817 <p><b>Description</b>
10818 <p><a name="7.3.9.5p2" href="#7.3.9.5p2"><small>2</small></a>
10819  The cproj functions compute a projection of z onto the Riemann sphere: z projects to
10820  z except that all complex infinities (even those with one infinite part and one NaN part)
10821  project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
10822  equivalent to
10823 <pre>
10824         INFINITY + I * copysign(0.0, cimag(z))
10825 </pre>
10826 <p><b>Returns</b>
10827 <p><a name="7.3.9.5p3" href="#7.3.9.5p3"><small>3</small></a>
10828  The cproj functions return the value of the projection onto the Riemann sphere.
10829
10830 <p><small><a href="#Contents">Contents</a></small>
10831 <h5><a name="7.3.9.6" href="#7.3.9.6">7.3.9.6 The creal functions</a></h5>
10832 <p><b>Synopsis</b>
10833 <p><a name="7.3.9.6p1" href="#7.3.9.6p1"><small>1</small></a>
10834 <pre>
10835         #include <a href="#7.3">&lt;complex.h&gt;</a>
10836         double creal(double complex z);
10837         float crealf(float complex z);
10838         long double creall(long double complex z);
10839 </pre>
10840 <p><b>Description</b>
10841 <p><a name="7.3.9.6p2" href="#7.3.9.6p2"><small>2</small></a>
10842  The creal functions compute the real part of z.<sup><a href="#note197"><b>197)</b></a></sup>
10843 <!--page 217 -->
10844 <p><b>Returns</b>
10845 <p><a name="7.3.9.6p3" href="#7.3.9.6p3"><small>3</small></a>
10846  The creal functions return the real part value.
10847  
10848  
10849  
10850  
10851 <!--page 218 -->
10852
10853 <p><b>Footnotes</b>
10854 <p><small><a name="note197" href="#note197">197)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
10855 </small>
10856
10857 <p><small><a href="#Contents">Contents</a></small>
10858 <h3><a name="7.4" href="#7.4">7.4 Character handling &lt;ctype.h&gt;</a></h3>
10859 <p><a name="7.4p1" href="#7.4p1"><small>1</small></a>
10860  The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
10861  characters.<sup><a href="#note198"><b>198)</b></a></sup> In all cases the argument is an int, the value of which shall be
10862  representable as an unsigned char or shall equal the value of the macro EOF. If the
10863  argument has any other value, the behavior is undefined.
10864 <p><a name="7.4p2" href="#7.4p2"><small>2</small></a>
10865  The behavior of these functions is affected by the current locale. Those functions that
10866  have locale-specific aspects only when not in the "C" locale are noted below.
10867 <p><a name="7.4p3" href="#7.4p3"><small>3</small></a>
10868  The term printing character refers to a member of a locale-specific set of characters, each
10869  of which occupies one printing position on a display device; the term control character
10870  refers to a member of a locale-specific set of characters that are not printing
10871  characters.<sup><a href="#note199"><b>199)</b></a></sup> All letters and digits are printing characters.
10872 <p><b> Forward references</b>: EOF (<a href="#7.21.1">7.21.1</a>), localization (<a href="#7.11">7.11</a>).
10873
10874 <p><b>Footnotes</b>
10875 <p><small><a name="note198" href="#note198">198)</a> See ''future library directions'' (<a href="#7.31.2">7.31.2</a>).
10876 </small>
10877 <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
10878  whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
10879  values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
10880 </small>
10881
10882 <p><small><a href="#Contents">Contents</a></small>
10883 <h4><a name="7.4.1" href="#7.4.1">7.4.1 Character classification functions</a></h4>
10884 <p><a name="7.4.1p1" href="#7.4.1p1"><small>1</small></a>
10885  The functions in this subclause return nonzero (true) if and only if the value of the
10886  argument c conforms to that in the description of the function.
10887
10888 <p><small><a href="#Contents">Contents</a></small>
10889 <h5><a name="7.4.1.1" href="#7.4.1.1">7.4.1.1 The isalnum function</a></h5>
10890 <p><b>Synopsis</b>
10891 <p><a name="7.4.1.1p1" href="#7.4.1.1p1"><small>1</small></a>
10892 <pre>
10893           #include <a href="#7.4">&lt;ctype.h&gt;</a>
10894           int isalnum(int c);
10895 </pre>
10896 <p><b>Description</b>
10897 <p><a name="7.4.1.1p2" href="#7.4.1.1p2"><small>2</small></a>
10898  The isalnum function tests for any character for which isalpha or isdigit is true.
10899
10900 <p><small><a href="#Contents">Contents</a></small>
10901 <h5><a name="7.4.1.2" href="#7.4.1.2">7.4.1.2 The isalpha function</a></h5>
10902 <p><b>Synopsis</b>
10903 <p><a name="7.4.1.2p1" href="#7.4.1.2p1"><small>1</small></a>
10904 <pre>
10905           #include <a href="#7.4">&lt;ctype.h&gt;</a>
10906           int isalpha(int c);
10907 </pre>
10908 <p><b>Description</b>
10909 <p><a name="7.4.1.2p2" href="#7.4.1.2p2"><small>2</small></a>
10910  The isalpha function tests for any character for which isupper or islower is true,
10911  or any character that is one of a locale-specific set of alphabetic characters for which
10912  
10913  
10914  
10915 <!--page 219 -->
10916  none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note200"><b>200)</b></a></sup> In the "C" locale,
10917  isalpha returns true only for the characters for which isupper or islower is true.
10918
10919 <p><b>Footnotes</b>
10920 <p><small><a name="note200" href="#note200">200)</a> The functions islower and isupper test true or false separately for each of these additional
10921  characters; all four combinations are possible.
10922 </small>
10923
10924 <p><small><a href="#Contents">Contents</a></small>
10925 <h5><a name="7.4.1.3" href="#7.4.1.3">7.4.1.3 The isblank function</a></h5>
10926 <p><b>Synopsis</b>
10927 <p><a name="7.4.1.3p1" href="#7.4.1.3p1"><small>1</small></a>
10928 <pre>
10929          #include <a href="#7.4">&lt;ctype.h&gt;</a>
10930          int isblank(int c);
10931 </pre>
10932 <p><b>Description</b>
10933 <p><a name="7.4.1.3p2" href="#7.4.1.3p2"><small>2</small></a>
10934  The isblank function tests for any character that is a standard blank character or is one
10935  of a locale-specific set of characters for which isspace is true and that is used to
10936  separate words within a line of text. The standard blank characters are the following:
10937  space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
10938  for the standard blank characters.
10939
10940 <p><small><a href="#Contents">Contents</a></small>
10941 <h5><a name="7.4.1.4" href="#7.4.1.4">7.4.1.4 The iscntrl function</a></h5>
10942 <p><b>Synopsis</b>
10943 <p><a name="7.4.1.4p1" href="#7.4.1.4p1"><small>1</small></a>
10944 <pre>
10945          #include <a href="#7.4">&lt;ctype.h&gt;</a>
10946          int iscntrl(int c);
10947 </pre>
10948 <p><b>Description</b>
10949 <p><a name="7.4.1.4p2" href="#7.4.1.4p2"><small>2</small></a>
10950  The iscntrl function tests for any control character.
10951
10952 <p><small><a href="#Contents">Contents</a></small>
10953 <h5><a name="7.4.1.5" href="#7.4.1.5">7.4.1.5 The isdigit function</a></h5>
10954 <p><b>Synopsis</b>
10955 <p><a name="7.4.1.5p1" href="#7.4.1.5p1"><small>1</small></a>
10956 <pre>
10957          #include <a href="#7.4">&lt;ctype.h&gt;</a>
10958          int isdigit(int c);
10959 </pre>
10960 <p><b>Description</b>
10961 <p><a name="7.4.1.5p2" href="#7.4.1.5p2"><small>2</small></a>
10962  The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
10963
10964 <p><small><a href="#Contents">Contents</a></small>
10965 <h5><a name="7.4.1.6" href="#7.4.1.6">7.4.1.6 The isgraph function</a></h5>
10966 <p><b>Synopsis</b>
10967 <p><a name="7.4.1.6p1" href="#7.4.1.6p1"><small>1</small></a>
10968 <pre>
10969          #include <a href="#7.4">&lt;ctype.h&gt;</a>
10970          int isgraph(int c);
10971 </pre>
10972  
10973  
10974  
10975  
10976 <!--page 220 -->
10977 <p><b>Description</b>
10978 <p><a name="7.4.1.6p2" href="#7.4.1.6p2"><small>2</small></a>
10979  The isgraph function tests for any printing character except space (' ').
10980
10981 <p><small><a href="#Contents">Contents</a></small>
10982 <h5><a name="7.4.1.7" href="#7.4.1.7">7.4.1.7 The islower function</a></h5>
10983 <p><b>Synopsis</b>
10984 <p><a name="7.4.1.7p1" href="#7.4.1.7p1"><small>1</small></a>
10985 <pre>
10986         #include <a href="#7.4">&lt;ctype.h&gt;</a>
10987         int islower(int c);
10988 </pre>
10989 <p><b>Description</b>
10990 <p><a name="7.4.1.7p2" href="#7.4.1.7p2"><small>2</small></a>
10991  The islower function tests for any character that is a lowercase letter or is one of a
10992  locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
10993  isspace is true. In the "C" locale, islower returns true only for the lowercase
10994  letters (as defined in <a href="#5.2.1">5.2.1</a>).
10995
10996 <p><small><a href="#Contents">Contents</a></small>
10997 <h5><a name="7.4.1.8" href="#7.4.1.8">7.4.1.8 The isprint function</a></h5>
10998 <p><b>Synopsis</b>
10999 <p><a name="7.4.1.8p1" href="#7.4.1.8p1"><small>1</small></a>
11000 <pre>
11001         #include <a href="#7.4">&lt;ctype.h&gt;</a>
11002         int isprint(int c);
11003 </pre>
11004 <p><b>Description</b>
11005 <p><a name="7.4.1.8p2" href="#7.4.1.8p2"><small>2</small></a>
11006  The isprint function tests for any printing character including space (' ').
11007
11008 <p><small><a href="#Contents">Contents</a></small>
11009 <h5><a name="7.4.1.9" href="#7.4.1.9">7.4.1.9 The ispunct function</a></h5>
11010 <p><b>Synopsis</b>
11011 <p><a name="7.4.1.9p1" href="#7.4.1.9p1"><small>1</small></a>
11012 <pre>
11013         #include <a href="#7.4">&lt;ctype.h&gt;</a>
11014         int ispunct(int c);
11015 </pre>
11016 <p><b>Description</b>
11017 <p><a name="7.4.1.9p2" href="#7.4.1.9p2"><small>2</small></a>
11018  The ispunct function tests for any printing character that is one of a locale-specific set
11019  of punctuation characters for which neither isspace nor isalnum is true. In the "C"
11020  locale, ispunct returns true for every printing character for which neither isspace
11021  nor isalnum is true.
11022
11023 <p><small><a href="#Contents">Contents</a></small>
11024 <h5><a name="7.4.1.10" href="#7.4.1.10">7.4.1.10 The isspace function</a></h5>
11025 <p><b>Synopsis</b>
11026 <p><a name="7.4.1.10p1" href="#7.4.1.10p1"><small>1</small></a>
11027 <pre>
11028         #include <a href="#7.4">&lt;ctype.h&gt;</a>
11029         int isspace(int c);
11030 </pre>
11031 <p><b>Description</b>
11032 <p><a name="7.4.1.10p2" href="#7.4.1.10p2"><small>2</small></a>
11033  The isspace function tests for any character that is a standard white-space character or
11034  is one of a locale-specific set of characters for which isalnum is false. The standard
11035 <!--page 221 -->
11036  white-space characters are the following: space (' '), form feed ('\f'), new-line
11037  ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
11038  "C" locale, isspace returns true only for the standard white-space characters.
11039
11040 <p><small><a href="#Contents">Contents</a></small>
11041 <h5><a name="7.4.1.11" href="#7.4.1.11">7.4.1.11 The isupper function</a></h5>
11042 <p><b>Synopsis</b>
11043 <p><a name="7.4.1.11p1" href="#7.4.1.11p1"><small>1</small></a>
11044 <pre>
11045          #include <a href="#7.4">&lt;ctype.h&gt;</a>
11046          int isupper(int c);
11047 </pre>
11048 <p><b>Description</b>
11049 <p><a name="7.4.1.11p2" href="#7.4.1.11p2"><small>2</small></a>
11050  The isupper function tests for any character that is an uppercase letter or is one of a
11051  locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
11052  isspace is true. In the "C" locale, isupper returns true only for the uppercase
11053  letters (as defined in <a href="#5.2.1">5.2.1</a>).
11054
11055 <p><small><a href="#Contents">Contents</a></small>
11056 <h5><a name="7.4.1.12" href="#7.4.1.12">7.4.1.12 The isxdigit function</a></h5>
11057 <p><b>Synopsis</b>
11058 <p><a name="7.4.1.12p1" href="#7.4.1.12p1"><small>1</small></a>
11059 <pre>
11060          #include <a href="#7.4">&lt;ctype.h&gt;</a>
11061          int isxdigit(int c);
11062 </pre>
11063 <p><b>Description</b>
11064 <p><a name="7.4.1.12p2" href="#7.4.1.12p2"><small>2</small></a>
11065  The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
11066
11067 <p><small><a href="#Contents">Contents</a></small>
11068 <h4><a name="7.4.2" href="#7.4.2">7.4.2 Character case mapping functions</a></h4>
11069
11070 <p><small><a href="#Contents">Contents</a></small>
11071 <h5><a name="7.4.2.1" href="#7.4.2.1">7.4.2.1 The tolower function</a></h5>
11072 <p><b>Synopsis</b>
11073 <p><a name="7.4.2.1p1" href="#7.4.2.1p1"><small>1</small></a>
11074 <pre>
11075          #include <a href="#7.4">&lt;ctype.h&gt;</a>
11076          int tolower(int c);
11077 </pre>
11078 <p><b>Description</b>
11079 <p><a name="7.4.2.1p2" href="#7.4.2.1p2"><small>2</small></a>
11080  The tolower function converts an uppercase letter to a corresponding lowercase letter.
11081 <p><b>Returns</b>
11082 <p><a name="7.4.2.1p3" href="#7.4.2.1p3"><small>3</small></a>
11083  If the argument is a character for which isupper is true and there are one or more
11084  corresponding characters, as specified by the current locale, for which islower is true,
11085  the tolower function returns one of the corresponding characters (always the same one
11086  for any given locale); otherwise, the argument is returned unchanged.
11087 <!--page 222 -->
11088
11089 <p><small><a href="#Contents">Contents</a></small>
11090 <h5><a name="7.4.2.2" href="#7.4.2.2">7.4.2.2 The toupper function</a></h5>
11091 <p><b>Synopsis</b>
11092 <p><a name="7.4.2.2p1" href="#7.4.2.2p1"><small>1</small></a>
11093 <pre>
11094         #include <a href="#7.4">&lt;ctype.h&gt;</a>
11095         int toupper(int c);
11096 </pre>
11097 <p><b>Description</b>
11098 <p><a name="7.4.2.2p2" href="#7.4.2.2p2"><small>2</small></a>
11099  The toupper function converts a lowercase letter to a corresponding uppercase letter.
11100 <p><b>Returns</b>
11101 <p><a name="7.4.2.2p3" href="#7.4.2.2p3"><small>3</small></a>
11102  If the argument is a character for which islower is true and there are one or more
11103  corresponding characters, as specified by the current locale, for which isupper is true,
11104  the toupper function returns one of the corresponding characters (always the same one
11105  for any given locale); otherwise, the argument is returned unchanged.
11106 <!--page 223 -->
11107
11108 <p><small><a href="#Contents">Contents</a></small>
11109 <h3><a name="7.5" href="#7.5">7.5 Errors &lt;errno.h&gt;</a></h3>
11110 <p><a name="7.5p1" href="#7.5p1"><small>1</small></a>
11111  The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
11112  conditions.
11113 <p><a name="7.5p2" href="#7.5p2"><small>2</small></a>
11114  The macros are
11115 <pre>
11116           EDOM
11117           EILSEQ
11118           ERANGE
11119 </pre>
11120  which expand to integer constant expressions with type int, distinct positive values, and
11121  which are suitable for use in #if preprocessing directives; and
11122 <pre>
11123           errno
11124 </pre>
11125  which expands to a modifiable lvalue<sup><a href="#note201"><b>201)</b></a></sup> that has type int and thread local storage
11126  duration, the value of which is set to a positive error number by several library functions.
11127  If a macro definition is suppressed in order to access an actual object, or a program
11128  defines an identifier with the name errno, the behavior is undefined.
11129 <p><a name="7.5p3" href="#7.5p3"><small>3</small></a>
11130  The value of errno in the initial thread is zero at program startup (the initial value of
11131  errno in other threads is an indeterminate value), but is never set to zero by any library
11132  function.<sup><a href="#note202"><b>202)</b></a></sup> The value of errno may be set to nonzero by a library function call
11133  whether or not there is an error, provided the use of errno is not documented in the
11134  description of the function in this International Standard.
11135 <p><a name="7.5p4" href="#7.5p4"><small>4</small></a>
11136  Additional macro definitions, beginning with E and a digit or E and an uppercase
11137  letter,<sup><a href="#note203"><b>203)</b></a></sup> may also be specified by the implementation.
11138  
11139  
11140  
11141  
11142 <!--page 224 -->
11143
11144 <p><b>Footnotes</b>
11145 <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
11146  resulting from a function call (for example, *errno()).
11147 </small>
11148 <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,
11149  then inspect it before a subsequent library function call. Of course, a library function can save the
11150  value of errno on entry and then set it to zero, as long as the original value is restored if errno's
11151  value is still zero just before the return.
11152 </small>
11153 <p><small><a name="note203" href="#note203">203)</a> See ''future library directions'' (<a href="#7.31.3">7.31.3</a>).
11154 </small>
11155
11156 <p><small><a href="#Contents">Contents</a></small>
11157 <h3><a name="7.6" href="#7.6">7.6 Floating-point environment &lt;fenv.h&gt;</a></h3>
11158 <p><a name="7.6p1" href="#7.6p1"><small>1</small></a>
11159  The header <a href="#7.6">&lt;fenv.h&gt;</a> defines several macros, and declares types and functions that
11160  provide access to the floating-point environment. The floating-point environment refers
11161  collectively to any floating-point status flags and control modes supported by the
11162  implementation.<sup><a href="#note204"><b>204)</b></a></sup> A floating-point status flag is a system variable whose value is set
11163  (but never cleared) when a floating-point exception is raised, which occurs as a side effect
11164  of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note205"><b>205)</b></a></sup> A floating-
11165  point control mode is a system variable whose value may be set by the user to affect the
11166  subsequent behavior of floating-point arithmetic.
11167 <p><a name="7.6p2" href="#7.6p2"><small>2</small></a>
11168  The floating-point environment has thread storage duration. The initial state for a
11169  thread's floating-point environment is the current state of the floating-point environment
11170  of the thread that creates it at the time of creation.
11171 <p><a name="7.6p3" href="#7.6p3"><small>3</small></a>
11172  Certain programming conventions support the intended model of use for the floating-
11173  point environment:<sup><a href="#note206"><b>206)</b></a></sup>
11174 <ul>
11175 <li>  a function call does not alter its caller's floating-point control modes, clear its caller's
11176  floating-point status flags, nor depend on the state of its caller's floating-point status
11177  flags unless the function is so documented;
11178 <li>  a function call is assumed to require default floating-point control modes, unless its
11179  documentation promises otherwise;
11180 <li>  a function call is assumed to have the potential for raising floating-point exceptions,
11181  unless its documentation promises otherwise.
11182 </ul>
11183 <p><a name="7.6p4" href="#7.6p4"><small>4</small></a>
11184  The type
11185 <pre>
11186          fenv_t
11187 </pre>
11188  represents the entire floating-point environment.
11189 <p><a name="7.6p5" href="#7.6p5"><small>5</small></a>
11190  The type
11191 <pre>
11192          fexcept_t
11193 </pre>
11194  represents the floating-point status flags collectively, including any status the
11195  implementation associates with the flags.
11196  
11197  
11198 <!--page 225 -->
11199 <p><a name="7.6p6" href="#7.6p6"><small>6</small></a>
11200  Each of the macros
11201 <pre>
11202           FE_DIVBYZERO
11203           FE_INEXACT
11204           FE_INVALID
11205           FE_OVERFLOW
11206           FE_UNDERFLOW
11207 </pre>
11208  is defined if and only if the implementation supports the floating-point exception by
11209  means of the functions in 7.6.2.<sup><a href="#note207"><b>207)</b></a></sup> Additional implementation-defined floating-point
11210  exceptions, with macro definitions beginning with FE_ and an uppercase letter,<sup><a href="#note208"><b>208)</b></a></sup> may
11211  also be specified by the implementation. The defined macros expand to integer constant
11212  expressions with values such that bitwise ORs of all combinations of the macros result in
11213  distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
11214  zero.<sup><a href="#note209"><b>209)</b></a></sup>
11215 <p><a name="7.6p7" href="#7.6p7"><small>7</small></a>
11216  The macro
11217 <pre>
11218           FE_ALL_EXCEPT
11219 </pre>
11220  is simply the bitwise OR of all floating-point exception macros defined by the
11221  implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
11222 <p><a name="7.6p8" href="#7.6p8"><small>8</small></a>
11223  Each of the macros
11224 <pre>
11225           FE_DOWNWARD
11226           FE_TONEAREST
11227           FE_TOWARDZERO
11228           FE_UPWARD
11229 </pre>
11230  is defined if and only if the implementation supports getting and setting the represented
11231  rounding direction by means of the fegetround and fesetround functions.
11232  Additional implementation-defined rounding directions, with macro definitions beginning
11233  with FE_ and an uppercase letter,<sup><a href="#note210"><b>210)</b></a></sup> may also be specified by the implementation. The
11234  defined macros expand to integer constant expressions whose values are distinct
11235  nonnegative values.<sup><a href="#note211"><b>211)</b></a></sup>
11236  
11237  
11238 <!--page 226 -->
11239 <p><a name="7.6p9" href="#7.6p9"><small>9</small></a>
11240  The macro
11241 <pre>
11242           FE_DFL_ENV
11243 </pre>
11244  represents the default floating-point environment -- the one installed at program startup
11245 <ul>
11246 <li>  and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
11247 </ul>
11248  <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
11249 <p><a name="7.6p10" href="#7.6p10"><small>10</small></a>
11250  Additional implementation-defined environments, with macro definitions beginning with
11251  FE_ and an uppercase letter,<sup><a href="#note212"><b>212)</b></a></sup> and having type ''pointer to const-qualified fenv_t'',
11252  may also be specified by the implementation.
11253
11254 <p><b>Footnotes</b>
11255 <p><small><a name="note204" href="#note204">204)</a> This header is designed to support the floating-point exception status flags and directed-rounding
11256  control modes required by IEC 60559, and other similar floating-point state information. It is also
11257  designed to facilitate code portability among all systems.
11258 </small>
11259 <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.
11260 </small>
11261 <p><small><a name="note206" href="#note206">206)</a> With these conventions, a programmer can safely assume default floating-point control modes (or be
11262  unaware of them). The responsibilities associated with accessing the floating-point environment fall
11263  on the programmer or program that does so explicitly.
11264 </small>
11265 <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
11266  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
11267  necessary for all the functions to succeed all the time.
11268 </small>
11269 <p><small><a name="note208" href="#note208">208)</a> See ''future library directions'' (<a href="#7.31.4">7.31.4</a>).
11270 </small>
11271 <p><small><a name="note209" href="#note209">209)</a> The macros should be distinct powers of two.
11272 </small>
11273 <p><small><a name="note210" href="#note210">210)</a> See ''future library directions'' (<a href="#7.31.4">7.31.4</a>).
11274 </small>
11275 <p><small><a name="note211" href="#note211">211)</a> Even though the rounding direction macros may expand to constants corresponding to the values of
11276  FLT_ROUNDS, they are not required to do so.
11277 </small>
11278 <p><small><a name="note212" href="#note212">212)</a> See ''future library directions'' (<a href="#7.31.4">7.31.4</a>).
11279 </small>
11280
11281 <p><small><a href="#Contents">Contents</a></small>
11282 <h4><a name="7.6.1" href="#7.6.1">7.6.1 The FENV_ACCESS pragma</a></h4>
11283 <p><b>Synopsis</b>
11284 <p><a name="7.6.1p1" href="#7.6.1p1"><small>1</small></a>
11285 <pre>
11286           #include <a href="#7.6">&lt;fenv.h&gt;</a>
11287           #pragma STDC FENV_ACCESS on-off-switch
11288 </pre>
11289 <p><b>Description</b>
11290 <p><a name="7.6.1p2" href="#7.6.1p2"><small>2</small></a>
11291  The FENV_ACCESS pragma provides a means to inform the implementation when a
11292  program might access the floating-point environment to test floating-point status flags or
11293  run under non-default floating-point control modes.<sup><a href="#note213"><b>213)</b></a></sup> The pragma shall occur either
11294  outside external declarations or preceding all explicit declarations and statements inside a
11295  compound statement. When outside external declarations, the pragma takes effect from
11296  its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
11297  the translation unit. When inside a compound statement, the pragma takes effect from its
11298  occurrence until another FENV_ACCESS pragma is encountered (including within a
11299  nested compound statement), or until the end of the compound statement; at the end of a
11300  compound statement the state for the pragma is restored to its condition just before the
11301  compound statement. If this pragma is used in any other context, the behavior is
11302  undefined. If part of a program tests floating-point status flags, sets floating-point control
11303  modes, or runs under non-default mode settings, but was translated with the state for the
11304  FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
11305  ''off'') for the pragma is implementation-defined. (When execution passes from a part of
11306  the program translated with FENV_ACCESS ''off'' to a part translated with
11307  FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
11308  floating-point control modes have their default settings.)
11309  
11310  
11311  
11312 <!--page 227 -->
11313 <p><a name="7.6.1p3" href="#7.6.1p3"><small>3</small></a>
11314  EXAMPLE
11315 <pre>
11316          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11317          void f(double x)
11318          {
11319                #pragma STDC FENV_ACCESS ON
11320                void g(double);
11321                void h(double);
11322                /* ... */
11323                g(x + 1);
11324                h(x + 1);
11325                /* ... */
11326          }
11327 </pre>
11328 <p><a name="7.6.1p4" href="#7.6.1p4"><small>4</small></a>
11329  If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
11330  x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
11331  contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note214"><b>214)</b></a></sup>
11332  
11333
11334 <p><b>Footnotes</b>
11335 <p><small><a name="note213" href="#note213">213)</a> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
11336  tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
11337  folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
11338  modes are in effect and the flags are not tested.
11339 </small>
11340 <p><small><a name="note214" href="#note214">214)</a> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
11341  hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
11342  ''off'', just one evaluation of x + 1 would suffice.
11343 </small>
11344
11345 <p><small><a href="#Contents">Contents</a></small>
11346 <h4><a name="7.6.2" href="#7.6.2">7.6.2 Floating-point exceptions</a></h4>
11347 <p><a name="7.6.2p1" href="#7.6.2p1"><small>1</small></a>
11348  The following functions provide access to the floating-point status flags.<sup><a href="#note215"><b>215)</b></a></sup> The int
11349  input argument for the functions represents a subset of floating-point exceptions, and can
11350  be zero or the bitwise OR of one or more floating-point exception macros, for example
11351  FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
11352  functions is undefined.
11353
11354 <p><b>Footnotes</b>
11355 <p><small><a name="note215" href="#note215">215)</a> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
11356  abstraction of flags that are either set or clear. An implementation may endow floating-point status
11357  flags with more information -- for example, the address of the code which first raised the floating-
11358  point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
11359  content of flags.
11360 </small>
11361
11362 <p><small><a href="#Contents">Contents</a></small>
11363 <h5><a name="7.6.2.1" href="#7.6.2.1">7.6.2.1 The feclearexcept function</a></h5>
11364 <p><b>Synopsis</b>
11365 <p><a name="7.6.2.1p1" href="#7.6.2.1p1"><small>1</small></a>
11366 <pre>
11367          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11368          int feclearexcept(int excepts);
11369 </pre>
11370 <p><b>Description</b>
11371 <p><a name="7.6.2.1p2" href="#7.6.2.1p2"><small>2</small></a>
11372  The feclearexcept function attempts to clear the supported floating-point exceptions
11373  represented by its argument.
11374 <p><b>Returns</b>
11375 <p><a name="7.6.2.1p3" href="#7.6.2.1p3"><small>3</small></a>
11376  The feclearexcept function returns zero if the excepts argument is zero or if all
11377  the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
11378  
11379  
11380 <!--page 228 -->
11381
11382 <p><small><a href="#Contents">Contents</a></small>
11383 <h5><a name="7.6.2.2" href="#7.6.2.2">7.6.2.2 The fegetexceptflag function</a></h5>
11384 <p><b>Synopsis</b>
11385 <p><a name="7.6.2.2p1" href="#7.6.2.2p1"><small>1</small></a>
11386 <pre>
11387           #include <a href="#7.6">&lt;fenv.h&gt;</a>
11388           int fegetexceptflag(fexcept_t *flagp,
11389                int excepts);
11390 </pre>
11391 <p><b>Description</b>
11392 <p><a name="7.6.2.2p2" href="#7.6.2.2p2"><small>2</small></a>
11393  The fegetexceptflag function attempts to store an implementation-defined
11394  representation of the states of the floating-point status flags indicated by the argument
11395  excepts in the object pointed to by the argument flagp.
11396 <p><b>Returns</b>
11397 <p><a name="7.6.2.2p3" href="#7.6.2.2p3"><small>3</small></a>
11398  The fegetexceptflag function returns zero if the representation was successfully
11399  stored. Otherwise, it returns a nonzero value.
11400
11401 <p><small><a href="#Contents">Contents</a></small>
11402 <h5><a name="7.6.2.3" href="#7.6.2.3">7.6.2.3 The feraiseexcept function</a></h5>
11403 <p><b>Synopsis</b>
11404 <p><a name="7.6.2.3p1" href="#7.6.2.3p1"><small>1</small></a>
11405 <pre>
11406           #include <a href="#7.6">&lt;fenv.h&gt;</a>
11407           int feraiseexcept(int excepts);
11408 </pre>
11409 <p><b>Description</b>
11410 <p><a name="7.6.2.3p2" href="#7.6.2.3p2"><small>2</small></a>
11411  The feraiseexcept function attempts to raise the supported floating-point exceptions
11412  represented by its argument.<sup><a href="#note216"><b>216)</b></a></sup> The order in which these floating-point exceptions are
11413  raised is unspecified, except as stated in <a href="#F.8.6">F.8.6</a>. Whether the feraiseexcept function
11414  additionally raises the ''inexact'' floating-point exception whenever it raises the
11415  ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
11416 <p><b>Returns</b>
11417 <p><a name="7.6.2.3p3" href="#7.6.2.3p3"><small>3</small></a>
11418  The feraiseexcept function returns zero if the excepts argument is zero or if all
11419  the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
11420  
11421  
11422  
11423  
11424 <!--page 229 -->
11425
11426 <p><b>Footnotes</b>
11427 <p><small><a name="note216" href="#note216">216)</a> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
11428  Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
11429  in <a href="#F.8.6">F.8.6</a> is in the same spirit.
11430 </small>
11431
11432 <p><small><a href="#Contents">Contents</a></small>
11433 <h5><a name="7.6.2.4" href="#7.6.2.4">7.6.2.4 The fesetexceptflag function</a></h5>
11434 <p><b>Synopsis</b>
11435 <p><a name="7.6.2.4p1" href="#7.6.2.4p1"><small>1</small></a>
11436 <pre>
11437          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11438          int fesetexceptflag(const fexcept_t *flagp,
11439               int excepts);
11440 </pre>
11441 <p><b>Description</b>
11442 <p><a name="7.6.2.4p2" href="#7.6.2.4p2"><small>2</small></a>
11443  The fesetexceptflag function attempts to set the floating-point status flags
11444  indicated by the argument excepts to the states stored in the object pointed to by
11445  flagp. The value of *flagp shall have been set by a previous call to
11446  fegetexceptflag whose second argument represented at least those floating-point
11447  exceptions represented by the argument excepts. This function does not raise floating-
11448  point exceptions, but only sets the state of the flags.
11449 <p><b>Returns</b>
11450 <p><a name="7.6.2.4p3" href="#7.6.2.4p3"><small>3</small></a>
11451  The fesetexceptflag function returns zero if the excepts argument is zero or if
11452  all the specified flags were successfully set to the appropriate state. Otherwise, it returns
11453  a nonzero value.
11454
11455 <p><small><a href="#Contents">Contents</a></small>
11456 <h5><a name="7.6.2.5" href="#7.6.2.5">7.6.2.5 The fetestexcept function</a></h5>
11457 <p><b>Synopsis</b>
11458 <p><a name="7.6.2.5p1" href="#7.6.2.5p1"><small>1</small></a>
11459 <pre>
11460          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11461          int fetestexcept(int excepts);
11462 </pre>
11463 <p><b>Description</b>
11464 <p><a name="7.6.2.5p2" href="#7.6.2.5p2"><small>2</small></a>
11465  The fetestexcept function determines which of a specified subset of the floating-
11466  point exception flags are currently set. The excepts argument specifies the floating-
11467  point status flags to be queried.<sup><a href="#note217"><b>217)</b></a></sup>
11468 <p><b>Returns</b>
11469 <p><a name="7.6.2.5p3" href="#7.6.2.5p3"><small>3</small></a>
11470  The fetestexcept function returns the value of the bitwise OR of the floating-point
11471  exception macros corresponding to the currently set floating-point exceptions included in
11472  excepts.
11473 <p><a name="7.6.2.5p4" href="#7.6.2.5p4"><small>4</small></a>
11474  EXAMPLE       Call f if ''invalid'' is set, then g if ''overflow'' is set:
11475  
11476  
11477  
11478  
11479 <!--page 230 -->
11480 <pre>
11481         #include <a href="#7.6">&lt;fenv.h&gt;</a>
11482         /* ... */
11483         {
11484                 #pragma STDC FENV_ACCESS ON
11485                 int set_excepts;
11486                 feclearexcept(FE_INVALID | FE_OVERFLOW);
11487                 // maybe raise exceptions
11488                 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
11489                 if (set_excepts &amp; FE_INVALID) f();
11490                 if (set_excepts &amp; FE_OVERFLOW) g();
11491                 /* ... */
11492         }
11493 </pre>
11494  
11495
11496 <p><b>Footnotes</b>
11497 <p><small><a name="note217" href="#note217">217)</a> This mechanism allows testing several floating-point exceptions with just one function call.
11498 </small>
11499
11500 <p><small><a href="#Contents">Contents</a></small>
11501 <h4><a name="7.6.3" href="#7.6.3">7.6.3 Rounding</a></h4>
11502 <p><a name="7.6.3p1" href="#7.6.3p1"><small>1</small></a>
11503  The fegetround and fesetround functions provide control of rounding direction
11504  modes.
11505
11506 <p><small><a href="#Contents">Contents</a></small>
11507 <h5><a name="7.6.3.1" href="#7.6.3.1">7.6.3.1 The fegetround function</a></h5>
11508 <p><b>Synopsis</b>
11509 <p><a name="7.6.3.1p1" href="#7.6.3.1p1"><small>1</small></a>
11510 <pre>
11511         #include <a href="#7.6">&lt;fenv.h&gt;</a>
11512         int fegetround(void);
11513 </pre>
11514 <p><b>Description</b>
11515 <p><a name="7.6.3.1p2" href="#7.6.3.1p2"><small>2</small></a>
11516  The fegetround function gets the current rounding direction.
11517 <p><b>Returns</b>
11518 <p><a name="7.6.3.1p3" href="#7.6.3.1p3"><small>3</small></a>
11519  The fegetround function returns the value of the rounding direction macro
11520  representing the current rounding direction or a negative value if there is no such
11521  rounding direction macro or the current rounding direction is not determinable.
11522
11523 <p><small><a href="#Contents">Contents</a></small>
11524 <h5><a name="7.6.3.2" href="#7.6.3.2">7.6.3.2 The fesetround function</a></h5>
11525 <p><b>Synopsis</b>
11526 <p><a name="7.6.3.2p1" href="#7.6.3.2p1"><small>1</small></a>
11527 <pre>
11528         #include <a href="#7.6">&lt;fenv.h&gt;</a>
11529         int fesetround(int round);
11530 </pre>
11531 <p><b>Description</b>
11532 <p><a name="7.6.3.2p2" href="#7.6.3.2p2"><small>2</small></a>
11533  The fesetround function establishes the rounding direction represented by its
11534  argument round. If the argument is not equal to the value of a rounding direction macro,
11535  the rounding direction is not changed.
11536 <p><b>Returns</b>
11537 <p><a name="7.6.3.2p3" href="#7.6.3.2p3"><small>3</small></a>
11538  The fesetround function returns zero if and only if the requested rounding direction
11539  was established.
11540 <!--page 231 -->
11541 <p><a name="7.6.3.2p4" href="#7.6.3.2p4"><small>4</small></a>
11542  EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
11543  rounding direction fails.
11544 <pre>
11545          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11546          #include <a href="#7.2">&lt;assert.h&gt;</a>
11547          void f(int round_dir)
11548          {
11549                #pragma STDC FENV_ACCESS ON
11550                int save_round;
11551                int setround_ok;
11552                save_round = fegetround();
11553                setround_ok = fesetround(round_dir);
11554                assert(setround_ok == 0);
11555                /* ... */
11556                fesetround(save_round);
11557                /* ... */
11558          }
11559 </pre>
11560  
11561
11562 <p><small><a href="#Contents">Contents</a></small>
11563 <h4><a name="7.6.4" href="#7.6.4">7.6.4 Environment</a></h4>
11564 <p><a name="7.6.4p1" href="#7.6.4p1"><small>1</small></a>
11565  The functions in this section manage the floating-point environment -- status flags and
11566  control modes -- as one entity.
11567
11568 <p><small><a href="#Contents">Contents</a></small>
11569 <h5><a name="7.6.4.1" href="#7.6.4.1">7.6.4.1 The fegetenv function</a></h5>
11570 <p><b>Synopsis</b>
11571 <p><a name="7.6.4.1p1" href="#7.6.4.1p1"><small>1</small></a>
11572 <pre>
11573          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11574          int fegetenv(fenv_t *envp);
11575 </pre>
11576 <p><b>Description</b>
11577 <p><a name="7.6.4.1p2" href="#7.6.4.1p2"><small>2</small></a>
11578  The fegetenv function attempts to store the current floating-point environment in the
11579  object pointed to by envp.
11580 <p><b>Returns</b>
11581 <p><a name="7.6.4.1p3" href="#7.6.4.1p3"><small>3</small></a>
11582  The fegetenv function returns zero if the environment was successfully stored.
11583  Otherwise, it returns a nonzero value.
11584
11585 <p><small><a href="#Contents">Contents</a></small>
11586 <h5><a name="7.6.4.2" href="#7.6.4.2">7.6.4.2 The feholdexcept function</a></h5>
11587 <p><b>Synopsis</b>
11588 <p><a name="7.6.4.2p1" href="#7.6.4.2p1"><small>1</small></a>
11589 <pre>
11590          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11591          int feholdexcept(fenv_t *envp);
11592 </pre>
11593 <p><b>Description</b>
11594 <p><a name="7.6.4.2p2" href="#7.6.4.2p2"><small>2</small></a>
11595  The feholdexcept function saves the current floating-point environment in the object
11596  pointed to by envp, clears the floating-point status flags, and then installs a non-stop
11597  (continue on floating-point exceptions) mode, if available, for all floating-point
11598  exceptions.<sup><a href="#note218"><b>218)</b></a></sup>
11599 <!--page 232 -->
11600 <p><b>Returns</b>
11601 <p><a name="7.6.4.2p3" href="#7.6.4.2p3"><small>3</small></a>
11602  The feholdexcept function returns zero if and only if non-stop floating-point
11603  exception handling was successfully installed.
11604
11605 <p><b>Footnotes</b>
11606 <p><small><a name="note218" href="#note218">218)</a> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
11607  handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
11608  such systems, the feholdexcept function can be used in conjunction with the feupdateenv
11609  function to write routines that hide spurious floating-point exceptions from their callers.
11610 </small>
11611
11612 <p><small><a href="#Contents">Contents</a></small>
11613 <h5><a name="7.6.4.3" href="#7.6.4.3">7.6.4.3 The fesetenv function</a></h5>
11614 <p><b>Synopsis</b>
11615 <p><a name="7.6.4.3p1" href="#7.6.4.3p1"><small>1</small></a>
11616 <pre>
11617          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11618          int fesetenv(const fenv_t *envp);
11619 </pre>
11620 <p><b>Description</b>
11621 <p><a name="7.6.4.3p2" href="#7.6.4.3p2"><small>2</small></a>
11622  The fesetenv function attempts to establish the floating-point environment represented
11623  by the object pointed to by envp. The argument envp shall point to an object set by a
11624  call to fegetenv or feholdexcept, or equal a floating-point environment macro.
11625  Note that fesetenv merely installs the state of the floating-point status flags
11626  represented through its argument, and does not raise these floating-point exceptions.
11627 <p><b>Returns</b>
11628 <p><a name="7.6.4.3p3" href="#7.6.4.3p3"><small>3</small></a>
11629  The fesetenv function returns zero if the environment was successfully established.
11630  Otherwise, it returns a nonzero value.
11631
11632 <p><small><a href="#Contents">Contents</a></small>
11633 <h5><a name="7.6.4.4" href="#7.6.4.4">7.6.4.4 The feupdateenv function</a></h5>
11634 <p><b>Synopsis</b>
11635 <p><a name="7.6.4.4p1" href="#7.6.4.4p1"><small>1</small></a>
11636 <pre>
11637          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11638          int feupdateenv(const fenv_t *envp);
11639 </pre>
11640 <p><b>Description</b>
11641 <p><a name="7.6.4.4p2" href="#7.6.4.4p2"><small>2</small></a>
11642  The feupdateenv function attempts to save the currently raised floating-point
11643  exceptions in its automatic storage, install the floating-point environment represented by
11644  the object pointed to by envp, and then raise the saved floating-point exceptions. The
11645  argument envp shall point to an object set by a call to feholdexcept or fegetenv,
11646  or equal a floating-point environment macro.
11647 <p><b>Returns</b>
11648 <p><a name="7.6.4.4p3" href="#7.6.4.4p3"><small>3</small></a>
11649  The feupdateenv function returns zero if all the actions were successfully carried out.
11650  Otherwise, it returns a nonzero value.
11651  
11652  
11653  
11654  
11655 <!--page 233 -->
11656 <p><a name="7.6.4.4p4" href="#7.6.4.4p4"><small>4</small></a>
11657  EXAMPLE     Hide spurious underflow floating-point exceptions:
11658 <!--page 234 -->
11659 <pre>
11660          #include <a href="#7.6">&lt;fenv.h&gt;</a>
11661          double f(double x)
11662          {
11663                #pragma STDC FENV_ACCESS ON
11664                double result;
11665                fenv_t save_env;
11666                if (feholdexcept(&amp;save_env))
11667                      return /* indication of an environmental problem */;
11668                // compute result
11669                if (/* test spurious underflow */)
11670                      if (feclearexcept(FE_UNDERFLOW))
11671                               return /* indication of an environmental problem */;
11672                if (feupdateenv(&amp;save_env))
11673                      return /* indication of an environmental problem */;
11674                return result;
11675          }
11676 </pre>
11677
11678 <p><small><a href="#Contents">Contents</a></small>
11679 <h3><a name="7.7" href="#7.7">7.7 Characteristics of floating types &lt;float.h&gt;</a></h3>
11680 <p><a name="7.7p1" href="#7.7p1"><small>1</small></a>
11681  The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
11682  parameters of the standard floating-point types.
11683 <p><a name="7.7p2" href="#7.7p2"><small>2</small></a>
11684  The macros, their meanings, and the constraints (or restrictions) on their values are listed
11685  in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
11686 <!--page 235 -->
11687
11688 <p><small><a href="#Contents">Contents</a></small>
11689 <h3><a name="7.8" href="#7.8">7.8 Format conversion of integer types &lt;inttypes.h&gt;</a></h3>
11690 <p><a name="7.8p1" href="#7.8p1"><small>1</small></a>
11691  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
11692  additional facilities provided by hosted implementations.
11693 <p><a name="7.8p2" href="#7.8p2"><small>2</small></a>
11694  It declares functions for manipulating greatest-width integers and converting numeric
11695  character strings to greatest-width integers, and it declares the type
11696 <pre>
11697           imaxdiv_t
11698 </pre>
11699  which is a structure type that is the type of the value returned by the imaxdiv function.
11700  For each type declared in <a href="#7.20">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
11701  specifiers for use with the formatted input/output functions.<sup><a href="#note219"><b>219)</b></a></sup>
11702 <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
11703  functions (<a href="#7.21.6">7.21.6</a>), formatted wide character input/output functions (<a href="#7.29.2">7.29.2</a>).
11704
11705 <p><b>Footnotes</b>
11706 <p><small><a name="note219" href="#note219">219)</a> See ''future library directions'' (<a href="#7.31.5">7.31.5</a>).
11707 </small>
11708
11709 <p><small><a href="#Contents">Contents</a></small>
11710 <h4><a name="7.8.1" href="#7.8.1">7.8.1 Macros for format specifiers</a></h4>
11711 <p><a name="7.8.1p1" href="#7.8.1p1"><small>1</small></a>
11712  Each of the following object-like macros expands to a character string literal containing a
11713  conversion specifier, possibly modified by a length modifier, suitable for use within the
11714  format argument of a formatted input/output function when converting the corresponding
11715  integer type. These macro names have the general form of PRI (character string literals
11716  for the fprintf and fwprintf family) or SCN (character string literals for the
11717  fscanf and fwscanf family),<sup><a href="#note220"><b>220)</b></a></sup> followed by the conversion specifier, followed by a
11718  name corresponding to a similar type name in <a href="#7.20.1">7.20.1</a>. In these names, N represents the
11719  width of the type as described in <a href="#7.20.1">7.20.1</a>. For example, PRIdFAST32 can be used in a
11720  format string to print the value of an integer of type int_fast32_t.
11721 <p><a name="7.8.1p2" href="#7.8.1p2"><small>2</small></a>
11722  The fprintf macros for signed integers are:
11723 <pre>
11724         PRIdN             PRIdLEASTN                PRIdFASTN          PRIdMAX             PRIdPTR
11725         PRIiN             PRIiLEASTN                PRIiFASTN          PRIiMAX             PRIiPTR
11726 </pre>
11727 <p><a name="7.8.1p3" href="#7.8.1p3"><small>3</small></a>
11728  The fprintf macros for unsigned integers are:
11729 <pre>
11730         PRIoN             PRIoLEASTN                PRIoFASTN          PRIoMAX             PRIoPTR
11731         PRIuN             PRIuLEASTN                PRIuFASTN          PRIuMAX             PRIuPTR
11732         PRIxN             PRIxLEASTN                PRIxFASTN          PRIxMAX             PRIxPTR
11733         PRIXN             PRIXLEASTN                PRIXFASTN          PRIXMAX             PRIXPTR
11734 </pre>
11735 <p><a name="7.8.1p4" href="#7.8.1p4"><small>4</small></a>
11736  The fscanf macros for signed integers are:
11737  
11738  
11739  
11740 <!--page 236 -->
11741 <pre>
11742         SCNdN           SCNdLEASTN               SCNdFASTN              SCNdMAX             SCNdPTR
11743         SCNiN           SCNiLEASTN               SCNiFASTN              SCNiMAX             SCNiPTR
11744 </pre>
11745 <p><a name="7.8.1p5" href="#7.8.1p5"><small>5</small></a>
11746  The fscanf macros for unsigned integers are:
11747 <pre>
11748         SCNoN           SCNoLEASTN               SCNoFASTN              SCNoMAX             SCNoPTR
11749         SCNuN           SCNuLEASTN               SCNuFASTN              SCNuMAX             SCNuPTR
11750         SCNxN           SCNxLEASTN               SCNxFASTN              SCNxMAX             SCNxPTR
11751 </pre>
11752 <p><a name="7.8.1p6" href="#7.8.1p6"><small>6</small></a>
11753  For each type that the implementation provides in <a href="#7.20">&lt;stdint.h&gt;</a>, the corresponding
11754  fprintf macros shall be defined and the corresponding fscanf macros shall be
11755  defined unless the implementation does not have a suitable fscanf length modifier for
11756  the type.
11757 <p><a name="7.8.1p7" href="#7.8.1p7"><small>7</small></a>
11758  EXAMPLE
11759 <pre>
11760          #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11761          #include <a href="#7.29">&lt;wchar.h&gt;</a>
11762          int main(void)
11763          {
11764                uintmax_t i = UINTMAX_MAX;    // this type always exists
11765                wprintf(L"The largest integer value is %020"
11766                      PRIxMAX "\n", i);
11767                return 0;
11768          }
11769 </pre>
11770  
11771
11772 <p><b>Footnotes</b>
11773 <p><small><a name="note220" href="#note220">220)</a> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
11774  different format specifiers may be required for fprintf and fscanf, even when the type is the
11775  same.
11776 </small>
11777
11778 <p><small><a href="#Contents">Contents</a></small>
11779 <h4><a name="7.8.2" href="#7.8.2">7.8.2 Functions for greatest-width integer types</a></h4>
11780
11781 <p><small><a href="#Contents">Contents</a></small>
11782 <h5><a name="7.8.2.1" href="#7.8.2.1">7.8.2.1 The imaxabs function</a></h5>
11783 <p><b>Synopsis</b>
11784 <p><a name="7.8.2.1p1" href="#7.8.2.1p1"><small>1</small></a>
11785 <pre>
11786          #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11787          intmax_t imaxabs(intmax_t j);
11788 </pre>
11789 <p><b>Description</b>
11790 <p><a name="7.8.2.1p2" href="#7.8.2.1p2"><small>2</small></a>
11791  The imaxabs function computes the absolute value of an integer j. If the result cannot
11792  be represented, the behavior is undefined.<sup><a href="#note221"><b>221)</b></a></sup>
11793 <p><b>Returns</b>
11794 <p><a name="7.8.2.1p3" href="#7.8.2.1p3"><small>3</small></a>
11795  The imaxabs function returns the absolute value.
11796  
11797  
11798  
11799  
11800 <!--page 237 -->
11801
11802 <p><b>Footnotes</b>
11803 <p><small><a name="note221" href="#note221">221)</a> The absolute value of the most negative number cannot be represented in two's complement.
11804 </small>
11805
11806 <p><small><a href="#Contents">Contents</a></small>
11807 <h5><a name="7.8.2.2" href="#7.8.2.2">7.8.2.2 The imaxdiv function</a></h5>
11808 <p><b>Synopsis</b>
11809 <p><a name="7.8.2.2p1" href="#7.8.2.2p1"><small>1</small></a>
11810 <pre>
11811          #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11812          imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
11813 </pre>
11814 <p><b>Description</b>
11815 <p><a name="7.8.2.2p2" href="#7.8.2.2p2"><small>2</small></a>
11816  The imaxdiv function computes numer / denom and numer % denom in a single
11817  operation.
11818 <p><b>Returns</b>
11819 <p><a name="7.8.2.2p3" href="#7.8.2.2p3"><small>3</small></a>
11820  The imaxdiv function returns a structure of type imaxdiv_t comprising both the
11821  quotient and the remainder. The structure shall contain (in either order) the members
11822  quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
11823  either part of the result cannot be represented, the behavior is undefined.
11824
11825 <p><small><a href="#Contents">Contents</a></small>
11826 <h5><a name="7.8.2.3" href="#7.8.2.3">7.8.2.3 The strtoimax and strtoumax functions</a></h5>
11827 <p><b>Synopsis</b>
11828 <p><a name="7.8.2.3p1" href="#7.8.2.3p1"><small>1</small></a>
11829 <pre>
11830          #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11831          intmax_t strtoimax(const char * restrict nptr,
11832               char ** restrict endptr, int base);
11833          uintmax_t strtoumax(const char * restrict nptr,
11834               char ** restrict endptr, int base);
11835 </pre>
11836 <p><b>Description</b>
11837 <p><a name="7.8.2.3p2" href="#7.8.2.3p2"><small>2</small></a>
11838  The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
11839  strtoul, and strtoull functions, except that the initial portion of the string is
11840  converted to intmax_t and uintmax_t representation, respectively.
11841 <p><b>Returns</b>
11842 <p><a name="7.8.2.3p3" href="#7.8.2.3p3"><small>3</small></a>
11843  The strtoimax and strtoumax functions return the converted value, if any. If no
11844  conversion could be performed, zero is returned. If the correct value is outside the range
11845  of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
11846  (according to the return type and sign of the value, if any), and the value of the macro
11847  ERANGE is stored in errno.
11848 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
11849  (<a href="#7.22.1.4">7.22.1.4</a>).
11850 <!--page 238 -->
11851
11852 <p><small><a href="#Contents">Contents</a></small>
11853 <h5><a name="7.8.2.4" href="#7.8.2.4">7.8.2.4 The wcstoimax and wcstoumax functions</a></h5>
11854 <p><b>Synopsis</b>
11855 <p><a name="7.8.2.4p1" href="#7.8.2.4p1"><small>1</small></a>
11856 <pre>
11857         #include <a href="#7.19">&lt;stddef.h&gt;</a>           // for wchar_t
11858         #include <a href="#7.8">&lt;inttypes.h&gt;</a>
11859         intmax_t wcstoimax(const wchar_t * restrict nptr,
11860              wchar_t ** restrict endptr, int base);
11861         uintmax_t wcstoumax(const wchar_t * restrict nptr,
11862              wchar_t ** restrict endptr, int base);
11863 </pre>
11864 <p><b>Description</b>
11865 <p><a name="7.8.2.4p2" href="#7.8.2.4p2"><small>2</small></a>
11866  The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
11867  wcstoul, and wcstoull functions except that the initial portion of the wide string is
11868  converted to intmax_t and uintmax_t representation, respectively.
11869 <p><b>Returns</b>
11870 <p><a name="7.8.2.4p3" href="#7.8.2.4p3"><small>3</small></a>
11871  The wcstoimax function returns the converted value, if any. If no conversion could be
11872  performed, zero is returned. If the correct value is outside the range of representable
11873  values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
11874  return type and sign of the value, if any), and the value of the macro ERANGE is stored in
11875  errno.
11876 <p><b> Forward references</b>: the wcstol, wcstoll, wcstoul, and wcstoull functions
11877  (<a href="#7.29.4.1.2">7.29.4.1.2</a>).
11878 <!--page 239 -->
11879
11880 <p><small><a href="#Contents">Contents</a></small>
11881 <h3><a name="7.9" href="#7.9">7.9 Alternative spellings &lt;iso646.h&gt;</a></h3>
11882 <p><a name="7.9p1" href="#7.9p1"><small>1</small></a>
11883  The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
11884  to the corresponding tokens (on the right):
11885 <!--page 240 -->
11886 <pre>
11887          and        &amp;&amp;
11888          and_eq     &amp;=
11889          bitand     &amp;
11890          bitor      |
11891          compl      ~
11892          not        !
11893          not_eq     !=
11894          or         ||
11895          or_eq      |=
11896          xor        ^
11897          xor_eq     ^=
11898 </pre>
11899
11900 <p><small><a href="#Contents">Contents</a></small>
11901 <h3><a name="7.10" href="#7.10">7.10 Sizes of integer types &lt;limits.h&gt;</a></h3>
11902 <p><a name="7.10p1" href="#7.10p1"><small>1</small></a>
11903  The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
11904  parameters of the standard integer types.
11905 <p><a name="7.10p2" href="#7.10p2"><small>2</small></a>
11906  The macros, their meanings, and the constraints (or restrictions) on their values are listed
11907  in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
11908 <!--page 241 -->
11909
11910 <p><small><a href="#Contents">Contents</a></small>
11911 <h3><a name="7.11" href="#7.11">7.11 Localization &lt;locale.h&gt;</a></h3>
11912 <p><a name="7.11p1" href="#7.11p1"><small>1</small></a>
11913  The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
11914 <p><a name="7.11p2" href="#7.11p2"><small>2</small></a>
11915  The type is
11916 <pre>
11917          struct lconv
11918 </pre>
11919  which contains members related to the formatting of numeric values. The structure shall
11920  contain at least the following members, in any order. The semantics of the members and
11921  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
11922  the values specified in the comments.
11923 <!--page 242 -->
11924 <pre>
11925          char   *decimal_point;                //   "."
11926          char   *thousands_sep;                //   ""
11927          char   *grouping;                     //   ""
11928          char   *mon_decimal_point;            //   ""
11929          char   *mon_thousands_sep;            //   ""
11930          char   *mon_grouping;                 //   ""
11931          char   *positive_sign;                //   ""
11932          char   *negative_sign;                //   ""
11933          char   *currency_symbol;              //   ""
11934          char   frac_digits;                   //   CHAR_MAX
11935          char   p_cs_precedes;                 //   CHAR_MAX
11936          char   n_cs_precedes;                 //   CHAR_MAX
11937          char   p_sep_by_space;                //   CHAR_MAX
11938          char   n_sep_by_space;                //   CHAR_MAX
11939          char   p_sign_posn;                   //   CHAR_MAX
11940          char   n_sign_posn;                   //   CHAR_MAX
11941          char   *int_curr_symbol;              //   ""
11942          char   int_frac_digits;               //   CHAR_MAX
11943          char   int_p_cs_precedes;             //   CHAR_MAX
11944          char   int_n_cs_precedes;             //   CHAR_MAX
11945          char   int_p_sep_by_space;            //   CHAR_MAX
11946          char   int_n_sep_by_space;            //   CHAR_MAX
11947          char   int_p_sign_posn;               //   CHAR_MAX
11948          char   int_n_sign_posn;               //   CHAR_MAX
11949 </pre>
11950 <p><a name="7.11p3" href="#7.11p3"><small>3</small></a>
11951  The macros defined are NULL (described in <a href="#7.19">7.19</a>); and
11952 <pre>
11953           LC_ALL
11954           LC_COLLATE
11955           LC_CTYPE
11956           LC_MONETARY
11957           LC_NUMERIC
11958           LC_TIME
11959 </pre>
11960  which expand to integer constant expressions with distinct values, suitable for use as the
11961  first argument to the setlocale function.<sup><a href="#note222"><b>222)</b></a></sup> Additional macro definitions, beginning
11962  with the characters LC_ and an uppercase letter,<sup><a href="#note223"><b>223)</b></a></sup> may also be specified by the
11963  implementation.
11964
11965 <p><b>Footnotes</b>
11966 <p><small><a name="note222" href="#note222">222)</a> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
11967 </small>
11968 <p><small><a name="note223" href="#note223">223)</a> See ''future library directions'' (<a href="#7.31.6">7.31.6</a>).
11969 </small>
11970
11971 <p><small><a href="#Contents">Contents</a></small>
11972 <h4><a name="7.11.1" href="#7.11.1">7.11.1 Locale control</a></h4>
11973
11974 <p><small><a href="#Contents">Contents</a></small>
11975 <h5><a name="7.11.1.1" href="#7.11.1.1">7.11.1.1 The setlocale function</a></h5>
11976 <p><b>Synopsis</b>
11977 <p><a name="7.11.1.1p1" href="#7.11.1.1p1"><small>1</small></a>
11978 <pre>
11979           #include <a href="#7.11">&lt;locale.h&gt;</a>
11980           char *setlocale(int category, const char *locale);
11981 </pre>
11982 <p><b>Description</b>
11983 <p><a name="7.11.1.1p2" href="#7.11.1.1p2"><small>2</small></a>
11984  The setlocale function selects the appropriate portion of the program's locale as
11985  specified by the category and locale arguments. The setlocale function may be
11986  used to change or query the program's entire current locale or portions thereof. The value
11987  LC_ALL for category names the program's entire locale; the other values for
11988  category name only a portion of the program's locale. LC_COLLATE affects the
11989  behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
11990  the character handling functions<sup><a href="#note224"><b>224)</b></a></sup> and the multibyte and wide character functions.
11991  LC_MONETARY affects the monetary formatting information returned by the
11992  localeconv function. LC_NUMERIC affects the decimal-point character for the
11993  formatted input/output functions and the string conversion functions, as well as the
11994  nonmonetary formatting information returned by the localeconv function. LC_TIME
11995  affects the behavior of the strftime and wcsftime functions.
11996 <p><a name="7.11.1.1p3" href="#7.11.1.1p3"><small>3</small></a>
11997  A value of "C" for locale specifies the minimal environment for C translation; a value
11998  of "" for locale specifies the locale-specific native environment. Other
11999  implementation-defined strings may be passed as the second argument to setlocale.
12000  
12001 <!--page 243 -->
12002 <p><a name="7.11.1.1p4" href="#7.11.1.1p4"><small>4</small></a>
12003  At program startup, the equivalent of
12004 <pre>
12005          setlocale(LC_ALL, "C");
12006 </pre>
12007  is executed.
12008 <p><a name="7.11.1.1p5" href="#7.11.1.1p5"><small>5</small></a>
12009  A call to the setlocale function may introduce a data race with other calls to the
12010  setlocale function or with calls to functions that are affected by the current locale.
12011  The implementation shall behave as if no library function calls the setlocale function.
12012 <p><b>Returns</b>
12013 <p><a name="7.11.1.1p6" href="#7.11.1.1p6"><small>6</small></a>
12014  If a pointer to a string is given for locale and the selection can be honored, the
12015  setlocale function returns a pointer to the string associated with the specified
12016  category for the new locale. If the selection cannot be honored, the setlocale
12017  function returns a null pointer and the program's locale is not changed.
12018 <p><a name="7.11.1.1p7" href="#7.11.1.1p7"><small>7</small></a>
12019  A null pointer for locale causes the setlocale function to return a pointer to the
12020  string associated with the category for the program's current locale; the program's
12021  locale is not changed.<sup><a href="#note225"><b>225)</b></a></sup>
12022 <p><a name="7.11.1.1p8" href="#7.11.1.1p8"><small>8</small></a>
12023  The pointer to string returned by the setlocale function is such that a subsequent call
12024  with that string value and its associated category will restore that part of the program's
12025  locale. The string pointed to shall not be modified by the program, but may be
12026  overwritten by a subsequent call to the setlocale function.
12027 <p><b> Forward references</b>: formatted input/output functions (<a href="#7.21.6">7.21.6</a>), multibyte/wide
12028  character conversion functions (<a href="#7.22.7">7.22.7</a>), multibyte/wide string conversion functions
12029  (<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.24.4.3">7.24.4.3</a>), the
12030  strftime function (<a href="#7.27.3.5">7.27.3.5</a>), the strxfrm function (<a href="#7.24.4.5">7.24.4.5</a>).
12031
12032 <p><b>Footnotes</b>
12033 <p><small><a name="note224" href="#note224">224)</a> The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
12034  isxdigit.
12035 </small>
12036 <p><small><a name="note225" href="#note225">225)</a> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
12037  locale when category has the value LC_ALL.
12038 </small>
12039
12040 <p><small><a href="#Contents">Contents</a></small>
12041 <h4><a name="7.11.2" href="#7.11.2">7.11.2 Numeric formatting convention inquiry</a></h4>
12042
12043 <p><small><a href="#Contents">Contents</a></small>
12044 <h5><a name="7.11.2.1" href="#7.11.2.1">7.11.2.1 The localeconv function</a></h5>
12045 <p><b>Synopsis</b>
12046 <p><a name="7.11.2.1p1" href="#7.11.2.1p1"><small>1</small></a>
12047 <pre>
12048          #include <a href="#7.11">&lt;locale.h&gt;</a>
12049          struct lconv *localeconv(void);
12050 </pre>
12051 <p><b>Description</b>
12052 <p><a name="7.11.2.1p2" href="#7.11.2.1p2"><small>2</small></a>
12053  The localeconv function sets the components of an object with type struct lconv
12054  with values appropriate for the formatting of numeric quantities (monetary and otherwise)
12055  according to the rules of the current locale.
12056  
12057  
12058  
12059 <!--page 244 -->
12060 <p><a name="7.11.2.1p3" href="#7.11.2.1p3"><small>3</small></a>
12061  The members of the structure with type char * are pointers to strings, any of which
12062  (except decimal_point) can point to "", to indicate that the value is not available in
12063  the current locale or is of zero length. Apart from grouping and mon_grouping, the
12064  strings shall start and end in the initial shift state. The members with type char are
12065  nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
12066  available in the current locale. The members include the following:
12067  char *decimal_point
12068 <pre>
12069            The decimal-point character used to format nonmonetary quantities.
12070 </pre>
12071  char *thousands_sep
12072 <pre>
12073            The character used to separate groups of digits before the decimal-point
12074            character in formatted nonmonetary quantities.
12075 </pre>
12076  char *grouping
12077 <pre>
12078            A string whose elements indicate the size of each group of digits in
12079            formatted nonmonetary quantities.
12080 </pre>
12081  char *mon_decimal_point
12082 <pre>
12083            The decimal-point used to format monetary quantities.
12084 </pre>
12085  char *mon_thousands_sep
12086 <pre>
12087            The separator for groups of digits before the decimal-point in formatted
12088            monetary quantities.
12089 </pre>
12090  char *mon_grouping
12091 <pre>
12092            A string whose elements indicate the size of each group of digits in
12093            formatted monetary quantities.
12094 </pre>
12095  char *positive_sign
12096 <pre>
12097            The string used to indicate a nonnegative-valued formatted monetary
12098            quantity.
12099 </pre>
12100  char *negative_sign
12101 <pre>
12102            The string used to indicate a negative-valued formatted monetary quantity.
12103 </pre>
12104  char *currency_symbol
12105 <pre>
12106            The local currency symbol applicable to the current locale.
12107 </pre>
12108  char frac_digits
12109 <pre>
12110            The number of fractional digits (those after the decimal-point) to be
12111            displayed in a locally formatted monetary quantity.
12112 </pre>
12113  char p_cs_precedes
12114 <!--page 245 -->
12115 <pre>
12116            Set to 1 or 0 if the currency_symbol respectively precedes or
12117            succeeds the value for a nonnegative locally formatted monetary quantity.
12118 </pre>
12119  char n_cs_precedes
12120 <pre>
12121            Set to 1 or 0 if the currency_symbol respectively precedes or
12122            succeeds the value for a negative locally formatted monetary quantity.
12123 </pre>
12124  char p_sep_by_space
12125 <pre>
12126            Set to a value indicating the separation of the currency_symbol, the
12127            sign string, and the value for a nonnegative locally formatted monetary
12128            quantity.
12129 </pre>
12130  char n_sep_by_space
12131 <pre>
12132            Set to a value indicating the separation of the currency_symbol, the
12133            sign string, and the value for a negative locally formatted monetary
12134            quantity.
12135 </pre>
12136  char p_sign_posn
12137 <pre>
12138            Set to a value indicating the positioning of the positive_sign for a
12139            nonnegative locally formatted monetary quantity.
12140 </pre>
12141  char n_sign_posn
12142 <pre>
12143            Set to a value indicating the positioning of the negative_sign for a
12144            negative locally formatted monetary quantity.
12145 </pre>
12146  char *int_curr_symbol
12147 <pre>
12148            The international currency symbol applicable to the current locale. The
12149            first three characters contain the alphabetic international currency symbol
12150            in accordance with those specified in ISO 4217. The fourth character
12151            (immediately preceding the null character) is the character used to separate
12152            the international currency symbol from the monetary quantity.
12153 </pre>
12154  char int_frac_digits
12155 <pre>
12156            The number of fractional digits (those after the decimal-point) to be
12157            displayed in an internationally formatted monetary quantity.
12158 </pre>
12159  char int_p_cs_precedes
12160 <pre>
12161            Set to 1 or 0 if the int_curr_symbol respectively precedes or
12162            succeeds the value for a nonnegative internationally formatted monetary
12163            quantity.
12164 </pre>
12165  char int_n_cs_precedes
12166 <pre>
12167            Set to 1 or 0 if the int_curr_symbol respectively precedes or
12168            succeeds the value for a negative internationally formatted monetary
12169            quantity.
12170 </pre>
12171  char int_p_sep_by_space
12172 <!--page 246 -->
12173 <pre>
12174            Set to a value indicating the separation of the int_curr_symbol, the
12175            sign string, and the value for a nonnegative internationally formatted
12176            monetary quantity.
12177 </pre>
12178  char int_n_sep_by_space
12179 <pre>
12180            Set to a value indicating the separation of the int_curr_symbol, the
12181            sign string, and the value for a negative internationally formatted monetary
12182            quantity.
12183 </pre>
12184  char int_p_sign_posn
12185 <pre>
12186            Set to a value indicating the positioning of the positive_sign for a
12187            nonnegative internationally formatted monetary quantity.
12188 </pre>
12189  char int_n_sign_posn
12190 <pre>
12191            Set to a value indicating the positioning of the negative_sign for a
12192            negative internationally formatted monetary quantity.
12193 </pre>
12194 <p><a name="7.11.2.1p4" href="#7.11.2.1p4"><small>4</small></a>
12195  The elements of grouping and mon_grouping are interpreted according to the
12196  following:
12197  CHAR_MAX        No further grouping is to be performed.
12198  0               The previous element is to be repeatedly used for the remainder of the
12199 <pre>
12200                  digits.
12201 </pre>
12202  other           The integer value is the number of digits that compose the current group.
12203 <pre>
12204                  The next element is examined to determine the size of the next group of
12205                  digits before the current group.
12206 </pre>
12207 <p><a name="7.11.2.1p5" href="#7.11.2.1p5"><small>5</small></a>
12208  The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
12209  and int_n_sep_by_space are interpreted according to the following:
12210  0     No space separates the currency symbol and value.
12211  1     If the currency symbol and sign string are adjacent, a space separates them from the
12212 <pre>
12213        value; otherwise, a space separates the currency symbol from the value.
12214 </pre>
12215  2   If the currency symbol and sign string are adjacent, a space separates them;
12216 <pre>
12217      otherwise, a space separates the sign string from the value.
12218 </pre>
12219  For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
12220  int_curr_symbol is used instead of a space.
12221 <p><a name="7.11.2.1p6" href="#7.11.2.1p6"><small>6</small></a>
12222  The values of p_sign_posn, n_sign_posn, int_p_sign_posn,                              and
12223  int_n_sign_posn are interpreted according to the following:
12224  0     Parentheses surround the quantity and currency symbol.
12225  1     The sign string precedes the quantity and currency symbol.
12226  2     The sign string succeeds the quantity and currency symbol.
12227  3     The sign string immediately precedes the currency symbol.
12228  4     The sign string immediately succeeds the currency symbol.
12229 <!--page 247 -->
12230 <p><a name="7.11.2.1p7" href="#7.11.2.1p7"><small>7</small></a>
12231  The implementation shall behave as if no library function calls the localeconv
12232  function.
12233 <p><b>Returns</b>
12234 <p><a name="7.11.2.1p8" href="#7.11.2.1p8"><small>8</small></a>
12235  The localeconv function returns a pointer to the filled-in object. The structure
12236  pointed to by the return value shall not be modified by the program, but may be
12237  overwritten by a subsequent call to the localeconv function. In addition, calls to the
12238  setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
12239  overwrite the contents of the structure.
12240 <p><a name="7.11.2.1p9" href="#7.11.2.1p9"><small>9</small></a>
12241  EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
12242  monetary quantities.
12243 <pre>
12244                                Local format                                     International format
12245 </pre>
12246  
12247  Country            Positive                  Negative                    Positive               Negative
12248  
12249  Country1     1.234,56 mk             -1.234,56 mk                  FIM   1.234,56         FIM -1.234,56
12250  Country2     L.1.234                 -L.1.234                      ITL   1.234            -ITL 1.234
12251  Country3     fl. 1.234,56              fl. -1.234,56                   NLG   1.234,56         NLG -1.234,56
12252  Country4     SFrs.1,234.56           SFrs.1,234.56C                CHF   1,234.56         CHF 1,234.56C
12253 <p><a name="7.11.2.1p10" href="#7.11.2.1p10"><small>10</small></a>
12254  For these four countries, the respective values for the monetary members of the structure returned by
12255  localeconv could be:
12256 <pre>
12257                                    Country1              Country2              Country3            Country4
12258 </pre>
12259  
12260  mon_decimal_point                 ","                   ""                   ","                 "."
12261  mon_thousands_sep                 "."                   "."                  "."                 ","
12262  mon_grouping                      "\3"                  "\3"                 "\3"                "\3"
12263  positive_sign                     ""                    ""                   ""                  ""
12264  negative_sign                     "-"                   "-"                  "-"                 "C"
12265  currency_symbol                   "mk"                  "L."                 "\u0192"            "SFrs."
12266  frac_digits                       2                     0                    2                   2
12267  p_cs_precedes                     0                     1                    1                   1
12268  n_cs_precedes                     0                     1                    1                   1
12269  p_sep_by_space                    1                     0                    1                   0
12270  n_sep_by_space                    1                     0                    2                   0
12271  p_sign_posn                       1                     1                    1                   1
12272  n_sign_posn                       1                     1                    4                   2
12273  int_curr_symbol                   "FIM "                "ITL "               "NLG "              "CHF "
12274  int_frac_digits                   2                     0                    2                   2
12275  int_p_cs_precedes                 1                     1                    1                   1
12276  int_n_cs_precedes                 1                     1                    1                   1
12277  int_p_sep_by_space                1                     1                    1                   1
12278  int_n_sep_by_space                2                     1                    2                   1
12279  int_p_sign_posn                   1                     1                    1                   1
12280  int_n_sign_posn                   4                     1                    4                   2
12281 <!--page 248 -->
12282 <p><a name="7.11.2.1p11" href="#7.11.2.1p11"><small>11</small></a>
12283  EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
12284  affect the formatted value.
12285 <pre>
12286                                                                p_sep_by_space
12287 </pre>
12288  
12289  p_cs_precedes           p_sign_posn                0                   1                  2
12290  
12291 <pre>
12292                  0                    0         (<a href="#1.25">1.25</a>$)            (<a href="#1.25">1.25</a> $)            (<a href="#1.25">1.25</a>$)
12293                                       1         +1.25$             +1.25 $             + <a href="#1.25">1.25</a>$
12294                                       2         <a href="#1.25">1.25</a>$+             <a href="#1.25">1.25</a> $+             <a href="#1.25">1.25</a>$ +
12295                                       3         <a href="#1.25">1.25</a>+$             <a href="#1.25">1.25</a> +$             <a href="#1.25">1.25</a>+ $
12296                                       4         <a href="#1.25">1.25</a>$+             <a href="#1.25">1.25</a> $+             <a href="#1.25">1.25</a>$ +
12297 </pre>
12298  
12299 <!--page 249 -->
12300 <pre>
12301                  1                    0         ($1.25)            ($ <a href="#1.25">1.25</a>)            ($1.25)
12302                                       1         +$1.25             +$ <a href="#1.25">1.25</a>             + $1.25
12303                                       2         $1.25+             $ <a href="#1.25">1.25</a>+             $1.25 +
12304                                       3         +$1.25             +$ <a href="#1.25">1.25</a>             + $1.25
12305                                       4         $+1.25             $+ <a href="#1.25">1.25</a>             $ +1.25
12306 </pre>
12307
12308 <p><small><a href="#Contents">Contents</a></small>
12309 <h3><a name="7.12" href="#7.12">7.12 Mathematics &lt;math.h&gt;</a></h3>
12310 <p><a name="7.12p1" href="#7.12p1"><small>1</small></a>
12311  The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
12312  several macros. Most synopses specify a family of functions consisting of a principal
12313  function with one or more double parameters, a double return value, or both; and
12314  other functions with the same name but with f and l suffixes, which are corresponding
12315  functions with float and long double parameters, return values, or both.<sup><a href="#note226"><b>226)</b></a></sup>
12316  Integer arithmetic functions and conversion functions are discussed later.
12317 <p><a name="7.12p2" href="#7.12p2"><small>2</small></a>
12318  The types
12319 <pre>
12320          float_t
12321          double_t
12322 </pre>
12323  are floating types at least as wide as float and double, respectively, and such that
12324  double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
12325  float_t and double_t are float and double, respectively; if
12326  FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
12327  2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
12328  otherwise implementation-defined.<sup><a href="#note227"><b>227)</b></a></sup>
12329 <p><a name="7.12p3" href="#7.12p3"><small>3</small></a>
12330  The macro
12331 <pre>
12332          HUGE_VAL
12333 </pre>
12334  expands to a positive double constant expression, not necessarily representable as a
12335  float. The macros
12336 <pre>
12337          HUGE_VALF
12338          HUGE_VALL
12339 </pre>
12340  are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note228"><b>228)</b></a></sup>
12341 <p><a name="7.12p4" href="#7.12p4"><small>4</small></a>
12342  The macro
12343 <pre>
12344          INFINITY
12345 </pre>
12346  expands to a constant expression of type float representing positive or unsigned
12347  infinity, if available; else to a positive constant of type float that overflows at
12348  
12349  
12350  
12351 <!--page 250 -->
12352  translation time.<sup><a href="#note229"><b>229)</b></a></sup>
12353 <p><a name="7.12p5" href="#7.12p5"><small>5</small></a>
12354  The macro
12355 <pre>
12356           NAN
12357 </pre>
12358  is defined if and only if the implementation supports quiet NaNs for the float type. It
12359  expands to a constant expression of type float representing a quiet NaN.
12360 <p><a name="7.12p6" href="#7.12p6"><small>6</small></a>
12361  The number classification macros
12362 <pre>
12363           FP_INFINITE
12364           FP_NAN
12365           FP_NORMAL
12366           FP_SUBNORMAL
12367           FP_ZERO
12368 </pre>
12369  represent the mutually exclusive kinds of floating-point values. They expand to integer
12370  constant expressions with distinct values. Additional implementation-defined floating-
12371  point classifications, with macro definitions beginning with FP_ and an uppercase letter,
12372  may also be specified by the implementation.
12373 <p><a name="7.12p7" href="#7.12p7"><small>7</small></a>
12374  The macro
12375 <pre>
12376           FP_FAST_FMA
12377 </pre>
12378  is optionally defined. If defined, it indicates that the fma function generally executes
12379  about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note230"><b>230)</b></a></sup> The
12380  macros
12381 <pre>
12382           FP_FAST_FMAF
12383           FP_FAST_FMAL
12384 </pre>
12385  are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
12386  these macros expand to the integer constant 1.
12387 <p><a name="7.12p8" href="#7.12p8"><small>8</small></a>
12388  The macros
12389 <pre>
12390           FP_ILOGB0
12391           FP_ILOGBNAN
12392 </pre>
12393  expand to integer constant expressions whose values are returned by ilogb(x) if x is
12394  zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
12395  -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
12396  
12397  
12398 <!--page 251 -->
12399 <p><a name="7.12p9" href="#7.12p9"><small>9</small></a>
12400  The macros
12401 <pre>
12402            MATH_ERRNO
12403            MATH_ERREXCEPT
12404 </pre>
12405  expand to the integer constants 1 and 2, respectively; the macro
12406 <pre>
12407          math_errhandling
12408 </pre>
12409  expands to an expression that has type int and the value MATH_ERRNO,
12410  MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
12411  constant for the duration of the program. It is unspecified whether
12412  math_errhandling is a macro or an identifier with external linkage. If a macro
12413  definition is suppressed or a program defines an identifier with the name
12414  math_errhandling, the behavior is undefined.               If the expression
12415  math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
12416  shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
12417  <a href="#7.6">&lt;fenv.h&gt;</a>.
12418
12419 <p><b>Footnotes</b>
12420 <p><small><a name="note226" href="#note226">226)</a> Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
12421  and return values in wider format than the synopsis prototype indicates.
12422 </small>
12423 <p><small><a name="note227" href="#note227">227)</a> The types float_t and double_t are intended to be the implementation's most efficient types at
12424  least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
12425  type float_t is the narrowest type used by the implementation to evaluate floating expressions.
12426 </small>
12427 <p><small><a name="note228" href="#note228">228)</a> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
12428  supports infinities.
12429 </small>
12430 <p><small><a name="note229" href="#note229">229)</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.
12431 </small>
12432 <p><small><a name="note230" href="#note230">230)</a> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
12433  directly with a hardware multiply-add instruction. Software implementations are expected to be
12434  substantially slower.
12435 </small>
12436
12437 <p><small><a href="#Contents">Contents</a></small>
12438 <h4><a name="7.12.1" href="#7.12.1">7.12.1 Treatment of error conditions</a></h4>
12439 <p><a name="7.12.1p1" href="#7.12.1p1"><small>1</small></a>
12440  The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
12441  values of its input arguments, except where stated otherwise. Each function shall execute
12442  as if it were a single operation without raising SIGFPE and without generating any of the
12443  floating-point exceptions ''invalid'', ''divide-by-zero'', or ''overflow'' except to reflect
12444  the result of the function.
12445 <p><a name="7.12.1p2" href="#7.12.1p2"><small>2</small></a>
12446  For all functions, a domain error occurs if an input argument is outside the domain over
12447  which the mathematical function is defined. The description of each function lists any
12448  required domain errors; an implementation may define additional domain errors, provided
12449  that such errors are consistent with the mathematical definition of the function.<sup><a href="#note231"><b>231)</b></a></sup> On a
12450  domain error, the function returns an implementation-defined value; if the integer
12451  expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
12452  errno acquires the value EDOM; if the integer expression math_errhandling &amp;
12453  MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
12454 <p><a name="7.12.1p3" href="#7.12.1p3"><small>3</small></a>
12455  Similarly, a pole error (also known as a singularity or infinitary) occurs if the
12456  mathematical function has an exact infinite result as the finite input argument(s) are
12457  approached in the limit (for example, log(0.0)). The description of each function lists
12458  any required pole errors; an implementation may define additional pole errors, provided
12459  that such errors are consistent with the mathematical definition of the function. On a pole
12460  error, the function returns an implementation-defined value; if the integer expression
12461  
12462  
12463 <!--page 252 -->
12464  math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression errno
12465  acquires the value ERANGE; if the integer expression math_errhandling &amp;
12466  MATH_ERREXCEPT is nonzero, the ''divide-by-zero'' floating-point exception is raised.
12467 <p><a name="7.12.1p4" href="#7.12.1p4"><small>4</small></a>
12468  Likewise, a range error occurs if the mathematical result of the function cannot be
12469  represented in an object of the specified type, due to extreme magnitude.
12470 <p><a name="7.12.1p5" href="#7.12.1p5"><small>5</small></a>
12471  A floating result overflows if the magnitude of the mathematical result is finite but so
12472  large that the mathematical result cannot be represented without extraordinary roundoff
12473  error in an object of the specified type. If a floating result overflows and default rounding
12474  is in effect, then the function returns the value of the macro HUGE_VAL, HUGE_VALF, or
12475  HUGE_VALL according to the return type, with the same sign as the correct value of the
12476  function; if the integer expression math_errhandling &amp; MATH_ERRNO is nonzero,
12477  the integer expression errno acquires the value ERANGE; if the integer expression
12478  math_errhandling &amp; MATH_ERREXCEPT is nonzero, the ''overflow'' floating-
12479  point exception is raised.
12480 <p><a name="7.12.1p6" href="#7.12.1p6"><small>6</small></a>
12481  The result underflows if the magnitude of the mathematical result is so small that the
12482  mathematical result cannot be represented, without extraordinary roundoff error, in an
12483  object of the specified type.<sup><a href="#note232"><b>232)</b></a></sup> If the result underflows, the function returns an
12484  implementation-defined value whose magnitude is no greater than the smallest
12485  normalized positive number in the specified type; if the integer expression
12486  math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
12487  value    ERANGE       is    implementation-defined;     if   the  integer   expression
12488  math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
12489  floating-point exception is raised is implementation-defined.
12490 <p><a name="7.12.1p7" href="#7.12.1p7"><small>7</small></a>
12491  If a domain, pole, or range error occurs and the integer expression
12492  math_errhandling &amp; MATH_ERRNO is zero,<sup><a href="#note233"><b>233)</b></a></sup> then errno shall either be set to
12493  the value corresponding to the error or left unmodified. If no such error occurs, errno
12494  shall be left unmodified regardless of the setting of math_errhandling.
12495  
12496  
12497  
12498  
12499 <!--page 253 -->
12500
12501 <p><b>Footnotes</b>
12502 <p><small><a name="note231" href="#note231">231)</a> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
12503  error if the mathematical domain of the function does not include the infinity.
12504 </small>
12505 <p><small><a name="note232" href="#note232">232)</a> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
12506  also ''flush-to-zero'' underflow.
12507 </small>
12508 <p><small><a name="note233" href="#note233">233)</a> Math errors are being indicated by the floating-point exception flags rather than by errno.
12509 </small>
12510
12511 <p><small><a href="#Contents">Contents</a></small>
12512 <h4><a name="7.12.2" href="#7.12.2">7.12.2 The FP_CONTRACT pragma</a></h4>
12513 <p><b>Synopsis</b>
12514 <p><a name="7.12.2p1" href="#7.12.2p1"><small>1</small></a>
12515 <pre>
12516           #include <a href="#7.12">&lt;math.h&gt;</a>
12517           #pragma STDC FP_CONTRACT on-off-switch
12518 </pre>
12519 <p><b>Description</b>
12520 <p><a name="7.12.2p2" href="#7.12.2p2"><small>2</small></a>
12521  The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
12522  state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
12523  either outside external declarations or preceding all explicit declarations and statements
12524  inside a compound statement. When outside external declarations, the pragma takes
12525  effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
12526  the end of the translation unit. When inside a compound statement, the pragma takes
12527  effect from its occurrence until another FP_CONTRACT pragma is encountered
12528  (including within a nested compound statement), or until the end of the compound
12529  statement; at the end of a compound statement the state for the pragma is restored to its
12530  condition just before the compound statement. If this pragma is used in any other
12531  context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
12532  implementation-defined.
12533
12534 <p><small><a href="#Contents">Contents</a></small>
12535 <h4><a name="7.12.3" href="#7.12.3">7.12.3 Classification macros</a></h4>
12536 <p><a name="7.12.3p1" href="#7.12.3p1"><small>1</small></a>
12537  In the synopses in this subclause, real-floating indicates that the argument shall be an
12538  expression of real floating type.
12539
12540 <p><small><a href="#Contents">Contents</a></small>
12541 <h5><a name="7.12.3.1" href="#7.12.3.1">7.12.3.1 The fpclassify macro</a></h5>
12542 <p><b>Synopsis</b>
12543 <p><a name="7.12.3.1p1" href="#7.12.3.1p1"><small>1</small></a>
12544 <pre>
12545           #include <a href="#7.12">&lt;math.h&gt;</a>
12546           int fpclassify(real-floating x);
12547 </pre>
12548 <p><b>Description</b>
12549 <p><a name="7.12.3.1p2" href="#7.12.3.1p2"><small>2</small></a>
12550  The fpclassify macro classifies its argument value as NaN, infinite, normal,
12551  subnormal, zero, or into another implementation-defined category. First, an argument
12552  represented in a format wider than its semantic type is converted to its semantic type.
12553  Then classification is based on the type of the argument.<sup><a href="#note234"><b>234)</b></a></sup>
12554 <p><b>Returns</b>
12555 <p><a name="7.12.3.1p3" href="#7.12.3.1p3"><small>3</small></a>
12556  The fpclassify macro returns the value of the number classification macro
12557  appropriate to the value of its argument.
12558  
12559  
12560 <!--page 254 -->
12561
12562 <p><b>Footnotes</b>
12563 <p><small><a name="note234" href="#note234">234)</a> Since an expression can be evaluated with more range and precision than its type has, it is important to
12564  know the type that classification is based on. For example, a normal long double value might
12565  become subnormal when converted to double, and zero when converted to float.
12566 </small>
12567
12568 <p><small><a href="#Contents">Contents</a></small>
12569 <h5><a name="7.12.3.2" href="#7.12.3.2">7.12.3.2 The isfinite macro</a></h5>
12570 <p><b>Synopsis</b>
12571 <p><a name="7.12.3.2p1" href="#7.12.3.2p1"><small>1</small></a>
12572 <pre>
12573          #include <a href="#7.12">&lt;math.h&gt;</a>
12574          int isfinite(real-floating x);
12575 </pre>
12576 <p><b>Description</b>
12577 <p><a name="7.12.3.2p2" href="#7.12.3.2p2"><small>2</small></a>
12578  The isfinite macro determines whether its argument has a finite value (zero,
12579  subnormal, or normal, and not infinite or NaN). First, an argument represented in a
12580  format wider than its semantic type is converted to its semantic type. Then determination
12581  is based on the type of the argument.
12582 <p><b>Returns</b>
12583 <p><a name="7.12.3.2p3" href="#7.12.3.2p3"><small>3</small></a>
12584  The isfinite macro returns a nonzero value if and only if its argument has a finite
12585  value.
12586
12587 <p><small><a href="#Contents">Contents</a></small>
12588 <h5><a name="7.12.3.3" href="#7.12.3.3">7.12.3.3 The isinf macro</a></h5>
12589 <p><b>Synopsis</b>
12590 <p><a name="7.12.3.3p1" href="#7.12.3.3p1"><small>1</small></a>
12591 <pre>
12592          #include <a href="#7.12">&lt;math.h&gt;</a>
12593          int isinf(real-floating x);
12594 </pre>
12595 <p><b>Description</b>
12596 <p><a name="7.12.3.3p2" href="#7.12.3.3p2"><small>2</small></a>
12597  The isinf macro determines whether its argument value is an infinity (positive or
12598  negative). First, an argument represented in a format wider than its semantic type is
12599  converted to its semantic type. Then determination is based on the type of the argument.
12600 <p><b>Returns</b>
12601 <p><a name="7.12.3.3p3" href="#7.12.3.3p3"><small>3</small></a>
12602  The isinf macro returns a nonzero value if and only if its argument has an infinite
12603  value.
12604
12605 <p><small><a href="#Contents">Contents</a></small>
12606 <h5><a name="7.12.3.4" href="#7.12.3.4">7.12.3.4 The isnan macro</a></h5>
12607 <p><b>Synopsis</b>
12608 <p><a name="7.12.3.4p1" href="#7.12.3.4p1"><small>1</small></a>
12609 <pre>
12610          #include <a href="#7.12">&lt;math.h&gt;</a>
12611          int isnan(real-floating x);
12612 </pre>
12613 <p><b>Description</b>
12614 <p><a name="7.12.3.4p2" href="#7.12.3.4p2"><small>2</small></a>
12615  The isnan macro determines whether its argument value is a NaN. First, an argument
12616  represented in a format wider than its semantic type is converted to its semantic type.
12617  Then determination is based on the type of the argument.<sup><a href="#note235"><b>235)</b></a></sup>
12618  
12619  
12620 <!--page 255 -->
12621 <p><b>Returns</b>
12622 <p><a name="7.12.3.4p3" href="#7.12.3.4p3"><small>3</small></a>
12623  The isnan macro returns a nonzero value if and only if its argument has a NaN value.
12624
12625 <p><b>Footnotes</b>
12626 <p><small><a name="note235" href="#note235">235)</a> For the isnan macro, the type for determination does not matter unless the implementation supports
12627  NaNs in the evaluation type but not in the semantic type.
12628 </small>
12629
12630 <p><small><a href="#Contents">Contents</a></small>
12631 <h5><a name="7.12.3.5" href="#7.12.3.5">7.12.3.5 The isnormal macro</a></h5>
12632 <p><b>Synopsis</b>
12633 <p><a name="7.12.3.5p1" href="#7.12.3.5p1"><small>1</small></a>
12634 <pre>
12635          #include <a href="#7.12">&lt;math.h&gt;</a>
12636          int isnormal(real-floating x);
12637 </pre>
12638 <p><b>Description</b>
12639 <p><a name="7.12.3.5p2" href="#7.12.3.5p2"><small>2</small></a>
12640  The isnormal macro determines whether its argument value is normal (neither zero,
12641  subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
12642  semantic type is converted to its semantic type. Then determination is based on the type
12643  of the argument.
12644 <p><b>Returns</b>
12645 <p><a name="7.12.3.5p3" href="#7.12.3.5p3"><small>3</small></a>
12646  The isnormal macro returns a nonzero value if and only if its argument has a normal
12647  value.
12648
12649 <p><small><a href="#Contents">Contents</a></small>
12650 <h5><a name="7.12.3.6" href="#7.12.3.6">7.12.3.6 The signbit macro</a></h5>
12651 <p><b>Synopsis</b>
12652 <p><a name="7.12.3.6p1" href="#7.12.3.6p1"><small>1</small></a>
12653 <pre>
12654          #include <a href="#7.12">&lt;math.h&gt;</a>
12655          int signbit(real-floating x);
12656 </pre>
12657 <p><b>Description</b>
12658 <p><a name="7.12.3.6p2" href="#7.12.3.6p2"><small>2</small></a>
12659  The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note236"><b>236)</b></a></sup>
12660 <p><b>Returns</b>
12661 <p><a name="7.12.3.6p3" href="#7.12.3.6p3"><small>3</small></a>
12662  The signbit macro returns a nonzero value if and only if the sign of its argument value
12663  is negative.
12664  
12665  
12666  
12667  
12668 <!--page 256 -->
12669
12670 <p><b>Footnotes</b>
12671 <p><small><a name="note236" href="#note236">236)</a> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
12672  unsigned, it is treated as positive.
12673 </small>
12674
12675 <p><small><a href="#Contents">Contents</a></small>
12676 <h4><a name="7.12.4" href="#7.12.4">7.12.4 Trigonometric functions</a></h4>
12677
12678 <p><small><a href="#Contents">Contents</a></small>
12679 <h5><a name="7.12.4.1" href="#7.12.4.1">7.12.4.1 The acos functions</a></h5>
12680 <p><b>Synopsis</b>
12681 <p><a name="7.12.4.1p1" href="#7.12.4.1p1"><small>1</small></a>
12682 <pre>
12683         #include <a href="#7.12">&lt;math.h&gt;</a>
12684         double acos(double x);
12685         float acosf(float x);
12686         long double acosl(long double x);
12687 </pre>
12688 <p><b>Description</b>
12689 <p><a name="7.12.4.1p2" href="#7.12.4.1p2"><small>2</small></a>
12690  The acos functions compute the principal value of the arc cosine of x. A domain error
12691  occurs for arguments not in the interval [-1, +1].
12692 <p><b>Returns</b>
12693 <p><a name="7.12.4.1p3" href="#7.12.4.1p3"><small>3</small></a>
12694  The acos functions return arccos x in the interval [0, pi ] radians.
12695
12696 <p><small><a href="#Contents">Contents</a></small>
12697 <h5><a name="7.12.4.2" href="#7.12.4.2">7.12.4.2 The asin functions</a></h5>
12698 <p><b>Synopsis</b>
12699 <p><a name="7.12.4.2p1" href="#7.12.4.2p1"><small>1</small></a>
12700 <pre>
12701         #include <a href="#7.12">&lt;math.h&gt;</a>
12702         double asin(double x);
12703         float asinf(float x);
12704         long double asinl(long double x);
12705 </pre>
12706 <p><b>Description</b>
12707 <p><a name="7.12.4.2p2" href="#7.12.4.2p2"><small>2</small></a>
12708  The asin functions compute the principal value of the arc sine of x. A domain error
12709  occurs for arguments not in the interval [-1, +1].
12710 <p><b>Returns</b>
12711 <p><a name="7.12.4.2p3" href="#7.12.4.2p3"><small>3</small></a>
12712  The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
12713
12714 <p><small><a href="#Contents">Contents</a></small>
12715 <h5><a name="7.12.4.3" href="#7.12.4.3">7.12.4.3 The atan functions</a></h5>
12716 <p><b>Synopsis</b>
12717 <p><a name="7.12.4.3p1" href="#7.12.4.3p1"><small>1</small></a>
12718 <pre>
12719         #include <a href="#7.12">&lt;math.h&gt;</a>
12720         double atan(double x);
12721         float atanf(float x);
12722         long double atanl(long double x);
12723 </pre>
12724 <p><b>Description</b>
12725 <p><a name="7.12.4.3p2" href="#7.12.4.3p2"><small>2</small></a>
12726  The atan functions compute the principal value of the arc tangent of x.
12727 <!--page 257 -->
12728 <p><b>Returns</b>
12729 <p><a name="7.12.4.3p3" href="#7.12.4.3p3"><small>3</small></a>
12730  The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
12731
12732 <p><small><a href="#Contents">Contents</a></small>
12733 <h5><a name="7.12.4.4" href="#7.12.4.4">7.12.4.4 The atan2 functions</a></h5>
12734 <p><b>Synopsis</b>
12735 <p><a name="7.12.4.4p1" href="#7.12.4.4p1"><small>1</small></a>
12736 <pre>
12737          #include <a href="#7.12">&lt;math.h&gt;</a>
12738          double atan2(double y, double x);
12739          float atan2f(float y, float x);
12740          long double atan2l(long double y, long double x);
12741 </pre>
12742 <p><b>Description</b>
12743 <p><a name="7.12.4.4p2" href="#7.12.4.4p2"><small>2</small></a>
12744  The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
12745  arguments to determine the quadrant of the return value. A domain error may occur if
12746  both arguments are zero.
12747 <p><b>Returns</b>
12748 <p><a name="7.12.4.4p3" href="#7.12.4.4p3"><small>3</small></a>
12749  The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
12750
12751 <p><small><a href="#Contents">Contents</a></small>
12752 <h5><a name="7.12.4.5" href="#7.12.4.5">7.12.4.5 The cos functions</a></h5>
12753 <p><b>Synopsis</b>
12754 <p><a name="7.12.4.5p1" href="#7.12.4.5p1"><small>1</small></a>
12755 <pre>
12756          #include <a href="#7.12">&lt;math.h&gt;</a>
12757          double cos(double x);
12758          float cosf(float x);
12759          long double cosl(long double x);
12760 </pre>
12761 <p><b>Description</b>
12762 <p><a name="7.12.4.5p2" href="#7.12.4.5p2"><small>2</small></a>
12763  The cos functions compute the cosine of x (measured in radians).
12764 <p><b>Returns</b>
12765 <p><a name="7.12.4.5p3" href="#7.12.4.5p3"><small>3</small></a>
12766  The cos functions return cos x.
12767
12768 <p><small><a href="#Contents">Contents</a></small>
12769 <h5><a name="7.12.4.6" href="#7.12.4.6">7.12.4.6 The sin functions</a></h5>
12770 <p><b>Synopsis</b>
12771 <p><a name="7.12.4.6p1" href="#7.12.4.6p1"><small>1</small></a>
12772 <pre>
12773          #include <a href="#7.12">&lt;math.h&gt;</a>
12774          double sin(double x);
12775          float sinf(float x);
12776          long double sinl(long double x);
12777 </pre>
12778 <p><b>Description</b>
12779 <p><a name="7.12.4.6p2" href="#7.12.4.6p2"><small>2</small></a>
12780  The sin functions compute the sine of x (measured in radians).
12781 <!--page 258 -->
12782 <p><b>Returns</b>
12783 <p><a name="7.12.4.6p3" href="#7.12.4.6p3"><small>3</small></a>
12784  The sin functions return sin x.
12785
12786 <p><small><a href="#Contents">Contents</a></small>
12787 <h5><a name="7.12.4.7" href="#7.12.4.7">7.12.4.7 The tan functions</a></h5>
12788 <p><b>Synopsis</b>
12789 <p><a name="7.12.4.7p1" href="#7.12.4.7p1"><small>1</small></a>
12790 <pre>
12791         #include <a href="#7.12">&lt;math.h&gt;</a>
12792         double tan(double x);
12793         float tanf(float x);
12794         long double tanl(long double x);
12795 </pre>
12796 <p><b>Description</b>
12797 <p><a name="7.12.4.7p2" href="#7.12.4.7p2"><small>2</small></a>
12798  The tan functions return the tangent of x (measured in radians).
12799 <p><b>Returns</b>
12800 <p><a name="7.12.4.7p3" href="#7.12.4.7p3"><small>3</small></a>
12801  The tan functions return tan x.
12802
12803 <p><small><a href="#Contents">Contents</a></small>
12804 <h4><a name="7.12.5" href="#7.12.5">7.12.5 Hyperbolic functions</a></h4>
12805
12806 <p><small><a href="#Contents">Contents</a></small>
12807 <h5><a name="7.12.5.1" href="#7.12.5.1">7.12.5.1 The acosh functions</a></h5>
12808 <p><b>Synopsis</b>
12809 <p><a name="7.12.5.1p1" href="#7.12.5.1p1"><small>1</small></a>
12810 <pre>
12811         #include <a href="#7.12">&lt;math.h&gt;</a>
12812         double acosh(double x);
12813         float acoshf(float x);
12814         long double acoshl(long double x);
12815 </pre>
12816 <p><b>Description</b>
12817 <p><a name="7.12.5.1p2" href="#7.12.5.1p2"><small>2</small></a>
12818  The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
12819  error occurs for arguments less than 1.
12820 <p><b>Returns</b>
12821 <p><a name="7.12.5.1p3" href="#7.12.5.1p3"><small>3</small></a>
12822  The acosh functions return arcosh x in the interval [0, +(inf)].
12823
12824 <p><small><a href="#Contents">Contents</a></small>
12825 <h5><a name="7.12.5.2" href="#7.12.5.2">7.12.5.2 The asinh functions</a></h5>
12826 <p><b>Synopsis</b>
12827 <p><a name="7.12.5.2p1" href="#7.12.5.2p1"><small>1</small></a>
12828 <pre>
12829         #include <a href="#7.12">&lt;math.h&gt;</a>
12830         double asinh(double x);
12831         float asinhf(float x);
12832         long double asinhl(long double x);
12833 </pre>
12834 <p><b>Description</b>
12835 <p><a name="7.12.5.2p2" href="#7.12.5.2p2"><small>2</small></a>
12836  The asinh functions compute the arc hyperbolic sine of x.
12837 <!--page 259 -->
12838 <p><b>Returns</b>
12839 <p><a name="7.12.5.2p3" href="#7.12.5.2p3"><small>3</small></a>
12840  The asinh functions return arsinh x.
12841
12842 <p><small><a href="#Contents">Contents</a></small>
12843 <h5><a name="7.12.5.3" href="#7.12.5.3">7.12.5.3 The atanh functions</a></h5>
12844 <p><b>Synopsis</b>
12845 <p><a name="7.12.5.3p1" href="#7.12.5.3p1"><small>1</small></a>
12846 <pre>
12847          #include <a href="#7.12">&lt;math.h&gt;</a>
12848          double atanh(double x);
12849          float atanhf(float x);
12850          long double atanhl(long double x);
12851 </pre>
12852 <p><b>Description</b>
12853 <p><a name="7.12.5.3p2" href="#7.12.5.3p2"><small>2</small></a>
12854  The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
12855  for arguments not in the interval [-1, +1]. A pole error may occur if the argument equals
12856  -1 or +1.
12857 <p><b>Returns</b>
12858 <p><a name="7.12.5.3p3" href="#7.12.5.3p3"><small>3</small></a>
12859  The atanh functions return artanh x.
12860
12861 <p><small><a href="#Contents">Contents</a></small>
12862 <h5><a name="7.12.5.4" href="#7.12.5.4">7.12.5.4 The cosh functions</a></h5>
12863 <p><b>Synopsis</b>
12864 <p><a name="7.12.5.4p1" href="#7.12.5.4p1"><small>1</small></a>
12865 <pre>
12866          #include <a href="#7.12">&lt;math.h&gt;</a>
12867          double cosh(double x);
12868          float coshf(float x);
12869          long double coshl(long double x);
12870 </pre>
12871 <p><b>Description</b>
12872 <p><a name="7.12.5.4p2" href="#7.12.5.4p2"><small>2</small></a>
12873  The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
12874  magnitude of x is too large.
12875 <p><b>Returns</b>
12876 <p><a name="7.12.5.4p3" href="#7.12.5.4p3"><small>3</small></a>
12877  The cosh functions return cosh x.
12878
12879 <p><small><a href="#Contents">Contents</a></small>
12880 <h5><a name="7.12.5.5" href="#7.12.5.5">7.12.5.5 The sinh functions</a></h5>
12881 <p><b>Synopsis</b>
12882 <p><a name="7.12.5.5p1" href="#7.12.5.5p1"><small>1</small></a>
12883 <pre>
12884          #include <a href="#7.12">&lt;math.h&gt;</a>
12885          double sinh(double x);
12886          float sinhf(float x);
12887          long double sinhl(long double x);
12888 </pre>
12889 <p><b>Description</b>
12890 <p><a name="7.12.5.5p2" href="#7.12.5.5p2"><small>2</small></a>
12891  The sinh functions compute the hyperbolic sine of x. A range error occurs if the
12892  magnitude of x is too large.
12893 <!--page 260 -->
12894 <p><b>Returns</b>
12895 <p><a name="7.12.5.5p3" href="#7.12.5.5p3"><small>3</small></a>
12896  The sinh functions return sinh x.
12897
12898 <p><small><a href="#Contents">Contents</a></small>
12899 <h5><a name="7.12.5.6" href="#7.12.5.6">7.12.5.6 The tanh functions</a></h5>
12900 <p><b>Synopsis</b>
12901 <p><a name="7.12.5.6p1" href="#7.12.5.6p1"><small>1</small></a>
12902 <pre>
12903         #include <a href="#7.12">&lt;math.h&gt;</a>
12904         double tanh(double x);
12905         float tanhf(float x);
12906         long double tanhl(long double x);
12907 </pre>
12908 <p><b>Description</b>
12909 <p><a name="7.12.5.6p2" href="#7.12.5.6p2"><small>2</small></a>
12910  The tanh functions compute the hyperbolic tangent of x.
12911 <p><b>Returns</b>
12912 <p><a name="7.12.5.6p3" href="#7.12.5.6p3"><small>3</small></a>
12913  The tanh functions return tanh x.
12914
12915 <p><small><a href="#Contents">Contents</a></small>
12916 <h4><a name="7.12.6" href="#7.12.6">7.12.6 Exponential and logarithmic functions</a></h4>
12917
12918 <p><small><a href="#Contents">Contents</a></small>
12919 <h5><a name="7.12.6.1" href="#7.12.6.1">7.12.6.1 The exp functions</a></h5>
12920 <p><b>Synopsis</b>
12921 <p><a name="7.12.6.1p1" href="#7.12.6.1p1"><small>1</small></a>
12922 <pre>
12923         #include <a href="#7.12">&lt;math.h&gt;</a>
12924         double exp(double x);
12925         float expf(float x);
12926         long double expl(long double x);
12927 </pre>
12928 <p><b>Description</b>
12929 <p><a name="7.12.6.1p2" href="#7.12.6.1p2"><small>2</small></a>
12930  The exp functions compute the base-e exponential of x. A range error occurs if the
12931  magnitude of x is too large.
12932 <p><b>Returns</b>
12933 <p><a name="7.12.6.1p3" href="#7.12.6.1p3"><small>3</small></a>
12934  The exp functions return ex .
12935
12936 <p><small><a href="#Contents">Contents</a></small>
12937 <h5><a name="7.12.6.2" href="#7.12.6.2">7.12.6.2 The exp2 functions</a></h5>
12938 <p><b>Synopsis</b>
12939 <p><a name="7.12.6.2p1" href="#7.12.6.2p1"><small>1</small></a>
12940 <pre>
12941         #include <a href="#7.12">&lt;math.h&gt;</a>
12942         double exp2(double x);
12943         float exp2f(float x);
12944         long double exp2l(long double x);
12945 </pre>
12946 <p><b>Description</b>
12947 <p><a name="7.12.6.2p2" href="#7.12.6.2p2"><small>2</small></a>
12948  The exp2 functions compute the base-2 exponential of x. A range error occurs if the
12949  magnitude of x is too large.
12950 <!--page 261 -->
12951 <p><b>Returns</b>
12952 <p><a name="7.12.6.2p3" href="#7.12.6.2p3"><small>3</small></a>
12953  The exp2 functions return 2x .
12954
12955 <p><small><a href="#Contents">Contents</a></small>
12956 <h5><a name="7.12.6.3" href="#7.12.6.3">7.12.6.3 The expm1 functions</a></h5>
12957 <p><b>Synopsis</b>
12958 <p><a name="7.12.6.3p1" href="#7.12.6.3p1"><small>1</small></a>
12959 <pre>
12960          #include <a href="#7.12">&lt;math.h&gt;</a>
12961          double expm1(double x);
12962          float expm1f(float x);
12963          long double expm1l(long double x);
12964 </pre>
12965 <p><b>Description</b>
12966 <p><a name="7.12.6.3p2" href="#7.12.6.3p2"><small>2</small></a>
12967  The expm1 functions compute the base-e exponential of the argument, minus 1. A range
12968  error occurs if x is too large.<sup><a href="#note237"><b>237)</b></a></sup>
12969 <p><b>Returns</b>
12970 <p><a name="7.12.6.3p3" href="#7.12.6.3p3"><small>3</small></a>
12971  The expm1 functions return ex - 1.
12972
12973 <p><b>Footnotes</b>
12974 <p><small><a name="note237" href="#note237">237)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
12975 </small>
12976
12977 <p><small><a href="#Contents">Contents</a></small>
12978 <h5><a name="7.12.6.4" href="#7.12.6.4">7.12.6.4 The frexp functions</a></h5>
12979 <p><b>Synopsis</b>
12980 <p><a name="7.12.6.4p1" href="#7.12.6.4p1"><small>1</small></a>
12981 <pre>
12982          #include <a href="#7.12">&lt;math.h&gt;</a>
12983          double frexp(double value, int *exp);
12984          float frexpf(float value, int *exp);
12985          long double frexpl(long double value, int *exp);
12986 </pre>
12987 <p><b>Description</b>
12988 <p><a name="7.12.6.4p2" href="#7.12.6.4p2"><small>2</small></a>
12989  The frexp functions break a floating-point number into a normalized fraction and an
12990  integral power of 2. They store the integer in the int object pointed to by exp.
12991 <p><b>Returns</b>
12992 <p><a name="7.12.6.4p3" href="#7.12.6.4p3"><small>3</small></a>
12993  If value is not a floating-point number or if the integral power of 2 is outside the range
12994  of int, the results are unspecified. Otherwise, the frexp functions return the value x,
12995  such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x x 2*exp .
12996  If value is zero, both parts of the result are zero.
12997  
12998  
12999  
13000  
13001 <!--page 262 -->
13002
13003 <p><small><a href="#Contents">Contents</a></small>
13004 <h5><a name="7.12.6.5" href="#7.12.6.5">7.12.6.5 The ilogb functions</a></h5>
13005 <p><b>Synopsis</b>
13006 <p><a name="7.12.6.5p1" href="#7.12.6.5p1"><small>1</small></a>
13007 <pre>
13008         #include <a href="#7.12">&lt;math.h&gt;</a>
13009         int ilogb(double x);
13010         int ilogbf(float x);
13011         int ilogbl(long double x);
13012 </pre>
13013 <p><b>Description</b>
13014 <p><a name="7.12.6.5p2" href="#7.12.6.5p2"><small>2</small></a>
13015  The ilogb functions extract the exponent of x as a signed int value. If x is zero they
13016  compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
13017  a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
13018  the corresponding logb function and casting the returned value to type int. A domain
13019  error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
13020  the range of the return type, the numeric result is unspecified.
13021 <p><b>Returns</b>
13022 <p><a name="7.12.6.5p3" href="#7.12.6.5p3"><small>3</small></a>
13023  The ilogb functions return the exponent of x as a signed int value.
13024 <p><b> Forward references</b>: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
13025
13026 <p><small><a href="#Contents">Contents</a></small>
13027 <h5><a name="7.12.6.6" href="#7.12.6.6">7.12.6.6 The ldexp functions</a></h5>
13028 <p><b>Synopsis</b>
13029 <p><a name="7.12.6.6p1" href="#7.12.6.6p1"><small>1</small></a>
13030 <pre>
13031         #include <a href="#7.12">&lt;math.h&gt;</a>
13032         double ldexp(double x, int exp);
13033         float ldexpf(float x, int exp);
13034         long double ldexpl(long double x, int exp);
13035 </pre>
13036 <p><b>Description</b>
13037 <p><a name="7.12.6.6p2" href="#7.12.6.6p2"><small>2</small></a>
13038  The ldexp functions multiply a floating-point number by an integral power of 2. A
13039  range error may occur.
13040 <p><b>Returns</b>
13041 <p><a name="7.12.6.6p3" href="#7.12.6.6p3"><small>3</small></a>
13042  The ldexp functions return x x 2exp .
13043
13044 <p><small><a href="#Contents">Contents</a></small>
13045 <h5><a name="7.12.6.7" href="#7.12.6.7">7.12.6.7 The log functions</a></h5>
13046 <p><b>Synopsis</b>
13047 <p><a name="7.12.6.7p1" href="#7.12.6.7p1"><small>1</small></a>
13048 <!--page 263 -->
13049 <pre>
13050         #include <a href="#7.12">&lt;math.h&gt;</a>
13051         double log(double x);
13052         float logf(float x);
13053         long double logl(long double x);
13054 </pre>
13055 <p><b>Description</b>
13056 <p><a name="7.12.6.7p2" href="#7.12.6.7p2"><small>2</small></a>
13057  The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
13058  the argument is negative. A pole error may occur if the argument is zero.
13059 <p><b>Returns</b>
13060 <p><a name="7.12.6.7p3" href="#7.12.6.7p3"><small>3</small></a>
13061  The log functions return loge x.
13062
13063 <p><small><a href="#Contents">Contents</a></small>
13064 <h5><a name="7.12.6.8" href="#7.12.6.8">7.12.6.8 The log10 functions</a></h5>
13065 <p><b>Synopsis</b>
13066 <p><a name="7.12.6.8p1" href="#7.12.6.8p1"><small>1</small></a>
13067 <pre>
13068          #include <a href="#7.12">&lt;math.h&gt;</a>
13069          double log10(double x);
13070          float log10f(float x);
13071          long double log10l(long double x);
13072 </pre>
13073 <p><b>Description</b>
13074 <p><a name="7.12.6.8p2" href="#7.12.6.8p2"><small>2</small></a>
13075  The log10 functions compute the base-10 (common) logarithm of x. A domain error
13076  occurs if the argument is negative. A pole error may occur if the argument is zero.
13077 <p><b>Returns</b>
13078 <p><a name="7.12.6.8p3" href="#7.12.6.8p3"><small>3</small></a>
13079  The log10 functions return log10 x.
13080
13081 <p><small><a href="#Contents">Contents</a></small>
13082 <h5><a name="7.12.6.9" href="#7.12.6.9">7.12.6.9 The log1p functions</a></h5>
13083 <p><b>Synopsis</b>
13084 <p><a name="7.12.6.9p1" href="#7.12.6.9p1"><small>1</small></a>
13085 <pre>
13086          #include <a href="#7.12">&lt;math.h&gt;</a>
13087          double log1p(double x);
13088          float log1pf(float x);
13089          long double log1pl(long double x);
13090 </pre>
13091 <p><b>Description</b>
13092 <p><a name="7.12.6.9p2" href="#7.12.6.9p2"><small>2</small></a>
13093  The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note238"><b>238)</b></a></sup>
13094  A domain error occurs if the argument is less than -1. A pole error may occur if the
13095  argument equals -1.
13096 <p><b>Returns</b>
13097 <p><a name="7.12.6.9p3" href="#7.12.6.9p3"><small>3</small></a>
13098  The log1p functions return loge (1 + x).
13099  
13100  
13101  
13102  
13103 <!--page 264 -->
13104
13105 <p><b>Footnotes</b>
13106 <p><small><a name="note238" href="#note238">238)</a> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
13107 </small>
13108
13109 <p><small><a href="#Contents">Contents</a></small>
13110 <h5><a name="7.12.6.10" href="#7.12.6.10">7.12.6.10 The log2 functions</a></h5>
13111 <p><b>Synopsis</b>
13112 <p><a name="7.12.6.10p1" href="#7.12.6.10p1"><small>1</small></a>
13113 <pre>
13114         #include <a href="#7.12">&lt;math.h&gt;</a>
13115         double log2(double x);
13116         float log2f(float x);
13117         long double log2l(long double x);
13118 </pre>
13119 <p><b>Description</b>
13120 <p><a name="7.12.6.10p2" href="#7.12.6.10p2"><small>2</small></a>
13121  The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
13122  argument is less than zero. A pole error may occur if the argument is zero.
13123 <p><b>Returns</b>
13124 <p><a name="7.12.6.10p3" href="#7.12.6.10p3"><small>3</small></a>
13125  The log2 functions return log2 x.
13126
13127 <p><small><a href="#Contents">Contents</a></small>
13128 <h5><a name="7.12.6.11" href="#7.12.6.11">7.12.6.11 The logb functions</a></h5>
13129 <p><b>Synopsis</b>
13130 <p><a name="7.12.6.11p1" href="#7.12.6.11p1"><small>1</small></a>
13131 <pre>
13132         #include <a href="#7.12">&lt;math.h&gt;</a>
13133         double logb(double x);
13134         float logbf(float x);
13135         long double logbl(long double x);
13136 </pre>
13137 <p><b>Description</b>
13138 <p><a name="7.12.6.11p2" href="#7.12.6.11p2"><small>2</small></a>
13139  The logb functions extract the exponent of x, as a signed integer value in floating-point
13140  format. If x is subnormal it is treated as though it were normalized; thus, for positive
13141  finite x,
13142 <pre>
13143        1 &lt;= x x FLT_RADIX-logb(x) &lt; FLT_RADIX
13144 </pre>
13145  A domain error or pole error may occur if the argument is zero.
13146 <p><b>Returns</b>
13147 <p><a name="7.12.6.11p3" href="#7.12.6.11p3"><small>3</small></a>
13148  The logb functions return the signed exponent of x.
13149
13150 <p><small><a href="#Contents">Contents</a></small>
13151 <h5><a name="7.12.6.12" href="#7.12.6.12">7.12.6.12 The modf functions</a></h5>
13152 <p><b>Synopsis</b>
13153 <p><a name="7.12.6.12p1" href="#7.12.6.12p1"><small>1</small></a>
13154 <pre>
13155         #include <a href="#7.12">&lt;math.h&gt;</a>
13156         double modf(double value, double *iptr);
13157         float modff(float value, float *iptr);
13158         long double modfl(long double value, long double *iptr);
13159 </pre>
13160 <p><b>Description</b>
13161 <p><a name="7.12.6.12p2" href="#7.12.6.12p2"><small>2</small></a>
13162  The modf functions break the argument value into integral and fractional parts, each of
13163  which has the same type and sign as the argument. They store the integral part (in
13164 <!--page 265 -->
13165  floating-point format) in the object pointed to by iptr.
13166 <p><b>Returns</b>
13167 <p><a name="7.12.6.12p3" href="#7.12.6.12p3"><small>3</small></a>
13168  The modf functions return the signed fractional part of value.
13169
13170 <p><small><a href="#Contents">Contents</a></small>
13171 <h5><a name="7.12.6.13" href="#7.12.6.13">7.12.6.13 The scalbn and scalbln functions</a></h5>
13172 <p><b>Synopsis</b>
13173 <p><a name="7.12.6.13p1" href="#7.12.6.13p1"><small>1</small></a>
13174 <pre>
13175          #include <a href="#7.12">&lt;math.h&gt;</a>
13176          double scalbn(double x, int n);
13177          float scalbnf(float x, int n);
13178          long double scalbnl(long double x, int n);
13179          double scalbln(double x, long int n);
13180          float scalblnf(float x, long int n);
13181          long double scalblnl(long double x, long int n);
13182 </pre>
13183 <p><b>Description</b>
13184 <p><a name="7.12.6.13p2" href="#7.12.6.13p2"><small>2</small></a>
13185  The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
13186  normally by computing FLT_RADIXn explicitly. A range error may occur.
13187 <p><b>Returns</b>
13188 <p><a name="7.12.6.13p3" href="#7.12.6.13p3"><small>3</small></a>
13189  The scalbn and scalbln functions return x x FLT_RADIXn .
13190
13191 <p><small><a href="#Contents">Contents</a></small>
13192 <h4><a name="7.12.7" href="#7.12.7">7.12.7 Power and absolute-value functions</a></h4>
13193
13194 <p><small><a href="#Contents">Contents</a></small>
13195 <h5><a name="7.12.7.1" href="#7.12.7.1">7.12.7.1 The cbrt functions</a></h5>
13196 <p><b>Synopsis</b>
13197 <p><a name="7.12.7.1p1" href="#7.12.7.1p1"><small>1</small></a>
13198 <pre>
13199          #include <a href="#7.12">&lt;math.h&gt;</a>
13200          double cbrt(double x);
13201          float cbrtf(float x);
13202          long double cbrtl(long double x);
13203 </pre>
13204 <p><b>Description</b>
13205 <p><a name="7.12.7.1p2" href="#7.12.7.1p2"><small>2</small></a>
13206  The cbrt functions compute the real cube root of x.
13207 <p><b>Returns</b>
13208 <p><a name="7.12.7.1p3" href="#7.12.7.1p3"><small>3</small></a>
13209  The cbrt functions return x1/3 .
13210 <!--page 266 -->
13211
13212 <p><small><a href="#Contents">Contents</a></small>
13213 <h5><a name="7.12.7.2" href="#7.12.7.2">7.12.7.2 The fabs functions</a></h5>
13214 <p><b>Synopsis</b>
13215 <p><a name="7.12.7.2p1" href="#7.12.7.2p1"><small>1</small></a>
13216 <pre>
13217         #include <a href="#7.12">&lt;math.h&gt;</a>
13218         double fabs(double x);
13219         float fabsf(float x);
13220         long double fabsl(long double x);
13221 </pre>
13222 <p><b>Description</b>
13223 <p><a name="7.12.7.2p2" href="#7.12.7.2p2"><small>2</small></a>
13224  The fabs functions compute the absolute value of a floating-point number x.
13225 <p><b>Returns</b>
13226 <p><a name="7.12.7.2p3" href="#7.12.7.2p3"><small>3</small></a>
13227  The fabs functions return | x |.
13228
13229 <p><small><a href="#Contents">Contents</a></small>
13230 <h5><a name="7.12.7.3" href="#7.12.7.3">7.12.7.3 The hypot functions</a></h5>
13231 <p><b>Synopsis</b>
13232 <p><a name="7.12.7.3p1" href="#7.12.7.3p1"><small>1</small></a>
13233 <pre>
13234         #include <a href="#7.12">&lt;math.h&gt;</a>
13235         double hypot(double x, double y);
13236         float hypotf(float x, float y);
13237         long double hypotl(long double x, long double y);
13238 </pre>
13239 <p><b>Description</b>
13240 <p><a name="7.12.7.3p2" href="#7.12.7.3p2"><small>2</small></a>
13241  The hypot functions compute the square root of the sum of the squares of x and y,
13242  without undue overflow or underflow. A range error may occur.
13243 <p><a name="7.12.7.3p3" href="#7.12.7.3p3"><small>3</small></a>
13244 <p><b>Returns</b>
13245 <p><a name="7.12.7.3p4" href="#7.12.7.3p4"><small>4</small></a>
13246  The hypot functions return (sqrt)x2 + y2 .
13247 <pre>
13248                             -
13249                             -----
13250 </pre>
13251
13252 <p><small><a href="#Contents">Contents</a></small>
13253 <h5><a name="7.12.7.4" href="#7.12.7.4">7.12.7.4 The pow functions</a></h5>
13254 <p><b>Synopsis</b>
13255 <p><a name="7.12.7.4p1" href="#7.12.7.4p1"><small>1</small></a>
13256 <pre>
13257         #include <a href="#7.12">&lt;math.h&gt;</a>
13258         double pow(double x, double y);
13259         float powf(float x, float y);
13260         long double powl(long double x, long double y);
13261 </pre>
13262 <p><b>Description</b>
13263 <p><a name="7.12.7.4p2" href="#7.12.7.4p2"><small>2</small></a>
13264  The pow functions compute x raised to the power y. A domain error occurs if x is finite
13265  and negative and y is finite and not an integer value. A range error may occur. A domain
13266  error may occur if x is zero and y is zero. A domain error or pole error may occur if x is
13267  zero and y is less than zero.
13268 <!--page 267 -->
13269 <p><b>Returns</b>
13270 <p><a name="7.12.7.4p3" href="#7.12.7.4p3"><small>3</small></a>
13271  The pow functions return xy .
13272
13273 <p><small><a href="#Contents">Contents</a></small>
13274 <h5><a name="7.12.7.5" href="#7.12.7.5">7.12.7.5 The sqrt functions</a></h5>
13275 <p><b>Synopsis</b>
13276 <p><a name="7.12.7.5p1" href="#7.12.7.5p1"><small>1</small></a>
13277 <pre>
13278          #include <a href="#7.12">&lt;math.h&gt;</a>
13279          double sqrt(double x);
13280          float sqrtf(float x);
13281          long double sqrtl(long double x);
13282 </pre>
13283 <p><b>Description</b>
13284 <p><a name="7.12.7.5p2" href="#7.12.7.5p2"><small>2</small></a>
13285  The sqrt functions compute the nonnegative square root of x. A domain error occurs if
13286  the argument is less than zero.
13287 <p><b>Returns</b>
13288 <p><a name="7.12.7.5p3" href="#7.12.7.5p3"><small>3</small></a>
13289  The sqrt functions return (sqrt)x.
13290 <pre>
13291                            -
13292                            -
13293 </pre>
13294
13295 <p><small><a href="#Contents">Contents</a></small>
13296 <h4><a name="7.12.8" href="#7.12.8">7.12.8 Error and gamma functions</a></h4>
13297
13298 <p><small><a href="#Contents">Contents</a></small>
13299 <h5><a name="7.12.8.1" href="#7.12.8.1">7.12.8.1 The erf functions</a></h5>
13300 <p><b>Synopsis</b>
13301 <p><a name="7.12.8.1p1" href="#7.12.8.1p1"><small>1</small></a>
13302 <pre>
13303          #include <a href="#7.12">&lt;math.h&gt;</a>
13304          double erf(double x);
13305          float erff(float x);
13306          long double erfl(long double x);
13307 </pre>
13308 <p><b>Description</b>
13309 <p><a name="7.12.8.1p2" href="#7.12.8.1p2"><small>2</small></a>
13310  The erf functions compute the error function of x.
13311 <p><b>Returns</b>
13312 <p><a name="7.12.8.1p3" href="#7.12.8.1p3"><small>3</small></a>
13313 <pre>
13314                                     2        x
13315                                          (integral)       e-t dt.
13316                                                    2
13317 </pre>
13318  The erf functions return erf x =
13319 <pre>
13320                                     (sqrt)pi
13321                                     -
13322                                     -    0
13323 </pre>
13324  
13325
13326 <p><small><a href="#Contents">Contents</a></small>
13327 <h5><a name="7.12.8.2" href="#7.12.8.2">7.12.8.2 The erfc functions</a></h5>
13328 <p><b>Synopsis</b>
13329 <p><a name="7.12.8.2p1" href="#7.12.8.2p1"><small>1</small></a>
13330 <pre>
13331          #include <a href="#7.12">&lt;math.h&gt;</a>
13332          double erfc(double x);
13333          float erfcf(float x);
13334          long double erfcl(long double x);
13335 </pre>
13336 <p><b>Description</b>
13337 <p><a name="7.12.8.2p2" href="#7.12.8.2p2"><small>2</small></a>
13338  The erfc functions compute the complementary error function of x. A range error
13339  occurs if x is too large.
13340 <!--page 268 -->
13341 <p><b>Returns</b>
13342 <p><a name="7.12.8.2p3" href="#7.12.8.2p3"><small>3</small></a>
13343 <pre>
13344                                                      2       (inf)
13345                                                          (integral)       e-t dt.
13346                                                                    2
13347 </pre>
13348  The erfc functions return erfc x = 1 - erf x =
13349 <pre>
13350                                                   (sqrt)pi
13351                                                   -
13352                                                   -      x
13353 </pre>
13354  
13355
13356 <p><small><a href="#Contents">Contents</a></small>
13357 <h5><a name="7.12.8.3" href="#7.12.8.3">7.12.8.3 The lgamma functions</a></h5>
13358 <p><b>Synopsis</b>
13359 <p><a name="7.12.8.3p1" href="#7.12.8.3p1"><small>1</small></a>
13360 <pre>
13361         #include <a href="#7.12">&lt;math.h&gt;</a>
13362         double lgamma(double x);
13363         float lgammaf(float x);
13364         long double lgammal(long double x);
13365 </pre>
13366 <p><b>Description</b>
13367 <p><a name="7.12.8.3p2" href="#7.12.8.3p2"><small>2</small></a>
13368  The lgamma functions compute the natural logarithm of the absolute value of gamma of
13369  x. A range error occurs if x is too large. A pole error may occur if x is a negative integer
13370  or zero.
13371 <p><b>Returns</b>
13372 <p><a name="7.12.8.3p3" href="#7.12.8.3p3"><small>3</small></a>
13373  The lgamma functions return loge | (Gamma)(x) |.
13374
13375 <p><small><a href="#Contents">Contents</a></small>
13376 <h5><a name="7.12.8.4" href="#7.12.8.4">7.12.8.4 The tgamma functions</a></h5>
13377 <p><b>Synopsis</b>
13378 <p><a name="7.12.8.4p1" href="#7.12.8.4p1"><small>1</small></a>
13379 <pre>
13380         #include <a href="#7.12">&lt;math.h&gt;</a>
13381         double tgamma(double x);
13382         float tgammaf(float x);
13383         long double tgammal(long double x);
13384 </pre>
13385 <p><b>Description</b>
13386 <p><a name="7.12.8.4p2" href="#7.12.8.4p2"><small>2</small></a>
13387  The tgamma functions compute the gamma function of x. A domain error or pole error
13388  may occur if x is a negative integer or zero. A range error occurs if the magnitude of x is
13389  too large and may occur if the magnitude of x is too small.
13390 <p><b>Returns</b>
13391 <p><a name="7.12.8.4p3" href="#7.12.8.4p3"><small>3</small></a>
13392  The tgamma functions return (Gamma)(x).
13393 <!--page 269 -->
13394
13395 <p><small><a href="#Contents">Contents</a></small>
13396 <h4><a name="7.12.9" href="#7.12.9">7.12.9 Nearest integer functions</a></h4>
13397
13398 <p><small><a href="#Contents">Contents</a></small>
13399 <h5><a name="7.12.9.1" href="#7.12.9.1">7.12.9.1 The ceil functions</a></h5>
13400 <p><b>Synopsis</b>
13401 <p><a name="7.12.9.1p1" href="#7.12.9.1p1"><small>1</small></a>
13402 <pre>
13403          #include <a href="#7.12">&lt;math.h&gt;</a>
13404          double ceil(double x);
13405          float ceilf(float x);
13406          long double ceill(long double x);
13407 </pre>
13408 <p><b>Description</b>
13409 <p><a name="7.12.9.1p2" href="#7.12.9.1p2"><small>2</small></a>
13410  The ceil functions compute the smallest integer value not less than x.
13411 <p><b>Returns</b>
13412 <p><a name="7.12.9.1p3" href="#7.12.9.1p3"><small>3</small></a>
13413  The ceil functions return [^x^], expressed as a floating-point number.
13414
13415 <p><small><a href="#Contents">Contents</a></small>
13416 <h5><a name="7.12.9.2" href="#7.12.9.2">7.12.9.2 The floor functions</a></h5>
13417 <p><b>Synopsis</b>
13418 <p><a name="7.12.9.2p1" href="#7.12.9.2p1"><small>1</small></a>
13419 <pre>
13420          #include <a href="#7.12">&lt;math.h&gt;</a>
13421          double floor(double x);
13422          float floorf(float x);
13423          long double floorl(long double x);
13424 </pre>
13425 <p><b>Description</b>
13426 <p><a name="7.12.9.2p2" href="#7.12.9.2p2"><small>2</small></a>
13427  The floor functions compute the largest integer value not greater than x.
13428 <p><b>Returns</b>
13429 <p><a name="7.12.9.2p3" href="#7.12.9.2p3"><small>3</small></a>
13430  The floor functions return [_x_], expressed as a floating-point number.
13431
13432 <p><small><a href="#Contents">Contents</a></small>
13433 <h5><a name="7.12.9.3" href="#7.12.9.3">7.12.9.3 The nearbyint functions</a></h5>
13434 <p><b>Synopsis</b>
13435 <p><a name="7.12.9.3p1" href="#7.12.9.3p1"><small>1</small></a>
13436 <pre>
13437          #include <a href="#7.12">&lt;math.h&gt;</a>
13438          double nearbyint(double x);
13439          float nearbyintf(float x);
13440          long double nearbyintl(long double x);
13441 </pre>
13442 <p><b>Description</b>
13443 <p><a name="7.12.9.3p2" href="#7.12.9.3p2"><small>2</small></a>
13444  The nearbyint functions round their argument to an integer value in floating-point
13445  format, using the current rounding direction and without raising the ''inexact'' floating-
13446  point exception.
13447 <!--page 270 -->
13448 <p><b>Returns</b>
13449 <p><a name="7.12.9.3p3" href="#7.12.9.3p3"><small>3</small></a>
13450  The nearbyint functions return the rounded integer value.
13451
13452 <p><small><a href="#Contents">Contents</a></small>
13453 <h5><a name="7.12.9.4" href="#7.12.9.4">7.12.9.4 The rint functions</a></h5>
13454 <p><b>Synopsis</b>
13455 <p><a name="7.12.9.4p1" href="#7.12.9.4p1"><small>1</small></a>
13456 <pre>
13457         #include <a href="#7.12">&lt;math.h&gt;</a>
13458         double rint(double x);
13459         float rintf(float x);
13460         long double rintl(long double x);
13461 </pre>
13462 <p><b>Description</b>
13463 <p><a name="7.12.9.4p2" href="#7.12.9.4p2"><small>2</small></a>
13464  The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
13465  rint functions may raise the ''inexact'' floating-point exception if the result differs in
13466  value from the argument.
13467 <p><b>Returns</b>
13468 <p><a name="7.12.9.4p3" href="#7.12.9.4p3"><small>3</small></a>
13469  The rint functions return the rounded integer value.
13470
13471 <p><small><a href="#Contents">Contents</a></small>
13472 <h5><a name="7.12.9.5" href="#7.12.9.5">7.12.9.5 The lrint and llrint functions</a></h5>
13473 <p><b>Synopsis</b>
13474 <p><a name="7.12.9.5p1" href="#7.12.9.5p1"><small>1</small></a>
13475 <pre>
13476         #include <a href="#7.12">&lt;math.h&gt;</a>
13477         long int lrint(double x);
13478         long int lrintf(float x);
13479         long int lrintl(long double x);
13480         long long int llrint(double x);
13481         long long int llrintf(float x);
13482         long long int llrintl(long double x);
13483 </pre>
13484 <p><b>Description</b>
13485 <p><a name="7.12.9.5p2" href="#7.12.9.5p2"><small>2</small></a>
13486  The lrint and llrint functions round their argument to the nearest integer value,
13487  rounding according to the current rounding direction. If the rounded value is outside the
13488  range of the return type, the numeric result is unspecified and a domain error or range
13489  error may occur.
13490 <p><b>Returns</b>
13491 <p><a name="7.12.9.5p3" href="#7.12.9.5p3"><small>3</small></a>
13492  The lrint and llrint functions return the rounded integer value.
13493 <!--page 271 -->
13494
13495 <p><small><a href="#Contents">Contents</a></small>
13496 <h5><a name="7.12.9.6" href="#7.12.9.6">7.12.9.6 The round functions</a></h5>
13497 <p><b>Synopsis</b>
13498 <p><a name="7.12.9.6p1" href="#7.12.9.6p1"><small>1</small></a>
13499 <pre>
13500          #include <a href="#7.12">&lt;math.h&gt;</a>
13501          double round(double x);
13502          float roundf(float x);
13503          long double roundl(long double x);
13504 </pre>
13505 <p><b>Description</b>
13506 <p><a name="7.12.9.6p2" href="#7.12.9.6p2"><small>2</small></a>
13507  The round functions round their argument to the nearest integer value in floating-point
13508  format, rounding halfway cases away from zero, regardless of the current rounding
13509  direction.
13510 <p><b>Returns</b>
13511 <p><a name="7.12.9.6p3" href="#7.12.9.6p3"><small>3</small></a>
13512  The round functions return the rounded integer value.
13513
13514 <p><small><a href="#Contents">Contents</a></small>
13515 <h5><a name="7.12.9.7" href="#7.12.9.7">7.12.9.7 The lround and llround functions</a></h5>
13516 <p><b>Synopsis</b>
13517 <p><a name="7.12.9.7p1" href="#7.12.9.7p1"><small>1</small></a>
13518 <pre>
13519          #include <a href="#7.12">&lt;math.h&gt;</a>
13520          long int lround(double x);
13521          long int lroundf(float x);
13522          long int lroundl(long double x);
13523          long long int llround(double x);
13524          long long int llroundf(float x);
13525          long long int llroundl(long double x);
13526 </pre>
13527 <p><b>Description</b>
13528 <p><a name="7.12.9.7p2" href="#7.12.9.7p2"><small>2</small></a>
13529  The lround and llround functions round their argument to the nearest integer value,
13530  rounding halfway cases away from zero, regardless of the current rounding direction. If
13531  the rounded value is outside the range of the return type, the numeric result is unspecified
13532  and a domain error or range error may occur.
13533 <p><b>Returns</b>
13534 <p><a name="7.12.9.7p3" href="#7.12.9.7p3"><small>3</small></a>
13535  The lround and llround functions return the rounded integer value.
13536
13537 <p><small><a href="#Contents">Contents</a></small>
13538 <h5><a name="7.12.9.8" href="#7.12.9.8">7.12.9.8 The trunc functions</a></h5>
13539 <p><b>Synopsis</b>
13540 <p><a name="7.12.9.8p1" href="#7.12.9.8p1"><small>1</small></a>
13541 <!--page 272 -->
13542 <pre>
13543          #include <a href="#7.12">&lt;math.h&gt;</a>
13544          double trunc(double x);
13545          float truncf(float x);
13546          long double truncl(long double x);
13547 </pre>
13548 <p><b>Description</b>
13549 <p><a name="7.12.9.8p2" href="#7.12.9.8p2"><small>2</small></a>
13550  The trunc functions round their argument to the integer value, in floating format,
13551  nearest to but no larger in magnitude than the argument.
13552 <p><b>Returns</b>
13553 <p><a name="7.12.9.8p3" href="#7.12.9.8p3"><small>3</small></a>
13554  The trunc functions return the truncated integer value.
13555
13556 <p><small><a href="#Contents">Contents</a></small>
13557 <h4><a name="7.12.10" href="#7.12.10">7.12.10 Remainder functions</a></h4>
13558
13559 <p><small><a href="#Contents">Contents</a></small>
13560 <h5><a name="7.12.10.1" href="#7.12.10.1">7.12.10.1 The fmod functions</a></h5>
13561 <p><b>Synopsis</b>
13562 <p><a name="7.12.10.1p1" href="#7.12.10.1p1"><small>1</small></a>
13563 <pre>
13564           #include <a href="#7.12">&lt;math.h&gt;</a>
13565           double fmod(double x, double y);
13566           float fmodf(float x, float y);
13567           long double fmodl(long double x, long double y);
13568 </pre>
13569 <p><b>Description</b>
13570 <p><a name="7.12.10.1p2" href="#7.12.10.1p2"><small>2</small></a>
13571  The fmod functions compute the floating-point remainder of x/y.
13572 <p><b>Returns</b>
13573 <p><a name="7.12.10.1p3" href="#7.12.10.1p3"><small>3</small></a>
13574  The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
13575  the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
13576  whether a domain error occurs or the fmod functions return zero is implementation-
13577  defined.
13578
13579 <p><small><a href="#Contents">Contents</a></small>
13580 <h5><a name="7.12.10.2" href="#7.12.10.2">7.12.10.2 The remainder functions</a></h5>
13581 <p><b>Synopsis</b>
13582 <p><a name="7.12.10.2p1" href="#7.12.10.2p1"><small>1</small></a>
13583 <pre>
13584           #include <a href="#7.12">&lt;math.h&gt;</a>
13585           double remainder(double x, double y);
13586           float remainderf(float x, float y);
13587           long double remainderl(long double x, long double y);
13588 </pre>
13589 <p><b>Description</b>
13590 <p><a name="7.12.10.2p2" href="#7.12.10.2p2"><small>2</small></a>
13591  The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note239"><b>239)</b></a></sup>
13592  
13593  
13594  
13595  
13596 <!--page 273 -->
13597 <p><b>Returns</b>
13598 <p><a name="7.12.10.2p3" href="#7.12.10.2p3"><small>3</small></a>
13599  The remainder functions return x REM y. If y is zero, whether a domain error occurs
13600  or the functions return zero is implementation defined.
13601
13602 <p><b>Footnotes</b>
13603 <p><small><a name="note239" href="#note239">239)</a> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
13604  mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
13605  | n - x/y | = 1/2, then n is even. If r = 0, its sign shall be that of x.'' This definition is applicable for
13606  all implementations.
13607 </small>
13608
13609 <p><small><a href="#Contents">Contents</a></small>
13610 <h5><a name="7.12.10.3" href="#7.12.10.3">7.12.10.3 The remquo functions</a></h5>
13611 <p><b>Synopsis</b>
13612 <p><a name="7.12.10.3p1" href="#7.12.10.3p1"><small>1</small></a>
13613 <pre>
13614          #include <a href="#7.12">&lt;math.h&gt;</a>
13615          double remquo(double x, double y, int *quo);
13616          float remquof(float x, float y, int *quo);
13617          long double remquol(long double x, long double y,
13618               int *quo);
13619 </pre>
13620 <p><b>Description</b>
13621 <p><a name="7.12.10.3p2" href="#7.12.10.3p2"><small>2</small></a>
13622  The remquo functions compute the same remainder as the remainder functions. In
13623  the object pointed to by quo they store a value whose sign is the sign of x/y and whose
13624  magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
13625  n is an implementation-defined integer greater than or equal to 3.
13626 <p><b>Returns</b>
13627 <p><a name="7.12.10.3p3" href="#7.12.10.3p3"><small>3</small></a>
13628  The remquo functions return x REM y. If y is zero, the value stored in the object
13629  pointed to by quo is unspecified and whether a domain error occurs or the functions
13630  return zero is implementation defined.
13631
13632 <p><small><a href="#Contents">Contents</a></small>
13633 <h4><a name="7.12.11" href="#7.12.11">7.12.11 Manipulation functions</a></h4>
13634
13635 <p><small><a href="#Contents">Contents</a></small>
13636 <h5><a name="7.12.11.1" href="#7.12.11.1">7.12.11.1 The copysign functions</a></h5>
13637 <p><b>Synopsis</b>
13638 <p><a name="7.12.11.1p1" href="#7.12.11.1p1"><small>1</small></a>
13639 <pre>
13640          #include <a href="#7.12">&lt;math.h&gt;</a>
13641          double copysign(double x, double y);
13642          float copysignf(float x, float y);
13643          long double copysignl(long double x, long double y);
13644 </pre>
13645 <p><b>Description</b>
13646 <p><a name="7.12.11.1p2" href="#7.12.11.1p2"><small>2</small></a>
13647  The copysign functions produce a value with the magnitude of x and the sign of y.
13648  They produce a NaN (with the sign of y) if x is a NaN. On implementations that
13649  represent a signed zero but do not treat negative zero consistently in arithmetic
13650  operations, the copysign functions regard the sign of zero as positive.
13651 <p><b>Returns</b>
13652 <p><a name="7.12.11.1p3" href="#7.12.11.1p3"><small>3</small></a>
13653  The copysign functions return a value with the magnitude of x and the sign of y.
13654 <!--page 274 -->
13655
13656 <p><small><a href="#Contents">Contents</a></small>
13657 <h5><a name="7.12.11.2" href="#7.12.11.2">7.12.11.2 The nan functions</a></h5>
13658 <p><b>Synopsis</b>
13659 <p><a name="7.12.11.2p1" href="#7.12.11.2p1"><small>1</small></a>
13660 <pre>
13661          #include <a href="#7.12">&lt;math.h&gt;</a>
13662          double nan(const char *tagp);
13663          float nanf(const char *tagp);
13664          long double nanl(const char *tagp);
13665 </pre>
13666 <p><b>Description</b>
13667 <p><a name="7.12.11.2p2" href="#7.12.11.2p2"><small>2</small></a>
13668  The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
13669  sequence)",     (char**)       NULL); the call nan("") is equivalent to
13670  strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
13671  sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
13672  NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
13673  and strtold.
13674 <p><b>Returns</b>
13675 <p><a name="7.12.11.2p3" href="#7.12.11.2p3"><small>3</small></a>
13676  The nan functions return a quiet NaN, if available, with content indicated through tagp.
13677  If the implementation does not support quiet NaNs, the functions return zero.
13678 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>).
13679
13680 <p><small><a href="#Contents">Contents</a></small>
13681 <h5><a name="7.12.11.3" href="#7.12.11.3">7.12.11.3 The nextafter functions</a></h5>
13682 <p><b>Synopsis</b>
13683 <p><a name="7.12.11.3p1" href="#7.12.11.3p1"><small>1</small></a>
13684 <pre>
13685          #include <a href="#7.12">&lt;math.h&gt;</a>
13686          double nextafter(double x, double y);
13687          float nextafterf(float x, float y);
13688          long double nextafterl(long double x, long double y);
13689 </pre>
13690 <p><b>Description</b>
13691 <p><a name="7.12.11.3p2" href="#7.12.11.3p2"><small>2</small></a>
13692  The nextafter functions determine the next representable value, in the type of the
13693  function, after x in the direction of y, where x and y are first converted to the type of the
13694  function.<sup><a href="#note240"><b>240)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
13695  if the magnitude of x is the largest finite value representable in the type and the result is
13696  infinite or not representable in the type.
13697 <p><b>Returns</b>
13698 <p><a name="7.12.11.3p3" href="#7.12.11.3p3"><small>3</small></a>
13699  The nextafter functions return the next representable value in the specified format
13700  after x in the direction of y.
13701  
13702  
13703 <!--page 275 -->
13704
13705 <p><b>Footnotes</b>
13706 <p><small><a name="note240" href="#note240">240)</a> The argument values are converted to the type of the function, even by a macro implementation of the
13707  function.
13708 </small>
13709
13710 <p><small><a href="#Contents">Contents</a></small>
13711 <h5><a name="7.12.11.4" href="#7.12.11.4">7.12.11.4 The nexttoward functions</a></h5>
13712 <p><b>Synopsis</b>
13713 <p><a name="7.12.11.4p1" href="#7.12.11.4p1"><small>1</small></a>
13714 <pre>
13715          #include <a href="#7.12">&lt;math.h&gt;</a>
13716          double nexttoward(double x, long double y);
13717          float nexttowardf(float x, long double y);
13718          long double nexttowardl(long double x, long double y);
13719 </pre>
13720 <p><b>Description</b>
13721 <p><a name="7.12.11.4p2" href="#7.12.11.4p2"><small>2</small></a>
13722  The nexttoward functions are equivalent to the nextafter functions except that the
13723  second parameter has type long double and the functions return y converted to the
13724  type of the function if x equals y.<sup><a href="#note241"><b>241)</b></a></sup>
13725
13726 <p><b>Footnotes</b>
13727 <p><small><a name="note241" href="#note241">241)</a> The result of the nexttoward functions is determined in the type of the function, without loss of
13728  range or precision in a floating second argument.
13729 </small>
13730
13731 <p><small><a href="#Contents">Contents</a></small>
13732 <h4><a name="7.12.12" href="#7.12.12">7.12.12 Maximum, minimum, and positive difference functions</a></h4>
13733
13734 <p><small><a href="#Contents">Contents</a></small>
13735 <h5><a name="7.12.12.1" href="#7.12.12.1">7.12.12.1 The fdim functions</a></h5>
13736 <p><b>Synopsis</b>
13737 <p><a name="7.12.12.1p1" href="#7.12.12.1p1"><small>1</small></a>
13738 <pre>
13739          #include <a href="#7.12">&lt;math.h&gt;</a>
13740          double fdim(double x, double y);
13741          float fdimf(float x, float y);
13742          long double fdiml(long double x, long double y);
13743 </pre>
13744 <p><b>Description</b>
13745 <p><a name="7.12.12.1p2" href="#7.12.12.1p2"><small>2</small></a>
13746  The fdim functions determine the positive difference between their arguments:
13747 <pre>
13748        {x - y if x &gt; y
13749        {
13750        {+0     if x &lt;= y
13751 </pre>
13752  A range error may occur.
13753 <p><b>Returns</b>
13754 <p><a name="7.12.12.1p3" href="#7.12.12.1p3"><small>3</small></a>
13755  The fdim functions return the positive difference value.
13756
13757 <p><small><a href="#Contents">Contents</a></small>
13758 <h5><a name="7.12.12.2" href="#7.12.12.2">7.12.12.2 The fmax functions</a></h5>
13759 <p><b>Synopsis</b>
13760 <p><a name="7.12.12.2p1" href="#7.12.12.2p1"><small>1</small></a>
13761 <pre>
13762          #include <a href="#7.12">&lt;math.h&gt;</a>
13763          double fmax(double x, double y);
13764          float fmaxf(float x, float y);
13765          long double fmaxl(long double x, long double y);
13766 </pre>
13767  
13768  
13769  
13770 <!--page 276 -->
13771 <p><b>Description</b>
13772 <p><a name="7.12.12.2p2" href="#7.12.12.2p2"><small>2</small></a>
13773  The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note242"><b>242)</b></a></sup>
13774 <p><b>Returns</b>
13775 <p><a name="7.12.12.2p3" href="#7.12.12.2p3"><small>3</small></a>
13776  The fmax functions return the maximum numeric value of their arguments.
13777
13778 <p><b>Footnotes</b>
13779 <p><small><a name="note242" href="#note242">242)</a> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
13780  fmax functions choose the numeric value. See <a href="#F.10.9.2">F.10.9.2</a>.
13781 </small>
13782
13783 <p><small><a href="#Contents">Contents</a></small>
13784 <h5><a name="7.12.12.3" href="#7.12.12.3">7.12.12.3 The fmin functions</a></h5>
13785 <p><b>Synopsis</b>
13786 <p><a name="7.12.12.3p1" href="#7.12.12.3p1"><small>1</small></a>
13787 <pre>
13788          #include <a href="#7.12">&lt;math.h&gt;</a>
13789          double fmin(double x, double y);
13790          float fminf(float x, float y);
13791          long double fminl(long double x, long double y);
13792 </pre>
13793 <p><b>Description</b>
13794 <p><a name="7.12.12.3p2" href="#7.12.12.3p2"><small>2</small></a>
13795  The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note243"><b>243)</b></a></sup>
13796 <p><b>Returns</b>
13797 <p><a name="7.12.12.3p3" href="#7.12.12.3p3"><small>3</small></a>
13798  The fmin functions return the minimum numeric value of their arguments.
13799
13800 <p><b>Footnotes</b>
13801 <p><small><a name="note243" href="#note243">243)</a> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
13802 </small>
13803
13804 <p><small><a href="#Contents">Contents</a></small>
13805 <h4><a name="7.12.13" href="#7.12.13">7.12.13 Floating multiply-add</a></h4>
13806
13807 <p><small><a href="#Contents">Contents</a></small>
13808 <h5><a name="7.12.13.1" href="#7.12.13.1">7.12.13.1 The fma functions</a></h5>
13809 <p><b>Synopsis</b>
13810 <p><a name="7.12.13.1p1" href="#7.12.13.1p1"><small>1</small></a>
13811 <pre>
13812          #include <a href="#7.12">&lt;math.h&gt;</a>
13813          double fma(double x, double y, double z);
13814          float fmaf(float x, float y, float z);
13815          long double fmal(long double x, long double y,
13816               long double z);
13817 </pre>
13818 <p><b>Description</b>
13819 <p><a name="7.12.13.1p2" href="#7.12.13.1p2"><small>2</small></a>
13820  The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
13821  the value (as if) to infinite precision and round once to the result format, according to the
13822  current rounding mode. A range error may occur.
13823 <p><b>Returns</b>
13824 <p><a name="7.12.13.1p3" href="#7.12.13.1p3"><small>3</small></a>
13825  The fma functions return (x x y) + z, rounded as one ternary operation.
13826  
13827  
13828  
13829  
13830 <!--page 277 -->
13831
13832 <p><small><a href="#Contents">Contents</a></small>
13833 <h4><a name="7.12.14" href="#7.12.14">7.12.14 Comparison macros</a></h4>
13834 <p><a name="7.12.14p1" href="#7.12.14p1"><small>1</small></a>
13835  The relational and equality operators support the usual mathematical relationships
13836  between numeric values. For any ordered pair of numeric values exactly one of the
13837  relationships -- less, greater, and equal -- is true. Relational operators may raise the
13838  ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
13839  numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note244"><b>244)</b></a></sup> The following
13840  subclauses provide macros that are quiet (non floating-point exception raising) versions
13841  of the relational operators, and other comparison macros that facilitate writing efficient
13842  code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
13843  the synopses in this subclause, real-floating indicates that the argument shall be an
13844  expression of real floating type<sup><a href="#note245"><b>245)</b></a></sup> (both arguments need not have the same type).<sup><a href="#note246"><b>246)</b></a></sup>
13845
13846 <p><b>Footnotes</b>
13847 <p><small><a name="note244" href="#note244">244)</a> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
13848  the operands compare unordered, as an error indicator for programs written without consideration of
13849  NaNs; the result in these cases is false.
13850 </small>
13851 <p><small><a name="note245" href="#note245">245)</a> If any argument is of integer type, or any other type that is not a real floating type, the behavior is
13852  undefined.
13853 </small>
13854 <p><small><a name="note246" href="#note246">246)</a> Whether an argument represented in a format wider than its semantic type is converted to the semantic
13855  type is unspecified.
13856 </small>
13857
13858 <p><small><a href="#Contents">Contents</a></small>
13859 <h5><a name="7.12.14.1" href="#7.12.14.1">7.12.14.1 The isgreater macro</a></h5>
13860 <p><b>Synopsis</b>
13861 <p><a name="7.12.14.1p1" href="#7.12.14.1p1"><small>1</small></a>
13862 <pre>
13863           #include <a href="#7.12">&lt;math.h&gt;</a>
13864           int isgreater(real-floating x, real-floating y);
13865 </pre>
13866 <p><b>Description</b>
13867 <p><a name="7.12.14.1p2" href="#7.12.14.1p2"><small>2</small></a>
13868  The isgreater macro determines whether its first argument is greater than its second
13869  argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
13870  unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
13871  exception when x and y are unordered.
13872 <p><b>Returns</b>
13873 <p><a name="7.12.14.1p3" href="#7.12.14.1p3"><small>3</small></a>
13874  The isgreater macro returns the value of (x) &gt; (y).
13875
13876 <p><small><a href="#Contents">Contents</a></small>
13877 <h5><a name="7.12.14.2" href="#7.12.14.2">7.12.14.2 The isgreaterequal macro</a></h5>
13878 <p><b>Synopsis</b>
13879 <p><a name="7.12.14.2p1" href="#7.12.14.2p1"><small>1</small></a>
13880 <pre>
13881           #include <a href="#7.12">&lt;math.h&gt;</a>
13882           int isgreaterequal(real-floating x, real-floating y);
13883 </pre>
13884  
13885  
13886  
13887  
13888 <!--page 278 -->
13889 <p><b>Description</b>
13890 <p><a name="7.12.14.2p2" href="#7.12.14.2p2"><small>2</small></a>
13891  The isgreaterequal macro determines whether its first argument is greater than or
13892  equal to its second argument. The value of isgreaterequal(x, y) is always equal
13893  to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
13894  not raise the ''invalid'' floating-point exception when x and y are unordered.
13895 <p><b>Returns</b>
13896 <p><a name="7.12.14.2p3" href="#7.12.14.2p3"><small>3</small></a>
13897  The isgreaterequal macro returns the value of (x) &gt;= (y).
13898
13899 <p><small><a href="#Contents">Contents</a></small>
13900 <h5><a name="7.12.14.3" href="#7.12.14.3">7.12.14.3 The isless macro</a></h5>
13901 <p><b>Synopsis</b>
13902 <p><a name="7.12.14.3p1" href="#7.12.14.3p1"><small>1</small></a>
13903 <pre>
13904        #include <a href="#7.12">&lt;math.h&gt;</a>
13905        int isless(real-floating x, real-floating y);
13906 </pre>
13907 <p><b>Description</b>
13908 <p><a name="7.12.14.3p2" href="#7.12.14.3p2"><small>2</small></a>
13909  The isless macro determines whether its first argument is less than its second
13910  argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
13911  unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
13912  exception when x and y are unordered.
13913 <p><b>Returns</b>
13914 <p><a name="7.12.14.3p3" href="#7.12.14.3p3"><small>3</small></a>
13915  The isless macro returns the value of (x) &lt; (y).
13916
13917 <p><small><a href="#Contents">Contents</a></small>
13918 <h5><a name="7.12.14.4" href="#7.12.14.4">7.12.14.4 The islessequal macro</a></h5>
13919 <p><b>Synopsis</b>
13920 <p><a name="7.12.14.4p1" href="#7.12.14.4p1"><small>1</small></a>
13921 <pre>
13922        #include <a href="#7.12">&lt;math.h&gt;</a>
13923        int islessequal(real-floating x, real-floating y);
13924 </pre>
13925 <p><b>Description</b>
13926 <p><a name="7.12.14.4p2" href="#7.12.14.4p2"><small>2</small></a>
13927  The islessequal macro determines whether its first argument is less than or equal to
13928  its second argument. The value of islessequal(x, y) is always equal to
13929  (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
13930  the ''invalid'' floating-point exception when x and y are unordered.
13931 <p><b>Returns</b>
13932 <p><a name="7.12.14.4p3" href="#7.12.14.4p3"><small>3</small></a>
13933  The islessequal macro returns the value of (x) &lt;= (y).
13934 <!--page 279 -->
13935
13936 <p><small><a href="#Contents">Contents</a></small>
13937 <h5><a name="7.12.14.5" href="#7.12.14.5">7.12.14.5 The islessgreater macro</a></h5>
13938 <p><b>Synopsis</b>
13939 <p><a name="7.12.14.5p1" href="#7.12.14.5p1"><small>1</small></a>
13940 <pre>
13941          #include <a href="#7.12">&lt;math.h&gt;</a>
13942          int islessgreater(real-floating x, real-floating y);
13943 </pre>
13944 <p><b>Description</b>
13945 <p><a name="7.12.14.5p2" href="#7.12.14.5p2"><small>2</small></a>
13946  The islessgreater macro determines whether its first argument is less than or
13947  greater than its second argument. The islessgreater(x, y) macro is similar to
13948  (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
13949  the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
13950  and y twice).
13951 <p><b>Returns</b>
13952 <p><a name="7.12.14.5p3" href="#7.12.14.5p3"><small>3</small></a>
13953  The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
13954
13955 <p><small><a href="#Contents">Contents</a></small>
13956 <h5><a name="7.12.14.6" href="#7.12.14.6">7.12.14.6 The isunordered macro</a></h5>
13957 <p><b>Synopsis</b>
13958 <p><a name="7.12.14.6p1" href="#7.12.14.6p1"><small>1</small></a>
13959 <pre>
13960          #include <a href="#7.12">&lt;math.h&gt;</a>
13961          int isunordered(real-floating x, real-floating y);
13962 </pre>
13963 <p><b>Description</b>
13964 <p><a name="7.12.14.6p2" href="#7.12.14.6p2"><small>2</small></a>
13965  The isunordered macro determines whether its arguments are unordered.
13966 <p><b>Returns</b>
13967 <p><a name="7.12.14.6p3" href="#7.12.14.6p3"><small>3</small></a>
13968  The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
13969 <!--page 280 -->
13970
13971 <p><small><a href="#Contents">Contents</a></small>
13972 <h3><a name="7.13" href="#7.13">7.13 Nonlocal jumps &lt;setjmp.h&gt;</a></h3>
13973 <p><a name="7.13p1" href="#7.13p1"><small>1</small></a>
13974  The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
13975  one type, for bypassing the normal function call and return discipline.<sup><a href="#note247"><b>247)</b></a></sup>
13976 <p><a name="7.13p2" href="#7.13p2"><small>2</small></a>
13977  The type declared is
13978 <pre>
13979          jmp_buf
13980 </pre>
13981  which is an array type suitable for holding the information needed to restore a calling
13982  environment. The environment of a call to the setjmp macro consists of information
13983  sufficient for a call to the longjmp function to return execution to the correct block and
13984  invocation of that block, were it called recursively. It does not include the state of the
13985  floating-point status flags, of open files, or of any other component of the abstract
13986  machine.
13987 <p><a name="7.13p3" href="#7.13p3"><small>3</small></a>
13988  It is unspecified whether setjmp is a macro or an identifier declared with external
13989  linkage. If a macro definition is suppressed in order to access an actual function, or a
13990  program defines an external identifier with the name setjmp, the behavior is undefined.
13991
13992 <p><b>Footnotes</b>
13993 <p><small><a name="note247" href="#note247">247)</a> These functions are useful for dealing with unusual conditions encountered in a low-level function of
13994  a program.
13995 </small>
13996
13997 <p><small><a href="#Contents">Contents</a></small>
13998 <h4><a name="7.13.1" href="#7.13.1">7.13.1 Save calling environment</a></h4>
13999
14000 <p><small><a href="#Contents">Contents</a></small>
14001 <h5><a name="7.13.1.1" href="#7.13.1.1">7.13.1.1 The setjmp macro</a></h5>
14002 <p><b>Synopsis</b>
14003 <p><a name="7.13.1.1p1" href="#7.13.1.1p1"><small>1</small></a>
14004 <pre>
14005          #include <a href="#7.13">&lt;setjmp.h&gt;</a>
14006          int setjmp(jmp_buf env);
14007 </pre>
14008 <p><b>Description</b>
14009 <p><a name="7.13.1.1p2" href="#7.13.1.1p2"><small>2</small></a>
14010  The setjmp macro saves its calling environment in its jmp_buf argument for later use
14011  by the longjmp function.
14012 <p><b>Returns</b>
14013 <p><a name="7.13.1.1p3" href="#7.13.1.1p3"><small>3</small></a>
14014  If the return is from a direct invocation, the setjmp macro returns the value zero. If the
14015  return is from a call to the longjmp function, the setjmp macro returns a nonzero
14016  value.
14017 <p><b>Environmental limits</b>
14018 <p><a name="7.13.1.1p4" href="#7.13.1.1p4"><small>4</small></a>
14019  An invocation of the setjmp macro shall appear only in one of the following contexts:
14020 <ul>
14021 <li>  the entire controlling expression of a selection or iteration statement;
14022 <li>  one operand of a relational or equality operator with the other operand an integer
14023  constant expression, with the resulting expression being the entire controlling
14024  
14025  
14026 <!--page 281 -->
14027    expression of a selection or iteration statement;
14028 <li>  the operand of a unary ! operator with the resulting expression being the entire
14029  controlling expression of a selection or iteration statement; or
14030 <li>  the entire expression of an expression statement (possibly cast to void).
14031 </ul>
14032 <p><a name="7.13.1.1p5" href="#7.13.1.1p5"><small>5</small></a>
14033  If the invocation appears in any other context, the behavior is undefined.
14034
14035 <p><small><a href="#Contents">Contents</a></small>
14036 <h4><a name="7.13.2" href="#7.13.2">7.13.2 Restore calling environment</a></h4>
14037
14038 <p><small><a href="#Contents">Contents</a></small>
14039 <h5><a name="7.13.2.1" href="#7.13.2.1">7.13.2.1 The longjmp function</a></h5>
14040 <p><b>Synopsis</b>
14041 <p><a name="7.13.2.1p1" href="#7.13.2.1p1"><small>1</small></a>
14042 <pre>
14043           #include <a href="#7.13">&lt;setjmp.h&gt;</a>
14044           _Noreturn void longjmp(jmp_buf env, int val);
14045 </pre>
14046 <p><b>Description</b>
14047 <p><a name="7.13.2.1p2" href="#7.13.2.1p2"><small>2</small></a>
14048  The longjmp function restores the environment saved by the most recent invocation of
14049  the setjmp macro in the same invocation of the program with the corresponding
14050  jmp_buf argument. If there has been no such invocation, or if the invocation was from
14051  another thread of execution, or if the function containing the invocation of the setjmp
14052  macro has terminated execution<sup><a href="#note248"><b>248)</b></a></sup> in the interim, or if the invocation of the setjmp
14053  macro was within the scope of an identifier with variably modified type and execution has
14054  left that scope in the interim, the behavior is undefined.
14055 <p><a name="7.13.2.1p3" href="#7.13.2.1p3"><small>3</small></a>
14056  All accessible objects have values, and all other components of the abstract machine<sup><a href="#note249"><b>249)</b></a></sup>
14057  have state, as of the time the longjmp function was called, except that the values of
14058  objects of automatic storage duration that are local to the function containing the
14059  invocation of the corresponding setjmp macro that do not have volatile-qualified type
14060  and have been changed between the setjmp invocation and longjmp call are
14061  indeterminate.
14062 <p><b>Returns</b>
14063 <p><a name="7.13.2.1p4" href="#7.13.2.1p4"><small>4</small></a>
14064  After longjmp is completed, thread execution continues as if the corresponding
14065  invocation of the setjmp macro had just returned the value specified by val. The
14066  longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
14067  the setjmp macro returns the value 1.
14068 <p><a name="7.13.2.1p5" href="#7.13.2.1p5"><small>5</small></a>
14069  EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
14070  might cause memory associated with a variable length array object to be squandered.
14071  
14072  
14073  
14074 <!--page 282 -->
14075 <!--page 283 -->
14076 <pre>
14077        #include <a href="#7.13">&lt;setjmp.h&gt;</a>
14078        jmp_buf buf;
14079        void g(int n);
14080        void h(int n);
14081        int n = 6;
14082        void f(void)
14083        {
14084              int x[n];             // valid: f is not terminated
14085              setjmp(buf);
14086              g(n);
14087        }
14088        void g(int n)
14089        {
14090              int a[n];             // a may remain allocated
14091              h(n);
14092        }
14093        void h(int n)
14094        {
14095              int b[n];             // b may remain allocated
14096              longjmp(buf, 2);      // might cause memory loss
14097        }
14098 </pre>
14099
14100 <p><b>Footnotes</b>
14101 <p><small><a name="note248" href="#note248">248)</a> For example, by executing a return statement or because another longjmp call has caused a
14102  transfer to a setjmp invocation in a function earlier in the set of nested calls.
14103 </small>
14104 <p><small><a name="note249" href="#note249">249)</a> This includes, but is not limited to, the floating-point status flags and the state of open files.
14105 </small>
14106
14107 <p><small><a href="#Contents">Contents</a></small>
14108 <h3><a name="7.14" href="#7.14">7.14 Signal handling &lt;signal.h&gt;</a></h3>
14109 <p><a name="7.14p1" href="#7.14p1"><small>1</small></a>
14110  The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
14111  for handling various signals (conditions that may be reported during program execution).
14112 <p><a name="7.14p2" href="#7.14p2"><small>2</small></a>
14113  The type defined is
14114 <pre>
14115           sig_atomic_t
14116 </pre>
14117  which is the (possibly volatile-qualified) integer type of an object that can be accessed as
14118  an atomic entity, even in the presence of asynchronous interrupts.
14119 <p><a name="7.14p3" href="#7.14p3"><small>3</small></a>
14120  The macros defined are
14121 <pre>
14122           SIG_DFL
14123           SIG_ERR
14124           SIG_IGN
14125 </pre>
14126  which expand to constant expressions with distinct values that have type compatible with
14127  the second argument to, and the return value of, the signal function, and whose values
14128  compare unequal to the address of any declarable function; and the following, which
14129  expand to positive integer constant expressions with type int and distinct values that are
14130  the signal numbers, each corresponding to the specified condition:
14131 <pre>
14132           SIGABRT abnormal termination, such as is initiated by the abort function
14133           SIGFPE        an erroneous arithmetic operation, such as zero divide or an operation
14134                         resulting in overflow
14135           SIGILL        detection of an invalid function image, such as an invalid instruction
14136           SIGINT        receipt of an interactive attention signal
14137           SIGSEGV an invalid access to storage
14138           SIGTERM a termination request sent to the program
14139 </pre>
14140 <p><a name="7.14p4" href="#7.14p4"><small>4</small></a>
14141  An implementation need not generate any of these signals, except as a result of explicit
14142  calls to the raise function. Additional signals and pointers to undeclarable functions,
14143  with macro definitions beginning, respectively, with the letters SIG and an uppercase
14144  letter or with SIG_ and an uppercase letter,<sup><a href="#note250"><b>250)</b></a></sup> may also be specified by the
14145  implementation. The complete set of signals, their semantics, and their default handling
14146  is implementation-defined; all signal numbers shall be positive.
14147  
14148  
14149  
14150  
14151 <!--page 284 -->
14152
14153 <p><b>Footnotes</b>
14154 <p><small><a name="note250" href="#note250">250)</a> See ''future library directions'' (<a href="#7.31.7">7.31.7</a>). The names of the signal numbers reflect the following terms
14155  (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
14156  and termination.
14157 </small>
14158
14159 <p><small><a href="#Contents">Contents</a></small>
14160 <h4><a name="7.14.1" href="#7.14.1">7.14.1 Specify signal handling</a></h4>
14161
14162 <p><small><a href="#Contents">Contents</a></small>
14163 <h5><a name="7.14.1.1" href="#7.14.1.1">7.14.1.1 The signal function</a></h5>
14164 <p><b>Synopsis</b>
14165 <p><a name="7.14.1.1p1" href="#7.14.1.1p1"><small>1</small></a>
14166 <pre>
14167          #include <a href="#7.14">&lt;signal.h&gt;</a>
14168          void (*signal(int sig, void (*func)(int)))(int);
14169 </pre>
14170 <p><b>Description</b>
14171 <p><a name="7.14.1.1p2" href="#7.14.1.1p2"><small>2</small></a>
14172  The signal function chooses one of three ways in which receipt of the signal number
14173  sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
14174  for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
14175  Otherwise, func shall point to a function to be called when that signal occurs. An
14176  invocation of such a function because of a signal, or (recursively) of any further functions
14177  called by that invocation (other than functions in the standard library),<sup><a href="#note251"><b>251)</b></a></sup> is called a
14178  signal handler.
14179 <p><a name="7.14.1.1p3" href="#7.14.1.1p3"><small>3</small></a>
14180  When a signal occurs and func points to a function, it is implementation-defined
14181  whether the equivalent of signal(sig, SIG_DFL); is executed or the
14182  implementation prevents some implementation-defined set of signals (at least including
14183  sig) from occurring until the current signal handling has completed; in the case of
14184  SIGILL, the implementation may alternatively define that no action is taken. Then the
14185  equivalent of (*func)(sig); is executed. If and when the function returns, if the
14186  value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
14187  value corresponding to a computational exception, the behavior is undefined; otherwise
14188  the program will resume execution at the point it was interrupted.
14189 <p><a name="7.14.1.1p4" href="#7.14.1.1p4"><small>4</small></a>
14190  If the signal occurs as the result of calling the abort or raise function, the signal
14191  handler shall not call the raise function.
14192 <p><a name="7.14.1.1p5" href="#7.14.1.1p5"><small>5</small></a>
14193  If the signal occurs other than as the result of calling the abort or raise function, the
14194  behavior is undefined if the signal handler refers to any object with static or thread
14195  storage duration that is not a lock-free atomic object other than by assigning a value to an
14196  object declared as volatile sig_atomic_t, or the signal handler calls any function
14197  in the standard library other than the abort function, the _Exit function, the
14198  quick_exit function, or the signal function with the first argument equal to the
14199  signal number corresponding to the signal that caused the invocation of the handler.
14200  Furthermore, if such a call to the signal function results in a SIG_ERR return, the
14201  value of errno is indeterminate.<sup><a href="#note252"><b>252)</b></a></sup>
14202  
14203  
14204 <!--page 285 -->
14205 <p><a name="7.14.1.1p6" href="#7.14.1.1p6"><small>6</small></a>
14206  At program startup, the equivalent of
14207 <pre>
14208          signal(sig, SIG_IGN);
14209 </pre>
14210  may be executed for some signals selected in an implementation-defined manner; the
14211  equivalent of
14212 <pre>
14213          signal(sig, SIG_DFL);
14214 </pre>
14215  is executed for all other signals defined by the implementation.
14216 <p><a name="7.14.1.1p7" href="#7.14.1.1p7"><small>7</small></a>
14217  Use of this function in a multi-threaded program results in undefined behavior. The
14218  implementation shall behave as if no library function calls the signal function.
14219 <p><b>Returns</b>
14220 <p><a name="7.14.1.1p8" href="#7.14.1.1p8"><small>8</small></a>
14221  If the request can be honored, the signal function returns the value of func for the
14222  most recent successful call to signal for the specified signal sig. Otherwise, a value of
14223  SIG_ERR is returned and a positive value is stored in errno.
14224 <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
14225  _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>).
14226
14227 <p><b>Footnotes</b>
14228 <p><small><a name="note251" href="#note251">251)</a> This includes functions called indirectly via standard library functions (e.g., a SIGABRT handler
14229  called via the abort function).
14230 </small>
14231 <p><small><a name="note252" href="#note252">252)</a> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
14232 </small>
14233
14234 <p><small><a href="#Contents">Contents</a></small>
14235 <h4><a name="7.14.2" href="#7.14.2">7.14.2 Send signal</a></h4>
14236
14237 <p><small><a href="#Contents">Contents</a></small>
14238 <h5><a name="7.14.2.1" href="#7.14.2.1">7.14.2.1 The raise function</a></h5>
14239 <p><b>Synopsis</b>
14240 <p><a name="7.14.2.1p1" href="#7.14.2.1p1"><small>1</small></a>
14241 <pre>
14242          #include <a href="#7.14">&lt;signal.h&gt;</a>
14243          int raise(int sig);
14244 </pre>
14245 <p><b>Description</b>
14246 <p><a name="7.14.2.1p2" href="#7.14.2.1p2"><small>2</small></a>
14247  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
14248  signal handler is called, the raise function shall not return until after the signal handler
14249  does.
14250 <p><b>Returns</b>
14251 <p><a name="7.14.2.1p3" href="#7.14.2.1p3"><small>3</small></a>
14252  The raise function returns zero if successful, nonzero if unsuccessful.
14253 <!--page 286 -->
14254
14255 <p><small><a href="#Contents">Contents</a></small>
14256 <h3><a name="7.15" href="#7.15">7.15 Alignment &lt;stdalign.h&gt;</a></h3>
14257 <p><a name="7.15p1" href="#7.15p1"><small>1</small></a>
14258  The header <a href="#7.15">&lt;stdalign.h&gt;</a> defines four macros.
14259 <p><a name="7.15p2" href="#7.15p2"><small>2</small></a>
14260  The macro
14261 <pre>
14262         alignas
14263 </pre>
14264  expands to _Alignas; the macro
14265 <pre>
14266         alignof
14267 </pre>
14268  expands to _Alignof.
14269 <p><a name="7.15p3" href="#7.15p3"><small>3</small></a>
14270  The remaining macros are suitable for use in #if preprocessing directives. They are
14271 <pre>
14272         __alignas_is_defined
14273 </pre>
14274  and
14275 <pre>
14276         __alignof_is_defined
14277 </pre>
14278  which both expand to the integer constant 1.
14279 <!--page 287 -->
14280
14281 <p><small><a href="#Contents">Contents</a></small>
14282 <h3><a name="7.16" href="#7.16">7.16 Variable arguments &lt;stdarg.h&gt;</a></h3>
14283 <p><a name="7.16p1" href="#7.16p1"><small>1</small></a>
14284  The header <a href="#7.16">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
14285  through a list of arguments whose number and types are not known to the called function
14286  when it is translated.
14287 <p><a name="7.16p2" href="#7.16p2"><small>2</small></a>
14288  A function may be called with a variable number of arguments of varying types. As
14289  described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
14290  parameter plays a special role in the access mechanism, and will be designated parmN in
14291  this description.
14292 <p><a name="7.16p3" href="#7.16p3"><small>3</small></a>
14293  The type declared is
14294 <pre>
14295          va_list
14296 </pre>
14297  which is a complete object type suitable for holding information needed by the macros
14298  va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
14299  desired, the called function shall declare an object (generally referred to as ap in this
14300  subclause) having type va_list. The object ap may be passed as an argument to
14301  another function; if that function invokes the va_arg macro with parameter ap, the
14302  value of ap in the calling function is indeterminate and shall be passed to the va_end
14303  macro prior to any further reference to ap.<sup><a href="#note253"><b>253)</b></a></sup>
14304
14305 <p><b>Footnotes</b>
14306 <p><small><a name="note253" href="#note253">253)</a> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
14307  case the original function may make further use of the original list after the other function returns.
14308 </small>
14309
14310 <p><small><a href="#Contents">Contents</a></small>
14311 <h4><a name="7.16.1" href="#7.16.1">7.16.1 Variable argument list access macros</a></h4>
14312 <p><a name="7.16.1p1" href="#7.16.1p1"><small>1</small></a>
14313  The va_start and va_arg macros described in this subclause shall be implemented
14314  as macros, not functions. It is unspecified whether va_copy and va_end are macros or
14315  identifiers declared with external linkage. If a macro definition is suppressed in order to
14316  access an actual function, or a program defines an external identifier with the same name,
14317  the behavior is undefined. Each invocation of the va_start and va_copy macros
14318  shall be matched by a corresponding invocation of the va_end macro in the same
14319  function.
14320
14321 <p><small><a href="#Contents">Contents</a></small>
14322 <h5><a name="7.16.1.1" href="#7.16.1.1">7.16.1.1 The va_arg macro</a></h5>
14323 <p><b>Synopsis</b>
14324 <p><a name="7.16.1.1p1" href="#7.16.1.1p1"><small>1</small></a>
14325 <pre>
14326          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
14327          type va_arg(va_list ap, type);
14328 </pre>
14329 <p><b>Description</b>
14330 <p><a name="7.16.1.1p2" href="#7.16.1.1p2"><small>2</small></a>
14331  The va_arg macro expands to an expression that has the specified type and the value of
14332  the next argument in the call. The parameter ap shall have been initialized by the
14333  va_start or va_copy macro (without an intervening invocation of the va_end
14334  
14335 <!--page 288 -->
14336  macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
14337  values of successive arguments are returned in turn. The parameter type shall be a type
14338  name specified such that the type of a pointer to an object that has the specified type can
14339  be obtained simply by postfixing a * to type. If there is no actual next argument, or if
14340  type is not compatible with the type of the actual next argument (as promoted according
14341  to the default argument promotions), the behavior is undefined, except for the following
14342  cases:
14343 <ul>
14344 <li>  one type is a signed integer type, the other type is the corresponding unsigned integer
14345  type, and the value is representable in both types;
14346 <li>  one type is pointer to void and the other is a pointer to a character type.
14347 </ul>
14348 <p><b>Returns</b>
14349 <p><a name="7.16.1.1p3" href="#7.16.1.1p3"><small>3</small></a>
14350  The first invocation of the va_arg macro after that of the va_start macro returns the
14351  value of the argument after that specified by parmN . Successive invocations return the
14352  values of the remaining arguments in succession.
14353
14354 <p><small><a href="#Contents">Contents</a></small>
14355 <h5><a name="7.16.1.2" href="#7.16.1.2">7.16.1.2 The va_copy macro</a></h5>
14356 <p><b>Synopsis</b>
14357 <p><a name="7.16.1.2p1" href="#7.16.1.2p1"><small>1</small></a>
14358 <pre>
14359         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
14360         void va_copy(va_list dest, va_list src);
14361 </pre>
14362 <p><b>Description</b>
14363 <p><a name="7.16.1.2p2" href="#7.16.1.2p2"><small>2</small></a>
14364  The va_copy macro initializes dest as a copy of src, as if the va_start macro had
14365  been applied to dest followed by the same sequence of uses of the va_arg macro as
14366  had previously been used to reach the present state of src. Neither the va_copy nor
14367  va_start macro shall be invoked to reinitialize dest without an intervening
14368  invocation of the va_end macro for the same dest.
14369 <p><b>Returns</b>
14370 <p><a name="7.16.1.2p3" href="#7.16.1.2p3"><small>3</small></a>
14371  The va_copy macro returns no value.
14372
14373 <p><small><a href="#Contents">Contents</a></small>
14374 <h5><a name="7.16.1.3" href="#7.16.1.3">7.16.1.3 The va_end macro</a></h5>
14375 <p><b>Synopsis</b>
14376 <p><a name="7.16.1.3p1" href="#7.16.1.3p1"><small>1</small></a>
14377 <pre>
14378         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
14379         void va_end(va_list ap);
14380 </pre>
14381 <p><b>Description</b>
14382 <p><a name="7.16.1.3p2" href="#7.16.1.3p2"><small>2</small></a>
14383  The va_end macro facilitates a normal return from the function whose variable
14384  argument list was referred to by the expansion of the va_start macro, or the function
14385  containing the expansion of the va_copy macro, that initialized the va_list ap. The
14386  va_end macro may modify ap so that it is no longer usable (without being reinitialized
14387 <!--page 289 -->
14388  by the va_start or va_copy macro). If there is no corresponding invocation of the
14389  va_start or va_copy macro, or if the va_end macro is not invoked before the
14390  return, the behavior is undefined.
14391 <p><b>Returns</b>
14392 <p><a name="7.16.1.3p3" href="#7.16.1.3p3"><small>3</small></a>
14393  The va_end macro returns no value.
14394
14395 <p><small><a href="#Contents">Contents</a></small>
14396 <h5><a name="7.16.1.4" href="#7.16.1.4">7.16.1.4 The va_start macro</a></h5>
14397 <p><b>Synopsis</b>
14398 <p><a name="7.16.1.4p1" href="#7.16.1.4p1"><small>1</small></a>
14399 <pre>
14400          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
14401          void va_start(va_list ap, parmN);
14402 </pre>
14403 <p><b>Description</b>
14404 <p><a name="7.16.1.4p2" href="#7.16.1.4p2"><small>2</small></a>
14405  The va_start macro shall be invoked before any access to the unnamed arguments.
14406 <p><a name="7.16.1.4p3" href="#7.16.1.4p3"><small>3</small></a>
14407  The va_start macro initializes ap for subsequent use by the va_arg and va_end
14408  macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
14409  without an intervening invocation of the va_end macro for the same ap.
14410 <p><a name="7.16.1.4p4" href="#7.16.1.4p4"><small>4</small></a>
14411  The parameter parmN is the identifier of the rightmost parameter in the variable
14412  parameter list in the function definition (the one just before the , ...). If the parameter
14413  parmN is declared with the register storage class, with a function or array type, or
14414  with a type that is not compatible with the type that results after application of the default
14415  argument promotions, the behavior is undefined.
14416 <p><b>Returns</b>
14417 <p><a name="7.16.1.4p5" href="#7.16.1.4p5"><small>5</small></a>
14418  The va_start macro returns no value.
14419 <p><a name="7.16.1.4p6" href="#7.16.1.4p6"><small>6</small></a>
14420  EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
14421  more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
14422  pointers is specified by the first argument to f1.
14423 <!--page 290 -->
14424 <pre>
14425          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
14426          #define MAXARGS   31
14427          void f1(int n_ptrs, ...)
14428          {
14429                va_list ap;
14430                char *array[MAXARGS];
14431                int ptr_no = 0;
14432                    if (n_ptrs &gt; MAXARGS)
14433                          n_ptrs = MAXARGS;
14434                    va_start(ap, n_ptrs);
14435                    while (ptr_no &lt; n_ptrs)
14436                          array[ptr_no++] = va_arg(ap, char *);
14437                    va_end(ap);
14438                    f2(n_ptrs, array);
14439           }
14440 </pre>
14441  Each call to f1 is required to have visible the definition of the function or a declaration such as
14442 <pre>
14443           void f1(int, ...);
14444 </pre>
14445  
14446 <p><a name="7.16.1.4p7" href="#7.16.1.4p7"><small>7</small></a>
14447  EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
14448  indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
14449  is gathered again and passed to function f4.
14450 <!--page 291 -->
14451 <pre>
14452           #include <a href="#7.16">&lt;stdarg.h&gt;</a>
14453           #define MAXARGS 31
14454           void f3(int n_ptrs, int f4_after, ...)
14455           {
14456                 va_list ap, ap_save;
14457                 char *array[MAXARGS];
14458                 int ptr_no = 0;
14459                 if (n_ptrs &gt; MAXARGS)
14460                       n_ptrs = MAXARGS;
14461                 va_start(ap, f4_after);
14462                 while (ptr_no &lt; n_ptrs) {
14463                       array[ptr_no++] = va_arg(ap, char *);
14464                       if (ptr_no == f4_after)
14465                             va_copy(ap_save, ap);
14466                 }
14467                 va_end(ap);
14468                 f2(n_ptrs, array);
14469                    // Now process the saved copy.
14470                    n_ptrs -= f4_after;
14471                    ptr_no = 0;
14472                    while (ptr_no &lt; n_ptrs)
14473                          array[ptr_no++] = va_arg(ap_save, char *);
14474                    va_end(ap_save);
14475                    f4(n_ptrs, array);
14476           }
14477 </pre>
14478
14479 <p><small><a href="#Contents">Contents</a></small>
14480 <h3><a name="7.17" href="#7.17">7.17 Atomics &lt;stdatomic.h&gt;</a></h3>
14481
14482 <p><small><a href="#Contents">Contents</a></small>
14483 <h4><a name="7.17.1" href="#7.17.1">7.17.1 Introduction</a></h4>
14484 <p><a name="7.17.1p1" href="#7.17.1p1"><small>1</small></a>
14485  The header <a href="#7.17">&lt;stdatomic.h&gt;</a> defines several macros and declares several types and
14486  functions for performing atomic operations on data shared between threads.<sup><a href="#note254"><b>254)</b></a></sup>
14487 <p><a name="7.17.1p2" href="#7.17.1p2"><small>2</small></a>
14488  Implementations that define the macro __STDC_NO_ATOMICS__ need not provide
14489  this header nor support any of its facilities.
14490 <p><a name="7.17.1p3" href="#7.17.1p3"><small>3</small></a>
14491  The macros defined are the atomic lock-free macros
14492 <pre>
14493           ATOMIC_BOOL_LOCK_FREE
14494           ATOMIC_CHAR_LOCK_FREE
14495           ATOMIC_CHAR16_T_LOCK_FREE
14496           ATOMIC_CHAR32_T_LOCK_FREE
14497           ATOMIC_WCHAR_T_LOCK_FREE
14498           ATOMIC_SHORT_LOCK_FREE
14499           ATOMIC_INT_LOCK_FREE
14500           ATOMIC_LONG_LOCK_FREE
14501           ATOMIC_LLONG_LOCK_FREE
14502           ATOMIC_POINTER_LOCK_FREE
14503 </pre>
14504  which indicate the lock-free property of the corresponding atomic types (both signed and
14505  unsigned); and
14506 <pre>
14507           ATOMIC_FLAG_INIT
14508 </pre>
14509  which expands to an initializer for an object of type atomic_flag.
14510 <p><a name="7.17.1p4" href="#7.17.1p4"><small>4</small></a>
14511  The types include
14512 <pre>
14513            memory_order
14514 </pre>
14515  which is an enumerated type whose enumerators identify memory ordering constraints;
14516 <pre>
14517            atomic_flag
14518 </pre>
14519  which is a structure type representing a lock-free, primitive atomic flag; and several *
14520  atomic analogs of integer types.
14521 <p><a name="7.17.1p5" href="#7.17.1p5"><small>5</small></a>
14522  In the following synopses:
14523 <ul>
14524 <li>  An A refers to one of the atomic types.
14525 <li>  A C refers to its corresponding non-atomic type.                                         *
14526 <li>  An M refers to the type of the other argument for arithmetic operations. For atomic
14527  integer types, M is C. For atomic pointer types, M is ptrdiff_t.
14528  
14529 <!--page 292 -->
14530 <li>  The functions not ending in _explicit have the same semantics as the
14531  corresponding _explicit function with memory_order_seq_cst for the
14532  memory_order argument.
14533 </ul>
14534 <p><a name="7.17.1p6" href="#7.17.1p6"><small>6</small></a>
14535  NOTE Many operations are volatile-qualified. The ''volatile as device register'' semantics have not
14536  changed in the standard. This qualification means that volatility is preserved when applying these
14537  operations to volatile objects.
14538  
14539
14540 <p><b>Footnotes</b>
14541 <p><small><a name="note254" href="#note254">254)</a> See ''future library directions'' (<a href="#7.31.8">7.31.8</a>).
14542 </small>
14543
14544 <p><small><a href="#Contents">Contents</a></small>
14545 <h4><a name="7.17.2" href="#7.17.2">7.17.2 Initialization</a></h4>
14546
14547 <p><small><a href="#Contents">Contents</a></small>
14548 <h5><a name="7.17.2.1" href="#7.17.2.1">7.17.2.1 The ATOMIC_VAR_INIT macro</a></h5>
14549 <p><b>Synopsis</b>
14550 <p><a name="7.17.2.1p1" href="#7.17.2.1p1"><small>1</small></a>
14551 <pre>
14552          #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14553          #define ATOMIC_VAR_INIT(C value)
14554 </pre>
14555 <p><b>Description</b>
14556 <p><a name="7.17.2.1p2" href="#7.17.2.1p2"><small>2</small></a>
14557  The ATOMIC_VAR_INIT macro expands to a token sequence suitable for initializing an
14558  atomic object of a type that is initialization-compatible with value. An atomic object
14559  with automatic storage duration that is not explicitly initialized using
14560  ATOMIC_VAR_INIT is initially in an indeterminate state; however, the default (zero)
14561  initialization for objects with static or thread-local storage duration is guaranteed to
14562  produce a valid state.
14563 <p><a name="7.17.2.1p3" href="#7.17.2.1p3"><small>3</small></a>
14564  Concurrent access to the variable being initialized, even via an atomic operation,
14565  constitutes a data race.
14566 <p><a name="7.17.2.1p4" href="#7.17.2.1p4"><small>4</small></a>
14567  EXAMPLE
14568 <pre>
14569          atomic_int guide = ATOMIC_VAR_INIT(42);
14570 </pre>
14571  
14572
14573 <p><small><a href="#Contents">Contents</a></small>
14574 <h5><a name="7.17.2.2" href="#7.17.2.2">7.17.2.2 The atomic_init generic function</a></h5>
14575 <p><b>Synopsis</b>
14576 <p><a name="7.17.2.2p1" href="#7.17.2.2p1"><small>1</small></a>
14577 <pre>
14578          #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14579          void atomic_init(volatile A *obj, C value);
14580 </pre>
14581 <p><b>Description</b>
14582 <p><a name="7.17.2.2p2" href="#7.17.2.2p2"><small>2</small></a>
14583  The atomic_init generic function initializes the atomic object pointed to by obj to
14584  the value value, while also initializing any additional state that the implementation
14585  might need to carry for the atomic object.
14586 <p><a name="7.17.2.2p3" href="#7.17.2.2p3"><small>3</small></a>
14587  Although this function initializes an atomic object, it does not avoid data races;
14588  concurrent access to the variable being initialized, even via an atomic operation,
14589  constitutes a data race.
14590 <!--page 293 -->
14591 <p><b>Returns</b>
14592 <p><a name="7.17.2.2p4" href="#7.17.2.2p4"><small>4</small></a>
14593  The atomic_init generic function returns no value.
14594 <p><a name="7.17.2.2p5" href="#7.17.2.2p5"><small>5</small></a>
14595  EXAMPLE
14596 <pre>
14597            atomic_int guide;
14598            atomic_init(&amp;guide, 42);
14599 </pre>
14600  
14601
14602 <p><small><a href="#Contents">Contents</a></small>
14603 <h4><a name="7.17.3" href="#7.17.3">7.17.3 Order and consistency</a></h4>
14604 <p><a name="7.17.3p1" href="#7.17.3p1"><small>1</small></a>
14605  The enumerated type memory_order specifies the detailed regular (non-atomic)
14606  memory synchronization operations as defined in <a href="#5.1.2.4">5.1.2.4</a> and may provide for operation
14607  ordering. Its enumeration constants are as follows:<sup><a href="#note255"><b>255)</b></a></sup>
14608 <pre>
14609           memory_order_relaxed
14610           memory_order_consume
14611           memory_order_acquire
14612           memory_order_release
14613           memory_order_acq_rel
14614           memory_order_seq_cst
14615 </pre>
14616 <p><a name="7.17.3p2" href="#7.17.3p2"><small>2</small></a>
14617  For memory_order_relaxed, no operation orders memory.
14618 <p><a name="7.17.3p3" href="#7.17.3p3"><small>3</small></a>
14619  For       memory_order_release,       memory_order_acq_rel,             and
14620  memory_order_seq_cst, a store operation performs a release operation on the
14621  affected memory location.
14622 <p><a name="7.17.3p4" href="#7.17.3p4"><small>4</small></a>
14623  For       memory_order_acquire,       memory_order_acq_rel,             and
14624  memory_order_seq_cst, a load operation performs an acquire operation on the
14625  affected memory location.
14626 <p><a name="7.17.3p5" href="#7.17.3p5"><small>5</small></a>
14627  For memory_order_consume, a load operation performs a consume operation on the
14628  affected memory location.
14629 <p><a name="7.17.3p6" href="#7.17.3p6"><small>6</small></a>
14630  There shall be a single total order S on all memory_order_seq_cst operations,
14631  consistent with the ''happens before'' order and modification orders for all affected
14632  locations, such that each memory_order_seq_cst operation B that loads a value
14633  from an atomic object M observes one of the following values:
14634 <ul>
14635 <li>  the result of the last modification A of M that precedes B in S, if it exists, or
14636 <li>  if A exists, the result of some modification of M in the visible sequence of side
14637  effects with respect to B that is not memory_order_seq_cst and that does not
14638  happen before A, or
14639  
14640  
14641  
14642  
14643 <!--page 294 -->
14644 <li>  if A does not exist, the result of some modification of M in the visible sequence of
14645   side effects with respect to B that is not memory_order_seq_cst.
14646 </ul>
14647 <p><a name="7.17.3p7" href="#7.17.3p7"><small>7</small></a>
14648  NOTE 1 Although it is not explicitly required that S include lock operations, it can always be extended to
14649  an order that does include lock and unlock operations, since the ordering between those is already included
14650  in the ''happens before'' ordering.
14651  
14652 <p><a name="7.17.3p8" href="#7.17.3p8"><small>8</small></a>
14653  NOTE 2 Atomic operations specifying memory_order_relaxed are relaxed only with respect to
14654  memory ordering. Implementations must still guarantee that any given atomic access to a particular atomic
14655  object be indivisible with respect to all other atomic accesses to that object.
14656  
14657 <p><a name="7.17.3p9" href="#7.17.3p9"><small>9</small></a>
14658  For an atomic operation B that reads the value of an atomic object M, if there is a
14659  memory_order_seq_cst fence X sequenced before B, then B observes either the
14660  last memory_order_seq_cst modification of M preceding X in the total order S or
14661  a later modification of M in its modification order.
14662 <p><a name="7.17.3p10" href="#7.17.3p10"><small>10</small></a>
14663  For atomic operations A and B on an atomic object M, where A modifies M and B takes
14664  its value, if there is a memory_order_seq_cst fence X such that A is sequenced
14665  before X and B follows X in S, then B observes either the effects of A or a later
14666  modification of M in its modification order.
14667 <p><a name="7.17.3p11" href="#7.17.3p11"><small>11</small></a>
14668  For atomic operations A and B on an atomic object M, where A modifies M and B takes
14669  its value, if there are memory_order_seq_cst fences X and Y such that A is
14670  sequenced before X, Y is sequenced before B, and X precedes Y in S, then B observes
14671  either the effects of A or a later modification of M in its modification order.
14672 <p><a name="7.17.3p12" href="#7.17.3p12"><small>12</small></a>
14673  Atomic read-modify-write operations shall always read the last value (in the modification
14674  order) stored before the write associated with the read-modify-write operation.
14675 <p><a name="7.17.3p13" href="#7.17.3p13"><small>13</small></a>
14676  An atomic store shall only store a value that has been computed from constants and
14677  program input values by a finite sequence of program evaluations, such that each
14678  evaluation observes the values of variables as computed by the last prior assignment in
14679  the sequence.<sup><a href="#note256"><b>256)</b></a></sup> The ordering of evaluations in this sequence shall be such that
14680 <ul>
14681 <li>  If an evaluation B observes a value computed by A in a different thread, then B does
14682  not happen before A.
14683 <li>  If an evaluation A is included in the sequence, then all evaluations that assign to the
14684  same variable and happen before A are also included.
14685 </ul>
14686 <p><a name="7.17.3p14" href="#7.17.3p14"><small>14</small></a>
14687  NOTE 3 The second requirement disallows ''out-of-thin-air'', or ''speculative'' stores of atomics when
14688  relaxed atomics are used. Since unordered operations are involved, evaluations may appear in this
14689  sequence out of thread order. For example, with x and y initially zero,
14690  
14691  
14692  
14693  
14694 <!--page 295 -->
14695 <pre>
14696            // Thread 1:
14697            r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
14698            atomic_store_explicit(&amp;x, r1, memory_order_relaxed);
14699 </pre>
14700  
14701 <pre>
14702            // Thread 2:
14703            r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
14704            atomic_store_explicit(&amp;y, 42, memory_order_relaxed);
14705 </pre>
14706  is allowed to produce r1 == 42 &amp;&amp; r2 == 42. The sequence of evaluations justifying this consists of:
14707 <pre>
14708            atomic_store_explicit(&amp;y, 42,             memory_order_relaxed);
14709            r1 = atomic_load_explicit(&amp;y,             memory_order_relaxed);
14710            atomic_store_explicit(&amp;x, r1,             memory_order_relaxed);
14711            r2 = atomic_load_explicit(&amp;x,             memory_order_relaxed);
14712 </pre>
14713  On the other hand,
14714 <pre>
14715            // Thread 1:
14716            r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
14717            atomic_store_explicit(&amp;x, r1, memory_order_relaxed);
14718 </pre>
14719  
14720 <pre>
14721            // Thread 2:
14722            r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
14723            atomic_store_explicit(&amp;y, r2, memory_order_relaxed);
14724 </pre>
14725  is not allowed to produce r1 == 42 &amp;&amp; r2 = 42, since there is no sequence of evaluations that results
14726  in the computation of 42. In the absence of ''relaxed'' operations and read-modify-write operations with
14727  weaker than memory_order_acq_rel ordering, the second requirement has no impact.
14728  
14729 <p><b>Recommended practice</b>
14730 <p><a name="7.17.3p15" href="#7.17.3p15"><small>15</small></a>
14731  The requirements do not forbid r1 == 42 &amp;&amp; r2 == 42 in the following example,
14732  with x and y initially zero:
14733 <pre>
14734          // Thread 1:
14735          r1 = atomic_load_explicit(&amp;x, memory_order_relaxed);
14736          if (r1 == 42)
14737               atomic_store_explicit(&amp;y, r1, memory_order_relaxed);
14738 </pre>
14739  
14740 <pre>
14741          // Thread 2:
14742          r2 = atomic_load_explicit(&amp;y, memory_order_relaxed);
14743          if (r2 == 42)
14744               atomic_store_explicit(&amp;x, 42, memory_order_relaxed);
14745 </pre>
14746  However, this is not useful behavior, and implementations should not allow it.
14747 <p><a name="7.17.3p16" href="#7.17.3p16"><small>16</small></a>
14748  Implementations should make atomic stores visible to atomic loads within a reasonable
14749  amount of time.
14750 <!--page 296 -->
14751
14752 <p><b>Footnotes</b>
14753 <p><small><a name="note255" href="#note255">255)</a> See ''future library directions'' (<a href="#7.31.8">7.31.8</a>).
14754 </small>
14755 <p><small><a name="note256" href="#note256">256)</a> Among other implications, atomic variables shall not decay.
14756 </small>
14757
14758 <p><small><a href="#Contents">Contents</a></small>
14759 <h5><a name="7.17.3.1" href="#7.17.3.1">7.17.3.1 The kill_dependency macro</a></h5>
14760 <p><b>Synopsis</b>
14761 <p><a name="7.17.3.1p1" href="#7.17.3.1p1"><small>1</small></a>
14762 <pre>
14763         #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14764         type kill_dependency(type y);
14765 </pre>
14766 <p><b>Description</b>
14767 <p><a name="7.17.3.1p2" href="#7.17.3.1p2"><small>2</small></a>
14768  The kill_dependency macro terminates a dependency chain; the argument does not
14769  carry a dependency to the return value.
14770 <p><b>Returns</b>
14771 <p><a name="7.17.3.1p3" href="#7.17.3.1p3"><small>3</small></a>
14772  The kill_dependency macro returns the value of y.
14773
14774 <p><small><a href="#Contents">Contents</a></small>
14775 <h4><a name="7.17.4" href="#7.17.4">7.17.4 Fences</a></h4>
14776 <p><a name="7.17.4p1" href="#7.17.4p1"><small>1</small></a>
14777  This subclause introduces synchronization primitives called fences. Fences can have
14778  acquire semantics, release semantics, or both. A fence with acquire semantics is called
14779  an acquire fence; a fence with release semantics is called a release fence.
14780 <p><a name="7.17.4p2" href="#7.17.4p2"><small>2</small></a>
14781  A release fence A synchronizes with an acquire fence B if there exist atomic operations
14782  X and Y , both operating on some atomic object M, such that A is sequenced before X, X
14783  modifies M, Y is sequenced before B, and Y reads the value written by X or a value
14784  written by any side effect in the hypothetical release sequence X would head if it were a
14785  release operation.
14786 <p><a name="7.17.4p3" href="#7.17.4p3"><small>3</small></a>
14787  A release fence A synchronizes with an atomic operation B that performs an acquire
14788  operation on an atomic object M if there exists an atomic operation X such that A is
14789  sequenced before X, X modifies M, and B reads the value written by X or a value written
14790  by any side effect in the hypothetical release sequence X would head if it were a release
14791  operation.
14792 <p><a name="7.17.4p4" href="#7.17.4p4"><small>4</small></a>
14793  An atomic operation A that is a release operation on an atomic object M synchronizes
14794  with an acquire fence B if there exists some atomic operation X on M such that X is
14795  sequenced before B and reads the value written by A or a value written by any side effect
14796  in the release sequence headed by A.
14797
14798 <p><small><a href="#Contents">Contents</a></small>
14799 <h5><a name="7.17.4.1" href="#7.17.4.1">7.17.4.1 The atomic_thread_fence function</a></h5>
14800 <p><b>Synopsis</b>
14801 <p><a name="7.17.4.1p1" href="#7.17.4.1p1"><small>1</small></a>
14802 <pre>
14803         #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14804         void atomic_thread_fence(memory_order order);
14805 </pre>
14806 <p><b>Description</b>
14807 <p><a name="7.17.4.1p2" href="#7.17.4.1p2"><small>2</small></a>
14808  Depending on the value of order, this operation:
14809 <ul>
14810 <li>  has no effects, if order == memory_order_relaxed;
14811 <!--page 297 -->
14812 <li>  is an acquire fence, if order == memory_order_acquire or order ==
14813  memory_order_consume;
14814 <li>  is a release fence, if order == memory_order_release;
14815 <li>  is both an acquire fence                    and     a    release    fence,     if   order        ==
14816  memory_order_acq_rel;
14817 <li>  is a sequentially consistent acquire and release fence, if order                                 ==
14818  memory_order_seq_cst.
14819 </ul>
14820 <p><b>Returns</b>
14821 <p><a name="7.17.4.1p3" href="#7.17.4.1p3"><small>3</small></a>
14822  The atomic_thread_fence function returns no value.
14823
14824 <p><small><a href="#Contents">Contents</a></small>
14825 <h5><a name="7.17.4.2" href="#7.17.4.2">7.17.4.2 The atomic_signal_fence function</a></h5>
14826 <p><b>Synopsis</b>
14827 <p><a name="7.17.4.2p1" href="#7.17.4.2p1"><small>1</small></a>
14828 <pre>
14829          #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14830          void atomic_signal_fence(memory_order order);
14831 </pre>
14832 <p><b>Description</b>
14833 <p><a name="7.17.4.2p2" href="#7.17.4.2p2"><small>2</small></a>
14834  Equivalent to atomic_thread_fence(order), except that the resulting ordering
14835  constraints are established only between a thread and a signal handler executed in the
14836  same thread.
14837 <p><a name="7.17.4.2p3" href="#7.17.4.2p3"><small>3</small></a>
14838  NOTE 1 The atomic_signal_fence function can be used to specify the order in which actions
14839  performed by the thread become visible to the signal handler.
14840  
14841 <p><a name="7.17.4.2p4" href="#7.17.4.2p4"><small>4</small></a>
14842  NOTE 2 Compiler optimizations and reorderings of loads and stores are inhibited in the same way as with
14843  atomic_thread_fence, but the hardware fence instructions that atomic_thread_fence would
14844  have inserted are not emitted.
14845  
14846 <p><b>Returns</b>
14847 <p><a name="7.17.4.2p5" href="#7.17.4.2p5"><small>5</small></a>
14848  The atomic_signal_fence function returns no value.
14849
14850 <p><small><a href="#Contents">Contents</a></small>
14851 <h4><a name="7.17.5" href="#7.17.5">7.17.5 Lock-free property</a></h4>
14852 <p><a name="7.17.5p1" href="#7.17.5p1"><small>1</small></a>
14853  The atomic lock-free macros indicate the lock-free property of integer and address atomic
14854  types. A value of 0 indicates that the type is never lock-free; a value of 1 indicates that
14855  the type is sometimes lock-free; a value of 2 indicates that the type is always lock-free.
14856 <p><a name="7.17.5p2" href="#7.17.5p2"><small>2</small></a>
14857  NOTE Operations that are lock-free should also be address-free. That is, atomic operations on the same
14858  memory location via two different addresses will communicate atomically. The implementation should not
14859  depend on any per-process state. This restriction enables communication via memory mapped into a
14860  process more than once and memory shared between two processes.
14861 <!--page 298 -->
14862
14863 <p><small><a href="#Contents">Contents</a></small>
14864 <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>
14865 <p><b>Synopsis</b>
14866 <p><a name="7.17.5.1p1" href="#7.17.5.1p1"><small>1</small></a>
14867 <pre>
14868           #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14869           _Bool atomic_is_lock_free(const volatile A *obj);
14870 </pre>
14871 <p><b>Description</b>
14872 <p><a name="7.17.5.1p2" href="#7.17.5.1p2"><small>2</small></a>
14873  The atomic_is_lock_free generic function indicates whether or not the object
14874  pointed to by obj is lock-free.                                              *
14875 <p><b>Returns</b>
14876 <p><a name="7.17.5.1p3" href="#7.17.5.1p3"><small>3</small></a>
14877  The atomic_is_lock_free generic function returns nonzero (true) if and only if the
14878  object's operations are lock-free. The result of a lock-free query on one object cannot be
14879  inferred from the result of a lock-free query on another object.
14880
14881 <p><small><a href="#Contents">Contents</a></small>
14882 <h4><a name="7.17.6" href="#7.17.6">7.17.6 Atomic integer types</a></h4>
14883 <p><a name="7.17.6p1" href="#7.17.6p1"><small>1</small></a>
14884  For each line in the following table,<sup><a href="#note257"><b>257)</b></a></sup> the atomic type name is declared as a type that
14885  has the same representation and alignment requirements as the corresponding direct
14886  type.<sup><a href="#note258"><b>258)</b></a></sup>
14887  
14888  
14889  
14890  
14891 <!--page 299 -->
14892 <pre>
14893                Atomic type name                           Direct type
14894            atomic_bool                        _Atomic    _Bool
14895            atomic_char                        _Atomic    char
14896            atomic_schar                       _Atomic    signed char
14897            atomic_uchar                       _Atomic    unsigned char
14898            atomic_short                       _Atomic    short
14899            atomic_ushort                      _Atomic    unsigned short
14900            atomic_int                         _Atomic    int
14901            atomic_uint                        _Atomic    unsigned int
14902            atomic_long                        _Atomic    long
14903            atomic_ulong                       _Atomic    unsigned long
14904            atomic_llong                       _Atomic    long long
14905            atomic_ullong                      _Atomic    unsigned long long
14906            atomic_char16_t                    _Atomic    char16_t
14907            atomic_char32_t                    _Atomic    char32_t
14908            atomic_wchar_t                     _Atomic    wchar_t
14909            atomic_int_least8_t                _Atomic    int_least8_t
14910            atomic_uint_least8_t               _Atomic    uint_least8_t
14911            atomic_int_least16_t               _Atomic    int_least16_t
14912            atomic_uint_least16_t              _Atomic    uint_least16_t
14913            atomic_int_least32_t               _Atomic    int_least32_t
14914            atomic_uint_least32_t              _Atomic    uint_least32_t
14915            atomic_int_least64_t               _Atomic    int_least64_t
14916            atomic_uint_least64_t              _Atomic    uint_least64_t
14917            atomic_int_fast8_t                 _Atomic    int_fast8_t
14918            atomic_uint_fast8_t                _Atomic    uint_fast8_t
14919            atomic_int_fast16_t                _Atomic    int_fast16_t
14920            atomic_uint_fast16_t               _Atomic    uint_fast16_t
14921            atomic_int_fast32_t                _Atomic    int_fast32_t
14922            atomic_uint_fast32_t               _Atomic    uint_fast32_t
14923            atomic_int_fast64_t                _Atomic    int_fast64_t
14924            atomic_uint_fast64_t               _Atomic    uint_fast64_t
14925            atomic_intptr_t                    _Atomic    intptr_t
14926            atomic_uintptr_t                   _Atomic    uintptr_t
14927            atomic_size_t                      _Atomic    size_t
14928            atomic_ptrdiff_t                   _Atomic    ptrdiff_t
14929            atomic_intmax_t                    _Atomic    intmax_t
14930            atomic_uintmax_t                   _Atomic    uintmax_t
14931 </pre>
14932 <p><a name="7.17.6p2" href="#7.17.6p2"><small>2</small></a>
14933  The semantics of the operations on these types are defined in <a href="#7.17.7">7.17.7</a>.                       *
14934 <!--page 300 -->
14935 <p><a name="7.17.6p3" href="#7.17.6p3"><small>3</small></a>
14936  NOTE The representation of atomic integer types need not have the same size as their corresponding
14937  regular types. They should have the same size whenever possible, as it eases effort required to port existing
14938  code.
14939  
14940
14941 <p><b>Footnotes</b>
14942 <p><small><a name="note257" href="#note257">257)</a> See ''future library directions'' (<a href="#7.31.8">7.31.8</a>).
14943 </small>
14944 <p><small><a name="note258" href="#note258">258)</a> The same representation and alignment requirements are meant to imply interchangeability as
14945  arguments to functions, return values from functions, and members of unions.
14946 </small>
14947
14948 <p><small><a href="#Contents">Contents</a></small>
14949 <h4><a name="7.17.7" href="#7.17.7">7.17.7 Operations on atomic types</a></h4>
14950 <p><a name="7.17.7p1" href="#7.17.7p1"><small>1</small></a>
14951  There are only a few kinds of operations on atomic types, though there are many
14952  instances of those kinds. This subclause specifies each general kind.
14953
14954 <p><small><a href="#Contents">Contents</a></small>
14955 <h5><a name="7.17.7.1" href="#7.17.7.1">7.17.7.1 The atomic_store generic functions</a></h5>
14956 <p><b>Synopsis</b>
14957 <p><a name="7.17.7.1p1" href="#7.17.7.1p1"><small>1</small></a>
14958 <pre>
14959           #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14960           void atomic_store(volatile A *object, C desired);
14961           void atomic_store_explicit(volatile A *object,
14962                C desired, memory_order order);
14963 </pre>
14964 <p><b>Description</b>
14965 <p><a name="7.17.7.1p2" href="#7.17.7.1p2"><small>2</small></a>
14966  The      order      argument    shall    not    be    memory_order_acquire,
14967  memory_order_consume, nor memory_order_acq_rel. Atomically replace the
14968  value pointed to by object with the value of desired. Memory is affected according
14969  to the value of order.
14970 <p><b>Returns</b>
14971 <p><a name="7.17.7.1p3" href="#7.17.7.1p3"><small>3</small></a>
14972  The atomic_store generic functions return no value.
14973
14974 <p><small><a href="#Contents">Contents</a></small>
14975 <h5><a name="7.17.7.2" href="#7.17.7.2">7.17.7.2 The atomic_load generic functions</a></h5>
14976 <p><b>Synopsis</b>
14977 <p><a name="7.17.7.2p1" href="#7.17.7.2p1"><small>1</small></a>
14978 <pre>
14979           #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14980           C atomic_load(volatile A *object);
14981           C atomic_load_explicit(volatile A *object,
14982                memory_order order);
14983 </pre>
14984 <p><b>Description</b>
14985 <p><a name="7.17.7.2p2" href="#7.17.7.2p2"><small>2</small></a>
14986  The order argument shall not be memory_order_release nor
14987  memory_order_acq_rel. Memory is affected according to the value of order.
14988 <p><b>Returns</b>
14989  Atomically returns the value pointed to by object.
14990 <!--page 301 -->
14991
14992 <p><small><a href="#Contents">Contents</a></small>
14993 <h5><a name="7.17.7.3" href="#7.17.7.3">7.17.7.3 The atomic_exchange generic functions</a></h5>
14994 <p><b>Synopsis</b>
14995 <p><a name="7.17.7.3p1" href="#7.17.7.3p1"><small>1</small></a>
14996 <pre>
14997           #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
14998           C atomic_exchange(volatile A *object, C desired);
14999           C atomic_exchange_explicit(volatile A *object,
15000                C desired, memory_order order);
15001 </pre>
15002 <p><b>Description</b>
15003 <p><a name="7.17.7.3p2" href="#7.17.7.3p2"><small>2</small></a>
15004  Atomically replace the value pointed to by object with desired. Memory is affected
15005  according to the value of order. These operations are read-modify-write operations
15006  (<a href="#5.1.2.4">5.1.2.4</a>).
15007 <p><b>Returns</b>
15008 <p><a name="7.17.7.3p3" href="#7.17.7.3p3"><small>3</small></a>
15009  Atomically returns the value pointed to by object immediately before the effects.
15010
15011 <p><small><a href="#Contents">Contents</a></small>
15012 <h5><a name="7.17.7.4" href="#7.17.7.4">7.17.7.4 The atomic_compare_exchange generic functions</a></h5>
15013 <p><b>Synopsis</b>
15014 <p><a name="7.17.7.4p1" href="#7.17.7.4p1"><small>1</small></a>
15015 <pre>
15016           #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
15017           _Bool atomic_compare_exchange_strong(volatile A *object,
15018                C *expected, C desired);
15019           _Bool atomic_compare_exchange_strong_explicit(
15020                volatile A *object, C *expected, C desired,
15021                memory_order success, memory_order failure);
15022           _Bool atomic_compare_exchange_weak(volatile A *object,
15023                C *expected, C desired);
15024           _Bool atomic_compare_exchange_weak_explicit(
15025                volatile A *object, C *expected, C desired,
15026                memory_order success, memory_order failure);
15027 </pre>
15028 <p><b>Description</b>
15029 <p><a name="7.17.7.4p2" href="#7.17.7.4p2"><small>2</small></a>
15030  The failure argument shall not be memory_order_release nor
15031  memory_order_acq_rel. The failure argument shall be no stronger than the
15032  success argument. Atomically, compares the value pointed to by object for equality
15033  with that in expected, and if true, replaces the value pointed to by object with
15034  desired, and if false, updates the value in expected with the value pointed to by
15035  object. Further, if the comparison is true, memory is affected according to the value of
15036  success, and if the comparison is false, memory is affected according to the value of
15037  failure. These operations are atomic read-modify-write operations (<a href="#5.1.2.4">5.1.2.4</a>).
15038 <p><a name="7.17.7.4p3" href="#7.17.7.4p3"><small>3</small></a>
15039  NOTE 1    For example, the effect of atomic_compare_exchange_strong is
15040 <!--page 302 -->
15041 <pre>
15042           if (memcmp(object, expected, sizeof (*object)) == 0)
15043                 memcpy(object, &amp;desired, sizeof (*object));
15044           else
15045                 memcpy(expected, object, sizeof (*object));
15046 </pre>
15047  
15048 <p><a name="7.17.7.4p4" href="#7.17.7.4p4"><small>4</small></a>
15049  A weak compare-and-exchange operation may fail spuriously. That is, even when the
15050  contents of memory referred to by expected and object are equal, it may return zero
15051  and store back to expected the same memory contents that were originally there.
15052 <p><a name="7.17.7.4p5" href="#7.17.7.4p5"><small>5</small></a>
15053  NOTE 2 This spurious failure enables implementation of compare-and-exchange on a broader class of
15054  machines, e.g. load-locked store-conditional machines.
15055  
15056 <p><a name="7.17.7.4p6" href="#7.17.7.4p6"><small>6</small></a>
15057  EXAMPLE         A consequence of spurious failure is that nearly all uses of weak compare-and-exchange will
15058  be in a loop.
15059 <pre>
15060           exp = atomic_load(&amp;cur);
15061           do {
15062                 des = function(exp);
15063           } while (!atomic_compare_exchange_weak(&amp;cur, &amp;exp, des));
15064 </pre>
15065  When a compare-and-exchange is in a loop, the weak version will yield better performance on some
15066  platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the
15067  strong one is preferable.
15068  
15069 <p><b>Returns</b>
15070 <p><a name="7.17.7.4p7" href="#7.17.7.4p7"><small>7</small></a>
15071  The result of the comparison.
15072
15073 <p><small><a href="#Contents">Contents</a></small>
15074 <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>
15075 <p><a name="7.17.7.5p1" href="#7.17.7.5p1"><small>1</small></a>
15076  The following operations perform arithmetic and bitwise computations. All of these
15077  operations are applicable to an object of any atomic integer type. None of these *
15078  operations is applicable to atomic_bool. The key, operator, and computation
15079  correspondence is:
15080   key            op          computation
15081   add            +       addition
15082   sub            -       subtraction
15083   or             |       bitwise inclusive or
15084   xor            ^       bitwise exclusive or
15085   and            &amp;       bitwise and
15086 <p><b>Synopsis</b>
15087 <p><a name="7.17.7.5p2" href="#7.17.7.5p2"><small>2</small></a>
15088 <pre>
15089           #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
15090           C atomic_fetch_key(volatile A *object, M operand);
15091           C atomic_fetch_key_explicit(volatile A *object,
15092                M operand, memory_order order);
15093 </pre>
15094 <p><b>Description</b>
15095 <p><a name="7.17.7.5p3" href="#7.17.7.5p3"><small>3</small></a>
15096  Atomically replaces the value pointed to by object with the result of the computation
15097  applied to the value pointed to by object and the given operand. Memory is affected
15098 <!--page 303 -->
15099  according to the value of order. These operations are atomic read-modify-write
15100  operations (<a href="#5.1.2.4">5.1.2.4</a>). For signed integer types, arithmetic is defined to use two's
15101  complement representation with silent wrap-around on overflow; there are no undefined
15102  results. For address types, the result may be an undefined address, but the operations
15103  otherwise have no undefined behavior.
15104 <p><b>Returns</b>
15105 <p><a name="7.17.7.5p4" href="#7.17.7.5p4"><small>4</small></a>
15106  Atomically, the value pointed to by object immediately before the effects.
15107 <p><a name="7.17.7.5p5" href="#7.17.7.5p5"><small>5</small></a>
15108  NOTE The operation of the atomic_fetch and modify generic functions are nearly equivalent to the
15109  operation of the corresponding op= compound assignment operators. The only differences are that the
15110  compound assignment operators are not guaranteed to operate atomically, and the value yielded by a
15111  compound assignment operator is the updated value of the object, whereas the value returned by the
15112  atomic_fetch and modify generic functions is the previous value of the atomic object.
15113  
15114
15115 <p><small><a href="#Contents">Contents</a></small>
15116 <h4><a name="7.17.8" href="#7.17.8">7.17.8 Atomic flag type and operations</a></h4>
15117 <p><a name="7.17.8p1" href="#7.17.8p1"><small>1</small></a>
15118  The atomic_flag type provides the classic test-and-set functionality. It has two
15119  states, set and clear.
15120 <p><a name="7.17.8p2" href="#7.17.8p2"><small>2</small></a>
15121  Operations on an object of type atomic_flag shall be lock free.
15122 <p><a name="7.17.8p3" href="#7.17.8p3"><small>3</small></a>
15123  NOTE Hence the operations should also be address-free. No other type requires lock-free operations, so
15124  the atomic_flag type is the minimum hardware-implemented type needed to conform to this
15125  International standard. The remaining types can be emulated with atomic_flag, though with less than
15126  ideal properties.
15127  
15128 <p><a name="7.17.8p4" href="#7.17.8p4"><small>4</small></a>
15129  The macro ATOMIC_FLAG_INIT may be used to initialize an atomic_flag to the
15130  clear state. An atomic_flag that is not explicitly initialized with
15131  ATOMIC_FLAG_INIT is initially in an indeterminate state.
15132 <p><a name="7.17.8p5" href="#7.17.8p5"><small>5</small></a>
15133  EXAMPLE
15134 <pre>
15135          atomic_flag guard = ATOMIC_FLAG_INIT;
15136 </pre>
15137  
15138
15139 <p><small><a href="#Contents">Contents</a></small>
15140 <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>
15141 <p><b>Synopsis</b>
15142 <p><a name="7.17.8.1p1" href="#7.17.8.1p1"><small>1</small></a>
15143 <pre>
15144          #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
15145          _Bool atomic_flag_test_and_set(
15146               volatile atomic_flag *object);
15147          _Bool atomic_flag_test_and_set_explicit(
15148               volatile atomic_flag *object, memory_order order);
15149 </pre>
15150 <p><b>Description</b>
15151 <p><a name="7.17.8.1p2" href="#7.17.8.1p2"><small>2</small></a>
15152  Atomically sets the value pointed to by object to true. Memory is affected according
15153  to the value of order. These operations are atomic read-modify-write operations
15154  (<a href="#5.1.2.4">5.1.2.4</a>).
15155 <!--page 304 -->
15156 <p><b>Returns</b>
15157 <p><a name="7.17.8.1p3" href="#7.17.8.1p3"><small>3</small></a>
15158  Atomically, the value of the object immediately before the effects.
15159
15160 <p><small><a href="#Contents">Contents</a></small>
15161 <h5><a name="7.17.8.2" href="#7.17.8.2">7.17.8.2 The atomic_flag_clear functions</a></h5>
15162 <p><b>Synopsis</b>
15163 <p><a name="7.17.8.2p1" href="#7.17.8.2p1"><small>1</small></a>
15164 <pre>
15165         #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
15166         void atomic_flag_clear(volatile atomic_flag *object);
15167         void atomic_flag_clear_explicit(
15168              volatile atomic_flag *object, memory_order order);
15169 </pre>
15170 <p><b>Description</b>
15171 <p><a name="7.17.8.2p2" href="#7.17.8.2p2"><small>2</small></a>
15172  The order argument shall not be memory_order_acquire nor
15173  memory_order_acq_rel. Atomically sets the value pointed to by object to false.
15174  Memory is affected according to the value of order.
15175 <p><b>Returns</b>
15176 <p><a name="7.17.8.2p3" href="#7.17.8.2p3"><small>3</small></a>
15177  The atomic_flag_clear functions return no value.
15178 <!--page 305 -->
15179
15180 <p><small><a href="#Contents">Contents</a></small>
15181 <h3><a name="7.18" href="#7.18">7.18 Boolean type and values &lt;stdbool.h&gt;</a></h3>
15182 <p><a name="7.18p1" href="#7.18p1"><small>1</small></a>
15183  The header <a href="#7.18">&lt;stdbool.h&gt;</a> defines four macros.
15184 <p><a name="7.18p2" href="#7.18p2"><small>2</small></a>
15185  The macro
15186 <pre>
15187           bool
15188 </pre>
15189  expands to _Bool.
15190 <p><a name="7.18p3" href="#7.18p3"><small>3</small></a>
15191  The remaining three macros are suitable for use in #if preprocessing directives. They
15192  are
15193 <pre>
15194           true
15195 </pre>
15196  which expands to the integer constant 1,
15197 <pre>
15198           false
15199 </pre>
15200  which expands to the integer constant 0, and
15201 <pre>
15202           __bool_true_false_are_defined
15203 </pre>
15204  which expands to the integer constant 1.
15205 <p><a name="7.18p4" href="#7.18p4"><small>4</small></a>
15206  Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
15207  redefine the macros bool, true, and false.<sup><a href="#note259"><b>259)</b></a></sup>
15208  
15209  
15210  
15211  
15212 <!--page 306 -->
15213
15214 <p><b>Footnotes</b>
15215 <p><small><a name="note259" href="#note259">259)</a> See ''future library directions'' (<a href="#7.31.9">7.31.9</a>).
15216 </small>
15217
15218 <p><small><a href="#Contents">Contents</a></small>
15219 <h3><a name="7.19" href="#7.19">7.19 Common definitions &lt;stddef.h&gt;</a></h3>
15220 <p><a name="7.19p1" href="#7.19p1"><small>1</small></a>
15221  The header <a href="#7.19">&lt;stddef.h&gt;</a> defines the following macros and declares the following types.
15222  Some are also defined in other headers, as noted in their respective subclauses.
15223 <p><a name="7.19p2" href="#7.19p2"><small>2</small></a>
15224  The types are
15225 <pre>
15226         ptrdiff_t
15227 </pre>
15228  which is the signed integer type of the result of subtracting two pointers;
15229 <pre>
15230         size_t
15231 </pre>
15232  which is the unsigned integer type of the result of the sizeof operator;
15233 <pre>
15234         max_align_t
15235 </pre>
15236  which is an object type whose alignment is as great as is supported by the implementation
15237  in all contexts; and
15238 <pre>
15239         wchar_t
15240 </pre>
15241  which is an integer type whose range of values can represent distinct codes for all
15242  members of the largest extended character set specified among the supported locales; the
15243  null character shall have the code value zero. Each member of the basic character set
15244  shall have a code value equal to its value when used as the lone character in an integer
15245  character      constant     if     an      implementation      does      not      define
15246  __STDC_MB_MIGHT_NEQ_WC__.
15247 <p><a name="7.19p3" href="#7.19p3"><small>3</small></a>
15248  The macros are
15249 <pre>
15250         NULL
15251 </pre>
15252  which expands to an implementation-defined null pointer constant; and
15253 <pre>
15254         offsetof(type, member-designator)
15255 </pre>
15256  which expands to an integer constant expression that has type size_t, the value of
15257  which is the offset in bytes, to the structure member (designated by member-designator),
15258  from the beginning of its structure (designated by type). The type and member designator
15259  shall be such that given
15260 <pre>
15261         static type t;
15262 </pre>
15263  then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
15264  specified member is a bit-field, the behavior is undefined.)
15265 <p><b>Recommended practice</b>
15266 <p><a name="7.19p4" href="#7.19p4"><small>4</small></a>
15267  The types used for size_t and ptrdiff_t should not have an integer conversion rank
15268  greater than that of signed long int unless the implementation supports objects
15269  large enough to make this necessary.                                               *
15270 <!--page 307 -->
15271
15272 <p><small><a href="#Contents">Contents</a></small>
15273 <h3><a name="7.20" href="#7.20">7.20 Integer types &lt;stdint.h&gt;</a></h3>
15274 <p><a name="7.20p1" href="#7.20p1"><small>1</small></a>
15275  The header <a href="#7.20">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
15276  defines corresponding sets of macros.<sup><a href="#note260"><b>260)</b></a></sup> It also defines macros that specify limits of
15277  integer types corresponding to types defined in other standard headers.
15278 <p><a name="7.20p2" href="#7.20p2"><small>2</small></a>
15279  Types are defined in the following categories:
15280 <ul>
15281 <li>  integer types having certain exact widths;
15282 <li>  integer types having at least certain specified widths;
15283 <li>  fastest integer types having at least certain specified widths;
15284 <li>  integer types wide enough to hold pointers to objects;
15285 <li>  integer types having greatest width.
15286 </ul>
15287  (Some of these types may denote the same type.)
15288 <p><a name="7.20p3" href="#7.20p3"><small>3</small></a>
15289  Corresponding macros specify limits of the declared types and construct suitable
15290  constants.
15291 <p><a name="7.20p4" href="#7.20p4"><small>4</small></a>
15292  For each type described herein that the implementation provides,<sup><a href="#note261"><b>261)</b></a></sup> <a href="#7.20">&lt;stdint.h&gt;</a> shall
15293  declare that typedef name and define the associated macros. Conversely, for each type
15294  described herein that the implementation does not provide, <a href="#7.20">&lt;stdint.h&gt;</a> shall not
15295  declare that typedef name nor shall it define the associated macros. An implementation
15296  shall provide those types described as ''required'', but need not provide any of the others
15297  (described as ''optional'').
15298
15299 <p><b>Footnotes</b>
15300 <p><small><a name="note260" href="#note260">260)</a> See ''future library directions'' (<a href="#7.31.10">7.31.10</a>).
15301 </small>
15302 <p><small><a name="note261" href="#note261">261)</a> Some of these types may denote implementation-defined extended integer types.
15303 </small>
15304
15305 <p><small><a href="#Contents">Contents</a></small>
15306 <h4><a name="7.20.1" href="#7.20.1">7.20.1 Integer types</a></h4>
15307 <p><a name="7.20.1p1" href="#7.20.1p1"><small>1</small></a>
15308  When typedef names differing only in the absence or presence of the initial u are defined,
15309  they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
15310  implementation providing one of these corresponding types shall also provide the other.
15311 <p><a name="7.20.1p2" href="#7.20.1p2"><small>2</small></a>
15312  In the following descriptions, the symbol N represents an unsigned decimal integer with
15313  no leading zeros (e.g., 8 or 24, but not 04 or 048).
15314  
15315  
15316  
15317  
15318 <!--page 308 -->
15319
15320 <p><small><a href="#Contents">Contents</a></small>
15321 <h5><a name="7.20.1.1" href="#7.20.1.1">7.20.1.1 Exact-width integer types</a></h5>
15322 <p><a name="7.20.1.1p1" href="#7.20.1.1p1"><small>1</small></a>
15323  The typedef name intN_t designates a signed integer type with width N , no padding
15324  bits, and a two's complement representation. Thus, int8_t denotes such a signed
15325  integer type with a width of exactly 8 bits.
15326 <p><a name="7.20.1.1p2" href="#7.20.1.1p2"><small>2</small></a>
15327  The typedef name uintN_t designates an unsigned integer type with width N and no
15328  padding bits. Thus, uint24_t denotes such an unsigned integer type with a width of
15329  exactly 24 bits.
15330 <p><a name="7.20.1.1p3" href="#7.20.1.1p3"><small>3</small></a>
15331  These types are optional. However, if an implementation provides integer types with
15332  widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
15333  two's complement representation, it shall define the corresponding typedef names.
15334
15335 <p><small><a href="#Contents">Contents</a></small>
15336 <h5><a name="7.20.1.2" href="#7.20.1.2">7.20.1.2 Minimum-width integer types</a></h5>
15337 <p><a name="7.20.1.2p1" href="#7.20.1.2p1"><small>1</small></a>
15338  The typedef name int_leastN_t designates a signed integer type with a width of at
15339  least N , such that no signed integer type with lesser size has at least the specified width.
15340  Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
15341 <p><a name="7.20.1.2p2" href="#7.20.1.2p2"><small>2</small></a>
15342  The typedef name uint_leastN_t designates an unsigned integer type with a width
15343  of at least N , such that no unsigned integer type with lesser size has at least the specified
15344  width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
15345  least 16 bits.
15346 <p><a name="7.20.1.2p3" href="#7.20.1.2p3"><small>3</small></a>
15347  The following types are required:
15348 <pre>
15349           int_least8_t                                      uint_least8_t
15350           int_least16_t                                     uint_least16_t
15351           int_least32_t                                     uint_least32_t
15352           int_least64_t                                     uint_least64_t
15353 </pre>
15354  All other types of this form are optional.
15355
15356 <p><small><a href="#Contents">Contents</a></small>
15357 <h5><a name="7.20.1.3" href="#7.20.1.3">7.20.1.3 Fastest minimum-width integer types</a></h5>
15358 <p><a name="7.20.1.3p1" href="#7.20.1.3p1"><small>1</small></a>
15359  Each of the following types designates an integer type that is usually fastest<sup><a href="#note262"><b>262)</b></a></sup> to operate
15360  with among all integer types that have at least the specified width.
15361 <p><a name="7.20.1.3p2" href="#7.20.1.3p2"><small>2</small></a>
15362  The typedef name int_fastN_t designates the fastest signed integer type with a width
15363  of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
15364  type with a width of at least N .
15365  
15366  
15367  
15368  
15369 <!--page 309 -->
15370 <p><a name="7.20.1.3p3" href="#7.20.1.3p3"><small>3</small></a>
15371  The following types are required:
15372 <pre>
15373          int_fast8_t                                    uint_fast8_t
15374          int_fast16_t                                   uint_fast16_t
15375          int_fast32_t                                   uint_fast32_t
15376          int_fast64_t                                   uint_fast64_t
15377 </pre>
15378  All other types of this form are optional.
15379
15380 <p><b>Footnotes</b>
15381 <p><small><a name="note262" href="#note262">262)</a> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
15382  grounds for choosing one type over another, it will simply pick some integer type satisfying the
15383  signedness and width requirements.
15384 </small>
15385
15386 <p><small><a href="#Contents">Contents</a></small>
15387 <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>
15388 <p><a name="7.20.1.4p1" href="#7.20.1.4p1"><small>1</small></a>
15389  The following type designates a signed integer type with the property that any valid
15390  pointer to void can be converted to this type, then converted back to pointer to void,
15391  and the result will compare equal to the original pointer:
15392 <pre>
15393          intptr_t
15394 </pre>
15395  The following type designates an unsigned integer type with the property that any valid
15396  pointer to void can be converted to this type, then converted back to pointer to void,
15397  and the result will compare equal to the original pointer:
15398 <pre>
15399          uintptr_t
15400 </pre>
15401  These types are optional.
15402
15403 <p><small><a href="#Contents">Contents</a></small>
15404 <h5><a name="7.20.1.5" href="#7.20.1.5">7.20.1.5 Greatest-width integer types</a></h5>
15405 <p><a name="7.20.1.5p1" href="#7.20.1.5p1"><small>1</small></a>
15406  The following type designates a signed integer type capable of representing any value of
15407  any signed integer type:
15408 <pre>
15409          intmax_t
15410 </pre>
15411  The following type designates an unsigned integer type capable of representing any value
15412  of any unsigned integer type:
15413 <pre>
15414          uintmax_t
15415 </pre>
15416  These types are required.
15417
15418 <p><small><a href="#Contents">Contents</a></small>
15419 <h4><a name="7.20.2" href="#7.20.2">7.20.2 Limits of specified-width integer types</a></h4>
15420 <p><a name="7.20.2p1" href="#7.20.2p1"><small>1</small></a>
15421  The following object-like macros specify the minimum and maximum limits of the types
15422  declared in <a href="#7.20">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
15423  <a href="#7.20.1">7.20.1</a>.
15424 <p><a name="7.20.2p2" href="#7.20.2p2"><small>2</small></a>
15425  Each instance of any defined macro shall be replaced by a constant expression suitable
15426  for use in #if preprocessing directives, and this expression shall have the same type as
15427  would an expression that is an object of the corresponding type converted according to
15428  the integer promotions. Its implementation-defined value shall be equal to or greater in
15429  magnitude (absolute value) than the corresponding value given below, with the same sign,
15430  except where stated to be exactly the given value.
15431 <!--page 310 -->
15432
15433 <p><small><a href="#Contents">Contents</a></small>
15434 <h5><a name="7.20.2.1" href="#7.20.2.1">7.20.2.1 Limits of exact-width integer types</a></h5>
15435 <p><a name="7.20.2.1p1" href="#7.20.2.1p1"><small>1</small></a>
15436 <ul>
15437 <li>  minimum values of exact-width signed integer types
15438 <pre>
15439      INTN_MIN                                  exactly -(2 N -1 )
15440 </pre>
15441 <li>  maximum values of exact-width signed integer types
15442 <pre>
15443      INTN_MAX                                  exactly 2 N -1 - 1
15444 </pre>
15445 <li>  maximum values of exact-width unsigned integer types
15446   UINTN_MAX                                    exactly 2 N - 1
15447 </ul>
15448
15449 <p><small><a href="#Contents">Contents</a></small>
15450 <h5><a name="7.20.2.2" href="#7.20.2.2">7.20.2.2 Limits of minimum-width integer types</a></h5>
15451 <p><a name="7.20.2.2p1" href="#7.20.2.2p1"><small>1</small></a>
15452 <ul>
15453 <li>  minimum values of minimum-width signed integer types
15454 <pre>
15455      INT_LEASTN_MIN                                    -(2 N -1 - 1)
15456 </pre>
15457 <li>  maximum values of minimum-width signed integer types
15458 <pre>
15459      INT_LEASTN_MAX                                    2 N -1 - 1
15460 </pre>
15461 <li>  maximum values of minimum-width unsigned integer types
15462   UINT_LEASTN_MAX                                      2N - 1
15463 </ul>
15464
15465 <p><small><a href="#Contents">Contents</a></small>
15466 <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>
15467 <p><a name="7.20.2.3p1" href="#7.20.2.3p1"><small>1</small></a>
15468 <ul>
15469 <li>  minimum values of fastest minimum-width signed integer types
15470 <pre>
15471      INT_FASTN_MIN                                     -(2 N -1 - 1)
15472 </pre>
15473 <li>  maximum values of fastest minimum-width signed integer types
15474   INT_FASTN_MAX                                        2 N -1 - 1
15475 <li>  maximum values of fastest minimum-width unsigned integer types
15476   UINT_FASTN_MAX                                       2N - 1
15477 </ul>
15478
15479 <p><small><a href="#Contents">Contents</a></small>
15480 <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>
15481 <p><a name="7.20.2.4p1" href="#7.20.2.4p1"><small>1</small></a>
15482 <ul>
15483 <li>  minimum value of pointer-holding signed integer type
15484 <pre>
15485      INTPTR_MIN                                        -(215 - 1)
15486 </pre>
15487 <li>  maximum value of pointer-holding signed integer type
15488   INTPTR_MAX                                           215 - 1
15489 <li>  maximum value of pointer-holding unsigned integer type
15490   UINTPTR_MAX                                          216 - 1
15491 <!--page 311 -->
15492 </ul>
15493
15494 <p><small><a href="#Contents">Contents</a></small>
15495 <h5><a name="7.20.2.5" href="#7.20.2.5">7.20.2.5 Limits of greatest-width integer types</a></h5>
15496 <p><a name="7.20.2.5p1" href="#7.20.2.5p1"><small>1</small></a>
15497 <ul>
15498 <li>  minimum value of greatest-width signed integer type
15499    INTMAX_MIN                                                    -(263 - 1)
15500 <li>  maximum value of greatest-width signed integer type
15501    INTMAX_MAX                                                    263 - 1
15502 <li>  maximum value of greatest-width unsigned integer type
15503    UINTMAX_MAX                                                   264 - 1
15504 </ul>
15505
15506 <p><small><a href="#Contents">Contents</a></small>
15507 <h4><a name="7.20.3" href="#7.20.3">7.20.3 Limits of other integer types</a></h4>
15508 <p><a name="7.20.3p1" href="#7.20.3p1"><small>1</small></a>
15509  The following object-like macros specify the minimum and maximum limits of integer
15510  types corresponding to types defined in other standard headers.
15511 <p><a name="7.20.3p2" href="#7.20.3p2"><small>2</small></a>
15512  Each instance of these macros shall be replaced by a constant expression suitable for use
15513  in #if preprocessing directives, and this expression shall have the same type as would an
15514  expression that is an object of the corresponding type converted according to the integer
15515  promotions. Its implementation-defined value shall be equal to or greater in magnitude
15516  (absolute value) than the corresponding value given below, with the same sign. An
15517  implementation shall define only the macros corresponding to those typedef names it
15518  actually provides.<sup><a href="#note263"><b>263)</b></a></sup>
15519 <ul>
15520 <li>  limits of ptrdiff_t
15521    PTRDIFF_MIN                                                 -65535
15522    PTRDIFF_MAX                                                 +65535
15523 <li>  limits of sig_atomic_t
15524    SIG_ATOMIC_MIN                                              see below
15525    SIG_ATOMIC_MAX                                              see below
15526 <li>  limit of size_t
15527    SIZE_MAX                                                      65535
15528 <li>  limits of wchar_t
15529    WCHAR_MIN                                                   see below
15530    WCHAR_MAX                                                   see below
15531 <li>  limits of wint_t
15532  
15533  
15534  
15535  
15536 <!--page 312 -->
15537    WINT_MIN                                              see below
15538    WINT_MAX                                              see below
15539 </ul>
15540 <p><a name="7.20.3p3" href="#7.20.3p3"><small>3</small></a>
15541  If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
15542  SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
15543  shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
15544  type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
15545  SIG_ATOMIC_MAX shall be no less than 255.
15546 <p><a name="7.20.3p4" href="#7.20.3p4"><small>4</small></a>
15547  If wchar_t (see <a href="#7.19">7.19</a>) is defined as a signed integer type, the value of WCHAR_MIN
15548  shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
15549  otherwise, wchar_t is defined as an unsigned integer type, and the value of
15550  WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.<sup><a href="#note264"><b>264)</b></a></sup>
15551 <p><a name="7.20.3p5" href="#7.20.3p5"><small>5</small></a>
15552  If wint_t (see <a href="#7.29">7.29</a>) is defined as a signed integer type, the value of WINT_MIN shall
15553  be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
15554  otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
15555  shall be 0 and the value of WINT_MAX shall be no less than 65535.
15556
15557 <p><b>Footnotes</b>
15558 <p><small><a name="note263" href="#note263">263)</a> A freestanding implementation need not provide all of these types.
15559 </small>
15560 <p><small><a name="note264" href="#note264">264)</a> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
15561  character set.
15562 </small>
15563
15564 <p><small><a href="#Contents">Contents</a></small>
15565 <h4><a name="7.20.4" href="#7.20.4">7.20.4 Macros for integer constants</a></h4>
15566 <p><a name="7.20.4p1" href="#7.20.4p1"><small>1</small></a>
15567  The following function-like macros expand to integer constants suitable for initializing
15568  objects that have integer types corresponding to types defined in <a href="#7.20">&lt;stdint.h&gt;</a>. Each
15569  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>.
15570 <p><a name="7.20.4p2" href="#7.20.4p2"><small>2</small></a>
15571  The argument in any instance of these macros shall be an unsuffixed integer constant (as
15572  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.
15573 <p><a name="7.20.4p3" href="#7.20.4p3"><small>3</small></a>
15574  Each invocation of one of these macros shall expand to an integer constant expression
15575  suitable for use in #if preprocessing directives. The type of the expression shall have
15576  the same type as would an expression of the corresponding type converted according to
15577  the integer promotions. The value of the expression shall be that of the argument.
15578
15579 <p><small><a href="#Contents">Contents</a></small>
15580 <h5><a name="7.20.4.1" href="#7.20.4.1">7.20.4.1 Macros for minimum-width integer constants</a></h5>
15581 <p><a name="7.20.4.1p1" href="#7.20.4.1p1"><small>1</small></a>
15582  The macro INTN_C(value) shall expand to an integer constant expression
15583  corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
15584  to an integer constant expression corresponding to the type uint_leastN_t. For
15585  example, if uint_least64_t is a name for the type unsigned long long int,
15586  then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
15587  
15588  
15589  
15590  
15591 <!--page 313 -->
15592
15593 <p><small><a href="#Contents">Contents</a></small>
15594 <h5><a name="7.20.4.2" href="#7.20.4.2">7.20.4.2 Macros for greatest-width integer constants</a></h5>
15595 <p><a name="7.20.4.2p1" href="#7.20.4.2p1"><small>1</small></a>
15596  The following macro expands to an integer constant expression having the value specified
15597  by its argument and the type intmax_t:
15598 <pre>
15599          INTMAX_C(value)
15600 </pre>
15601  The following macro expands to an integer constant expression having the value specified
15602  by its argument and the type uintmax_t:
15603 <!--page 314 -->
15604 <pre>
15605          UINTMAX_C(value)
15606 </pre>
15607
15608 <p><small><a href="#Contents">Contents</a></small>
15609 <h3><a name="7.21" href="#7.21">7.21 Input/output &lt;stdio.h&gt;</a></h3>
15610
15611 <p><small><a href="#Contents">Contents</a></small>
15612 <h4><a name="7.21.1" href="#7.21.1">7.21.1 Introduction</a></h4>
15613 <p><a name="7.21.1p1" href="#7.21.1p1"><small>1</small></a>
15614  The header <a href="#7.21">&lt;stdio.h&gt;</a> defines several macros, and declares three types and many
15615  functions for performing input and output.
15616 <p><a name="7.21.1p2" href="#7.21.1p2"><small>2</small></a>
15617  The types declared are size_t (described in <a href="#7.19">7.19</a>);
15618 <pre>
15619         FILE
15620 </pre>
15621  which is an object type capable of recording all the information needed to control a
15622  stream, including its file position indicator, a pointer to its associated buffer (if any), an
15623  error indicator that records whether a read/write error has occurred, and an end-of-file
15624  indicator that records whether the end of the file has been reached; and
15625 <pre>
15626         fpos_t
15627 </pre>
15628  which is a complete object type other than an array type capable of recording all the
15629  information needed to specify uniquely every position within a file.
15630 <p><a name="7.21.1p3" href="#7.21.1p3"><small>3</small></a>
15631  The macros are NULL (described in <a href="#7.19">7.19</a>);
15632 <pre>
15633         _IOFBF
15634         _IOLBF
15635         _IONBF
15636 </pre>
15637  which expand to integer constant expressions with distinct values, suitable for use as the
15638  third argument to the setvbuf function;
15639 <pre>
15640         BUFSIZ
15641 </pre>
15642  which expands to an integer constant expression that is the size of the buffer used by the
15643  setbuf function;
15644 <pre>
15645         EOF
15646 </pre>
15647  which expands to an integer constant expression, with type int and a negative value, that
15648  is returned by several functions to indicate end-of-file, that is, no more input from a
15649  stream;
15650 <pre>
15651         FOPEN_MAX
15652 </pre>
15653  which expands to an integer constant expression that is the minimum number of files that
15654  the implementation guarantees can be open simultaneously;
15655 <pre>
15656         FILENAME_MAX
15657 </pre>
15658  which expands to an integer constant expression that is the size needed for an array of
15659  char large enough to hold the longest file name string that the implementation
15660 <!--page 315 -->
15661  guarantees can be opened;<sup><a href="#note265"><b>265)</b></a></sup>
15662 <pre>
15663          L_tmpnam
15664 </pre>
15665  which expands to an integer constant expression that is the size needed for an array of
15666  char large enough to hold a temporary file name string generated by the tmpnam
15667  function;
15668 <pre>
15669          SEEK_CUR
15670          SEEK_END
15671          SEEK_SET
15672 </pre>
15673  which expand to integer constant expressions with distinct values, suitable for use as the
15674  third argument to the fseek function;
15675 <pre>
15676          TMP_MAX
15677 </pre>
15678  which expands to an integer constant expression that is the minimum number of unique
15679  file names that can be generated by the tmpnam function;
15680 <pre>
15681          stderr
15682          stdin
15683          stdout
15684 </pre>
15685  which are expressions of type ''pointer to FILE'' that point to the FILE objects
15686  associated, respectively, with the standard error, input, and output streams.
15687 <p><a name="7.21.1p4" href="#7.21.1p4"><small>4</small></a>
15688  The header <a href="#7.29">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
15689  and output. The wide character input/output functions described in that subclause
15690  provide operations analogous to most of those described here, except that the
15691  fundamental units internal to the program are wide characters. The external
15692  representation (in the file) is a sequence of ''generalized'' multibyte characters, as
15693  described further in <a href="#7.21.3">7.21.3</a>.
15694 <p><a name="7.21.1p5" href="#7.21.1p5"><small>5</small></a>
15695  The input/output functions are given the following collective terms:
15696 <ul>
15697 <li>  The wide character input functions -- those functions described in <a href="#7.29">7.29</a> that perform
15698  input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
15699  fwscanf, wscanf, vfwscanf, and vwscanf.
15700 <li>  The wide character output functions -- those functions described in <a href="#7.29">7.29</a> that perform
15701  output from wide characters and wide strings: fputwc, fputws, putwc,
15702  putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
15703  
15704  
15705 <!--page 316 -->
15706 <li>  The wide character input/output functions -- the union of the ungetwc function, the
15707  wide character input functions, and the wide character output functions.
15708 <li>  The byte input/output functions -- those functions described in this subclause that
15709  perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
15710  fscanf, fwrite, getc, getchar, printf, putc, putchar, puts, scanf,
15711  ungetc, vfprintf, vfscanf, vprintf, and vscanf.
15712 </ul>
15713 <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
15714  tmpnam function (<a href="#7.21.4.4">7.21.4.4</a>), <a href="#7.29">&lt;wchar.h&gt;</a> (<a href="#7.29">7.29</a>).
15715
15716 <p><b>Footnotes</b>
15717 <p><small><a name="note265" href="#note265">265)</a> If the implementation imposes no practical limit on the length of file name strings, the value of
15718  FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
15719  string. Of course, file name string contents are subject to other system-specific constraints; therefore
15720  all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
15721 </small>
15722
15723 <p><small><a href="#Contents">Contents</a></small>
15724 <h4><a name="7.21.2" href="#7.21.2">7.21.2 Streams</a></h4>
15725 <p><a name="7.21.2p1" href="#7.21.2p1"><small>1</small></a>
15726  Input and output, whether to or from physical devices such as terminals and tape drives,
15727  or whether to or from files supported on structured storage devices, are mapped into
15728  logical data streams, whose properties are more uniform than their various inputs and
15729  outputs. Two forms of mapping are supported, for text streams and for binary
15730  streams.<sup><a href="#note266"><b>266)</b></a></sup>
15731 <p><a name="7.21.2p2" href="#7.21.2p2"><small>2</small></a>
15732  A text stream is an ordered sequence of characters composed into lines, each line
15733  consisting of zero or more characters plus a terminating new-line character. Whether the
15734  last line requires a terminating new-line character is implementation-defined. Characters
15735  may have to be added, altered, or deleted on input and output to conform to differing
15736  conventions for representing text in the host environment. Thus, there need not be a one-
15737  to-one correspondence between the characters in a stream and those in the external
15738  representation. Data read in from a text stream will necessarily compare equal to the data
15739  that were earlier written out to that stream only if: the data consist only of printing
15740  characters and the control characters horizontal tab and new-line; no new-line character is
15741  immediately preceded by space characters; and the last character is a new-line character.
15742  Whether space characters that are written out immediately before a new-line character
15743  appear when read in is implementation-defined.
15744 <p><a name="7.21.2p3" href="#7.21.2p3"><small>3</small></a>
15745  A binary stream is an ordered sequence of characters that can transparently record
15746  internal data. Data read in from a binary stream shall compare equal to the data that were
15747  earlier written out to that stream, under the same implementation. Such a stream may,
15748  however, have an implementation-defined number of null characters appended to the end
15749  of the stream.
15750 <p><a name="7.21.2p4" href="#7.21.2p4"><small>4</small></a>
15751  Each stream has an orientation. After a stream is associated with an external file, but
15752  before any operations are performed on it, the stream is without orientation. Once a wide
15753  character input/output function has been applied to a stream without orientation, the
15754  
15755  
15756 <!--page 317 -->
15757  stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
15758  been applied to a stream without orientation, the stream becomes a byte-oriented stream.
15759  Only a call to the freopen function or the fwide function can otherwise alter the
15760  orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note267"><b>267)</b></a></sup>
15761 <p><a name="7.21.2p5" href="#7.21.2p5"><small>5</small></a>
15762  Byte input/output functions shall not be applied to a wide-oriented stream and wide
15763  character input/output functions shall not be applied to a byte-oriented stream. The
15764  remaining stream operations do not affect, and are not affected by, a stream's orientation,
15765  except for the following additional restrictions:
15766 <ul>
15767 <li>  Binary wide-oriented streams have the file-positioning restrictions ascribed to both
15768  text and binary streams.
15769 <li>  For wide-oriented streams, after a successful call to a file-positioning function that
15770  leaves the file position indicator prior to the end-of-file, a wide character output
15771  function can overwrite a partial multibyte character; any file contents beyond the
15772  byte(s) written are henceforth indeterminate.
15773 </ul>
15774 <p><a name="7.21.2p6" href="#7.21.2p6"><small>6</small></a>
15775  Each wide-oriented stream has an associated mbstate_t object that stores the current
15776  parse state of the stream. A successful call to fgetpos stores a representation of the
15777  value of this mbstate_t object as part of the value of the fpos_t object. A later
15778  successful call to fsetpos using the same stored fpos_t value restores the value of
15779  the associated mbstate_t object as well as the position within the controlled stream.
15780 <p><a name="7.21.2p7" href="#7.21.2p7"><small>7</small></a>
15781  Each stream has an associated lock that is used to prevent data races when multiple
15782  threads of execution access a stream, and to restrict the interleaving of stream operations
15783  performed by multiple threads. Only one thread may hold this lock at a time. The lock is
15784  reentrant: a single thread may hold the lock multiple times at a given time.
15785 <p><a name="7.21.2p8" href="#7.21.2p8"><small>8</small></a>
15786  All functions that read, write, position, or query the position of a stream lock the stream
15787  before accessing it. They release the lock associated with the stream when the access is
15788  complete.
15789 <p><b>Environmental limits</b>
15790 <p><a name="7.21.2p9" href="#7.21.2p9"><small>9</small></a>
15791  An implementation shall support text files with lines containing at least 254 characters,
15792  including the terminating new-line character. The value of the macro BUFSIZ shall be at
15793  least 256.
15794 <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.29.3.5">7.29.3.5</a>),
15795  mbstate_t (<a href="#7.30.1">7.30.1</a>), the fgetpos function (<a href="#7.21.9.1">7.21.9.1</a>), the fsetpos function
15796  (<a href="#7.21.9.3">7.21.9.3</a>).
15797  
15798  
15799  
15800  
15801 <!--page 318 -->
15802
15803 <p><b>Footnotes</b>
15804 <p><small><a name="note266" href="#note266">266)</a> An implementation need not distinguish between text streams and binary streams. In such an
15805  implementation, there need be no new-line characters in a text stream nor any limit to the length of a
15806  line.
15807 </small>
15808 <p><small><a name="note267" href="#note267">267)</a> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
15809 </small>
15810
15811 <p><small><a href="#Contents">Contents</a></small>
15812 <h4><a name="7.21.3" href="#7.21.3">7.21.3 Files</a></h4>
15813 <p><a name="7.21.3p1" href="#7.21.3p1"><small>1</small></a>
15814  A stream is associated with an external file (which may be a physical device) by opening
15815  a file, which may involve creating a new file. Creating an existing file causes its former
15816  contents to be discarded, if necessary. If a file can support positioning requests (such as a
15817  disk file, as opposed to a terminal), then a file position indicator associated with the
15818  stream is positioned at the start (character number zero) of the file, unless the file is
15819  opened with append mode in which case it is implementation-defined whether the file
15820  position indicator is initially positioned at the beginning or the end of the file. The file
15821  position indicator is maintained by subsequent reads, writes, and positioning requests, to
15822  facilitate an orderly progression through the file.
15823 <p><a name="7.21.3p2" href="#7.21.3p2"><small>2</small></a>
15824  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
15825  stream causes the associated file to be truncated beyond that point is implementation-
15826  defined.
15827 <p><a name="7.21.3p3" href="#7.21.3p3"><small>3</small></a>
15828  When a stream is unbuffered, characters are intended to appear from the source or at the
15829  destination as soon as possible. Otherwise characters may be accumulated and
15830  transmitted to or from the host environment as a block. When a stream is fully buffered,
15831  characters are intended to be transmitted to or from the host environment as a block when
15832  a buffer is filled. When a stream is line buffered, characters are intended to be
15833  transmitted to or from the host environment as a block when a new-line character is
15834  encountered. Furthermore, characters are intended to be transmitted as a block to the host
15835  environment when a buffer is filled, when input is requested on an unbuffered stream, or
15836  when input is requested on a line buffered stream that requires the transmission of
15837  characters from the host environment. Support for these characteristics is
15838  implementation-defined, and may be affected via the setbuf and setvbuf functions.
15839 <p><a name="7.21.3p4" href="#7.21.3p4"><small>4</small></a>
15840  A file may be disassociated from a controlling stream by closing the file. Output streams
15841  are flushed (any unwritten buffer contents are transmitted to the host environment) before
15842  the stream is disassociated from the file. The value of a pointer to a FILE object is
15843  indeterminate after the associated file is closed (including the standard text streams).
15844  Whether a file of zero length (on which no characters have been written by an output
15845  stream) actually exists is implementation-defined.
15846 <p><a name="7.21.3p5" href="#7.21.3p5"><small>5</small></a>
15847  The file may be subsequently reopened, by the same or another program execution, and
15848  its contents reclaimed or modified (if it can be repositioned at its start). If the main
15849  function returns to its original caller, or if the exit function is called, all open files are
15850  closed (hence all output streams are flushed) before program termination. Other paths to
15851  program termination, such as calling the abort function, need not close all files
15852  properly.
15853 <p><a name="7.21.3p6" href="#7.21.3p6"><small>6</small></a>
15854  The address of the FILE object used to control a stream may be significant; a copy of a
15855  FILE object need not serve in place of the original.
15856 <!--page 319 -->
15857 <p><a name="7.21.3p7" href="#7.21.3p7"><small>7</small></a>
15858  At program startup, three text streams are predefined and need not be opened explicitly
15859 <ul>
15860 <li>  standard input (for reading conventional input), standard output (for writing
15861 </ul>
15862  conventional output), and standard error (for writing diagnostic output). As initially
15863  opened, the standard error stream is not fully buffered; the standard input and standard
15864  output streams are fully buffered if and only if the stream can be determined not to refer
15865  to an interactive device.
15866 <p><a name="7.21.3p8" href="#7.21.3p8"><small>8</small></a>
15867  Functions that open additional (nontemporary) files require a file name, which is a string.
15868  The rules for composing valid file names are implementation-defined. Whether the same
15869  file can be simultaneously open multiple times is also implementation-defined.
15870 <p><a name="7.21.3p9" href="#7.21.3p9"><small>9</small></a>
15871  Although both text and binary wide-oriented streams are conceptually sequences of wide
15872  characters, the external file associated with a wide-oriented stream is a sequence of
15873  multibyte characters, generalized as follows:
15874 <ul>
15875 <li>  Multibyte encodings within files may contain embedded null bytes (unlike multibyte
15876  encodings valid for use internal to the program).
15877 <li>  A file need not begin nor end in the initial shift state.<sup><a href="#note268"><b>268)</b></a></sup>
15878 </ul>
15879 <p><a name="7.21.3p10" href="#7.21.3p10"><small>10</small></a>
15880  Moreover, the encodings used for multibyte characters may differ among files. Both the
15881  nature and choice of such encodings are implementation-defined.
15882 <p><a name="7.21.3p11" href="#7.21.3p11"><small>11</small></a>
15883  The wide character input functions read multibyte characters from the stream and convert
15884  them to wide characters as if they were read by successive calls to the fgetwc function.
15885  Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
15886  described by the stream's own mbstate_t object. The byte input functions read
15887  characters from the stream as if by successive calls to the fgetc function.
15888 <p><a name="7.21.3p12" href="#7.21.3p12"><small>12</small></a>
15889  The wide character output functions convert wide characters to multibyte characters and
15890  write them to the stream as if they were written by successive calls to the fputwc
15891  function. Each conversion occurs as if by a call to the wcrtomb function, with the
15892  conversion state described by the stream's own mbstate_t object. The byte output
15893  functions write characters to the stream as if by successive calls to the fputc function.
15894 <p><a name="7.21.3p13" href="#7.21.3p13"><small>13</small></a>
15895  In some cases, some of the byte input/output functions also perform conversions between
15896  multibyte characters and wide characters. These conversions also occur as if by calls to
15897  the mbrtowc and wcrtomb functions.
15898 <p><a name="7.21.3p14" href="#7.21.3p14"><small>14</small></a>
15899  An encoding error occurs if the character sequence presented to the underlying
15900  mbrtowc function does not form a valid (generalized) multibyte character, or if the code
15901  value passed to the underlying wcrtomb does not correspond to a valid (generalized)
15902  
15903  
15904 <!--page 320 -->
15905  multibyte character. The wide character input/output functions and the byte input/output
15906  functions store the value of the macro EILSEQ in errno if and only if an encoding error
15907  occurs.
15908 <p><b>Environmental limits</b>
15909 <p><a name="7.21.3p15" href="#7.21.3p15"><small>15</small></a>
15910  The value of FOPEN_MAX shall be at least eight, including the three standard text
15911  streams.
15912 <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
15913  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
15914  (<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.29.3.1">7.29.3.1</a>), the
15915  fputwc function (<a href="#7.29.3.3">7.29.3.3</a>), conversion state (<a href="#7.29.6">7.29.6</a>), the mbrtowc function
15916  (<a href="#7.29.6.3.2">7.29.6.3.2</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
15917
15918 <p><b>Footnotes</b>
15919 <p><small><a name="note268" href="#note268">268)</a> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
15920  undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
15921  with state-dependent encoding that does not assuredly end in the initial shift state.
15922 </small>
15923
15924 <p><small><a href="#Contents">Contents</a></small>
15925 <h4><a name="7.21.4" href="#7.21.4">7.21.4 Operations on files</a></h4>
15926
15927 <p><small><a href="#Contents">Contents</a></small>
15928 <h5><a name="7.21.4.1" href="#7.21.4.1">7.21.4.1 The remove function</a></h5>
15929 <p><b>Synopsis</b>
15930 <p><a name="7.21.4.1p1" href="#7.21.4.1p1"><small>1</small></a>
15931 <pre>
15932         #include <a href="#7.21">&lt;stdio.h&gt;</a>
15933         int remove(const char *filename);
15934 </pre>
15935 <p><b>Description</b>
15936 <p><a name="7.21.4.1p2" href="#7.21.4.1p2"><small>2</small></a>
15937  The remove function causes the file whose name is the string pointed to by filename
15938  to be no longer accessible by that name. A subsequent attempt to open that file using that
15939  name will fail, unless it is created anew. If the file is open, the behavior of the remove
15940  function is implementation-defined.
15941 <p><b>Returns</b>
15942 <p><a name="7.21.4.1p3" href="#7.21.4.1p3"><small>3</small></a>
15943  The remove function returns zero if the operation succeeds, nonzero if it fails.
15944
15945 <p><small><a href="#Contents">Contents</a></small>
15946 <h5><a name="7.21.4.2" href="#7.21.4.2">7.21.4.2 The rename function</a></h5>
15947 <p><b>Synopsis</b>
15948 <p><a name="7.21.4.2p1" href="#7.21.4.2p1"><small>1</small></a>
15949 <pre>
15950         #include <a href="#7.21">&lt;stdio.h&gt;</a>
15951         int rename(const char *old, const char *new);
15952 </pre>
15953 <p><b>Description</b>
15954 <p><a name="7.21.4.2p2" href="#7.21.4.2p2"><small>2</small></a>
15955  The rename function causes the file whose name is the string pointed to by old to be
15956  henceforth known by the name given by the string pointed to by new. The file named
15957  old is no longer accessible by that name. If a file named by the string pointed to by new
15958  exists prior to the call to the rename function, the behavior is implementation-defined.
15959 <!--page 321 -->
15960 <p><b>Returns</b>
15961 <p><a name="7.21.4.2p3" href="#7.21.4.2p3"><small>3</small></a>
15962  The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note269"><b>269)</b></a></sup> in
15963  which case if the file existed previously it is still known by its original name.
15964
15965 <p><b>Footnotes</b>
15966 <p><small><a name="note269" href="#note269">269)</a> Among the reasons the implementation may cause the rename function to fail are that the file is open
15967  or that it is necessary to copy its contents to effectuate its renaming.
15968 </small>
15969
15970 <p><small><a href="#Contents">Contents</a></small>
15971 <h5><a name="7.21.4.3" href="#7.21.4.3">7.21.4.3 The tmpfile function</a></h5>
15972 <p><b>Synopsis</b>
15973 <p><a name="7.21.4.3p1" href="#7.21.4.3p1"><small>1</small></a>
15974 <pre>
15975          #include <a href="#7.21">&lt;stdio.h&gt;</a>
15976          FILE *tmpfile(void);
15977 </pre>
15978 <p><b>Description</b>
15979 <p><a name="7.21.4.3p2" href="#7.21.4.3p2"><small>2</small></a>
15980  The tmpfile function creates a temporary binary file that is different from any other
15981  existing file and that will automatically be removed when it is closed or at program
15982  termination. If the program terminates abnormally, whether an open temporary file is
15983  removed is implementation-defined. The file is opened for update with "wb+" mode.
15984 <p><b>Recommended practice</b>
15985 <p><a name="7.21.4.3p3" href="#7.21.4.3p3"><small>3</small></a>
15986  It should be possible to open at least TMP_MAX temporary files during the lifetime of the
15987  program (this limit may be shared with tmpnam) and there should be no limit on the
15988  number simultaneously open other than this limit and any limit on the number of open
15989  files (FOPEN_MAX).
15990 <p><b>Returns</b>
15991 <p><a name="7.21.4.3p4" href="#7.21.4.3p4"><small>4</small></a>
15992  The tmpfile function returns a pointer to the stream of the file that it created. If the file
15993  cannot be created, the tmpfile function returns a null pointer.
15994 <p><b> Forward references</b>: the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
15995
15996 <p><small><a href="#Contents">Contents</a></small>
15997 <h5><a name="7.21.4.4" href="#7.21.4.4">7.21.4.4 The tmpnam function</a></h5>
15998 <p><b>Synopsis</b>
15999 <p><a name="7.21.4.4p1" href="#7.21.4.4p1"><small>1</small></a>
16000 <pre>
16001          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16002          char *tmpnam(char *s);
16003 </pre>
16004 <p><b>Description</b>
16005 <p><a name="7.21.4.4p2" href="#7.21.4.4p2"><small>2</small></a>
16006  The tmpnam function generates a string that is a valid file name and that is not the same
16007  as the name of an existing file.<sup><a href="#note270"><b>270)</b></a></sup> The function is potentially capable of generating at
16008  
16009  
16010 <!--page 322 -->
16011  least TMP_MAX different strings, but any or all of them may already be in use by existing
16012  files and thus not be suitable return values.
16013 <p><a name="7.21.4.4p3" href="#7.21.4.4p3"><small>3</small></a>
16014  The tmpnam function generates a different string each time it is called.
16015 <p><a name="7.21.4.4p4" href="#7.21.4.4p4"><small>4</small></a>
16016  Calls to the tmpnam function with a null pointer argument may introduce data races with
16017  each other. The implementation shall behave as if no library function calls the tmpnam
16018  function.
16019 <p><b>Returns</b>
16020 <p><a name="7.21.4.4p5" href="#7.21.4.4p5"><small>5</small></a>
16021  If no suitable string can be generated, the tmpnam function returns a null pointer.
16022  Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
16023  internal static object and returns a pointer to that object (subsequent calls to the tmpnam
16024  function may modify the same object). If the argument is not a null pointer, it is assumed
16025  to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
16026  in that array and returns the argument as its value.
16027 <p><b>Environmental limits</b>
16028 <p><a name="7.21.4.4p6" href="#7.21.4.4p6"><small>6</small></a>
16029  The value of the macro TMP_MAX shall be at least 25.
16030
16031 <p><b>Footnotes</b>
16032 <p><small><a name="note270" href="#note270">270)</a> Files created using strings generated by the tmpnam function are temporary only in the sense that
16033  their names should not collide with those generated by conventional naming rules for the
16034  implementation. It is still necessary to use the remove function to remove such files when their use
16035  is ended, and before program termination.
16036 </small>
16037
16038 <p><small><a href="#Contents">Contents</a></small>
16039 <h4><a name="7.21.5" href="#7.21.5">7.21.5 File access functions</a></h4>
16040
16041 <p><small><a href="#Contents">Contents</a></small>
16042 <h5><a name="7.21.5.1" href="#7.21.5.1">7.21.5.1 The fclose function</a></h5>
16043 <p><b>Synopsis</b>
16044 <p><a name="7.21.5.1p1" href="#7.21.5.1p1"><small>1</small></a>
16045 <pre>
16046         #include <a href="#7.21">&lt;stdio.h&gt;</a>
16047         int fclose(FILE *stream);
16048 </pre>
16049 <p><b>Description</b>
16050 <p><a name="7.21.5.1p2" href="#7.21.5.1p2"><small>2</small></a>
16051  A successful call to the fclose function causes the stream pointed to by stream to be
16052  flushed and the associated file to be closed. Any unwritten buffered data for the stream
16053  are delivered to the host environment to be written to the file; any unread buffered data
16054  are discarded. Whether or not the call succeeds, the stream is disassociated from the file
16055  and any buffer set by the setbuf or setvbuf function is disassociated from the stream
16056  (and deallocated if it was automatically allocated).
16057 <p><b>Returns</b>
16058 <p><a name="7.21.5.1p3" href="#7.21.5.1p3"><small>3</small></a>
16059  The fclose function returns zero if the stream was successfully closed, or EOF if any
16060  errors were detected.
16061 <!--page 323 -->
16062
16063 <p><small><a href="#Contents">Contents</a></small>
16064 <h5><a name="7.21.5.2" href="#7.21.5.2">7.21.5.2 The fflush function</a></h5>
16065 <p><b>Synopsis</b>
16066 <p><a name="7.21.5.2p1" href="#7.21.5.2p1"><small>1</small></a>
16067 <pre>
16068          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16069          int fflush(FILE *stream);
16070 </pre>
16071 <p><b>Description</b>
16072 <p><a name="7.21.5.2p2" href="#7.21.5.2p2"><small>2</small></a>
16073  If stream points to an output stream or an update stream in which the most recent
16074  operation was not input, the fflush function causes any unwritten data for that stream
16075  to be delivered to the host environment to be written to the file; otherwise, the behavior is
16076  undefined.
16077 <p><a name="7.21.5.2p3" href="#7.21.5.2p3"><small>3</small></a>
16078  If stream is a null pointer, the fflush function performs this flushing action on all
16079  streams for which the behavior is defined above.
16080 <p><b>Returns</b>
16081 <p><a name="7.21.5.2p4" href="#7.21.5.2p4"><small>4</small></a>
16082  The fflush function sets the error indicator for the stream and returns EOF if a write
16083  error occurs, otherwise it returns zero.
16084 <p><b> Forward references</b>: the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
16085
16086 <p><small><a href="#Contents">Contents</a></small>
16087 <h5><a name="7.21.5.3" href="#7.21.5.3">7.21.5.3 The fopen function</a></h5>
16088 <p><b>Synopsis</b>
16089 <p><a name="7.21.5.3p1" href="#7.21.5.3p1"><small>1</small></a>
16090 <pre>
16091          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16092          FILE *fopen(const char * restrict filename,
16093               const char * restrict mode);
16094 </pre>
16095 <p><b>Description</b>
16096 <p><a name="7.21.5.3p2" href="#7.21.5.3p2"><small>2</small></a>
16097  The fopen function opens the file whose name is the string pointed to by filename,
16098  and associates a stream with it.
16099 <p><a name="7.21.5.3p3" href="#7.21.5.3p3"><small>3</small></a>
16100  The argument mode points to a string. If the string is one of the following, the file is
16101  open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note271"><b>271)</b></a></sup>
16102  r                     open text file for reading
16103  w                     truncate to zero length or create text file for writing
16104  wx                    create text file for writing
16105  a                     append; open or create text file for writing at end-of-file
16106  rb                    open binary file for reading
16107  wb                    truncate to zero length or create binary file for writing
16108  
16109  
16110 <!--page 324 -->
16111  wbx               create binary file for writing
16112  ab                append; open or create binary file for writing at end-of-file
16113  r+                open text file for update (reading and writing)
16114  w+                truncate to zero length or create text file for update
16115  w+x               create text file for update
16116  a+                append; open or create text file for update, writing at end-of-file
16117  r+b or rb+        open binary file for update (reading and writing)
16118  w+b or wb+        truncate to zero length or create binary file for update
16119  w+bx or wb+x      create binary file for update
16120  a+b or ab+        append; open or create binary file for update, writing at end-of-file
16121 <p><a name="7.21.5.3p4" href="#7.21.5.3p4"><small>4</small></a>
16122  Opening a file with read mode ('r' as the first character in the mode argument) fails if
16123  the file does not exist or cannot be read.
16124 <p><a name="7.21.5.3p5" href="#7.21.5.3p5"><small>5</small></a>
16125  Opening a file with exclusive mode ('x' as the last character in the mode argument)
16126  fails if the file already exists or cannot be created. Otherwise, the file is created with
16127  exclusive (also known as non-shared) access to the extent that the underlying system
16128  supports exclusive access.
16129 <p><a name="7.21.5.3p6" href="#7.21.5.3p6"><small>6</small></a>
16130  Opening a file with append mode ('a' as the first character in the mode argument)
16131  causes all subsequent writes to the file to be forced to the then current end-of-file,
16132  regardless of intervening calls to the fseek function. In some implementations, opening
16133  a binary file with append mode ('b' as the second or third character in the above list of
16134  mode argument values) may initially position the file position indicator for the stream
16135  beyond the last data written, because of null character padding.
16136 <p><a name="7.21.5.3p7" href="#7.21.5.3p7"><small>7</small></a>
16137  When a file is opened with update mode ('+' as the second or third character in the
16138  above list of mode argument values), both input and output may be performed on the
16139  associated stream. However, output shall not be directly followed by input without an
16140  intervening call to the fflush function or to a file positioning function (fseek,
16141  fsetpos, or rewind), and input shall not be directly followed by output without an
16142  intervening call to a file positioning function, unless the input operation encounters end-
16143  of-file. Opening (or creating) a text file with update mode may instead open (or create) a
16144  binary stream in some implementations.
16145 <p><a name="7.21.5.3p8" href="#7.21.5.3p8"><small>8</small></a>
16146  When opened, a stream is fully buffered if and only if it can be determined not to refer to
16147  an interactive device. The error and end-of-file indicators for the stream are cleared.
16148 <p><b>Returns</b>
16149 <p><a name="7.21.5.3p9" href="#7.21.5.3p9"><small>9</small></a>
16150  The fopen function returns a pointer to the object controlling the stream. If the open
16151  operation fails, fopen returns a null pointer.
16152 <p><b> Forward references</b>: file positioning functions (<a href="#7.21.9">7.21.9</a>).
16153 <!--page 325 -->
16154
16155 <p><b>Footnotes</b>
16156 <p><small><a name="note271" href="#note271">271)</a> If the string begins with one of the above sequences, the implementation might choose to ignore the
16157  remaining characters, or it might use them to select different kinds of a file (some of which might not
16158  conform to the properties in <a href="#7.21.2">7.21.2</a>).
16159 </small>
16160
16161 <p><small><a href="#Contents">Contents</a></small>
16162 <h5><a name="7.21.5.4" href="#7.21.5.4">7.21.5.4 The freopen function</a></h5>
16163 <p><b>Synopsis</b>
16164 <p><a name="7.21.5.4p1" href="#7.21.5.4p1"><small>1</small></a>
16165 <pre>
16166          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16167          FILE *freopen(const char * restrict filename,
16168               const char * restrict mode,
16169               FILE * restrict stream);
16170 </pre>
16171 <p><b>Description</b>
16172 <p><a name="7.21.5.4p2" href="#7.21.5.4p2"><small>2</small></a>
16173  The freopen function opens the file whose name is the string pointed to by filename
16174  and associates the stream pointed to by stream with it. The mode argument is used just
16175  as in the fopen function.<sup><a href="#note272"><b>272)</b></a></sup>
16176 <p><a name="7.21.5.4p3" href="#7.21.5.4p3"><small>3</small></a>
16177  If filename is a null pointer, the freopen function attempts to change the mode of
16178  the stream to that specified by mode, as if the name of the file currently associated with
16179  the stream had been used. It is implementation-defined which changes of mode are
16180  permitted (if any), and under what circumstances.
16181 <p><a name="7.21.5.4p4" href="#7.21.5.4p4"><small>4</small></a>
16182  The freopen function first attempts to close any file that is associated with the specified
16183  stream. Failure to close the file is ignored. The error and end-of-file indicators for the
16184  stream are cleared.
16185 <p><b>Returns</b>
16186 <p><a name="7.21.5.4p5" href="#7.21.5.4p5"><small>5</small></a>
16187  The freopen function returns a null pointer if the open operation fails. Otherwise,
16188  freopen returns the value of stream.
16189
16190 <p><b>Footnotes</b>
16191 <p><small><a name="note272" href="#note272">272)</a> The primary use of the freopen function is to change the file associated with a standard text stream
16192  (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
16193  returned by the fopen function may be assigned.
16194 </small>
16195
16196 <p><small><a href="#Contents">Contents</a></small>
16197 <h5><a name="7.21.5.5" href="#7.21.5.5">7.21.5.5 The setbuf function</a></h5>
16198 <p><b>Synopsis</b>
16199 <p><a name="7.21.5.5p1" href="#7.21.5.5p1"><small>1</small></a>
16200 <pre>
16201          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16202          void setbuf(FILE * restrict stream,
16203               char * restrict buf);
16204 </pre>
16205 <p><b>Description</b>
16206 <p><a name="7.21.5.5p2" href="#7.21.5.5p2"><small>2</small></a>
16207  Except that it returns no value, the setbuf function is equivalent to the setvbuf
16208  function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
16209  is a null pointer), with the value _IONBF for mode.
16210  
16211  
16212  
16213  
16214 <!--page 326 -->
16215 <p><b>Returns</b>
16216 <p><a name="7.21.5.5p3" href="#7.21.5.5p3"><small>3</small></a>
16217  The setbuf function returns no value.
16218 <p><b> Forward references</b>: the setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>).
16219
16220 <p><small><a href="#Contents">Contents</a></small>
16221 <h5><a name="7.21.5.6" href="#7.21.5.6">7.21.5.6 The setvbuf function</a></h5>
16222 <p><b>Synopsis</b>
16223 <p><a name="7.21.5.6p1" href="#7.21.5.6p1"><small>1</small></a>
16224 <pre>
16225          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16226          int setvbuf(FILE * restrict stream,
16227               char * restrict buf,
16228               int mode, size_t size);
16229 </pre>
16230 <p><b>Description</b>
16231 <p><a name="7.21.5.6p2" href="#7.21.5.6p2"><small>2</small></a>
16232  The setvbuf function may be used only after the stream pointed to by stream has
16233  been associated with an open file and before any other operation (other than an
16234  unsuccessful call to setvbuf) is performed on the stream. The argument mode
16235  determines how stream will be buffered, as follows: _IOFBF causes input/output to be
16236  fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
16237  input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
16238  used instead of a buffer allocated by the setvbuf function<sup><a href="#note273"><b>273)</b></a></sup> and the argument size
16239  specifies the size of the array; otherwise, size may determine the size of a buffer
16240  allocated by the setvbuf function. The contents of the array at any time are
16241  indeterminate.
16242 <p><b>Returns</b>
16243 <p><a name="7.21.5.6p3" href="#7.21.5.6p3"><small>3</small></a>
16244  The setvbuf function returns zero on success, or nonzero if an invalid value is given
16245  for mode or if the request cannot be honored.
16246  
16247  
16248  
16249  
16250 <!--page 327 -->
16251
16252 <p><b>Footnotes</b>
16253 <p><small><a name="note273" href="#note273">273)</a> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
16254  before a buffer that has automatic storage duration is deallocated upon block exit.
16255 </small>
16256
16257 <p><small><a href="#Contents">Contents</a></small>
16258 <h4><a name="7.21.6" href="#7.21.6">7.21.6 Formatted input/output functions</a></h4>
16259 <p><a name="7.21.6p1" href="#7.21.6p1"><small>1</small></a>
16260  The formatted input/output functions shall behave as if there is a sequence point after the
16261  actions associated with each specifier.<sup><a href="#note274"><b>274)</b></a></sup>
16262
16263 <p><b>Footnotes</b>
16264 <p><small><a name="note274" href="#note274">274)</a> The fprintf functions perform writes to memory for the %n specifier.
16265 </small>
16266
16267 <p><small><a href="#Contents">Contents</a></small>
16268 <h5><a name="7.21.6.1" href="#7.21.6.1">7.21.6.1 The fprintf function</a></h5>
16269 <p><b>Synopsis</b>
16270 <p><a name="7.21.6.1p1" href="#7.21.6.1p1"><small>1</small></a>
16271 <pre>
16272           #include <a href="#7.21">&lt;stdio.h&gt;</a>
16273           int fprintf(FILE * restrict stream,
16274                const char * restrict format, ...);
16275 </pre>
16276 <p><b>Description</b>
16277 <p><a name="7.21.6.1p2" href="#7.21.6.1p2"><small>2</small></a>
16278  The fprintf function writes output to the stream pointed to by stream, under control
16279  of the string pointed to by format that specifies how subsequent arguments are
16280  converted for output. If there are insufficient arguments for the format, the behavior is
16281  undefined. If the format is exhausted while arguments remain, the excess arguments are
16282  evaluated (as always) but are otherwise ignored. The fprintf function returns when
16283  the end of the format string is encountered.
16284 <p><a name="7.21.6.1p3" href="#7.21.6.1p3"><small>3</small></a>
16285  The format shall be a multibyte character sequence, beginning and ending in its initial
16286  shift state. The format is composed of zero or more directives: ordinary multibyte
16287  characters (not %), which are copied unchanged to the output stream; and conversion
16288  specifications, each of which results in fetching zero or more subsequent arguments,
16289  converting them, if applicable, according to the corresponding conversion specifier, and
16290  then writing the result to the output stream.
16291 <p><a name="7.21.6.1p4" href="#7.21.6.1p4"><small>4</small></a>
16292  Each conversion specification is introduced by the character %. After the %, the following
16293  appear in sequence:
16294 <ul>
16295 <li>  Zero or more flags (in any order) that modify the meaning of the conversion
16296  specification.
16297 <li>  An optional minimum field width. If the converted value has fewer characters than the
16298  field width, it is padded with spaces (by default) on the left (or right, if the left
16299  adjustment flag, described later, has been given) to the field width. The field width
16300  takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note275"><b>275)</b></a></sup>
16301 <li>  An optional precision that gives the minimum number of digits to appear for the d, i,
16302  o, u, x, and X conversions, the number of digits to appear after the decimal-point
16303  character for a, A, e, E, f, and F conversions, the maximum number of significant
16304  digits for the g and G conversions, or the maximum number of bytes to be written for
16305  
16306  
16307 <!--page 328 -->
16308    s conversions. The precision takes the form of a period (.) followed either by an
16309    asterisk * (described later) or by an optional decimal integer; if only the period is
16310    specified, the precision is taken as zero. If a precision appears with any other
16311    conversion specifier, the behavior is undefined.
16312 <li>  An optional length modifier that specifies the size of the argument.
16313 <li>  A conversion specifier character that specifies the type of conversion to be applied.
16314 </ul>
16315 <p><a name="7.21.6.1p5" href="#7.21.6.1p5"><small>5</small></a>
16316  As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
16317  this case, an int argument supplies the field width or precision. The arguments
16318  specifying field width, or precision, or both, shall appear (in that order) before the
16319  argument (if any) to be converted. A negative field width argument is taken as a - flag
16320  followed by a positive field width. A negative precision argument is taken as if the
16321  precision were omitted.
16322 <p><a name="7.21.6.1p6" href="#7.21.6.1p6"><small>6</small></a>
16323  The flag characters and their meanings are:
16324  -       The result of the conversion is left-justified within the field. (It is right-justified if
16325 <pre>
16326          this flag is not specified.)
16327 </pre>
16328  +       The result of a signed conversion always begins with a plus or minus sign. (It
16329 <pre>
16330          begins with a sign only when a negative value is converted if this flag is not
16331          specified.)<sup><a href="#note276"><b>276)</b></a></sup>
16332 </pre>
16333  space If the first character of a signed conversion is not a sign, or if a signed conversion
16334 <pre>
16335        results in no characters, a space is prefixed to the result. If the space and + flags
16336        both appear, the space flag is ignored.
16337 </pre>
16338  #       The result is converted to an ''alternative form''. For o conversion, it increases
16339 <pre>
16340          the precision, if and only if necessary, to force the first digit of the result to be a
16341          zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
16342          conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
16343          and G conversions, the result of converting a floating-point number always
16344          contains a decimal-point character, even if no digits follow it. (Normally, a
16345          decimal-point character appears in the result of these conversions only if a digit
16346          follows it.) For g and G conversions, trailing zeros are not removed from the
16347          result. For other conversions, the behavior is undefined.
16348 </pre>
16349  0       For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
16350 <pre>
16351          (following any indication of sign or base) are used to pad to the field width rather
16352          than performing space padding, except when converting an infinity or NaN. If the
16353          0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
16354 </pre>
16355  
16356  
16357 <!--page 329 -->
16358 <pre>
16359            conversions, if a precision is specified, the 0 flag is ignored. For other
16360            conversions, the behavior is undefined.
16361 </pre>
16362 <p><a name="7.21.6.1p7" href="#7.21.6.1p7"><small>7</small></a>
16363  The length modifiers and their meanings are:
16364  hh            Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16365 <pre>
16366                signed char or unsigned char argument (the argument will have
16367                been promoted according to the integer promotions, but its value shall be
16368                converted to signed char or unsigned char before printing); or that
16369                a following n conversion specifier applies to a pointer to a signed char
16370                argument.
16371 </pre>
16372  h             Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16373 <pre>
16374                short int or unsigned short int argument (the argument will
16375                have been promoted according to the integer promotions, but its value shall
16376                be converted to short int or unsigned short int before printing);
16377                or that a following n conversion specifier applies to a pointer to a short
16378                int argument.
16379 </pre>
16380  l (ell)       Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16381 <pre>
16382                long int or unsigned long int argument; that a following n
16383                conversion specifier applies to a pointer to a long int argument; that a
16384                following c conversion specifier applies to a wint_t argument; that a
16385                following s conversion specifier applies to a pointer to a wchar_t
16386                argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
16387                specifier.
16388 </pre>
16389  ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16390 <pre>
16391               long long int or unsigned long long int argument; or that a
16392               following n conversion specifier applies to a pointer to a long long int
16393               argument.
16394 </pre>
16395  j             Specifies that a following d, i, o, u, x, or X conversion specifier applies to
16396 <pre>
16397                an intmax_t or uintmax_t argument; or that a following n conversion
16398                specifier applies to a pointer to an intmax_t argument.
16399 </pre>
16400  z             Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16401 <pre>
16402                size_t or the corresponding signed integer type argument; or that a
16403                following n conversion specifier applies to a pointer to a signed integer type
16404                corresponding to size_t argument.
16405 </pre>
16406  t             Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
16407 <!--page 330 -->
16408 <pre>
16409                ptrdiff_t or the corresponding unsigned integer type argument; or that a
16410                following n conversion specifier applies to a pointer to a ptrdiff_t
16411                argument.
16412 </pre>
16413  L              Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
16414 <pre>
16415                 applies to a long double argument.
16416 </pre>
16417  If a length modifier appears with any conversion specifier other than as specified above,
16418  the behavior is undefined.
16419 <p><a name="7.21.6.1p8" href="#7.21.6.1p8"><small>8</small></a>
16420  The conversion specifiers and their meanings are:
16421  d,i          The int argument is converted to signed decimal in the style [-]dddd. The
16422 <pre>
16423               precision specifies the minimum number of digits to appear; if the value
16424               being converted can be represented in fewer digits, it is expanded with
16425               leading zeros. The default precision is 1. The result of converting a zero
16426               value with a precision of zero is no characters.
16427 </pre>
16428  o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
16429 <pre>
16430          decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
16431          letters abcdef are used for x conversion and the letters ABCDEF for X
16432          conversion. The precision specifies the minimum number of digits to appear;
16433          if the value being converted can be represented in fewer digits, it is expanded
16434          with leading zeros. The default precision is 1. The result of converting a
16435          zero value with a precision of zero is no characters.
16436 </pre>
16437  f,F          A double argument representing a floating-point number is converted to
16438 <pre>
16439               decimal notation in the style [-]ddd.ddd, where the number of digits after
16440               the decimal-point character is equal to the precision specification. If the
16441               precision is missing, it is taken as 6; if the precision is zero and the # flag is
16442               not specified, no decimal-point character appears. If a decimal-point
16443               character appears, at least one digit appears before it. The value is rounded to
16444               the appropriate number of digits.
16445               A double argument representing an infinity is converted in one of the styles
16446               [-]inf or [-]infinity -- which style is implementation-defined. A
16447               double argument representing a NaN is converted in one of the styles
16448               [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
16449               any n-char-sequence, is implementation-defined. The F conversion specifier
16450               produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
16451               respectively.<sup><a href="#note277"><b>277)</b></a></sup>
16452 </pre>
16453  e,E          A double argument representing a floating-point number is converted in the
16454 <pre>
16455               style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
16456               argument is nonzero) before the decimal-point character and the number of
16457               digits after it is equal to the precision; if the precision is missing, it is taken as
16458 </pre>
16459  
16460  
16461 <!--page 331 -->
16462 <pre>
16463                6; if the precision is zero and the # flag is not specified, no decimal-point
16464                character appears. The value is rounded to the appropriate number of digits.
16465                The E conversion specifier produces a number with E instead of e
16466                introducing the exponent. The exponent always contains at least two digits,
16467                and only as many more digits as necessary to represent the exponent. If the
16468                value is zero, the exponent is zero.
16469                A double argument representing an infinity or NaN is converted in the style
16470                of an f or F conversion specifier.
16471 </pre>
16472  g,G           A double argument representing a floating-point number is converted in
16473 <pre>
16474                style f or e (or in style F or E in the case of a G conversion specifier),
16475                depending on the value converted and the precision. Let P equal the
16476                precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
16477                Then, if a conversion with style E would have an exponent of X:
16478                -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
16479                  P - (X + 1).
16480                -- otherwise, the conversion is with style e (or E) and precision P - 1.
16481                Finally, unless the # flag is used, any trailing zeros are removed from the
16482                fractional portion of the result and the decimal-point character is removed if
16483                there is no fractional portion remaining.
16484                A double argument representing an infinity or NaN is converted in the style
16485                of an f or F conversion specifier.
16486 </pre>
16487  a,A           A double argument representing a floating-point number is converted in the
16488 <pre>
16489                style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
16490                nonzero if the argument is a normalized floating-point number and is
16491                otherwise unspecified) before the decimal-point character<sup><a href="#note278"><b>278)</b></a></sup> and the number
16492                of hexadecimal digits after it is equal to the precision; if the precision is
16493                missing and FLT_RADIX is a power of 2, then the precision is sufficient for
16494                an exact representation of the value; if the precision is missing and
16495                FLT_RADIX is not a power of 2, then the precision is sufficient to
16496 </pre>
16497  
16498  
16499  
16500  
16501 <!--page 332 -->
16502 <pre>
16503                distinguish<sup><a href="#note279"><b>279)</b></a></sup> values of type double, except that trailing zeros may be
16504                omitted; if the precision is zero and the # flag is not specified, no decimal-
16505                point character appears. The letters abcdef are used for a conversion and
16506                the letters ABCDEF for A conversion. The A conversion specifier produces a
16507                number with X and P instead of x and p. The exponent always contains at
16508                least one digit, and only as many more digits as necessary to represent the
16509                decimal exponent of 2. If the value is zero, the exponent is zero.
16510                A double argument representing an infinity or NaN is converted in the style
16511                of an f or F conversion specifier.
16512 </pre>
16513  c             If no l length modifier is present, the int argument is converted to an
16514 <pre>
16515                unsigned char, and the resulting character is written.
16516                If an l length modifier is present, the wint_t argument is converted as if by
16517                an ls conversion specification with no precision and an argument that points
16518                to the initial element of a two-element array of wchar_t, the first element
16519                containing the wint_t argument to the lc conversion specification and the
16520                second a null wide character.
16521 </pre>
16522  s             If no l length modifier is present, the argument shall be a pointer to the initial
16523 <pre>
16524                element of an array of character type.<sup><a href="#note280"><b>280)</b></a></sup> Characters from the array are
16525                written up to (but not including) the terminating null character. If the
16526                precision is specified, no more than that many bytes are written. If the
16527                precision is not specified or is greater than the size of the array, the array shall
16528                contain a null character.
16529                If an l length modifier is present, the argument shall be a pointer to the initial
16530                element of an array of wchar_t type. Wide characters from the array are
16531                converted to multibyte characters (each as if by a call to the wcrtomb
16532                function, with the conversion state described by an mbstate_t object
16533                initialized to zero before the first wide character is converted) up to and
16534                including a terminating null wide character. The resulting multibyte
16535                characters are written up to (but not including) the terminating null character
16536                (byte). If no precision is specified, the array shall contain a null wide
16537                character. If a precision is specified, no more than that many bytes are
16538                written (including shift sequences, if any), and the array shall contain a null
16539                wide character if, to equal the multibyte character sequence length given by
16540 </pre>
16541  
16542 <!--page 333 -->
16543 <pre>
16544                 the precision, the function would need to access a wide character one past the
16545                 end of the array. In no case is a partial multibyte character written.<sup><a href="#note281"><b>281)</b></a></sup>
16546 </pre>
16547  p              The argument shall be a pointer to void. The value of the pointer is
16548 <pre>
16549                 converted to a sequence of printing characters, in an implementation-defined
16550                 manner.
16551 </pre>
16552  n              The argument shall be a pointer to signed integer into which is written the
16553 <pre>
16554                 number of characters written to the output stream so far by this call to
16555                 fprintf. No argument is converted, but one is consumed. If the conversion
16556                 specification includes any flags, a field width, or a precision, the behavior is
16557                 undefined.
16558 </pre>
16559  %              A % character is written. No argument is converted. The complete
16560 <pre>
16561                 conversion specification shall be %%.
16562 </pre>
16563 <p><a name="7.21.6.1p9" href="#7.21.6.1p9"><small>9</small></a>
16564  If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note282"><b>282)</b></a></sup> If any argument is
16565  not the correct type for the corresponding conversion specification, the behavior is
16566  undefined.
16567 <p><a name="7.21.6.1p10" href="#7.21.6.1p10"><small>10</small></a>
16568  In no case does a nonexistent or small field width cause truncation of a field; if the result
16569  of a conversion is wider than the field width, the field is expanded to contain the
16570  conversion result.
16571 <p><a name="7.21.6.1p11" href="#7.21.6.1p11"><small>11</small></a>
16572  For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
16573  to a hexadecimal floating number with the given precision.
16574 <p><b>Recommended practice</b>
16575 <p><a name="7.21.6.1p12" href="#7.21.6.1p12"><small>12</small></a>
16576  For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
16577  representable in the given precision, the result should be one of the two adjacent numbers
16578  in hexadecimal floating style with the given precision, with the extra stipulation that the
16579  error should have a correct sign for the current rounding direction.
16580 <p><a name="7.21.6.1p13" href="#7.21.6.1p13"><small>13</small></a>
16581  For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
16582  DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note283"><b>283)</b></a></sup> If the number of
16583  significant decimal digits is more than DECIMAL_DIG but the source value is exactly
16584  representable with DECIMAL_DIG digits, then the result should be an exact
16585  representation with trailing zeros. Otherwise, the source value is bounded by two
16586  adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
16587  
16588  
16589 <!--page 334 -->
16590  of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
16591  the error should have a correct sign for the current rounding direction.
16592 <p><b>Returns</b>
16593 <p><a name="7.21.6.1p14" href="#7.21.6.1p14"><small>14</small></a>
16594  The fprintf function returns the number of characters transmitted, or a negative value
16595  if an output or encoding error occurred.
16596 <p><b>Environmental limits</b>
16597 <p><a name="7.21.6.1p15" href="#7.21.6.1p15"><small>15</small></a>
16598  The number of characters that can be produced by any single conversion shall be at least
16599  4095.
16600 <p><a name="7.21.6.1p16" href="#7.21.6.1p16"><small>16</small></a>
16601  EXAMPLE 1         To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
16602  places:
16603 <pre>
16604           #include <a href="#7.12">&lt;math.h&gt;</a>
16605           #include <a href="#7.21">&lt;stdio.h&gt;</a>
16606           /* ... */
16607           char *weekday, *month;      // pointers to strings
16608           int day, hour, min;
16609           fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
16610                   weekday, month, day, hour, min);
16611           fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
16612 </pre>
16613  
16614 <p><a name="7.21.6.1p17" href="#7.21.6.1p17"><small>17</small></a>
16615  EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
16616  members of the extended character set that consist of more than one byte each consist of exactly two bytes,
16617  the first of which is denoted here by a and the second by an uppercase letter.
16618 <p><a name="7.21.6.1p18" href="#7.21.6.1p18"><small>18</small></a>
16619  Given the following wide string with length seven,
16620 <pre>
16621           static wchar_t wstr[] = L" X Yabc Z W";
16622 </pre>
16623  the seven calls
16624 <pre>
16625           fprintf(stdout,          "|1234567890123|\n");
16626           fprintf(stdout,          "|%13ls|\n", wstr);
16627           fprintf(stdout,          "|%-13.9ls|\n", wstr);
16628           fprintf(stdout,          "|%13.10ls|\n", wstr);
16629           fprintf(stdout,          "|%13.11ls|\n", wstr);
16630           fprintf(stdout,          "|%13.15ls|\n", &amp;wstr[2]);
16631           fprintf(stdout,          "|%13lc|\n", (wint_t) wstr[5]);
16632 </pre>
16633  will print the following seven lines:
16634 <pre>
16635           |1234567890123|
16636           |   X Yabc Z W|
16637           | X Yabc Z    |
16638           |     X Yabc Z|
16639           |   X Yabc Z W|
16640           |      abc Z W|
16641           |            Z|
16642 </pre>
16643  
16644 <p><b> Forward references</b>: conversion state (<a href="#7.29.6">7.29.6</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
16645 <!--page 335 -->
16646
16647 <p><b>Footnotes</b>
16648 <p><small><a name="note275" href="#note275">275)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
16649 </small>
16650 <p><small><a name="note276" href="#note276">276)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
16651  include a minus sign.
16652 </small>
16653 <p><small><a name="note277" href="#note277">277)</a> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
16654  the # and 0 flag characters have no effect.
16655 </small>
16656 <p><small><a name="note278" href="#note278">278)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
16657  that subsequent digits align to nibble (4-bit) boundaries.
16658 </small>
16659 <p><small><a name="note279" href="#note279">279)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
16660  FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
16661  might suffice depending on the implementation's scheme for determining the digit to the left of the
16662  decimal-point character.
16663 </small>
16664 <p><small><a name="note280" href="#note280">280)</a> No special provisions are made for multibyte characters.
16665 </small>
16666 <p><small><a name="note281" href="#note281">281)</a> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
16667 </small>
16668 <p><small><a name="note282" href="#note282">282)</a> See ''future library directions'' (<a href="#7.31.11">7.31.11</a>).
16669 </small>
16670 <p><small><a name="note283" href="#note283">283)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
16671  given format specifier. The number of significant digits is determined by the format specifier, and in
16672  the case of fixed-point conversion by the source value as well.
16673 </small>
16674
16675 <p><small><a href="#Contents">Contents</a></small>
16676 <h5><a name="7.21.6.2" href="#7.21.6.2">7.21.6.2 The fscanf function</a></h5>
16677 <p><b>Synopsis</b>
16678 <p><a name="7.21.6.2p1" href="#7.21.6.2p1"><small>1</small></a>
16679 <pre>
16680          #include <a href="#7.21">&lt;stdio.h&gt;</a>
16681          int fscanf(FILE * restrict stream,
16682               const char * restrict format, ...);
16683 </pre>
16684 <p><b>Description</b>
16685 <p><a name="7.21.6.2p2" href="#7.21.6.2p2"><small>2</small></a>
16686  The fscanf function reads input from the stream pointed to by stream, under control
16687  of the string pointed to by format that specifies the admissible input sequences and how
16688  they are to be converted for assignment, using subsequent arguments as pointers to the
16689  objects to receive the converted input. If there are insufficient arguments for the format,
16690  the behavior is undefined. If the format is exhausted while arguments remain, the excess
16691  arguments are evaluated (as always) but are otherwise ignored.
16692 <p><a name="7.21.6.2p3" href="#7.21.6.2p3"><small>3</small></a>
16693  The format shall be a multibyte character sequence, beginning and ending in its initial
16694  shift state. The format is composed of zero or more directives: one or more white-space
16695  characters, an ordinary multibyte character (neither % nor a white-space character), or a
16696  conversion specification. Each conversion specification is introduced by the character %.
16697  After the %, the following appear in sequence:
16698 <ul>
16699 <li>  An optional assignment-suppressing character *.
16700 <li>  An optional decimal integer greater than zero that specifies the maximum field width
16701  (in characters).
16702 <li>  An optional length modifier that specifies the size of the receiving object.
16703 <li>  A conversion specifier character that specifies the type of conversion to be applied.
16704 </ul>
16705 <p><a name="7.21.6.2p4" href="#7.21.6.2p4"><small>4</small></a>
16706  The fscanf function executes each directive of the format in turn. When all directives
16707  have been executed, or if a directive fails (as detailed below), the function returns.
16708  Failures are described as input failures (due to the occurrence of an encoding error or the
16709  unavailability of input characters), or matching failures (due to inappropriate input).
16710 <p><a name="7.21.6.2p5" href="#7.21.6.2p5"><small>5</small></a>
16711  A directive composed of white-space character(s) is executed by reading input up to the
16712  first non-white-space character (which remains unread), or until no more characters can
16713  be read. The directive never fails.
16714 <p><a name="7.21.6.2p6" href="#7.21.6.2p6"><small>6</small></a>
16715  A directive that is an ordinary multibyte character is executed by reading the next
16716  characters of the stream. If any of those characters differ from the ones composing the
16717  directive, the directive fails and the differing and subsequent characters remain unread.
16718  Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
16719  read, the directive fails.
16720 <p><a name="7.21.6.2p7" href="#7.21.6.2p7"><small>7</small></a>
16721  A directive that is a conversion specification defines a set of matching input sequences, as
16722  described below for each specifier. A conversion specification is executed in the
16723 <!--page 336 -->
16724  following steps:
16725 <p><a name="7.21.6.2p8" href="#7.21.6.2p8"><small>8</small></a>
16726  Input white-space characters (as specified by the isspace function) are skipped, unless
16727  the specification includes a [, c, or n specifier.<sup><a href="#note284"><b>284)</b></a></sup>
16728 <p><a name="7.21.6.2p9" href="#7.21.6.2p9"><small>9</small></a>
16729  An input item is read from the stream, unless the specification includes an n specifier. An
16730  input item is defined as the longest sequence of input characters which does not exceed
16731  any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note285"><b>285)</b></a></sup>
16732  The first character, if any, after the input item remains unread. If the length of the input
16733  item is zero, the execution of the directive fails; this condition is a matching failure unless
16734  end-of-file, an encoding error, or a read error prevented input from the stream, in which
16735  case it is an input failure.
16736 <p><a name="7.21.6.2p10" href="#7.21.6.2p10"><small>10</small></a>
16737  Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
16738  count of input characters) is converted to a type appropriate to the conversion specifier. If
16739  the input item is not a matching sequence, the execution of the directive fails: this
16740  condition is a matching failure. Unless assignment suppression was indicated by a *, the
16741  result of the conversion is placed in the object pointed to by the first argument following
16742  the format argument that has not already received a conversion result. If this object
16743  does not have an appropriate type, or if the result of the conversion cannot be represented
16744  in the object, the behavior is undefined.
16745 <p><a name="7.21.6.2p11" href="#7.21.6.2p11"><small>11</small></a>
16746  The length modifiers and their meanings are:
16747  hh             Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16748 <pre>
16749                 to an argument with type pointer to signed char or unsigned char.
16750 </pre>
16751  h              Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16752 <pre>
16753                 to an argument with type pointer to short int or unsigned short
16754                 int.
16755 </pre>
16756  l (ell)        Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16757 <pre>
16758                 to an argument with type pointer to long int or unsigned long
16759                 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
16760                 an argument with type pointer to double; or that a following c, s, or [
16761                 conversion specifier applies to an argument with type pointer to wchar_t.
16762 </pre>
16763  ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16764 <pre>
16765               to an argument with type pointer to long long int or unsigned
16766               long long int.
16767 </pre>
16768  
16769  
16770  
16771 <!--page 337 -->
16772  j            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16773 <pre>
16774               to an argument with type pointer to intmax_t or uintmax_t.
16775 </pre>
16776  z            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16777 <pre>
16778               to an argument with type pointer to size_t or the corresponding signed
16779               integer type.
16780 </pre>
16781  t            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16782 <pre>
16783               to an argument with type pointer to ptrdiff_t or the corresponding
16784               unsigned integer type.
16785 </pre>
16786  L            Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
16787 <pre>
16788               applies to an argument with type pointer to long double.
16789 </pre>
16790  If a length modifier appears with any conversion specifier other than as specified above,
16791  the behavior is undefined.
16792 <p><a name="7.21.6.2p12" href="#7.21.6.2p12"><small>12</small></a>
16793  The conversion specifiers and their meanings are:
16794  d           Matches an optionally signed decimal integer, whose format is the same as
16795 <pre>
16796              expected for the subject sequence of the strtol function with the value 10
16797              for the base argument. The corresponding argument shall be a pointer to
16798              signed integer.
16799 </pre>
16800  i           Matches an optionally signed integer, whose format is the same as expected
16801 <pre>
16802              for the subject sequence of the strtol function with the value 0 for the
16803              base argument. The corresponding argument shall be a pointer to signed
16804              integer.
16805 </pre>
16806  o           Matches an optionally signed octal integer, whose format is the same as
16807 <pre>
16808              expected for the subject sequence of the strtoul function with the value 8
16809              for the base argument. The corresponding argument shall be a pointer to
16810              unsigned integer.
16811 </pre>
16812  u           Matches an optionally signed decimal integer, whose format is the same as
16813 <pre>
16814              expected for the subject sequence of the strtoul function with the value 10
16815              for the base argument. The corresponding argument shall be a pointer to
16816              unsigned integer.
16817 </pre>
16818  x           Matches an optionally signed hexadecimal integer, whose format is the same
16819 <pre>
16820              as expected for the subject sequence of the strtoul function with the value
16821              16 for the base argument. The corresponding argument shall be a pointer to
16822              unsigned integer.
16823 </pre>
16824  a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
16825 <!--page 338 -->
16826 <pre>
16827          format is the same as expected for the subject sequence of the strtod
16828          function. The corresponding argument shall be a pointer to floating.
16829 </pre>
16830  c             Matches a sequence of characters of exactly the number specified by the field
16831 <pre>
16832                width (1 if no field width is present in the directive).<sup><a href="#note286"><b>286)</b></a></sup>
16833                If no l length modifier is present, the corresponding argument shall be a
16834                pointer to the initial element of a character array large enough to accept the
16835                sequence. No null character is added.
16836                If an l length modifier is present, the input shall be a sequence of multibyte
16837                characters that begins in the initial shift state. Each multibyte character in the
16838                sequence is converted to a wide character as if by a call to the mbrtowc
16839                function, with the conversion state described by an mbstate_t object
16840                initialized to zero before the first multibyte character is converted. The
16841                corresponding argument shall be a pointer to the initial element of an array of
16842                wchar_t large enough to accept the resulting sequence of wide characters.
16843                No null wide character is added.
16844 </pre>
16845  s             Matches a sequence of non-white-space characters.<sup><a href="#note286"><b>286)</b></a></sup>
16846 <pre>
16847                If no l length modifier is present, the corresponding argument shall be a
16848                pointer to the initial element of a character array large enough to accept the
16849                sequence and a terminating null character, which will be added automatically.
16850                If an l length modifier is present, the input shall be a sequence of multibyte
16851                characters that begins in the initial shift state. Each multibyte character is
16852                converted to a wide character as if by a call to the mbrtowc function, with
16853                the conversion state described by an mbstate_t object initialized to zero
16854                before the first multibyte character is converted. The corresponding argument
16855                shall be a pointer to the initial element of an array of wchar_t large enough
16856                to accept the sequence and the terminating null wide character, which will be
16857                added automatically.
16858 </pre>
16859  [             Matches a nonempty sequence of characters from a set of expected characters
16860 <pre>
16861                (the scanset).<sup><a href="#note286"><b>286)</b></a></sup>
16862                If no l length modifier is present, the corresponding argument shall be a
16863                pointer to the initial element of a character array large enough to accept the
16864                sequence and a terminating null character, which will be added automatically.
16865                If an l length modifier is present, the input shall be a sequence of multibyte
16866                characters that begins in the initial shift state. Each multibyte character is
16867                converted to a wide character as if by a call to the mbrtowc function, with
16868                the conversion state described by an mbstate_t object initialized to zero
16869 </pre>
16870  
16871 <!--page 339 -->
16872 <pre>
16873                 before the first multibyte character is converted. The corresponding argument
16874                 shall be a pointer to the initial element of an array of wchar_t large enough
16875                 to accept the sequence and the terminating null wide character, which will be
16876                 added automatically.
16877                 The conversion specifier includes all subsequent characters in the format
16878                 string, up to and including the matching right bracket (]). The characters
16879                 between the brackets (the scanlist) compose the scanset, unless the character
16880                 after the left bracket is a circumflex (^), in which case the scanset contains all
16881                 characters that do not appear in the scanlist between the circumflex and the
16882                 right bracket. If the conversion specifier begins with [] or [^], the right
16883                 bracket character is in the scanlist and the next following right bracket
16884                 character is the matching right bracket that ends the specification; otherwise
16885                 the first following right bracket character is the one that ends the
16886                 specification. If a - character is in the scanlist and is not the first, nor the
16887                 second where the first character is a ^, nor the last character, the behavior is
16888                 implementation-defined.
16889 </pre>
16890  p              Matches an implementation-defined set of sequences, which should be the
16891 <pre>
16892                 same as the set of sequences that may be produced by the %p conversion of
16893                 the fprintf function. The corresponding argument shall be a pointer to a
16894                 pointer to void. The input item is converted to a pointer value in an
16895                 implementation-defined manner. If the input item is a value converted earlier
16896                 during the same program execution, the pointer that results shall compare
16897                 equal to that value; otherwise the behavior of the %p conversion is undefined.
16898 </pre>
16899  n              No input is consumed. The corresponding argument shall be a pointer to
16900 <pre>
16901                 signed integer into which is to be written the number of characters read from
16902                 the input stream so far by this call to the fscanf function. Execution of a
16903                 %n directive does not increment the assignment count returned at the
16904                 completion of execution of the fscanf function. No argument is converted,
16905                 but one is consumed. If the conversion specification includes an assignment-
16906                 suppressing character or a field width, the behavior is undefined.
16907 </pre>
16908  %              Matches a single % character; no conversion or assignment occurs. The
16909 <pre>
16910                 complete conversion specification shall be %%.
16911 </pre>
16912 <p><a name="7.21.6.2p13" href="#7.21.6.2p13"><small>13</small></a>
16913  If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note287"><b>287)</b></a></sup>
16914 <p><a name="7.21.6.2p14" href="#7.21.6.2p14"><small>14</small></a>
16915  The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
16916  respectively, a, e, f, g, and x.
16917  
16918  
16919  
16920 <!--page 340 -->
16921 <p><a name="7.21.6.2p15" href="#7.21.6.2p15"><small>15</small></a>
16922  Trailing white space (including new-line characters) is left unread unless matched by a
16923  directive. The success of literal matches and suppressed assignments is not directly
16924  determinable other than via the %n directive.
16925 <p><b>Returns</b>
16926 <p><a name="7.21.6.2p16" href="#7.21.6.2p16"><small>16</small></a>
16927  The fscanf function returns the value of the macro EOF if an input failure occurs
16928  before the first conversion (if any) has completed. Otherwise, the function returns the
16929  number of input items assigned, which can be fewer than provided for, or even zero, in
16930  the event of an early matching failure.
16931 <p><a name="7.21.6.2p17" href="#7.21.6.2p17"><small>17</small></a>
16932  EXAMPLE 1        The call:
16933 <pre>
16934           #include <a href="#7.21">&lt;stdio.h&gt;</a>
16935           /* ... */
16936           int n, i; float x; char name[50];
16937           n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);
16938 </pre>
16939  with the input line:
16940 <pre>
16941           25 54.32E-1 thompson
16942 </pre>
16943  will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
16944  thompson\0.
16945  
16946 <p><a name="7.21.6.2p18" href="#7.21.6.2p18"><small>18</small></a>
16947  EXAMPLE 2        The call:
16948 <pre>
16949           #include <a href="#7.21">&lt;stdio.h&gt;</a>
16950           /* ... */
16951           int i; float x; char name[50];
16952           fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);
16953 </pre>
16954  with input:
16955 <pre>
16956           56789 0123 56a72
16957 </pre>
16958  will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
16959  sequence 56\0. The next character read from the input stream will be a.
16960  
16961 <p><a name="7.21.6.2p19" href="#7.21.6.2p19"><small>19</small></a>
16962  EXAMPLE 3        To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
16963 <pre>
16964           #include <a href="#7.21">&lt;stdio.h&gt;</a>
16965           /* ... */
16966           int count; float quant; char units[21], item[21];
16967           do {
16968                   count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
16969                   fscanf(stdin,"%*[^\n]");
16970           } while (!feof(stdin) &amp;&amp; !ferror(stdin));
16971 </pre>
16972 <p><a name="7.21.6.2p20" href="#7.21.6.2p20"><small>20</small></a>
16973  If the stdin stream contains the following lines:
16974 <!--page 341 -->
16975 <pre>
16976           2 quarts of oil
16977           -12.8degrees Celsius
16978           lots of luck
16979           10.0LBS     of
16980           dirt
16981           100ergs of energy
16982 </pre>
16983  the execution of the above example will be analogous to the following assignments:
16984 <pre>
16985            quant     =   2; strcpy(units, "quarts"); strcpy(item, "oil");
16986            count     =   3;
16987            quant     =   -12.8; strcpy(units, "degrees");
16988            count     =   2; // "C" fails to match "o"
16989            count     =   0; // "l" fails to match "%f"
16990            quant     =   10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
16991            count     =   3;
16992            count     =   0; // "100e" fails to match "%f"
16993            count     =   EOF;
16994 </pre>
16995  
16996 <p><a name="7.21.6.2p21" href="#7.21.6.2p21"><small>21</small></a>
16997  EXAMPLE 4         In:
16998 <pre>
16999            #include <a href="#7.21">&lt;stdio.h&gt;</a>
17000            /* ... */
17001            int d1, d2, n1, n2, i;
17002            i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);
17003 </pre>
17004  the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure, the value
17005  of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
17006  
17007 <p><a name="7.21.6.2p22" href="#7.21.6.2p22"><small>22</small></a>
17008  EXAMPLE 5         The call:
17009 <pre>
17010            #include <a href="#7.21">&lt;stdio.h&gt;</a>
17011            /* ... */
17012            int n, i;
17013            n = sscanf("foo %            bar    42", "foo%%bar%d", &amp;i);
17014 </pre>
17015  will assign to n the value 1 and to i the value 42 because input white-space characters are skipped for both
17016  the % and d conversion specifiers.
17017  
17018 <p><a name="7.21.6.2p23" href="#7.21.6.2p23"><small>23</small></a>
17019  EXAMPLE 6 In these examples, multibyte characters do have a state-dependent encoding, and the
17020  members of the extended character set that consist of more than one byte each consist of exactly two bytes,
17021  the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
17022  such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
17023  entry into the alternate shift state.
17024 <p><a name="7.21.6.2p24" href="#7.21.6.2p24"><small>24</small></a>
17025  After the call:
17026 <pre>
17027            #include <a href="#7.21">&lt;stdio.h&gt;</a>
17028            /* ... */
17029            char str[50];
17030            fscanf(stdin, "a%s", str);
17031 </pre>
17032  with the input line:
17033 <pre>
17034            a(uparrow) X Y(downarrow) bc
17035 </pre>
17036  str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
17037  characters, in the more general case) appears to be a single-byte white-space character.
17038 <p><a name="7.21.6.2p25" href="#7.21.6.2p25"><small>25</small></a>
17039  In contrast, after the call:
17040 <!--page 342 -->
17041 <pre>
17042          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17043          #include <a href="#7.19">&lt;stddef.h&gt;</a>
17044          /* ... */
17045          wchar_t wstr[50];
17046          fscanf(stdin, "a%ls", wstr);
17047 </pre>
17048  with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
17049  terminating null wide character.
17050 <p><a name="7.21.6.2p26" href="#7.21.6.2p26"><small>26</small></a>
17051  However, the call:
17052 <pre>
17053          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17054          #include <a href="#7.19">&lt;stddef.h&gt;</a>
17055          /* ... */
17056          wchar_t wstr[50];
17057          fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
17058 </pre>
17059  with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
17060  string.
17061 <p><a name="7.21.6.2p27" href="#7.21.6.2p27"><small>27</small></a>
17062  Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
17063  character Y, after the call:
17064 <pre>
17065          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17066          #include <a href="#7.19">&lt;stddef.h&gt;</a>
17067          /* ... */
17068          wchar_t wstr[50];
17069          fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
17070 </pre>
17071  with the same input line, zero will again be returned, but stdin will be left with a partially consumed
17072  multibyte character.
17073  
17074 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>), the
17075  strtol, strtoll, strtoul, and strtoull functions (<a href="#7.22.1.4">7.22.1.4</a>), conversion state
17076  (<a href="#7.29.6">7.29.6</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
17077
17078 <p><b>Footnotes</b>
17079 <p><small><a name="note284" href="#note284">284)</a> These white-space characters are not counted against a specified field width.
17080 </small>
17081 <p><small><a name="note285" href="#note285">285)</a> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
17082  that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
17083 </small>
17084 <p><small><a name="note286" href="#note286">286)</a> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
17085  conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
17086  resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
17087 </small>
17088 <p><small><a name="note287" href="#note287">287)</a> See ''future library directions'' (<a href="#7.31.11">7.31.11</a>).
17089 </small>
17090
17091 <p><small><a href="#Contents">Contents</a></small>
17092 <h5><a name="7.21.6.3" href="#7.21.6.3">7.21.6.3 The printf function</a></h5>
17093 <p><b>Synopsis</b>
17094 <p><a name="7.21.6.3p1" href="#7.21.6.3p1"><small>1</small></a>
17095 <pre>
17096          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17097          int printf(const char * restrict format, ...);
17098 </pre>
17099 <p><b>Description</b>
17100 <p><a name="7.21.6.3p2" href="#7.21.6.3p2"><small>2</small></a>
17101  The printf function is equivalent to fprintf with the argument stdout interposed
17102  before the arguments to printf.
17103 <p><b>Returns</b>
17104 <p><a name="7.21.6.3p3" href="#7.21.6.3p3"><small>3</small></a>
17105  The printf function returns the number of characters transmitted, or a negative value if
17106  an output or encoding error occurred.
17107 <!--page 343 -->
17108
17109 <p><small><a href="#Contents">Contents</a></small>
17110 <h5><a name="7.21.6.4" href="#7.21.6.4">7.21.6.4 The scanf function</a></h5>
17111 <p><b>Synopsis</b>
17112 <p><a name="7.21.6.4p1" href="#7.21.6.4p1"><small>1</small></a>
17113 <pre>
17114          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17115          int scanf(const char * restrict format, ...);
17116 </pre>
17117 <p><b>Description</b>
17118 <p><a name="7.21.6.4p2" href="#7.21.6.4p2"><small>2</small></a>
17119  The scanf function is equivalent to fscanf with the argument stdin interposed
17120  before the arguments to scanf.
17121 <p><b>Returns</b>
17122 <p><a name="7.21.6.4p3" href="#7.21.6.4p3"><small>3</small></a>
17123  The scanf function returns the value of the macro EOF if an input failure occurs before
17124  the first conversion (if any) has completed. Otherwise, the scanf function returns the
17125  number of input items assigned, which can be fewer than provided for, or even zero, in
17126  the event of an early matching failure.
17127
17128 <p><small><a href="#Contents">Contents</a></small>
17129 <h5><a name="7.21.6.5" href="#7.21.6.5">7.21.6.5 The snprintf function</a></h5>
17130 <p><b>Synopsis</b>
17131 <p><a name="7.21.6.5p1" href="#7.21.6.5p1"><small>1</small></a>
17132 <pre>
17133          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17134          int snprintf(char * restrict s, size_t n,
17135               const char * restrict format, ...);
17136 </pre>
17137 <p><b>Description</b>
17138 <p><a name="7.21.6.5p2" href="#7.21.6.5p2"><small>2</small></a>
17139  The snprintf function is equivalent to fprintf, except that the output is written into
17140  an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
17141  and s may be a null pointer. Otherwise, output characters beyond the n-1st are
17142  discarded rather than being written to the array, and a null character is written at the end
17143  of the characters actually written into the array. If copying takes place between objects
17144  that overlap, the behavior is undefined.
17145 <p><b>Returns</b>
17146 <p><a name="7.21.6.5p3" href="#7.21.6.5p3"><small>3</small></a>
17147  The snprintf function returns the number of characters that would have been written
17148  had n been sufficiently large, not counting the terminating null character, or a negative
17149  value if an encoding error occurred. Thus, the null-terminated output has been
17150  completely written if and only if the returned value is nonnegative and less than n.
17151
17152 <p><small><a href="#Contents">Contents</a></small>
17153 <h5><a name="7.21.6.6" href="#7.21.6.6">7.21.6.6 The sprintf function</a></h5>
17154 <p><b>Synopsis</b>
17155 <p><a name="7.21.6.6p1" href="#7.21.6.6p1"><small>1</small></a>
17156 <!--page 344 -->
17157 <pre>
17158          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17159          int sprintf(char * restrict s,
17160               const char * restrict format, ...);
17161 </pre>
17162 <p><b>Description</b>
17163 <p><a name="7.21.6.6p2" href="#7.21.6.6p2"><small>2</small></a>
17164  The sprintf function is equivalent to fprintf, except that the output is written into
17165  an array (specified by the argument s) rather than to a stream. A null character is written
17166  at the end of the characters written; it is not counted as part of the returned value. If
17167  copying takes place between objects that overlap, the behavior is undefined.
17168 <p><b>Returns</b>
17169 <p><a name="7.21.6.6p3" href="#7.21.6.6p3"><small>3</small></a>
17170  The sprintf function returns the number of characters written in the array, not
17171  counting the terminating null character, or a negative value if an encoding error occurred.
17172
17173 <p><small><a href="#Contents">Contents</a></small>
17174 <h5><a name="7.21.6.7" href="#7.21.6.7">7.21.6.7 The sscanf function</a></h5>
17175 <p><b>Synopsis</b>
17176 <p><a name="7.21.6.7p1" href="#7.21.6.7p1"><small>1</small></a>
17177 <pre>
17178         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17179         int sscanf(const char * restrict s,
17180              const char * restrict format, ...);
17181 </pre>
17182 <p><b>Description</b>
17183 <p><a name="7.21.6.7p2" href="#7.21.6.7p2"><small>2</small></a>
17184  The sscanf function is equivalent to fscanf, except that input is obtained from a
17185  string (specified by the argument s) rather than from a stream. Reaching the end of the
17186  string is equivalent to encountering end-of-file for the fscanf function. If copying
17187  takes place between objects that overlap, the behavior is undefined.
17188 <p><b>Returns</b>
17189 <p><a name="7.21.6.7p3" href="#7.21.6.7p3"><small>3</small></a>
17190  The sscanf function returns the value of the macro EOF if an input failure occurs
17191  before the first conversion (if any) has completed. Otherwise, the sscanf function
17192  returns the number of input items assigned, which can be fewer than provided for, or even
17193  zero, in the event of an early matching failure.
17194
17195 <p><small><a href="#Contents">Contents</a></small>
17196 <h5><a name="7.21.6.8" href="#7.21.6.8">7.21.6.8 The vfprintf function</a></h5>
17197 <p><b>Synopsis</b>
17198 <p><a name="7.21.6.8p1" href="#7.21.6.8p1"><small>1</small></a>
17199 <pre>
17200         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17201         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17202         int vfprintf(FILE * restrict stream,
17203              const char * restrict format,
17204              va_list arg);
17205 </pre>
17206 <p><b>Description</b>
17207 <p><a name="7.21.6.8p2" href="#7.21.6.8p2"><small>2</small></a>
17208  The vfprintf function is equivalent to fprintf, with the variable argument list
17209  replaced by arg, which shall have been initialized by the va_start macro (and
17210  possibly subsequent va_arg calls). The vfprintf function does not invoke the
17211 <!--page 345 -->
17212  va_end macro.<sup><a href="#note288"><b>288)</b></a></sup>
17213 <p><b>Returns</b>
17214 <p><a name="7.21.6.8p3" href="#7.21.6.8p3"><small>3</small></a>
17215  The vfprintf function returns the number of characters transmitted, or a negative
17216  value if an output or encoding error occurred.
17217 <p><a name="7.21.6.8p4" href="#7.21.6.8p4"><small>4</small></a>
17218  EXAMPLE       The following shows the use of the vfprintf function in a general error-reporting routine.
17219 <pre>
17220          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17221          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17222          void error(char *function_name, char *format, ...)
17223          {
17224                va_list args;
17225                  va_start(args, format);
17226                  // print out name of function causing error
17227                  fprintf(stderr, "ERROR in %s: ", function_name);
17228                  // print out remainder of message
17229                  vfprintf(stderr, format, args);
17230                  va_end(args);
17231          }
17232 </pre>
17233  
17234
17235 <p><b>Footnotes</b>
17236 <p><small><a name="note288" href="#note288">288)</a> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
17237  vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
17238 </small>
17239
17240 <p><small><a href="#Contents">Contents</a></small>
17241 <h5><a name="7.21.6.9" href="#7.21.6.9">7.21.6.9 The vfscanf function</a></h5>
17242 <p><b>Synopsis</b>
17243 <p><a name="7.21.6.9p1" href="#7.21.6.9p1"><small>1</small></a>
17244 <pre>
17245          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17246          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17247          int vfscanf(FILE * restrict stream,
17248               const char * restrict format,
17249               va_list arg);
17250 </pre>
17251 <p><b>Description</b>
17252 <p><a name="7.21.6.9p2" href="#7.21.6.9p2"><small>2</small></a>
17253  The vfscanf function is equivalent to fscanf, with the variable argument list
17254  replaced by arg, which shall have been initialized by the va_start macro (and
17255  possibly subsequent va_arg calls). The vfscanf function does not invoke the
17256  va_end macro.<sup><a href="#note288"><b>288)</b></a></sup>
17257 <p><b>Returns</b>
17258 <p><a name="7.21.6.9p3" href="#7.21.6.9p3"><small>3</small></a>
17259  The vfscanf function returns the value of the macro EOF if an input failure occurs
17260  before the first conversion (if any) has completed. Otherwise, the vfscanf function
17261  returns the number of input items assigned, which can be fewer than provided for, or even
17262  zero, in the event of an early matching failure.
17263  
17264  
17265  
17266 <!--page 346 -->
17267
17268 <p><small><a href="#Contents">Contents</a></small>
17269 <h5><a name="7.21.6.10" href="#7.21.6.10">7.21.6.10 The vprintf function</a></h5>
17270 <p><b>Synopsis</b>
17271 <p><a name="7.21.6.10p1" href="#7.21.6.10p1"><small>1</small></a>
17272 <pre>
17273         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17274         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17275         int vprintf(const char * restrict format,
17276              va_list arg);
17277 </pre>
17278 <p><b>Description</b>
17279 <p><a name="7.21.6.10p2" href="#7.21.6.10p2"><small>2</small></a>
17280  The vprintf function is equivalent to printf, with the variable argument list
17281  replaced by arg, which shall have been initialized by the va_start macro (and
17282  possibly subsequent va_arg calls). The vprintf function does not invoke the
17283  va_end macro.<sup><a href="#note288"><b>288)</b></a></sup>
17284 <p><b>Returns</b>
17285 <p><a name="7.21.6.10p3" href="#7.21.6.10p3"><small>3</small></a>
17286  The vprintf function returns the number of characters transmitted, or a negative value
17287  if an output or encoding error occurred.
17288
17289 <p><small><a href="#Contents">Contents</a></small>
17290 <h5><a name="7.21.6.11" href="#7.21.6.11">7.21.6.11 The vscanf function</a></h5>
17291 <p><b>Synopsis</b>
17292 <p><a name="7.21.6.11p1" href="#7.21.6.11p1"><small>1</small></a>
17293 <pre>
17294         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17295         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17296         int vscanf(const char * restrict format,
17297              va_list arg);
17298 </pre>
17299 <p><b>Description</b>
17300 <p><a name="7.21.6.11p2" href="#7.21.6.11p2"><small>2</small></a>
17301  The vscanf function is equivalent to scanf, with the variable argument list replaced
17302  by arg, which shall have been initialized by the va_start macro (and possibly
17303  subsequent va_arg calls). The vscanf function does not invoke the va_end
17304  macro.<sup><a href="#note288"><b>288)</b></a></sup>
17305 <p><b>Returns</b>
17306 <p><a name="7.21.6.11p3" href="#7.21.6.11p3"><small>3</small></a>
17307  The vscanf function returns the value of the macro EOF if an input failure occurs
17308  before the first conversion (if any) has completed. Otherwise, the vscanf function
17309  returns the number of input items assigned, which can be fewer than provided for, or even
17310  zero, in the event of an early matching failure.
17311 <!--page 347 -->
17312
17313 <p><small><a href="#Contents">Contents</a></small>
17314 <h5><a name="7.21.6.12" href="#7.21.6.12">7.21.6.12 The vsnprintf function</a></h5>
17315 <p><b>Synopsis</b>
17316 <p><a name="7.21.6.12p1" href="#7.21.6.12p1"><small>1</small></a>
17317 <pre>
17318          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17319          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17320          int vsnprintf(char * restrict s, size_t n,
17321               const char * restrict format,
17322               va_list arg);
17323 </pre>
17324 <p><b>Description</b>
17325 <p><a name="7.21.6.12p2" href="#7.21.6.12p2"><small>2</small></a>
17326  The vsnprintf function is equivalent to snprintf, with the variable argument list
17327  replaced by arg, which shall have been initialized by the va_start macro (and
17328  possibly subsequent va_arg calls). The vsnprintf function does not invoke the
17329  va_end macro.<sup><a href="#note288"><b>288)</b></a></sup> If copying takes place between objects that overlap, the behavior is
17330  undefined.
17331 <p><b>Returns</b>
17332 <p><a name="7.21.6.12p3" href="#7.21.6.12p3"><small>3</small></a>
17333  The vsnprintf function returns the number of characters that would have been written
17334  had n been sufficiently large, not counting the terminating null character, or a negative
17335  value if an encoding error occurred. Thus, the null-terminated output has been
17336  completely written if and only if the returned value is nonnegative and less than n.
17337
17338 <p><small><a href="#Contents">Contents</a></small>
17339 <h5><a name="7.21.6.13" href="#7.21.6.13">7.21.6.13 The vsprintf function</a></h5>
17340 <p><b>Synopsis</b>
17341 <p><a name="7.21.6.13p1" href="#7.21.6.13p1"><small>1</small></a>
17342 <pre>
17343          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17344          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17345          int vsprintf(char * restrict s,
17346               const char * restrict format,
17347               va_list arg);
17348 </pre>
17349 <p><b>Description</b>
17350 <p><a name="7.21.6.13p2" href="#7.21.6.13p2"><small>2</small></a>
17351  The vsprintf function is equivalent to sprintf, with the variable argument list
17352  replaced by arg, which shall have been initialized by the va_start macro (and
17353  possibly subsequent va_arg calls). The vsprintf function does not invoke the
17354  va_end macro.<sup><a href="#note288"><b>288)</b></a></sup> If copying takes place between objects that overlap, the behavior is
17355  undefined.
17356 <p><b>Returns</b>
17357 <p><a name="7.21.6.13p3" href="#7.21.6.13p3"><small>3</small></a>
17358  The vsprintf function returns the number of characters written in the array, not
17359  counting the terminating null character, or a negative value if an encoding error occurred.
17360 <!--page 348 -->
17361
17362 <p><small><a href="#Contents">Contents</a></small>
17363 <h5><a name="7.21.6.14" href="#7.21.6.14">7.21.6.14 The vsscanf function</a></h5>
17364 <p><b>Synopsis</b>
17365 <p><a name="7.21.6.14p1" href="#7.21.6.14p1"><small>1</small></a>
17366 <pre>
17367          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
17368          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17369          int vsscanf(const char * restrict s,
17370               const char * restrict format,
17371               va_list arg);
17372 </pre>
17373 <p><b>Description</b>
17374 <p><a name="7.21.6.14p2" href="#7.21.6.14p2"><small>2</small></a>
17375  The vsscanf function is equivalent to sscanf, with the variable argument list
17376  replaced by arg, which shall have been initialized by the va_start macro (and
17377  possibly subsequent va_arg calls). The vsscanf function does not invoke the
17378  va_end macro.<sup><a href="#note288"><b>288)</b></a></sup>
17379 <p><b>Returns</b>
17380 <p><a name="7.21.6.14p3" href="#7.21.6.14p3"><small>3</small></a>
17381  The vsscanf function returns the value of the macro EOF if an input failure occurs
17382  before the first conversion (if any) has completed. Otherwise, the vsscanf function
17383  returns the number of input items assigned, which can be fewer than provided for, or even
17384  zero, in the event of an early matching failure.
17385
17386 <p><small><a href="#Contents">Contents</a></small>
17387 <h4><a name="7.21.7" href="#7.21.7">7.21.7 Character input/output functions</a></h4>
17388
17389 <p><small><a href="#Contents">Contents</a></small>
17390 <h5><a name="7.21.7.1" href="#7.21.7.1">7.21.7.1 The fgetc function</a></h5>
17391 <p><b>Synopsis</b>
17392 <p><a name="7.21.7.1p1" href="#7.21.7.1p1"><small>1</small></a>
17393 <pre>
17394          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17395          int fgetc(FILE *stream);
17396 </pre>
17397 <p><b>Description</b>
17398 <p><a name="7.21.7.1p2" href="#7.21.7.1p2"><small>2</small></a>
17399  If the end-of-file indicator for the input stream pointed to by stream is not set and a
17400  next character is present, the fgetc function obtains that character as an unsigned
17401  char converted to an int and advances the associated file position indicator for the
17402  stream (if defined).
17403 <p><b>Returns</b>
17404 <p><a name="7.21.7.1p3" href="#7.21.7.1p3"><small>3</small></a>
17405  If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
17406  of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
17407  fgetc function returns the next character from the input stream pointed to by stream.
17408  If a read error occurs, the error indicator for the stream is set and the fgetc function
17409  returns EOF.<sup><a href="#note289"><b>289)</b></a></sup>
17410  
17411  
17412 <!--page 349 -->
17413
17414 <p><b>Footnotes</b>
17415 <p><small><a name="note289" href="#note289">289)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
17416 </small>
17417
17418 <p><small><a href="#Contents">Contents</a></small>
17419 <h5><a name="7.21.7.2" href="#7.21.7.2">7.21.7.2 The fgets function</a></h5>
17420 <p><b>Synopsis</b>
17421 <p><a name="7.21.7.2p1" href="#7.21.7.2p1"><small>1</small></a>
17422 <pre>
17423          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17424          char *fgets(char * restrict s, int n,
17425               FILE * restrict stream);
17426 </pre>
17427 <p><b>Description</b>
17428 <p><a name="7.21.7.2p2" href="#7.21.7.2p2"><small>2</small></a>
17429  The fgets function reads at most one less than the number of characters specified by n
17430  from the stream pointed to by stream into the array pointed to by s. No additional
17431  characters are read after a new-line character (which is retained) or after end-of-file. A
17432  null character is written immediately after the last character read into the array.
17433 <p><b>Returns</b>
17434 <p><a name="7.21.7.2p3" href="#7.21.7.2p3"><small>3</small></a>
17435  The fgets function returns s if successful. If end-of-file is encountered and no
17436  characters have been read into the array, the contents of the array remain unchanged and a
17437  null pointer is returned. If a read error occurs during the operation, the array contents are
17438  indeterminate and a null pointer is returned.
17439
17440 <p><small><a href="#Contents">Contents</a></small>
17441 <h5><a name="7.21.7.3" href="#7.21.7.3">7.21.7.3 The fputc function</a></h5>
17442 <p><b>Synopsis</b>
17443 <p><a name="7.21.7.3p1" href="#7.21.7.3p1"><small>1</small></a>
17444 <pre>
17445          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17446          int fputc(int c, FILE *stream);
17447 </pre>
17448 <p><b>Description</b>
17449 <p><a name="7.21.7.3p2" href="#7.21.7.3p2"><small>2</small></a>
17450  The fputc function writes the character specified by c (converted to an unsigned
17451  char) to the output stream pointed to by stream, at the position indicated by the
17452  associated file position indicator for the stream (if defined), and advances the indicator
17453  appropriately. If the file cannot support positioning requests, or if the stream was opened
17454  with append mode, the character is appended to the output stream.
17455 <p><b>Returns</b>
17456 <p><a name="7.21.7.3p3" href="#7.21.7.3p3"><small>3</small></a>
17457  The fputc function returns the character written. If a write error occurs, the error
17458  indicator for the stream is set and fputc returns EOF.
17459
17460 <p><small><a href="#Contents">Contents</a></small>
17461 <h5><a name="7.21.7.4" href="#7.21.7.4">7.21.7.4 The fputs function</a></h5>
17462 <p><b>Synopsis</b>
17463 <p><a name="7.21.7.4p1" href="#7.21.7.4p1"><small>1</small></a>
17464 <!--page 350 -->
17465 <pre>
17466          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17467          int fputs(const char * restrict s,
17468               FILE * restrict stream);
17469 </pre>
17470 <p><b>Description</b>
17471 <p><a name="7.21.7.4p2" href="#7.21.7.4p2"><small>2</small></a>
17472  The fputs function writes the string pointed to by s to the stream pointed to by
17473  stream. The terminating null character is not written.
17474 <p><b>Returns</b>
17475 <p><a name="7.21.7.4p3" href="#7.21.7.4p3"><small>3</small></a>
17476  The fputs function returns EOF if a write error occurs; otherwise it returns a
17477  nonnegative value.
17478
17479 <p><small><a href="#Contents">Contents</a></small>
17480 <h5><a name="7.21.7.5" href="#7.21.7.5">7.21.7.5 The getc function</a></h5>
17481 <p><b>Synopsis</b>
17482 <p><a name="7.21.7.5p1" href="#7.21.7.5p1"><small>1</small></a>
17483 <pre>
17484         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17485         int getc(FILE *stream);
17486 </pre>
17487 <p><b>Description</b>
17488 <p><a name="7.21.7.5p2" href="#7.21.7.5p2"><small>2</small></a>
17489  The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
17490  may evaluate stream more than once, so the argument should never be an expression
17491  with side effects.
17492 <p><b>Returns</b>
17493 <p><a name="7.21.7.5p3" href="#7.21.7.5p3"><small>3</small></a>
17494  The getc function returns the next character from the input stream pointed to by
17495  stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
17496  getc returns EOF. If a read error occurs, the error indicator for the stream is set and
17497  getc returns EOF.
17498
17499 <p><small><a href="#Contents">Contents</a></small>
17500 <h5><a name="7.21.7.6" href="#7.21.7.6">7.21.7.6 The getchar function</a></h5>
17501 <p><b>Synopsis</b>
17502 <p><a name="7.21.7.6p1" href="#7.21.7.6p1"><small>1</small></a>
17503 <pre>
17504         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17505         int getchar(void);
17506 </pre>
17507 <p><b>Description</b>
17508 <p><a name="7.21.7.6p2" href="#7.21.7.6p2"><small>2</small></a>
17509  The getchar function is equivalent to getc with the argument stdin.
17510 <p><b>Returns</b>
17511 <p><a name="7.21.7.6p3" href="#7.21.7.6p3"><small>3</small></a>
17512  The getchar function returns the next character from the input stream pointed to by
17513  stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
17514  getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
17515  getchar returns EOF.
17516 <!--page 351 -->
17517
17518 <p><small><a href="#Contents">Contents</a></small>
17519 <h5><a name="7.21.7.7" href="#7.21.7.7">7.21.7.7 The putc function</a></h5>
17520 <p><b>Synopsis</b>
17521 <p><a name="7.21.7.7p1" href="#7.21.7.7p1"><small>1</small></a>
17522 <pre>
17523          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17524          int putc(int c, FILE *stream);
17525 </pre>
17526 <p><b>Description</b>
17527 <p><a name="7.21.7.7p2" href="#7.21.7.7p2"><small>2</small></a>
17528  The putc function is equivalent to fputc, except that if it is implemented as a macro, it
17529  may evaluate stream more than once, so that argument should never be an expression
17530  with side effects.
17531 <p><b>Returns</b>
17532 <p><a name="7.21.7.7p3" href="#7.21.7.7p3"><small>3</small></a>
17533  The putc function returns the character written. If a write error occurs, the error
17534  indicator for the stream is set and putc returns EOF.
17535
17536 <p><small><a href="#Contents">Contents</a></small>
17537 <h5><a name="7.21.7.8" href="#7.21.7.8">7.21.7.8 The putchar function</a></h5>
17538 <p><b>Synopsis</b>
17539 <p><a name="7.21.7.8p1" href="#7.21.7.8p1"><small>1</small></a>
17540 <pre>
17541          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17542          int putchar(int c);
17543 </pre>
17544 <p><b>Description</b>
17545 <p><a name="7.21.7.8p2" href="#7.21.7.8p2"><small>2</small></a>
17546  The putchar function is equivalent to putc with the second argument stdout.
17547 <p><b>Returns</b>
17548 <p><a name="7.21.7.8p3" href="#7.21.7.8p3"><small>3</small></a>
17549  The putchar function returns the character written. If a write error occurs, the error
17550  indicator for the stream is set and putchar returns EOF.
17551
17552 <p><small><a href="#Contents">Contents</a></small>
17553 <h5><a name="7.21.7.9" href="#7.21.7.9">7.21.7.9 The puts function</a></h5>
17554 <p><b>Synopsis</b>
17555 <p><a name="7.21.7.9p1" href="#7.21.7.9p1"><small>1</small></a>
17556 <pre>
17557          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17558          int puts(const char *s);
17559 </pre>
17560 <p><b>Description</b>
17561 <p><a name="7.21.7.9p2" href="#7.21.7.9p2"><small>2</small></a>
17562  The puts function writes the string pointed to by s to the stream pointed to by stdout,
17563  and appends a new-line character to the output. The terminating null character is not
17564  written.
17565 <p><b>Returns</b>
17566 <p><a name="7.21.7.9p3" href="#7.21.7.9p3"><small>3</small></a>
17567  The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
17568  value.
17569 <!--page 352 -->
17570
17571 <p><small><a href="#Contents">Contents</a></small>
17572 <h5><a name="7.21.7.10" href="#7.21.7.10">7.21.7.10 The ungetc function</a></h5>
17573 <p><b>Synopsis</b>
17574 <p><a name="7.21.7.10p1" href="#7.21.7.10p1"><small>1</small></a>
17575 <pre>
17576           #include <a href="#7.21">&lt;stdio.h&gt;</a>
17577           int ungetc(int c, FILE *stream);
17578 </pre>
17579 <p><b>Description</b>
17580 <p><a name="7.21.7.10p2" href="#7.21.7.10p2"><small>2</small></a>
17581  The ungetc function pushes the character specified by c (converted to an unsigned
17582  char) back onto the input stream pointed to by stream. Pushed-back characters will be
17583  returned by subsequent reads on that stream in the reverse order of their pushing. A
17584  successful intervening call (with the stream pointed to by stream) to a file positioning
17585  function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
17586  stream. The external storage corresponding to the stream is unchanged.
17587 <p><a name="7.21.7.10p3" href="#7.21.7.10p3"><small>3</small></a>
17588  One character of pushback is guaranteed. If the ungetc function is called too many
17589  times on the same stream without an intervening read or file positioning operation on that
17590  stream, the operation may fail.
17591 <p><a name="7.21.7.10p4" href="#7.21.7.10p4"><small>4</small></a>
17592  If the value of c equals that of the macro EOF, the operation fails and the input stream is
17593  unchanged.
17594 <p><a name="7.21.7.10p5" href="#7.21.7.10p5"><small>5</small></a>
17595  A successful call to the ungetc function clears the end-of-file indicator for the stream.
17596  The value of the file position indicator for the stream after reading or discarding all
17597  pushed-back characters shall be the same as it was before the characters were pushed
17598  back. For a text stream, the value of its file position indicator after a successful call to the
17599  ungetc function is unspecified until all pushed-back characters are read or discarded.
17600  For a binary stream, its file position indicator is decremented by each successful call to
17601  the ungetc function; if its value was zero before a call, it is indeterminate after the
17602  call.<sup><a href="#note290"><b>290)</b></a></sup>
17603 <p><b>Returns</b>
17604 <p><a name="7.21.7.10p6" href="#7.21.7.10p6"><small>6</small></a>
17605  The ungetc function returns the character pushed back after conversion, or EOF if the
17606  operation fails.
17607 <p><b> Forward references</b>: file positioning functions (<a href="#7.21.9">7.21.9</a>).
17608  
17609  
17610  
17611  
17612 <!--page 353 -->
17613
17614 <p><b>Footnotes</b>
17615 <p><small><a name="note290" href="#note290">290)</a> See ''future library directions'' (<a href="#7.31.11">7.31.11</a>).
17616 </small>
17617
17618 <p><small><a href="#Contents">Contents</a></small>
17619 <h4><a name="7.21.8" href="#7.21.8">7.21.8 Direct input/output functions</a></h4>
17620
17621 <p><small><a href="#Contents">Contents</a></small>
17622 <h5><a name="7.21.8.1" href="#7.21.8.1">7.21.8.1 The fread function</a></h5>
17623 <p><b>Synopsis</b>
17624 <p><a name="7.21.8.1p1" href="#7.21.8.1p1"><small>1</small></a>
17625 <pre>
17626          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17627          size_t fread(void * restrict ptr,
17628               size_t size, size_t nmemb,
17629               FILE * restrict stream);
17630 </pre>
17631 <p><b>Description</b>
17632 <p><a name="7.21.8.1p2" href="#7.21.8.1p2"><small>2</small></a>
17633  The fread function reads, into the array pointed to by ptr, up to nmemb elements
17634  whose size is specified by size, from the stream pointed to by stream. For each
17635  object, size calls are made to the fgetc function and the results stored, in the order
17636  read, in an array of unsigned char exactly overlaying the object. The file position
17637  indicator for the stream (if defined) is advanced by the number of characters successfully
17638  read. If an error occurs, the resulting value of the file position indicator for the stream is
17639  indeterminate. If a partial element is read, its value is indeterminate.
17640 <p><b>Returns</b>
17641 <p><a name="7.21.8.1p3" href="#7.21.8.1p3"><small>3</small></a>
17642  The fread function returns the number of elements successfully read, which may be
17643  less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
17644  fread returns zero and the contents of the array and the state of the stream remain
17645  unchanged.
17646
17647 <p><small><a href="#Contents">Contents</a></small>
17648 <h5><a name="7.21.8.2" href="#7.21.8.2">7.21.8.2 The fwrite function</a></h5>
17649 <p><b>Synopsis</b>
17650 <p><a name="7.21.8.2p1" href="#7.21.8.2p1"><small>1</small></a>
17651 <pre>
17652          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17653          size_t fwrite(const void * restrict ptr,
17654               size_t size, size_t nmemb,
17655               FILE * restrict stream);
17656 </pre>
17657 <p><b>Description</b>
17658 <p><a name="7.21.8.2p2" href="#7.21.8.2p2"><small>2</small></a>
17659  The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
17660  whose size is specified by size, to the stream pointed to by stream. For each object,
17661  size calls are made to the fputc function, taking the values (in order) from an array of
17662  unsigned char exactly overlaying the object. The file position indicator for the
17663  stream (if defined) is advanced by the number of characters successfully written. If an
17664  error occurs, the resulting value of the file position indicator for the stream is
17665  indeterminate.
17666 <!--page 354 -->
17667 <p><b>Returns</b>
17668 <p><a name="7.21.8.2p3" href="#7.21.8.2p3"><small>3</small></a>
17669  The fwrite function returns the number of elements successfully written, which will be
17670  less than nmemb only if a write error is encountered. If size or nmemb is zero,
17671  fwrite returns zero and the state of the stream remains unchanged.
17672
17673 <p><small><a href="#Contents">Contents</a></small>
17674 <h4><a name="7.21.9" href="#7.21.9">7.21.9 File positioning functions</a></h4>
17675
17676 <p><small><a href="#Contents">Contents</a></small>
17677 <h5><a name="7.21.9.1" href="#7.21.9.1">7.21.9.1 The fgetpos function</a></h5>
17678 <p><b>Synopsis</b>
17679 <p><a name="7.21.9.1p1" href="#7.21.9.1p1"><small>1</small></a>
17680 <pre>
17681         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17682         int fgetpos(FILE * restrict stream,
17683              fpos_t * restrict pos);
17684 </pre>
17685 <p><b>Description</b>
17686 <p><a name="7.21.9.1p2" href="#7.21.9.1p2"><small>2</small></a>
17687  The fgetpos function stores the current values of the parse state (if any) and file
17688  position indicator for the stream pointed to by stream in the object pointed to by pos.
17689  The values stored contain unspecified information usable by the fsetpos function for
17690  repositioning the stream to its position at the time of the call to the fgetpos function.
17691 <p><b>Returns</b>
17692 <p><a name="7.21.9.1p3" href="#7.21.9.1p3"><small>3</small></a>
17693  If successful, the fgetpos function returns zero; on failure, the fgetpos function
17694  returns nonzero and stores an implementation-defined positive value in errno.
17695 <p><b> Forward references</b>: the fsetpos function (<a href="#7.21.9.3">7.21.9.3</a>).
17696
17697 <p><small><a href="#Contents">Contents</a></small>
17698 <h5><a name="7.21.9.2" href="#7.21.9.2">7.21.9.2 The fseek function</a></h5>
17699 <p><b>Synopsis</b>
17700 <p><a name="7.21.9.2p1" href="#7.21.9.2p1"><small>1</small></a>
17701 <pre>
17702         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17703         int fseek(FILE *stream, long int offset, int whence);
17704 </pre>
17705 <p><b>Description</b>
17706 <p><a name="7.21.9.2p2" href="#7.21.9.2p2"><small>2</small></a>
17707  The fseek function sets the file position indicator for the stream pointed to by stream.
17708  If a read or write error occurs, the error indicator for the stream is set and fseek fails.
17709 <p><a name="7.21.9.2p3" href="#7.21.9.2p3"><small>3</small></a>
17710  For a binary stream, the new position, measured in characters from the beginning of the
17711  file, is obtained by adding offset to the position specified by whence. The specified
17712  position is the beginning of the file if whence is SEEK_SET, the current value of the file
17713  position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
17714  meaningfully support fseek calls with a whence value of SEEK_END.
17715 <p><a name="7.21.9.2p4" href="#7.21.9.2p4"><small>4</small></a>
17716  For a text stream, either offset shall be zero, or offset shall be a value returned by
17717  an earlier successful call to the ftell function on a stream associated with the same file
17718  and whence shall be SEEK_SET.
17719 <!--page 355 -->
17720 <p><a name="7.21.9.2p5" href="#7.21.9.2p5"><small>5</small></a>
17721  After determining the new position, a successful call to the fseek function undoes any
17722  effects of the ungetc function on the stream, clears the end-of-file indicator for the
17723  stream, and then establishes the new position. After a successful fseek call, the next
17724  operation on an update stream may be either input or output.
17725 <p><b>Returns</b>
17726 <p><a name="7.21.9.2p6" href="#7.21.9.2p6"><small>6</small></a>
17727  The fseek function returns nonzero only for a request that cannot be satisfied.
17728 <p><b> Forward references</b>: the ftell function (<a href="#7.21.9.4">7.21.9.4</a>).
17729
17730 <p><small><a href="#Contents">Contents</a></small>
17731 <h5><a name="7.21.9.3" href="#7.21.9.3">7.21.9.3 The fsetpos function</a></h5>
17732 <p><b>Synopsis</b>
17733 <p><a name="7.21.9.3p1" href="#7.21.9.3p1"><small>1</small></a>
17734 <pre>
17735          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17736          int fsetpos(FILE *stream, const fpos_t *pos);
17737 </pre>
17738 <p><b>Description</b>
17739 <p><a name="7.21.9.3p2" href="#7.21.9.3p2"><small>2</small></a>
17740  The fsetpos function sets the mbstate_t object (if any) and file position indicator
17741  for the stream pointed to by stream according to the value of the object pointed to by
17742  pos, which shall be a value obtained from an earlier successful call to the fgetpos
17743  function on a stream associated with the same file. If a read or write error occurs, the
17744  error indicator for the stream is set and fsetpos fails.
17745 <p><a name="7.21.9.3p3" href="#7.21.9.3p3"><small>3</small></a>
17746  A successful call to the fsetpos function undoes any effects of the ungetc function
17747  on the stream, clears the end-of-file indicator for the stream, and then establishes the new
17748  parse state and position. After a successful fsetpos call, the next operation on an
17749  update stream may be either input or output.
17750 <p><b>Returns</b>
17751 <p><a name="7.21.9.3p4" href="#7.21.9.3p4"><small>4</small></a>
17752  If successful, the fsetpos function returns zero; on failure, the fsetpos function
17753  returns nonzero and stores an implementation-defined positive value in errno.
17754
17755 <p><small><a href="#Contents">Contents</a></small>
17756 <h5><a name="7.21.9.4" href="#7.21.9.4">7.21.9.4 The ftell function</a></h5>
17757 <p><b>Synopsis</b>
17758 <p><a name="7.21.9.4p1" href="#7.21.9.4p1"><small>1</small></a>
17759 <pre>
17760          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17761          long int ftell(FILE *stream);
17762 </pre>
17763 <p><b>Description</b>
17764 <p><a name="7.21.9.4p2" href="#7.21.9.4p2"><small>2</small></a>
17765  The ftell function obtains the current value of the file position indicator for the stream
17766  pointed to by stream. For a binary stream, the value is the number of characters from
17767  the beginning of the file. For a text stream, its file position indicator contains unspecified
17768  information, usable by the fseek function for returning the file position indicator for the
17769  stream to its position at the time of the ftell call; the difference between two such
17770  return values is not necessarily a meaningful measure of the number of characters written
17771 <!--page 356 -->
17772  or read.
17773 <p><b>Returns</b>
17774 <p><a name="7.21.9.4p3" href="#7.21.9.4p3"><small>3</small></a>
17775  If successful, the ftell function returns the current value of the file position indicator
17776  for the stream. On failure, the ftell function returns -1L and stores an
17777  implementation-defined positive value in errno.
17778
17779 <p><small><a href="#Contents">Contents</a></small>
17780 <h5><a name="7.21.9.5" href="#7.21.9.5">7.21.9.5 The rewind function</a></h5>
17781 <p><b>Synopsis</b>
17782 <p><a name="7.21.9.5p1" href="#7.21.9.5p1"><small>1</small></a>
17783 <pre>
17784         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17785         void rewind(FILE *stream);
17786 </pre>
17787 <p><b>Description</b>
17788 <p><a name="7.21.9.5p2" href="#7.21.9.5p2"><small>2</small></a>
17789  The rewind function sets the file position indicator for the stream pointed to by
17790  stream to the beginning of the file. It is equivalent to
17791 <pre>
17792         (void)fseek(stream, 0L, SEEK_SET)
17793 </pre>
17794  except that the error indicator for the stream is also cleared.
17795 <p><b>Returns</b>
17796 <p><a name="7.21.9.5p3" href="#7.21.9.5p3"><small>3</small></a>
17797  The rewind function returns no value.
17798
17799 <p><small><a href="#Contents">Contents</a></small>
17800 <h4><a name="7.21.10" href="#7.21.10">7.21.10 Error-handling functions</a></h4>
17801
17802 <p><small><a href="#Contents">Contents</a></small>
17803 <h5><a name="7.21.10.1" href="#7.21.10.1">7.21.10.1 The clearerr function</a></h5>
17804 <p><b>Synopsis</b>
17805 <p><a name="7.21.10.1p1" href="#7.21.10.1p1"><small>1</small></a>
17806 <pre>
17807         #include <a href="#7.21">&lt;stdio.h&gt;</a>
17808         void clearerr(FILE *stream);
17809 </pre>
17810 <p><b>Description</b>
17811 <p><a name="7.21.10.1p2" href="#7.21.10.1p2"><small>2</small></a>
17812  The clearerr function clears the end-of-file and error indicators for the stream pointed
17813  to by stream.
17814 <p><b>Returns</b>
17815 <p><a name="7.21.10.1p3" href="#7.21.10.1p3"><small>3</small></a>
17816  The clearerr function returns no value.
17817 <!--page 357 -->
17818
17819 <p><small><a href="#Contents">Contents</a></small>
17820 <h5><a name="7.21.10.2" href="#7.21.10.2">7.21.10.2 The feof function</a></h5>
17821 <p><b>Synopsis</b>
17822 <p><a name="7.21.10.2p1" href="#7.21.10.2p1"><small>1</small></a>
17823 <pre>
17824          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17825          int feof(FILE *stream);
17826 </pre>
17827 <p><b>Description</b>
17828 <p><a name="7.21.10.2p2" href="#7.21.10.2p2"><small>2</small></a>
17829  The feof function tests the end-of-file indicator for the stream pointed to by stream.
17830 <p><b>Returns</b>
17831 <p><a name="7.21.10.2p3" href="#7.21.10.2p3"><small>3</small></a>
17832  The feof function returns nonzero if and only if the end-of-file indicator is set for
17833  stream.
17834
17835 <p><small><a href="#Contents">Contents</a></small>
17836 <h5><a name="7.21.10.3" href="#7.21.10.3">7.21.10.3 The ferror function</a></h5>
17837 <p><b>Synopsis</b>
17838 <p><a name="7.21.10.3p1" href="#7.21.10.3p1"><small>1</small></a>
17839 <pre>
17840          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17841          int ferror(FILE *stream);
17842 </pre>
17843 <p><b>Description</b>
17844 <p><a name="7.21.10.3p2" href="#7.21.10.3p2"><small>2</small></a>
17845  The ferror function tests the error indicator for the stream pointed to by stream.
17846 <p><b>Returns</b>
17847 <p><a name="7.21.10.3p3" href="#7.21.10.3p3"><small>3</small></a>
17848  The ferror function returns nonzero if and only if the error indicator is set for
17849  stream.
17850
17851 <p><small><a href="#Contents">Contents</a></small>
17852 <h5><a name="7.21.10.4" href="#7.21.10.4">7.21.10.4 The perror function</a></h5>
17853 <p><b>Synopsis</b>
17854 <p><a name="7.21.10.4p1" href="#7.21.10.4p1"><small>1</small></a>
17855 <pre>
17856          #include <a href="#7.21">&lt;stdio.h&gt;</a>
17857          void perror(const char *s);
17858 </pre>
17859 <p><b>Description</b>
17860 <p><a name="7.21.10.4p2" href="#7.21.10.4p2"><small>2</small></a>
17861  The perror function maps the error number in the integer expression errno to an
17862  error message. It writes a sequence of characters to the standard error stream thus: first
17863  (if s is not a null pointer and the character pointed to by s is not the null character), the
17864  string pointed to by s followed by a colon (:) and a space; then an appropriate error
17865  message string followed by a new-line character. The contents of the error message
17866  strings are the same as those returned by the strerror function with argument errno.
17867 <p><b>Returns</b>
17868 <p><a name="7.21.10.4p3" href="#7.21.10.4p3"><small>3</small></a>
17869  The perror function returns no value.
17870 <p><b> Forward references</b>: the strerror function (<a href="#7.24.6.2">7.24.6.2</a>).
17871 <!--page 358 -->
17872
17873 <p><small><a href="#Contents">Contents</a></small>
17874 <h3><a name="7.22" href="#7.22">7.22 General utilities &lt;stdlib.h&gt;</a></h3>
17875 <p><a name="7.22p1" href="#7.22p1"><small>1</small></a>
17876  The header <a href="#7.22">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
17877  defines several macros.<sup><a href="#note291"><b>291)</b></a></sup>
17878 <p><a name="7.22p2" href="#7.22p2"><small>2</small></a>
17879  The types declared are size_t and wchar_t (both described in <a href="#7.19">7.19</a>),
17880 <pre>
17881           div_t
17882 </pre>
17883  which is a structure type that is the type of the value returned by the div function,
17884 <pre>
17885           ldiv_t
17886 </pre>
17887  which is a structure type that is the type of the value returned by the ldiv function, and
17888 <pre>
17889           lldiv_t
17890 </pre>
17891  which is a structure type that is the type of the value returned by the lldiv function.
17892 <p><a name="7.22p3" href="#7.22p3"><small>3</small></a>
17893  The macros defined are NULL (described in <a href="#7.19">7.19</a>);
17894 <pre>
17895           EXIT_FAILURE
17896 </pre>
17897  and
17898 <pre>
17899           EXIT_SUCCESS
17900 </pre>
17901  which expand to integer constant expressions that can be used as the argument to the
17902  exit function to return unsuccessful or successful termination status, respectively, to the
17903  host environment;
17904 <pre>
17905           RAND_MAX
17906 </pre>
17907  which expands to an integer constant expression that is the maximum value returned by
17908  the rand function; and
17909 <pre>
17910           MB_CUR_MAX
17911 </pre>
17912  which expands to a positive integer expression with type size_t that is the maximum
17913  number of bytes in a multibyte character for the extended character set specified by the
17914  current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
17915  
17916  
17917  
17918  
17919 <!--page 359 -->
17920
17921 <p><b>Footnotes</b>
17922 <p><small><a name="note291" href="#note291">291)</a> See ''future library directions'' (<a href="#7.31.12">7.31.12</a>).
17923 </small>
17924
17925 <p><small><a href="#Contents">Contents</a></small>
17926 <h4><a name="7.22.1" href="#7.22.1">7.22.1 Numeric conversion functions</a></h4>
17927 <p><a name="7.22.1p1" href="#7.22.1p1"><small>1</small></a>
17928  The functions atof, atoi, atol, and atoll need not affect the value of the integer
17929  expression errno on an error. If the value of the result cannot be represented, the
17930  behavior is undefined.
17931
17932 <p><small><a href="#Contents">Contents</a></small>
17933 <h5><a name="7.22.1.1" href="#7.22.1.1">7.22.1.1 The atof function</a></h5>
17934 <p><b>Synopsis</b>
17935 <p><a name="7.22.1.1p1" href="#7.22.1.1p1"><small>1</small></a>
17936 <pre>
17937          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17938          double atof(const char *nptr);
17939 </pre>
17940 <p><b>Description</b>
17941 <p><a name="7.22.1.1p2" href="#7.22.1.1p2"><small>2</small></a>
17942  The atof function converts the initial portion of the string pointed to by nptr to
17943  double representation. Except for the behavior on error, it is equivalent to
17944 <pre>
17945          strtod(nptr, (char **)NULL)
17946 </pre>
17947 <p><b>Returns</b>
17948 <p><a name="7.22.1.1p3" href="#7.22.1.1p3"><small>3</small></a>
17949  The atof function returns the converted value.
17950 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>).
17951
17952 <p><small><a href="#Contents">Contents</a></small>
17953 <h5><a name="7.22.1.2" href="#7.22.1.2">7.22.1.2 The atoi, atol, and atoll functions</a></h5>
17954 <p><b>Synopsis</b>
17955 <p><a name="7.22.1.2p1" href="#7.22.1.2p1"><small>1</small></a>
17956 <pre>
17957          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17958          int atoi(const char *nptr);
17959          long int atol(const char *nptr);
17960          long long int atoll(const char *nptr);
17961 </pre>
17962 <p><b>Description</b>
17963 <p><a name="7.22.1.2p2" href="#7.22.1.2p2"><small>2</small></a>
17964  The atoi, atol, and atoll functions convert the initial portion of the string pointed
17965  to by nptr to int, long int, and long long int representation, respectively.
17966  Except for the behavior on error, they are equivalent to
17967 <pre>
17968          atoi: (int)strtol(nptr, (char **)NULL, 10)
17969          atol: strtol(nptr, (char **)NULL, 10)
17970          atoll: strtoll(nptr, (char **)NULL, 10)
17971 </pre>
17972 <p><b>Returns</b>
17973 <p><a name="7.22.1.2p3" href="#7.22.1.2p3"><small>3</small></a>
17974  The atoi, atol, and atoll functions return the converted value.
17975 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
17976  (<a href="#7.22.1.4">7.22.1.4</a>).
17977 <!--page 360 -->
17978
17979 <p><small><a href="#Contents">Contents</a></small>
17980 <h5><a name="7.22.1.3" href="#7.22.1.3">7.22.1.3 The strtod, strtof, and strtold functions</a></h5>
17981 <p><b>Synopsis</b>
17982 <p><a name="7.22.1.3p1" href="#7.22.1.3p1"><small>1</small></a>
17983 <pre>
17984         #include <a href="#7.22">&lt;stdlib.h&gt;</a>
17985         double strtod(const char * restrict nptr,
17986              char ** restrict endptr);
17987         float strtof(const char * restrict nptr,
17988              char ** restrict endptr);
17989         long double strtold(const char * restrict nptr,
17990              char ** restrict endptr);
17991 </pre>
17992 <p><b>Description</b>
17993 <p><a name="7.22.1.3p2" href="#7.22.1.3p2"><small>2</small></a>
17994  The strtod, strtof, and strtold functions convert the initial portion of the string
17995  pointed to by nptr to double, float, and long double representation,
17996  respectively. First, they decompose the input string into three parts: an initial, possibly
17997  empty, sequence of white-space characters (as specified by the isspace function), a
17998  subject sequence resembling a floating-point constant or representing an infinity or NaN;
17999  and a final string of one or more unrecognized characters, including the terminating null
18000  character of the input string. Then, they attempt to convert the subject sequence to a
18001  floating-point number, and return the result.
18002 <p><a name="7.22.1.3p3" href="#7.22.1.3p3"><small>3</small></a>
18003  The expected form of the subject sequence is an optional plus or minus sign, then one of
18004  the following:
18005 <ul>
18006 <li>  a nonempty sequence of decimal digits optionally containing a decimal-point
18007  character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
18008 <li>  a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
18009  decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
18010 <li>  INF or INFINITY, ignoring case
18011 <li>  NAN or NAN(n-char-sequence<sub>opt</sub>), ignoring case in the NAN part, where:
18012 <pre>
18013           n-char-sequence:
18014                  digit
18015                  nondigit
18016                  n-char-sequence digit
18017                  n-char-sequence nondigit
18018 </pre>
18019 </ul>
18020  The subject sequence is defined as the longest initial subsequence of the input string,
18021  starting with the first non-white-space character, that is of the expected form. The subject
18022  sequence contains no characters if the input string is not of the expected form.
18023 <p><a name="7.22.1.3p4" href="#7.22.1.3p4"><small>4</small></a>
18024  If the subject sequence has the expected form for a floating-point number, the sequence of
18025  characters starting with the first digit or the decimal-point character (whichever occurs
18026  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
18027 <!--page 361 -->
18028  decimal-point character is used in place of a period, and that if neither an exponent part
18029  nor a decimal-point character appears in a decimal floating point number, or if a binary
18030  exponent part does not appear in a hexadecimal floating point number, an exponent part
18031  of the appropriate type with value zero is assumed to follow the last digit in the string. If
18032  the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note292"><b>292)</b></a></sup>
18033  A character sequence INF or INFINITY is interpreted as an infinity, if representable in
18034  the return type, else like a floating constant that is too large for the range of the return
18035  type. A character sequence NAN or NAN(n-char-sequence<sub>opt</sub>) is interpreted as a quiet
18036  NaN, if supported in the return type, else like a subject sequence part that does not have
18037  the expected form; the meaning of the n-char sequence is implementation-defined.<sup><a href="#note293"><b>293)</b></a></sup> A
18038  pointer to the final string is stored in the object pointed to by endptr, provided that
18039  endptr is not a null pointer.
18040 <p><a name="7.22.1.3p5" href="#7.22.1.3p5"><small>5</small></a>
18041  If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
18042  value resulting from the conversion is correctly rounded.
18043 <p><a name="7.22.1.3p6" href="#7.22.1.3p6"><small>6</small></a>
18044  In other than the "C" locale, additional locale-specific subject sequence forms may be
18045  accepted.
18046 <p><a name="7.22.1.3p7" href="#7.22.1.3p7"><small>7</small></a>
18047  If the subject sequence is empty or does not have the expected form, no conversion is
18048  performed; the value of nptr is stored in the object pointed to by endptr, provided
18049  that endptr is not a null pointer.
18050 <p><b>Recommended practice</b>
18051 <p><a name="7.22.1.3p8" href="#7.22.1.3p8"><small>8</small></a>
18052  If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
18053  the result is not exactly representable, the result should be one of the two numbers in the
18054  appropriate internal format that are adjacent to the hexadecimal floating source value,
18055  with the extra stipulation that the error should have a correct sign for the current rounding
18056  direction.
18057 <p><a name="7.22.1.3p9" href="#7.22.1.3p9"><small>9</small></a>
18058  If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
18059  <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
18060  sequence D has the decimal form and more than DECIMAL_DIG significant digits,
18061  consider the two bounding, adjacent decimal strings L and U, both having
18062  DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
18063  The result should be one of the (equal or adjacent) values that would be obtained by
18064  correctly rounding L and U according to the current rounding direction, with the extra
18065  
18066 <!--page 362 -->
18067  stipulation that the error with respect to D should have a correct sign for the current
18068  rounding direction.<sup><a href="#note294"><b>294)</b></a></sup>
18069 <p><b>Returns</b>
18070 <p><a name="7.22.1.3p10" href="#7.22.1.3p10"><small>10</small></a>
18071  The functions return the converted value, if any. If no conversion could be performed,
18072  zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
18073  plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the
18074  return type and sign of the value), and the value of the macro ERANGE is stored in
18075  errno. If the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is
18076  no greater than the smallest normalized positive number in the return type; whether
18077  errno acquires the value ERANGE is implementation-defined.
18078
18079 <p><b>Footnotes</b>
18080 <p><small><a name="note292" href="#note292">292)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
18081  negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
18082  methods may yield different results if rounding is toward positive or negative infinity. In either case,
18083  the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
18084 </small>
18085 <p><small><a name="note293" href="#note293">293)</a> An implementation may use the n-char sequence to determine extra information to be represented in
18086  the NaN's significand.
18087 </small>
18088 <p><small><a name="note294" href="#note294">294)</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
18089  to the same internal floating value, but if not will round to adjacent values.
18090 </small>
18091
18092 <p><small><a href="#Contents">Contents</a></small>
18093 <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>
18094 <p><b>Synopsis</b>
18095 <p><a name="7.22.1.4p1" href="#7.22.1.4p1"><small>1</small></a>
18096 <pre>
18097          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18098          long int strtol(
18099               const char * restrict nptr,
18100               char ** restrict endptr,
18101               int base);
18102          long long int strtoll(
18103               const char * restrict nptr,
18104               char ** restrict endptr,
18105               int base);
18106          unsigned long int strtoul(
18107               const char * restrict nptr,
18108               char ** restrict endptr,
18109               int base);
18110          unsigned long long int strtoull(
18111               const char * restrict nptr,
18112               char ** restrict endptr,
18113               int base);
18114 </pre>
18115 <p><b>Description</b>
18116 <p><a name="7.22.1.4p2" href="#7.22.1.4p2"><small>2</small></a>
18117  The strtol, strtoll, strtoul, and strtoull functions convert the initial
18118  portion of the string pointed to by nptr to long int, long long int, unsigned
18119  long int, and unsigned long long int representation, respectively. First,
18120  they decompose the input string into three parts: an initial, possibly empty, sequence of
18121  white-space characters (as specified by the isspace function), a subject sequence
18122  
18123  
18124 <!--page 363 -->
18125  resembling an integer represented in some radix determined by the value of base, and a
18126  final string of one or more unrecognized characters, including the terminating null
18127  character of the input string. Then, they attempt to convert the subject sequence to an
18128  integer, and return the result.
18129 <p><a name="7.22.1.4p3" href="#7.22.1.4p3"><small>3</small></a>
18130  If the value of base is zero, the expected form of the subject sequence is that of an
18131  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
18132  not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
18133  expected form of the subject sequence is a sequence of letters and digits representing an
18134  integer with the radix specified by base, optionally preceded by a plus or minus sign,
18135  but not including an integer suffix. The letters from a (or A) through z (or Z) are
18136  ascribed the values 10 through 35; only letters and digits whose ascribed values are less
18137  than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
18138  optionally precede the sequence of letters and digits, following the sign if present.
18139 <p><a name="7.22.1.4p4" href="#7.22.1.4p4"><small>4</small></a>
18140  The subject sequence is defined as the longest initial subsequence of the input string,
18141  starting with the first non-white-space character, that is of the expected form. The subject
18142  sequence contains no characters if the input string is empty or consists entirely of white
18143  space, or if the first non-white-space character is other than a sign or a permissible letter
18144  or digit.
18145 <p><a name="7.22.1.4p5" href="#7.22.1.4p5"><small>5</small></a>
18146  If the subject sequence has the expected form and the value of base is zero, the sequence
18147  of characters starting with the first digit is interpreted as an integer constant according to
18148  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
18149  is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
18150  as given above. If the subject sequence begins with a minus sign, the value resulting from
18151  the conversion is negated (in the return type). A pointer to the final string is stored in the
18152  object pointed to by endptr, provided that endptr is not a null pointer.
18153 <p><a name="7.22.1.4p6" href="#7.22.1.4p6"><small>6</small></a>
18154  In other than the "C" locale, additional locale-specific subject sequence forms may be
18155  accepted.
18156 <p><a name="7.22.1.4p7" href="#7.22.1.4p7"><small>7</small></a>
18157  If the subject sequence is empty or does not have the expected form, no conversion is
18158  performed; the value of nptr is stored in the object pointed to by endptr, provided
18159  that endptr is not a null pointer.
18160 <p><b>Returns</b>
18161 <p><a name="7.22.1.4p8" href="#7.22.1.4p8"><small>8</small></a>
18162  The strtol, strtoll, strtoul, and strtoull functions return the converted
18163  value, if any. If no conversion could be performed, zero is returned. If the correct value
18164  is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
18165  LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
18166  and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
18167 <!--page 364 -->
18168
18169 <p><small><a href="#Contents">Contents</a></small>
18170 <h4><a name="7.22.2" href="#7.22.2">7.22.2 Pseudo-random sequence generation functions</a></h4>
18171
18172 <p><small><a href="#Contents">Contents</a></small>
18173 <h5><a name="7.22.2.1" href="#7.22.2.1">7.22.2.1 The rand function</a></h5>
18174 <p><b>Synopsis</b>
18175 <p><a name="7.22.2.1p1" href="#7.22.2.1p1"><small>1</small></a>
18176 <pre>
18177          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18178          int rand(void);
18179 </pre>
18180 <p><b>Description</b>
18181 <p><a name="7.22.2.1p2" href="#7.22.2.1p2"><small>2</small></a>
18182  The rand function computes a sequence of pseudo-random integers in the range 0 to
18183  RAND_MAX.<sup><a href="#note295"><b>295)</b></a></sup>
18184 <p><a name="7.22.2.1p3" href="#7.22.2.1p3"><small>3</small></a>
18185  The rand function is not required to avoid data races with other calls to pseudo-random
18186  sequence generation functions. The implementation shall behave as if no library function
18187  calls the rand function.
18188 <p><b>Returns</b>
18189 <p><a name="7.22.2.1p4" href="#7.22.2.1p4"><small>4</small></a>
18190  The rand function returns a pseudo-random integer.
18191 <p><b>Environmental limits</b>
18192 <p><a name="7.22.2.1p5" href="#7.22.2.1p5"><small>5</small></a>
18193  The value of the RAND_MAX macro shall be at least 32767.
18194
18195 <p><b>Footnotes</b>
18196 <p><small><a name="note295" href="#note295">295)</a> There are no guarantees as to the quality of the random sequence produced and some implementations
18197  are known to produce sequences with distressingly non-random low-order bits. Applications with
18198  particular requirements should use a generator that is known to be sufficient for their needs.
18199 </small>
18200
18201 <p><small><a href="#Contents">Contents</a></small>
18202 <h5><a name="7.22.2.2" href="#7.22.2.2">7.22.2.2 The srand function</a></h5>
18203 <p><b>Synopsis</b>
18204 <p><a name="7.22.2.2p1" href="#7.22.2.2p1"><small>1</small></a>
18205 <pre>
18206          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18207          void srand(unsigned int seed);
18208 </pre>
18209 <p><b>Description</b>
18210 <p><a name="7.22.2.2p2" href="#7.22.2.2p2"><small>2</small></a>
18211  The srand function uses the argument as a seed for a new sequence of pseudo-random
18212  numbers to be returned by subsequent calls to rand. If srand is then called with the
18213  same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
18214  called before any calls to srand have been made, the same sequence shall be generated
18215  as when srand is first called with a seed value of 1.
18216 <p><a name="7.22.2.2p3" href="#7.22.2.2p3"><small>3</small></a>
18217  The srand function is not required to avoid data races with other calls to pseudo-
18218  random sequence generation functions. The implementation shall behave as if no library
18219  function calls the srand function.
18220  
18221  
18222  
18223  
18224 <!--page 365 -->
18225 <p><b>Returns</b>
18226 <p><a name="7.22.2.2p4" href="#7.22.2.2p4"><small>4</small></a>
18227  The srand function returns no value.
18228 <p><a name="7.22.2.2p5" href="#7.22.2.2p5"><small>5</small></a>
18229  EXAMPLE     The following functions define a portable implementation of rand and srand.
18230 <pre>
18231          static unsigned long int next = 1;
18232          int rand(void)   // RAND_MAX assumed to be 32767
18233          {
18234                next = next * 1103515245 + 12345;
18235                return (unsigned int)(next/65536) % 32768;
18236          }
18237          void srand(unsigned int seed)
18238          {
18239                next = seed;
18240          }
18241 </pre>
18242  
18243
18244 <p><small><a href="#Contents">Contents</a></small>
18245 <h4><a name="7.22.3" href="#7.22.3">7.22.3 Memory management functions</a></h4>
18246 <p><a name="7.22.3p1" href="#7.22.3p1"><small>1</small></a>
18247  The order and contiguity of storage allocated by successive calls to the
18248  aligned_alloc, calloc, malloc, and realloc functions is unspecified. The
18249  pointer returned if the allocation succeeds is suitably aligned so that it may be assigned to
18250  a pointer to any type of object with a fundamental alignment requirement and then used
18251  to access such an object or an array of such objects in the space allocated (until the space
18252  is explicitly deallocated). The lifetime of an allocated object extends from the allocation
18253  until the deallocation. Each such allocation shall yield a pointer to an object disjoint from
18254  any other object. The pointer returned points to the start (lowest byte address) of the
18255  allocated space. If the space cannot be allocated, a null pointer is returned. If the size of
18256  the space requested is zero, the behavior is implementation-defined: either a null pointer
18257  is returned, or the behavior is as if the size were some nonzero value, except that the
18258  returned pointer shall not be used to access an object.
18259 <p><a name="7.22.3p2" href="#7.22.3p2"><small>2</small></a>
18260  For purposes of determining the existence of a data race, memory allocation functions
18261  behave as though they accessed only memory locations accessible through their
18262  arguments and not other static duration storage. These functions may, however, visibly
18263  modify the storage that they allocate or deallocate. A call to free or realloc that
18264  deallocates a region p of memory synchronizes with any allocation call that allocates all
18265  or part of the region p. This synchronization occurs after any access of p by the
18266  deallocating function, and before any such access by the allocating function.
18267
18268 <p><small><a href="#Contents">Contents</a></small>
18269 <h5><a name="7.22.3.1" href="#7.22.3.1">7.22.3.1 The aligned_alloc function</a></h5>
18270 <p><b>Synopsis</b>
18271 <p><a name="7.22.3.1p1" href="#7.22.3.1p1"><small>1</small></a>
18272 <!--page 366 -->
18273 <pre>
18274          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18275          void *aligned_alloc(size_t alignment, size_t size);
18276 </pre>
18277 <p><b>Description</b>
18278 <p><a name="7.22.3.1p2" href="#7.22.3.1p2"><small>2</small></a>
18279  The aligned_alloc function allocates space for an object whose alignment is
18280  specified by alignment, whose size is specified by size, and whose value is
18281  indeterminate. The value of alignment shall be a valid alignment supported by the
18282  implementation and the value of size shall be an integral multiple of alignment.
18283 <p><b>Returns</b>
18284 <p><a name="7.22.3.1p3" href="#7.22.3.1p3"><small>3</small></a>
18285  The aligned_alloc function returns either a null pointer or a pointer to the allocated
18286  space.
18287
18288 <p><small><a href="#Contents">Contents</a></small>
18289 <h5><a name="7.22.3.2" href="#7.22.3.2">7.22.3.2 The calloc function</a></h5>
18290 <p><b>Synopsis</b>
18291 <p><a name="7.22.3.2p1" href="#7.22.3.2p1"><small>1</small></a>
18292 <pre>
18293          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18294          void *calloc(size_t nmemb, size_t size);
18295 </pre>
18296 <p><b>Description</b>
18297 <p><a name="7.22.3.2p2" href="#7.22.3.2p2"><small>2</small></a>
18298  The calloc function allocates space for an array of nmemb objects, each of whose size
18299  is size. The space is initialized to all bits zero.<sup><a href="#note296"><b>296)</b></a></sup>
18300 <p><b>Returns</b>
18301 <p><a name="7.22.3.2p3" href="#7.22.3.2p3"><small>3</small></a>
18302  The calloc function returns either a null pointer or a pointer to the allocated space.
18303
18304 <p><b>Footnotes</b>
18305 <p><small><a name="note296" href="#note296">296)</a> Note that this need not be the same as the representation of floating-point zero or a null pointer
18306  constant.
18307 </small>
18308
18309 <p><small><a href="#Contents">Contents</a></small>
18310 <h5><a name="7.22.3.3" href="#7.22.3.3">7.22.3.3 The free function</a></h5>
18311 <p><b>Synopsis</b>
18312 <p><a name="7.22.3.3p1" href="#7.22.3.3p1"><small>1</small></a>
18313 <pre>
18314          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18315          void free(void *ptr);
18316 </pre>
18317 <p><b>Description</b>
18318 <p><a name="7.22.3.3p2" href="#7.22.3.3p2"><small>2</small></a>
18319  The free function causes the space pointed to by ptr to be deallocated, that is, made
18320  available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
18321  the argument does not match a pointer earlier returned by a memory management
18322  function, or if the space has been deallocated by a call to free or realloc, the
18323  behavior is undefined.
18324 <p><b>Returns</b>
18325 <p><a name="7.22.3.3p3" href="#7.22.3.3p3"><small>3</small></a>
18326  The free function returns no value.
18327  
18328  
18329  
18330  
18331 <!--page 367 -->
18332
18333 <p><small><a href="#Contents">Contents</a></small>
18334 <h5><a name="7.22.3.4" href="#7.22.3.4">7.22.3.4 The malloc function</a></h5>
18335 <p><b>Synopsis</b>
18336 <p><a name="7.22.3.4p1" href="#7.22.3.4p1"><small>1</small></a>
18337 <pre>
18338          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18339          void *malloc(size_t size);
18340 </pre>
18341 <p><b>Description</b>
18342 <p><a name="7.22.3.4p2" href="#7.22.3.4p2"><small>2</small></a>
18343  The malloc function allocates space for an object whose size is specified by size and
18344  whose value is indeterminate.
18345 <p><b>Returns</b>
18346 <p><a name="7.22.3.4p3" href="#7.22.3.4p3"><small>3</small></a>
18347  The malloc function returns either a null pointer or a pointer to the allocated space.
18348
18349 <p><small><a href="#Contents">Contents</a></small>
18350 <h5><a name="7.22.3.5" href="#7.22.3.5">7.22.3.5 The realloc function</a></h5>
18351 <p><b>Synopsis</b>
18352 <p><a name="7.22.3.5p1" href="#7.22.3.5p1"><small>1</small></a>
18353 <pre>
18354          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18355          void *realloc(void *ptr, size_t size);
18356 </pre>
18357 <p><b>Description</b>
18358 <p><a name="7.22.3.5p2" href="#7.22.3.5p2"><small>2</small></a>
18359  The realloc function deallocates the old object pointed to by ptr and returns a
18360  pointer to a new object that has the size specified by size. The contents of the new
18361  object shall be the same as that of the old object prior to deallocation, up to the lesser of
18362  the new and old sizes. Any bytes in the new object beyond the size of the old object have
18363  indeterminate values.
18364 <p><a name="7.22.3.5p3" href="#7.22.3.5p3"><small>3</small></a>
18365  If ptr is a null pointer, the realloc function behaves like the malloc function for the
18366  specified size. Otherwise, if ptr does not match a pointer earlier returned by a memory
18367  management function, or if the space has been deallocated by a call to the free or
18368  realloc function, the behavior is undefined. If memory for the new object cannot be
18369  allocated, the old object is not deallocated and its value is unchanged.
18370 <p><b>Returns</b>
18371 <p><a name="7.22.3.5p4" href="#7.22.3.5p4"><small>4</small></a>
18372  The realloc function returns a pointer to the new object (which may have the same
18373  value as a pointer to the old object), or a null pointer if the new object could not be
18374  allocated.
18375 <!--page 368 -->
18376
18377 <p><small><a href="#Contents">Contents</a></small>
18378 <h4><a name="7.22.4" href="#7.22.4">7.22.4 Communication with the environment</a></h4>
18379
18380 <p><small><a href="#Contents">Contents</a></small>
18381 <h5><a name="7.22.4.1" href="#7.22.4.1">7.22.4.1 The abort function</a></h5>
18382 <p><b>Synopsis</b>
18383 <p><a name="7.22.4.1p1" href="#7.22.4.1p1"><small>1</small></a>
18384 <pre>
18385         #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18386         _Noreturn void abort(void);
18387 </pre>
18388 <p><b>Description</b>
18389 <p><a name="7.22.4.1p2" href="#7.22.4.1p2"><small>2</small></a>
18390  The abort function causes abnormal program termination to occur, unless the signal
18391  SIGABRT is being caught and the signal handler does not return. Whether open streams
18392  with unwritten buffered data are flushed, open streams are closed, or temporary files are
18393  removed is implementation-defined. An implementation-defined form of the status
18394  unsuccessful termination is returned to the host environment by means of the function
18395  call raise(SIGABRT).
18396 <p><b>Returns</b>
18397 <p><a name="7.22.4.1p3" href="#7.22.4.1p3"><small>3</small></a>
18398  The abort function does not return to its caller.
18399
18400 <p><small><a href="#Contents">Contents</a></small>
18401 <h5><a name="7.22.4.2" href="#7.22.4.2">7.22.4.2 The atexit function</a></h5>
18402 <p><b>Synopsis</b>
18403 <p><a name="7.22.4.2p1" href="#7.22.4.2p1"><small>1</small></a>
18404 <pre>
18405         #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18406         int atexit(void (*func)(void));
18407 </pre>
18408 <p><b>Description</b>
18409 <p><a name="7.22.4.2p2" href="#7.22.4.2p2"><small>2</small></a>
18410  The atexit function registers the function pointed to by func, to be called without
18411  arguments at normal program termination.<sup><a href="#note297"><b>297)</b></a></sup> It is unspecified whether a call to the
18412  atexit function that does not happen before the exit function is called will succeed.
18413 <p><b>Environmental limits</b>
18414 <p><a name="7.22.4.2p3" href="#7.22.4.2p3"><small>3</small></a>
18415  The implementation shall support the registration of at least 32 functions.
18416 <p><b>Returns</b>
18417 <p><a name="7.22.4.2p4" href="#7.22.4.2p4"><small>4</small></a>
18418  The atexit function returns zero if the registration succeeds, nonzero if it fails.
18419 <p><b> Forward references</b>: the at_quick_exit function (<a href="#7.22.4.3">7.22.4.3</a>), the exit function
18420  (<a href="#7.22.4.4">7.22.4.4</a>).
18421  
18422  
18423  
18424  
18425 <!--page 369 -->
18426
18427 <p><b>Footnotes</b>
18428 <p><small><a name="note297" href="#note297">297)</a> The atexit function registrations are distinct from the at_quick_exit registrations, so
18429  applications may need to call both registration functions with the same argument.
18430 </small>
18431
18432 <p><small><a href="#Contents">Contents</a></small>
18433 <h5><a name="7.22.4.3" href="#7.22.4.3">7.22.4.3 The at_quick_exit function</a></h5>
18434 <p><b>Synopsis</b>
18435 <p><a name="7.22.4.3p1" href="#7.22.4.3p1"><small>1</small></a>
18436 <pre>
18437          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18438          int at_quick_exit(void (*func)(void));
18439 </pre>
18440 <p><b>Description</b>
18441 <p><a name="7.22.4.3p2" href="#7.22.4.3p2"><small>2</small></a>
18442  The at_quick_exit function registers the function pointed to by func, to be called
18443  without arguments should quick_exit be called.<sup><a href="#note298"><b>298)</b></a></sup> It is unspecified whether a call to
18444  the at_quick_exit function that does not happen before the quick_exit function
18445  is called will succeed.
18446 <p><b>Environmental limits</b>
18447 <p><a name="7.22.4.3p3" href="#7.22.4.3p3"><small>3</small></a>
18448  The implementation shall support the registration of at least 32 functions.
18449 <p><b>Returns</b>
18450 <p><a name="7.22.4.3p4" href="#7.22.4.3p4"><small>4</small></a>
18451  The at_quick_exit function returns zero if the registration succeeds, nonzero if it
18452  fails.
18453 <p><b> Forward references</b>: the quick_exit function (<a href="#7.22.4.7">7.22.4.7</a>).
18454
18455 <p><b>Footnotes</b>
18456 <p><small><a name="note298" href="#note298">298)</a> The at_quick_exit function registrations are distinct from the atexit registrations, so
18457  applications may need to call both registration functions with the same argument.
18458 </small>
18459
18460 <p><small><a href="#Contents">Contents</a></small>
18461 <h5><a name="7.22.4.4" href="#7.22.4.4">7.22.4.4 The exit function</a></h5>
18462 <p><b>Synopsis</b>
18463 <p><a name="7.22.4.4p1" href="#7.22.4.4p1"><small>1</small></a>
18464 <pre>
18465          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18466          _Noreturn void exit(int status);
18467 </pre>
18468 <p><b>Description</b>
18469 <p><a name="7.22.4.4p2" href="#7.22.4.4p2"><small>2</small></a>
18470  The exit function causes normal program termination to occur. No functions registered
18471  by the at_quick_exit function are called. If a program calls the exit function
18472  more than once, or calls the quick_exit function in addition to the exit function, the
18473  behavior is undefined.
18474 <p><a name="7.22.4.4p3" href="#7.22.4.4p3"><small>3</small></a>
18475  First, all functions registered by the atexit function are called, in the reverse order of
18476  their registration,<sup><a href="#note299"><b>299)</b></a></sup> except that a function is called after any previously registered
18477  functions that had already been called at the time it was registered. If, during the call to
18478  any such function, a call to the longjmp function is made that would terminate the call
18479  to the registered function, the behavior is undefined.
18480  
18481  
18482  
18483 <!--page 370 -->
18484 <p><a name="7.22.4.4p4" href="#7.22.4.4p4"><small>4</small></a>
18485  Next, all open streams with unwritten buffered data are flushed, all open streams are
18486  closed, and all files created by the tmpfile function are removed.
18487 <p><a name="7.22.4.4p5" href="#7.22.4.4p5"><small>5</small></a>
18488  Finally, control is returned to the host environment. If the value of status is zero or
18489  EXIT_SUCCESS, an implementation-defined form of the status successful termination is
18490  returned. If the value of status is EXIT_FAILURE, an implementation-defined form
18491  of the status unsuccessful termination is returned. Otherwise the status returned is
18492  implementation-defined.
18493 <p><b>Returns</b>
18494 <p><a name="7.22.4.4p6" href="#7.22.4.4p6"><small>6</small></a>
18495  The exit function cannot return to its caller.
18496
18497 <p><b>Footnotes</b>
18498 <p><small><a name="note299" href="#note299">299)</a> Each function is called as many times as it was registered, and in the correct order with respect to
18499  other registered functions.
18500 </small>
18501
18502 <p><small><a href="#Contents">Contents</a></small>
18503 <h5><a name="7.22.4.5" href="#7.22.4.5">7.22.4.5 The _Exit function</a></h5>
18504 <p><b>Synopsis</b>
18505 <p><a name="7.22.4.5p1" href="#7.22.4.5p1"><small>1</small></a>
18506 <pre>
18507          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18508          _Noreturn void _Exit(int status);
18509 </pre>
18510 <p><b>Description</b>
18511 <p><a name="7.22.4.5p2" href="#7.22.4.5p2"><small>2</small></a>
18512  The _Exit function causes normal program termination to occur and control to be
18513  returned to the host environment. No functions registered by the atexit function, the
18514  at_quick_exit function, or signal handlers registered by the signal function are
18515  called. The status returned to the host environment is determined in the same way as for
18516  the exit function (<a href="#7.22.4.4">7.22.4.4</a>). Whether open streams with unwritten buffered data are
18517  flushed, open streams are closed, or temporary files are removed is implementation-
18518  defined.
18519 <p><b>Returns</b>
18520 <p><a name="7.22.4.5p3" href="#7.22.4.5p3"><small>3</small></a>
18521  The _Exit function cannot return to its caller.
18522
18523 <p><small><a href="#Contents">Contents</a></small>
18524 <h5><a name="7.22.4.6" href="#7.22.4.6">7.22.4.6 The getenv function</a></h5>
18525 <p><b>Synopsis</b>
18526 <p><a name="7.22.4.6p1" href="#7.22.4.6p1"><small>1</small></a>
18527 <pre>
18528          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18529          char *getenv(const char *name);
18530 </pre>
18531 <p><b>Description</b>
18532 <p><a name="7.22.4.6p2" href="#7.22.4.6p2"><small>2</small></a>
18533  The getenv function searches an environment list, provided by the host environment,
18534  for a string that matches the string pointed to by name. The set of environment names
18535  and the method for altering the environment list are implementation-defined. The
18536  getenv function need not avoid data races with other threads of execution that modify
18537  the environment list.<sup><a href="#note300"><b>300)</b></a></sup>
18538  
18539 <!--page 371 -->
18540 <p><a name="7.22.4.6p3" href="#7.22.4.6p3"><small>3</small></a>
18541  The implementation shall behave as if no library function calls the getenv function.
18542 <p><b>Returns</b>
18543 <p><a name="7.22.4.6p4" href="#7.22.4.6p4"><small>4</small></a>
18544  The getenv function returns a pointer to a string associated with the matched list
18545  member. The string pointed to shall not be modified by the program, but may be
18546  overwritten by a subsequent call to the getenv function. If the specified name cannot
18547  be found, a null pointer is returned.
18548
18549 <p><b>Footnotes</b>
18550 <p><small><a name="note300" href="#note300">300)</a> Many implementations provide non-standard functions that modify the environment list.
18551 </small>
18552
18553 <p><small><a href="#Contents">Contents</a></small>
18554 <h5><a name="7.22.4.7" href="#7.22.4.7">7.22.4.7 The quick_exit function</a></h5>
18555 <p><b>Synopsis</b>
18556 <p><a name="7.22.4.7p1" href="#7.22.4.7p1"><small>1</small></a>
18557 <pre>
18558          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18559          _Noreturn void quick_exit(int status);
18560 </pre>
18561 <p><b>Description</b>
18562 <p><a name="7.22.4.7p2" href="#7.22.4.7p2"><small>2</small></a>
18563  The quick_exit function causes normal program termination to occur. No functions
18564  registered by the atexit function or signal handlers registered by the signal function
18565  are called. If a program calls the quick_exit function more than once, or calls the
18566  exit function in addition to the quick_exit function, the behavior is undefined. If a
18567  signal is raised while the quick_exit function is executing, the behavior is undefined.
18568 <p><a name="7.22.4.7p3" href="#7.22.4.7p3"><small>3</small></a>
18569  The quick_exit function first calls all functions registered by the at_quick_exit
18570  function, in the reverse order of their registration,<sup><a href="#note301"><b>301)</b></a></sup> except that a function is called after
18571  any previously registered functions that had already been called at the time it was
18572  registered. If, during the call to any such function, a call to the longjmp function is
18573  made that would terminate the call to the registered function, the behavior is undefined.
18574 <p><a name="7.22.4.7p4" href="#7.22.4.7p4"><small>4</small></a>
18575  Then control is returned to the host environment by means of the function call
18576  _Exit(status).
18577 <p><b>Returns</b>
18578 <p><a name="7.22.4.7p5" href="#7.22.4.7p5"><small>5</small></a>
18579  The quick_exit function cannot return to its caller.
18580
18581 <p><b>Footnotes</b>
18582 <p><small><a name="note301" href="#note301">301)</a> Each function is called as many times as it was registered, and in the correct order with respect to
18583  other registered functions.
18584 </small>
18585
18586 <p><small><a href="#Contents">Contents</a></small>
18587 <h5><a name="7.22.4.8" href="#7.22.4.8">7.22.4.8 The system function</a></h5>
18588 <p><b>Synopsis</b>
18589 <p><a name="7.22.4.8p1" href="#7.22.4.8p1"><small>1</small></a>
18590 <pre>
18591          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18592          int system(const char *string);
18593 </pre>
18594 <p><b>Description</b>
18595 <p><a name="7.22.4.8p2" href="#7.22.4.8p2"><small>2</small></a>
18596  If string is a null pointer, the system function determines whether the host
18597  environment has a command processor. If string is not a null pointer, the system
18598  
18599 <!--page 372 -->
18600  function passes the string pointed to by string to that command processor to be
18601  executed in a manner which the implementation shall document; this might then cause the
18602  program calling system to behave in a non-conforming manner or to terminate.
18603 <p><b>Returns</b>
18604 <p><a name="7.22.4.8p3" href="#7.22.4.8p3"><small>3</small></a>
18605  If the argument is a null pointer, the system function returns nonzero only if a
18606  command processor is available. If the argument is not a null pointer, and the system
18607  function does return, it returns an implementation-defined value.
18608
18609 <p><small><a href="#Contents">Contents</a></small>
18610 <h4><a name="7.22.5" href="#7.22.5">7.22.5 Searching and sorting utilities</a></h4>
18611 <p><a name="7.22.5p1" href="#7.22.5p1"><small>1</small></a>
18612  These utilities make use of a comparison function to search or sort arrays of unspecified
18613  type. Where an argument declared as size_t nmemb specifies the length of the array
18614  for a function, nmemb can have the value zero on a call to that function; the comparison
18615  function is not called, a search finds no matching element, and sorting performs no
18616  rearrangement. Pointer arguments on such a call shall still have valid values, as described
18617  in <a href="#7.1.4">7.1.4</a>.
18618 <p><a name="7.22.5p2" href="#7.22.5p2"><small>2</small></a>
18619  The implementation shall ensure that the second argument of the comparison function
18620  (when called from bsearch), or both arguments (when called from qsort), are
18621  pointers to elements of the array.<sup><a href="#note302"><b>302)</b></a></sup> The first argument when called from bsearch
18622  shall equal key.
18623 <p><a name="7.22.5p3" href="#7.22.5p3"><small>3</small></a>
18624  The comparison function shall not alter the contents of the array. The implementation
18625  may reorder elements of the array between calls to the comparison function, but shall not
18626  alter the contents of any individual element.
18627 <p><a name="7.22.5p4" href="#7.22.5p4"><small>4</small></a>
18628  When the same objects (consisting of size bytes, irrespective of their current positions
18629  in the array) are passed more than once to the comparison function, the results shall be
18630  consistent with one another. That is, for qsort they shall define a total ordering on the
18631  array, and for bsearch the same object shall always compare the same way with the
18632  key.
18633 <p><a name="7.22.5p5" href="#7.22.5p5"><small>5</small></a>
18634  A sequence point occurs immediately before and immediately after each call to the
18635  comparison function, and also between any call to the comparison function and any
18636  movement of the objects passed as arguments to that call.
18637  
18638  
18639  
18640  
18641 <!--page 373 -->
18642
18643 <p><b>Footnotes</b>
18644 <p><small><a name="note302" href="#note302">302)</a> That is, if the value passed is p, then the following expressions are always nonzero:
18645
18646 <pre>
18647           ((char *)p - (char *)base) % size == 0
18648           (char *)p &gt;= (char *)base
18649           (char *)p &lt; (char *)base + nmemb * size
18650 </pre>
18651 </small>
18652
18653 <p><small><a href="#Contents">Contents</a></small>
18654 <h5><a name="7.22.5.1" href="#7.22.5.1">7.22.5.1 The bsearch function</a></h5>
18655 <p><b>Synopsis</b>
18656 <p><a name="7.22.5.1p1" href="#7.22.5.1p1"><small>1</small></a>
18657 <pre>
18658           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18659           void *bsearch(const void *key, const void *base,
18660                size_t nmemb, size_t size,
18661                int (*compar)(const void *, const void *));
18662 </pre>
18663 <p><b>Description</b>
18664 <p><a name="7.22.5.1p2" href="#7.22.5.1p2"><small>2</small></a>
18665  The bsearch function searches an array of nmemb objects, the initial element of which
18666  is pointed to by base, for an element that matches the object pointed to by key. The
18667  size of each element of the array is specified by size.
18668 <p><a name="7.22.5.1p3" href="#7.22.5.1p3"><small>3</small></a>
18669  The comparison function pointed to by compar is called with two arguments that point
18670  to the key object and to an array element, in that order. The function shall return an
18671  integer less than, equal to, or greater than zero if the key object is considered,
18672  respectively, to be less than, to match, or to be greater than the array element. The array
18673  shall consist of: all the elements that compare less than, all the elements that compare
18674  equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note303"><b>303)</b></a></sup>
18675 <p><b>Returns</b>
18676 <p><a name="7.22.5.1p4" href="#7.22.5.1p4"><small>4</small></a>
18677  The bsearch function returns a pointer to a matching element of the array, or a null
18678  pointer if no match is found. If two elements compare as equal, which element is
18679  matched is unspecified.
18680
18681 <p><b>Footnotes</b>
18682 <p><small><a name="note303" href="#note303">303)</a> In practice, the entire array is sorted according to the comparison function.
18683 </small>
18684
18685 <p><small><a href="#Contents">Contents</a></small>
18686 <h5><a name="7.22.5.2" href="#7.22.5.2">7.22.5.2 The qsort function</a></h5>
18687 <p><b>Synopsis</b>
18688 <p><a name="7.22.5.2p1" href="#7.22.5.2p1"><small>1</small></a>
18689 <pre>
18690           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18691           void qsort(void *base, size_t nmemb, size_t size,
18692                int (*compar)(const void *, const void *));
18693 </pre>
18694 <p><b>Description</b>
18695 <p><a name="7.22.5.2p2" href="#7.22.5.2p2"><small>2</small></a>
18696  The qsort function sorts an array of nmemb objects, the initial element of which is
18697  pointed to by base. The size of each object is specified by size.
18698 <p><a name="7.22.5.2p3" href="#7.22.5.2p3"><small>3</small></a>
18699  The contents of the array are sorted into ascending order according to a comparison
18700  function pointed to by compar, which is called with two arguments that point to the
18701  objects being compared. The function shall return an integer less than, equal to, or
18702  greater than zero if the first argument is considered to be respectively less than, equal to,
18703  or greater than the second.
18704  
18705  
18706 <!--page 374 -->
18707 <p><a name="7.22.5.2p4" href="#7.22.5.2p4"><small>4</small></a>
18708  If two elements compare as equal, their order in the resulting sorted array is unspecified.
18709 <p><b>Returns</b>
18710 <p><a name="7.22.5.2p5" href="#7.22.5.2p5"><small>5</small></a>
18711  The qsort function returns no value.
18712
18713 <p><small><a href="#Contents">Contents</a></small>
18714 <h4><a name="7.22.6" href="#7.22.6">7.22.6 Integer arithmetic functions</a></h4>
18715
18716 <p><small><a href="#Contents">Contents</a></small>
18717 <h5><a name="7.22.6.1" href="#7.22.6.1">7.22.6.1 The abs, labs and llabs functions</a></h5>
18718 <p><b>Synopsis</b>
18719 <p><a name="7.22.6.1p1" href="#7.22.6.1p1"><small>1</small></a>
18720 <pre>
18721          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18722          int abs(int j);
18723          long int labs(long int j);
18724          long long int llabs(long long int j);
18725 </pre>
18726 <p><b>Description</b>
18727 <p><a name="7.22.6.1p2" href="#7.22.6.1p2"><small>2</small></a>
18728  The abs, labs, and llabs functions compute the absolute value of an integer j. If the
18729  result cannot be represented, the behavior is undefined.<sup><a href="#note304"><b>304)</b></a></sup>
18730 <p><b>Returns</b>
18731 <p><a name="7.22.6.1p3" href="#7.22.6.1p3"><small>3</small></a>
18732  The abs, labs, and llabs, functions return the absolute value.
18733
18734 <p><b>Footnotes</b>
18735 <p><small><a name="note304" href="#note304">304)</a> The absolute value of the most negative number cannot be represented in two's complement.
18736 </small>
18737
18738 <p><small><a href="#Contents">Contents</a></small>
18739 <h5><a name="7.22.6.2" href="#7.22.6.2">7.22.6.2 The div, ldiv, and lldiv functions</a></h5>
18740 <p><b>Synopsis</b>
18741 <p><a name="7.22.6.2p1" href="#7.22.6.2p1"><small>1</small></a>
18742 <pre>
18743          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18744          div_t div(int numer, int denom);
18745          ldiv_t ldiv(long int numer, long int denom);
18746          lldiv_t lldiv(long long int numer, long long int denom);
18747 </pre>
18748 <p><b>Description</b>
18749 <p><a name="7.22.6.2p2" href="#7.22.6.2p2"><small>2</small></a>
18750  The div, ldiv, and lldiv, functions compute numer / denom and numer %
18751  denom in a single operation.
18752 <p><b>Returns</b>
18753 <p><a name="7.22.6.2p3" href="#7.22.6.2p3"><small>3</small></a>
18754  The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
18755  lldiv_t, respectively, comprising both the quotient and the remainder. The structures
18756  shall contain (in either order) the members quot (the quotient) and rem (the remainder),
18757  each of which has the same type as the arguments numer and denom. If either part of
18758  the result cannot be represented, the behavior is undefined.
18759  
18760  
18761  
18762  
18763 <!--page 375 -->
18764
18765 <p><small><a href="#Contents">Contents</a></small>
18766 <h4><a name="7.22.7" href="#7.22.7">7.22.7 Multibyte/wide character conversion functions</a></h4>
18767 <p><a name="7.22.7p1" href="#7.22.7p1"><small>1</small></a>
18768  The behavior of the multibyte character functions is affected by the LC_CTYPE category
18769  of the current locale. For a state-dependent encoding, each function is placed into its
18770  initial conversion state at program startup and can be returned to that state by a call for
18771  which its character pointer argument, s, is a null pointer. Subsequent calls with s as
18772  other than a null pointer cause the internal conversion state of the function to be altered as
18773  necessary. A call with s as a null pointer causes these functions to return a nonzero value
18774  if encodings have state dependency, and zero otherwise.<sup><a href="#note305"><b>305)</b></a></sup> Changing the LC_CTYPE
18775  category causes the conversion state of these functions to be indeterminate.
18776
18777 <p><b>Footnotes</b>
18778 <p><small><a name="note305" href="#note305">305)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
18779  character codes, but are grouped with an adjacent multibyte character.
18780 </small>
18781
18782 <p><small><a href="#Contents">Contents</a></small>
18783 <h5><a name="7.22.7.1" href="#7.22.7.1">7.22.7.1 The mblen function</a></h5>
18784 <p><b>Synopsis</b>
18785 <p><a name="7.22.7.1p1" href="#7.22.7.1p1"><small>1</small></a>
18786 <pre>
18787          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18788          int mblen(const char *s, size_t n);
18789 </pre>
18790 <p><b>Description</b>
18791 <p><a name="7.22.7.1p2" href="#7.22.7.1p2"><small>2</small></a>
18792  If s is not a null pointer, the mblen function determines the number of bytes contained
18793  in the multibyte character pointed to by s. Except that the conversion state of the
18794  mbtowc function is not affected, it is equivalent to
18795 <pre>
18796          mbtowc((wchar_t *)0, (const char *)0, 0);
18797          mbtowc((wchar_t *)0, s, n);
18798 </pre>
18799 <p><a name="7.22.7.1p3" href="#7.22.7.1p3"><small>3</small></a>
18800  The implementation shall behave as if no library function calls the mblen function.
18801 <p><b>Returns</b>
18802 <p><a name="7.22.7.1p4" href="#7.22.7.1p4"><small>4</small></a>
18803  If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
18804  character encodings, respectively, do or do not have state-dependent encodings. If s is
18805  not a null pointer, the mblen function either returns 0 (if s points to the null character),
18806  or returns the number of bytes that are contained in the multibyte character (if the next n
18807  or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
18808  multibyte character).
18809 <p><b> Forward references</b>: the mbtowc function (<a href="#7.22.7.2">7.22.7.2</a>).
18810  
18811  
18812  
18813  
18814 <!--page 376 -->
18815
18816 <p><small><a href="#Contents">Contents</a></small>
18817 <h5><a name="7.22.7.2" href="#7.22.7.2">7.22.7.2 The mbtowc function</a></h5>
18818 <p><b>Synopsis</b>
18819 <p><a name="7.22.7.2p1" href="#7.22.7.2p1"><small>1</small></a>
18820 <pre>
18821         #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18822         int mbtowc(wchar_t * restrict pwc,
18823              const char * restrict s,
18824              size_t n);
18825 </pre>
18826 <p><b>Description</b>
18827 <p><a name="7.22.7.2p2" href="#7.22.7.2p2"><small>2</small></a>
18828  If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
18829  the byte pointed to by s to determine the number of bytes needed to complete the next
18830  multibyte character (including any shift sequences). If the function determines that the
18831  next multibyte character is complete and valid, it determines the value of the
18832  corresponding wide character and then, if pwc is not a null pointer, stores that value in
18833  the object pointed to by pwc. If the corresponding wide character is the null wide
18834  character, the function is left in the initial conversion state.
18835 <p><a name="7.22.7.2p3" href="#7.22.7.2p3"><small>3</small></a>
18836  The implementation shall behave as if no library function calls the mbtowc function.
18837 <p><b>Returns</b>
18838 <p><a name="7.22.7.2p4" href="#7.22.7.2p4"><small>4</small></a>
18839  If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
18840  character encodings, respectively, do or do not have state-dependent encodings. If s is
18841  not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
18842  or returns the number of bytes that are contained in the converted multibyte character (if
18843  the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
18844  form a valid multibyte character).
18845 <p><a name="7.22.7.2p5" href="#7.22.7.2p5"><small>5</small></a>
18846  In no case will the value returned be greater than n or the value of the MB_CUR_MAX
18847  macro.
18848
18849 <p><small><a href="#Contents">Contents</a></small>
18850 <h5><a name="7.22.7.3" href="#7.22.7.3">7.22.7.3 The wctomb function</a></h5>
18851 <p><b>Synopsis</b>
18852 <p><a name="7.22.7.3p1" href="#7.22.7.3p1"><small>1</small></a>
18853 <pre>
18854         #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18855         int wctomb(char *s, wchar_t wc);
18856 </pre>
18857 <p><b>Description</b>
18858 <p><a name="7.22.7.3p2" href="#7.22.7.3p2"><small>2</small></a>
18859  The wctomb function determines the number of bytes needed to represent the multibyte
18860  character corresponding to the wide character given by wc (including any shift
18861  sequences), and stores the multibyte character representation in the array whose first
18862  element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
18863  are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
18864  sequence needed to restore the initial shift state, and the function is left in the initial
18865  conversion state.
18866 <!--page 377 -->
18867 <p><a name="7.22.7.3p3" href="#7.22.7.3p3"><small>3</small></a>
18868  The implementation shall behave as if no library function calls the wctomb function.
18869 <p><b>Returns</b>
18870 <p><a name="7.22.7.3p4" href="#7.22.7.3p4"><small>4</small></a>
18871  If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
18872  character encodings, respectively, do or do not have state-dependent encodings. If s is
18873  not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
18874  to a valid multibyte character, or returns the number of bytes that are contained in the
18875  multibyte character corresponding to the value of wc.
18876 <p><a name="7.22.7.3p5" href="#7.22.7.3p5"><small>5</small></a>
18877  In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
18878
18879 <p><small><a href="#Contents">Contents</a></small>
18880 <h4><a name="7.22.8" href="#7.22.8">7.22.8 Multibyte/wide string conversion functions</a></h4>
18881 <p><a name="7.22.8p1" href="#7.22.8p1"><small>1</small></a>
18882  The behavior of the multibyte string functions is affected by the LC_CTYPE category of
18883  the current locale.
18884
18885 <p><small><a href="#Contents">Contents</a></small>
18886 <h5><a name="7.22.8.1" href="#7.22.8.1">7.22.8.1 The mbstowcs function</a></h5>
18887 <p><b>Synopsis</b>
18888 <p><a name="7.22.8.1p1" href="#7.22.8.1p1"><small>1</small></a>
18889 <pre>
18890           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18891           size_t mbstowcs(wchar_t * restrict pwcs,
18892                const char * restrict s,
18893                size_t n);
18894 </pre>
18895 <p><b>Description</b>
18896 <p><a name="7.22.8.1p2" href="#7.22.8.1p2"><small>2</small></a>
18897  The mbstowcs function converts a sequence of multibyte characters that begins in the
18898  initial shift state from the array pointed to by s into a sequence of corresponding wide
18899  characters and stores not more than n wide characters into the array pointed to by pwcs.
18900  No multibyte characters that follow a null character (which is converted into a null wide
18901  character) will be examined or converted. Each multibyte character is converted as if by
18902  a call to the mbtowc function, except that the conversion state of the mbtowc function is
18903  not affected.
18904 <p><a name="7.22.8.1p3" href="#7.22.8.1p3"><small>3</small></a>
18905  No more than n elements will be modified in the array pointed to by pwcs. If copying
18906  takes place between objects that overlap, the behavior is undefined.
18907 <p><b>Returns</b>
18908 <p><a name="7.22.8.1p4" href="#7.22.8.1p4"><small>4</small></a>
18909  If an invalid multibyte character is encountered, the mbstowcs function returns
18910  (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
18911  elements modified, not including a terminating null wide character, if any.<sup><a href="#note306"><b>306)</b></a></sup>
18912  
18913  
18914  
18915  
18916 <!--page 378 -->
18917
18918 <p><b>Footnotes</b>
18919 <p><small><a name="note306" href="#note306">306)</a> The array will not be null-terminated if the value returned is n.
18920 </small>
18921
18922 <p><small><a href="#Contents">Contents</a></small>
18923 <h5><a name="7.22.8.2" href="#7.22.8.2">7.22.8.2 The wcstombs function</a></h5>
18924 <p><b>Synopsis</b>
18925 <p><a name="7.22.8.2p1" href="#7.22.8.2p1"><small>1</small></a>
18926 <pre>
18927         #include <a href="#7.22">&lt;stdlib.h&gt;</a>
18928         size_t wcstombs(char * restrict s,
18929              const wchar_t * restrict pwcs,
18930              size_t n);
18931 </pre>
18932 <p><b>Description</b>
18933 <p><a name="7.22.8.2p2" href="#7.22.8.2p2"><small>2</small></a>
18934  The wcstombs function converts a sequence of wide characters from the array pointed
18935  to by pwcs into a sequence of corresponding multibyte characters that begins in the
18936  initial shift state, and stores these multibyte characters into the array pointed to by s,
18937  stopping if a multibyte character would exceed the limit of n total bytes or if a null
18938  character is stored. Each wide character is converted as if by a call to the wctomb
18939  function, except that the conversion state of the wctomb function is not affected.
18940 <p><a name="7.22.8.2p3" href="#7.22.8.2p3"><small>3</small></a>
18941  No more than n bytes will be modified in the array pointed to by s. If copying takes place
18942  between objects that overlap, the behavior is undefined.
18943 <p><b>Returns</b>
18944 <p><a name="7.22.8.2p4" href="#7.22.8.2p4"><small>4</small></a>
18945  If a wide character is encountered that does not correspond to a valid multibyte character,
18946  the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
18947  returns the number of bytes modified, not including a terminating null character, if
18948  any.<sup><a href="#note306"><b>306)</b></a></sup>
18949 <!--page 379 -->
18950
18951 <p><small><a href="#Contents">Contents</a></small>
18952 <h3><a name="7.23" href="#7.23">7.23 _Noreturn &lt;stdnoreturn.h&gt;</a></h3>
18953 <p><a name="7.23p1" href="#7.23p1"><small>1</small></a>
18954  The header <a href="#7.23">&lt;stdnoreturn.h&gt;</a> defines the macro
18955 <pre>
18956          noreturn
18957 </pre>
18958  which expands to _Noreturn.
18959 <!--page 380 -->
18960
18961 <p><small><a href="#Contents">Contents</a></small>
18962 <h3><a name="7.24" href="#7.24">7.24 String handling &lt;string.h&gt;</a></h3>
18963
18964 <p><small><a href="#Contents">Contents</a></small>
18965 <h4><a name="7.24.1" href="#7.24.1">7.24.1 String function conventions</a></h4>
18966 <p><a name="7.24.1p1" href="#7.24.1p1"><small>1</small></a>
18967  The header <a href="#7.24">&lt;string.h&gt;</a> declares one type and several functions, and defines one
18968  macro useful for manipulating arrays of character type and other objects treated as arrays
18969  of character type.<sup><a href="#note307"><b>307)</b></a></sup> The type is size_t and the macro is NULL (both described in
18970  <a href="#7.19">7.19</a>). Various methods are used for determining the lengths of the arrays, but in all cases
18971  a char * or void * argument points to the initial (lowest addressed) character of the
18972  array. If an array is accessed beyond the end of an object, the behavior is undefined.
18973 <p><a name="7.24.1p2" href="#7.24.1p2"><small>2</small></a>
18974  Where an argument declared as size_t n specifies the length of the array for a
18975  function, n can have the value zero on a call to that function. Unless explicitly stated
18976  otherwise in the description of a particular function in this subclause, pointer arguments
18977  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
18978  function that locates a character finds no occurrence, a function that compares two
18979  character sequences returns zero, and a function that copies characters copies zero
18980  characters.
18981 <p><a name="7.24.1p3" href="#7.24.1p3"><small>3</small></a>
18982  For all functions in this subclause, each character shall be interpreted as if it had the type
18983  unsigned char (and therefore every possible object representation is valid and has a
18984  different value).
18985
18986 <p><b>Footnotes</b>
18987 <p><small><a name="note307" href="#note307">307)</a> See ''future library directions'' (<a href="#7.31.13">7.31.13</a>).
18988 </small>
18989
18990 <p><small><a href="#Contents">Contents</a></small>
18991 <h4><a name="7.24.2" href="#7.24.2">7.24.2 Copying functions</a></h4>
18992
18993 <p><small><a href="#Contents">Contents</a></small>
18994 <h5><a name="7.24.2.1" href="#7.24.2.1">7.24.2.1 The memcpy function</a></h5>
18995 <p><b>Synopsis</b>
18996 <p><a name="7.24.2.1p1" href="#7.24.2.1p1"><small>1</small></a>
18997 <pre>
18998           #include <a href="#7.24">&lt;string.h&gt;</a>
18999           void *memcpy(void * restrict s1,
19000                const void * restrict s2,
19001                size_t n);
19002 </pre>
19003 <p><b>Description</b>
19004 <p><a name="7.24.2.1p2" href="#7.24.2.1p2"><small>2</small></a>
19005  The memcpy function copies n characters from the object pointed to by s2 into the
19006  object pointed to by s1. If copying takes place between objects that overlap, the behavior
19007  is undefined.
19008 <p><b>Returns</b>
19009 <p><a name="7.24.2.1p3" href="#7.24.2.1p3"><small>3</small></a>
19010  The memcpy function returns the value of s1.
19011  
19012  
19013  
19014  
19015 <!--page 381 -->
19016
19017 <p><small><a href="#Contents">Contents</a></small>
19018 <h5><a name="7.24.2.2" href="#7.24.2.2">7.24.2.2 The memmove function</a></h5>
19019 <p><b>Synopsis</b>
19020 <p><a name="7.24.2.2p1" href="#7.24.2.2p1"><small>1</small></a>
19021 <pre>
19022          #include <a href="#7.24">&lt;string.h&gt;</a>
19023          void *memmove(void *s1, const void *s2, size_t n);
19024 </pre>
19025 <p><b>Description</b>
19026 <p><a name="7.24.2.2p2" href="#7.24.2.2p2"><small>2</small></a>
19027  The memmove function copies n characters from the object pointed to by s2 into the
19028  object pointed to by s1. Copying takes place as if the n characters from the object
19029  pointed to by s2 are first copied into a temporary array of n characters that does not
19030  overlap the objects pointed to by s1 and s2, and then the n characters from the
19031  temporary array are copied into the object pointed to by s1.
19032 <p><b>Returns</b>
19033 <p><a name="7.24.2.2p3" href="#7.24.2.2p3"><small>3</small></a>
19034  The memmove function returns the value of s1.
19035
19036 <p><small><a href="#Contents">Contents</a></small>
19037 <h5><a name="7.24.2.3" href="#7.24.2.3">7.24.2.3 The strcpy function</a></h5>
19038 <p><b>Synopsis</b>
19039 <p><a name="7.24.2.3p1" href="#7.24.2.3p1"><small>1</small></a>
19040 <pre>
19041          #include <a href="#7.24">&lt;string.h&gt;</a>
19042          char *strcpy(char * restrict s1,
19043               const char * restrict s2);
19044 </pre>
19045 <p><b>Description</b>
19046 <p><a name="7.24.2.3p2" href="#7.24.2.3p2"><small>2</small></a>
19047  The strcpy function copies the string pointed to by s2 (including the terminating null
19048  character) into the array pointed to by s1. If copying takes place between objects that
19049  overlap, the behavior is undefined.
19050 <p><b>Returns</b>
19051 <p><a name="7.24.2.3p3" href="#7.24.2.3p3"><small>3</small></a>
19052  The strcpy function returns the value of s1.
19053
19054 <p><small><a href="#Contents">Contents</a></small>
19055 <h5><a name="7.24.2.4" href="#7.24.2.4">7.24.2.4 The strncpy function</a></h5>
19056 <p><b>Synopsis</b>
19057 <p><a name="7.24.2.4p1" href="#7.24.2.4p1"><small>1</small></a>
19058 <pre>
19059          #include <a href="#7.24">&lt;string.h&gt;</a>
19060          char *strncpy(char * restrict s1,
19061               const char * restrict s2,
19062               size_t n);
19063 </pre>
19064 <p><b>Description</b>
19065 <p><a name="7.24.2.4p2" href="#7.24.2.4p2"><small>2</small></a>
19066  The strncpy function copies not more than n characters (characters that follow a null
19067  character are not copied) from the array pointed to by s2 to the array pointed to by
19068 <!--page 382 -->
19069  s1.<sup><a href="#note308"><b>308)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
19070 <p><a name="7.24.2.4p3" href="#7.24.2.4p3"><small>3</small></a>
19071  If the array pointed to by s2 is a string that is shorter than n characters, null characters
19072  are appended to the copy in the array pointed to by s1, until n characters in all have been
19073  written.
19074 <p><b>Returns</b>
19075 <p><a name="7.24.2.4p4" href="#7.24.2.4p4"><small>4</small></a>
19076  The strncpy function returns the value of s1.
19077
19078 <p><b>Footnotes</b>
19079 <p><small><a name="note308" href="#note308">308)</a> Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
19080  not be null-terminated.
19081 </small>
19082
19083 <p><small><a href="#Contents">Contents</a></small>
19084 <h4><a name="7.24.3" href="#7.24.3">7.24.3 Concatenation functions</a></h4>
19085
19086 <p><small><a href="#Contents">Contents</a></small>
19087 <h5><a name="7.24.3.1" href="#7.24.3.1">7.24.3.1 The strcat function</a></h5>
19088 <p><b>Synopsis</b>
19089 <p><a name="7.24.3.1p1" href="#7.24.3.1p1"><small>1</small></a>
19090 <pre>
19091           #include <a href="#7.24">&lt;string.h&gt;</a>
19092           char *strcat(char * restrict s1,
19093                const char * restrict s2);
19094 </pre>
19095 <p><b>Description</b>
19096 <p><a name="7.24.3.1p2" href="#7.24.3.1p2"><small>2</small></a>
19097  The strcat function appends a copy of the string pointed to by s2 (including the
19098  terminating null character) to the end of the string pointed to by s1. The initial character
19099  of s2 overwrites the null character at the end of s1. If copying takes place between
19100  objects that overlap, the behavior is undefined.
19101 <p><b>Returns</b>
19102 <p><a name="7.24.3.1p3" href="#7.24.3.1p3"><small>3</small></a>
19103  The strcat function returns the value of s1.
19104
19105 <p><small><a href="#Contents">Contents</a></small>
19106 <h5><a name="7.24.3.2" href="#7.24.3.2">7.24.3.2 The strncat function</a></h5>
19107 <p><b>Synopsis</b>
19108 <p><a name="7.24.3.2p1" href="#7.24.3.2p1"><small>1</small></a>
19109 <pre>
19110           #include <a href="#7.24">&lt;string.h&gt;</a>
19111           char *strncat(char * restrict s1,
19112                const char * restrict s2,
19113                size_t n);
19114 </pre>
19115 <p><b>Description</b>
19116 <p><a name="7.24.3.2p2" href="#7.24.3.2p2"><small>2</small></a>
19117  The strncat function appends not more than n characters (a null character and
19118  characters that follow it are not appended) from the array pointed to by s2 to the end of
19119  the string pointed to by s1. The initial character of s2 overwrites the null character at the
19120  end of s1. A terminating null character is always appended to the result.<sup><a href="#note309"><b>309)</b></a></sup> If copying
19121  
19122 <!--page 383 -->
19123  takes place between objects that overlap, the behavior is undefined.
19124 <p><b>Returns</b>
19125 <p><a name="7.24.3.2p3" href="#7.24.3.2p3"><small>3</small></a>
19126  The strncat function returns the value of s1.
19127 <p><b> Forward references</b>: the strlen function (<a href="#7.24.6.3">7.24.6.3</a>).
19128
19129 <p><b>Footnotes</b>
19130 <p><small><a name="note309" href="#note309">309)</a> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
19131  strlen(s1)+n+1.
19132 </small>
19133
19134 <p><small><a href="#Contents">Contents</a></small>
19135 <h4><a name="7.24.4" href="#7.24.4">7.24.4 Comparison functions</a></h4>
19136 <p><a name="7.24.4p1" href="#7.24.4p1"><small>1</small></a>
19137  The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
19138  and strncmp is determined by the sign of the difference between the values of the first
19139  pair of characters (both interpreted as unsigned char) that differ in the objects being
19140  compared.
19141
19142 <p><small><a href="#Contents">Contents</a></small>
19143 <h5><a name="7.24.4.1" href="#7.24.4.1">7.24.4.1 The memcmp function</a></h5>
19144 <p><b>Synopsis</b>
19145 <p><a name="7.24.4.1p1" href="#7.24.4.1p1"><small>1</small></a>
19146 <pre>
19147          #include <a href="#7.24">&lt;string.h&gt;</a>
19148          int memcmp(const void *s1, const void *s2, size_t n);
19149 </pre>
19150 <p><b>Description</b>
19151 <p><a name="7.24.4.1p2" href="#7.24.4.1p2"><small>2</small></a>
19152  The memcmp function compares the first n characters of the object pointed to by s1 to
19153  the first n characters of the object pointed to by s2.<sup><a href="#note310"><b>310)</b></a></sup>
19154 <p><b>Returns</b>
19155 <p><a name="7.24.4.1p3" href="#7.24.4.1p3"><small>3</small></a>
19156  The memcmp function returns an integer greater than, equal to, or less than zero,
19157  accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
19158  pointed to by s2.
19159
19160 <p><b>Footnotes</b>
19161 <p><small><a name="note310" href="#note310">310)</a> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
19162  indeterminate. Strings shorter than their allocated space and unions may also cause problems in
19163  comparison.
19164 </small>
19165
19166 <p><small><a href="#Contents">Contents</a></small>
19167 <h5><a name="7.24.4.2" href="#7.24.4.2">7.24.4.2 The strcmp function</a></h5>
19168 <p><b>Synopsis</b>
19169 <p><a name="7.24.4.2p1" href="#7.24.4.2p1"><small>1</small></a>
19170 <pre>
19171          #include <a href="#7.24">&lt;string.h&gt;</a>
19172          int strcmp(const char *s1, const char *s2);
19173 </pre>
19174 <p><b>Description</b>
19175 <p><a name="7.24.4.2p2" href="#7.24.4.2p2"><small>2</small></a>
19176  The strcmp function compares the string pointed to by s1 to the string pointed to by
19177  s2.
19178 <p><b>Returns</b>
19179 <p><a name="7.24.4.2p3" href="#7.24.4.2p3"><small>3</small></a>
19180  The strcmp function returns an integer greater than, equal to, or less than zero,
19181  accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
19182  
19183 <!--page 384 -->
19184  pointed to by s2.
19185
19186 <p><small><a href="#Contents">Contents</a></small>
19187 <h5><a name="7.24.4.3" href="#7.24.4.3">7.24.4.3 The strcoll function</a></h5>
19188 <p><b>Synopsis</b>
19189 <p><a name="7.24.4.3p1" href="#7.24.4.3p1"><small>1</small></a>
19190 <pre>
19191         #include <a href="#7.24">&lt;string.h&gt;</a>
19192         int strcoll(const char *s1, const char *s2);
19193 </pre>
19194 <p><b>Description</b>
19195 <p><a name="7.24.4.3p2" href="#7.24.4.3p2"><small>2</small></a>
19196  The strcoll function compares the string pointed to by s1 to the string pointed to by
19197  s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
19198 <p><b>Returns</b>
19199 <p><a name="7.24.4.3p3" href="#7.24.4.3p3"><small>3</small></a>
19200  The strcoll function returns an integer greater than, equal to, or less than zero,
19201  accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
19202  pointed to by s2 when both are interpreted as appropriate to the current locale.
19203
19204 <p><small><a href="#Contents">Contents</a></small>
19205 <h5><a name="7.24.4.4" href="#7.24.4.4">7.24.4.4 The strncmp function</a></h5>
19206 <p><b>Synopsis</b>
19207 <p><a name="7.24.4.4p1" href="#7.24.4.4p1"><small>1</small></a>
19208 <pre>
19209         #include <a href="#7.24">&lt;string.h&gt;</a>
19210         int strncmp(const char *s1, const char *s2, size_t n);
19211 </pre>
19212 <p><b>Description</b>
19213 <p><a name="7.24.4.4p2" href="#7.24.4.4p2"><small>2</small></a>
19214  The strncmp function compares not more than n characters (characters that follow a
19215  null character are not compared) from the array pointed to by s1 to the array pointed to
19216  by s2.
19217 <p><b>Returns</b>
19218 <p><a name="7.24.4.4p3" href="#7.24.4.4p3"><small>3</small></a>
19219  The strncmp function returns an integer greater than, equal to, or less than zero,
19220  accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
19221  to, or less than the possibly null-terminated array pointed to by s2.
19222
19223 <p><small><a href="#Contents">Contents</a></small>
19224 <h5><a name="7.24.4.5" href="#7.24.4.5">7.24.4.5 The strxfrm function</a></h5>
19225 <p><b>Synopsis</b>
19226 <p><a name="7.24.4.5p1" href="#7.24.4.5p1"><small>1</small></a>
19227 <pre>
19228         #include <a href="#7.24">&lt;string.h&gt;</a>
19229         size_t strxfrm(char * restrict s1,
19230              const char * restrict s2,
19231              size_t n);
19232 </pre>
19233 <p><b>Description</b>
19234 <p><a name="7.24.4.5p2" href="#7.24.4.5p2"><small>2</small></a>
19235  The strxfrm function transforms the string pointed to by s2 and places the resulting
19236  string into the array pointed to by s1. The transformation is such that if the strcmp
19237  function is applied to two transformed strings, it returns a value greater than, equal to, or
19238 <!--page 385 -->
19239  less than zero, corresponding to the result of the strcoll function applied to the same
19240  two original strings. No more than n characters are placed into the resulting array
19241  pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
19242  be a null pointer. If copying takes place between objects that overlap, the behavior is
19243  undefined.
19244 <p><b>Returns</b>
19245 <p><a name="7.24.4.5p3" href="#7.24.4.5p3"><small>3</small></a>
19246  The strxfrm function returns the length of the transformed string (not including the
19247  terminating null character). If the value returned is n or more, the contents of the array
19248  pointed to by s1 are indeterminate.
19249 <p><a name="7.24.4.5p4" href="#7.24.4.5p4"><small>4</small></a>
19250  EXAMPLE The value of the following expression is the size of the array needed to hold the
19251  transformation of the string pointed to by s.
19252 <pre>
19253          1 + strxfrm(NULL, s, 0)
19254 </pre>
19255  
19256
19257 <p><small><a href="#Contents">Contents</a></small>
19258 <h4><a name="7.24.5" href="#7.24.5">7.24.5 Search functions</a></h4>
19259
19260 <p><small><a href="#Contents">Contents</a></small>
19261 <h5><a name="7.24.5.1" href="#7.24.5.1">7.24.5.1 The memchr function</a></h5>
19262 <p><b>Synopsis</b>
19263 <p><a name="7.24.5.1p1" href="#7.24.5.1p1"><small>1</small></a>
19264 <pre>
19265          #include <a href="#7.24">&lt;string.h&gt;</a>
19266          void *memchr(const void *s, int c, size_t n);
19267 </pre>
19268 <p><b>Description</b>
19269 <p><a name="7.24.5.1p2" href="#7.24.5.1p2"><small>2</small></a>
19270  The memchr function locates the first occurrence of c (converted to an unsigned
19271  char) in the initial n characters (each interpreted as unsigned char) of the object
19272  pointed to by s. The implementation shall behave as if it reads the characters sequentially
19273  and stops as soon as a matching character is found.
19274 <p><b>Returns</b>
19275 <p><a name="7.24.5.1p3" href="#7.24.5.1p3"><small>3</small></a>
19276  The memchr function returns a pointer to the located character, or a null pointer if the
19277  character does not occur in the object.
19278
19279 <p><small><a href="#Contents">Contents</a></small>
19280 <h5><a name="7.24.5.2" href="#7.24.5.2">7.24.5.2 The strchr function</a></h5>
19281 <p><b>Synopsis</b>
19282 <p><a name="7.24.5.2p1" href="#7.24.5.2p1"><small>1</small></a>
19283 <pre>
19284          #include <a href="#7.24">&lt;string.h&gt;</a>
19285          char *strchr(const char *s, int c);
19286 </pre>
19287 <p><b>Description</b>
19288 <p><a name="7.24.5.2p2" href="#7.24.5.2p2"><small>2</small></a>
19289  The strchr function locates the first occurrence of c (converted to a char) in the
19290  string pointed to by s. The terminating null character is considered to be part of the
19291  string.
19292 <!--page 386 -->
19293 <p><b>Returns</b>
19294 <p><a name="7.24.5.2p3" href="#7.24.5.2p3"><small>3</small></a>
19295  The strchr function returns a pointer to the located character, or a null pointer if the
19296  character does not occur in the string.
19297
19298 <p><small><a href="#Contents">Contents</a></small>
19299 <h5><a name="7.24.5.3" href="#7.24.5.3">7.24.5.3 The strcspn function</a></h5>
19300 <p><b>Synopsis</b>
19301 <p><a name="7.24.5.3p1" href="#7.24.5.3p1"><small>1</small></a>
19302 <pre>
19303         #include <a href="#7.24">&lt;string.h&gt;</a>
19304         size_t strcspn(const char *s1, const char *s2);
19305 </pre>
19306 <p><b>Description</b>
19307 <p><a name="7.24.5.3p2" href="#7.24.5.3p2"><small>2</small></a>
19308  The strcspn function computes the length of the maximum initial segment of the string
19309  pointed to by s1 which consists entirely of characters not from the string pointed to by
19310  s2.
19311 <p><b>Returns</b>
19312 <p><a name="7.24.5.3p3" href="#7.24.5.3p3"><small>3</small></a>
19313  The strcspn function returns the length of the segment.
19314
19315 <p><small><a href="#Contents">Contents</a></small>
19316 <h5><a name="7.24.5.4" href="#7.24.5.4">7.24.5.4 The strpbrk function</a></h5>
19317 <p><b>Synopsis</b>
19318 <p><a name="7.24.5.4p1" href="#7.24.5.4p1"><small>1</small></a>
19319 <pre>
19320         #include <a href="#7.24">&lt;string.h&gt;</a>
19321         char *strpbrk(const char *s1, const char *s2);
19322 </pre>
19323 <p><b>Description</b>
19324 <p><a name="7.24.5.4p2" href="#7.24.5.4p2"><small>2</small></a>
19325  The strpbrk function locates the first occurrence in the string pointed to by s1 of any
19326  character from the string pointed to by s2.
19327 <p><b>Returns</b>
19328 <p><a name="7.24.5.4p3" href="#7.24.5.4p3"><small>3</small></a>
19329  The strpbrk function returns a pointer to the character, or a null pointer if no character
19330  from s2 occurs in s1.
19331
19332 <p><small><a href="#Contents">Contents</a></small>
19333 <h5><a name="7.24.5.5" href="#7.24.5.5">7.24.5.5 The strrchr function</a></h5>
19334 <p><b>Synopsis</b>
19335 <p><a name="7.24.5.5p1" href="#7.24.5.5p1"><small>1</small></a>
19336 <pre>
19337         #include <a href="#7.24">&lt;string.h&gt;</a>
19338         char *strrchr(const char *s, int c);
19339 </pre>
19340 <p><b>Description</b>
19341 <p><a name="7.24.5.5p2" href="#7.24.5.5p2"><small>2</small></a>
19342  The strrchr function locates the last occurrence of c (converted to a char) in the
19343  string pointed to by s. The terminating null character is considered to be part of the
19344  string.
19345 <!--page 387 -->
19346 <p><b>Returns</b>
19347 <p><a name="7.24.5.5p3" href="#7.24.5.5p3"><small>3</small></a>
19348  The strrchr function returns a pointer to the character, or a null pointer if c does not
19349  occur in the string.
19350
19351 <p><small><a href="#Contents">Contents</a></small>
19352 <h5><a name="7.24.5.6" href="#7.24.5.6">7.24.5.6 The strspn function</a></h5>
19353 <p><b>Synopsis</b>
19354 <p><a name="7.24.5.6p1" href="#7.24.5.6p1"><small>1</small></a>
19355 <pre>
19356          #include <a href="#7.24">&lt;string.h&gt;</a>
19357          size_t strspn(const char *s1, const char *s2);
19358 </pre>
19359 <p><b>Description</b>
19360 <p><a name="7.24.5.6p2" href="#7.24.5.6p2"><small>2</small></a>
19361  The strspn function computes the length of the maximum initial segment of the string
19362  pointed to by s1 which consists entirely of characters from the string pointed to by s2.
19363 <p><b>Returns</b>
19364 <p><a name="7.24.5.6p3" href="#7.24.5.6p3"><small>3</small></a>
19365  The strspn function returns the length of the segment.
19366
19367 <p><small><a href="#Contents">Contents</a></small>
19368 <h5><a name="7.24.5.7" href="#7.24.5.7">7.24.5.7 The strstr function</a></h5>
19369 <p><b>Synopsis</b>
19370 <p><a name="7.24.5.7p1" href="#7.24.5.7p1"><small>1</small></a>
19371 <pre>
19372          #include <a href="#7.24">&lt;string.h&gt;</a>
19373          char *strstr(const char *s1, const char *s2);
19374 </pre>
19375 <p><b>Description</b>
19376 <p><a name="7.24.5.7p2" href="#7.24.5.7p2"><small>2</small></a>
19377  The strstr function locates the first occurrence in the string pointed to by s1 of the
19378  sequence of characters (excluding the terminating null character) in the string pointed to
19379  by s2.
19380 <p><b>Returns</b>
19381 <p><a name="7.24.5.7p3" href="#7.24.5.7p3"><small>3</small></a>
19382  The strstr function returns a pointer to the located string, or a null pointer if the string
19383  is not found. If s2 points to a string with zero length, the function returns s1.
19384
19385 <p><small><a href="#Contents">Contents</a></small>
19386 <h5><a name="7.24.5.8" href="#7.24.5.8">7.24.5.8 The strtok function</a></h5>
19387 <p><b>Synopsis</b>
19388 <p><a name="7.24.5.8p1" href="#7.24.5.8p1"><small>1</small></a>
19389 <pre>
19390          #include <a href="#7.24">&lt;string.h&gt;</a>
19391          char *strtok(char * restrict s1,
19392               const char * restrict s2);
19393 </pre>
19394 <p><b>Description</b>
19395 <p><a name="7.24.5.8p2" href="#7.24.5.8p2"><small>2</small></a>
19396  A sequence of calls to the strtok function breaks the string pointed to by s1 into a
19397  sequence of tokens, each of which is delimited by a character from the string pointed to
19398  by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
19399  sequence have a null first argument. The separator string pointed to by s2 may be
19400  different from call to call.
19401 <!--page 388 -->
19402 <p><a name="7.24.5.8p3" href="#7.24.5.8p3"><small>3</small></a>
19403  The first call in the sequence searches the string pointed to by s1 for the first character
19404  that is not contained in the current separator string pointed to by s2. If no such character
19405  is found, then there are no tokens in the string pointed to by s1 and the strtok function
19406  returns a null pointer. If such a character is found, it is the start of the first token.
19407 <p><a name="7.24.5.8p4" href="#7.24.5.8p4"><small>4</small></a>
19408  The strtok function then searches from there for a character that is contained in the
19409  current separator string. If no such character is found, the current token extends to the
19410  end of the string pointed to by s1, and subsequent searches for a token will return a null
19411  pointer. If such a character is found, it is overwritten by a null character, which
19412  terminates the current token. The strtok function saves a pointer to the following
19413  character, from which the next search for a token will start.
19414 <p><a name="7.24.5.8p5" href="#7.24.5.8p5"><small>5</small></a>
19415  Each subsequent call, with a null pointer as the value of the first argument, starts
19416  searching from the saved pointer and behaves as described above.
19417 <p><a name="7.24.5.8p6" href="#7.24.5.8p6"><small>6</small></a>
19418  The strtok function is not required to avoid data races with other calls to the strtok
19419  function.<sup><a href="#note311"><b>311)</b></a></sup> The implementation shall behave as if no library function calls the strtok
19420  function.
19421 <p><b>Returns</b>
19422 <p><a name="7.24.5.8p7" href="#7.24.5.8p7"><small>7</small></a>
19423  The strtok function returns a pointer to the first character of a token, or a null pointer
19424  if there is no token.
19425 <p><a name="7.24.5.8p8" href="#7.24.5.8p8"><small>8</small></a>
19426  EXAMPLE
19427 <pre>
19428          #include <a href="#7.24">&lt;string.h&gt;</a>
19429          static char str[] = "?a???b,,,#c";
19430          char *t;
19431          t   =   strtok(str, "?");         //   t   points to the token "a"
19432          t   =   strtok(NULL, ",");        //   t   points to the token "??b"
19433          t   =   strtok(NULL, "#,");       //   t   points to the token "c"
19434          t   =   strtok(NULL, "?");        //   t   is a null pointer
19435 </pre>
19436  
19437 <p><b> Forward references</b>: The strtok_s function (<a href="#K.3.7.3.1">K.3.7.3.1</a>).
19438  
19439  
19440  
19441  
19442 <!--page 389 -->
19443
19444 <p><b>Footnotes</b>
19445 <p><small><a name="note311" href="#note311">311)</a> The strtok_s function can be used instead to avoid data races.
19446 </small>
19447
19448 <p><small><a href="#Contents">Contents</a></small>
19449 <h4><a name="7.24.6" href="#7.24.6">7.24.6 Miscellaneous functions</a></h4>
19450
19451 <p><small><a href="#Contents">Contents</a></small>
19452 <h5><a name="7.24.6.1" href="#7.24.6.1">7.24.6.1 The memset function</a></h5>
19453 <p><b>Synopsis</b>
19454 <p><a name="7.24.6.1p1" href="#7.24.6.1p1"><small>1</small></a>
19455 <pre>
19456          #include <a href="#7.24">&lt;string.h&gt;</a>
19457          void *memset(void *s, int c, size_t n);
19458 </pre>
19459 <p><b>Description</b>
19460 <p><a name="7.24.6.1p2" href="#7.24.6.1p2"><small>2</small></a>
19461  The memset function copies the value of c (converted to an unsigned char) into
19462  each of the first n characters of the object pointed to by s.
19463 <p><b>Returns</b>
19464 <p><a name="7.24.6.1p3" href="#7.24.6.1p3"><small>3</small></a>
19465  The memset function returns the value of s.
19466
19467 <p><small><a href="#Contents">Contents</a></small>
19468 <h5><a name="7.24.6.2" href="#7.24.6.2">7.24.6.2 The strerror function</a></h5>
19469 <p><b>Synopsis</b>
19470 <p><a name="7.24.6.2p1" href="#7.24.6.2p1"><small>1</small></a>
19471 <pre>
19472          #include <a href="#7.24">&lt;string.h&gt;</a>
19473          char *strerror(int errnum);
19474 </pre>
19475 <p><b>Description</b>
19476 <p><a name="7.24.6.2p2" href="#7.24.6.2p2"><small>2</small></a>
19477  The strerror function maps the number in errnum to a message string. Typically,
19478  the values for errnum come from errno, but strerror shall map any value of type
19479  int to a message.
19480 <p><a name="7.24.6.2p3" href="#7.24.6.2p3"><small>3</small></a>
19481  The strerror function is not required to avoid data races with other calls to the
19482  strerror function.<sup><a href="#note312"><b>312)</b></a></sup> The implementation shall behave as if no library function calls
19483  the strerror function.
19484 <p><b>Returns</b>
19485 <p><a name="7.24.6.2p4" href="#7.24.6.2p4"><small>4</small></a>
19486  The strerror function returns a pointer to the string, the contents of which are locale-
19487  specific. The array pointed to shall not be modified by the program, but may be
19488  overwritten by a subsequent call to the strerror function.
19489 <p><b> Forward references</b>: The strerror_s function (<a href="#K.3.7.4.2">K.3.7.4.2</a>).
19490  
19491  
19492  
19493  
19494 <!--page 390 -->
19495
19496 <p><b>Footnotes</b>
19497 <p><small><a name="note312" href="#note312">312)</a> The strerror_s function can be used instead to avoid data races.
19498 </small>
19499
19500 <p><small><a href="#Contents">Contents</a></small>
19501 <h5><a name="7.24.6.3" href="#7.24.6.3">7.24.6.3 The strlen function</a></h5>
19502 <p><b>Synopsis</b>
19503 <p><a name="7.24.6.3p1" href="#7.24.6.3p1"><small>1</small></a>
19504 <pre>
19505         #include <a href="#7.24">&lt;string.h&gt;</a>
19506         size_t strlen(const char *s);
19507 </pre>
19508 <p><b>Description</b>
19509 <p><a name="7.24.6.3p2" href="#7.24.6.3p2"><small>2</small></a>
19510  The strlen function computes the length of the string pointed to by s.
19511 <p><b>Returns</b>
19512 <p><a name="7.24.6.3p3" href="#7.24.6.3p3"><small>3</small></a>
19513  The strlen function returns the number of characters that precede the terminating null
19514  character.
19515 <!--page 391 -->
19516
19517 <p><small><a href="#Contents">Contents</a></small>
19518 <h3><a name="7.25" href="#7.25">7.25 Type-generic math &lt;tgmath.h&gt;</a></h3>
19519 <p><a name="7.25p1" href="#7.25p1"><small>1</small></a>
19520  The header <a href="#7.25">&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
19521  defines several type-generic macros.
19522 <p><a name="7.25p2" href="#7.25p2"><small>2</small></a>
19523  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
19524  double) suffix, several have one or more parameters whose corresponding real type is
19525  double. For each such function, except modf, there is a corresponding type-generic
19526  macro.<sup><a href="#note313"><b>313)</b></a></sup> The parameters whose corresponding real type is double in the function
19527  synopsis are generic parameters. Use of the macro invokes a function whose
19528  corresponding real type and type domain are determined by the arguments for the generic
19529  parameters.<sup><a href="#note314"><b>314)</b></a></sup>
19530 <p><a name="7.25p3" href="#7.25p3"><small>3</small></a>
19531  Use of the macro invokes a function whose generic parameters have the corresponding
19532  real type determined as follows:
19533 <ul>
19534 <li>  First, if any argument for generic parameters has type long double, the type
19535  determined is long double.
19536 <li>  Otherwise, if any argument for generic parameters has type double or is of integer
19537  type, the type determined is double.
19538 <li>  Otherwise, the type determined is float.
19539 </ul>
19540 <p><a name="7.25p4" href="#7.25p4"><small>4</small></a>
19541  For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
19542  <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
19543  generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
19544  corresponding type-generic macro for fabs and cabs is fabs.
19545  
19546  
19547  
19548  
19549 <!--page 392 -->
19550 <pre>
19551          <a href="#7.12">&lt;math.h&gt;</a>          <a href="#7.3">&lt;complex.h&gt;</a>              type-generic
19552           function            function                 macro
19553           acos               cacos                    acos
19554           asin               casin                    asin
19555           atan               catan                    atan
19556           acosh              cacosh                   acosh
19557           asinh              casinh                   asinh
19558           atanh              catanh                   atanh
19559           cos                ccos                     cos
19560           sin                csin                     sin
19561           tan                ctan                     tan
19562           cosh               ccosh                    cosh
19563           sinh               csinh                    sinh
19564           tanh               ctanh                    tanh
19565           exp                cexp                     exp
19566           log                clog                     log
19567           pow                cpow                     pow
19568           sqrt               csqrt                    sqrt
19569           fabs               cabs                     fabs
19570 </pre>
19571  If at least one argument for a generic parameter is complex, then use of the macro invokes
19572  a complex function; otherwise, use of the macro invokes a real function.
19573 <p><a name="7.25p5" href="#7.25p5"><small>5</small></a>
19574  For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
19575  <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
19576  name as the function. These type-generic macros are:
19577 <pre>
19578        atan2                fma                  llround              remainder
19579        cbrt                 fmax                 log10                remquo
19580        ceil                 fmin                 log1p                rint
19581        copysign             fmod                 log2                 round
19582        erf                  frexp                logb                 scalbn
19583        erfc                 hypot                lrint                scalbln
19584        exp2                 ilogb                lround               tgamma
19585        expm1                ldexp                nearbyint            trunc
19586        fdim                 lgamma               nextafter
19587        floor                llrint               nexttoward
19588 </pre>
19589  If all arguments for generic parameters are real, then use of the macro invokes a real
19590  function; otherwise, use of the macro results in undefined behavior.
19591 <!--page 393 -->
19592 <p><a name="7.25p6" href="#7.25p6"><small>6</small></a>
19593  For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
19594  function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
19595  function. These type-generic macros are:
19596 <pre>
19597          carg                    conj                     creal
19598          cimag                   cproj
19599 </pre>
19600  Use of the macro with any real or complex argument invokes a complex function.
19601 <p><a name="7.25p7" href="#7.25p7"><small>7</small></a>
19602  EXAMPLE       With the declarations
19603 <pre>
19604          #include <a href="#7.25">&lt;tgmath.h&gt;</a>
19605          int n;
19606          float f;
19607          double d;
19608          long double ld;
19609          float complex fc;
19610          double complex dc;
19611          long double complex ldc;
19612 </pre>
19613  functions invoked by use of type-generic macros are shown in the following table:
19614 <!--page 394 -->
19615 <pre>
19616                   macro use                                  invokes
19617              exp(n)                              exp(n), the function
19618              acosh(f)                            acoshf(f)
19619              sin(d)                              sin(d), the function
19620              atan(ld)                            atanl(ld)
19621              log(fc)                             clogf(fc)
19622              sqrt(dc)                            csqrt(dc)
19623              pow(ldc, f)                         cpowl(ldc, f)
19624              remainder(n, n)                     remainder(n, n), the function
19625              nextafter(d, f)                     nextafter(d, f), the function
19626              nexttoward(f, ld)                   nexttowardf(f, ld)
19627              copysign(n, ld)                     copysignl(n, ld)
19628              ceil(fc)                            undefined behavior
19629              rint(dc)                            undefined behavior
19630              fmax(ldc, ld)                       undefined behavior
19631              carg(n)                             carg(n), the function
19632              cproj(f)                            cprojf(f)
19633              creal(d)                            creal(d), the function
19634              cimag(ld)                           cimagl(ld)
19635              fabs(fc)                            cabsf(fc)
19636              carg(dc)                            carg(dc), the function
19637              cproj(ldc)                          cprojl(ldc)
19638 </pre>
19639
19640 <p><b>Footnotes</b>
19641 <p><small><a name="note313" href="#note313">313)</a> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
19642  make available the corresponding ordinary function.
19643 </small>
19644 <p><small><a name="note314" href="#note314">314)</a> If the type of the argument is not compatible with the type of the parameter for the selected function,
19645  the behavior is undefined.
19646 </small>
19647
19648 <p><small><a href="#Contents">Contents</a></small>
19649 <h3><a name="7.26" href="#7.26">7.26 Threads &lt;threads.h&gt;</a></h3>
19650
19651 <p><small><a href="#Contents">Contents</a></small>
19652 <h4><a name="7.26.1" href="#7.26.1">7.26.1 Introduction</a></h4>
19653 <p><a name="7.26.1p1" href="#7.26.1p1"><small>1</small></a>
19654  The header <a href="#7.26">&lt;threads.h&gt;</a> includes the header <a href="#7.27">&lt;time.h&gt;</a>, defines macros, and
19655  declares types, enumeration constants, and functions that support multiple threads of
19656  execution.<sup><a href="#note315"><b>315)</b></a></sup>
19657 <p><a name="7.26.1p2" href="#7.26.1p2"><small>2</small></a>
19658  Implementations that define the macro __STDC_NO_THREADS__ need not provide
19659  this header nor support any of its facilities.
19660 <p><a name="7.26.1p3" href="#7.26.1p3"><small>3</small></a>
19661  The macros are
19662 <pre>
19663           thread_local
19664 </pre>
19665  which expands to _Thread_local;
19666 <pre>
19667           ONCE_FLAG_INIT
19668 </pre>
19669  which expands to a value that can be used to initialize an object of type once_flag;
19670  and
19671 <pre>
19672           TSS_DTOR_ITERATIONS
19673 </pre>
19674  which expands to an integer constant expression representing the maximum number of
19675  times that destructors will be called when a thread terminates.
19676 <p><a name="7.26.1p4" href="#7.26.1p4"><small>4</small></a>
19677  The types are
19678 <pre>
19679           cnd_t
19680 </pre>
19681  which is a complete object type that holds an identifier for a condition variable;
19682 <pre>
19683           thrd_t
19684 </pre>
19685  which is a complete object type that holds an identifier for a thread;
19686 <pre>
19687           tss_t
19688 </pre>
19689  which is a complete object type that holds an identifier for a thread-specific storage
19690  pointer;
19691 <pre>
19692           mtx_t
19693 </pre>
19694  which is a complete object type that holds an identifier for a mutex;
19695 <pre>
19696           tss_dtor_t
19697 </pre>
19698  which is the function pointer type void (*)(void*), used for a destructor for a
19699  thread-specific storage pointer;
19700  
19701  
19702  
19703 <!--page 395 -->
19704 <pre>
19705          thrd_start_t
19706 </pre>
19707  which is the function pointer type int (*)(void*) that is passed to thrd_create
19708  to create a new thread; and
19709 <pre>
19710            once_flag
19711 </pre>
19712  which is a complete object type that holds a flag for use by call_once.
19713 <p><a name="7.26.1p5" href="#7.26.1p5"><small>5</small></a>
19714  The enumeration constants are
19715 <pre>
19716          mtx_plain
19717 </pre>
19718  which is passed to mtx_init to create a mutex object that supports neither timeout nor
19719  test and return;
19720 <pre>
19721            mtx_recursive
19722 </pre>
19723  which is passed to mtx_init to create a mutex object that supports recursive locking;
19724 <pre>
19725            mtx_timed
19726 </pre>
19727  which is passed to mtx_init to create a mutex object that supports timeout;
19728 <pre>
19729          thrd_timedout
19730 </pre>
19731  which is returned by a timed wait function to indicate that the time specified in the call
19732  was reached without acquiring the requested resource;
19733 <pre>
19734          thrd_success
19735 </pre>
19736  which is returned by a function to indicate that the requested operation succeeded;
19737 <pre>
19738          thrd_busy
19739 </pre>
19740  which is returned by a function to indicate that the requested operation failed because a
19741  resource requested by a test and return function is already in use;
19742 <pre>
19743          thrd_error
19744 </pre>
19745  which is returned by a function to indicate that the requested operation failed; and
19746 <pre>
19747          thrd_nomem
19748 </pre>
19749  which is returned by a function to indicate that the requested operation failed because it
19750  was unable to allocate memory.
19751 <p><b> Forward references</b>: date and time (<a href="#7.27">7.27</a>).
19752 <!--page 396 -->
19753
19754 <p><b>Footnotes</b>
19755 <p><small><a name="note315" href="#note315">315)</a> See ''future library directions'' (<a href="#7.31.15">7.31.15</a>).
19756 </small>
19757
19758 <p><small><a href="#Contents">Contents</a></small>
19759 <h4><a name="7.26.2" href="#7.26.2">7.26.2 Initialization functions</a></h4>
19760
19761 <p><small><a href="#Contents">Contents</a></small>
19762 <h5><a name="7.26.2.1" href="#7.26.2.1">7.26.2.1 The call_once function</a></h5>
19763 <p><b>Synopsis</b>
19764 <p><a name="7.26.2.1p1" href="#7.26.2.1p1"><small>1</small></a>
19765 <pre>
19766         #include <a href="#7.26">&lt;threads.h&gt;</a>
19767         void call_once(once_flag *flag, void (*func)(void));
19768 </pre>
19769 <p><b>Description</b>
19770 <p><a name="7.26.2.1p2" href="#7.26.2.1p2"><small>2</small></a>
19771  The call_once function uses the once_flag pointed to by flag to ensure that
19772  func is called exactly once, the first time the call_once function is called with that
19773  value of flag. Completion of an effective call to the call_once function synchronizes
19774  with all subsequent calls to the call_once function with the same value of flag.
19775 <p><b>Returns</b>
19776 <p><a name="7.26.2.1p3" href="#7.26.2.1p3"><small>3</small></a>
19777  The call_once function returns no value.
19778
19779 <p><small><a href="#Contents">Contents</a></small>
19780 <h4><a name="7.26.3" href="#7.26.3">7.26.3 Condition variable functions</a></h4>
19781
19782 <p><small><a href="#Contents">Contents</a></small>
19783 <h5><a name="7.26.3.1" href="#7.26.3.1">7.26.3.1 The cnd_broadcast function</a></h5>
19784 <p><b>Synopsis</b>
19785 <p><a name="7.26.3.1p1" href="#7.26.3.1p1"><small>1</small></a>
19786 <pre>
19787         #include <a href="#7.26">&lt;threads.h&gt;</a>
19788         int cnd_broadcast(cnd_t *cond);
19789 </pre>
19790 <p><b>Description</b>
19791 <p><a name="7.26.3.1p2" href="#7.26.3.1p2"><small>2</small></a>
19792  The cnd_broadcast function unblocks all of the threads that are blocked on the
19793  condition variable pointed to by cond at the time of the call. If no threads are blocked
19794  on the condition variable pointed to by cond at the time of the call, the function does
19795  nothing.
19796 <p><b>Returns</b>
19797 <p><a name="7.26.3.1p3" href="#7.26.3.1p3"><small>3</small></a>
19798  The cnd_broadcast function returns thrd_success on success, or thrd_error
19799  if the request could not be honored.
19800
19801 <p><small><a href="#Contents">Contents</a></small>
19802 <h5><a name="7.26.3.2" href="#7.26.3.2">7.26.3.2 The cnd_destroy function</a></h5>
19803 <p><b>Synopsis</b>
19804 <p><a name="7.26.3.2p1" href="#7.26.3.2p1"><small>1</small></a>
19805 <pre>
19806         #include <a href="#7.26">&lt;threads.h&gt;</a>
19807         void cnd_destroy(cnd_t *cond);
19808 </pre>
19809 <p><b>Description</b>
19810 <p><a name="7.26.3.2p2" href="#7.26.3.2p2"><small>2</small></a>
19811  The cnd_destroy function releases all resources used by the condition variable
19812  pointed to by cond. The cnd_destroy function requires that no threads be blocked
19813  waiting for the condition variable pointed to by cond.
19814 <!--page 397 -->
19815 <p><b>Returns</b>
19816 <p><a name="7.26.3.2p3" href="#7.26.3.2p3"><small>3</small></a>
19817  The cnd_destroy function returns no value.
19818
19819 <p><small><a href="#Contents">Contents</a></small>
19820 <h5><a name="7.26.3.3" href="#7.26.3.3">7.26.3.3 The cnd_init function</a></h5>
19821 <p><b>Synopsis</b>
19822 <p><a name="7.26.3.3p1" href="#7.26.3.3p1"><small>1</small></a>
19823 <pre>
19824          #include <a href="#7.26">&lt;threads.h&gt;</a>
19825          int cnd_init(cnd_t *cond);
19826 </pre>
19827 <p><b>Description</b>
19828 <p><a name="7.26.3.3p2" href="#7.26.3.3p2"><small>2</small></a>
19829  The cnd_init function creates a condition variable. If it succeeds it sets the variable
19830  pointed to by cond to a value that uniquely identifies the newly created condition
19831  variable. A thread that calls cnd_wait on a newly created condition variable will
19832  block.
19833 <p><b>Returns</b>
19834 <p><a name="7.26.3.3p3" href="#7.26.3.3p3"><small>3</small></a>
19835  The cnd_init function returns thrd_success on success, or thrd_nomem if no
19836  memory could be allocated for the newly created condition, or thrd_error if the
19837  request could not be honored.
19838
19839 <p><small><a href="#Contents">Contents</a></small>
19840 <h5><a name="7.26.3.4" href="#7.26.3.4">7.26.3.4 The cnd_signal function</a></h5>
19841 <p><b>Synopsis</b>
19842 <p><a name="7.26.3.4p1" href="#7.26.3.4p1"><small>1</small></a>
19843 <pre>
19844          #include <a href="#7.26">&lt;threads.h&gt;</a>
19845          int cnd_signal(cnd_t *cond);
19846 </pre>
19847 <p><b>Description</b>
19848 <p><a name="7.26.3.4p2" href="#7.26.3.4p2"><small>2</small></a>
19849  The cnd_signal function unblocks one of the threads that are blocked on the
19850  condition variable pointed to by cond at the time of the call. If no threads are blocked
19851  on the condition variable at the time of the call, the function does nothing and return
19852  success.
19853 <p><b>Returns</b>
19854 <p><a name="7.26.3.4p3" href="#7.26.3.4p3"><small>3</small></a>
19855  The cnd_signal function returns thrd_success on success or thrd_error if
19856  the request could not be honored.
19857
19858 <p><small><a href="#Contents">Contents</a></small>
19859 <h5><a name="7.26.3.5" href="#7.26.3.5">7.26.3.5 The cnd_timedwait function</a></h5>
19860 <p><b>Synopsis</b>
19861 <p><a name="7.26.3.5p1" href="#7.26.3.5p1"><small>1</small></a>
19862 <!--page 398 -->
19863 <pre>
19864          #include <a href="#7.26">&lt;threads.h&gt;</a>
19865          int cnd_timedwait(cnd_t *restrict cond,
19866               mtx_t *restrict mtx,
19867               const struct timespec *restrict ts);
19868 </pre>
19869 <p><b>Description</b>
19870 <p><a name="7.26.3.5p2" href="#7.26.3.5p2"><small>2</small></a>
19871  The cnd_timedwait function atomically unlocks the mutex pointed to by mtx and
19872  endeavors to block until the condition variable pointed to by cond is signaled by a call to
19873  cnd_signal or to cnd_broadcast, or until after the TIME_UTC-based calendar
19874  time pointed to by ts. When the calling thread becomes unblocked it locks the variable
19875  pointed to by mtx before it returns. The cnd_timedwait function requires that the
19876  mutex pointed to by mtx be locked by the calling thread.
19877 <p><b>Returns</b>
19878 <p><a name="7.26.3.5p3" href="#7.26.3.5p3"><small>3</small></a>
19879  The cnd_timedwait function returns thrd_success upon success, or
19880  thrd_timedout if the time specified in the call was reached without acquiring the
19881  requested resource, or thrd_error if the request could not be honored.
19882
19883 <p><small><a href="#Contents">Contents</a></small>
19884 <h5><a name="7.26.3.6" href="#7.26.3.6">7.26.3.6 The cnd_wait function</a></h5>
19885 <p><b>Synopsis</b>
19886 <p><a name="7.26.3.6p1" href="#7.26.3.6p1"><small>1</small></a>
19887 <pre>
19888         #include <a href="#7.26">&lt;threads.h&gt;</a>
19889         int cnd_wait(cnd_t *cond, mtx_t *mtx);
19890 </pre>
19891 <p><b>Description</b>
19892 <p><a name="7.26.3.6p2" href="#7.26.3.6p2"><small>2</small></a>
19893  The cnd_wait function atomically unlocks the mutex pointed to by mtx and endeavors
19894  to block until the condition variable pointed to by cond is signaled by a call to
19895  cnd_signal or to cnd_broadcast. When the calling thread becomes unblocked it
19896  locks the mutex pointed to by mtx before it returns. The cnd_wait function requires
19897  that the mutex pointed to by mtx be locked by the calling thread.
19898 <p><b>Returns</b>
19899 <p><a name="7.26.3.6p3" href="#7.26.3.6p3"><small>3</small></a>
19900  The cnd_wait function returns thrd_success on success or thrd_error if the
19901  request could not be honored.
19902
19903 <p><small><a href="#Contents">Contents</a></small>
19904 <h4><a name="7.26.4" href="#7.26.4">7.26.4 Mutex functions</a></h4>
19905
19906 <p><small><a href="#Contents">Contents</a></small>
19907 <h5><a name="7.26.4.1" href="#7.26.4.1">7.26.4.1 The mtx_destroy function</a></h5>
19908 <p><b>Synopsis</b>
19909 <p><a name="7.26.4.1p1" href="#7.26.4.1p1"><small>1</small></a>
19910 <pre>
19911         #include <a href="#7.26">&lt;threads.h&gt;</a>
19912         void mtx_destroy(mtx_t *mtx);
19913 </pre>
19914 <p><b>Description</b>
19915 <p><a name="7.26.4.1p2" href="#7.26.4.1p2"><small>2</small></a>
19916  The mtx_destroy function releases any resources used by the mutex pointed to by
19917  mtx. No threads can be blocked waiting for the mutex pointed to by mtx.
19918 <p><b>Returns</b>
19919 <p><a name="7.26.4.1p3" href="#7.26.4.1p3"><small>3</small></a>
19920  The mtx_destroy function returns no value.
19921 <!--page 399 -->
19922
19923 <p><small><a href="#Contents">Contents</a></small>
19924 <h5><a name="7.26.4.2" href="#7.26.4.2">7.26.4.2 The mtx_init function</a></h5>
19925 <p><b>Synopsis</b>
19926 <p><a name="7.26.4.2p1" href="#7.26.4.2p1"><small>1</small></a>
19927 <pre>
19928          #include <a href="#7.26">&lt;threads.h&gt;</a>
19929          int mtx_init(mtx_t *mtx, int type);
19930 </pre>
19931 <p><b>Description</b>
19932 <p><a name="7.26.4.2p2" href="#7.26.4.2p2"><small>2</small></a>
19933  The mtx_init function creates a mutex object with properties indicated by type,
19934  which must have one of the six values:
19935  mtx_plain for a simple non-recursive mutex,
19936  mtx_timed for a non-recursive mutex that supports timeout,                      *
19937  mtx_plain | mtx_recursive for a simple recursive mutex, or
19938  mtx_timed | mtx_recursive for a recursive mutex that supports timeout.
19939 <p><a name="7.26.4.2p3" href="#7.26.4.2p3"><small>3</small></a>
19940  If the mtx_init function succeeds, it sets the mutex pointed to by mtx to a value that
19941  uniquely identifies the newly created mutex.
19942 <p><b>Returns</b>
19943 <p><a name="7.26.4.2p4" href="#7.26.4.2p4"><small>4</small></a>
19944  The mtx_init function returns thrd_success on success, or thrd_error if the
19945  request could not be honored.
19946
19947 <p><small><a href="#Contents">Contents</a></small>
19948 <h5><a name="7.26.4.3" href="#7.26.4.3">7.26.4.3 The mtx_lock function</a></h5>
19949 <p><b>Synopsis</b>
19950 <p><a name="7.26.4.3p1" href="#7.26.4.3p1"><small>1</small></a>
19951 <pre>
19952          #include <a href="#7.26">&lt;threads.h&gt;</a>
19953          int mtx_lock(mtx_t *mtx);
19954 </pre>
19955 <p><b>Description</b>
19956 <p><a name="7.26.4.3p2" href="#7.26.4.3p2"><small>2</small></a>
19957  The mtx_lock function blocks until it locks the mutex pointed to by mtx. If the mutex
19958  is non-recursive, it shall not be locked by the calling thread. Prior calls to mtx_unlock
19959  on the same mutex shall synchronize with this operation.
19960 <p><b>Returns</b>
19961 <p><a name="7.26.4.3p3" href="#7.26.4.3p3"><small>3</small></a>
19962  The mtx_lock function returns thrd_success on success, or thrd_error if the *
19963  request could not be honored.
19964
19965 <p><small><a href="#Contents">Contents</a></small>
19966 <h5><a name="7.26.4.4" href="#7.26.4.4">7.26.4.4 The mtx_timedlock function</a></h5>
19967 <p><b>Synopsis</b>
19968 <p><a name="7.26.4.4p1" href="#7.26.4.4p1"><small>1</small></a>
19969 <!--page 400 -->
19970 <pre>
19971          #include <a href="#7.26">&lt;threads.h&gt;</a>
19972          int mtx_timedlock(mtx_t *restrict mtx,
19973               const struct timespec *restrict ts);
19974 </pre>
19975 <p><b>Description</b>
19976 <p><a name="7.26.4.4p2" href="#7.26.4.4p2"><small>2</small></a>
19977  The mtx_timedlock function endeavors to block until it locks the mutex pointed to by
19978  mtx or until after the TIME_UTC-based calendar time pointed to by ts. The specified
19979  mutex shall support timeout. If the operation succeeds, prior calls to mtx_unlock on
19980  the same mutex shall synchronize with this operation.
19981 <p><b>Returns</b>
19982 <p><a name="7.26.4.4p3" href="#7.26.4.4p3"><small>3</small></a>
19983  The mtx_timedlock function returns thrd_success on success, or
19984  thrd_timedout if the time specified was reached without acquiring the requested
19985  resource, or thrd_error if the request could not be honored.
19986
19987 <p><small><a href="#Contents">Contents</a></small>
19988 <h5><a name="7.26.4.5" href="#7.26.4.5">7.26.4.5 The mtx_trylock function</a></h5>
19989 <p><b>Synopsis</b>
19990 <p><a name="7.26.4.5p1" href="#7.26.4.5p1"><small>1</small></a>
19991 <pre>
19992         #include <a href="#7.26">&lt;threads.h&gt;</a>
19993         int mtx_trylock(mtx_t *mtx);
19994 </pre>
19995 <p><b>Description</b>
19996 <p><a name="7.26.4.5p2" href="#7.26.4.5p2"><small>2</small></a>
19997  The mtx_trylock function endeavors to lock the mutex pointed to by mtx. If the *
19998  mutex is already locked, the function returns without blocking. If the operation succeeds,
19999  prior calls to mtx_unlock on the same mutex shall synchronize with this operation.
20000 <p><b>Returns</b>
20001 <p><a name="7.26.4.5p3" href="#7.26.4.5p3"><small>3</small></a>
20002  The mtx_trylock function returns thrd_success on success, or thrd_busy if
20003  the resource requested is already in use, or thrd_error if the request could not be
20004  honored.
20005
20006 <p><small><a href="#Contents">Contents</a></small>
20007 <h5><a name="7.26.4.6" href="#7.26.4.6">7.26.4.6 The mtx_unlock function</a></h5>
20008 <p><b>Synopsis</b>
20009 <p><a name="7.26.4.6p1" href="#7.26.4.6p1"><small>1</small></a>
20010 <pre>
20011         #include <a href="#7.26">&lt;threads.h&gt;</a>
20012         int mtx_unlock(mtx_t *mtx);
20013 </pre>
20014 <p><b>Description</b>
20015 <p><a name="7.26.4.6p2" href="#7.26.4.6p2"><small>2</small></a>
20016  The mtx_unlock function unlocks the mutex pointed to by mtx. The mutex pointed to
20017  by mtx shall be locked by the calling thread.
20018 <p><b>Returns</b>
20019 <p><a name="7.26.4.6p3" href="#7.26.4.6p3"><small>3</small></a>
20020  The mtx_unlock function returns thrd_success on success or thrd_error if
20021  the request could not be honored.
20022 <!--page 401 -->
20023
20024 <p><small><a href="#Contents">Contents</a></small>
20025 <h4><a name="7.26.5" href="#7.26.5">7.26.5 Thread functions</a></h4>
20026
20027 <p><small><a href="#Contents">Contents</a></small>
20028 <h5><a name="7.26.5.1" href="#7.26.5.1">7.26.5.1 The thrd_create function</a></h5>
20029 <p><b>Synopsis</b>
20030 <p><a name="7.26.5.1p1" href="#7.26.5.1p1"><small>1</small></a>
20031 <pre>
20032          #include <a href="#7.26">&lt;threads.h&gt;</a>
20033          int thrd_create(thrd_t *thr, thrd_start_t func,
20034               void *arg);
20035 </pre>
20036 <p><b>Description</b>
20037 <p><a name="7.26.5.1p2" href="#7.26.5.1p2"><small>2</small></a>
20038  The thrd_create function creates a new thread executing func(arg). If the
20039  thrd_create function succeeds, it sets the object pointed to by thr to the identifier of
20040  the newly created thread. (A thread's identifier may be reused for a different thread once
20041  the original thread has exited and either been detached or joined to another thread.) The
20042  completion of the thrd_create function synchronizes with the beginning of the
20043  execution of the new thread.
20044 <p><b>Returns</b>
20045 <p><a name="7.26.5.1p3" href="#7.26.5.1p3"><small>3</small></a>
20046  The thrd_create function returns thrd_success on success, or thrd_nomem if
20047  no memory could be allocated for the thread requested, or thrd_error if the request
20048  could not be honored.
20049
20050 <p><small><a href="#Contents">Contents</a></small>
20051 <h5><a name="7.26.5.2" href="#7.26.5.2">7.26.5.2 The thrd_current function</a></h5>
20052 <p><b>Synopsis</b>
20053 <p><a name="7.26.5.2p1" href="#7.26.5.2p1"><small>1</small></a>
20054 <pre>
20055          #include <a href="#7.26">&lt;threads.h&gt;</a>
20056          thrd_t thrd_current(void);
20057 </pre>
20058 <p><b>Description</b>
20059 <p><a name="7.26.5.2p2" href="#7.26.5.2p2"><small>2</small></a>
20060  The thrd_current function identifies the thread that called it.
20061 <p><b>Returns</b>
20062 <p><a name="7.26.5.2p3" href="#7.26.5.2p3"><small>3</small></a>
20063  The thrd_current function returns the identifier of the thread that called it.
20064
20065 <p><small><a href="#Contents">Contents</a></small>
20066 <h5><a name="7.26.5.3" href="#7.26.5.3">7.26.5.3 The thrd_detach function</a></h5>
20067 <p><b>Synopsis</b>
20068 <p><a name="7.26.5.3p1" href="#7.26.5.3p1"><small>1</small></a>
20069 <pre>
20070          #include <a href="#7.26">&lt;threads.h&gt;</a>
20071          int thrd_detach(thrd_t thr);
20072 </pre>
20073 <p><b>Description</b>
20074 <p><a name="7.26.5.3p2" href="#7.26.5.3p2"><small>2</small></a>
20075  The thrd_detach function tells the operating system to dispose of any resources
20076  allocated to the thread identified by thr when that thread terminates. The thread
20077  identified by thr shall not have been previously detached or joined with another thread.
20078 <!--page 402 -->
20079 <p><b>Returns</b>
20080 <p><a name="7.26.5.3p3" href="#7.26.5.3p3"><small>3</small></a>
20081  The thrd_detach function returns thrd_success on success or thrd_error if
20082  the request could not be honored.
20083
20084 <p><small><a href="#Contents">Contents</a></small>
20085 <h5><a name="7.26.5.4" href="#7.26.5.4">7.26.5.4 The thrd_equal function</a></h5>
20086 <p><b>Synopsis</b>
20087 <p><a name="7.26.5.4p1" href="#7.26.5.4p1"><small>1</small></a>
20088 <pre>
20089         #include <a href="#7.26">&lt;threads.h&gt;</a>
20090         int thrd_equal(thrd_t thr0, thrd_t thr1);
20091 </pre>
20092 <p><b>Description</b>
20093 <p><a name="7.26.5.4p2" href="#7.26.5.4p2"><small>2</small></a>
20094  The thrd_equal function will determine whether the thread identified by thr0 refers
20095  to the thread identified by thr1.
20096 <p><b>Returns</b>
20097 <p><a name="7.26.5.4p3" href="#7.26.5.4p3"><small>3</small></a>
20098  The thrd_equal function returns zero if the thread thr0 and the thread thr1 refer to
20099  different threads. Otherwise the thrd_equal function returns a nonzero value.
20100
20101 <p><small><a href="#Contents">Contents</a></small>
20102 <h5><a name="7.26.5.5" href="#7.26.5.5">7.26.5.5 The thrd_exit function</a></h5>
20103 <p><b>Synopsis</b>
20104 <p><a name="7.26.5.5p1" href="#7.26.5.5p1"><small>1</small></a>
20105 <pre>
20106         #include <a href="#7.26">&lt;threads.h&gt;</a>
20107         _Noreturn void thrd_exit(int res);
20108 </pre>
20109 <p><b>Description</b>
20110 <p><a name="7.26.5.5p2" href="#7.26.5.5p2"><small>2</small></a>
20111  The thrd_exit function terminates execution of the calling thread and sets its result
20112  code to res.
20113 <p><a name="7.26.5.5p3" href="#7.26.5.5p3"><small>3</small></a>
20114  The program shall terminate normally after the last thread has been terminated. The
20115  behavior shall be as if the program called the exit function with the status
20116  EXIT_SUCCESS at thread termination time.
20117 <p><b>Returns</b>
20118 <p><a name="7.26.5.5p4" href="#7.26.5.5p4"><small>4</small></a>
20119  The thrd_exit function returns no value.
20120
20121 <p><small><a href="#Contents">Contents</a></small>
20122 <h5><a name="7.26.5.6" href="#7.26.5.6">7.26.5.6 The thrd_join function</a></h5>
20123 <p><b>Synopsis</b>
20124 <p><a name="7.26.5.6p1" href="#7.26.5.6p1"><small>1</small></a>
20125 <pre>
20126         #include <a href="#7.26">&lt;threads.h&gt;</a>
20127         int thrd_join(thrd_t thr, int *res);
20128 </pre>
20129 <p><b>Description</b>
20130 <p><a name="7.26.5.6p2" href="#7.26.5.6p2"><small>2</small></a>
20131  The thrd_join function joins the thread identified by thr with the current thread by
20132  blocking until the other thread has terminated. If the parameter res is not a null pointer,
20133  it stores the thread's result code in the integer pointed to by res. The termination of the
20134 <!--page 403 -->
20135  other thread synchronizes with the completion of the thrd_join function. The thread
20136  identified by thr shall not have been previously detached or joined with another thread.
20137 <p><b>Returns</b>
20138 <p><a name="7.26.5.6p3" href="#7.26.5.6p3"><small>3</small></a>
20139  The thrd_join function returns thrd_success on success or thrd_error if the
20140  request could not be honored.
20141
20142 <p><small><a href="#Contents">Contents</a></small>
20143 <h5><a name="7.26.5.7" href="#7.26.5.7">7.26.5.7 The thrd_sleep function</a></h5>
20144 <p><b>Synopsis</b>
20145 <p><a name="7.26.5.7p1" href="#7.26.5.7p1"><small>1</small></a>
20146 <pre>
20147          #include <a href="#7.26">&lt;threads.h&gt;</a>
20148          int thrd_sleep(const struct timespec *duration,
20149               struct timespec *remaining);
20150 </pre>
20151 <p><b>Description</b>
20152 <p><a name="7.26.5.7p2" href="#7.26.5.7p2"><small>2</small></a>
20153  The thrd_sleep function suspends execution of the calling thread until either the
20154  interval specified by duration has elapsed or a signal which is not being ignored is
20155  received. If interrupted by a signal and the remaining argument is not null, the
20156  amount of time remaining (the requested interval minus the time actually slept) is stored
20157  in the interval it points to. The duration and remaining arguments may point to the
20158  same object.
20159 <p><a name="7.26.5.7p3" href="#7.26.5.7p3"><small>3</small></a>
20160  The suspension time may be longer than requested because the interval is rounded up to
20161  an integer multiple of the sleep resolution or because of the scheduling of other activity
20162  by the system. But, except for the case of being interrupted by a signal, the suspension
20163  time shall not be less than that specified, as measured by the system clock TIME_UTC.
20164 <p><b>Returns</b>
20165 <p><a name="7.26.5.7p4" href="#7.26.5.7p4"><small>4</small></a>
20166  The thrd_sleep function returns zero if the requested time has elapsed, -1 if it has
20167  been interrupted by a signal, or a negative value if it fails.
20168
20169 <p><small><a href="#Contents">Contents</a></small>
20170 <h5><a name="7.26.5.8" href="#7.26.5.8">7.26.5.8 The thrd_yield function</a></h5>
20171 <p><b>Synopsis</b>
20172 <p><a name="7.26.5.8p1" href="#7.26.5.8p1"><small>1</small></a>
20173 <pre>
20174          #include <a href="#7.26">&lt;threads.h&gt;</a>
20175          void thrd_yield(void);
20176 </pre>
20177 <p><b>Description</b>
20178 <p><a name="7.26.5.8p2" href="#7.26.5.8p2"><small>2</small></a>
20179  The thrd_yield function endeavors to permit other threads to run, even if the current
20180  thread would ordinarily continue to run.
20181 <p><b>Returns</b>
20182 <p><a name="7.26.5.8p3" href="#7.26.5.8p3"><small>3</small></a>
20183  The thrd_yield function returns no value.
20184 <!--page 404 -->
20185
20186 <p><small><a href="#Contents">Contents</a></small>
20187 <h4><a name="7.26.6" href="#7.26.6">7.26.6 Thread-specific storage functions</a></h4>
20188
20189 <p><small><a href="#Contents">Contents</a></small>
20190 <h5><a name="7.26.6.1" href="#7.26.6.1">7.26.6.1 The tss_create function</a></h5>
20191 <p><b>Synopsis</b>
20192 <p><a name="7.26.6.1p1" href="#7.26.6.1p1"><small>1</small></a>
20193 <pre>
20194         #include <a href="#7.26">&lt;threads.h&gt;</a>
20195         int tss_create(tss_t *key, tss_dtor_t dtor);
20196 </pre>
20197 <p><b>Description</b>
20198 <p><a name="7.26.6.1p2" href="#7.26.6.1p2"><small>2</small></a>
20199  The tss_create function creates a thread-specific storage pointer with destructor
20200  dtor, which may be null.
20201 <p><b>Returns</b>
20202 <p><a name="7.26.6.1p3" href="#7.26.6.1p3"><small>3</small></a>
20203  If the tss_create function is successful, it sets the thread-specific storage pointed to
20204  by key to a value that uniquely identifies the newly created pointer and returns
20205  thrd_success; otherwise, thrd_error is returned and the thread-specific storage
20206  pointed to by key is set to an undefined value.
20207
20208 <p><small><a href="#Contents">Contents</a></small>
20209 <h5><a name="7.26.6.2" href="#7.26.6.2">7.26.6.2 The tss_delete function</a></h5>
20210 <p><b>Synopsis</b>
20211 <p><a name="7.26.6.2p1" href="#7.26.6.2p1"><small>1</small></a>
20212 <pre>
20213         #include <a href="#7.26">&lt;threads.h&gt;</a>
20214         void tss_delete(tss_t key);
20215 </pre>
20216 <p><b>Description</b>
20217 <p><a name="7.26.6.2p2" href="#7.26.6.2p2"><small>2</small></a>
20218  The tss_delete function releases any resources used by the thread-specific storage
20219  identified by key.
20220 <p><b>Returns</b>
20221 <p><a name="7.26.6.2p3" href="#7.26.6.2p3"><small>3</small></a>
20222  The tss_delete function returns no value.
20223
20224 <p><small><a href="#Contents">Contents</a></small>
20225 <h5><a name="7.26.6.3" href="#7.26.6.3">7.26.6.3 The tss_get function</a></h5>
20226 <p><b>Synopsis</b>
20227 <p><a name="7.26.6.3p1" href="#7.26.6.3p1"><small>1</small></a>
20228 <pre>
20229         #include <a href="#7.26">&lt;threads.h&gt;</a>
20230         void *tss_get(tss_t key);
20231 </pre>
20232 <p><b>Description</b>
20233 <p><a name="7.26.6.3p2" href="#7.26.6.3p2"><small>2</small></a>
20234  The tss_get function returns the value for the current thread held in the thread-specific
20235  storage identified by key.
20236 <p><b>Returns</b>
20237 <p><a name="7.26.6.3p3" href="#7.26.6.3p3"><small>3</small></a>
20238  The tss_get function returns the value for the current thread if successful, or zero if
20239  unsuccessful.
20240 <!--page 405 -->
20241
20242 <p><small><a href="#Contents">Contents</a></small>
20243 <h5><a name="7.26.6.4" href="#7.26.6.4">7.26.6.4 The tss_set function</a></h5>
20244 <p><b>Synopsis</b>
20245 <p><a name="7.26.6.4p1" href="#7.26.6.4p1"><small>1</small></a>
20246 <pre>
20247          #include <a href="#7.26">&lt;threads.h&gt;</a>
20248          int tss_set(tss_t key, void *val);
20249 </pre>
20250 <p><b>Description</b>
20251 <p><a name="7.26.6.4p2" href="#7.26.6.4p2"><small>2</small></a>
20252  The tss_set function sets the value for the current thread held in the thread-specific
20253  storage identified by key to val.
20254 <p><b>Returns</b>
20255 <p><a name="7.26.6.4p3" href="#7.26.6.4p3"><small>3</small></a>
20256  The tss_set function returns thrd_success on success or thrd_error if the
20257  request could not be honored.                                             *
20258 <!--page 406 -->
20259
20260 <p><small><a href="#Contents">Contents</a></small>
20261 <h3><a name="7.27" href="#7.27">7.27 Date and time &lt;time.h&gt;</a></h3>
20262
20263 <p><small><a href="#Contents">Contents</a></small>
20264 <h4><a name="7.27.1" href="#7.27.1">7.27.1 Components of time</a></h4>
20265 <p><a name="7.27.1p1" href="#7.27.1p1"><small>1</small></a>
20266  The header <a href="#7.27">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
20267  manipulating time. Many functions deal with a calendar time that represents the current
20268  date (according to the Gregorian calendar) and time. Some functions deal with local
20269  time, which is the calendar time expressed for some specific time zone, and with Daylight
20270  Saving Time, which is a temporary change in the algorithm for determining local time.
20271  The local time zone and Daylight Saving Time are implementation-defined.
20272 <p><a name="7.27.1p2" href="#7.27.1p2"><small>2</small></a>
20273  The macros defined are NULL (described in <a href="#7.19">7.19</a>);                                                            *
20274 <pre>
20275          CLOCKS_PER_SEC
20276 </pre>
20277  which expands to an expression with type clock_t (described below) that is the
20278  number per second of the value returned by the clock function; and
20279 <pre>
20280          TIME_UTC
20281 </pre>
20282  which expands to an integer constant greater than 0 that designates the UTC time
20283  base.<sup><a href="#note316"><b>316)</b></a></sup>
20284 <p><a name="7.27.1p3" href="#7.27.1p3"><small>3</small></a>
20285  The types declared are size_t (described in <a href="#7.19">7.19</a>);
20286 <pre>
20287          clock_t
20288 </pre>
20289  and
20290 <pre>
20291          time_t
20292 </pre>
20293  which are real types capable of representing times;
20294 <pre>
20295          struct timespec
20296 </pre>
20297  which holds an interval specified in seconds and nanoseconds (which may represent a
20298  calendar time based on a particular epoch); and
20299 <pre>
20300          struct tm
20301 </pre>
20302  which holds the components of a calendar time, called the broken-down time.
20303 <p><a name="7.27.1p4" href="#7.27.1p4"><small>4</small></a>
20304  The range and precision of times representable in clock_t and time_t are
20305  implementation-defined. The timespec structure shall contain at least the following
20306  members, in any order.<sup><a href="#note317"><b>317)</b></a></sup>
20307  
20308  
20309  
20310 <!--page 407 -->
20311 <pre>
20312          time_t tv_sec; // whole seconds -- &gt;= 0
20313          long   tv_nsec; // nanoseconds -- [0, 999999999]
20314 </pre>
20315  The tm structure shall contain at least the following members, in any order. The
20316  semantics of the members and their normal ranges are expressed in the comments.<sup><a href="#note318"><b>318)</b></a></sup>
20317 <pre>
20318          int    tm_sec;           //   seconds after the minute -- [0, 60]
20319          int    tm_min;           //   minutes after the hour -- [0, 59]
20320          int    tm_hour;          //   hours since midnight -- [0, 23]
20321          int    tm_mday;          //   day of the month -- [1, 31]
20322          int    tm_mon;           //   months since January -- [0, 11]
20323          int    tm_year;          //   years since 1900
20324          int    tm_wday;          //   days since Sunday -- [0, 6]
20325          int    tm_yday;          //   days since January 1 -- [0, 365]
20326          int    tm_isdst;         //   Daylight Saving Time flag
20327 </pre>
20328  The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
20329  Saving Time is not in effect, and negative if the information is not available.
20330
20331 <p><b>Footnotes</b>
20332 <p><small><a name="note316" href="#note316">316)</a> Implementations may define additional time bases, but are only required to support a real time clock
20333  based on UTC.
20334 </small>
20335 <p><small><a name="note317" href="#note317">317)</a> The tv_sec member is a linear count of seconds and may not have the normal semantics of a
20336  time_t. The semantics of the members and their normal ranges are expressed in the comments.
20337 </small>
20338 <p><small><a name="note318" href="#note318">318)</a> The range [0, 60] for tm_sec allows for a positive leap second.
20339 </small>
20340
20341 <p><small><a href="#Contents">Contents</a></small>
20342 <h4><a name="7.27.2" href="#7.27.2">7.27.2 Time manipulation functions</a></h4>
20343
20344 <p><small><a href="#Contents">Contents</a></small>
20345 <h5><a name="7.27.2.1" href="#7.27.2.1">7.27.2.1 The clock function</a></h5>
20346 <p><b>Synopsis</b>
20347 <p><a name="7.27.2.1p1" href="#7.27.2.1p1"><small>1</small></a>
20348 <pre>
20349          #include <a href="#7.27">&lt;time.h&gt;</a>
20350          clock_t clock(void);
20351 </pre>
20352 <p><b>Description</b>
20353 <p><a name="7.27.2.1p2" href="#7.27.2.1p2"><small>2</small></a>
20354  The clock function determines the processor time used.
20355 <p><b>Returns</b>
20356 <p><a name="7.27.2.1p3" href="#7.27.2.1p3"><small>3</small></a>
20357  The clock function returns the implementation's best approximation to the processor
20358  time used by the program since the beginning of an implementation-defined era related
20359  only to the program invocation. To determine the time in seconds, the value returned by
20360  the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
20361  the processor time used is not available or its value cannot be represented, the function
20362  returns the value (clock_t)(-1).<sup><a href="#note319"><b>319)</b></a></sup>
20363  
20364  
20365  
20366  
20367 <!--page 408 -->
20368
20369 <p><b>Footnotes</b>
20370 <p><small><a name="note319" href="#note319">319)</a> In order to measure the time spent in a program, the clock function should be called at the start of
20371  the program and its return value subtracted from the value returned by subsequent calls.
20372 </small>
20373
20374 <p><small><a href="#Contents">Contents</a></small>
20375 <h5><a name="7.27.2.2" href="#7.27.2.2">7.27.2.2 The difftime function</a></h5>
20376 <p><b>Synopsis</b>
20377 <p><a name="7.27.2.2p1" href="#7.27.2.2p1"><small>1</small></a>
20378 <pre>
20379          #include <a href="#7.27">&lt;time.h&gt;</a>
20380          double difftime(time_t time1, time_t time0);
20381 </pre>
20382 <p><b>Description</b>
20383 <p><a name="7.27.2.2p2" href="#7.27.2.2p2"><small>2</small></a>
20384  The difftime function computes the difference between two calendar times: time1 -
20385  time0.
20386 <p><b>Returns</b>
20387 <p><a name="7.27.2.2p3" href="#7.27.2.2p3"><small>3</small></a>
20388  The difftime function returns the difference expressed in seconds as a double.
20389
20390 <p><small><a href="#Contents">Contents</a></small>
20391 <h5><a name="7.27.2.3" href="#7.27.2.3">7.27.2.3 The mktime function</a></h5>
20392 <p><b>Synopsis</b>
20393 <p><a name="7.27.2.3p1" href="#7.27.2.3p1"><small>1</small></a>
20394 <pre>
20395          #include <a href="#7.27">&lt;time.h&gt;</a>
20396          time_t mktime(struct tm *timeptr);
20397 </pre>
20398 <p><b>Description</b>
20399 <p><a name="7.27.2.3p2" href="#7.27.2.3p2"><small>2</small></a>
20400  The mktime function converts the broken-down time, expressed as local time, in the
20401  structure pointed to by timeptr into a calendar time value with the same encoding as
20402  that of the values returned by the time function. The original values of the tm_wday
20403  and tm_yday components of the structure are ignored, and the original values of the
20404  other components are not restricted to the ranges indicated above.<sup><a href="#note320"><b>320)</b></a></sup> On successful
20405  completion, the values of the tm_wday and tm_yday components of the structure are
20406  set appropriately, and the other components are set to represent the specified calendar
20407  time, but with their values forced to the ranges indicated above; the final value of
20408  tm_mday is not set until tm_mon and tm_year are determined.
20409 <p><b>Returns</b>
20410 <p><a name="7.27.2.3p3" href="#7.27.2.3p3"><small>3</small></a>
20411  The mktime function returns the specified calendar time encoded as a value of type
20412  time_t. If the calendar time cannot be represented, the function returns the value
20413  (time_t)(-1).
20414 <p><a name="7.27.2.3p4" href="#7.27.2.3p4"><small>4</small></a>
20415  EXAMPLE       What day of the week is July 4, 2001?
20416  
20417  
20418  
20419  
20420 <!--page 409 -->
20421 <pre>
20422          #include <a href="#7.21">&lt;stdio.h&gt;</a>
20423          #include <a href="#7.27">&lt;time.h&gt;</a>
20424          static const char *const wday[] = {
20425                  "Sunday", "Monday", "Tuesday", "Wednesday",
20426                  "Thursday", "Friday", "Saturday", "-unknown-"
20427          };
20428          struct tm time_str;
20429          /* ... */
20430          time_str.tm_year   = 2001 - 1900;
20431          time_str.tm_mon    = 7 - 1;
20432          time_str.tm_mday   = 4;
20433          time_str.tm_hour   = 0;
20434          time_str.tm_min    = 0;
20435          time_str.tm_sec    = 1;
20436          time_str.tm_isdst = -1;
20437          if (mktime(&amp;time_str) == (time_t)(-1))
20438                time_str.tm_wday = 7;
20439          printf("%s\n", wday[time_str.tm_wday]);
20440 </pre>
20441  
20442
20443 <p><b>Footnotes</b>
20444 <p><small><a name="note320" href="#note320">320)</a> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
20445  Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
20446  causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
20447 </small>
20448
20449 <p><small><a href="#Contents">Contents</a></small>
20450 <h5><a name="7.27.2.4" href="#7.27.2.4">7.27.2.4 The time function</a></h5>
20451 <p><b>Synopsis</b>
20452 <p><a name="7.27.2.4p1" href="#7.27.2.4p1"><small>1</small></a>
20453 <pre>
20454          #include <a href="#7.27">&lt;time.h&gt;</a>
20455          time_t time(time_t *timer);
20456 </pre>
20457 <p><b>Description</b>
20458 <p><a name="7.27.2.4p2" href="#7.27.2.4p2"><small>2</small></a>
20459  The time function determines the current calendar time. The encoding of the value is
20460  unspecified.
20461 <p><b>Returns</b>
20462 <p><a name="7.27.2.4p3" href="#7.27.2.4p3"><small>3</small></a>
20463  The time function returns the implementation's best approximation to the current
20464  calendar time. The value (time_t)(-1) is returned if the calendar time is not
20465  available. If timer is not a null pointer, the return value is also assigned to the object it
20466  points to.
20467
20468 <p><small><a href="#Contents">Contents</a></small>
20469 <h5><a name="7.27.2.5" href="#7.27.2.5">7.27.2.5 The timespec_get function</a></h5>
20470 <p><b>Synopsis</b>
20471 <p><a name="7.27.2.5p1" href="#7.27.2.5p1"><small>1</small></a>
20472 <pre>
20473          #include <a href="#7.27">&lt;time.h&gt;</a>
20474          int timespec_get(struct timespec *ts, int base);
20475 </pre>
20476 <p><b>Description</b>
20477 <p><a name="7.27.2.5p2" href="#7.27.2.5p2"><small>2</small></a>
20478  The timespec_get function sets the interval pointed to by ts to hold the current
20479  calendar time based on the specified time base.
20480 <p><a name="7.27.2.5p3" href="#7.27.2.5p3"><small>3</small></a>
20481  If base is TIME_UTC, the tv_sec member is set to the number of seconds since an
20482  implementation defined epoch, truncated to a whole value and the tv_nsec member is
20483  set to the integral number of nanoseconds, rounded to the resolution of the system
20484 <!--page 410 -->
20485  clock.<sup><a href="#note321"><b>321)</b></a></sup>
20486 <p><b>Returns</b>
20487 <p><a name="7.27.2.5p4" href="#7.27.2.5p4"><small>4</small></a>
20488  If the timespec_get function is successful it returns the nonzero value base;
20489  otherwise, it returns zero.
20490
20491 <p><b>Footnotes</b>
20492 <p><small><a name="note321" href="#note321">321)</a> Although a struct timespec object describes times with nanosecond resolution, the available
20493  resolution is system dependent and may even be greater than 1 second.
20494 </small>
20495
20496 <p><small><a href="#Contents">Contents</a></small>
20497 <h4><a name="7.27.3" href="#7.27.3">7.27.3 Time conversion functions</a></h4>
20498 <p><a name="7.27.3p1" href="#7.27.3p1"><small>1</small></a>
20499  Except for the strftime function, these functions each return a pointer to one of two
20500  types of static objects: a broken-down time structure or an array of char. Execution of
20501  any of the functions that return a pointer to one of these object types may overwrite the
20502  information in any object of the same type pointed to by the value returned from any
20503  previous call to any of them and the functions are not required to avoid data races with
20504  each other.<sup><a href="#note322"><b>322)</b></a></sup> The implementation shall behave as if no other library functions call these
20505  functions.
20506
20507 <p><b>Footnotes</b>
20508 <p><small><a name="note322" href="#note322">322)</a> Alternative time conversion functions that do avoid data races are specified in <a href="#K.3.8.2">K.3.8.2</a>.
20509 </small>
20510
20511 <p><small><a href="#Contents">Contents</a></small>
20512 <h5><a name="7.27.3.1" href="#7.27.3.1">7.27.3.1 The asctime function</a></h5>
20513 <p><b>Synopsis</b>
20514 <p><a name="7.27.3.1p1" href="#7.27.3.1p1"><small>1</small></a>
20515 <pre>
20516           #include <a href="#7.27">&lt;time.h&gt;</a>
20517           char *asctime(const struct tm *timeptr);
20518 </pre>
20519 <p><b>Description</b>
20520 <p><a name="7.27.3.1p2" href="#7.27.3.1p2"><small>2</small></a>
20521  The asctime function converts the broken-down time in the structure pointed to by
20522  timeptr into a string in the form
20523 <pre>
20524           Sun Sep 16 01:03:52 1973\n\0
20525 </pre>
20526  using the equivalent of the following algorithm.
20527  char *asctime(const struct tm *timeptr)
20528  {
20529 <pre>
20530       static const char wday_name[7][3] = {
20531            "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
20532       };
20533       static const char mon_name[12][3] = {
20534            "Jan", "Feb", "Mar", "Apr", "May", "Jun",
20535            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
20536       };
20537       static char result[26];
20538 </pre>
20539  
20540  
20541  
20542 <!--page 411 -->
20543 <pre>
20544          sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
20545               wday_name[timeptr-&gt;tm_wday],
20546               mon_name[timeptr-&gt;tm_mon],
20547               timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
20548               timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
20549               1900 + timeptr-&gt;tm_year);
20550          return result;
20551 </pre>
20552  }
20553 <p><a name="7.27.3.1p3" href="#7.27.3.1p3"><small>3</small></a>
20554  If any of the members of the broken-down time contain values that are outside their
20555  normal ranges,<sup><a href="#note323"><b>323)</b></a></sup> the behavior of the asctime function is undefined. Likewise, if the
20556  calculated year exceeds four digits or is less than the year 1000, the behavior is
20557  undefined.
20558 <p><b>Returns</b>
20559 <p><a name="7.27.3.1p4" href="#7.27.3.1p4"><small>4</small></a>
20560  The asctime function returns a pointer to the string.
20561
20562 <p><b>Footnotes</b>
20563 <p><small><a name="note323" href="#note323">323)</a> See <a href="#7.27.1">7.27.1</a>.
20564 </small>
20565
20566 <p><small><a href="#Contents">Contents</a></small>
20567 <h5><a name="7.27.3.2" href="#7.27.3.2">7.27.3.2 The ctime function</a></h5>
20568 <p><b>Synopsis</b>
20569 <p><a name="7.27.3.2p1" href="#7.27.3.2p1"><small>1</small></a>
20570 <pre>
20571          #include <a href="#7.27">&lt;time.h&gt;</a>
20572          char *ctime(const time_t *timer);
20573 </pre>
20574 <p><b>Description</b>
20575 <p><a name="7.27.3.2p2" href="#7.27.3.2p2"><small>2</small></a>
20576  The ctime function converts the calendar time pointed to by timer to local time in the
20577  form of a string. It is equivalent to
20578 <pre>
20579          asctime(localtime(timer))
20580 </pre>
20581 <p><b>Returns</b>
20582 <p><a name="7.27.3.2p3" href="#7.27.3.2p3"><small>3</small></a>
20583  The ctime function returns the pointer returned by the asctime function with that
20584  broken-down time as argument.
20585 <p><b> Forward references</b>: the localtime function (<a href="#7.27.3.4">7.27.3.4</a>).
20586
20587 <p><small><a href="#Contents">Contents</a></small>
20588 <h5><a name="7.27.3.3" href="#7.27.3.3">7.27.3.3 The gmtime function</a></h5>
20589 <p><b>Synopsis</b>
20590 <p><a name="7.27.3.3p1" href="#7.27.3.3p1"><small>1</small></a>
20591 <pre>
20592          #include <a href="#7.27">&lt;time.h&gt;</a>
20593          struct tm *gmtime(const time_t *timer);
20594 </pre>
20595  
20596  
20597  
20598  
20599 <!--page 412 -->
20600 <p><b>Description</b>
20601 <p><a name="7.27.3.3p2" href="#7.27.3.3p2"><small>2</small></a>
20602  The gmtime function converts the calendar time pointed to by timer into a broken-
20603  down time, expressed as UTC.
20604 <p><b>Returns</b>
20605 <p><a name="7.27.3.3p3" href="#7.27.3.3p3"><small>3</small></a>
20606  The gmtime function returns a pointer to the broken-down time, or a null pointer if the
20607  specified time cannot be converted to UTC.
20608
20609 <p><small><a href="#Contents">Contents</a></small>
20610 <h5><a name="7.27.3.4" href="#7.27.3.4">7.27.3.4 The localtime function</a></h5>
20611 <p><b>Synopsis</b>
20612 <p><a name="7.27.3.4p1" href="#7.27.3.4p1"><small>1</small></a>
20613 <pre>
20614         #include <a href="#7.27">&lt;time.h&gt;</a>
20615         struct tm *localtime(const time_t *timer);
20616 </pre>
20617 <p><b>Description</b>
20618 <p><a name="7.27.3.4p2" href="#7.27.3.4p2"><small>2</small></a>
20619  The localtime function converts the calendar time pointed to by timer into a
20620  broken-down time, expressed as local time.
20621 <p><b>Returns</b>
20622 <p><a name="7.27.3.4p3" href="#7.27.3.4p3"><small>3</small></a>
20623  The localtime function returns a pointer to the broken-down time, or a null pointer if
20624  the specified time cannot be converted to local time.
20625
20626 <p><small><a href="#Contents">Contents</a></small>
20627 <h5><a name="7.27.3.5" href="#7.27.3.5">7.27.3.5 The strftime function</a></h5>
20628 <p><b>Synopsis</b>
20629 <p><a name="7.27.3.5p1" href="#7.27.3.5p1"><small>1</small></a>
20630 <pre>
20631         #include <a href="#7.27">&lt;time.h&gt;</a>
20632         size_t strftime(char * restrict s,
20633              size_t maxsize,
20634              const char * restrict format,
20635              const struct tm * restrict timeptr);
20636 </pre>
20637 <p><b>Description</b>
20638 <p><a name="7.27.3.5p2" href="#7.27.3.5p2"><small>2</small></a>
20639  The strftime function places characters into the array pointed to by s as controlled by
20640  the string pointed to by format. The format shall be a multibyte character sequence,
20641  beginning and ending in its initial shift state. The format string consists of zero or
20642  more conversion specifiers and ordinary multibyte characters. A conversion specifier
20643  consists of a % character, possibly followed by an E or O modifier character (described
20644  below), followed by a character that determines the behavior of the conversion specifier.
20645  All ordinary multibyte characters (including the terminating null character) are copied
20646  unchanged into the array. If copying takes place between objects that overlap, the
20647  behavior is undefined. No more than maxsize characters are placed into the array.
20648 <p><a name="7.27.3.5p3" href="#7.27.3.5p3"><small>3</small></a>
20649  Each conversion specifier is replaced by appropriate characters as described in the
20650  following list. The appropriate characters are determined using the LC_TIME category
20651 <!--page 413 -->
20652  of the current locale and by the values of zero or more members of the broken-down time
20653  structure pointed to by timeptr, as specified in brackets in the description. If any of
20654  the specified values is outside the normal range, the characters stored are unspecified.
20655  %a   is replaced by the locale's abbreviated weekday name. [tm_wday]
20656  %A   is replaced by the locale's full weekday name. [tm_wday]
20657  %b   is replaced by the locale's abbreviated month name. [tm_mon]
20658  %B   is replaced by the locale's full month name. [tm_mon]
20659  %c   is replaced by the locale's appropriate date and time representation. [all specified
20660 <pre>
20661       in <a href="#7.27.1">7.27.1</a>]
20662 </pre>
20663  %C   is replaced by the year divided by 100 and truncated to an integer, as a decimal
20664 <pre>
20665       number (00-99). [tm_year]
20666 </pre>
20667  %d   is replaced by the day of the month as a decimal number (01-31). [tm_mday]
20668  %D   is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
20669  %e   is replaced by the day of the month as a decimal number (1-31); a single digit is
20670 <pre>
20671       preceded by a space. [tm_mday]
20672 </pre>
20673  %F   is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
20674 <pre>
20675       tm_mday]
20676 </pre>
20677  %g   is replaced by the last 2 digits of the week-based year (see below) as a decimal
20678 <pre>
20679       number (00-99). [tm_year, tm_wday, tm_yday]
20680 </pre>
20681  %G   is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
20682 <pre>
20683       [tm_year, tm_wday, tm_yday]
20684 </pre>
20685  %h   is equivalent to ''%b''. [tm_mon]
20686  %H   is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
20687  %I   is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
20688  %j   is replaced by the day of the year as a decimal number (001-366). [tm_yday]
20689  %m   is replaced by the month as a decimal number (01-12). [tm_mon]
20690  %M   is replaced by the minute as a decimal number (00-59). [tm_min]
20691  %n   is replaced by a new-line character.
20692  %p   is replaced by the locale's equivalent of the AM/PM designations associated with a
20693 <pre>
20694       12-hour clock. [tm_hour]
20695 </pre>
20696  %r   is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
20697  %R   is equivalent to ''%H:%M''. [tm_hour, tm_min]
20698  %S   is replaced by the second as a decimal number (00-60). [tm_sec]
20699  %t   is replaced by a horizontal-tab character.
20700  %T   is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
20701 <pre>
20702       tm_sec]
20703 </pre>
20704  %u   is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
20705 <pre>
20706       is 1. [tm_wday]
20707 </pre>
20708  %U   is replaced by the week number of the year (the first Sunday as the first day of week
20709 <pre>
20710       1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
20711 </pre>
20712  %V   is replaced by the ISO 8601 week number (see below) as a decimal number
20713 <!--page 414 -->
20714 <pre>
20715        (01-53). [tm_year, tm_wday, tm_yday]
20716 </pre>
20717  %w    is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
20718 <pre>
20719        [tm_wday]
20720 </pre>
20721  %W    is replaced by the week number of the year (the first Monday as the first day of
20722 <pre>
20723        week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
20724 </pre>
20725  %x    is replaced by the locale's appropriate date representation. [all specified in <a href="#7.27.1">7.27.1</a>]
20726  %X    is replaced by the locale's appropriate time representation. [all specified in <a href="#7.27.1">7.27.1</a>]
20727  %y    is replaced by the last 2 digits of the year as a decimal number (00-99).
20728 <pre>
20729        [tm_year]
20730 </pre>
20731  %Y    is replaced by the year as a decimal number (e.g., 1997). [tm_year]
20732  %z    is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
20733 <pre>
20734        hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
20735        zone is determinable. [tm_isdst]
20736 </pre>
20737  %Z    is replaced by the locale's time zone name or abbreviation, or by no characters if no
20738 <pre>
20739        time zone is determinable. [tm_isdst]
20740 </pre>
20741  %%    is replaced by %.
20742 <p><a name="7.27.3.5p4" href="#7.27.3.5p4"><small>4</small></a>
20743  Some conversion specifiers can be modified by the inclusion of an E or O modifier
20744  character to indicate an alternative format or specification. If the alternative format or
20745  specification does not exist for the current locale, the modifier is ignored.
20746  %Ec is replaced by the locale's alternative date and time representation.
20747  %EC is replaced by the name of the base year (period) in the locale's alternative
20748 <pre>
20749      representation.
20750 </pre>
20751  %Ex is replaced by the locale's alternative date representation.
20752  %EX is replaced by the locale's alternative time representation.
20753  %Ey is replaced by the offset from %EC (year only) in the locale's alternative
20754 <pre>
20755      representation.
20756 </pre>
20757  %EY is replaced by the locale's full alternative year representation.
20758  %Od is replaced by the day of the month, using the locale's alternative numeric symbols
20759 <pre>
20760      (filled as needed with leading zeros, or with leading spaces if there is no alternative
20761      symbol for zero).
20762 </pre>
20763  %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
20764 <pre>
20765      (filled as needed with leading spaces).
20766 </pre>
20767  %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
20768 <pre>
20769      symbols.
20770 </pre>
20771  %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
20772 <pre>
20773      symbols.
20774 </pre>
20775  %Om is replaced by the month, using the locale's alternative numeric symbols.
20776  %OM is replaced by the minutes, using the locale's alternative numeric symbols.
20777  %OS is replaced by the seconds, using the locale's alternative numeric symbols.
20778  %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
20779 <!--page 415 -->
20780 <pre>
20781      representation, where Monday is 1.
20782 </pre>
20783  %OU is replaced by the week number, using the locale's alternative numeric symbols.
20784  %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
20785 <pre>
20786      symbols.
20787 </pre>
20788  %Ow is replaced by the weekday as a number, using the locale's alternative numeric
20789 <pre>
20790      symbols.
20791 </pre>
20792  %OW is replaced by the week number of the year, using the locale's alternative numeric
20793 <pre>
20794      symbols.
20795 </pre>
20796  %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
20797 <pre>
20798      symbols.
20799 </pre>
20800 <p><a name="7.27.3.5p5" href="#7.27.3.5p5"><small>5</small></a>
20801  %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
20802  weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
20803  which is also the week that includes the first Thursday of the year, and is also the first
20804  week that contains at least four days in the year. If the first Monday of January is the
20805  2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
20806  for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
20807  December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
20808  the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
20809  %V is replaced by 01.
20810 <p><a name="7.27.3.5p6" href="#7.27.3.5p6"><small>6</small></a>
20811  If a conversion specifier is not one of the above, the behavior is undefined.
20812 <p><a name="7.27.3.5p7" href="#7.27.3.5p7"><small>7</small></a>
20813  In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
20814  following specifiers are:
20815  %a    the first three characters of %A.
20816  %A    one of ''Sunday'', ''Monday'', ... , ''Saturday''.
20817  %b    the first three characters of %B.
20818  %B    one of ''January'', ''February'', ... , ''December''.
20819  %c    equivalent to ''%a %b %e %T %Y''.
20820  %p    one of ''AM'' or ''PM''.
20821  %r    equivalent to ''%I:%M:%S %p''.
20822  %x    equivalent to ''%m/%d/%y''.
20823  %X    equivalent to %T.
20824  %Z    implementation-defined.
20825 <p><b>Returns</b>
20826 <p><a name="7.27.3.5p8" href="#7.27.3.5p8"><small>8</small></a>
20827  If the total number of resulting characters including the terminating null character is not
20828  more than maxsize, the strftime function returns the number of characters placed
20829  into the array pointed to by s not including the terminating null character. Otherwise,
20830  zero is returned and the contents of the array are indeterminate.
20831 <!--page 416 -->
20832
20833 <p><small><a href="#Contents">Contents</a></small>
20834 <h3><a name="7.28" href="#7.28">7.28 Unicode utilities &lt;uchar.h&gt;</a></h3>
20835 <p><a name="7.28p1" href="#7.28p1"><small>1</small></a>
20836  The header <a href="#7.28">&lt;uchar.h&gt;</a> declares types and functions for manipulating Unicode
20837  characters.
20838 <p><a name="7.28p2" href="#7.28p2"><small>2</small></a>
20839  The types declared are mbstate_t (described in <a href="#7.30.1">7.30.1</a>) and size_t (described in
20840  <a href="#7.19">7.19</a>);
20841 <pre>
20842         char16_t
20843 </pre>
20844  which is an unsigned integer type used for 16-bit characters and is the same type as
20845  uint_least16_t (described in <a href="#7.20.1.2">7.20.1.2</a>); and
20846 <pre>
20847         char32_t
20848 </pre>
20849  which is an unsigned integer type used for 32-bit characters and is the same type as
20850  uint_least32_t (also described in <a href="#7.20.1.2">7.20.1.2</a>).
20851
20852 <p><small><a href="#Contents">Contents</a></small>
20853 <h4><a name="7.28.1" href="#7.28.1">7.28.1 Restartable multibyte/wide character conversion functions</a></h4>
20854 <p><a name="7.28.1p1" href="#7.28.1p1"><small>1</small></a>
20855  These functions have a parameter, ps, of type pointer to mbstate_t that points to an
20856  object that can completely describe the current conversion state of the associated
20857  multibyte character sequence, which the functions alter as necessary. If ps is a null
20858  pointer, each function uses its own internal mbstate_t object instead, which is
20859  initialized at program startup to the initial conversion state; the functions are not required
20860  to avoid data races with other calls to the same function in this case. The implementation
20861  behaves as if no library function calls these functions with a null pointer for ps.
20862
20863 <p><small><a href="#Contents">Contents</a></small>
20864 <h5><a name="7.28.1.1" href="#7.28.1.1">7.28.1.1 The mbrtoc16 function</a></h5>
20865 <p><b>Synopsis</b>
20866 <p><a name="7.28.1.1p1" href="#7.28.1.1p1"><small>1</small></a>
20867 <pre>
20868         #include <a href="#7.28">&lt;uchar.h&gt;</a>
20869         size_t mbrtoc16(char16_t * restrict pc16,
20870              const char * restrict s, size_t n,
20871              mbstate_t * restrict ps);
20872 </pre>
20873 <p><b>Description</b>
20874 <p><a name="7.28.1.1p2" href="#7.28.1.1p2"><small>2</small></a>
20875  If s is a null pointer, the mbrtoc16 function is equivalent to the call:
20876 <pre>
20877                 mbrtoc16(NULL, "", 1, ps)
20878 </pre>
20879  In this case, the values of the parameters pc16 and n are ignored.
20880 <p><a name="7.28.1.1p3" href="#7.28.1.1p3"><small>3</small></a>
20881  If s is not a null pointer, the mbrtoc16 function inspects at most n bytes beginning with
20882  the byte pointed to by s to determine the number of bytes needed to complete the next
20883  multibyte character (including any shift sequences). If the function determines that the
20884  next multibyte character is complete and valid, it determines the values of the
20885  corresponding wide characters and then, if pc16 is not a null pointer, stores the value of
20886  the first (or only) such character in the object pointed to by pc16. Subsequent calls will
20887 <!--page 417 -->
20888  store successive wide characters without consuming any additional input until all the
20889  characters have been stored. If the corresponding wide character is the null wide
20890  character, the resulting state described is the initial conversion state.
20891 <p><b>Returns</b>
20892 <p><a name="7.28.1.1p4" href="#7.28.1.1p4"><small>4</small></a>
20893  The mbrtoc16 function returns the first of the following that applies (given the current
20894  conversion state):
20895  0                     if the next n or fewer bytes complete the multibyte character that
20896 <pre>
20897                        corresponds to the null wide character (which is the value stored).
20898 </pre>
20899  between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
20900 <pre>
20901                     character (which is the value stored); the value returned is the number
20902                     of bytes that complete the multibyte character.
20903 </pre>
20904  (size_t)(-3) if the next character resulting from a previous call has been stored (no
20905 <pre>
20906               bytes from the input have been consumed by this call).
20907 </pre>
20908  (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
20909 <pre>
20910               multibyte character, and all n bytes have been processed (no value is
20911               stored).<sup><a href="#note324"><b>324)</b></a></sup>
20912 </pre>
20913  (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
20914 <pre>
20915               do not contribute to a complete and valid multibyte character (no
20916               value is stored); the value of the macro EILSEQ is stored in errno,
20917               and the conversion state is unspecified.
20918 </pre>
20919
20920 <p><b>Footnotes</b>
20921 <p><small><a name="note324" href="#note324">324)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
20922  sequence of redundant shift sequences (for implementations with state-dependent encodings).
20923 </small>
20924
20925 <p><small><a href="#Contents">Contents</a></small>
20926 <h5><a name="7.28.1.2" href="#7.28.1.2">7.28.1.2 The c16rtomb function</a></h5>
20927 <p><b>Synopsis</b>
20928 <p><a name="7.28.1.2p1" href="#7.28.1.2p1"><small>1</small></a>
20929 <pre>
20930          #include <a href="#7.28">&lt;uchar.h&gt;</a>
20931          size_t c16rtomb(char * restrict s, char16_t c16,
20932               mbstate_t * restrict ps);
20933 </pre>
20934 <p><b>Description</b>
20935 <p><a name="7.28.1.2p2" href="#7.28.1.2p2"><small>2</small></a>
20936  If s is a null pointer, the c16rtomb function is equivalent to the call
20937 <pre>
20938                  c16rtomb(buf, L'\0', ps)
20939 </pre>
20940  where buf is an internal buffer.
20941 <p><a name="7.28.1.2p3" href="#7.28.1.2p3"><small>3</small></a>
20942  If s is not a null pointer, the c16rtomb function determines the number of bytes needed
20943  to represent the multibyte character that corresponds to the wide character given by c16
20944  (including any shift sequences), and stores the multibyte character representation in the
20945  
20946 <!--page 418 -->
20947  array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
20948  c16 is a null wide character, a null byte is stored, preceded by any shift sequence needed
20949  to restore the initial shift state; the resulting state described is the initial conversion state.
20950 <p><b>Returns</b>
20951 <p><a name="7.28.1.2p4" href="#7.28.1.2p4"><small>4</small></a>
20952  The c16rtomb function returns the number of bytes stored in the array object (including
20953  any shift sequences). When c16 is not a valid wide character, an encoding error occurs:
20954  the function stores the value of the macro EILSEQ in errno and returns
20955  (size_t)(-1); the conversion state is unspecified.
20956
20957 <p><small><a href="#Contents">Contents</a></small>
20958 <h5><a name="7.28.1.3" href="#7.28.1.3">7.28.1.3 The mbrtoc32 function</a></h5>
20959 <p><b>Synopsis</b>
20960 <p><a name="7.28.1.3p1" href="#7.28.1.3p1"><small>1</small></a>
20961 <pre>
20962          #include <a href="#7.28">&lt;uchar.h&gt;</a>
20963          size_t mbrtoc32(char32_t * restrict pc32,
20964               const char * restrict s, size_t n,
20965               mbstate_t * restrict ps);
20966 </pre>
20967 <p><b>Description</b>
20968 <p><a name="7.28.1.3p2" href="#7.28.1.3p2"><small>2</small></a>
20969  If s is a null pointer, the mbrtoc32 function is equivalent to the call:
20970 <pre>
20971                  mbrtoc32(NULL, "", 1, ps)
20972 </pre>
20973  In this case, the values of the parameters pc32 and n are ignored.
20974 <p><a name="7.28.1.3p3" href="#7.28.1.3p3"><small>3</small></a>
20975  If s is not a null pointer, the mbrtoc32 function inspects at most n bytes beginning with
20976  the byte pointed to by s to determine the number of bytes needed to complete the next
20977  multibyte character (including any shift sequences). If the function determines that the
20978  next multibyte character is complete and valid, it determines the values of the
20979  corresponding wide characters and then, if pc32 is not a null pointer, stores the value of
20980  the first (or only) such character in the object pointed to by pc32. Subsequent calls will
20981  store successive wide characters without consuming any additional input until all the
20982  characters have been stored. If the corresponding wide character is the null wide
20983  character, the resulting state described is the initial conversion state.
20984 <p><b>Returns</b>
20985 <p><a name="7.28.1.3p4" href="#7.28.1.3p4"><small>4</small></a>
20986  The mbrtoc32 function returns the first of the following that applies (given the current
20987  conversion state):
20988  0                    if the next n or fewer bytes complete the multibyte character that
20989 <pre>
20990                       corresponds to the null wide character (which is the value stored).
20991 </pre>
20992  between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
20993 <!--page 419 -->
20994 <pre>
20995                     character (which is the value stored); the value returned is the number
20996                     of bytes that complete the multibyte character.
20997 </pre>
20998  (size_t)(-3) if the next character resulting from a previous call has been stored (no
20999 <pre>
21000               bytes from the input have been consumed by this call).
21001 </pre>
21002  (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
21003 <pre>
21004               multibyte character, and all n bytes have been processed (no value is
21005               stored).<sup><a href="#note325"><b>325)</b></a></sup>
21006 </pre>
21007  (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
21008 <pre>
21009               do not contribute to a complete and valid multibyte character (no
21010               value is stored); the value of the macro EILSEQ is stored in errno,
21011               and the conversion state is unspecified.
21012 </pre>
21013
21014 <p><b>Footnotes</b>
21015 <p><small><a name="note325" href="#note325">325)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
21016  sequence of redundant shift sequences (for implementations with state-dependent encodings).
21017 </small>
21018
21019 <p><small><a href="#Contents">Contents</a></small>
21020 <h5><a name="7.28.1.4" href="#7.28.1.4">7.28.1.4 The c32rtomb function</a></h5>
21021 <p><b>Synopsis</b>
21022 <p><a name="7.28.1.4p1" href="#7.28.1.4p1"><small>1</small></a>
21023 <pre>
21024          #include <a href="#7.28">&lt;uchar.h&gt;</a>
21025          size_t c32rtomb(char * restrict s, char32_t c32,
21026               mbstate_t * restrict ps);
21027 </pre>
21028 <p><b>Description</b>
21029 <p><a name="7.28.1.4p2" href="#7.28.1.4p2"><small>2</small></a>
21030  If s is a null pointer, the c32rtomb function is equivalent to the call
21031 <pre>
21032                  c32rtomb(buf, L'\0', ps)
21033 </pre>
21034  where buf is an internal buffer.
21035 <p><a name="7.28.1.4p3" href="#7.28.1.4p3"><small>3</small></a>
21036  If s is not a null pointer, the c32rtomb function determines the number of bytes needed
21037  to represent the multibyte character that corresponds to the wide character given by c32
21038  (including any shift sequences), and stores the multibyte character representation in the
21039  array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
21040  c32 is a null wide character, a null byte is stored, preceded by any shift sequence needed
21041  to restore the initial shift state; the resulting state described is the initial conversion state.
21042 <p><b>Returns</b>
21043 <p><a name="7.28.1.4p4" href="#7.28.1.4p4"><small>4</small></a>
21044  The c32rtomb function returns the number of bytes stored in the array object (including
21045  any shift sequences). When c32 is not a valid wide character, an encoding error occurs:
21046  the function stores the value of the macro EILSEQ in errno and returns
21047  (size_t)(-1); the conversion state is unspecified.
21048  
21049  
21050  
21051  
21052 <!--page 420 -->
21053
21054 <p><small><a href="#Contents">Contents</a></small>
21055 <h3><a name="7.29" href="#7.29">7.29 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a></h3>
21056
21057 <p><small><a href="#Contents">Contents</a></small>
21058 <h4><a name="7.29.1" href="#7.29.1">7.29.1 Introduction</a></h4>
21059 <p><a name="7.29.1p1" href="#7.29.1p1"><small>1</small></a>
21060  The header <a href="#7.29">&lt;wchar.h&gt;</a> defines four macros, and declares four data types, one tag, and
21061  many functions.<sup><a href="#note326"><b>326)</b></a></sup>
21062 <p><a name="7.29.1p2" href="#7.29.1p2"><small>2</small></a>
21063  The types declared are wchar_t and size_t (both described in <a href="#7.19">7.19</a>);
21064 <pre>
21065           mbstate_t
21066 </pre>
21067  which is a complete object type other than an array type that can hold the conversion state
21068  information necessary to convert between sequences of multibyte characters and wide
21069  characters;
21070 <pre>
21071           wint_t
21072 </pre>
21073  which is an integer type unchanged by default argument promotions that can hold any
21074  value corresponding to members of the extended character set, as well as at least one
21075  value that does not correspond to any member of the extended character set (see WEOF
21076  below);<sup><a href="#note327"><b>327)</b></a></sup> and
21077 <pre>
21078           struct tm
21079 </pre>
21080  which is declared as an incomplete structure type (the contents are described in <a href="#7.27.1">7.27.1</a>).
21081 <p><a name="7.29.1p3" href="#7.29.1p3"><small>3</small></a>
21082  The macros defined are NULL (described in <a href="#7.19">7.19</a>); WCHAR_MIN and WCHAR_MAX
21083  (described in <a href="#7.20.3">7.20.3</a>); and
21084 <pre>
21085           WEOF
21086 </pre>
21087  which expands to a constant expression of type wint_t whose value does not
21088  correspond to any member of the extended character set.<sup><a href="#note328"><b>328)</b></a></sup> It is accepted (and returned)
21089  by several functions in this subclause to indicate end-of-file, that is, no more input from a
21090  stream. It is also used as a wide character value that does not correspond to any member
21091  of the extended character set.
21092 <p><a name="7.29.1p4" href="#7.29.1p4"><small>4</small></a>
21093  The functions declared are grouped as follows:
21094 <ul>
21095 <li>  Functions that perform input and output of wide characters, or multibyte characters,
21096  or both;
21097 <li>  Functions that provide wide string numeric conversion;
21098 <li>  Functions that perform general wide string manipulation;
21099  
21100  
21101 <!--page 421 -->
21102 <li>  Functions for wide string date and time conversion; and
21103 <li>  Functions that provide extended capabilities for conversion between multibyte and
21104  wide character sequences.
21105 </ul>
21106 <p><a name="7.29.1p5" href="#7.29.1p5"><small>5</small></a>
21107  Arguments to the functions in this subclause may point to arrays containing wchar_t
21108  values that do not correspond to members of the extended character set. Such values
21109  shall be processed according to the specified semantics, except that it is unspecified
21110  whether an encoding error occurs if such a value appears in the format string for a
21111  function in <a href="#7.29.2">7.29.2</a> or <a href="#7.29.5">7.29.5</a> and the specified semantics do not require that value to be
21112  processed by wcrtomb.
21113 <p><a name="7.29.1p6" href="#7.29.1p6"><small>6</small></a>
21114  Unless explicitly stated otherwise, if the execution of a function described in this
21115  subclause causes copying to take place between objects that overlap, the behavior is
21116  undefined.
21117
21118 <p><b>Footnotes</b>
21119 <p><small><a name="note326" href="#note326">326)</a> See ''future library directions'' (<a href="#7.31.16">7.31.16</a>).
21120 </small>
21121 <p><small><a name="note327" href="#note327">327)</a> wchar_t and wint_t can be the same integer type.
21122 </small>
21123 <p><small><a name="note328" href="#note328">328)</a> The value of the macro WEOF may differ from that of EOF and need not be negative.
21124 </small>
21125
21126 <p><small><a href="#Contents">Contents</a></small>
21127 <h4><a name="7.29.2" href="#7.29.2">7.29.2 Formatted wide character input/output functions</a></h4>
21128 <p><a name="7.29.2p1" href="#7.29.2p1"><small>1</small></a>
21129  The formatted wide character input/output functions shall behave as if there is a sequence
21130  point after the actions associated with each specifier.<sup><a href="#note329"><b>329)</b></a></sup>
21131
21132 <p><b>Footnotes</b>
21133 <p><small><a name="note329" href="#note329">329)</a> The fwprintf functions perform writes to memory for the %n specifier.
21134 </small>
21135
21136 <p><small><a href="#Contents">Contents</a></small>
21137 <h5><a name="7.29.2.1" href="#7.29.2.1">7.29.2.1 The fwprintf function</a></h5>
21138 <p><b>Synopsis</b>
21139 <p><a name="7.29.2.1p1" href="#7.29.2.1p1"><small>1</small></a>
21140 <pre>
21141          #include <a href="#7.21">&lt;stdio.h&gt;</a>
21142          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21143          int fwprintf(FILE * restrict stream,
21144               const wchar_t * restrict format, ...);
21145 </pre>
21146 <p><b>Description</b>
21147 <p><a name="7.29.2.1p2" href="#7.29.2.1p2"><small>2</small></a>
21148  The fwprintf function writes output to the stream pointed to by stream, under
21149  control of the wide string pointed to by format that specifies how subsequent arguments
21150  are converted for output. If there are insufficient arguments for the format, the behavior
21151  is undefined. If the format is exhausted while arguments remain, the excess arguments
21152  are evaluated (as always) but are otherwise ignored. The fwprintf function returns
21153  when the end of the format string is encountered.
21154 <p><a name="7.29.2.1p3" href="#7.29.2.1p3"><small>3</small></a>
21155  The format is composed of zero or more directives: ordinary wide characters (not %),
21156  which are copied unchanged to the output stream; and conversion specifications, each of
21157  which results in fetching zero or more subsequent arguments, converting them, if
21158  applicable, according to the corresponding conversion specifier, and then writing the
21159  result to the output stream.
21160  
21161  
21162  
21163 <!--page 422 -->
21164 <p><a name="7.29.2.1p4" href="#7.29.2.1p4"><small>4</small></a>
21165  Each conversion specification is introduced by the wide character %. After the %, the
21166  following appear in sequence:
21167 <ul>
21168 <li>  Zero or more flags (in any order) that modify the meaning of the conversion
21169  specification.
21170 <li>  An optional minimum field width. If the converted value has fewer wide characters
21171  than the field width, it is padded with spaces (by default) on the left (or right, if the
21172  left adjustment flag, described later, has been given) to the field width. The field
21173  width takes the form of an asterisk * (described later) or a nonnegative decimal
21174  integer.<sup><a href="#note330"><b>330)</b></a></sup>
21175 <li>  An optional precision that gives the minimum number of digits to appear for the d, i,
21176  o, u, x, and X conversions, the number of digits to appear after the decimal-point
21177  wide character for a, A, e, E, f, and F conversions, the maximum number of
21178  significant digits for the g and G conversions, or the maximum number of wide
21179  characters to be written for s conversions. The precision takes the form of a period
21180  (.) followed either by an asterisk * (described later) or by an optional decimal
21181  integer; if only the period is specified, the precision is taken as zero. If a precision
21182  appears with any other conversion specifier, the behavior is undefined.
21183 <li>  An optional length modifier that specifies the size of the argument.
21184 <li>  A conversion specifier wide character that specifies the type of conversion to be
21185  applied.
21186 </ul>
21187 <p><a name="7.29.2.1p5" href="#7.29.2.1p5"><small>5</small></a>
21188  As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
21189  this case, an int argument supplies the field width or precision. The arguments
21190  specifying field width, or precision, or both, shall appear (in that order) before the
21191  argument (if any) to be converted. A negative field width argument is taken as a - flag
21192  followed by a positive field width. A negative precision argument is taken as if the
21193  precision were omitted.
21194 <p><a name="7.29.2.1p6" href="#7.29.2.1p6"><small>6</small></a>
21195  The flag wide characters and their meanings are:
21196  -        The result of the conversion is left-justified within the field. (It is right-justified if
21197 <pre>
21198           this flag is not specified.)
21199 </pre>
21200  +        The result of a signed conversion always begins with a plus or minus sign. (It
21201 <pre>
21202           begins with a sign only when a negative value is converted if this flag is not
21203 </pre>
21204  
21205  
21206  
21207  
21208 <!--page 423 -->
21209 <pre>
21210            specified.)<sup><a href="#note331"><b>331)</b></a></sup>
21211 </pre>
21212  space If the first wide character of a signed conversion is not a sign, or if a signed
21213 <pre>
21214        conversion results in no wide characters, a space is prefixed to the result. If the
21215        space and + flags both appear, the space flag is ignored.
21216 </pre>
21217  #         The result is converted to an ''alternative form''. For o conversion, it increases
21218 <pre>
21219            the precision, if and only if necessary, to force the first digit of the result to be a
21220            zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
21221            conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
21222            and G conversions, the result of converting a floating-point number always
21223            contains a decimal-point wide character, even if no digits follow it. (Normally, a
21224            decimal-point wide character appears in the result of these conversions only if a
21225            digit follows it.) For g and G conversions, trailing zeros are not removed from the
21226            result. For other conversions, the behavior is undefined.
21227 </pre>
21228  0         For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
21229 <pre>
21230            (following any indication of sign or base) are used to pad to the field width rather
21231            than performing space padding, except when converting an infinity or NaN. If the
21232            0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
21233            conversions, if a precision is specified, the 0 flag is ignored. For other
21234            conversions, the behavior is undefined.
21235 </pre>
21236 <p><a name="7.29.2.1p7" href="#7.29.2.1p7"><small>7</small></a>
21237  The length modifiers and their meanings are:
21238  hh             Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
21239 <pre>
21240                 signed char or unsigned char argument (the argument will have
21241                 been promoted according to the integer promotions, but its value shall be
21242                 converted to signed char or unsigned char before printing); or that
21243                 a following n conversion specifier applies to a pointer to a signed char
21244                 argument.
21245 </pre>
21246  h              Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
21247 <pre>
21248                 short int or unsigned short int argument (the argument will
21249                 have been promoted according to the integer promotions, but its value shall
21250                 be converted to short int or unsigned short int before printing);
21251                 or that a following n conversion specifier applies to a pointer to a short
21252                 int argument.
21253 </pre>
21254  l (ell)        Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
21255 <pre>
21256                 long int or unsigned long int argument; that a following n
21257                 conversion specifier applies to a pointer to a long int argument; that a
21258 </pre>
21259  
21260  
21261 <!--page 424 -->
21262 <pre>
21263               following c conversion specifier applies to a wint_t argument; that a
21264               following s conversion specifier applies to a pointer to a wchar_t
21265               argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
21266               specifier.
21267 </pre>
21268  ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
21269 <pre>
21270               long long int or unsigned long long int argument; or that a
21271               following n conversion specifier applies to a pointer to a long long int
21272               argument.
21273 </pre>
21274  j            Specifies that a following d, i, o, u, x, or X conversion specifier applies to
21275 <pre>
21276               an intmax_t or uintmax_t argument; or that a following n conversion
21277               specifier applies to a pointer to an intmax_t argument.
21278 </pre>
21279  z            Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
21280 <pre>
21281               size_t or the corresponding signed integer type argument; or that a
21282               following n conversion specifier applies to a pointer to a signed integer type
21283               corresponding to size_t argument.
21284 </pre>
21285  t            Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
21286 <pre>
21287               ptrdiff_t or the corresponding unsigned integer type argument; or that a
21288               following n conversion specifier applies to a pointer to a ptrdiff_t
21289               argument.
21290 </pre>
21291  L            Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
21292 <pre>
21293               applies to a long double argument.
21294 </pre>
21295  If a length modifier appears with any conversion specifier other than as specified above,
21296  the behavior is undefined.
21297 <p><a name="7.29.2.1p8" href="#7.29.2.1p8"><small>8</small></a>
21298  The conversion specifiers and their meanings are:
21299  d,i         The int argument is converted to signed decimal in the style [-]dddd. The
21300 <pre>
21301              precision specifies the minimum number of digits to appear; if the value
21302              being converted can be represented in fewer digits, it is expanded with
21303              leading zeros. The default precision is 1. The result of converting a zero
21304              value with a precision of zero is no wide characters.
21305 </pre>
21306  o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
21307 <!--page 425 -->
21308 <pre>
21309          decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
21310          letters abcdef are used for x conversion and the letters ABCDEF for X
21311          conversion. The precision specifies the minimum number of digits to appear;
21312          if the value being converted can be represented in fewer digits, it is expanded
21313          with leading zeros. The default precision is 1. The result of converting a
21314          zero value with a precision of zero is no wide characters.
21315 </pre>
21316  f,F          A double argument representing a floating-point number is converted to
21317 <pre>
21318               decimal notation in the style [-]ddd.ddd, where the number of digits after
21319               the decimal-point wide character is equal to the precision specification. If the
21320               precision is missing, it is taken as 6; if the precision is zero and the # flag is
21321               not specified, no decimal-point wide character appears. If a decimal-point
21322               wide character appears, at least one digit appears before it. The value is
21323               rounded to the appropriate number of digits.
21324               A double argument representing an infinity is converted in one of the styles
21325               [-]inf or [-]infinity -- which style is implementation-defined. A
21326               double argument representing a NaN is converted in one of the styles
21327               [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
21328               any n-wchar-sequence, is implementation-defined. The F conversion
21329               specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
21330               nan, respectively.<sup><a href="#note332"><b>332)</b></a></sup>
21331 </pre>
21332  e,E          A double argument representing a floating-point number is converted in the
21333 <pre>
21334               style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
21335               argument is nonzero) before the decimal-point wide character and the number
21336               of digits after it is equal to the precision; if the precision is missing, it is taken
21337               as 6; if the precision is zero and the # flag is not specified, no decimal-point
21338               wide character appears. The value is rounded to the appropriate number of
21339               digits. The E conversion specifier produces a number with E instead of e
21340               introducing the exponent. The exponent always contains at least two digits,
21341               and only as many more digits as necessary to represent the exponent. If the
21342               value is zero, the exponent is zero.
21343               A double argument representing an infinity or NaN is converted in the style
21344               of an f or F conversion specifier.
21345 </pre>
21346  g,G          A double argument representing a floating-point number is converted in
21347 <pre>
21348               style f or e (or in style F or E in the case of a G conversion specifier),
21349               depending on the value converted and the precision. Let P equal the
21350               precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
21351               Then, if a conversion with style E would have an exponent of X:
21352               -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
21353                 P - (X + 1).
21354               -- otherwise, the conversion is with style e (or E) and precision P - 1.
21355               Finally, unless the # flag is used, any trailing zeros are removed from the
21356 </pre>
21357  
21358  
21359 <!--page 426 -->
21360 <pre>
21361               fractional portion of the result and the decimal-point wide character is
21362               removed if there is no fractional portion remaining.
21363               A double argument representing an infinity or NaN is converted in the style
21364               of an f or F conversion specifier.
21365 </pre>
21366  a,A          A double argument representing a floating-point number is converted in the
21367 <pre>
21368               style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
21369               nonzero if the argument is a normalized floating-point number and is
21370               otherwise unspecified) before the decimal-point wide character<sup><a href="#note333"><b>333)</b></a></sup> and the
21371               number of hexadecimal digits after it is equal to the precision; if the precision
21372               is missing and FLT_RADIX is a power of 2, then the precision is sufficient
21373               for an exact representation of the value; if the precision is missing and
21374               FLT_RADIX is not a power of 2, then the precision is sufficient to
21375               distinguish<sup><a href="#note334"><b>334)</b></a></sup> values of type double, except that trailing zeros may be
21376               omitted; if the precision is zero and the # flag is not specified, no decimal-
21377               point wide character appears. The letters abcdef are used for a conversion
21378               and the letters ABCDEF for A conversion. The A conversion specifier
21379               produces a number with X and P instead of x and p. The exponent always
21380               contains at least one digit, and only as many more digits as necessary to
21381               represent the decimal exponent of 2. If the value is zero, the exponent is
21382               zero.
21383               A double argument representing an infinity or NaN is converted in the style
21384               of an f or F conversion specifier.
21385 </pre>
21386  c            If no l length modifier is present, the int argument is converted to a wide
21387 <pre>
21388               character as if by calling btowc and the resulting wide character is written.
21389               If an l length modifier is present, the wint_t argument is converted to
21390               wchar_t and written.
21391 </pre>
21392  s            If no l length modifier is present, the argument shall be a pointer to the initial
21393 <pre>
21394               element of a character array containing a multibyte character sequence
21395               beginning in the initial shift state. Characters from the array are converted as
21396               if by repeated calls to the mbrtowc function, with the conversion state
21397               described by an mbstate_t object initialized to zero before the first
21398               multibyte character is converted, and written up to (but not including) the
21399 </pre>
21400  
21401 <!--page 427 -->
21402 <pre>
21403                 terminating null wide character. If the precision is specified, no more than
21404                 that many wide characters are written. If the precision is not specified or is
21405                 greater than the size of the converted array, the converted array shall contain a
21406                 null wide character.
21407                 If an l length modifier is present, the argument shall be a pointer to the initial
21408                 element of an array of wchar_t type. Wide characters from the array are
21409                 written up to (but not including) a terminating null wide character. If the
21410                 precision is specified, no more than that many wide characters are written. If
21411                 the precision is not specified or is greater than the size of the array, the array
21412                 shall contain a null wide character.
21413 </pre>
21414  p              The argument shall be a pointer to void. The value of the pointer is
21415 <pre>
21416                 converted to a sequence of printing wide characters, in an implementation-
21417                 defined manner.
21418 </pre>
21419  n              The argument shall be a pointer to signed integer into which is written the
21420 <pre>
21421                 number of wide characters written to the output stream so far by this call to
21422                 fwprintf. No argument is converted, but one is consumed. If the
21423                 conversion specification includes any flags, a field width, or a precision, the
21424                 behavior is undefined.
21425 </pre>
21426  %              A % wide character is written. No argument is converted. The complete
21427 <pre>
21428                 conversion specification shall be %%.
21429 </pre>
21430 <p><a name="7.29.2.1p9" href="#7.29.2.1p9"><small>9</small></a>
21431  If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note335"><b>335)</b></a></sup> If any argument is
21432  not the correct type for the corresponding conversion specification, the behavior is
21433  undefined.
21434 <p><a name="7.29.2.1p10" href="#7.29.2.1p10"><small>10</small></a>
21435  In no case does a nonexistent or small field width cause truncation of a field; if the result
21436  of a conversion is wider than the field width, the field is expanded to contain the
21437  conversion result.
21438 <p><a name="7.29.2.1p11" href="#7.29.2.1p11"><small>11</small></a>
21439  For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
21440  to a hexadecimal floating number with the given precision.
21441 <p><b>Recommended practice</b>
21442 <p><a name="7.29.2.1p12" href="#7.29.2.1p12"><small>12</small></a>
21443  For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
21444  representable in the given precision, the result should be one of the two adjacent numbers
21445  in hexadecimal floating style with the given precision, with the extra stipulation that the
21446  error should have a correct sign for the current rounding direction.
21447 <p><a name="7.29.2.1p13" href="#7.29.2.1p13"><small>13</small></a>
21448  For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
21449  DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note336"><b>336)</b></a></sup> If the number of
21450  
21451 <!--page 428 -->
21452  significant decimal digits is more than DECIMAL_DIG but the source value is exactly
21453  representable with DECIMAL_DIG digits, then the result should be an exact
21454  representation with trailing zeros. Otherwise, the source value is bounded by two
21455  adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
21456  of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
21457  the error should have a correct sign for the current rounding direction.
21458 <p><b>Returns</b>
21459 <p><a name="7.29.2.1p14" href="#7.29.2.1p14"><small>14</small></a>
21460  The fwprintf function returns the number of wide characters transmitted, or a negative
21461  value if an output or encoding error occurred.
21462 <p><b>Environmental limits</b>
21463 <p><a name="7.29.2.1p15" href="#7.29.2.1p15"><small>15</small></a>
21464  The number of wide characters that can be produced by any single conversion shall be at
21465  least 4095.
21466 <p><a name="7.29.2.1p16" href="#7.29.2.1p16"><small>16</small></a>
21467  EXAMPLE       To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
21468  places:
21469 <pre>
21470          #include <a href="#7.12">&lt;math.h&gt;</a>
21471          #include <a href="#7.21">&lt;stdio.h&gt;</a>
21472          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21473          /* ... */
21474          wchar_t *weekday, *month; // pointers to wide strings
21475          int day, hour, min;
21476          fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
21477                  weekday, month, day, hour, min);
21478          fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
21479 </pre>
21480  
21481 <p><b> Forward references</b>:          the btowc function (<a href="#7.29.6.1.1">7.29.6.1.1</a>), the mbrtowc function
21482  (<a href="#7.29.6.3.2">7.29.6.3.2</a>).
21483
21484 <p><b>Footnotes</b>
21485 <p><small><a name="note330" href="#note330">330)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
21486 </small>
21487 <p><small><a name="note331" href="#note331">331)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
21488  include a minus sign.
21489 </small>
21490 <p><small><a name="note332" href="#note332">332)</a> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
21491  meaning; the # and 0 flag wide characters have no effect.
21492 </small>
21493 <p><small><a name="note333" href="#note333">333)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
21494  character so that subsequent digits align to nibble (4-bit) boundaries.
21495 </small>
21496 <p><small><a name="note334" href="#note334">334)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
21497  FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
21498  might suffice depending on the implementation's scheme for determining the digit to the left of the
21499  decimal-point wide character.
21500 </small>
21501 <p><small><a name="note335" href="#note335">335)</a> See ''future library directions'' (<a href="#7.31.16">7.31.16</a>).
21502 </small>
21503 <p><small><a name="note336" href="#note336">336)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
21504  given format specifier. The number of significant digits is determined by the format specifier, and in
21505  the case of fixed-point conversion by the source value as well.
21506 </small>
21507
21508 <p><small><a href="#Contents">Contents</a></small>
21509 <h5><a name="7.29.2.2" href="#7.29.2.2">7.29.2.2 The fwscanf function</a></h5>
21510 <p><b>Synopsis</b>
21511 <p><a name="7.29.2.2p1" href="#7.29.2.2p1"><small>1</small></a>
21512 <pre>
21513          #include <a href="#7.21">&lt;stdio.h&gt;</a>
21514          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21515          int fwscanf(FILE * restrict stream,
21516               const wchar_t * restrict format, ...);
21517 </pre>
21518 <p><b>Description</b>
21519 <p><a name="7.29.2.2p2" href="#7.29.2.2p2"><small>2</small></a>
21520  The fwscanf function reads input from the stream pointed to by stream, under
21521  control of the wide string pointed to by format that specifies the admissible input
21522  sequences and how they are to be converted for assignment, using subsequent arguments
21523  
21524 <!--page 429 -->
21525  as pointers to the objects to receive the converted input. If there are insufficient
21526  arguments for the format, the behavior is undefined. If the format is exhausted while
21527  arguments remain, the excess arguments are evaluated (as always) but are otherwise
21528  ignored.
21529 <p><a name="7.29.2.2p3" href="#7.29.2.2p3"><small>3</small></a>
21530  The format is composed of zero or more directives: one or more white-space wide
21531  characters, an ordinary wide character (neither % nor a white-space wide character), or a
21532  conversion specification. Each conversion specification is introduced by the wide
21533  character %. After the %, the following appear in sequence:
21534 <ul>
21535 <li>  An optional assignment-suppressing wide character *.
21536 <li>  An optional decimal integer greater than zero that specifies the maximum field width
21537  (in wide characters).
21538 <li>  An optional length modifier that specifies the size of the receiving object.
21539 <li>  A conversion specifier wide character that specifies the type of conversion to be
21540  applied.
21541 </ul>
21542 <p><a name="7.29.2.2p4" href="#7.29.2.2p4"><small>4</small></a>
21543  The fwscanf function executes each directive of the format in turn. When all directives
21544  have been executed, or if a directive fails (as detailed below), the function returns.
21545  Failures are described as input failures (due to the occurrence of an encoding error or the
21546  unavailability of input characters), or matching failures (due to inappropriate input).
21547 <p><a name="7.29.2.2p5" href="#7.29.2.2p5"><small>5</small></a>
21548  A directive composed of white-space wide character(s) is executed by reading input up to
21549  the first non-white-space wide character (which remains unread), or until no more wide
21550  characters can be read. The directive never fails.
21551 <p><a name="7.29.2.2p6" href="#7.29.2.2p6"><small>6</small></a>
21552  A directive that is an ordinary wide character is executed by reading the next wide
21553  character of the stream. If that wide character differs from the directive, the directive
21554  fails and the differing and subsequent wide characters remain unread. Similarly, if end-
21555  of-file, an encoding error, or a read error prevents a wide character from being read, the
21556  directive fails.
21557 <p><a name="7.29.2.2p7" href="#7.29.2.2p7"><small>7</small></a>
21558  A directive that is a conversion specification defines a set of matching input sequences, as
21559  described below for each specifier. A conversion specification is executed in the
21560  following steps:
21561 <p><a name="7.29.2.2p8" href="#7.29.2.2p8"><small>8</small></a>
21562  Input white-space wide characters (as specified by the iswspace function) are skipped,
21563  unless the specification includes a [, c, or n specifier.<sup><a href="#note337"><b>337)</b></a></sup>
21564 <p><a name="7.29.2.2p9" href="#7.29.2.2p9"><small>9</small></a>
21565  An input item is read from the stream, unless the specification includes an n specifier. An
21566  input item is defined as the longest sequence of input wide characters which does not
21567  exceed any specified field width and which is, or is a prefix of, a matching input
21568  
21569  
21570 <!--page 430 -->
21571  sequence.<sup><a href="#note338"><b>338)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
21572  length of the input item is zero, the execution of the directive fails; this condition is a
21573  matching failure unless end-of-file, an encoding error, or a read error prevented input
21574  from the stream, in which case it is an input failure.
21575 <p><a name="7.29.2.2p10" href="#7.29.2.2p10"><small>10</small></a>
21576  Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
21577  count of input wide characters) is converted to a type appropriate to the conversion
21578  specifier. If the input item is not a matching sequence, the execution of the directive fails:
21579  this condition is a matching failure. Unless assignment suppression was indicated by a *,
21580  the result of the conversion is placed in the object pointed to by the first argument
21581  following the format argument that has not already received a conversion result. If this
21582  object does not have an appropriate type, or if the result of the conversion cannot be
21583  represented in the object, the behavior is undefined.
21584 <p><a name="7.29.2.2p11" href="#7.29.2.2p11"><small>11</small></a>
21585  The length modifiers and their meanings are:
21586  hh           Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21587 <pre>
21588               to an argument with type pointer to signed char or unsigned char.
21589 </pre>
21590  h            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21591 <pre>
21592               to an argument with type pointer to short int or unsigned short
21593               int.
21594 </pre>
21595  l (ell)      Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21596 <pre>
21597               to an argument with type pointer to long int or unsigned long
21598               int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
21599               an argument with type pointer to double; or that a following c, s, or [
21600               conversion specifier applies to an argument with type pointer to wchar_t.
21601 </pre>
21602  ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21603 <pre>
21604               to an argument with type pointer to long long int or unsigned
21605               long long int.
21606 </pre>
21607  j            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21608 <pre>
21609               to an argument with type pointer to intmax_t or uintmax_t.
21610 </pre>
21611  z            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21612 <pre>
21613               to an argument with type pointer to size_t or the corresponding signed
21614               integer type.
21615 </pre>
21616  t            Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
21617 <pre>
21618               to an argument with type pointer to ptrdiff_t or the corresponding
21619               unsigned integer type.
21620 </pre>
21621  
21622  
21623 <!--page 431 -->
21624  L            Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
21625 <pre>
21626               applies to an argument with type pointer to long double.
21627 </pre>
21628  If a length modifier appears with any conversion specifier other than as specified above,
21629  the behavior is undefined.
21630 <p><a name="7.29.2.2p12" href="#7.29.2.2p12"><small>12</small></a>
21631  The conversion specifiers and their meanings are:
21632  d           Matches an optionally signed decimal integer, whose format is the same as
21633 <pre>
21634              expected for the subject sequence of the wcstol function with the value 10
21635              for the base argument. The corresponding argument shall be a pointer to
21636              signed integer.
21637 </pre>
21638  i           Matches an optionally signed integer, whose format is the same as expected
21639 <pre>
21640              for the subject sequence of the wcstol function with the value 0 for the
21641              base argument. The corresponding argument shall be a pointer to signed
21642              integer.
21643 </pre>
21644  o           Matches an optionally signed octal integer, whose format is the same as
21645 <pre>
21646              expected for the subject sequence of the wcstoul function with the value 8
21647              for the base argument. The corresponding argument shall be a pointer to
21648              unsigned integer.
21649 </pre>
21650  u           Matches an optionally signed decimal integer, whose format is the same as
21651 <pre>
21652              expected for the subject sequence of the wcstoul function with the value 10
21653              for the base argument. The corresponding argument shall be a pointer to
21654              unsigned integer.
21655 </pre>
21656  x           Matches an optionally signed hexadecimal integer, whose format is the same
21657 <pre>
21658              as expected for the subject sequence of the wcstoul function with the value
21659              16 for the base argument. The corresponding argument shall be a pointer to
21660              unsigned integer.
21661 </pre>
21662  a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
21663 <pre>
21664          format is the same as expected for the subject sequence of the wcstod
21665          function. The corresponding argument shall be a pointer to floating.
21666 </pre>
21667  c           Matches a sequence of wide characters of exactly the number specified by the
21668 <!--page 432 -->
21669 <pre>
21670              field width (1 if no field width is present in the directive).
21671              If no l length modifier is present, characters from the input field are
21672              converted as if by repeated calls to the wcrtomb function, with the
21673              conversion state described by an mbstate_t object initialized to zero
21674              before the first wide character is converted. The corresponding argument
21675              shall be a pointer to the initial element of a character array large enough to
21676              accept the sequence. No null character is added.
21677              If an l length modifier is present, the corresponding argument shall be a
21678           pointer to the initial element of an array of wchar_t large enough to accept
21679           the sequence. No null wide character is added.
21680 </pre>
21681  s        Matches a sequence of non-white-space wide characters.
21682 <pre>
21683           If no l length modifier is present, characters from the input field are
21684           converted as if by repeated calls to the wcrtomb function, with the
21685           conversion state described by an mbstate_t object initialized to zero
21686           before the first wide character is converted. The corresponding argument
21687           shall be a pointer to the initial element of a character array large enough to
21688           accept the sequence and a terminating null character, which will be added
21689           automatically.
21690           If an l length modifier is present, the corresponding argument shall be a
21691           pointer to the initial element of an array of wchar_t large enough to accept
21692           the sequence and the terminating null wide character, which will be added
21693           automatically.
21694 </pre>
21695  [        Matches a nonempty sequence of wide characters from a set of expected
21696 <!--page 433 -->
21697 <pre>
21698           characters (the scanset).
21699           If no l length modifier is present, characters from the input field are
21700           converted as if by repeated calls to the wcrtomb function, with the
21701           conversion state described by an mbstate_t object initialized to zero
21702           before the first wide character is converted. The corresponding argument
21703           shall be a pointer to the initial element of a character array large enough to
21704           accept the sequence and a terminating null character, which will be added
21705           automatically.
21706           If an l length modifier is present, the corresponding argument shall be a
21707           pointer to the initial element of an array of wchar_t large enough to accept
21708           the sequence and the terminating null wide character, which will be added
21709           automatically.
21710           The conversion specifier includes all subsequent wide characters in the
21711           format string, up to and including the matching right bracket (]). The wide
21712           characters between the brackets (the scanlist) compose the scanset, unless the
21713           wide character after the left bracket is a circumflex (^), in which case the
21714           scanset contains all wide characters that do not appear in the scanlist between
21715           the circumflex and the right bracket. If the conversion specifier begins with
21716           [] or [^], the right bracket wide character is in the scanlist and the next
21717           following right bracket wide character is the matching right bracket that ends
21718           the specification; otherwise the first following right bracket wide character is
21719           the one that ends the specification. If a - wide character is in the scanlist and
21720           is not the first, nor the second where the first wide character is a ^, nor the
21721                 last character, the behavior is implementation-defined.
21722 </pre>
21723  p              Matches an implementation-defined set of sequences, which should be the
21724 <pre>
21725                 same as the set of sequences that may be produced by the %p conversion of
21726                 the fwprintf function. The corresponding argument shall be a pointer to a
21727                 pointer to void. The input item is converted to a pointer value in an
21728                 implementation-defined manner. If the input item is a value converted earlier
21729                 during the same program execution, the pointer that results shall compare
21730                 equal to that value; otherwise the behavior of the %p conversion is undefined.
21731 </pre>
21732  n              No input is consumed. The corresponding argument shall be a pointer to
21733 <pre>
21734                 signed integer into which is to be written the number of wide characters read
21735                 from the input stream so far by this call to the fwscanf function. Execution
21736                 of a %n directive does not increment the assignment count returned at the
21737                 completion of execution of the fwscanf function. No argument is
21738                 converted, but one is consumed. If the conversion specification includes an
21739                 assignment-suppressing wide character or a field width, the behavior is
21740                 undefined.
21741 </pre>
21742  %              Matches a single % wide character; no conversion or assignment occurs. The
21743 <pre>
21744                 complete conversion specification shall be %%.
21745 </pre>
21746 <p><a name="7.29.2.2p13" href="#7.29.2.2p13"><small>13</small></a>
21747  If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note339"><b>339)</b></a></sup>
21748 <p><a name="7.29.2.2p14" href="#7.29.2.2p14"><small>14</small></a>
21749  The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
21750  respectively, a, e, f, g, and x.
21751 <p><a name="7.29.2.2p15" href="#7.29.2.2p15"><small>15</small></a>
21752  Trailing white space (including new-line wide characters) is left unread unless matched
21753  by a directive. The success of literal matches and suppressed assignments is not directly
21754  determinable other than via the %n directive.
21755 <p><b>Returns</b>
21756 <p><a name="7.29.2.2p16" href="#7.29.2.2p16"><small>16</small></a>
21757  The fwscanf function returns the value of the macro EOF if an input failure occurs
21758  before the first conversion (if any) has completed. Otherwise, the function returns the
21759  number of input items assigned, which can be fewer than provided for, or even zero, in
21760  the event of an early matching failure.
21761 <p><a name="7.29.2.2p17" href="#7.29.2.2p17"><small>17</small></a>
21762  EXAMPLE 1       The call:
21763 <pre>
21764           #include <a href="#7.21">&lt;stdio.h&gt;</a>
21765           #include <a href="#7.29">&lt;wchar.h&gt;</a>
21766           /* ... */
21767           int n, i; float x; wchar_t name[50];
21768           n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);
21769 </pre>
21770  
21771  
21772  
21773 <!--page 434 -->
21774  with the input line:
21775 <pre>
21776           25 54.32E-1 thompson
21777 </pre>
21778  will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
21779  thompson\0.
21780  
21781 <p><a name="7.29.2.2p18" href="#7.29.2.2p18"><small>18</small></a>
21782  EXAMPLE 2        The call:
21783 <pre>
21784           #include <a href="#7.21">&lt;stdio.h&gt;</a>
21785           #include <a href="#7.29">&lt;wchar.h&gt;</a>
21786           /* ... */
21787           int i; float x; double y;
21788           fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);
21789 </pre>
21790  with input:
21791 <pre>
21792           56789 0123 56a72
21793 </pre>
21794  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
21795  56.0. The next wide character read from the input stream will be a.
21796  
21797 <p><b> Forward references</b>: the wcstod, wcstof, and wcstold functions (<a href="#7.29.4.1.1">7.29.4.1.1</a>), the
21798  wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.29.4.1.2">7.29.4.1.2</a>), the wcrtomb
21799  function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
21800
21801 <p><b>Footnotes</b>
21802 <p><small><a name="note337" href="#note337">337)</a> These white-space wide characters are not counted against a specified field width.
21803 </small>
21804 <p><small><a name="note338" href="#note338">338)</a> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
21805  sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
21806 </small>
21807 <p><small><a name="note339" href="#note339">339)</a> See ''future library directions'' (<a href="#7.31.16">7.31.16</a>).
21808 </small>
21809
21810 <p><small><a href="#Contents">Contents</a></small>
21811 <h5><a name="7.29.2.3" href="#7.29.2.3">7.29.2.3 The swprintf function</a></h5>
21812 <p><b>Synopsis</b>
21813 <p><a name="7.29.2.3p1" href="#7.29.2.3p1"><small>1</small></a>
21814 <pre>
21815           #include <a href="#7.29">&lt;wchar.h&gt;</a>
21816           int swprintf(wchar_t * restrict s,
21817                size_t n,
21818                const wchar_t * restrict format, ...);
21819 </pre>
21820 <p><b>Description</b>
21821 <p><a name="7.29.2.3p2" href="#7.29.2.3p2"><small>2</small></a>
21822  The swprintf function is equivalent to fwprintf, except that the argument s
21823  specifies an array of wide characters into which the generated output is to be written,
21824  rather than written to a stream. No more than n wide characters are written, including a
21825  terminating null wide character, which is always added (unless n is zero).
21826 <p><b>Returns</b>
21827 <p><a name="7.29.2.3p3" href="#7.29.2.3p3"><small>3</small></a>
21828  The swprintf function returns the number of wide characters written in the array, not
21829  counting the terminating null wide character, or a negative value if an encoding error
21830  occurred or if n or more wide characters were requested to be written.
21831 <!--page 435 -->
21832
21833 <p><small><a href="#Contents">Contents</a></small>
21834 <h5><a name="7.29.2.4" href="#7.29.2.4">7.29.2.4 The swscanf function</a></h5>
21835 <p><b>Synopsis</b>
21836 <p><a name="7.29.2.4p1" href="#7.29.2.4p1"><small>1</small></a>
21837 <pre>
21838          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21839          int swscanf(const wchar_t * restrict s,
21840               const wchar_t * restrict format, ...);
21841 </pre>
21842 <p><b>Description</b>
21843 <p><a name="7.29.2.4p2" href="#7.29.2.4p2"><small>2</small></a>
21844  The swscanf function is equivalent to fwscanf, except that the argument s specifies a
21845  wide string from which the input is to be obtained, rather than from a stream. Reaching
21846  the end of the wide string is equivalent to encountering end-of-file for the fwscanf
21847  function.
21848 <p><b>Returns</b>
21849 <p><a name="7.29.2.4p3" href="#7.29.2.4p3"><small>3</small></a>
21850  The swscanf function returns the value of the macro EOF if an input failure occurs
21851  before the first conversion (if any) has completed. Otherwise, the swscanf function
21852  returns the number of input items assigned, which can be fewer than provided for, or even
21853  zero, in the event of an early matching failure.
21854
21855 <p><small><a href="#Contents">Contents</a></small>
21856 <h5><a name="7.29.2.5" href="#7.29.2.5">7.29.2.5 The vfwprintf function</a></h5>
21857 <p><b>Synopsis</b>
21858 <p><a name="7.29.2.5p1" href="#7.29.2.5p1"><small>1</small></a>
21859 <pre>
21860          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
21861          #include <a href="#7.21">&lt;stdio.h&gt;</a>
21862          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21863          int vfwprintf(FILE * restrict stream,
21864               const wchar_t * restrict format,
21865               va_list arg);
21866 </pre>
21867 <p><b>Description</b>
21868 <p><a name="7.29.2.5p2" href="#7.29.2.5p2"><small>2</small></a>
21869  The vfwprintf function is equivalent to fwprintf, with the variable argument list
21870  replaced by arg, which shall have been initialized by the va_start macro (and
21871  possibly subsequent va_arg calls). The vfwprintf function does not invoke the
21872  va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
21873 <p><b>Returns</b>
21874 <p><a name="7.29.2.5p3" href="#7.29.2.5p3"><small>3</small></a>
21875  The vfwprintf function returns the number of wide characters transmitted, or a
21876  negative value if an output or encoding error occurred.
21877  
21878  
21879  
21880  
21881 <!--page 436 -->
21882 <p><a name="7.29.2.5p4" href="#7.29.2.5p4"><small>4</small></a>
21883  EXAMPLE       The following shows the use of the vfwprintf function in a general error-reporting
21884  routine.
21885 <pre>
21886         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
21887         #include <a href="#7.21">&lt;stdio.h&gt;</a>
21888         #include <a href="#7.29">&lt;wchar.h&gt;</a>
21889         void error(char *function_name, wchar_t *format, ...)
21890         {
21891               va_list args;
21892                  va_start(args, format);
21893                  // print out name of function causing error
21894                  fwprintf(stderr, L"ERROR in %s: ", function_name);
21895                  // print out remainder of message
21896                  vfwprintf(stderr, format, args);
21897                  va_end(args);
21898         }
21899 </pre>
21900  
21901
21902 <p><b>Footnotes</b>
21903 <p><small><a name="note340" href="#note340">340)</a> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
21904  invoke the va_arg macro, the value of arg after the return is indeterminate.
21905 </small>
21906
21907 <p><small><a href="#Contents">Contents</a></small>
21908 <h5><a name="7.29.2.6" href="#7.29.2.6">7.29.2.6 The vfwscanf function</a></h5>
21909 <p><b>Synopsis</b>
21910 <p><a name="7.29.2.6p1" href="#7.29.2.6p1"><small>1</small></a>
21911 <pre>
21912         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
21913         #include <a href="#7.21">&lt;stdio.h&gt;</a>
21914         #include <a href="#7.29">&lt;wchar.h&gt;</a>
21915         int vfwscanf(FILE * restrict stream,
21916              const wchar_t * restrict format,
21917              va_list arg);
21918 </pre>
21919 <p><b>Description</b>
21920 <p><a name="7.29.2.6p2" href="#7.29.2.6p2"><small>2</small></a>
21921  The vfwscanf function is equivalent to fwscanf, with the variable argument list
21922  replaced by arg, which shall have been initialized by the va_start macro (and
21923  possibly subsequent va_arg calls). The vfwscanf function does not invoke the
21924  va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
21925 <p><b>Returns</b>
21926 <p><a name="7.29.2.6p3" href="#7.29.2.6p3"><small>3</small></a>
21927  The vfwscanf function returns the value of the macro EOF if an input failure occurs
21928  before the first conversion (if any) has completed. Otherwise, the vfwscanf function
21929  returns the number of input items assigned, which can be fewer than provided for, or even
21930  zero, in the event of an early matching failure.
21931 <!--page 437 -->
21932
21933 <p><small><a href="#Contents">Contents</a></small>
21934 <h5><a name="7.29.2.7" href="#7.29.2.7">7.29.2.7 The vswprintf function</a></h5>
21935 <p><b>Synopsis</b>
21936 <p><a name="7.29.2.7p1" href="#7.29.2.7p1"><small>1</small></a>
21937 <pre>
21938          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
21939          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21940          int vswprintf(wchar_t * restrict s,
21941               size_t n,
21942               const wchar_t * restrict format,
21943               va_list arg);
21944 </pre>
21945 <p><b>Description</b>
21946 <p><a name="7.29.2.7p2" href="#7.29.2.7p2"><small>2</small></a>
21947  The vswprintf function is equivalent to swprintf, with the variable argument list
21948  replaced by arg, which shall have been initialized by the va_start macro (and
21949  possibly subsequent va_arg calls). The vswprintf function does not invoke the
21950  va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
21951 <p><b>Returns</b>
21952 <p><a name="7.29.2.7p3" href="#7.29.2.7p3"><small>3</small></a>
21953  The vswprintf function returns the number of wide characters written in the array, not
21954  counting the terminating null wide character, or a negative value if an encoding error
21955  occurred or if n or more wide characters were requested to be generated.
21956
21957 <p><small><a href="#Contents">Contents</a></small>
21958 <h5><a name="7.29.2.8" href="#7.29.2.8">7.29.2.8 The vswscanf function</a></h5>
21959 <p><b>Synopsis</b>
21960 <p><a name="7.29.2.8p1" href="#7.29.2.8p1"><small>1</small></a>
21961 <pre>
21962          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
21963          #include <a href="#7.29">&lt;wchar.h&gt;</a>
21964          int vswscanf(const wchar_t * restrict s,
21965               const wchar_t * restrict format,
21966               va_list arg);
21967 </pre>
21968 <p><b>Description</b>
21969 <p><a name="7.29.2.8p2" href="#7.29.2.8p2"><small>2</small></a>
21970  The vswscanf function is equivalent to swscanf, with the variable argument list
21971  replaced by arg, which shall have been initialized by the va_start macro (and
21972  possibly subsequent va_arg calls). The vswscanf function does not invoke the
21973  va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
21974 <p><b>Returns</b>
21975 <p><a name="7.29.2.8p3" href="#7.29.2.8p3"><small>3</small></a>
21976  The vswscanf function returns the value of the macro EOF if an input failure occurs
21977  before the first conversion (if any) has completed. Otherwise, the vswscanf function
21978  returns the number of input items assigned, which can be fewer than provided for, or even
21979  zero, in the event of an early matching failure.
21980 <!--page 438 -->
21981
21982 <p><small><a href="#Contents">Contents</a></small>
21983 <h5><a name="7.29.2.9" href="#7.29.2.9">7.29.2.9 The vwprintf function</a></h5>
21984 <p><b>Synopsis</b>
21985 <p><a name="7.29.2.9p1" href="#7.29.2.9p1"><small>1</small></a>
21986 <pre>
21987         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
21988         #include <a href="#7.29">&lt;wchar.h&gt;</a>
21989         int vwprintf(const wchar_t * restrict format,
21990              va_list arg);
21991 </pre>
21992 <p><b>Description</b>
21993 <p><a name="7.29.2.9p2" href="#7.29.2.9p2"><small>2</small></a>
21994  The vwprintf function is equivalent to wprintf, with the variable argument list
21995  replaced by arg, which shall have been initialized by the va_start macro (and
21996  possibly subsequent va_arg calls). The vwprintf function does not invoke the
21997  va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
21998 <p><b>Returns</b>
21999 <p><a name="7.29.2.9p3" href="#7.29.2.9p3"><small>3</small></a>
22000  The vwprintf function returns the number of wide characters transmitted, or a negative
22001  value if an output or encoding error occurred.
22002
22003 <p><small><a href="#Contents">Contents</a></small>
22004 <h5><a name="7.29.2.10" href="#7.29.2.10">7.29.2.10 The vwscanf function</a></h5>
22005 <p><b>Synopsis</b>
22006 <p><a name="7.29.2.10p1" href="#7.29.2.10p1"><small>1</small></a>
22007 <pre>
22008         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
22009         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22010         int vwscanf(const wchar_t * restrict format,
22011              va_list arg);
22012 </pre>
22013 <p><b>Description</b>
22014 <p><a name="7.29.2.10p2" href="#7.29.2.10p2"><small>2</small></a>
22015  The vwscanf function is equivalent to wscanf, with the variable argument list
22016  replaced by arg, which shall have been initialized by the va_start macro (and
22017  possibly subsequent va_arg calls). The vwscanf function does not invoke the
22018  va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
22019 <p><b>Returns</b>
22020 <p><a name="7.29.2.10p3" href="#7.29.2.10p3"><small>3</small></a>
22021  The vwscanf function returns the value of the macro EOF if an input failure occurs
22022  before the first conversion (if any) has completed. Otherwise, the vwscanf function
22023  returns the number of input items assigned, which can be fewer than provided for, or even
22024  zero, in the event of an early matching failure.
22025 <!--page 439 -->
22026
22027 <p><small><a href="#Contents">Contents</a></small>
22028 <h5><a name="7.29.2.11" href="#7.29.2.11">7.29.2.11 The wprintf function</a></h5>
22029 <p><b>Synopsis</b>
22030 <p><a name="7.29.2.11p1" href="#7.29.2.11p1"><small>1</small></a>
22031 <pre>
22032          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22033          int wprintf(const wchar_t * restrict format, ...);
22034 </pre>
22035 <p><b>Description</b>
22036 <p><a name="7.29.2.11p2" href="#7.29.2.11p2"><small>2</small></a>
22037  The wprintf function is equivalent to fwprintf with the argument stdout
22038  interposed before the arguments to wprintf.
22039 <p><b>Returns</b>
22040 <p><a name="7.29.2.11p3" href="#7.29.2.11p3"><small>3</small></a>
22041  The wprintf function returns the number of wide characters transmitted, or a negative
22042  value if an output or encoding error occurred.
22043
22044 <p><small><a href="#Contents">Contents</a></small>
22045 <h5><a name="7.29.2.12" href="#7.29.2.12">7.29.2.12 The wscanf function</a></h5>
22046 <p><b>Synopsis</b>
22047 <p><a name="7.29.2.12p1" href="#7.29.2.12p1"><small>1</small></a>
22048 <pre>
22049          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22050          int wscanf(const wchar_t * restrict format, ...);
22051 </pre>
22052 <p><b>Description</b>
22053 <p><a name="7.29.2.12p2" href="#7.29.2.12p2"><small>2</small></a>
22054  The wscanf function is equivalent to fwscanf with the argument stdin interposed
22055  before the arguments to wscanf.
22056 <p><b>Returns</b>
22057 <p><a name="7.29.2.12p3" href="#7.29.2.12p3"><small>3</small></a>
22058  The wscanf function returns the value of the macro EOF if an input failure occurs
22059  before the first conversion (if any) has completed. Otherwise, the wscanf function
22060  returns the number of input items assigned, which can be fewer than provided for, or even
22061  zero, in the event of an early matching failure.
22062
22063 <p><small><a href="#Contents">Contents</a></small>
22064 <h4><a name="7.29.3" href="#7.29.3">7.29.3 Wide character input/output functions</a></h4>
22065
22066 <p><small><a href="#Contents">Contents</a></small>
22067 <h5><a name="7.29.3.1" href="#7.29.3.1">7.29.3.1 The fgetwc function</a></h5>
22068 <p><b>Synopsis</b>
22069 <p><a name="7.29.3.1p1" href="#7.29.3.1p1"><small>1</small></a>
22070 <pre>
22071          #include <a href="#7.21">&lt;stdio.h&gt;</a>
22072          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22073          wint_t fgetwc(FILE *stream);
22074 </pre>
22075 <p><b>Description</b>
22076 <p><a name="7.29.3.1p2" href="#7.29.3.1p2"><small>2</small></a>
22077  If the end-of-file indicator for the input stream pointed to by stream is not set and a
22078  next wide character is present, the fgetwc function obtains that wide character as a
22079  wchar_t converted to a wint_t and advances the associated file position indicator for
22080  the stream (if defined).
22081 <!--page 440 -->
22082 <p><b>Returns</b>
22083 <p><a name="7.29.3.1p3" href="#7.29.3.1p3"><small>3</small></a>
22084  If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
22085  of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
22086  the fgetwc function returns the next wide character from the input stream pointed to by
22087  stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
22088  function returns WEOF. If an encoding error occurs (including too few bytes), the value of
22089  the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note341"><b>341)</b></a></sup>
22090
22091 <p><b>Footnotes</b>
22092 <p><small><a name="note341" href="#note341">341)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
22093  Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
22094 </small>
22095
22096 <p><small><a href="#Contents">Contents</a></small>
22097 <h5><a name="7.29.3.2" href="#7.29.3.2">7.29.3.2 The fgetws function</a></h5>
22098 <p><b>Synopsis</b>
22099 <p><a name="7.29.3.2p1" href="#7.29.3.2p1"><small>1</small></a>
22100 <pre>
22101          #include <a href="#7.21">&lt;stdio.h&gt;</a>
22102          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22103          wchar_t *fgetws(wchar_t * restrict s,
22104               int n, FILE * restrict stream);
22105 </pre>
22106 <p><b>Description</b>
22107 <p><a name="7.29.3.2p2" href="#7.29.3.2p2"><small>2</small></a>
22108  The fgetws function reads at most one less than the number of wide characters
22109  specified by n from the stream pointed to by stream into the array pointed to by s. No
22110  additional wide characters are read after a new-line wide character (which is retained) or
22111  after end-of-file. A null wide character is written immediately after the last wide
22112  character read into the array.
22113 <p><b>Returns</b>
22114 <p><a name="7.29.3.2p3" href="#7.29.3.2p3"><small>3</small></a>
22115  The fgetws function returns s if successful. If end-of-file is encountered and no
22116  characters have been read into the array, the contents of the array remain unchanged and a
22117  null pointer is returned. If a read or encoding error occurs during the operation, the array
22118  contents are indeterminate and a null pointer is returned.
22119
22120 <p><small><a href="#Contents">Contents</a></small>
22121 <h5><a name="7.29.3.3" href="#7.29.3.3">7.29.3.3 The fputwc function</a></h5>
22122 <p><b>Synopsis</b>
22123 <p><a name="7.29.3.3p1" href="#7.29.3.3p1"><small>1</small></a>
22124 <pre>
22125          #include <a href="#7.21">&lt;stdio.h&gt;</a>
22126          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22127          wint_t fputwc(wchar_t c, FILE *stream);
22128 </pre>
22129 <p><b>Description</b>
22130 <p><a name="7.29.3.3p2" href="#7.29.3.3p2"><small>2</small></a>
22131  The fputwc function writes the wide character specified by c to the output stream
22132  pointed to by stream, at the position indicated by the associated file position indicator
22133  for the stream (if defined), and advances the indicator appropriately. If the file cannot
22134  
22135 <!--page 441 -->
22136  support positioning requests, or if the stream was opened with append mode, the
22137  character is appended to the output stream.
22138 <p><b>Returns</b>
22139 <p><a name="7.29.3.3p3" href="#7.29.3.3p3"><small>3</small></a>
22140  The fputwc function returns the wide character written. If a write error occurs, the
22141  error indicator for the stream is set and fputwc returns WEOF. If an encoding error
22142  occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
22143
22144 <p><small><a href="#Contents">Contents</a></small>
22145 <h5><a name="7.29.3.4" href="#7.29.3.4">7.29.3.4 The fputws function</a></h5>
22146 <p><b>Synopsis</b>
22147 <p><a name="7.29.3.4p1" href="#7.29.3.4p1"><small>1</small></a>
22148 <pre>
22149          #include <a href="#7.21">&lt;stdio.h&gt;</a>
22150          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22151          int fputws(const wchar_t * restrict s,
22152               FILE * restrict stream);
22153 </pre>
22154 <p><b>Description</b>
22155 <p><a name="7.29.3.4p2" href="#7.29.3.4p2"><small>2</small></a>
22156  The fputws function writes the wide string pointed to by s to the stream pointed to by
22157  stream. The terminating null wide character is not written.
22158 <p><b>Returns</b>
22159 <p><a name="7.29.3.4p3" href="#7.29.3.4p3"><small>3</small></a>
22160  The fputws function returns EOF if a write or encoding error occurs; otherwise, it
22161  returns a nonnegative value.
22162
22163 <p><small><a href="#Contents">Contents</a></small>
22164 <h5><a name="7.29.3.5" href="#7.29.3.5">7.29.3.5 The fwide function</a></h5>
22165 <p><b>Synopsis</b>
22166 <p><a name="7.29.3.5p1" href="#7.29.3.5p1"><small>1</small></a>
22167 <pre>
22168          #include <a href="#7.21">&lt;stdio.h&gt;</a>
22169          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22170          int fwide(FILE *stream, int mode);
22171 </pre>
22172 <p><b>Description</b>
22173 <p><a name="7.29.3.5p2" href="#7.29.3.5p2"><small>2</small></a>
22174  The fwide function determines the orientation of the stream pointed to by stream. If
22175  mode is greater than zero, the function first attempts to make the stream wide oriented. If
22176  mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note342"><b>342)</b></a></sup>
22177  Otherwise, mode is zero and the function does not alter the orientation of the stream.
22178 <p><b>Returns</b>
22179 <p><a name="7.29.3.5p3" href="#7.29.3.5p3"><small>3</small></a>
22180  The fwide function returns a value greater than zero if, after the call, the stream has
22181  wide orientation, a value less than zero if the stream has byte orientation, or zero if the
22182  stream has no orientation.
22183  
22184  
22185 <!--page 442 -->
22186
22187 <p><b>Footnotes</b>
22188 <p><small><a name="note342" href="#note342">342)</a> If the orientation of the stream has already been determined, fwide does not change it.
22189 </small>
22190
22191 <p><small><a href="#Contents">Contents</a></small>
22192 <h5><a name="7.29.3.6" href="#7.29.3.6">7.29.3.6 The getwc function</a></h5>
22193 <p><b>Synopsis</b>
22194 <p><a name="7.29.3.6p1" href="#7.29.3.6p1"><small>1</small></a>
22195 <pre>
22196         #include <a href="#7.21">&lt;stdio.h&gt;</a>
22197         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22198         wint_t getwc(FILE *stream);
22199 </pre>
22200 <p><b>Description</b>
22201 <p><a name="7.29.3.6p2" href="#7.29.3.6p2"><small>2</small></a>
22202  The getwc function is equivalent to fgetwc, except that if it is implemented as a
22203  macro, it may evaluate stream more than once, so the argument should never be an
22204  expression with side effects.
22205 <p><b>Returns</b>
22206 <p><a name="7.29.3.6p3" href="#7.29.3.6p3"><small>3</small></a>
22207  The getwc function returns the next wide character from the input stream pointed to by
22208  stream, or WEOF.
22209
22210 <p><small><a href="#Contents">Contents</a></small>
22211 <h5><a name="7.29.3.7" href="#7.29.3.7">7.29.3.7 The getwchar function</a></h5>
22212 <p><b>Synopsis</b>
22213 <p><a name="7.29.3.7p1" href="#7.29.3.7p1"><small>1</small></a>
22214 <pre>
22215         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22216         wint_t getwchar(void);
22217 </pre>
22218 <p><b>Description</b>
22219 <p><a name="7.29.3.7p2" href="#7.29.3.7p2"><small>2</small></a>
22220  The getwchar function is equivalent to getwc with the argument stdin.
22221 <p><b>Returns</b>
22222 <p><a name="7.29.3.7p3" href="#7.29.3.7p3"><small>3</small></a>
22223  The getwchar function returns the next wide character from the input stream pointed to
22224  by stdin, or WEOF.
22225
22226 <p><small><a href="#Contents">Contents</a></small>
22227 <h5><a name="7.29.3.8" href="#7.29.3.8">7.29.3.8 The putwc function</a></h5>
22228 <p><b>Synopsis</b>
22229 <p><a name="7.29.3.8p1" href="#7.29.3.8p1"><small>1</small></a>
22230 <pre>
22231         #include <a href="#7.21">&lt;stdio.h&gt;</a>
22232         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22233         wint_t putwc(wchar_t c, FILE *stream);
22234 </pre>
22235 <p><b>Description</b>
22236 <p><a name="7.29.3.8p2" href="#7.29.3.8p2"><small>2</small></a>
22237  The putwc function is equivalent to fputwc, except that if it is implemented as a
22238  macro, it may evaluate stream more than once, so that argument should never be an
22239  expression with side effects.
22240 <p><b>Returns</b>
22241 <p><a name="7.29.3.8p3" href="#7.29.3.8p3"><small>3</small></a>
22242  The putwc function returns the wide character written, or WEOF.
22243 <!--page 443 -->
22244
22245 <p><small><a href="#Contents">Contents</a></small>
22246 <h5><a name="7.29.3.9" href="#7.29.3.9">7.29.3.9 The putwchar function</a></h5>
22247 <p><b>Synopsis</b>
22248 <p><a name="7.29.3.9p1" href="#7.29.3.9p1"><small>1</small></a>
22249 <pre>
22250          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22251          wint_t putwchar(wchar_t c);
22252 </pre>
22253 <p><b>Description</b>
22254 <p><a name="7.29.3.9p2" href="#7.29.3.9p2"><small>2</small></a>
22255  The putwchar function is equivalent to putwc with the second argument stdout.
22256 <p><b>Returns</b>
22257 <p><a name="7.29.3.9p3" href="#7.29.3.9p3"><small>3</small></a>
22258  The putwchar function returns the character written, or WEOF.
22259
22260 <p><small><a href="#Contents">Contents</a></small>
22261 <h5><a name="7.29.3.10" href="#7.29.3.10">7.29.3.10 The ungetwc function</a></h5>
22262 <p><b>Synopsis</b>
22263 <p><a name="7.29.3.10p1" href="#7.29.3.10p1"><small>1</small></a>
22264 <pre>
22265          #include <a href="#7.21">&lt;stdio.h&gt;</a>
22266          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22267          wint_t ungetwc(wint_t c, FILE *stream);
22268 </pre>
22269 <p><b>Description</b>
22270 <p><a name="7.29.3.10p2" href="#7.29.3.10p2"><small>2</small></a>
22271  The ungetwc function pushes the wide character specified by c back onto the input
22272  stream pointed to by stream. Pushed-back wide characters will be returned by
22273  subsequent reads on that stream in the reverse order of their pushing. A successful
22274  intervening call (with the stream pointed to by stream) to a file positioning function
22275  (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
22276  stream. The external storage corresponding to the stream is unchanged.
22277 <p><a name="7.29.3.10p3" href="#7.29.3.10p3"><small>3</small></a>
22278  One wide character of pushback is guaranteed, even if the call to the ungetwc function
22279  follows just after a call to a formatted wide character input function fwscanf,
22280  vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
22281  on the same stream without an intervening read or file positioning operation on that
22282  stream, the operation may fail.
22283 <p><a name="7.29.3.10p4" href="#7.29.3.10p4"><small>4</small></a>
22284  If the value of c equals that of the macro WEOF, the operation fails and the input stream is
22285  unchanged.
22286 <p><a name="7.29.3.10p5" href="#7.29.3.10p5"><small>5</small></a>
22287  A successful call to the ungetwc function clears the end-of-file indicator for the stream.
22288  The value of the file position indicator for the stream after reading or discarding all
22289  pushed-back wide characters is the same as it was before the wide characters were pushed
22290  back. For a text or binary stream, the value of its file position indicator after a successful
22291  call to the ungetwc function is unspecified until all pushed-back wide characters are
22292  read or discarded.
22293 <!--page 444 -->
22294 <p><b>Returns</b>
22295 <p><a name="7.29.3.10p6" href="#7.29.3.10p6"><small>6</small></a>
22296  The ungetwc function returns the wide character pushed back, or WEOF if the operation
22297  fails.
22298
22299 <p><small><a href="#Contents">Contents</a></small>
22300 <h4><a name="7.29.4" href="#7.29.4">7.29.4 General wide string utilities</a></h4>
22301 <p><a name="7.29.4p1" href="#7.29.4p1"><small>1</small></a>
22302  The header <a href="#7.29">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
22303  manipulation. Various methods are used for determining the lengths of the arrays, but in
22304  all cases a wchar_t * argument points to the initial (lowest addressed) element of the
22305  array. If an array is accessed beyond the end of an object, the behavior is undefined.
22306 <p><a name="7.29.4p2" href="#7.29.4p2"><small>2</small></a>
22307  Where an argument declared as size_t n determines the length of the array for a
22308  function, n can have the value zero on a call to that function. Unless explicitly stated
22309  otherwise in the description of a particular function in this subclause, pointer arguments
22310  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
22311  function that locates a wide character finds no occurrence, a function that compares two
22312  wide character sequences returns zero, and a function that copies wide characters copies
22313  zero wide characters.
22314
22315 <p><small><a href="#Contents">Contents</a></small>
22316 <h5><a name="7.29.4.1" href="#7.29.4.1">7.29.4.1 Wide string numeric conversion functions</a></h5>
22317
22318 <p><small><a href="#Contents">Contents</a></small>
22319 <h5><a name="7.29.4.1.1" href="#7.29.4.1.1">7.29.4.1.1 The wcstod, wcstof, and wcstold functions</a></h5>
22320 <p><b>Synopsis</b>
22321 <p><a name="7.29.4.1.1p1" href="#7.29.4.1.1p1"><small>1</small></a>
22322 <pre>
22323         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22324         double wcstod(const wchar_t * restrict nptr,
22325              wchar_t ** restrict endptr);
22326         float wcstof(const wchar_t * restrict nptr,
22327              wchar_t ** restrict endptr);
22328         long double wcstold(const wchar_t * restrict nptr,
22329              wchar_t ** restrict endptr);
22330 </pre>
22331 <p><b>Description</b>
22332 <p><a name="7.29.4.1.1p2" href="#7.29.4.1.1p2"><small>2</small></a>
22333  The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
22334  string pointed to by nptr to double, float, and long double representation,
22335  respectively. First, they decompose the input string into three parts: an initial, possibly
22336  empty, sequence of white-space wide characters (as specified by the iswspace
22337  function), a subject sequence resembling a floating-point constant or representing an
22338  infinity or NaN; and a final wide string of one or more unrecognized wide characters,
22339  including the terminating null wide character of the input wide string. Then, they attempt
22340  to convert the subject sequence to a floating-point number, and return the result.
22341 <p><a name="7.29.4.1.1p3" href="#7.29.4.1.1p3"><small>3</small></a>
22342  The expected form of the subject sequence is an optional plus or minus sign, then one of
22343  the following:
22344 <!--page 445 -->
22345 <ul>
22346 <li>  a nonempty sequence of decimal digits optionally containing a decimal-point wide
22347  character, then an optional exponent part as defined for the corresponding single-byte
22348  characters in <a href="#6.4.4.2">6.4.4.2</a>;
22349 <li>  a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
22350  decimal-point wide character, then an optional binary exponent part as defined in
22351  <a href="#6.4.4.2">6.4.4.2</a>;
22352 <li>  INF or INFINITY, or any other wide string equivalent except for case
22353 <li>  NAN or NAN(n-wchar-sequence<sub>opt</sub>), or any other wide string equivalent except for
22354  case in the NAN part, where:
22355 <pre>
22356             n-wchar-sequence:
22357                   digit
22358                   nondigit
22359                   n-wchar-sequence digit
22360                   n-wchar-sequence nondigit
22361 </pre>
22362 </ul>
22363  The subject sequence is defined as the longest initial subsequence of the input wide
22364  string, starting with the first non-white-space wide character, that is of the expected form.
22365  The subject sequence contains no wide characters if the input wide string is not of the
22366  expected form.
22367 <p><a name="7.29.4.1.1p4" href="#7.29.4.1.1p4"><small>4</small></a>
22368  If the subject sequence has the expected form for a floating-point number, the sequence of
22369  wide characters starting with the first digit or the decimal-point wide character
22370  (whichever occurs first) is interpreted as a floating constant according to the rules of
22371  <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
22372  if neither an exponent part nor a decimal-point wide character appears in a decimal
22373  floating point number, or if a binary exponent part does not appear in a hexadecimal
22374  floating point number, an exponent part of the appropriate type with value zero is
22375  assumed to follow the last digit in the string. If the subject sequence begins with a minus
22376  sign, the sequence is interpreted as negated.<sup><a href="#note343"><b>343)</b></a></sup> A wide character sequence INF or
22377  INFINITY is interpreted as an infinity, if representable in the return type, else like a
22378  floating constant that is too large for the range of the return type. A wide character
22379  sequence NAN or NAN(n-wchar-sequence<sub>opt</sub>) is interpreted as a quiet NaN, if supported
22380  in the return type, else like a subject sequence part that does not have the expected form;
22381  the meaning of the n-wchar sequence is implementation-defined.<sup><a href="#note344"><b>344)</b></a></sup> A pointer to the
22382  
22383 <!--page 446 -->
22384  final wide string is stored in the object pointed to by endptr, provided that endptr is
22385  not a null pointer.
22386 <p><a name="7.29.4.1.1p5" href="#7.29.4.1.1p5"><small>5</small></a>
22387  If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
22388  value resulting from the conversion is correctly rounded.
22389 <p><a name="7.29.4.1.1p6" href="#7.29.4.1.1p6"><small>6</small></a>
22390  In other than the "C" locale, additional locale-specific subject sequence forms may be
22391  accepted.
22392 <p><a name="7.29.4.1.1p7" href="#7.29.4.1.1p7"><small>7</small></a>
22393  If the subject sequence is empty or does not have the expected form, no conversion is
22394  performed; the value of nptr is stored in the object pointed to by endptr, provided
22395  that endptr is not a null pointer.
22396 <p><b>Recommended practice</b>
22397 <p><a name="7.29.4.1.1p8" href="#7.29.4.1.1p8"><small>8</small></a>
22398  If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
22399  the result is not exactly representable, the result should be one of the two numbers in the
22400  appropriate internal format that are adjacent to the hexadecimal floating source value,
22401  with the extra stipulation that the error should have a correct sign for the current rounding
22402  direction.
22403 <p><a name="7.29.4.1.1p9" href="#7.29.4.1.1p9"><small>9</small></a>
22404  If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
22405  <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
22406  sequence D has the decimal form and more than DECIMAL_DIG significant digits,
22407  consider the two bounding, adjacent decimal strings L and U, both having
22408  DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
22409  The result should be one of the (equal or adjacent) values that would be obtained by
22410  correctly rounding L and U according to the current rounding direction, with the extra
22411  stipulation that the error with respect to D should have a correct sign for the current
22412  rounding direction.<sup><a href="#note345"><b>345)</b></a></sup>
22413 <p><b>Returns</b>
22414 <p><a name="7.29.4.1.1p10" href="#7.29.4.1.1p10"><small>10</small></a>
22415  The functions return the converted value, if any. If no conversion could be performed,
22416  zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
22417  plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the
22418  return type and sign of the value), and the value of the macro ERANGE is stored in
22419  errno. If the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is
22420  no greater than the smallest normalized positive number in the return type; whether
22421  errno acquires the value ERANGE is implementation-defined.
22422  
22423  
22424  
22425  
22426 <!--page 447 -->
22427
22428 <p><b>Footnotes</b>
22429 <p><small><a name="note343" href="#note343">343)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
22430  negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
22431  methods may yield different results if rounding is toward positive or negative infinity. In either case,
22432  the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
22433 </small>
22434 <p><small><a name="note344" href="#note344">344)</a> An implementation may use the n-wchar sequence to determine extra information to be represented in
22435  the NaN's significand.
22436 </small>
22437 <p><small><a name="note345" href="#note345">345)</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
22438  to the same internal floating value, but if not will round to adjacent values.
22439 </small>
22440
22441 <p><small><a href="#Contents">Contents</a></small>
22442 <h5><a name="7.29.4.1.2" href="#7.29.4.1.2">7.29.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</a></h5>
22443 <p><b>Synopsis</b>
22444 <p><a name="7.29.4.1.2p1" href="#7.29.4.1.2p1"><small>1</small></a>
22445 <pre>
22446          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22447          long int wcstol(
22448               const wchar_t * restrict nptr,
22449               wchar_t ** restrict endptr,
22450               int base);
22451          long long int wcstoll(
22452               const wchar_t * restrict nptr,
22453               wchar_t ** restrict endptr,
22454               int base);
22455          unsigned long int wcstoul(
22456               const wchar_t * restrict nptr,
22457               wchar_t ** restrict endptr,
22458               int base);
22459          unsigned long long int wcstoull(
22460               const wchar_t * restrict nptr,
22461               wchar_t ** restrict endptr,
22462               int base);
22463 </pre>
22464 <p><b>Description</b>
22465 <p><a name="7.29.4.1.2p2" href="#7.29.4.1.2p2"><small>2</small></a>
22466  The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
22467  portion of the wide string pointed to by nptr to long int, long long int,
22468  unsigned long int, and unsigned long long int representation,
22469  respectively. First, they decompose the input string into three parts: an initial, possibly
22470  empty, sequence of white-space wide characters (as specified by the iswspace
22471  function), a subject sequence resembling an integer represented in some radix determined
22472  by the value of base, and a final wide string of one or more unrecognized wide
22473  characters, including the terminating null wide character of the input wide string. Then,
22474  they attempt to convert the subject sequence to an integer, and return the result.
22475 <p><a name="7.29.4.1.2p3" href="#7.29.4.1.2p3"><small>3</small></a>
22476  If the value of base is zero, the expected form of the subject sequence is that of an
22477  integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
22478  optionally preceded by a plus or minus sign, but not including an integer suffix. If the
22479  value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
22480  is a sequence of letters and digits representing an integer with the radix specified by
22481  base, optionally preceded by a plus or minus sign, but not including an integer suffix.
22482  The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
22483  letters and digits whose ascribed values are less than that of base are permitted. If the
22484  value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
22485  of letters and digits, following the sign if present.
22486 <!--page 448 -->
22487 <p><a name="7.29.4.1.2p4" href="#7.29.4.1.2p4"><small>4</small></a>
22488  The subject sequence is defined as the longest initial subsequence of the input wide
22489  string, starting with the first non-white-space wide character, that is of the expected form.
22490  The subject sequence contains no wide characters if the input wide string is empty or
22491  consists entirely of white space, or if the first non-white-space wide character is other
22492  than a sign or a permissible letter or digit.
22493 <p><a name="7.29.4.1.2p5" href="#7.29.4.1.2p5"><small>5</small></a>
22494  If the subject sequence has the expected form and the value of base is zero, the sequence
22495  of wide characters starting with the first digit is interpreted as an integer constant
22496  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
22497  value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
22498  letter its value as given above. If the subject sequence begins with a minus sign, the value
22499  resulting from the conversion is negated (in the return type). A pointer to the final wide
22500  string is stored in the object pointed to by endptr, provided that endptr is not a null
22501  pointer.
22502 <p><a name="7.29.4.1.2p6" href="#7.29.4.1.2p6"><small>6</small></a>
22503  In other than the "C" locale, additional locale-specific subject sequence forms may be
22504  accepted.
22505 <p><a name="7.29.4.1.2p7" href="#7.29.4.1.2p7"><small>7</small></a>
22506  If the subject sequence is empty or does not have the expected form, no conversion is
22507  performed; the value of nptr is stored in the object pointed to by endptr, provided
22508  that endptr is not a null pointer.
22509 <p><b>Returns</b>
22510 <p><a name="7.29.4.1.2p8" href="#7.29.4.1.2p8"><small>8</small></a>
22511  The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
22512  value, if any. If no conversion could be performed, zero is returned. If the correct value
22513  is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
22514  LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
22515  sign of the value, if any), and the value of the macro ERANGE is stored in errno.
22516
22517 <p><small><a href="#Contents">Contents</a></small>
22518 <h5><a name="7.29.4.2" href="#7.29.4.2">7.29.4.2 Wide string copying functions</a></h5>
22519
22520 <p><small><a href="#Contents">Contents</a></small>
22521 <h5><a name="7.29.4.2.1" href="#7.29.4.2.1">7.29.4.2.1 The wcscpy function</a></h5>
22522 <p><b>Synopsis</b>
22523 <p><a name="7.29.4.2.1p1" href="#7.29.4.2.1p1"><small>1</small></a>
22524 <pre>
22525         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22526         wchar_t *wcscpy(wchar_t * restrict s1,
22527              const wchar_t * restrict s2);
22528 </pre>
22529 <p><b>Description</b>
22530 <p><a name="7.29.4.2.1p2" href="#7.29.4.2.1p2"><small>2</small></a>
22531  The wcscpy function copies the wide string pointed to by s2 (including the terminating
22532  null wide character) into the array pointed to by s1.
22533 <p><b>Returns</b>
22534 <p><a name="7.29.4.2.1p3" href="#7.29.4.2.1p3"><small>3</small></a>
22535  The wcscpy function returns the value of s1.
22536 <!--page 449 -->
22537
22538 <p><small><a href="#Contents">Contents</a></small>
22539 <h5><a name="7.29.4.2.2" href="#7.29.4.2.2">7.29.4.2.2 The wcsncpy function</a></h5>
22540 <p><b>Synopsis</b>
22541 <p><a name="7.29.4.2.2p1" href="#7.29.4.2.2p1"><small>1</small></a>
22542 <pre>
22543           #include <a href="#7.29">&lt;wchar.h&gt;</a>
22544           wchar_t *wcsncpy(wchar_t * restrict s1,
22545                const wchar_t * restrict s2,
22546                size_t n);
22547 </pre>
22548 <p><b>Description</b>
22549 <p><a name="7.29.4.2.2p2" href="#7.29.4.2.2p2"><small>2</small></a>
22550  The wcsncpy function copies not more than n wide characters (those that follow a null
22551  wide character are not copied) from the array pointed to by s2 to the array pointed to by
22552  s1.<sup><a href="#note346"><b>346)</b></a></sup>
22553 <p><a name="7.29.4.2.2p3" href="#7.29.4.2.2p3"><small>3</small></a>
22554  If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
22555  wide characters are appended to the copy in the array pointed to by s1, until n wide
22556  characters in all have been written.
22557 <p><b>Returns</b>
22558 <p><a name="7.29.4.2.2p4" href="#7.29.4.2.2p4"><small>4</small></a>
22559  The wcsncpy function returns the value of s1.
22560
22561 <p><b>Footnotes</b>
22562 <p><small><a name="note346" href="#note346">346)</a> Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
22563  result will not be null-terminated.
22564 </small>
22565
22566 <p><small><a href="#Contents">Contents</a></small>
22567 <h5><a name="7.29.4.2.3" href="#7.29.4.2.3">7.29.4.2.3 The wmemcpy function</a></h5>
22568 <p><b>Synopsis</b>
22569 <p><a name="7.29.4.2.3p1" href="#7.29.4.2.3p1"><small>1</small></a>
22570 <pre>
22571           #include <a href="#7.29">&lt;wchar.h&gt;</a>
22572           wchar_t *wmemcpy(wchar_t * restrict s1,
22573                const wchar_t * restrict s2,
22574                size_t n);
22575 </pre>
22576 <p><b>Description</b>
22577 <p><a name="7.29.4.2.3p2" href="#7.29.4.2.3p2"><small>2</small></a>
22578  The wmemcpy function copies n wide characters from the object pointed to by s2 to the
22579  object pointed to by s1.
22580 <p><b>Returns</b>
22581 <p><a name="7.29.4.2.3p3" href="#7.29.4.2.3p3"><small>3</small></a>
22582  The wmemcpy function returns the value of s1.
22583  
22584  
22585  
22586  
22587 <!--page 450 -->
22588
22589 <p><small><a href="#Contents">Contents</a></small>
22590 <h5><a name="7.29.4.2.4" href="#7.29.4.2.4">7.29.4.2.4 The wmemmove function</a></h5>
22591 <p><b>Synopsis</b>
22592 <p><a name="7.29.4.2.4p1" href="#7.29.4.2.4p1"><small>1</small></a>
22593 <pre>
22594         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22595         wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
22596              size_t n);
22597 </pre>
22598 <p><b>Description</b>
22599 <p><a name="7.29.4.2.4p2" href="#7.29.4.2.4p2"><small>2</small></a>
22600  The wmemmove function copies n wide characters from the object pointed to by s2 to
22601  the object pointed to by s1. Copying takes place as if the n wide characters from the
22602  object pointed to by s2 are first copied into a temporary array of n wide characters that
22603  does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
22604  the temporary array are copied into the object pointed to by s1.
22605 <p><b>Returns</b>
22606 <p><a name="7.29.4.2.4p3" href="#7.29.4.2.4p3"><small>3</small></a>
22607  The wmemmove function returns the value of s1.
22608
22609 <p><small><a href="#Contents">Contents</a></small>
22610 <h5><a name="7.29.4.3" href="#7.29.4.3">7.29.4.3 Wide string concatenation functions</a></h5>
22611
22612 <p><small><a href="#Contents">Contents</a></small>
22613 <h5><a name="7.29.4.3.1" href="#7.29.4.3.1">7.29.4.3.1 The wcscat function</a></h5>
22614 <p><b>Synopsis</b>
22615 <p><a name="7.29.4.3.1p1" href="#7.29.4.3.1p1"><small>1</small></a>
22616 <pre>
22617         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22618         wchar_t *wcscat(wchar_t * restrict s1,
22619              const wchar_t * restrict s2);
22620 </pre>
22621 <p><b>Description</b>
22622 <p><a name="7.29.4.3.1p2" href="#7.29.4.3.1p2"><small>2</small></a>
22623  The wcscat function appends a copy of the wide string pointed to by s2 (including the
22624  terminating null wide character) to the end of the wide string pointed to by s1. The initial
22625  wide character of s2 overwrites the null wide character at the end of s1.
22626 <p><b>Returns</b>
22627 <p><a name="7.29.4.3.1p3" href="#7.29.4.3.1p3"><small>3</small></a>
22628  The wcscat function returns the value of s1.
22629
22630 <p><small><a href="#Contents">Contents</a></small>
22631 <h5><a name="7.29.4.3.2" href="#7.29.4.3.2">7.29.4.3.2 The wcsncat function</a></h5>
22632 <p><b>Synopsis</b>
22633 <p><a name="7.29.4.3.2p1" href="#7.29.4.3.2p1"><small>1</small></a>
22634 <pre>
22635         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22636         wchar_t *wcsncat(wchar_t * restrict s1,
22637              const wchar_t * restrict s2,
22638              size_t n);
22639 </pre>
22640 <p><b>Description</b>
22641 <p><a name="7.29.4.3.2p2" href="#7.29.4.3.2p2"><small>2</small></a>
22642  The wcsncat function appends not more than n wide characters (a null wide character
22643  and those that follow it are not appended) from the array pointed to by s2 to the end of
22644 <!--page 451 -->
22645  the wide string pointed to by s1. The initial wide character of s2 overwrites the null
22646  wide character at the end of s1. A terminating null wide character is always appended to
22647  the result.<sup><a href="#note347"><b>347)</b></a></sup>
22648 <p><b>Returns</b>
22649 <p><a name="7.29.4.3.2p3" href="#7.29.4.3.2p3"><small>3</small></a>
22650  The wcsncat function returns the value of s1.
22651
22652 <p><b>Footnotes</b>
22653 <p><small><a name="note347" href="#note347">347)</a> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
22654  wcslen(s1)+n+1.
22655 </small>
22656
22657 <p><small><a href="#Contents">Contents</a></small>
22658 <h5><a name="7.29.4.4" href="#7.29.4.4">7.29.4.4 Wide string comparison functions</a></h5>
22659 <p><a name="7.29.4.4p1" href="#7.29.4.4p1"><small>1</small></a>
22660  Unless explicitly stated otherwise, the functions described in this subclause order two
22661  wide characters the same way as two integers of the underlying integer type designated
22662  by wchar_t.
22663
22664 <p><small><a href="#Contents">Contents</a></small>
22665 <h5><a name="7.29.4.4.1" href="#7.29.4.4.1">7.29.4.4.1 The wcscmp function</a></h5>
22666 <p><b>Synopsis</b>
22667 <p><a name="7.29.4.4.1p1" href="#7.29.4.4.1p1"><small>1</small></a>
22668 <pre>
22669          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22670          int wcscmp(const wchar_t *s1, const wchar_t *s2);
22671 </pre>
22672 <p><b>Description</b>
22673 <p><a name="7.29.4.4.1p2" href="#7.29.4.4.1p2"><small>2</small></a>
22674  The wcscmp function compares the wide string pointed to by s1 to the wide string
22675  pointed to by s2.
22676 <p><b>Returns</b>
22677 <p><a name="7.29.4.4.1p3" href="#7.29.4.4.1p3"><small>3</small></a>
22678  The wcscmp function returns an integer greater than, equal to, or less than zero,
22679  accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
22680  wide string pointed to by s2.
22681
22682 <p><small><a href="#Contents">Contents</a></small>
22683 <h5><a name="7.29.4.4.2" href="#7.29.4.4.2">7.29.4.4.2 The wcscoll function</a></h5>
22684 <p><b>Synopsis</b>
22685 <p><a name="7.29.4.4.2p1" href="#7.29.4.4.2p1"><small>1</small></a>
22686 <pre>
22687          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22688          int wcscoll(const wchar_t *s1, const wchar_t *s2);
22689 </pre>
22690 <p><b>Description</b>
22691 <p><a name="7.29.4.4.2p2" href="#7.29.4.4.2p2"><small>2</small></a>
22692  The wcscoll function compares the wide string pointed to by s1 to the wide string
22693  pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
22694  current locale.
22695 <p><b>Returns</b>
22696 <p><a name="7.29.4.4.2p3" href="#7.29.4.4.2p3"><small>3</small></a>
22697  The wcscoll function returns an integer greater than, equal to, or less than zero,
22698  accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
22699  
22700  
22701 <!--page 452 -->
22702  wide string pointed to by s2 when both are interpreted as appropriate to the current
22703  locale.
22704
22705 <p><small><a href="#Contents">Contents</a></small>
22706 <h5><a name="7.29.4.4.3" href="#7.29.4.4.3">7.29.4.4.3 The wcsncmp function</a></h5>
22707 <p><b>Synopsis</b>
22708 <p><a name="7.29.4.4.3p1" href="#7.29.4.4.3p1"><small>1</small></a>
22709 <pre>
22710         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22711         int wcsncmp(const wchar_t *s1, const wchar_t *s2,
22712              size_t n);
22713 </pre>
22714 <p><b>Description</b>
22715 <p><a name="7.29.4.4.3p2" href="#7.29.4.4.3p2"><small>2</small></a>
22716  The wcsncmp function compares not more than n wide characters (those that follow a
22717  null wide character are not compared) from the array pointed to by s1 to the array
22718  pointed to by s2.
22719 <p><b>Returns</b>
22720 <p><a name="7.29.4.4.3p3" href="#7.29.4.4.3p3"><small>3</small></a>
22721  The wcsncmp function returns an integer greater than, equal to, or less than zero,
22722  accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
22723  to, or less than the possibly null-terminated array pointed to by s2.
22724
22725 <p><small><a href="#Contents">Contents</a></small>
22726 <h5><a name="7.29.4.4.4" href="#7.29.4.4.4">7.29.4.4.4 The wcsxfrm function</a></h5>
22727 <p><b>Synopsis</b>
22728 <p><a name="7.29.4.4.4p1" href="#7.29.4.4.4p1"><small>1</small></a>
22729 <pre>
22730         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22731         size_t wcsxfrm(wchar_t * restrict s1,
22732              const wchar_t * restrict s2,
22733              size_t n);
22734 </pre>
22735 <p><b>Description</b>
22736 <p><a name="7.29.4.4.4p2" href="#7.29.4.4.4p2"><small>2</small></a>
22737  The wcsxfrm function transforms the wide string pointed to by s2 and places the
22738  resulting wide string into the array pointed to by s1. The transformation is such that if
22739  the wcscmp function is applied to two transformed wide strings, it returns a value greater
22740  than, equal to, or less than zero, corresponding to the result of the wcscoll function
22741  applied to the same two original wide strings. No more than n wide characters are placed
22742  into the resulting array pointed to by s1, including the terminating null wide character. If
22743  n is zero, s1 is permitted to be a null pointer.
22744 <p><b>Returns</b>
22745 <p><a name="7.29.4.4.4p3" href="#7.29.4.4.4p3"><small>3</small></a>
22746  The wcsxfrm function returns the length of the transformed wide string (not including
22747  the terminating null wide character). If the value returned is n or greater, the contents of
22748  the array pointed to by s1 are indeterminate.
22749 <p><a name="7.29.4.4.4p4" href="#7.29.4.4.4p4"><small>4</small></a>
22750  EXAMPLE The value of the following expression is the length of the array needed to hold the
22751  transformation of the wide string pointed to by s:
22752 <!--page 453 -->
22753 <pre>
22754          1 + wcsxfrm(NULL, s, 0)
22755 </pre>
22756  
22757
22758 <p><small><a href="#Contents">Contents</a></small>
22759 <h5><a name="7.29.4.4.5" href="#7.29.4.4.5">7.29.4.4.5 The wmemcmp function</a></h5>
22760 <p><b>Synopsis</b>
22761 <p><a name="7.29.4.4.5p1" href="#7.29.4.4.5p1"><small>1</small></a>
22762 <pre>
22763          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22764          int wmemcmp(const wchar_t *s1, const wchar_t *s2,
22765               size_t n);
22766 </pre>
22767 <p><b>Description</b>
22768 <p><a name="7.29.4.4.5p2" href="#7.29.4.4.5p2"><small>2</small></a>
22769  The wmemcmp function compares the first n wide characters of the object pointed to by
22770  s1 to the first n wide characters of the object pointed to by s2.
22771 <p><b>Returns</b>
22772 <p><a name="7.29.4.4.5p3" href="#7.29.4.4.5p3"><small>3</small></a>
22773  The wmemcmp function returns an integer greater than, equal to, or less than zero,
22774  accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
22775  pointed to by s2.
22776
22777 <p><small><a href="#Contents">Contents</a></small>
22778 <h5><a name="7.29.4.5" href="#7.29.4.5">7.29.4.5 Wide string search functions</a></h5>
22779
22780 <p><small><a href="#Contents">Contents</a></small>
22781 <h5><a name="7.29.4.5.1" href="#7.29.4.5.1">7.29.4.5.1 The wcschr function</a></h5>
22782 <p><b>Synopsis</b>
22783 <p><a name="7.29.4.5.1p1" href="#7.29.4.5.1p1"><small>1</small></a>
22784 <pre>
22785          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22786          wchar_t *wcschr(const wchar_t *s, wchar_t c);
22787 </pre>
22788 <p><b>Description</b>
22789 <p><a name="7.29.4.5.1p2" href="#7.29.4.5.1p2"><small>2</small></a>
22790  The wcschr function locates the first occurrence of c in the wide string pointed to by s.
22791  The terminating null wide character is considered to be part of the wide string.
22792 <p><b>Returns</b>
22793 <p><a name="7.29.4.5.1p3" href="#7.29.4.5.1p3"><small>3</small></a>
22794  The wcschr function returns a pointer to the located wide character, or a null pointer if
22795  the wide character does not occur in the wide string.
22796
22797 <p><small><a href="#Contents">Contents</a></small>
22798 <h5><a name="7.29.4.5.2" href="#7.29.4.5.2">7.29.4.5.2 The wcscspn function</a></h5>
22799 <p><b>Synopsis</b>
22800 <p><a name="7.29.4.5.2p1" href="#7.29.4.5.2p1"><small>1</small></a>
22801 <pre>
22802          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22803          size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
22804 </pre>
22805 <p><b>Description</b>
22806 <p><a name="7.29.4.5.2p2" href="#7.29.4.5.2p2"><small>2</small></a>
22807  The wcscspn function computes the length of the maximum initial segment of the wide
22808  string pointed to by s1 which consists entirely of wide characters not from the wide
22809  string pointed to by s2.
22810 <!--page 454 -->
22811 <p><b>Returns</b>
22812 <p><a name="7.29.4.5.2p3" href="#7.29.4.5.2p3"><small>3</small></a>
22813  The wcscspn function returns the length of the segment.
22814
22815 <p><small><a href="#Contents">Contents</a></small>
22816 <h5><a name="7.29.4.5.3" href="#7.29.4.5.3">7.29.4.5.3 The wcspbrk function</a></h5>
22817 <p><b>Synopsis</b>
22818 <p><a name="7.29.4.5.3p1" href="#7.29.4.5.3p1"><small>1</small></a>
22819 <pre>
22820         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22821         wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
22822 </pre>
22823 <p><b>Description</b>
22824 <p><a name="7.29.4.5.3p2" href="#7.29.4.5.3p2"><small>2</small></a>
22825  The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
22826  any wide character from the wide string pointed to by s2.
22827 <p><b>Returns</b>
22828 <p><a name="7.29.4.5.3p3" href="#7.29.4.5.3p3"><small>3</small></a>
22829  The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
22830  no wide character from s2 occurs in s1.
22831
22832 <p><small><a href="#Contents">Contents</a></small>
22833 <h5><a name="7.29.4.5.4" href="#7.29.4.5.4">7.29.4.5.4 The wcsrchr function</a></h5>
22834 <p><b>Synopsis</b>
22835 <p><a name="7.29.4.5.4p1" href="#7.29.4.5.4p1"><small>1</small></a>
22836 <pre>
22837         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22838         wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
22839 </pre>
22840 <p><b>Description</b>
22841 <p><a name="7.29.4.5.4p2" href="#7.29.4.5.4p2"><small>2</small></a>
22842  The wcsrchr function locates the last occurrence of c in the wide string pointed to by
22843  s. The terminating null wide character is considered to be part of the wide string.
22844 <p><b>Returns</b>
22845 <p><a name="7.29.4.5.4p3" href="#7.29.4.5.4p3"><small>3</small></a>
22846  The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
22847  not occur in the wide string.
22848
22849 <p><small><a href="#Contents">Contents</a></small>
22850 <h5><a name="7.29.4.5.5" href="#7.29.4.5.5">7.29.4.5.5 The wcsspn function</a></h5>
22851 <p><b>Synopsis</b>
22852 <p><a name="7.29.4.5.5p1" href="#7.29.4.5.5p1"><small>1</small></a>
22853 <pre>
22854         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22855         size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
22856 </pre>
22857 <p><b>Description</b>
22858 <p><a name="7.29.4.5.5p2" href="#7.29.4.5.5p2"><small>2</small></a>
22859  The wcsspn function computes the length of the maximum initial segment of the wide
22860  string pointed to by s1 which consists entirely of wide characters from the wide string
22861  pointed to by s2.
22862 <p><b>Returns</b>
22863 <p><a name="7.29.4.5.5p3" href="#7.29.4.5.5p3"><small>3</small></a>
22864  The wcsspn function returns the length of the segment.
22865 <!--page 455 -->
22866
22867 <p><small><a href="#Contents">Contents</a></small>
22868 <h5><a name="7.29.4.5.6" href="#7.29.4.5.6">7.29.4.5.6 The wcsstr function</a></h5>
22869 <p><b>Synopsis</b>
22870 <p><a name="7.29.4.5.6p1" href="#7.29.4.5.6p1"><small>1</small></a>
22871 <pre>
22872          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22873          wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
22874 </pre>
22875 <p><b>Description</b>
22876 <p><a name="7.29.4.5.6p2" href="#7.29.4.5.6p2"><small>2</small></a>
22877  The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
22878  the sequence of wide characters (excluding the terminating null wide character) in the
22879  wide string pointed to by s2.
22880 <p><b>Returns</b>
22881 <p><a name="7.29.4.5.6p3" href="#7.29.4.5.6p3"><small>3</small></a>
22882  The wcsstr function returns a pointer to the located wide string, or a null pointer if the
22883  wide string is not found. If s2 points to a wide string with zero length, the function
22884  returns s1.
22885
22886 <p><small><a href="#Contents">Contents</a></small>
22887 <h5><a name="7.29.4.5.7" href="#7.29.4.5.7">7.29.4.5.7 The wcstok function</a></h5>
22888 <p><b>Synopsis</b>
22889 <p><a name="7.29.4.5.7p1" href="#7.29.4.5.7p1"><small>1</small></a>
22890 <pre>
22891          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22892          wchar_t *wcstok(wchar_t * restrict s1,
22893               const wchar_t * restrict s2,
22894               wchar_t ** restrict ptr);
22895 </pre>
22896 <p><b>Description</b>
22897 <p><a name="7.29.4.5.7p2" href="#7.29.4.5.7p2"><small>2</small></a>
22898  A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
22899  a sequence of tokens, each of which is delimited by a wide character from the wide string
22900  pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
22901  which the wcstok function stores information necessary for it to continue scanning the
22902  same wide string.
22903 <p><a name="7.29.4.5.7p3" href="#7.29.4.5.7p3"><small>3</small></a>
22904  The first call in a sequence has a non-null first argument and stores an initial value in the
22905  object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
22906  the object pointed to by ptr is required to have the value stored by the previous call in
22907  the sequence, which is then updated. The separator wide string pointed to by s2 may be
22908  different from call to call.
22909 <p><a name="7.29.4.5.7p4" href="#7.29.4.5.7p4"><small>4</small></a>
22910  The first call in the sequence searches the wide string pointed to by s1 for the first wide
22911  character that is not contained in the current separator wide string pointed to by s2. If no
22912  such wide character is found, then there are no tokens in the wide string pointed to by s1
22913  and the wcstok function returns a null pointer. If such a wide character is found, it is
22914  the start of the first token.
22915 <p><a name="7.29.4.5.7p5" href="#7.29.4.5.7p5"><small>5</small></a>
22916  The wcstok function then searches from there for a wide character that is contained in
22917  the current separator wide string. If no such wide character is found, the current token
22918 <!--page 456 -->
22919  extends to the end of the wide string pointed to by s1, and subsequent searches in the
22920  same wide string for a token return a null pointer. If such a wide character is found, it is
22921  overwritten by a null wide character, which terminates the current token.
22922 <p><a name="7.29.4.5.7p6" href="#7.29.4.5.7p6"><small>6</small></a>
22923  In all cases, the wcstok function stores sufficient information in the pointer pointed to
22924  by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
22925  value for ptr, shall start searching just past the element overwritten by a null wide
22926  character (if any).
22927 <p><b>Returns</b>
22928 <p><a name="7.29.4.5.7p7" href="#7.29.4.5.7p7"><small>7</small></a>
22929  The wcstok function returns a pointer to the first wide character of a token, or a null
22930  pointer if there is no token.
22931 <p><a name="7.29.4.5.7p8" href="#7.29.4.5.7p8"><small>8</small></a>
22932  EXAMPLE
22933 <pre>
22934         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22935         static wchar_t str1[] = L"?a???b,,,#c";
22936         static wchar_t str2[] = L"\t \t";
22937         wchar_t *t, *ptr1, *ptr2;
22938         t   =   wcstok(str1,   L"?", &amp;ptr1);          //   t   points to the token L"a"
22939         t   =   wcstok(NULL,   L",", &amp;ptr1);          //   t   points to the token L"??b"
22940         t   =   wcstok(str2,   L" \t", &amp;ptr2);        //   t   is a null pointer
22941         t   =   wcstok(NULL,   L"#,", &amp;ptr1);         //   t   points to the token L"c"
22942         t   =   wcstok(NULL,   L"?", &amp;ptr1);          //   t   is a null pointer
22943 </pre>
22944  
22945
22946 <p><small><a href="#Contents">Contents</a></small>
22947 <h5><a name="7.29.4.5.8" href="#7.29.4.5.8">7.29.4.5.8 The wmemchr function</a></h5>
22948 <p><b>Synopsis</b>
22949 <p><a name="7.29.4.5.8p1" href="#7.29.4.5.8p1"><small>1</small></a>
22950 <pre>
22951         #include <a href="#7.29">&lt;wchar.h&gt;</a>
22952         wchar_t *wmemchr(const wchar_t *s, wchar_t c,
22953              size_t n);
22954 </pre>
22955 <p><b>Description</b>
22956 <p><a name="7.29.4.5.8p2" href="#7.29.4.5.8p2"><small>2</small></a>
22957  The wmemchr function locates the first occurrence of c in the initial n wide characters of
22958  the object pointed to by s.
22959 <p><b>Returns</b>
22960 <p><a name="7.29.4.5.8p3" href="#7.29.4.5.8p3"><small>3</small></a>
22961  The wmemchr function returns a pointer to the located wide character, or a null pointer if
22962  the wide character does not occur in the object.
22963 <!--page 457 -->
22964
22965 <p><small><a href="#Contents">Contents</a></small>
22966 <h5><a name="7.29.4.6" href="#7.29.4.6">7.29.4.6 Miscellaneous functions</a></h5>
22967
22968 <p><small><a href="#Contents">Contents</a></small>
22969 <h5><a name="7.29.4.6.1" href="#7.29.4.6.1">7.29.4.6.1 The wcslen function</a></h5>
22970 <p><b>Synopsis</b>
22971 <p><a name="7.29.4.6.1p1" href="#7.29.4.6.1p1"><small>1</small></a>
22972 <pre>
22973          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22974          size_t wcslen(const wchar_t *s);
22975 </pre>
22976 <p><b>Description</b>
22977 <p><a name="7.29.4.6.1p2" href="#7.29.4.6.1p2"><small>2</small></a>
22978  The wcslen function computes the length of the wide string pointed to by s.
22979 <p><b>Returns</b>
22980 <p><a name="7.29.4.6.1p3" href="#7.29.4.6.1p3"><small>3</small></a>
22981  The wcslen function returns the number of wide characters that precede the terminating
22982  null wide character.
22983
22984 <p><small><a href="#Contents">Contents</a></small>
22985 <h5><a name="7.29.4.6.2" href="#7.29.4.6.2">7.29.4.6.2 The wmemset function</a></h5>
22986 <p><b>Synopsis</b>
22987 <p><a name="7.29.4.6.2p1" href="#7.29.4.6.2p1"><small>1</small></a>
22988 <pre>
22989          #include <a href="#7.29">&lt;wchar.h&gt;</a>
22990          wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
22991 </pre>
22992 <p><b>Description</b>
22993 <p><a name="7.29.4.6.2p2" href="#7.29.4.6.2p2"><small>2</small></a>
22994  The wmemset function copies the value of c into each of the first n wide characters of
22995  the object pointed to by s.
22996 <p><b>Returns</b>
22997 <p><a name="7.29.4.6.2p3" href="#7.29.4.6.2p3"><small>3</small></a>
22998  The wmemset function returns the value of s.
22999
23000 <p><small><a href="#Contents">Contents</a></small>
23001 <h4><a name="7.29.5" href="#7.29.5">7.29.5 Wide character time conversion functions</a></h4>
23002
23003 <p><small><a href="#Contents">Contents</a></small>
23004 <h5><a name="7.29.5.1" href="#7.29.5.1">7.29.5.1 The wcsftime function</a></h5>
23005 <p><b>Synopsis</b>
23006 <p><a name="7.29.5.1p1" href="#7.29.5.1p1"><small>1</small></a>
23007 <pre>
23008          #include <a href="#7.27">&lt;time.h&gt;</a>
23009          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23010          size_t wcsftime(wchar_t * restrict s,
23011               size_t maxsize,
23012               const wchar_t * restrict format,
23013               const struct tm * restrict timeptr);
23014 </pre>
23015 <p><b>Description</b>
23016 <p><a name="7.29.5.1p2" href="#7.29.5.1p2"><small>2</small></a>
23017  The wcsftime function is equivalent to the strftime function, except that:
23018 <ul>
23019 <li>  The argument s points to the initial element of an array of wide characters into which
23020  the generated output is to be placed.
23021 <!--page 458 -->
23022 <li>  The argument maxsize indicates the limiting number of wide characters.
23023 <li>  The argument format is a wide string and the conversion specifiers are replaced by
23024  corresponding sequences of wide characters.
23025 <li>  The return value indicates the number of wide characters.
23026 </ul>
23027 <p><b>Returns</b>
23028 <p><a name="7.29.5.1p3" href="#7.29.5.1p3"><small>3</small></a>
23029  If the total number of resulting wide characters including the terminating null wide
23030  character is not more than maxsize, the wcsftime function returns the number of
23031  wide characters placed into the array pointed to by s not including the terminating null
23032  wide character. Otherwise, zero is returned and the contents of the array are
23033  indeterminate.
23034
23035 <p><small><a href="#Contents">Contents</a></small>
23036 <h4><a name="7.29.6" href="#7.29.6">7.29.6 Extended multibyte/wide character conversion utilities</a></h4>
23037 <p><a name="7.29.6p1" href="#7.29.6p1"><small>1</small></a>
23038  The header <a href="#7.29">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
23039  between multibyte characters and wide characters.
23040 <p><a name="7.29.6p2" href="#7.29.6p2"><small>2</small></a>
23041  Most of the following functions -- those that are listed as ''restartable'', <a href="#7.29.6.3">7.29.6.3</a> and
23042  <a href="#7.29.6.4">7.29.6.4</a> -- take as a last argument a pointer to an object of type mbstate_t that is used
23043  to describe the current conversion state from a particular multibyte character sequence to
23044  a wide character sequence (or the reverse) under the rules of a particular setting for the
23045  LC_CTYPE category of the current locale.
23046 <p><a name="7.29.6p3" href="#7.29.6p3"><small>3</small></a>
23047  The initial conversion state corresponds, for a conversion in either direction, to the
23048  beginning of a new multibyte character in the initial shift state. A zero-valued
23049  mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
23050  valued mbstate_t object can be used to initiate conversion involving any multibyte
23051  character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
23052  been altered by any of the functions described in this subclause, and is then used with a
23053  different multibyte character sequence, or in the other conversion direction, or with a
23054  different LC_CTYPE category setting than on earlier function calls, the behavior is
23055  undefined.<sup><a href="#note348"><b>348)</b></a></sup>
23056 <p><a name="7.29.6p4" href="#7.29.6p4"><small>4</small></a>
23057  On entry, each function takes the described conversion state (either internal or pointed to
23058  by an argument) as current. The conversion state described by the referenced object is
23059  altered as needed to track the shift state, and the position within a multibyte character, for
23060  the associated multibyte character sequence.
23061  
23062  
23063  
23064  
23065 <!--page 459 -->
23066
23067 <p><b>Footnotes</b>
23068 <p><small><a name="note348" href="#note348">348)</a> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
23069  mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
23070  character string.
23071 </small>
23072
23073 <p><small><a href="#Contents">Contents</a></small>
23074 <h5><a name="7.29.6.1" href="#7.29.6.1">7.29.6.1 Single-byte/wide character conversion functions</a></h5>
23075
23076 <p><small><a href="#Contents">Contents</a></small>
23077 <h5><a name="7.29.6.1.1" href="#7.29.6.1.1">7.29.6.1.1 The btowc function</a></h5>
23078 <p><b>Synopsis</b>
23079 <p><a name="7.29.6.1.1p1" href="#7.29.6.1.1p1"><small>1</small></a>
23080 <pre>
23081          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23082          wint_t btowc(int c);
23083 </pre>
23084 <p><b>Description</b>
23085 <p><a name="7.29.6.1.1p2" href="#7.29.6.1.1p2"><small>2</small></a>
23086  The btowc function determines whether c constitutes a valid single-byte character in the
23087  initial shift state.
23088 <p><b>Returns</b>
23089 <p><a name="7.29.6.1.1p3" href="#7.29.6.1.1p3"><small>3</small></a>
23090  The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
23091  does not constitute a valid single-byte character in the initial shift state. Otherwise, it
23092  returns the wide character representation of that character.
23093
23094 <p><small><a href="#Contents">Contents</a></small>
23095 <h5><a name="7.29.6.1.2" href="#7.29.6.1.2">7.29.6.1.2 The wctob function</a></h5>
23096 <p><b>Synopsis</b>
23097 <p><a name="7.29.6.1.2p1" href="#7.29.6.1.2p1"><small>1</small></a>
23098 <pre>
23099          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23100          int wctob(wint_t c);
23101 </pre>
23102 <p><b>Description</b>
23103 <p><a name="7.29.6.1.2p2" href="#7.29.6.1.2p2"><small>2</small></a>
23104  The wctob function determines whether c corresponds to a member of the extended
23105  character set whose multibyte character representation is a single byte when in the initial
23106  shift state.
23107 <p><b>Returns</b>
23108 <p><a name="7.29.6.1.2p3" href="#7.29.6.1.2p3"><small>3</small></a>
23109  The wctob function returns EOF if c does not correspond to a multibyte character with
23110  length one in the initial shift state. Otherwise, it returns the single-byte representation of
23111  that character as an unsigned char converted to an int.
23112
23113 <p><small><a href="#Contents">Contents</a></small>
23114 <h5><a name="7.29.6.2" href="#7.29.6.2">7.29.6.2 Conversion state functions</a></h5>
23115
23116 <p><small><a href="#Contents">Contents</a></small>
23117 <h5><a name="7.29.6.2.1" href="#7.29.6.2.1">7.29.6.2.1 The mbsinit function</a></h5>
23118 <p><b>Synopsis</b>
23119 <p><a name="7.29.6.2.1p1" href="#7.29.6.2.1p1"><small>1</small></a>
23120 <pre>
23121          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23122          int mbsinit(const mbstate_t *ps);
23123 </pre>
23124 <p><b>Description</b>
23125 <p><a name="7.29.6.2.1p2" href="#7.29.6.2.1p2"><small>2</small></a>
23126  If ps is not a null pointer, the mbsinit function determines whether the referenced
23127  mbstate_t object describes an initial conversion state.
23128 <!--page 460 -->
23129 <p><b>Returns</b>
23130 <p><a name="7.29.6.2.1p3" href="#7.29.6.2.1p3"><small>3</small></a>
23131  The mbsinit function returns nonzero if ps is a null pointer or if the referenced object
23132  describes an initial conversion state; otherwise, it returns zero.
23133
23134 <p><small><a href="#Contents">Contents</a></small>
23135 <h5><a name="7.29.6.3" href="#7.29.6.3">7.29.6.3 Restartable multibyte/wide character conversion functions</a></h5>
23136 <p><a name="7.29.6.3p1" href="#7.29.6.3p1"><small>1</small></a>
23137  These functions differ from the corresponding multibyte character functions of <a href="#7.22.7">7.22.7</a>
23138  (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
23139  pointer to mbstate_t that points to an object that can completely describe the current
23140  conversion state of the associated multibyte character sequence. If ps is a null pointer,
23141  each function uses its own internal mbstate_t object instead, which is initialized at
23142  program startup to the initial conversion state; the functions are not required to avoid data
23143  races with other calls to the same function in this case. The implementation behaves as if
23144  no library function calls these functions with a null pointer for ps.
23145 <p><a name="7.29.6.3p2" href="#7.29.6.3p2"><small>2</small></a>
23146  Also unlike their corresponding functions, the return value does not represent whether the
23147  encoding is state-dependent.
23148
23149 <p><small><a href="#Contents">Contents</a></small>
23150 <h5><a name="7.29.6.3.1" href="#7.29.6.3.1">7.29.6.3.1 The mbrlen function</a></h5>
23151 <p><b>Synopsis</b>
23152 <p><a name="7.29.6.3.1p1" href="#7.29.6.3.1p1"><small>1</small></a>
23153 <pre>
23154         #include <a href="#7.29">&lt;wchar.h&gt;</a>
23155         size_t mbrlen(const char * restrict s,
23156              size_t n,
23157              mbstate_t * restrict ps);
23158 </pre>
23159 <p><b>Description</b>
23160 <p><a name="7.29.6.3.1p2" href="#7.29.6.3.1p2"><small>2</small></a>
23161  The mbrlen function is equivalent to the call:
23162 <pre>
23163         mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)
23164 </pre>
23165  where internal is the mbstate_t object for the mbrlen function, except that the
23166  expression designated by ps is evaluated only once.
23167 <p><b>Returns</b>
23168 <p><a name="7.29.6.3.1p3" href="#7.29.6.3.1p3"><small>3</small></a>
23169  The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
23170  or (size_t)(-1).
23171 <p><b> Forward references</b>: the mbrtowc function (<a href="#7.29.6.3.2">7.29.6.3.2</a>).
23172 <!--page 461 -->
23173
23174 <p><small><a href="#Contents">Contents</a></small>
23175 <h5><a name="7.29.6.3.2" href="#7.29.6.3.2">7.29.6.3.2 The mbrtowc function</a></h5>
23176 <p><b>Synopsis</b>
23177 <p><a name="7.29.6.3.2p1" href="#7.29.6.3.2p1"><small>1</small></a>
23178 <pre>
23179          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23180          size_t mbrtowc(wchar_t * restrict pwc,
23181               const char * restrict s,
23182               size_t n,
23183               mbstate_t * restrict ps);
23184 </pre>
23185 <p><b>Description</b>
23186 <p><a name="7.29.6.3.2p2" href="#7.29.6.3.2p2"><small>2</small></a>
23187  If s is a null pointer, the mbrtowc function is equivalent to the call:
23188 <pre>
23189                  mbrtowc(NULL, "", 1, ps)
23190 </pre>
23191  In this case, the values of the parameters pwc and n are ignored.
23192 <p><a name="7.29.6.3.2p3" href="#7.29.6.3.2p3"><small>3</small></a>
23193  If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
23194  the byte pointed to by s to determine the number of bytes needed to complete the next
23195  multibyte character (including any shift sequences). If the function determines that the
23196  next multibyte character is complete and valid, it determines the value of the
23197  corresponding wide character and then, if pwc is not a null pointer, stores that value in
23198  the object pointed to by pwc. If the corresponding wide character is the null wide
23199  character, the resulting state described is the initial conversion state.
23200 <p><b>Returns</b>
23201 <p><a name="7.29.6.3.2p4" href="#7.29.6.3.2p4"><small>4</small></a>
23202  The mbrtowc function returns the first of the following that applies (given the current
23203  conversion state):
23204  0                     if the next n or fewer bytes complete the multibyte character that
23205 <pre>
23206                        corresponds to the null wide character (which is the value stored).
23207 </pre>
23208  between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
23209 <pre>
23210                     character (which is the value stored); the value returned is the number
23211                     of bytes that complete the multibyte character.
23212 </pre>
23213  (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
23214 <pre>
23215               multibyte character, and all n bytes have been processed (no value is
23216               stored).<sup><a href="#note349"><b>349)</b></a></sup>
23217 </pre>
23218  (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
23219 <pre>
23220               do not contribute to a complete and valid multibyte character (no
23221               value is stored); the value of the macro EILSEQ is stored in errno,
23222               and the conversion state is unspecified.
23223 </pre>
23224  
23225 <!--page 462 -->
23226
23227 <p><b>Footnotes</b>
23228 <p><small><a name="note349" href="#note349">349)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
23229  sequence of redundant shift sequences (for implementations with state-dependent encodings).
23230 </small>
23231
23232 <p><small><a href="#Contents">Contents</a></small>
23233 <h5><a name="7.29.6.3.3" href="#7.29.6.3.3">7.29.6.3.3 The wcrtomb function</a></h5>
23234 <p><b>Synopsis</b>
23235 <p><a name="7.29.6.3.3p1" href="#7.29.6.3.3p1"><small>1</small></a>
23236 <pre>
23237          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23238          size_t wcrtomb(char * restrict s,
23239               wchar_t wc,
23240               mbstate_t * restrict ps);
23241 </pre>
23242 <p><b>Description</b>
23243 <p><a name="7.29.6.3.3p2" href="#7.29.6.3.3p2"><small>2</small></a>
23244  If s is a null pointer, the wcrtomb function is equivalent to the call
23245 <pre>
23246                  wcrtomb(buf, L'\0', ps)
23247 </pre>
23248  where buf is an internal buffer.
23249 <p><a name="7.29.6.3.3p3" href="#7.29.6.3.3p3"><small>3</small></a>
23250  If s is not a null pointer, the wcrtomb function determines the number of bytes needed
23251  to represent the multibyte character that corresponds to the wide character given by wc
23252  (including any shift sequences), and stores the multibyte character representation in the
23253  array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
23254  wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
23255  to restore the initial shift state; the resulting state described is the initial conversion state.
23256 <p><b>Returns</b>
23257 <p><a name="7.29.6.3.3p4" href="#7.29.6.3.3p4"><small>4</small></a>
23258  The wcrtomb function returns the number of bytes stored in the array object (including
23259  any shift sequences). When wc is not a valid wide character, an encoding error occurs:
23260  the function stores the value of the macro EILSEQ in errno and returns
23261  (size_t)(-1); the conversion state is unspecified.
23262
23263 <p><small><a href="#Contents">Contents</a></small>
23264 <h5><a name="7.29.6.4" href="#7.29.6.4">7.29.6.4 Restartable multibyte/wide string conversion functions</a></h5>
23265 <p><a name="7.29.6.4p1" href="#7.29.6.4p1"><small>1</small></a>
23266  These functions differ from the corresponding multibyte string functions of <a href="#7.22.8">7.22.8</a>
23267  (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
23268  mbstate_t that points to an object that can completely describe the current conversion
23269  state of the associated multibyte character sequence. If ps is a null pointer, each function
23270  uses its own internal mbstate_t object instead, which is initialized at program startup
23271  to the initial conversion state; the functions are not required to avoid data races with other
23272  calls to the same function in this case. The implementation behaves as if no library
23273  function calls these functions with a null pointer for ps.
23274 <p><a name="7.29.6.4p2" href="#7.29.6.4p2"><small>2</small></a>
23275  Also unlike their corresponding functions, the conversion source parameter, src, has a
23276  pointer-to-pointer type. When the function is storing the results of conversions (that is,
23277  when dst is not a null pointer), the pointer object pointed to by this parameter is updated
23278  to reflect the amount of the source processed by that invocation.
23279 <!--page 463 -->
23280
23281 <p><small><a href="#Contents">Contents</a></small>
23282 <h5><a name="7.29.6.4.1" href="#7.29.6.4.1">7.29.6.4.1 The mbsrtowcs function</a></h5>
23283 <p><b>Synopsis</b>
23284 <p><a name="7.29.6.4.1p1" href="#7.29.6.4.1p1"><small>1</small></a>
23285 <pre>
23286           #include <a href="#7.29">&lt;wchar.h&gt;</a>
23287           size_t mbsrtowcs(wchar_t * restrict dst,
23288                const char ** restrict src,
23289                size_t len,
23290                mbstate_t * restrict ps);
23291 </pre>
23292 <p><b>Description</b>
23293 <p><a name="7.29.6.4.1p2" href="#7.29.6.4.1p2"><small>2</small></a>
23294  The mbsrtowcs function converts a sequence of multibyte characters that begins in the
23295  conversion state described by the object pointed to by ps, from the array indirectly
23296  pointed to by src into a sequence of corresponding wide characters. If dst is not a null
23297  pointer, the converted characters are stored into the array pointed to by dst. Conversion
23298  continues up to and including a terminating null character, which is also stored.
23299  Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
23300  not form a valid multibyte character, or (if dst is not a null pointer) when len wide
23301  characters have been stored into the array pointed to by dst.<sup><a href="#note350"><b>350)</b></a></sup> Each conversion takes
23302  place as if by a call to the mbrtowc function.
23303 <p><a name="7.29.6.4.1p3" href="#7.29.6.4.1p3"><small>3</small></a>
23304  If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
23305  pointer (if conversion stopped due to reaching a terminating null character) or the address
23306  just past the last multibyte character converted (if any). If conversion stopped due to
23307  reaching a terminating null character and if dst is not a null pointer, the resulting state
23308  described is the initial conversion state.
23309 <p><b>Returns</b>
23310 <p><a name="7.29.6.4.1p4" href="#7.29.6.4.1p4"><small>4</small></a>
23311  If the input conversion encounters a sequence of bytes that do not form a valid multibyte
23312  character, an encoding error occurs: the mbsrtowcs function stores the value of the
23313  macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
23314  unspecified. Otherwise, it returns the number of multibyte characters successfully
23315  converted, not including the terminating null character (if any).
23316  
23317  
23318  
23319  
23320 <!--page 464 -->
23321
23322 <p><b>Footnotes</b>
23323 <p><small><a name="note350" href="#note350">350)</a> Thus, the value of len is ignored if dst is a null pointer.
23324 </small>
23325
23326 <p><small><a href="#Contents">Contents</a></small>
23327 <h5><a name="7.29.6.4.2" href="#7.29.6.4.2">7.29.6.4.2 The wcsrtombs function</a></h5>
23328 <p><b>Synopsis</b>
23329 <p><a name="7.29.6.4.2p1" href="#7.29.6.4.2p1"><small>1</small></a>
23330 <pre>
23331          #include <a href="#7.29">&lt;wchar.h&gt;</a>
23332          size_t wcsrtombs(char * restrict dst,
23333               const wchar_t ** restrict src,
23334               size_t len,
23335               mbstate_t * restrict ps);
23336 </pre>
23337 <p><b>Description</b>
23338 <p><a name="7.29.6.4.2p2" href="#7.29.6.4.2p2"><small>2</small></a>
23339  The wcsrtombs function converts a sequence of wide characters from the array
23340  indirectly pointed to by src into a sequence of corresponding multibyte characters that
23341  begins in the conversion state described by the object pointed to by ps. If dst is not a
23342  null pointer, the converted characters are then stored into the array pointed to by dst.
23343  Conversion continues up to and including a terminating null wide character, which is also
23344  stored. Conversion stops earlier in two cases: when a wide character is reached that does
23345  not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
23346  next multibyte character would exceed the limit of len total bytes to be stored into the
23347  array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
23348  function.<sup><a href="#note351"><b>351)</b></a></sup>
23349 <p><a name="7.29.6.4.2p3" href="#7.29.6.4.2p3"><small>3</small></a>
23350  If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
23351  pointer (if conversion stopped due to reaching a terminating null wide character) or the
23352  address just past the last wide character converted (if any). If conversion stopped due to
23353  reaching a terminating null wide character, the resulting state described is the initial
23354  conversion state.
23355 <p><b>Returns</b>
23356 <p><a name="7.29.6.4.2p4" href="#7.29.6.4.2p4"><small>4</small></a>
23357  If conversion stops because a wide character is reached that does not correspond to a
23358  valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
23359  value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
23360  state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
23361  character sequence, not including the terminating null character (if any).
23362  
23363  
23364  
23365  
23366 <!--page 465 -->
23367
23368 <p><b>Footnotes</b>
23369 <p><small><a name="note351" href="#note351">351)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
23370  include those necessary to reach the initial shift state immediately before the null byte.
23371 </small>
23372
23373 <p><small><a href="#Contents">Contents</a></small>
23374 <h3><a name="7.30" href="#7.30">7.30 Wide character classification and mapping utilities &lt;wctype.h&gt;</a></h3>
23375
23376 <p><small><a href="#Contents">Contents</a></small>
23377 <h4><a name="7.30.1" href="#7.30.1">7.30.1 Introduction</a></h4>
23378 <p><a name="7.30.1p1" href="#7.30.1p1"><small>1</small></a>
23379  The header <a href="#7.30">&lt;wctype.h&gt;</a> defines one macro, and declares three data types and many
23380  functions.<sup><a href="#note352"><b>352)</b></a></sup>
23381 <p><a name="7.30.1p2" href="#7.30.1p2"><small>2</small></a>
23382  The types declared are
23383 <pre>
23384            wint_t
23385 </pre>
23386  described in <a href="#7.29.1">7.29.1</a>;
23387 <pre>
23388            wctrans_t
23389 </pre>
23390  which is a scalar type that can hold values which represent locale-specific character
23391  mappings; and
23392 <pre>
23393            wctype_t
23394 </pre>
23395  which is a scalar type that can hold values which represent locale-specific character
23396  classifications.
23397 <p><a name="7.30.1p3" href="#7.30.1p3"><small>3</small></a>
23398  The macro defined is WEOF (described in <a href="#7.29.1">7.29.1</a>).
23399 <p><a name="7.30.1p4" href="#7.30.1p4"><small>4</small></a>
23400  The functions declared are grouped as follows:
23401 <ul>
23402 <li>  Functions that provide wide character classification;
23403 <li>  Extensible functions that provide wide character classification;
23404 <li>  Functions that provide wide character case mapping;
23405 <li>  Extensible functions that provide wide character mapping.
23406 </ul>
23407 <p><a name="7.30.1p5" href="#7.30.1p5"><small>5</small></a>
23408  For all functions described in this subclause that accept an argument of type wint_t, the
23409  value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
23410  this argument has any other value, the behavior is undefined.
23411 <p><a name="7.30.1p6" href="#7.30.1p6"><small>6</small></a>
23412  The behavior of these functions is affected by the LC_CTYPE category of the current
23413  locale.
23414  
23415  
23416  
23417  
23418 <!--page 466 -->
23419
23420 <p><b>Footnotes</b>
23421 <p><small><a name="note352" href="#note352">352)</a> See ''future library directions'' (<a href="#7.31.17">7.31.17</a>).
23422 </small>
23423
23424 <p><small><a href="#Contents">Contents</a></small>
23425 <h4><a name="7.30.2" href="#7.30.2">7.30.2 Wide character classification utilities</a></h4>
23426 <p><a name="7.30.2p1" href="#7.30.2p1"><small>1</small></a>
23427  The header <a href="#7.30">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
23428  characters.
23429 <p><a name="7.30.2p2" href="#7.30.2p2"><small>2</small></a>
23430  The term printing wide character refers to a member of a locale-specific set of wide
23431  characters, each of which occupies at least one printing position on a display device. The
23432  term control wide character refers to a member of a locale-specific set of wide characters
23433  that are not printing wide characters.
23434
23435 <p><small><a href="#Contents">Contents</a></small>
23436 <h5><a name="7.30.2.1" href="#7.30.2.1">7.30.2.1 Wide character classification functions</a></h5>
23437 <p><a name="7.30.2.1p1" href="#7.30.2.1p1"><small>1</small></a>
23438  The functions in this subclause return nonzero (true) if and only if the value of the
23439  argument wc conforms to that in the description of the function.
23440 <p><a name="7.30.2.1p2" href="#7.30.2.1p2"><small>2</small></a>
23441  Each of the following functions returns true for each wide character that corresponds (as
23442  if by a call to the wctob function) to a single-byte character for which the corresponding
23443  character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
23444  iswpunct functions may differ with respect to wide characters other than L' ' that are
23445  both printing and white-space wide characters.<sup><a href="#note353"><b>353)</b></a></sup>
23446 <p><b> Forward references</b>: the wctob function (<a href="#7.29.6.1.2">7.29.6.1.2</a>).
23447
23448 <p><b>Footnotes</b>
23449 <p><small><a name="note353" href="#note353">353)</a> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
23450  iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
23451  (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
23452  &amp;&amp; iswspace(wc) is true, but not both.
23453 </small>
23454
23455 <p><small><a href="#Contents">Contents</a></small>
23456 <h5><a name="7.30.2.1.1" href="#7.30.2.1.1">7.30.2.1.1 The iswalnum function</a></h5>
23457 <p><b>Synopsis</b>
23458 <p><a name="7.30.2.1.1p1" href="#7.30.2.1.1p1"><small>1</small></a>
23459 <pre>
23460          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23461          int iswalnum(wint_t wc);
23462 </pre>
23463 <p><b>Description</b>
23464 <p><a name="7.30.2.1.1p2" href="#7.30.2.1.1p2"><small>2</small></a>
23465  The iswalnum function tests for any wide character for which iswalpha or
23466  iswdigit is true.
23467
23468 <p><small><a href="#Contents">Contents</a></small>
23469 <h5><a name="7.30.2.1.2" href="#7.30.2.1.2">7.30.2.1.2 The iswalpha function</a></h5>
23470 <p><b>Synopsis</b>
23471 <p><a name="7.30.2.1.2p1" href="#7.30.2.1.2p1"><small>1</small></a>
23472 <pre>
23473          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23474          int iswalpha(wint_t wc);
23475 </pre>
23476 <p><b>Description</b>
23477 <p><a name="7.30.2.1.2p2" href="#7.30.2.1.2p2"><small>2</small></a>
23478  The iswalpha function tests for any wide character for which iswupper or
23479  iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
23480  
23481 <!--page 467 -->
23482  wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
23483  is true.<sup><a href="#note354"><b>354)</b></a></sup>
23484
23485 <p><b>Footnotes</b>
23486 <p><small><a name="note354" href="#note354">354)</a> The functions iswlower and iswupper test true or false separately for each of these additional
23487  wide characters; all four combinations are possible.
23488 </small>
23489
23490 <p><small><a href="#Contents">Contents</a></small>
23491 <h5><a name="7.30.2.1.3" href="#7.30.2.1.3">7.30.2.1.3 The iswblank function</a></h5>
23492 <p><b>Synopsis</b>
23493 <p><a name="7.30.2.1.3p1" href="#7.30.2.1.3p1"><small>1</small></a>
23494 <pre>
23495          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23496          int iswblank(wint_t wc);
23497 </pre>
23498 <p><b>Description</b>
23499 <p><a name="7.30.2.1.3p2" href="#7.30.2.1.3p2"><small>2</small></a>
23500  The iswblank function tests for any wide character that is a standard blank wide
23501  character or is one of a locale-specific set of wide characters for which iswspace is true
23502  and that is used to separate words within a line of text. The standard blank wide
23503  characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
23504  locale, iswblank returns true only for the standard blank characters.
23505
23506 <p><small><a href="#Contents">Contents</a></small>
23507 <h5><a name="7.30.2.1.4" href="#7.30.2.1.4">7.30.2.1.4 The iswcntrl function</a></h5>
23508 <p><b>Synopsis</b>
23509 <p><a name="7.30.2.1.4p1" href="#7.30.2.1.4p1"><small>1</small></a>
23510 <pre>
23511          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23512          int iswcntrl(wint_t wc);
23513 </pre>
23514 <p><b>Description</b>
23515 <p><a name="7.30.2.1.4p2" href="#7.30.2.1.4p2"><small>2</small></a>
23516  The iswcntrl function tests for any control wide character.
23517
23518 <p><small><a href="#Contents">Contents</a></small>
23519 <h5><a name="7.30.2.1.5" href="#7.30.2.1.5">7.30.2.1.5 The iswdigit function</a></h5>
23520 <p><b>Synopsis</b>
23521 <p><a name="7.30.2.1.5p1" href="#7.30.2.1.5p1"><small>1</small></a>
23522 <pre>
23523          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23524          int iswdigit(wint_t wc);
23525 </pre>
23526 <p><b>Description</b>
23527 <p><a name="7.30.2.1.5p2" href="#7.30.2.1.5p2"><small>2</small></a>
23528  The iswdigit function tests for any wide character that corresponds to a decimal-digit
23529  character (as defined in <a href="#5.2.1">5.2.1</a>).
23530
23531 <p><small><a href="#Contents">Contents</a></small>
23532 <h5><a name="7.30.2.1.6" href="#7.30.2.1.6">7.30.2.1.6 The iswgraph function</a></h5>
23533 <p><b>Synopsis</b>
23534 <p><a name="7.30.2.1.6p1" href="#7.30.2.1.6p1"><small>1</small></a>
23535 <pre>
23536          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23537          int iswgraph(wint_t wc);
23538 </pre>
23539  
23540  
23541  
23542  
23543 <!--page 468 -->
23544 <p><b>Description</b>
23545 <p><a name="7.30.2.1.6p2" href="#7.30.2.1.6p2"><small>2</small></a>
23546  The iswgraph function tests for any wide character for which iswprint is true and
23547  iswspace is false.<sup><a href="#note355"><b>355)</b></a></sup>
23548
23549 <p><b>Footnotes</b>
23550 <p><small><a name="note355" href="#note355">355)</a> Note that the behavior of the iswgraph and iswpunct functions may differ from their
23551  corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
23552  characters other than ' '.
23553 </small>
23554
23555 <p><small><a href="#Contents">Contents</a></small>
23556 <h5><a name="7.30.2.1.7" href="#7.30.2.1.7">7.30.2.1.7 The iswlower function</a></h5>
23557 <p><b>Synopsis</b>
23558 <p><a name="7.30.2.1.7p1" href="#7.30.2.1.7p1"><small>1</small></a>
23559 <pre>
23560          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23561          int iswlower(wint_t wc);
23562 </pre>
23563 <p><b>Description</b>
23564 <p><a name="7.30.2.1.7p2" href="#7.30.2.1.7p2"><small>2</small></a>
23565  The iswlower function tests for any wide character that corresponds to a lowercase
23566  letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
23567  iswdigit, iswpunct, or iswspace is true.
23568
23569 <p><small><a href="#Contents">Contents</a></small>
23570 <h5><a name="7.30.2.1.8" href="#7.30.2.1.8">7.30.2.1.8 The iswprint function</a></h5>
23571 <p><b>Synopsis</b>
23572 <p><a name="7.30.2.1.8p1" href="#7.30.2.1.8p1"><small>1</small></a>
23573 <pre>
23574          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23575          int iswprint(wint_t wc);
23576 </pre>
23577 <p><b>Description</b>
23578 <p><a name="7.30.2.1.8p2" href="#7.30.2.1.8p2"><small>2</small></a>
23579  The iswprint function tests for any printing wide character.
23580
23581 <p><small><a href="#Contents">Contents</a></small>
23582 <h5><a name="7.30.2.1.9" href="#7.30.2.1.9">7.30.2.1.9 The iswpunct function</a></h5>
23583 <p><b>Synopsis</b>
23584 <p><a name="7.30.2.1.9p1" href="#7.30.2.1.9p1"><small>1</small></a>
23585 <pre>
23586          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23587          int iswpunct(wint_t wc);
23588 </pre>
23589 <p><b>Description</b>
23590 <p><a name="7.30.2.1.9p2" href="#7.30.2.1.9p2"><small>2</small></a>
23591  The iswpunct function tests for any printing wide character that is one of a locale-
23592  specific set of punctuation wide characters for which neither iswspace nor iswalnum
23593  is true.<sup><a href="#note355"><b>355)</b></a></sup>
23594
23595 <p><small><a href="#Contents">Contents</a></small>
23596 <h5><a name="7.30.2.1.10" href="#7.30.2.1.10">7.30.2.1.10 The iswspace function</a></h5>
23597 <p><b>Synopsis</b>
23598 <p><a name="7.30.2.1.10p1" href="#7.30.2.1.10p1"><small>1</small></a>
23599 <pre>
23600          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23601          int iswspace(wint_t wc);
23602 </pre>
23603  
23604  
23605  
23606 <!--page 469 -->
23607 <p><b>Description</b>
23608 <p><a name="7.30.2.1.10p2" href="#7.30.2.1.10p2"><small>2</small></a>
23609  The iswspace function tests for any wide character that corresponds to a locale-specific
23610  set of white-space wide characters for which none of iswalnum, iswgraph, or
23611  iswpunct is true.
23612
23613 <p><small><a href="#Contents">Contents</a></small>
23614 <h5><a name="7.30.2.1.11" href="#7.30.2.1.11">7.30.2.1.11 The iswupper function</a></h5>
23615 <p><b>Synopsis</b>
23616 <p><a name="7.30.2.1.11p1" href="#7.30.2.1.11p1"><small>1</small></a>
23617 <pre>
23618          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23619          int iswupper(wint_t wc);
23620 </pre>
23621 <p><b>Description</b>
23622 <p><a name="7.30.2.1.11p2" href="#7.30.2.1.11p2"><small>2</small></a>
23623  The iswupper function tests for any wide character that corresponds to an uppercase
23624  letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
23625  iswdigit, iswpunct, or iswspace is true.
23626
23627 <p><small><a href="#Contents">Contents</a></small>
23628 <h5><a name="7.30.2.1.12" href="#7.30.2.1.12">7.30.2.1.12 The iswxdigit function</a></h5>
23629 <p><b>Synopsis</b>
23630 <p><a name="7.30.2.1.12p1" href="#7.30.2.1.12p1"><small>1</small></a>
23631 <pre>
23632          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23633          int iswxdigit(wint_t wc);
23634 </pre>
23635 <p><b>Description</b>
23636 <p><a name="7.30.2.1.12p2" href="#7.30.2.1.12p2"><small>2</small></a>
23637  The iswxdigit function tests for any wide character that corresponds to a
23638  hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
23639
23640 <p><small><a href="#Contents">Contents</a></small>
23641 <h5><a name="7.30.2.2" href="#7.30.2.2">7.30.2.2 Extensible wide character classification functions</a></h5>
23642 <p><a name="7.30.2.2p1" href="#7.30.2.2p1"><small>1</small></a>
23643  The functions wctype and iswctype provide extensible wide character classification
23644  as well as testing equivalent to that performed by the functions described in the previous
23645  subclause (<a href="#7.30.2.1">7.30.2.1</a>).
23646
23647 <p><small><a href="#Contents">Contents</a></small>
23648 <h5><a name="7.30.2.2.1" href="#7.30.2.2.1">7.30.2.2.1 The iswctype function</a></h5>
23649 <p><b>Synopsis</b>
23650 <p><a name="7.30.2.2.1p1" href="#7.30.2.2.1p1"><small>1</small></a>
23651 <pre>
23652          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23653          int iswctype(wint_t wc, wctype_t desc);
23654 </pre>
23655 <p><b>Description</b>
23656 <p><a name="7.30.2.2.1p2" href="#7.30.2.2.1p2"><small>2</small></a>
23657  The iswctype function determines whether the wide character wc has the property
23658  described by desc. The current setting of the LC_CTYPE category shall be the same as
23659  during the call to wctype that returned the value desc.
23660 <p><a name="7.30.2.2.1p3" href="#7.30.2.2.1p3"><small>3</small></a>
23661  Each of the following expressions has a truth-value equivalent to the call to the wide
23662  character classification function (<a href="#7.30.2.1">7.30.2.1</a>) in the comment that follows the expression:
23663 <!--page 470 -->
23664 <pre>
23665         iswctype(wc,       wctype("alnum"))              //   iswalnum(wc)
23666         iswctype(wc,       wctype("alpha"))              //   iswalpha(wc)
23667         iswctype(wc,       wctype("blank"))              //   iswblank(wc)
23668         iswctype(wc,       wctype("cntrl"))              //   iswcntrl(wc)
23669         iswctype(wc,       wctype("digit"))              //   iswdigit(wc)
23670         iswctype(wc,       wctype("graph"))              //   iswgraph(wc)
23671         iswctype(wc,       wctype("lower"))              //   iswlower(wc)
23672         iswctype(wc,       wctype("print"))              //   iswprint(wc)
23673         iswctype(wc,       wctype("punct"))              //   iswpunct(wc)
23674         iswctype(wc,       wctype("space"))              //   iswspace(wc)
23675         iswctype(wc,       wctype("upper"))              //   iswupper(wc)
23676         iswctype(wc,       wctype("xdigit"))             //   iswxdigit(wc)
23677 </pre>
23678 <p><b>Returns</b>
23679 <p><a name="7.30.2.2.1p4" href="#7.30.2.2.1p4"><small>4</small></a>
23680  The iswctype function returns nonzero (true) if and only if the value of the wide
23681  character wc has the property described by desc. If desc is zero, the iswctype
23682  function returns zero (false).
23683 <p><b> Forward references</b>: the wctype function (<a href="#7.30.2.2.2">7.30.2.2.2</a>).
23684
23685 <p><small><a href="#Contents">Contents</a></small>
23686 <h5><a name="7.30.2.2.2" href="#7.30.2.2.2">7.30.2.2.2 The wctype function</a></h5>
23687 <p><b>Synopsis</b>
23688 <p><a name="7.30.2.2.2p1" href="#7.30.2.2.2p1"><small>1</small></a>
23689 <pre>
23690         #include <a href="#7.30">&lt;wctype.h&gt;</a>
23691         wctype_t wctype(const char *property);
23692 </pre>
23693 <p><b>Description</b>
23694 <p><a name="7.30.2.2.2p2" href="#7.30.2.2.2p2"><small>2</small></a>
23695  The wctype function constructs a value with type wctype_t that describes a class of
23696  wide characters identified by the string argument property.
23697 <p><a name="7.30.2.2.2p3" href="#7.30.2.2.2p3"><small>3</small></a>
23698  The strings listed in the description of the iswctype function shall be valid in all
23699  locales as property arguments to the wctype function.
23700 <p><b>Returns</b>
23701 <p><a name="7.30.2.2.2p4" href="#7.30.2.2.2p4"><small>4</small></a>
23702  If property identifies a valid class of wide characters according to the LC_CTYPE
23703  category of the current locale, the wctype function returns a nonzero value that is valid
23704  as the second argument to the iswctype function; otherwise, it returns zero.
23705 <!--page 471 -->
23706
23707 <p><small><a href="#Contents">Contents</a></small>
23708 <h4><a name="7.30.3" href="#7.30.3">7.30.3 Wide character case mapping utilities</a></h4>
23709 <p><a name="7.30.3p1" href="#7.30.3p1"><small>1</small></a>
23710  The header <a href="#7.30">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
23711
23712 <p><small><a href="#Contents">Contents</a></small>
23713 <h5><a name="7.30.3.1" href="#7.30.3.1">7.30.3.1 Wide character case mapping functions</a></h5>
23714
23715 <p><small><a href="#Contents">Contents</a></small>
23716 <h5><a name="7.30.3.1.1" href="#7.30.3.1.1">7.30.3.1.1 The towlower function</a></h5>
23717 <p><b>Synopsis</b>
23718 <p><a name="7.30.3.1.1p1" href="#7.30.3.1.1p1"><small>1</small></a>
23719 <pre>
23720          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23721          wint_t towlower(wint_t wc);
23722 </pre>
23723 <p><b>Description</b>
23724 <p><a name="7.30.3.1.1p2" href="#7.30.3.1.1p2"><small>2</small></a>
23725  The towlower function converts an uppercase letter to a corresponding lowercase letter.
23726 <p><b>Returns</b>
23727 <p><a name="7.30.3.1.1p3" href="#7.30.3.1.1p3"><small>3</small></a>
23728  If the argument is a wide character for which iswupper is true and there are one or
23729  more corresponding wide characters, as specified by the current locale, for which
23730  iswlower is true, the towlower function returns one of the corresponding wide
23731  characters (always the same one for any given locale); otherwise, the argument is
23732  returned unchanged.
23733
23734 <p><small><a href="#Contents">Contents</a></small>
23735 <h5><a name="7.30.3.1.2" href="#7.30.3.1.2">7.30.3.1.2 The towupper function</a></h5>
23736 <p><b>Synopsis</b>
23737 <p><a name="7.30.3.1.2p1" href="#7.30.3.1.2p1"><small>1</small></a>
23738 <pre>
23739          #include <a href="#7.30">&lt;wctype.h&gt;</a>
23740          wint_t towupper(wint_t wc);
23741 </pre>
23742 <p><b>Description</b>
23743 <p><a name="7.30.3.1.2p2" href="#7.30.3.1.2p2"><small>2</small></a>
23744  The towupper function converts a lowercase letter to a corresponding uppercase letter.
23745 <p><b>Returns</b>
23746 <p><a name="7.30.3.1.2p3" href="#7.30.3.1.2p3"><small>3</small></a>
23747  If the argument is a wide character for which iswlower is true and there are one or
23748  more corresponding wide characters, as specified by the current locale, for which
23749  iswupper is true, the towupper function returns one of the corresponding wide
23750  characters (always the same one for any given locale); otherwise, the argument is
23751  returned unchanged.
23752
23753 <p><small><a href="#Contents">Contents</a></small>
23754 <h5><a name="7.30.3.2" href="#7.30.3.2">7.30.3.2 Extensible wide character case mapping functions</a></h5>
23755 <p><a name="7.30.3.2p1" href="#7.30.3.2p1"><small>1</small></a>
23756  The functions wctrans and towctrans provide extensible wide character mapping as
23757  well as case mapping equivalent to that performed by the functions described in the
23758  previous subclause (<a href="#7.30.3.1">7.30.3.1</a>).
23759 <!--page 472 -->
23760
23761 <p><small><a href="#Contents">Contents</a></small>
23762 <h5><a name="7.30.3.2.1" href="#7.30.3.2.1">7.30.3.2.1 The towctrans function</a></h5>
23763 <p><b>Synopsis</b>
23764 <p><a name="7.30.3.2.1p1" href="#7.30.3.2.1p1"><small>1</small></a>
23765 <pre>
23766         #include <a href="#7.30">&lt;wctype.h&gt;</a>
23767         wint_t towctrans(wint_t wc, wctrans_t desc);
23768 </pre>
23769 <p><b>Description</b>
23770 <p><a name="7.30.3.2.1p2" href="#7.30.3.2.1p2"><small>2</small></a>
23771  The towctrans function maps the wide character wc using the mapping described by
23772  desc. The current setting of the LC_CTYPE category shall be the same as during the call
23773  to wctrans that returned the value desc.
23774 <p><a name="7.30.3.2.1p3" href="#7.30.3.2.1p3"><small>3</small></a>
23775  Each of the following expressions behaves the same as the call to the wide character case
23776  mapping function (<a href="#7.30.3.1">7.30.3.1</a>) in the comment that follows the expression:
23777 <pre>
23778         towctrans(wc, wctrans("tolower"))                      // towlower(wc)
23779         towctrans(wc, wctrans("toupper"))                      // towupper(wc)
23780 </pre>
23781 <p><b>Returns</b>
23782 <p><a name="7.30.3.2.1p4" href="#7.30.3.2.1p4"><small>4</small></a>
23783  The towctrans function returns the mapped value of wc using the mapping described
23784  by desc. If desc is zero, the towctrans function returns the value of wc.
23785
23786 <p><small><a href="#Contents">Contents</a></small>
23787 <h5><a name="7.30.3.2.2" href="#7.30.3.2.2">7.30.3.2.2 The wctrans function</a></h5>
23788 <p><b>Synopsis</b>
23789 <p><a name="7.30.3.2.2p1" href="#7.30.3.2.2p1"><small>1</small></a>
23790 <pre>
23791         #include <a href="#7.30">&lt;wctype.h&gt;</a>
23792         wctrans_t wctrans(const char *property);
23793 </pre>
23794 <p><b>Description</b>
23795 <p><a name="7.30.3.2.2p2" href="#7.30.3.2.2p2"><small>2</small></a>
23796  The wctrans function constructs a value with type wctrans_t that describes a
23797  mapping between wide characters identified by the string argument property.
23798 <p><a name="7.30.3.2.2p3" href="#7.30.3.2.2p3"><small>3</small></a>
23799  The strings listed in the description of the towctrans function shall be valid in all
23800  locales as property arguments to the wctrans function.
23801 <p><b>Returns</b>
23802 <p><a name="7.30.3.2.2p4" href="#7.30.3.2.2p4"><small>4</small></a>
23803  If property identifies a valid mapping of wide characters according to the LC_CTYPE
23804  category of the current locale, the wctrans function returns a nonzero value that is valid
23805  as the second argument to the towctrans function; otherwise, it returns zero.
23806 <!--page 473 -->
23807
23808 <p><small><a href="#Contents">Contents</a></small>
23809 <h3><a name="7.31" href="#7.31">7.31 Future library directions</a></h3>
23810 <p><a name="7.31p1" href="#7.31p1"><small>1</small></a>
23811  The following names are grouped under individual headers for convenience. All external
23812  names described below are reserved no matter what headers are included by the program.
23813
23814 <p><small><a href="#Contents">Contents</a></small>
23815 <h4><a name="7.31.1" href="#7.31.1">7.31.1 Complex arithmetic &lt;complex.h&gt;</a></h4>
23816 <p><a name="7.31.1p1" href="#7.31.1p1"><small>1</small></a>
23817  The function names
23818 <pre>
23819       cerf                cexpm1              clog2
23820       cerfc               clog10              clgamma
23821       cexp2               clog1p              ctgamma
23822 </pre>
23823  and the same names suffixed with f or l may be added to the declarations in the
23824  <a href="#7.3">&lt;complex.h&gt;</a> header.
23825
23826 <p><small><a href="#Contents">Contents</a></small>
23827 <h4><a name="7.31.2" href="#7.31.2">7.31.2 Character handling &lt;ctype.h&gt;</a></h4>
23828 <p><a name="7.31.2p1" href="#7.31.2p1"><small>1</small></a>
23829  Function names that begin with either is or to, and a lowercase letter may be added to
23830  the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
23831
23832 <p><small><a href="#Contents">Contents</a></small>
23833 <h4><a name="7.31.3" href="#7.31.3">7.31.3 Errors &lt;errno.h&gt;</a></h4>
23834 <p><a name="7.31.3p1" href="#7.31.3p1"><small>1</small></a>
23835  Macros that begin with E and a digit or E and an uppercase letter may be added to the
23836  macros defined in the <a href="#7.5">&lt;errno.h&gt;</a> header.
23837
23838 <p><small><a href="#Contents">Contents</a></small>
23839 <h4><a name="7.31.4" href="#7.31.4">7.31.4 Floating-point environment &lt;fenv.h&gt;</a></h4>
23840 <p><a name="7.31.4p1" href="#7.31.4p1"><small>1</small></a>
23841  Macros that begin with FE_ and an uppercase letter may be added to the macros defined
23842  in the <a href="#7.6">&lt;fenv.h&gt;</a> header.
23843
23844 <p><small><a href="#Contents">Contents</a></small>
23845 <h4><a name="7.31.5" href="#7.31.5">7.31.5 Format conversion of integer types &lt;inttypes.h&gt;</a></h4>
23846 <p><a name="7.31.5p1" href="#7.31.5p1"><small>1</small></a>
23847  Macros that begin with either PRI or SCN, and either a lowercase letter or X may be
23848  added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
23849
23850 <p><small><a href="#Contents">Contents</a></small>
23851 <h4><a name="7.31.6" href="#7.31.6">7.31.6 Localization &lt;locale.h&gt;</a></h4>
23852 <p><a name="7.31.6p1" href="#7.31.6p1"><small>1</small></a>
23853  Macros that begin with LC_ and an uppercase letter may be added to the macros defined
23854  in the <a href="#7.11">&lt;locale.h&gt;</a> header.
23855
23856 <p><small><a href="#Contents">Contents</a></small>
23857 <h4><a name="7.31.7" href="#7.31.7">7.31.7 Signal handling &lt;signal.h&gt;</a></h4>
23858 <p><a name="7.31.7p1" href="#7.31.7p1"><small>1</small></a>
23859  Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
23860  letter may be added to the macros defined in the <a href="#7.14">&lt;signal.h&gt;</a> header.
23861
23862 <p><small><a href="#Contents">Contents</a></small>
23863 <h4><a name="7.31.8" href="#7.31.8">7.31.8 Atomics &lt;stdatomic.h&gt;</a></h4>
23864 <p><a name="7.31.8p1" href="#7.31.8p1"><small>1</small></a>
23865  Macros that begin with ATOMIC_ and an uppercase letter may be added to the macros
23866  defined in the <a href="#7.17">&lt;stdatomic.h&gt;</a> header. Typedef names that begin with either
23867  atomic_ or memory_, and a lowercase letter may be added to the declarations in the
23868  <a href="#7.17">&lt;stdatomic.h&gt;</a> header. Enumeration constants that begin with memory_order_
23869 <!--page 474 -->
23870  and a lowercase letter may be added to the definition of the memory_order type in the
23871  <a href="#7.17">&lt;stdatomic.h&gt;</a> header. Function names that begin with atomic_ and a lowercase
23872  letter may be added to the declarations in the <a href="#7.17">&lt;stdatomic.h&gt;</a> header.
23873
23874 <p><small><a href="#Contents">Contents</a></small>
23875 <h4><a name="7.31.9" href="#7.31.9">7.31.9 Boolean type and values &lt;stdbool.h&gt;</a></h4>
23876 <p><a name="7.31.9p1" href="#7.31.9p1"><small>1</small></a>
23877  The ability to undefine and perhaps then redefine the macros bool, true, and false is
23878  an obsolescent feature.
23879
23880 <p><small><a href="#Contents">Contents</a></small>
23881 <h4><a name="7.31.10" href="#7.31.10">7.31.10 Integer types &lt;stdint.h&gt;</a></h4>
23882 <p><a name="7.31.10p1" href="#7.31.10p1"><small>1</small></a>
23883  Typedef names beginning with int or uint and ending with _t may be added to the
23884  types defined in the <a href="#7.20">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
23885  and ending with _MAX, _MIN, or _C may be added to the macros defined in the
23886  <a href="#7.20">&lt;stdint.h&gt;</a> header.
23887
23888 <p><small><a href="#Contents">Contents</a></small>
23889 <h4><a name="7.31.11" href="#7.31.11">7.31.11 Input/output &lt;stdio.h&gt;</a></h4>
23890 <p><a name="7.31.11p1" href="#7.31.11p1"><small>1</small></a>
23891  Lowercase letters may be added to the conversion specifiers and length modifiers in
23892  fprintf and fscanf. Other characters may be used in extensions.
23893 <p><a name="7.31.11p2" href="#7.31.11p2"><small>2</small></a>
23894  The use of ungetc on a binary stream where the file position indicator is zero prior to
23895  the call is an obsolescent feature.
23896
23897 <p><small><a href="#Contents">Contents</a></small>
23898 <h4><a name="7.31.12" href="#7.31.12">7.31.12 General utilities &lt;stdlib.h&gt;</a></h4>
23899 <p><a name="7.31.12p1" href="#7.31.12p1"><small>1</small></a>
23900  Function names that begin with str and a lowercase letter may be added to the
23901  declarations in the <a href="#7.22">&lt;stdlib.h&gt;</a> header.
23902
23903 <p><small><a href="#Contents">Contents</a></small>
23904 <h4><a name="7.31.13" href="#7.31.13">7.31.13 String handling &lt;string.h&gt;</a></h4>
23905 <p><a name="7.31.13p1" href="#7.31.13p1"><small>1</small></a>
23906  Function names that begin with str, mem, or wcs and a lowercase letter may be added
23907  to the declarations in the <a href="#7.24">&lt;string.h&gt;</a> header.
23908
23909 <p><small><a href="#Contents">Contents</a></small>
23910 <h4><a name="7.31.14" href="#7.31.14">7.31.14 Date and time &lt;time.h&gt;</a></h4>
23911  Macros beginning with TIME_ and an uppercase letter may be added to the macros in the
23912  <a href="#7.27">&lt;time.h&gt;</a> header.
23913
23914 <p><small><a href="#Contents">Contents</a></small>
23915 <h4><a name="7.31.15" href="#7.31.15">7.31.15 Threads &lt;threads.h&gt;</a></h4>
23916 <p><a name="7.31.15p1" href="#7.31.15p1"><small>1</small></a>
23917  Function names, type names, and enumeration constants that begin with either cnd_,
23918  mtx_, thrd_, or tss_, and a lowercase letter may be added to the declarations in the
23919  <a href="#7.26">&lt;threads.h&gt;</a> header.
23920
23921 <p><small><a href="#Contents">Contents</a></small>
23922 <h4><a name="7.31.16" href="#7.31.16">7.31.16 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a></h4>
23923 <p><a name="7.31.16p1" href="#7.31.16p1"><small>1</small></a>
23924  Function names that begin with wcs and a lowercase letter may be added to the
23925  declarations in the <a href="#7.29">&lt;wchar.h&gt;</a> header.
23926 <p><a name="7.31.16p2" href="#7.31.16p2"><small>2</small></a>
23927  Lowercase letters may be added to the conversion specifiers and length modifiers in
23928  fwprintf and fwscanf. Other characters may be used in extensions.
23929 <!--page 475 -->
23930
23931 <p><small><a href="#Contents">Contents</a></small>
23932 <h4><a name="7.31.17" href="#7.31.17">7.31.17 Wide character classification and mapping utilities</a></h4>
23933  <a href="#7.30">&lt;wctype.h&gt;</a>
23934 <p><a name="7.31.17p1" href="#7.31.17p1"><small>1</small></a>
23935  Function names that begin with is or to and a lowercase letter may be added to the
23936  declarations in the <a href="#7.30">&lt;wctype.h&gt;</a> header.
23937 <!--page 476 -->
23938
23939 <p><small><a href="#Contents">Contents</a></small>
23940 <h2><a name="A" href="#A">Annex A</a></h2>
23941 <pre>
23942                                             (informative)
23943                              Language syntax summary
23944 </pre>
23945 <p><a name="Ap1" href="#Ap1"><small>1</small></a>
23946  NOTE   The notation is described in <a href="#6.1">6.1</a>.
23947  
23948
23949 <p><small><a href="#Contents">Contents</a></small>
23950 <h3><a name="A.1" href="#A.1">A.1 Lexical grammar</a></h3>
23951
23952 <p><small><a href="#Contents">Contents</a></small>
23953 <h4><a name="A.1.1" href="#A.1.1">A.1.1 Lexical elements</a></h4>
23954  (<a href="#6.4">6.4</a>) token:
23955 <pre>
23956                 keyword
23957                 identifier
23958                 constant
23959                 string-literal
23960                 punctuator
23961 </pre>
23962  (<a href="#6.4">6.4</a>) preprocessing-token:
23963 <!--page 477 -->
23964 <pre>
23965                header-name
23966                identifier
23967                pp-number
23968                character-constant
23969                string-literal
23970                punctuator
23971                each non-white-space character that cannot be one of the above
23972 </pre>
23973
23974 <p><small><a href="#Contents">Contents</a></small>
23975 <h4><a name="A.1.2" href="#A.1.2">A.1.2 Keywords</a></h4>
23976  (<a href="#6.4.1">6.4.1</a>) keyword: one of
23977 <pre>
23978                auto                     * if                     unsigned
23979                break                      inline                 void
23980                case                       int                    volatile
23981                char                       long                   while
23982                const                      register               _Alignas
23983                continue                   restrict               _Alignof
23984                default                    return                 _Atomic
23985                do                         short                  _Bool
23986                double                     signed                 _Complex
23987                else                       sizeof                 _Generic
23988                enum                       static                 _Imaginary
23989                extern                     struct                 _Noreturn
23990                float                      switch                 _Static_assert
23991                for                        typedef                _Thread_local
23992                goto                       union
23993 </pre>
23994
23995 <p><small><a href="#Contents">Contents</a></small>
23996 <h4><a name="A.1.3" href="#A.1.3">A.1.3 Identifiers</a></h4>
23997  (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
23998 <pre>
23999                 identifier-nondigit
24000                 identifier identifier-nondigit
24001                 identifier digit
24002 </pre>
24003  (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
24004 <pre>
24005                 nondigit
24006                 universal-character-name
24007                 other implementation-defined characters
24008 </pre>
24009  (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
24010 <pre>
24011                _ a b           c    d   e   f   g   h    i   j   k   l   m
24012                     n o        p    q   r   s   t   u    v   w   x   y   z
24013                     A B        C    D   E   F   G   H    I   J   K   L   M
24014                     N O        P    Q   R   S   T   U    V   W   X   Y   Z
24015 </pre>
24016  (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
24017 <!--page 478 -->
24018 <pre>
24019                 0 1 2          3    4   5   6   7   8    9
24020 </pre>
24021
24022 <p><small><a href="#Contents">Contents</a></small>
24023 <h4><a name="A.1.4" href="#A.1.4">A.1.4 Universal character names</a></h4>
24024  (<a href="#6.4.3">6.4.3</a>) universal-character-name:
24025 <pre>
24026                \u hex-quad
24027                \U hex-quad hex-quad
24028 </pre>
24029  (<a href="#6.4.3">6.4.3</a>) hex-quad:
24030 <pre>
24031                hexadecimal-digit hexadecimal-digit
24032                             hexadecimal-digit hexadecimal-digit
24033 </pre>
24034
24035 <p><small><a href="#Contents">Contents</a></small>
24036 <h4><a name="A.1.5" href="#A.1.5">A.1.5 Constants</a></h4>
24037  (<a href="#6.4.4">6.4.4</a>) constant:
24038 <pre>
24039                integer-constant
24040                floating-constant
24041                enumeration-constant
24042                character-constant
24043 </pre>
24044  (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
24045 <pre>
24046                 decimal-constant integer-suffix<sub>opt</sub>
24047                 octal-constant integer-suffix<sub>opt</sub>
24048                 hexadecimal-constant integer-suffix<sub>opt</sub>
24049 </pre>
24050  (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
24051 <pre>
24052                nonzero-digit
24053                decimal-constant digit
24054 </pre>
24055  (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
24056 <pre>
24057                 0
24058                 octal-constant octal-digit
24059 </pre>
24060  (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
24061 <pre>
24062                hexadecimal-prefix hexadecimal-digit
24063                hexadecimal-constant hexadecimal-digit
24064 </pre>
24065  (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
24066 <pre>
24067                0x 0X
24068 </pre>
24069  (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
24070 <pre>
24071                1 2 3 4 5              6      7   8   9
24072 </pre>
24073  (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
24074 <!--page 479 -->
24075 <pre>
24076                 0 1 2 3           4   5      6   7
24077 </pre>
24078  (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
24079 <pre>
24080                0 1 2 3 4 5                6    7    8   9
24081                a b c d e f
24082                A B C D E F
24083 </pre>
24084  (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
24085 <pre>
24086                 unsigned-suffix long-suffix<sub>opt</sub>
24087                 unsigned-suffix long-long-suffix
24088                 long-suffix unsigned-suffix<sub>opt</sub>
24089                 long-long-suffix unsigned-suffix<sub>opt</sub>
24090 </pre>
24091  (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
24092 <pre>
24093                 u U
24094 </pre>
24095  (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
24096 <pre>
24097                 l L
24098 </pre>
24099  (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
24100 <pre>
24101                 ll LL
24102 </pre>
24103  (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
24104 <pre>
24105                 decimal-floating-constant
24106                 hexadecimal-floating-constant
24107 </pre>
24108  (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
24109 <pre>
24110                fractional-constant exponent-part<sub>opt</sub> floating-suffix<sub>opt</sub>
24111                digit-sequence exponent-part floating-suffix<sub>opt</sub>
24112 </pre>
24113  (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
24114 <pre>
24115                hexadecimal-prefix hexadecimal-fractional-constant
24116                              binary-exponent-part floating-suffix<sub>opt</sub>
24117                hexadecimal-prefix hexadecimal-digit-sequence
24118                              binary-exponent-part floating-suffix<sub>opt</sub>
24119 </pre>
24120  (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
24121 <pre>
24122                 digit-sequence<sub>opt</sub> . digit-sequence
24123                 digit-sequence .
24124 </pre>
24125  (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
24126 <pre>
24127                e sign<sub>opt</sub> digit-sequence
24128                E sign<sub>opt</sub> digit-sequence
24129 </pre>
24130  (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
24131 <!--page 480 -->
24132 <pre>
24133                 + -
24134 </pre>
24135  (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
24136 <pre>
24137                 digit
24138                 digit-sequence digit
24139 </pre>
24140  (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
24141 <pre>
24142                hexadecimal-digit-sequence<sub>opt</sub> .
24143                               hexadecimal-digit-sequence
24144                hexadecimal-digit-sequence .
24145 </pre>
24146  (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
24147 <pre>
24148                 p sign<sub>opt</sub> digit-sequence
24149                 P sign<sub>opt</sub> digit-sequence
24150 </pre>
24151  (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
24152 <pre>
24153                hexadecimal-digit
24154                hexadecimal-digit-sequence hexadecimal-digit
24155 </pre>
24156  (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
24157 <pre>
24158                 f l F L
24159 </pre>
24160  (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
24161 <pre>
24162                identifier
24163 </pre>
24164  (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
24165 <pre>
24166                ' c-char-sequence '
24167                L' c-char-sequence '
24168                u' c-char-sequence '
24169                U' c-char-sequence '
24170 </pre>
24171  (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
24172 <pre>
24173                 c-char
24174                 c-char-sequence c-char
24175 </pre>
24176  (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
24177 <pre>
24178                 any member of the source character set except
24179                              the single-quote ', backslash \, or new-line character
24180                 escape-sequence
24181 </pre>
24182  (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
24183 <!--page 481 -->
24184 <pre>
24185                simple-escape-sequence
24186                octal-escape-sequence
24187                hexadecimal-escape-sequence
24188                universal-character-name
24189 </pre>
24190  (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
24191 <pre>
24192                \' \" \? \\
24193                \a \b \f \n \r \t                   \v
24194 </pre>
24195  (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
24196 <pre>
24197                 \ octal-digit
24198                 \ octal-digit octal-digit
24199                 \ octal-digit octal-digit octal-digit
24200 </pre>
24201  (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
24202 <pre>
24203                \x hexadecimal-digit
24204                hexadecimal-escape-sequence hexadecimal-digit
24205 </pre>
24206
24207 <p><small><a href="#Contents">Contents</a></small>
24208 <h4><a name="A.1.6" href="#A.1.6">A.1.6 String literals</a></h4>
24209  (<a href="#6.4.5">6.4.5</a>) string-literal:
24210 <pre>
24211                 encoding-prefix<sub>opt</sub> " s-char-sequence<sub>opt</sub> "
24212 </pre>
24213  (<a href="#6.4.5">6.4.5</a>) encoding-prefix:
24214 <pre>
24215                u8
24216                u
24217                U
24218                L
24219 </pre>
24220  (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
24221 <pre>
24222                 s-char
24223                 s-char-sequence s-char
24224 </pre>
24225  (<a href="#6.4.5">6.4.5</a>) s-char:
24226 <pre>
24227                 any member of the source character set except
24228                              the double-quote ", backslash \, or new-line character
24229                 escape-sequence
24230 </pre>
24231
24232 <p><small><a href="#Contents">Contents</a></small>
24233 <h4><a name="A.1.7" href="#A.1.7">A.1.7 Punctuators</a></h4>
24234  (<a href="#6.4.6">6.4.6</a>) punctuator: one of
24235 <!--page 482 -->
24236 <pre>
24237                [ ] ( ) { } . -&gt;
24238                ++ -- &amp; * + - ~ !
24239                / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;=                      ==     !=    ^    |   &amp;&amp;   ||
24240                ? : ; ...
24241                = *= /= %= += -= &lt;&lt;=                     &gt;&gt;=     &amp;=       ^=   |=
24242                , # ##
24243                &lt;: :&gt; &lt;% %&gt; %: %:%:
24244 </pre>
24245
24246 <p><small><a href="#Contents">Contents</a></small>
24247 <h4><a name="A.1.8" href="#A.1.8">A.1.8 Header names</a></h4>
24248  (<a href="#6.4.7">6.4.7</a>) header-name:
24249 <pre>
24250                &lt; h-char-sequence &gt;
24251                " q-char-sequence "
24252 </pre>
24253  (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
24254 <pre>
24255                h-char
24256                h-char-sequence h-char
24257 </pre>
24258  (<a href="#6.4.7">6.4.7</a>) h-char:
24259 <pre>
24260                any member of the source character set except
24261                             the new-line character and &gt;
24262 </pre>
24263  (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
24264 <pre>
24265                q-char
24266                q-char-sequence q-char
24267 </pre>
24268  (<a href="#6.4.7">6.4.7</a>) q-char:
24269 <pre>
24270                any member of the source character set except
24271                             the new-line character and "
24272 </pre>
24273
24274 <p><small><a href="#Contents">Contents</a></small>
24275 <h4><a name="A.1.9" href="#A.1.9">A.1.9 Preprocessing numbers</a></h4>
24276  (<a href="#6.4.8">6.4.8</a>) pp-number:
24277 <!--page 483 -->
24278 <pre>
24279                digit
24280                . digit
24281                pp-number   digit
24282                pp-number   identifier-nondigit
24283                pp-number   e sign
24284                pp-number   E sign
24285                pp-number   p sign
24286                pp-number   P sign
24287                pp-number   .
24288 </pre>
24289
24290 <p><small><a href="#Contents">Contents</a></small>
24291 <h3><a name="A.2" href="#A.2">A.2 Phrase structure grammar</a></h3>
24292
24293 <p><small><a href="#Contents">Contents</a></small>
24294 <h4><a name="A.2.1" href="#A.2.1">A.2.1 Expressions</a></h4>
24295  (<a href="#6.5.1">6.5.1</a>) primary-expression:
24296 <pre>
24297                identifier
24298                constant
24299                string-literal
24300                ( expression )
24301                generic-selection
24302 </pre>
24303  (<a href="#6.5.1.1">6.5.1.1</a>) generic-selection:
24304 <pre>
24305                _Generic ( assignment-expression , generic-assoc-list )
24306 </pre>
24307  (<a href="#6.5.1.1">6.5.1.1</a>) generic-assoc-list:
24308 <pre>
24309                generic-association
24310                generic-assoc-list , generic-association
24311 </pre>
24312  (<a href="#6.5.1.1">6.5.1.1</a>) generic-association:
24313 <pre>
24314                type-name : assignment-expression
24315                default : assignment-expression
24316 </pre>
24317  (<a href="#6.5.2">6.5.2</a>) postfix-expression:
24318 <pre>
24319                primary-expression
24320                postfix-expression [ expression ]
24321                postfix-expression ( argument-expression-list<sub>opt</sub> )
24322                postfix-expression . identifier
24323                postfix-expression -&gt; identifier
24324                postfix-expression ++
24325                postfix-expression --
24326                ( type-name ) { initializer-list }
24327                ( type-name ) { initializer-list , }
24328 </pre>
24329  (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
24330 <pre>
24331               assignment-expression
24332               argument-expression-list , assignment-expression
24333 </pre>
24334  (<a href="#6.5.3">6.5.3</a>) unary-expression:
24335 <!--page 484 -->
24336 <pre>
24337                postfix-expression
24338                ++ unary-expression
24339                -- unary-expression
24340                unary-operator cast-expression
24341                sizeof unary-expression
24342                sizeof ( type-name )
24343                _Alignof ( type-name )
24344 </pre>
24345  (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
24346 <pre>
24347                &amp; * + - ~                !
24348 </pre>
24349  (<a href="#6.5.4">6.5.4</a>) cast-expression:
24350 <pre>
24351                 unary-expression
24352                 ( type-name ) cast-expression
24353 </pre>
24354  (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
24355 <pre>
24356                 cast-expression
24357                 multiplicative-expression * cast-expression
24358                 multiplicative-expression / cast-expression
24359                 multiplicative-expression % cast-expression
24360 </pre>
24361  (<a href="#6.5.6">6.5.6</a>) additive-expression:
24362 <pre>
24363                 multiplicative-expression
24364                 additive-expression + multiplicative-expression
24365                 additive-expression - multiplicative-expression
24366 </pre>
24367  (<a href="#6.5.7">6.5.7</a>) shift-expression:
24368 <pre>
24369                  additive-expression
24370                  shift-expression &lt;&lt; additive-expression
24371                  shift-expression &gt;&gt; additive-expression
24372 </pre>
24373  (<a href="#6.5.8">6.5.8</a>) relational-expression:
24374 <pre>
24375                 shift-expression
24376                 relational-expression   &lt;    shift-expression
24377                 relational-expression   &gt;    shift-expression
24378                 relational-expression   &lt;=   shift-expression
24379                 relational-expression   &gt;=   shift-expression
24380 </pre>
24381  (<a href="#6.5.9">6.5.9</a>) equality-expression:
24382 <pre>
24383                 relational-expression
24384                 equality-expression == relational-expression
24385                 equality-expression != relational-expression
24386 </pre>
24387  (<a href="#6.5.10">6.5.10</a>) AND-expression:
24388 <pre>
24389               equality-expression
24390               AND-expression &amp; equality-expression
24391 </pre>
24392  (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
24393 <!--page 485 -->
24394 <pre>
24395                AND-expression
24396                exclusive-OR-expression ^ AND-expression
24397 </pre>
24398  (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
24399 <pre>
24400                 exclusive-OR-expression
24401                 inclusive-OR-expression | exclusive-OR-expression
24402 </pre>
24403  (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
24404 <pre>
24405                inclusive-OR-expression
24406                logical-AND-expression &amp;&amp; inclusive-OR-expression
24407 </pre>
24408  (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
24409 <pre>
24410                logical-AND-expression
24411                logical-OR-expression || logical-AND-expression
24412 </pre>
24413  (<a href="#6.5.15">6.5.15</a>) conditional-expression:
24414 <pre>
24415                logical-OR-expression
24416                logical-OR-expression ? expression : conditional-expression
24417 </pre>
24418  (<a href="#6.5.16">6.5.16</a>) assignment-expression:
24419 <pre>
24420                conditional-expression
24421                unary-expression assignment-operator assignment-expression
24422 </pre>
24423  (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
24424 <pre>
24425                = *= /= %= +=                -=    &lt;&lt;=    &gt;&gt;=      &amp;=    ^=   |=
24426 </pre>
24427  (<a href="#6.5.17">6.5.17</a>) expression:
24428 <pre>
24429                assignment-expression
24430                expression , assignment-expression
24431 </pre>
24432  (<a href="#6.6">6.6</a>) constant-expression:
24433 <pre>
24434                conditional-expression
24435 </pre>
24436
24437 <p><small><a href="#Contents">Contents</a></small>
24438 <h4><a name="A.2.2" href="#A.2.2">A.2.2 Declarations</a></h4>
24439  (<a href="#6.7">6.7</a>) declaration:
24440 <pre>
24441                 declaration-specifiers init-declarator-list<sub>opt</sub> ;
24442                 static_assert-declaration
24443 </pre>
24444  (<a href="#6.7">6.7</a>) declaration-specifiers:
24445 <pre>
24446                 storage-class-specifier declaration-specifiers<sub>opt</sub>
24447                 type-specifier declaration-specifiers<sub>opt</sub>
24448                 type-qualifier declaration-specifiers<sub>opt</sub>
24449                 function-specifier declaration-specifiers<sub>opt</sub>
24450                 alignment-specifier declaration-specifiers<sub>opt</sub>
24451 </pre>
24452  (<a href="#6.7">6.7</a>) init-declarator-list:
24453 <!--page 486 -->
24454 <pre>
24455                 init-declarator
24456                 init-declarator-list , init-declarator
24457 </pre>
24458  (<a href="#6.7">6.7</a>) init-declarator:
24459 <pre>
24460                 declarator
24461                 declarator = initializer
24462 </pre>
24463  (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
24464 <pre>
24465                typedef
24466                extern
24467                static
24468                _Thread_local
24469                auto
24470                register
24471 </pre>
24472  (<a href="#6.7.2">6.7.2</a>) type-specifier:
24473 <pre>
24474                 void
24475                 char
24476                 short
24477                 int
24478                 long
24479                 float
24480                 double
24481                 signed
24482                 unsigned
24483                 _Bool
24484                 _Complex
24485                 atomic-type-specifier
24486                 struct-or-union-specifier
24487                 enum-specifier
24488                 typedef-name
24489 </pre>
24490  (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
24491 <pre>
24492                 struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
24493                 struct-or-union identifier
24494 </pre>
24495  (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
24496 <pre>
24497                 struct
24498                 union
24499 </pre>
24500  (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
24501 <pre>
24502                 struct-declaration
24503                 struct-declaration-list struct-declaration
24504 </pre>
24505  (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
24506 <!--page 487 -->
24507 <pre>
24508                 specifier-qualifier-list struct-declarator-list<sub>opt</sub> ;
24509                 static_assert-declaration
24510 </pre>
24511  (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
24512 <pre>
24513                 type-specifier specifier-qualifier-list<sub>opt</sub>
24514                 type-qualifier specifier-qualifier-list<sub>opt</sub>
24515 </pre>
24516  (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
24517 <pre>
24518                 struct-declarator
24519                 struct-declarator-list , struct-declarator
24520 </pre>
24521  (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
24522 <pre>
24523                 declarator
24524                 declarator<sub>opt</sub> : constant-expression
24525 </pre>
24526  (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
24527 <pre>
24528                enum identifier<sub>opt</sub> { enumerator-list }
24529                enum identifier<sub>opt</sub> { enumerator-list , }
24530                enum identifier
24531 </pre>
24532  (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
24533 <pre>
24534                enumerator
24535                enumerator-list , enumerator
24536 </pre>
24537  (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
24538 <pre>
24539                enumeration-constant
24540                enumeration-constant = constant-expression
24541 </pre>
24542  (<a href="#6.7.2.4">6.7.2.4</a>) atomic-type-specifier:
24543 <pre>
24544                _Atomic ( type-name )
24545 </pre>
24546  (<a href="#6.7.3">6.7.3</a>) type-qualifier:
24547 <pre>
24548                const
24549                restrict
24550                volatile
24551                _Atomic
24552 </pre>
24553  (<a href="#6.7.4">6.7.4</a>) function-specifier:
24554 <pre>
24555                 inline
24556                 _Noreturn
24557 </pre>
24558  (<a href="#6.7.5">6.7.5</a>) alignment-specifier:
24559 <pre>
24560                _Alignas ( type-name )
24561                _Alignas ( constant-expression )
24562 </pre>
24563  (<a href="#6.7.6">6.7.6</a>) declarator:
24564 <!--page 488 -->
24565 <pre>
24566                pointer<sub>opt</sub> direct-declarator
24567 </pre>
24568  (<a href="#6.7.6">6.7.6</a>) direct-declarator:
24569 <pre>
24570                 identifier
24571                 ( declarator )
24572                 direct-declarator [ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
24573                 direct-declarator [ static type-qualifier-list<sub>opt</sub> assignment-expression ]
24574                 direct-declarator [ type-qualifier-list static assignment-expression ]
24575                 direct-declarator [ type-qualifier-list<sub>opt</sub> * ]
24576                 direct-declarator ( parameter-type-list )
24577                 direct-declarator ( identifier-list<sub>opt</sub> )
24578 </pre>
24579  (<a href="#6.7.6">6.7.6</a>) pointer:
24580 <pre>
24581                 * type-qualifier-list<sub>opt</sub>
24582                 * type-qualifier-list<sub>opt</sub> pointer
24583 </pre>
24584  (<a href="#6.7.6">6.7.6</a>) type-qualifier-list:
24585 <pre>
24586                type-qualifier
24587                type-qualifier-list type-qualifier
24588 </pre>
24589  (<a href="#6.7.6">6.7.6</a>) parameter-type-list:
24590 <pre>
24591               parameter-list
24592               parameter-list , ...
24593 </pre>
24594  (<a href="#6.7.6">6.7.6</a>) parameter-list:
24595 <pre>
24596               parameter-declaration
24597               parameter-list , parameter-declaration
24598 </pre>
24599  (<a href="#6.7.6">6.7.6</a>) parameter-declaration:
24600 <pre>
24601               declaration-specifiers declarator
24602               declaration-specifiers abstract-declarator<sub>opt</sub>
24603 </pre>
24604  (<a href="#6.7.6">6.7.6</a>) identifier-list:
24605 <pre>
24606                 identifier
24607                 identifier-list , identifier
24608 </pre>
24609  (<a href="#6.7.7">6.7.7</a>) type-name:
24610 <pre>
24611                specifier-qualifier-list abstract-declarator<sub>opt</sub>
24612 </pre>
24613  (<a href="#6.7.7">6.7.7</a>) abstract-declarator:
24614 <!--page 489 -->
24615 <pre>
24616                pointer
24617                pointer<sub>opt</sub> direct-abstract-declarator
24618 </pre>
24619  (<a href="#6.7.7">6.7.7</a>) direct-abstract-declarator:
24620 <pre>
24621                 ( abstract-declarator )
24622                 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list<sub>opt</sub>
24623                                assignment-expression<sub>opt</sub> ]
24624                 direct-abstract-declarator<sub>opt</sub> [ static type-qualifier-list<sub>opt</sub>
24625                                assignment-expression ]
24626                 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list static
24627                                assignment-expression ]
24628                 direct-abstract-declarator<sub>opt</sub> [ * ]
24629                 direct-abstract-declarator<sub>opt</sub> ( parameter-type-list<sub>opt</sub> )
24630 </pre>
24631  (<a href="#6.7.8">6.7.8</a>) typedef-name:
24632 <pre>
24633                identifier
24634 </pre>
24635  (<a href="#6.7.9">6.7.9</a>) initializer:
24636 <pre>
24637                  assignment-expression
24638                  { initializer-list }
24639                  { initializer-list , }
24640 </pre>
24641  (<a href="#6.7.9">6.7.9</a>) initializer-list:
24642 <pre>
24643                  designation<sub>opt</sub> initializer
24644                  initializer-list , designation<sub>opt</sub> initializer
24645 </pre>
24646  (<a href="#6.7.9">6.7.9</a>) designation:
24647 <pre>
24648                designator-list =
24649 </pre>
24650  (<a href="#6.7.9">6.7.9</a>) designator-list:
24651 <pre>
24652                designator
24653                designator-list designator
24654 </pre>
24655  (<a href="#6.7.9">6.7.9</a>) designator:
24656 <pre>
24657                [ constant-expression ]
24658                . identifier
24659 </pre>
24660  (<a href="#6.7.10">6.7.10</a>) static_assert-declaration:
24661 <!--page 490 -->
24662 <pre>
24663                 _Static_assert ( constant-expression , string-literal ) ;
24664 </pre>
24665
24666 <p><small><a href="#Contents">Contents</a></small>
24667 <h4><a name="A.2.3" href="#A.2.3">A.2.3 Statements</a></h4>
24668  (<a href="#6.8">6.8</a>) statement:
24669 <pre>
24670                labeled-statement
24671                compound-statement
24672                expression-statement
24673                selection-statement
24674                iteration-statement
24675                jump-statement
24676 </pre>
24677  (<a href="#6.8.1">6.8.1</a>) labeled-statement:
24678 <pre>
24679                 identifier : statement
24680                 case constant-expression : statement
24681                 default : statement
24682 </pre>
24683  (<a href="#6.8.2">6.8.2</a>) compound-statement:
24684 <pre>
24685               { block-item-list<sub>opt</sub> }
24686 </pre>
24687  (<a href="#6.8.2">6.8.2</a>) block-item-list:
24688 <pre>
24689                 block-item
24690                 block-item-list block-item
24691 </pre>
24692  (<a href="#6.8.2">6.8.2</a>) block-item:
24693 <pre>
24694                 declaration
24695                 statement
24696 </pre>
24697  (<a href="#6.8.3">6.8.3</a>) expression-statement:
24698 <pre>
24699                expression<sub>opt</sub> ;
24700 </pre>
24701  (<a href="#6.8.4">6.8.4</a>) selection-statement:
24702 <pre>
24703                 if ( expression ) statement
24704                 if ( expression ) statement else statement
24705                 switch ( expression ) statement
24706 </pre>
24707  (<a href="#6.8.5">6.8.5</a>) iteration-statement:
24708 <pre>
24709                  while ( expression ) statement
24710                  do statement while ( expression ) ;
24711                  for ( expression<sub>opt</sub> ; expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
24712                  for ( declaration expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
24713 </pre>
24714  (<a href="#6.8.6">6.8.6</a>) jump-statement:
24715 <!--page 491 -->
24716 <pre>
24717                goto identifier ;
24718                continue ;
24719                break ;
24720                return expression<sub>opt</sub> ;
24721 </pre>
24722
24723 <p><small><a href="#Contents">Contents</a></small>
24724 <h4><a name="A.2.4" href="#A.2.4">A.2.4 External definitions</a></h4>
24725  (<a href="#6.9">6.9</a>) translation-unit:
24726 <pre>
24727                 external-declaration
24728                 translation-unit external-declaration
24729 </pre>
24730  (<a href="#6.9">6.9</a>) external-declaration:
24731 <pre>
24732                 function-definition
24733                 declaration
24734 </pre>
24735  (<a href="#6.9.1">6.9.1</a>) function-definition:
24736 <pre>
24737                 declaration-specifiers declarator declaration-list<sub>opt</sub> compound-statement
24738 </pre>
24739  (<a href="#6.9.1">6.9.1</a>) declaration-list:
24740 <pre>
24741                declaration
24742                declaration-list declaration
24743 </pre>
24744
24745 <p><small><a href="#Contents">Contents</a></small>
24746 <h3><a name="A.3" href="#A.3">A.3 Preprocessing directives</a></h3>
24747  (<a href="#6.10">6.10</a>) preprocessing-file:
24748 <pre>
24749                group<sub>opt</sub>
24750 </pre>
24751  (<a href="#6.10">6.10</a>) group:
24752 <pre>
24753                  group-part
24754                  group group-part
24755 </pre>
24756  (<a href="#6.10">6.10</a>) group-part:
24757 <pre>
24758                if-section
24759                control-line
24760                text-line
24761                # non-directive
24762 </pre>
24763  (<a href="#6.10">6.10</a>) if-section:
24764 <pre>
24765                  if-group elif-groups<sub>opt</sub> else-group<sub>opt</sub> endif-line
24766 </pre>
24767  (<a href="#6.10">6.10</a>) if-group:
24768 <pre>
24769                 # if     constant-expression new-line group<sub>opt</sub>
24770                 # ifdef identifier new-line group<sub>opt</sub>
24771                 # ifndef identifier new-line group<sub>opt</sub>
24772 </pre>
24773  (<a href="#6.10">6.10</a>) elif-groups:
24774 <pre>
24775                 elif-group
24776                 elif-groups elif-group
24777 </pre>
24778  (<a href="#6.10">6.10</a>) elif-group:
24779 <!--page 492 -->
24780 <pre>
24781                 # elif        constant-expression new-line group<sub>opt</sub>
24782 </pre>
24783  (<a href="#6.10">6.10</a>) else-group:
24784 <pre>
24785                 # else        new-line group<sub>opt</sub>
24786 </pre>
24787  (<a href="#6.10">6.10</a>) endif-line:
24788 <pre>
24789                 # endif       new-line
24790 </pre>
24791  (<a href="#6.10">6.10</a>) control-line:
24792 <pre>
24793                # include pp-tokens new-line
24794                # define identifier replacement-list new-line
24795                # define identifier lparen identifier-list<sub>opt</sub> )
24796                                                replacement-list new-line
24797                # define identifier lparen ... ) replacement-list new-line
24798                # define identifier lparen identifier-list , ... )
24799                                                replacement-list new-line
24800                # undef   identifier new-line
24801                # line    pp-tokens new-line
24802                # error   pp-tokens<sub>opt</sub> new-line
24803                # pragma pp-tokens<sub>opt</sub> new-line
24804                #         new-line
24805 </pre>
24806  (<a href="#6.10">6.10</a>) text-line:
24807 <pre>
24808                 pp-tokens<sub>opt</sub> new-line
24809 </pre>
24810  (<a href="#6.10">6.10</a>) non-directive:
24811 <pre>
24812                pp-tokens new-line
24813 </pre>
24814  (<a href="#6.10">6.10</a>) lparen:
24815 <pre>
24816                   a ( character not immediately preceded by white-space
24817 </pre>
24818  (<a href="#6.10">6.10</a>) replacement-list:
24819 <pre>
24820                pp-tokens<sub>opt</sub>
24821 </pre>
24822  (<a href="#6.10">6.10</a>) pp-tokens:
24823 <pre>
24824                preprocessing-token
24825                pp-tokens preprocessing-token
24826 </pre>
24827  (<a href="#6.10">6.10</a>) new-line:
24828 <!--page 493 -->
24829 <pre>
24830                the new-line character
24831 </pre>
24832
24833 <p><small><a href="#Contents">Contents</a></small>
24834 <h2><a name="B" href="#B">Annex B</a></h2>
24835 <pre>
24836                                  (informative)
24837                              Library summary
24838 </pre>
24839
24840 <p><small><a href="#Contents">Contents</a></small>
24841 <h3><a name="B.1" href="#B.1">B.1 Diagnostics &lt;assert.h&gt;</a></h3>
24842 <pre>
24843          NDEBUG
24844          static_assert
24845          void assert(scalar expression);
24846 </pre>
24847
24848 <p><small><a href="#Contents">Contents</a></small>
24849 <h3><a name="B.2" href="#B.2">B.2 Complex &lt;complex.h&gt;</a></h3>
24850 <!--page 494 -->
24851 <!--page 495 -->
24852 <pre>
24853          __STDC_NO_COMPLEX__              imaginary
24854          complex                            _Imaginary_I
24855          _Complex_I                         I
24856          #pragma STDC CX_LIMITED_RANGE on-off-switch
24857          double complex cacos(double complex z);
24858          float complex cacosf(float complex z);
24859          long double complex cacosl(long double complex z);
24860          double complex casin(double complex z);
24861          float complex casinf(float complex z);
24862          long double complex casinl(long double complex z);
24863          double complex catan(double complex z);
24864          float complex catanf(float complex z);
24865          long double complex catanl(long double complex z);
24866          double complex ccos(double complex z);
24867          float complex ccosf(float complex z);
24868          long double complex ccosl(long double complex z);
24869          double complex csin(double complex z);
24870          float complex csinf(float complex z);
24871          long double complex csinl(long double complex z);
24872          double complex ctan(double complex z);
24873          float complex ctanf(float complex z);
24874          long double complex ctanl(long double complex z);
24875          double complex cacosh(double complex z);
24876          float complex cacoshf(float complex z);
24877          long double complex cacoshl(long double complex z);
24878          double complex casinh(double complex z);
24879          float complex casinhf(float complex z);
24880          long double complex casinhl(long double complex z);
24881        double complex catanh(double complex z);
24882        float complex catanhf(float complex z);
24883        long double complex catanhl(long double complex z);
24884        double complex ccosh(double complex z);
24885        float complex ccoshf(float complex z);
24886        long double complex ccoshl(long double complex z);
24887        double complex csinh(double complex z);
24888        float complex csinhf(float complex z);
24889        long double complex csinhl(long double complex z);
24890        double complex ctanh(double complex z);
24891        float complex ctanhf(float complex z);
24892        long double complex ctanhl(long double complex z);
24893        double complex cexp(double complex z);
24894        float complex cexpf(float complex z);
24895        long double complex cexpl(long double complex z);
24896        double complex clog(double complex z);
24897        float complex clogf(float complex z);
24898        long double complex clogl(long double complex z);
24899        double cabs(double complex z);
24900        float cabsf(float complex z);
24901        long double cabsl(long double complex z);
24902        double complex cpow(double complex x, double complex y);
24903        float complex cpowf(float complex x, float complex y);
24904        long double complex cpowl(long double complex x,
24905             long double complex y);
24906        double complex csqrt(double complex z);
24907        float complex csqrtf(float complex z);
24908        long double complex csqrtl(long double complex z);
24909        double carg(double complex z);
24910        float cargf(float complex z);
24911        long double cargl(long double complex z);
24912        double cimag(double complex z);
24913        float cimagf(float complex z);
24914        long double cimagl(long double complex z);
24915        double complex CMPLX(double x, double y);
24916        float complex CMPLXF(float x, float y);
24917        long double complex CMPLXL(long double x, long double y);
24918        double complex conj(double complex z);
24919        float complex conjf(float complex z);
24920        long double complex conjl(long double complex z);
24921        double complex cproj(double complex z);
24922          float complex cprojf(float complex z);
24923          long double complex cprojl(long double complex z);
24924          double creal(double complex z);
24925          float crealf(float complex z);
24926          long double creall(long double complex z);
24927 </pre>
24928
24929 <p><small><a href="#Contents">Contents</a></small>
24930 <h3><a name="B.3" href="#B.3">B.3 Character handling &lt;ctype.h&gt;</a></h3>
24931 <pre>
24932          int   isalnum(int c);
24933          int   isalpha(int c);
24934          int   isblank(int c);
24935          int   iscntrl(int c);
24936          int   isdigit(int c);
24937          int   isgraph(int c);
24938          int   islower(int c);
24939          int   isprint(int c);
24940          int   ispunct(int c);
24941          int   isspace(int c);
24942          int   isupper(int c);
24943          int   isxdigit(int c);
24944          int   tolower(int c);
24945          int   toupper(int c);
24946 </pre>
24947
24948 <p><small><a href="#Contents">Contents</a></small>
24949 <h3><a name="B.4" href="#B.4">B.4 Errors &lt;errno.h&gt;</a></h3>
24950 <pre>
24951          EDOM           EILSEQ             ERANGE          errno
24952          __STDC_WANT_LIB_EXT1__
24953          errno_t
24954 </pre>
24955
24956 <p><small><a href="#Contents">Contents</a></small>
24957 <h3><a name="B.5" href="#B.5">B.5 Floating-point environment &lt;fenv.h&gt;</a></h3>
24958 <!--page 496 -->
24959 <pre>
24960          fenv_t               FE_OVERFLOW              FE_TOWARDZERO
24961          fexcept_t            FE_UNDERFLOW             FE_UPWARD
24962          FE_DIVBYZERO         FE_ALL_EXCEPT            FE_DFL_ENV
24963          FE_INEXACT           FE_DOWNWARD
24964          FE_INVALID           FE_TONEAREST
24965          #pragma STDC FENV_ACCESS on-off-switch
24966          int feclearexcept(int excepts);
24967          int fegetexceptflag(fexcept_t *flagp, int excepts);
24968          int feraiseexcept(int excepts);
24969          int fesetexceptflag(const fexcept_t *flagp,
24970               int excepts);
24971          int fetestexcept(int excepts);
24972        int   fegetround(void);
24973        int   fesetround(int round);
24974        int   fegetenv(fenv_t *envp);
24975        int   feholdexcept(fenv_t *envp);
24976        int   fesetenv(const fenv_t *envp);
24977        int   feupdateenv(const fenv_t *envp);
24978 </pre>
24979
24980 <p><small><a href="#Contents">Contents</a></small>
24981 <h3><a name="B.6" href="#B.6">B.6 Characteristics of floating types &lt;float.h&gt;</a></h3>
24982 <pre>
24983        FLT_ROUNDS             DBL_DIG                  FLT_MAX
24984        FLT_EVAL_METHOD        LDBL_DIG                 DBL_MAX
24985        FLT_HAS_SUBNORM        FLT_MIN_EXP              LDBL_MAX
24986        DBL_HAS_SUBNORM        DBL_MIN_EXP              FLT_EPSILON
24987        LDBL_HAS_SUBNORM       LDBL_MIN_EXP             DBL_EPSILON
24988        FLT_RADIX              FLT_MIN_10_EXP           LDBL_EPSILON
24989        FLT_MANT_DIG           DBL_MIN_10_EXP           FLT_MIN
24990        DBL_MANT_DIG           LDBL_MIN_10_EXP          DBL_MIN
24991        LDBL_MANT_DIG          FLT_MAX_EXP              LDBL_MIN
24992        FLT_DECIMAL_DIG        DBL_MAX_EXP              FLT_TRUE_MIN
24993        DBL_DECIMAL_DIG        LDBL_MAX_EXP             DBL_TRUE_MIN
24994        LDBL_DECIMAL_DIG       FLT_MAX_10_EXP           LDBL_TRUE_MIN
24995        DECIMAL_DIG            DBL_MAX_10_EXP
24996        FLT_DIG                LDBL_MAX_10_EXP
24997 </pre>
24998
24999 <p><small><a href="#Contents">Contents</a></small>
25000 <h3><a name="B.7" href="#B.7">B.7 Format conversion of integer types &lt;inttypes.h&gt;</a></h3>
25001 <!--page 497 -->
25002 <pre>
25003        imaxdiv_t
25004        PRIdN         PRIdLEASTN       PRIdFASTN            PRIdMAX   PRIdPTR
25005        PRIiN         PRIiLEASTN       PRIiFASTN            PRIiMAX   PRIiPTR
25006        PRIoN         PRIoLEASTN       PRIoFASTN            PRIoMAX   PRIoPTR
25007        PRIuN         PRIuLEASTN       PRIuFASTN            PRIuMAX   PRIuPTR
25008        PRIxN         PRIxLEASTN       PRIxFASTN            PRIxMAX   PRIxPTR
25009        PRIXN         PRIXLEASTN       PRIXFASTN            PRIXMAX   PRIXPTR
25010        SCNdN         SCNdLEASTN       SCNdFASTN            SCNdMAX   SCNdPTR
25011        SCNiN         SCNiLEASTN       SCNiFASTN            SCNiMAX   SCNiPTR
25012        SCNoN         SCNoLEASTN       SCNoFASTN            SCNoMAX   SCNoPTR
25013        SCNuN         SCNuLEASTN       SCNuFASTN            SCNuMAX   SCNuPTR
25014        SCNxN         SCNxLEASTN       SCNxFASTN            SCNxMAX   SCNxPTR
25015        intmax_t imaxabs(intmax_t j);
25016        imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
25017        intmax_t strtoimax(const char * restrict nptr,
25018                char ** restrict endptr, int base);
25019          uintmax_t strtoumax(const char * restrict nptr,
25020                  char ** restrict endptr, int base);
25021          intmax_t wcstoimax(const wchar_t * restrict nptr,
25022                  wchar_t ** restrict endptr, int base);
25023          uintmax_t wcstoumax(const wchar_t * restrict nptr,
25024                  wchar_t ** restrict endptr, int base);
25025 </pre>
25026
25027 <p><small><a href="#Contents">Contents</a></small>
25028 <h3><a name="B.8" href="#B.8">B.8 Alternative spellings &lt;iso646.h&gt;</a></h3>
25029 <pre>
25030          and            bitor              not_eq          xor
25031          and_eq         compl              or              xor_eq
25032          bitand         not                or_eq
25033 </pre>
25034
25035 <p><small><a href="#Contents">Contents</a></small>
25036 <h3><a name="B.9" href="#B.9">B.9 Sizes of integer types &lt;limits.h&gt;</a></h3>
25037 <pre>
25038          CHAR_BIT       CHAR_MAX           INT_MIN         ULONG_MAX
25039          SCHAR_MIN      MB_LEN_MAX         INT_MAX         LLONG_MIN
25040          SCHAR_MAX      SHRT_MIN           UINT_MAX        LLONG_MAX
25041          UCHAR_MAX      SHRT_MAX           LONG_MIN        ULLONG_MAX
25042          CHAR_MIN       USHRT_MAX          LONG_MAX
25043 </pre>
25044
25045 <p><small><a href="#Contents">Contents</a></small>
25046 <h3><a name="B.10" href="#B.10">B.10 Localization &lt;locale.h&gt;</a></h3>
25047 <pre>
25048          struct lconv   LC_ALL             LC_CTYPE        LC_NUMERIC
25049          NULL           LC_COLLATE         LC_MONETARY     LC_TIME
25050          char *setlocale(int category, const char *locale);
25051          struct lconv *localeconv(void);
25052 </pre>
25053
25054 <p><small><a href="#Contents">Contents</a></small>
25055 <h3><a name="B.11" href="#B.11">B.11 Mathematics &lt;math.h&gt;</a></h3>
25056 <!--page 498 -->
25057 <!--page 499 -->
25058 <!--page 500 -->
25059 <!--page 501 -->
25060 <!--page 502 -->
25061 <pre>
25062          float_t              FP_INFINITE              FP_FAST_FMAL
25063          double_t             FP_NAN                   FP_ILOGB0
25064          HUGE_VAL             FP_NORMAL                FP_ILOGBNAN
25065          HUGE_VALF            FP_SUBNORMAL             MATH_ERRNO
25066          HUGE_VALL            FP_ZERO                  MATH_ERREXCEPT
25067          INFINITY             FP_FAST_FMA              math_errhandling
25068          NAN                  FP_FAST_FMAF
25069          #pragma STDC FP_CONTRACT on-off-switch
25070          int fpclassify(real-floating x);
25071          int isfinite(real-floating x);
25072          int isinf(real-floating x);
25073          int isnan(real-floating x);
25074          int isnormal(real-floating x);
25075          int signbit(real-floating x);
25076        double acos(double x);
25077        float acosf(float x);
25078        long double acosl(long double x);
25079        double asin(double x);
25080        float asinf(float x);
25081        long double asinl(long double x);
25082        double atan(double x);
25083        float atanf(float x);
25084        long double atanl(long double x);
25085        double atan2(double y, double x);
25086        float atan2f(float y, float x);
25087        long double atan2l(long double y, long double x);
25088        double cos(double x);
25089        float cosf(float x);
25090        long double cosl(long double x);
25091        double sin(double x);
25092        float sinf(float x);
25093        long double sinl(long double x);
25094        double tan(double x);
25095        float tanf(float x);
25096        long double tanl(long double x);
25097        double acosh(double x);
25098        float acoshf(float x);
25099        long double acoshl(long double x);
25100        double asinh(double x);
25101        float asinhf(float x);
25102        long double asinhl(long double x);
25103        double atanh(double x);
25104        float atanhf(float x);
25105        long double atanhl(long double x);
25106        double cosh(double x);
25107        float coshf(float x);
25108        long double coshl(long double x);
25109        double sinh(double x);
25110        float sinhf(float x);
25111        long double sinhl(long double x);
25112        double tanh(double x);
25113        float tanhf(float x);
25114        long double tanhl(long double x);
25115        double exp(double x);
25116        float expf(float x);
25117          long double expl(long double x);
25118          double exp2(double x);
25119          float exp2f(float x);
25120          long double exp2l(long double x);
25121          double expm1(double x);
25122          float expm1f(float x);
25123          long double expm1l(long double x);
25124          double frexp(double value, int *exp);
25125          float frexpf(float value, int *exp);
25126          long double frexpl(long double value, int *exp);
25127          int ilogb(double x);
25128          int ilogbf(float x);
25129          int ilogbl(long double x);
25130          double ldexp(double x, int exp);
25131          float ldexpf(float x, int exp);
25132          long double ldexpl(long double x, int exp);
25133          double log(double x);
25134          float logf(float x);
25135          long double logl(long double x);
25136          double log10(double x);
25137          float log10f(float x);
25138          long double log10l(long double x);
25139          double log1p(double x);
25140          float log1pf(float x);
25141          long double log1pl(long double x);
25142          double log2(double x);
25143          float log2f(float x);
25144          long double log2l(long double x);
25145          double logb(double x);
25146          float logbf(float x);
25147          long double logbl(long double x);
25148          double modf(double value, double *iptr);
25149          float modff(float value, float *iptr);
25150          long double modfl(long double value, long double *iptr);
25151          double scalbn(double x, int n);
25152          float scalbnf(float x, int n);
25153          long double scalbnl(long double x, int n);
25154          double scalbln(double x, long int n);
25155          float scalblnf(float x, long int n);
25156          long double scalblnl(long double x, long int n);
25157          double cbrt(double x);
25158        float cbrtf(float x);
25159        long double cbrtl(long double x);
25160        double fabs(double x);
25161        float fabsf(float x);
25162        long double fabsl(long double x);
25163        double hypot(double x, double y);
25164        float hypotf(float x, float y);
25165        long double hypotl(long double x, long double y);
25166        double pow(double x, double y);
25167        float powf(float x, float y);
25168        long double powl(long double x, long double y);
25169        double sqrt(double x);
25170        float sqrtf(float x);
25171        long double sqrtl(long double x);
25172        double erf(double x);
25173        float erff(float x);
25174        long double erfl(long double x);
25175        double erfc(double x);
25176        float erfcf(float x);
25177        long double erfcl(long double x);
25178        double lgamma(double x);
25179        float lgammaf(float x);
25180        long double lgammal(long double x);
25181        double tgamma(double x);
25182        float tgammaf(float x);
25183        long double tgammal(long double x);
25184        double ceil(double x);
25185        float ceilf(float x);
25186        long double ceill(long double x);
25187        double floor(double x);
25188        float floorf(float x);
25189        long double floorl(long double x);
25190        double nearbyint(double x);
25191        float nearbyintf(float x);
25192        long double nearbyintl(long double x);
25193        double rint(double x);
25194        float rintf(float x);
25195        long double rintl(long double x);
25196        long int lrint(double x);
25197        long int lrintf(float x);
25198        long int lrintl(long double x);
25199          long long int llrint(double x);
25200          long long int llrintf(float x);
25201          long long int llrintl(long double x);
25202          double round(double x);
25203          float roundf(float x);
25204          long double roundl(long double x);
25205          long int lround(double x);
25206          long int lroundf(float x);
25207          long int lroundl(long double x);
25208          long long int llround(double x);
25209          long long int llroundf(float x);
25210          long long int llroundl(long double x);
25211          double trunc(double x);
25212          float truncf(float x);
25213          long double truncl(long double x);
25214          double fmod(double x, double y);
25215          float fmodf(float x, float y);
25216          long double fmodl(long double x, long double y);
25217          double remainder(double x, double y);
25218          float remainderf(float x, float y);
25219          long double remainderl(long double x, long double y);
25220          double remquo(double x, double y, int *quo);
25221          float remquof(float x, float y, int *quo);
25222          long double remquol(long double x, long double y,
25223               int *quo);
25224          double copysign(double x, double y);
25225          float copysignf(float x, float y);
25226          long double copysignl(long double x, long double y);
25227          double nan(const char *tagp);
25228          float nanf(const char *tagp);
25229          long double nanl(const char *tagp);
25230          double nextafter(double x, double y);
25231          float nextafterf(float x, float y);
25232          long double nextafterl(long double x, long double y);
25233          double nexttoward(double x, long double y);
25234          float nexttowardf(float x, long double y);
25235          long double nexttowardl(long double x, long double y);
25236          double fdim(double x, double y);
25237          float fdimf(float x, float y);
25238          long double fdiml(long double x, long double y);
25239          double fmax(double x, double y);
25240        float fmaxf(float x, float y);
25241        long double fmaxl(long double x, long double y);
25242        double fmin(double x, double y);
25243        float fminf(float x, float y);
25244        long double fminl(long double x, long double y);
25245        double fma(double x, double y, double z);
25246        float fmaf(float x, float y, float z);
25247        long double fmal(long double x, long double y,
25248             long double z);
25249        int isgreater(real-floating x, real-floating y);
25250        int isgreaterequal(real-floating x, real-floating y);
25251        int isless(real-floating x, real-floating y);
25252        int islessequal(real-floating x, real-floating y);
25253        int islessgreater(real-floating x, real-floating y);
25254        int isunordered(real-floating x, real-floating y);
25255 </pre>
25256
25257 <p><small><a href="#Contents">Contents</a></small>
25258 <h3><a name="B.12" href="#B.12">B.12 Nonlocal jumps &lt;setjmp.h&gt;</a></h3>
25259 <pre>
25260        jmp_buf
25261        int setjmp(jmp_buf env);
25262        _Noreturn void longjmp(jmp_buf env, int val);
25263 </pre>
25264
25265 <p><small><a href="#Contents">Contents</a></small>
25266 <h3><a name="B.13" href="#B.13">B.13 Signal handling &lt;signal.h&gt;</a></h3>
25267 <!--page 503 -->
25268 <pre>
25269        sig_atomic_t   SIG_IGN            SIGILL          SIGTERM
25270        SIG_DFL        SIGABRT            SIGINT
25271        SIG_ERR        SIGFPE             SIGSEGV
25272        void (*signal(int sig, void (*func)(int)))(int);
25273        int raise(int sig);
25274 </pre>
25275
25276 <p><small><a href="#Contents">Contents</a></small>
25277 <h3><a name="B.14" href="#B.14">B.14 Alignment &lt;stdalign.h&gt;</a></h3>
25278 <pre>
25279          alignas
25280          __alignas_is_defined
25281 </pre>
25282
25283 <p><small><a href="#Contents">Contents</a></small>
25284 <h3><a name="B.15" href="#B.15">B.15 Variable arguments &lt;stdarg.h&gt;</a></h3>
25285 <pre>
25286          va_list
25287          type va_arg(va_list ap, type);
25288          void va_copy(va_list dest, va_list src);
25289          void va_end(va_list ap);
25290          void va_start(va_list ap, parmN);
25291 </pre>
25292
25293 <p><small><a href="#Contents">Contents</a></small>
25294 <h3><a name="B.16" href="#B.16">B.16 Atomics &lt;stdatomic.h&gt;</a></h3>
25295 <!--page 504 -->
25296 <!--page 505 -->
25297 <pre>
25298          ATOMIC_BOOL_LOCK_FREE       atomic_uint
25299          ATOMIC_CHAR_LOCK_FREE       atomic_long
25300          ATOMIC_CHAR16_T_LOCK_FREE   atomic_ulong
25301          ATOMIC_CHAR32_T_LOCK_FREE   atomic_llong
25302          ATOMIC_WCHAR_T_LOCK_FREE    atomic_ullong
25303          ATOMIC_SHORT_LOCK_FREE      atomic_char16_t
25304          ATOMIC_INT_LOCK_FREE        atomic_char32_t
25305          ATOMIC_LONG_LOCK_FREE       atomic_wchar_t
25306          ATOMIC_LLONG_LOCK_FREE      atomic_int_least8_t
25307          ATOMIC_POINTER_LOCK_FREE    atomic_uint_least8_t
25308          ATOMIC_FLAG_INIT            atomic_int_least16_t
25309          memory_order                atomic_uint_least16_t
25310          atomic_flag                 atomic_int_least32_t
25311          memory_order_relaxed      * atomic_uint_least32_t
25312          memory_order_consume        atomic_int_least64_t
25313          memory_order_acquire        atomic_uint_least64_t
25314          memory_order_release        atomic_int_fast8_t
25315          memory_order_acq_rel        atomic_uint_fast8_t
25316          memory_order_seq_cst        atomic_int_fast16_t
25317          atomic_bool                 atomic_uint_fast16_t
25318          atomic_char                 atomic_int_fast32_t
25319          atomic_schar                atomic_uint_fast32_t
25320          atomic_uchar                atomic_int_fast64_t
25321          atomic_short                atomic_uint_fast64_t
25322          atomic_ushort               atomic_intptr_t
25323          atomic_int                  atomic_uintptr_t
25324        atomic_size_t                    atomic_intmax_t
25325        atomic_ptrdiff_t                 atomic_uintmax_t
25326        #define ATOMIC_VAR_INIT(C value)
25327        void atomic_init(volatile A *obj, C value);
25328        type kill_dependency(type y);
25329        void atomic_thread_fence(memory_order order);
25330        void atomic_signal_fence(memory_order order);
25331        _Bool atomic_is_lock_free(const volatile A *obj);
25332        void atomic_store(volatile A *object, C desired);
25333        void atomic_store_explicit(volatile A *object,
25334              C desired, memory_order order);
25335        C atomic_load(volatile A *object);
25336        C atomic_load_explicit(volatile A *object,
25337              memory_order order);
25338        C atomic_exchange(volatile A *object, C desired);
25339        C atomic_exchange_explicit(volatile A *object,
25340              C desired, memory_order order);
25341        _Bool atomic_compare_exchange_strong(volatile A *object,
25342              C *expected, C desired);
25343        _Bool atomic_compare_exchange_strong_explicit(
25344              volatile A *object, C *expected, C desired,
25345              memory_order success, memory_order failure);
25346        _Bool atomic_compare_exchange_weak(volatile A *object,
25347              C *expected, C desired);
25348        _Bool atomic_compare_exchange_weak_explicit(
25349              volatile A *object, C *expected, C desired,
25350              memory_order success, memory_order failure);
25351        C atomic_fetch_key(volatile A *object, M operand);
25352        C atomic_fetch_key_explicit(volatile A *object,
25353              M operand, memory_order order);
25354        _Bool atomic_flag_test_and_set(
25355              volatile atomic_flag *object);
25356        _Bool atomic_flag_test_and_set_explicit(
25357              volatile atomic_flag *object, memory_order order);
25358        void atomic_flag_clear(volatile atomic_flag *object);
25359        void atomic_flag_clear_explicit(
25360              volatile atomic_flag *object, memory_order order);
25361 </pre>
25362
25363 <p><small><a href="#Contents">Contents</a></small>
25364 <h3><a name="B.17" href="#B.17">B.17 Boolean type and values &lt;stdbool.h&gt;</a></h3>
25365 <pre>
25366          bool
25367          true
25368          false
25369          __bool_true_false_are_defined
25370 </pre>
25371
25372 <p><small><a href="#Contents">Contents</a></small>
25373 <h3><a name="B.18" href="#B.18">B.18 Common definitions &lt;stddef.h&gt;</a></h3>
25374 <pre>
25375          ptrdiff_t       max_align_t        NULL
25376          size_t          wchar_t
25377          offsetof(type, member-designator)
25378          __STDC_WANT_LIB_EXT1__
25379          rsize_t
25380 </pre>
25381
25382 <p><small><a href="#Contents">Contents</a></small>
25383 <h3><a name="B.19" href="#B.19">B.19 Integer types &lt;stdint.h&gt;</a></h3>
25384 <!--page 506 -->
25385 <pre>
25386          intN_t                INT_LEASTN_MIN           PTRDIFF_MAX
25387          uintN_t               INT_LEASTN_MAX           SIG_ATOMIC_MIN
25388          int_leastN_t          UINT_LEASTN_MAX          SIG_ATOMIC_MAX
25389          uint_leastN_t         INT_FASTN_MIN            SIZE_MAX
25390          int_fastN_t           INT_FASTN_MAX            WCHAR_MIN
25391          uint_fastN_t          UINT_FASTN_MAX           WCHAR_MAX
25392          intptr_t              INTPTR_MIN               WINT_MIN
25393          uintptr_t             INTPTR_MAX               WINT_MAX
25394          intmax_t              UINTPTR_MAX              INTN_C(value)
25395          uintmax_t             INTMAX_MIN               UINTN_C(value)
25396          INTN_MIN              INTMAX_MAX               INTMAX_C(value)
25397          INTN_MAX              UINTMAX_MAX              UINTMAX_C(value)
25398          UINTN_MAX             PTRDIFF_MIN
25399          __STDC_WANT_LIB_EXT1__
25400          RSIZE_MAX
25401 </pre>
25402
25403 <p><small><a href="#Contents">Contents</a></small>
25404 <h3><a name="B.20" href="#B.20">B.20 Input/output &lt;stdio.h&gt;</a></h3>
25405 <!--page 507 -->
25406 <!--page 508 -->
25407 <!--page 509 -->
25408 <pre>
25409        size_t        _IOLBF             FILENAME_MAX    TMP_MAX
25410        FILE          _IONBF             L_tmpnam        stderr
25411        fpos_t        BUFSIZ             SEEK_CUR        stdin
25412        NULL          EOF                SEEK_END        stdout
25413        _IOFBF        FOPEN_MAX          SEEK_SET
25414        int remove(const char *filename);
25415        int rename(const char *old, const char *new);
25416        FILE *tmpfile(void);
25417        char *tmpnam(char *s);
25418        int fclose(FILE *stream);
25419        int fflush(FILE *stream);
25420        FILE *fopen(const char * restrict filename,
25421             const char * restrict mode);
25422        FILE *freopen(const char * restrict filename,
25423             const char * restrict mode,
25424             FILE * restrict stream);
25425        void setbuf(FILE * restrict stream,
25426             char * restrict buf);
25427        int setvbuf(FILE * restrict stream,
25428             char * restrict buf,
25429             int mode, size_t size);
25430        int fprintf(FILE * restrict stream,
25431             const char * restrict format, ...);
25432        int fscanf(FILE * restrict stream,
25433             const char * restrict format, ...);
25434        int printf(const char * restrict format, ...);
25435        int scanf(const char * restrict format, ...);
25436        int snprintf(char * restrict s, size_t n,
25437             const char * restrict format, ...);
25438        int sprintf(char * restrict s,
25439             const char * restrict format, ...);
25440        int sscanf(const char * restrict s,
25441             const char * restrict format, ...);
25442        int vfprintf(FILE * restrict stream,
25443             const char * restrict format, va_list arg);
25444        int vfscanf(FILE * restrict stream,
25445             const char * restrict format, va_list arg);
25446        int vprintf(const char * restrict format, va_list arg);
25447        int vscanf(const char * restrict format, va_list arg);
25448          int vsnprintf(char * restrict s, size_t n,
25449               const char * restrict format, va_list arg);
25450          int vsprintf(char * restrict s,
25451               const char * restrict format, va_list arg);
25452          int vsscanf(const char * restrict s,
25453               const char * restrict format, va_list arg);
25454          int fgetc(FILE *stream);
25455          char *fgets(char * restrict s, int n,
25456               FILE * restrict stream);
25457          int fputc(int c, FILE *stream);
25458          int fputs(const char * restrict s,
25459               FILE * restrict stream);
25460          int getc(FILE *stream);
25461          int getchar(void);
25462          int putc(int c, FILE *stream);
25463          int putchar(int c);
25464          int puts(const char *s);
25465          int ungetc(int c, FILE *stream);
25466          size_t fread(void * restrict ptr,
25467               size_t size, size_t nmemb,
25468               FILE * restrict stream);
25469          size_t fwrite(const void * restrict ptr,
25470               size_t size, size_t nmemb,
25471               FILE * restrict stream);
25472          int fgetpos(FILE * restrict stream,
25473               fpos_t * restrict pos);
25474          int fseek(FILE *stream, long int offset, int whence);
25475          int fsetpos(FILE *stream, const fpos_t *pos);
25476          long int ftell(FILE *stream);
25477          void rewind(FILE *stream);
25478          void clearerr(FILE *stream);
25479          int feof(FILE *stream);
25480          int ferror(FILE *stream);
25481          void perror(const char *s);
25482          __STDC_WANT_LIB_EXT1__
25483          L_tmpnam_s    TMP_MAX_S         errno_t         rsize_t
25484          errno_t tmpfile_s(FILE * restrict * restrict streamptr);
25485          errno_t tmpnam_s(char *s, rsize_t maxsize);
25486        errno_t fopen_s(FILE * restrict * restrict streamptr,
25487             const char * restrict filename,
25488             const char * restrict mode);
25489        errno_t freopen_s(FILE * restrict * restrict newstreamptr,
25490             const char * restrict filename,
25491             const char * restrict mode,
25492             FILE * restrict stream);
25493        int fprintf_s(FILE * restrict stream,
25494             const char * restrict format, ...);
25495        int fscanf_s(FILE * restrict stream,
25496             const char * restrict format, ...);
25497        int printf_s(const char * restrict format, ...);
25498        int scanf_s(const char * restrict format, ...);
25499        int snprintf_s(char * restrict s, rsize_t n,
25500             const char * restrict format, ...);
25501        int sprintf_s(char * restrict s, rsize_t n,
25502             const char * restrict format, ...);
25503        int sscanf_s(const char * restrict s,
25504             const char * restrict format, ...);
25505        int vfprintf_s(FILE * restrict stream,
25506             const char * restrict format,
25507             va_list arg);
25508        int vfscanf_s(FILE * restrict stream,
25509             const char * restrict format,
25510             va_list arg);
25511        int vprintf_s(const char * restrict format,
25512             va_list arg);
25513        int vscanf_s(const char * restrict format,
25514             va_list arg);
25515        int vsnprintf_s(char * restrict s, rsize_t n,
25516             const char * restrict format,
25517             va_list arg);
25518        int vsprintf_s(char * restrict s, rsize_t n,
25519             const char * restrict format,
25520             va_list arg);
25521        int vsscanf_s(const char * restrict s,
25522             const char * restrict format,
25523             va_list arg);
25524        char *gets_s(char *s, rsize_t n);
25525 </pre>
25526
25527 <p><small><a href="#Contents">Contents</a></small>
25528 <h3><a name="B.21" href="#B.21">B.21 General utilities &lt;stdlib.h&gt;</a></h3>
25529 <!--page 510 -->
25530 <!--page 511 -->
25531 <pre>
25532          size_t       ldiv_t             EXIT_FAILURE    MB_CUR_MAX
25533          wchar_t      lldiv_t            EXIT_SUCCESS
25534          div_t        NULL               RAND_MAX
25535          double atof(const char *nptr);
25536          int atoi(const char *nptr);
25537          long int atol(const char *nptr);
25538          long long int atoll(const char *nptr);
25539          double strtod(const char * restrict nptr,
25540               char ** restrict endptr);
25541          float strtof(const char * restrict nptr,
25542               char ** restrict endptr);
25543          long double strtold(const char * restrict nptr,
25544               char ** restrict endptr);
25545          long int strtol(const char * restrict nptr,
25546               char ** restrict endptr, int base);
25547          long long int strtoll(const char * restrict nptr,
25548               char ** restrict endptr, int base);
25549          unsigned long int strtoul(
25550               const char * restrict nptr,
25551               char ** restrict endptr, int base);
25552          unsigned long long int strtoull(
25553               const char * restrict nptr,
25554               char ** restrict endptr, int base);
25555          int rand(void);
25556          void srand(unsigned int seed);
25557          void *aligned_alloc(size_t alignment, size_t size);
25558          void *calloc(size_t nmemb, size_t size);
25559          void free(void *ptr);
25560          void *malloc(size_t size);
25561          void *realloc(void *ptr, size_t size);
25562          _Noreturn void abort(void);
25563          int atexit(void (*func)(void));
25564          int at_quick_exit(void (*func)(void));
25565          _Noreturn void exit(int status);
25566          _Noreturn void _Exit(int status);
25567          char *getenv(const char *name);
25568          _Noreturn void quick_exit(int status);
25569          int system(const char *string);
25570        void *bsearch(const void *key, const void *base,
25571             size_t nmemb, size_t size,
25572             int (*compar)(const void *, const void *));
25573        void qsort(void *base, size_t nmemb, size_t size,
25574             int (*compar)(const void *, const void *));
25575        int abs(int j);
25576        long int labs(long int j);
25577        long long int llabs(long long int j);
25578        div_t div(int numer, int denom);
25579        ldiv_t ldiv(long int numer, long int denom);
25580        lldiv_t lldiv(long long int numer,
25581             long long int denom);
25582        int mblen(const char *s, size_t n);
25583        int mbtowc(wchar_t * restrict pwc,
25584             const char * restrict s, size_t n);
25585        int wctomb(char *s, wchar_t wchar);
25586        size_t mbstowcs(wchar_t * restrict pwcs,
25587             const char * restrict s, size_t n);
25588        size_t wcstombs(char * restrict s,
25589             const wchar_t * restrict pwcs, size_t n);
25590        __STDC_WANT_LIB_EXT1__
25591        errno_t
25592        rsize_t
25593        constraint_handler_t
25594        constraint_handler_t set_constraint_handler_s(
25595             constraint_handler_t handler);
25596        void abort_handler_s(
25597             const char * restrict msg,
25598             void * restrict ptr,
25599             errno_t error);
25600        void ignore_handler_s(
25601             const char * restrict msg,
25602             void * restrict ptr,
25603             errno_t error);
25604        errno_t getenv_s(size_t * restrict len,
25605                  char * restrict value, rsize_t maxsize,
25606                  const char * restrict name);
25607          void *bsearch_s(const void *key, const void *base,
25608               rsize_t nmemb, rsize_t size,
25609               int (*compar)(const void *k, const void *y,
25610                               void *context),
25611               void *context);
25612          errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
25613               int (*compar)(const void *x, const void *y,
25614                               void *context),
25615               void *context);
25616          errno_t wctomb_s(int * restrict status,
25617               char * restrict s,
25618               rsize_t smax,
25619               wchar_t wc);
25620          errno_t mbstowcs_s(size_t * restrict retval,
25621               wchar_t * restrict dst, rsize_t dstmax,
25622               const char * restrict src, rsize_t len);
25623          errno_t wcstombs_s(size_t * restrict retval,
25624               char * restrict dst, rsize_t dstmax,
25625               const wchar_t * restrict src, rsize_t len);
25626 </pre>
25627
25628 <p><small><a href="#Contents">Contents</a></small>
25629 <h3><a name="B.22" href="#B.22">B.22 _Noreturn &lt;stdnoreturn.h&gt;</a></h3>
25630 <pre>
25631          noreturn
25632 </pre>
25633
25634 <p><small><a href="#Contents">Contents</a></small>
25635 <h3><a name="B.23" href="#B.23">B.23 String handling &lt;string.h&gt;</a></h3>
25636 <!--page 512 -->
25637 <!--page 513 -->
25638 <pre>
25639          size_t
25640          NULL
25641        void *memcpy(void * restrict s1,
25642             const void * restrict s2, size_t n);
25643        void *memmove(void *s1, const void *s2, size_t n);
25644        char *strcpy(char * restrict s1,
25645             const char * restrict s2);
25646        char *strncpy(char * restrict s1,
25647             const char * restrict s2, size_t n);
25648        char *strcat(char * restrict s1,
25649             const char * restrict s2);
25650        char *strncat(char * restrict s1,
25651             const char * restrict s2, size_t n);
25652        int memcmp(const void *s1, const void *s2, size_t n);
25653        int strcmp(const char *s1, const char *s2);
25654        int strcoll(const char *s1, const char *s2);
25655        int strncmp(const char *s1, const char *s2, size_t n);
25656        size_t strxfrm(char * restrict s1,
25657             const char * restrict s2, size_t n);
25658        void *memchr(const void *s, int c, size_t n);
25659        char *strchr(const char *s, int c);
25660        size_t strcspn(const char *s1, const char *s2);
25661        char *strpbrk(const char *s1, const char *s2);
25662        char *strrchr(const char *s, int c);
25663        size_t strspn(const char *s1, const char *s2);
25664        char *strstr(const char *s1, const char *s2);
25665        char *strtok(char * restrict s1,
25666             const char * restrict s2);
25667        void *memset(void *s, int c, size_t n);
25668        char *strerror(int errnum);
25669        size_t strlen(const char *s);
25670        __STDC_WANT_LIB_EXT1__
25671        errno_t
25672        rsize_t
25673        errno_t memcpy_s(void * restrict s1, rsize_t s1max,
25674             const void * restrict s2, rsize_t n);
25675        errno_t memmove_s(void *s1, rsize_t s1max,
25676             const void *s2, rsize_t n);
25677        errno_t strcpy_s(char * restrict s1,
25678             rsize_t s1max,
25679             const char * restrict s2);
25680        errno_t strncpy_s(char * restrict s1,
25681             rsize_t s1max,
25682             const char * restrict s2,
25683             rsize_t n);
25684        errno_t strcat_s(char * restrict s1,
25685             rsize_t s1max,
25686             const char * restrict s2);
25687        errno_t strncat_s(char * restrict s1,
25688             rsize_t s1max,
25689             const char * restrict s2,
25690             rsize_t n);
25691        char *strtok_s(char * restrict s1,
25692             rsize_t * restrict s1max,
25693             const char * restrict s2,
25694             char ** restrict ptr);
25695        errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
25696          errno_t strerror_s(char *s, rsize_t maxsize,
25697               errno_t errnum);
25698          size_t strerrorlen_s(errno_t errnum);
25699          size_t strnlen_s(const char *s, size_t maxsize);
25700 </pre>
25701
25702 <p><small><a href="#Contents">Contents</a></small>
25703 <h3><a name="B.24" href="#B.24">B.24 Type-generic math &lt;tgmath.h&gt;</a></h3>
25704 <pre>
25705          acos         sqrt               fmod            nextafter
25706          asin         fabs               frexp           nexttoward
25707          atan         atan2              hypot           remainder
25708          acosh        cbrt               ilogb           remquo
25709          asinh        ceil               ldexp           rint
25710          atanh        copysign           lgamma          round
25711          cos          erf                llrint          scalbn
25712          sin          erfc               llround         scalbln
25713          tan          exp2               log10           tgamma
25714          cosh         expm1              log1p           trunc
25715          sinh         fdim               log2            carg
25716          tanh         floor              logb            cimag
25717          exp          fma                lrint           conj
25718          log          fmax               lround          cproj
25719          pow          fmin               nearbyint       creal
25720 </pre>
25721
25722 <p><small><a href="#Contents">Contents</a></small>
25723 <h3><a name="B.25" href="#B.25">B.25 Threads &lt;threads.h&gt;</a></h3>
25724 <!--page 514 -->
25725 <pre>
25726          thread_local                    once_flag
25727          ONCE_FLAG_INIT                  mtx_plain                     *
25728          TSS_DTOR_ITERATIONS             mtx_recursive
25729          cnd_t                           mtx_timed
25730          thrd_t                          thrd_timedout
25731          tss_t                           thrd_success
25732          mtx_t                           thrd_busy
25733          tss_dtor_t                      thrd_error
25734          thrd_start_t                    thrd_nomem
25735        void call_once(once_flag *flag, void (*func)(void));
25736        int cnd_broadcast(cnd_t *cond);
25737        void cnd_destroy(cnd_t *cond);
25738        int cnd_init(cnd_t *cond);
25739        int cnd_signal(cnd_t *cond);
25740        int cnd_timedwait(cnd_t *restrict cond,
25741             mtx_t *restrict mtx,
25742             const struct timespec *restrict ts);
25743        int cnd_wait(cnd_t *cond, mtx_t *mtx);
25744        void mtx_destroy(mtx_t *mtx);
25745        int mtx_init(mtx_t *mtx, int type);
25746        int mtx_lock(mtx_t *mtx);
25747        int mtx_timedlock(mtx_t *restrict mtx,
25748             const struct timespec *restrict ts);
25749        int mtx_trylock(mtx_t *mtx);
25750        int mtx_unlock(mtx_t *mtx);
25751        int thrd_create(thrd_t *thr, thrd_start_t func,
25752             void *arg);
25753        thrd_t thrd_current(void);
25754        int thrd_detach(thrd_t thr);
25755        int thrd_equal(thrd_t thr0, thrd_t thr1);
25756        _Noreturn void thrd_exit(int res);
25757        int thrd_join(thrd_t thr, int *res);
25758        int thrd_sleep(const struct timespec *duration,
25759             struct timespec *remaining);
25760        void thrd_yield(void);
25761        int tss_create(tss_t *key, tss_dtor_t dtor);
25762        void tss_delete(tss_t key);
25763        void *tss_get(tss_t key);
25764        int tss_set(tss_t key, void *val);
25765 </pre>
25766
25767 <p><small><a href="#Contents">Contents</a></small>
25768 <h3><a name="B.26" href="#B.26">B.26 Date and time &lt;time.h&gt;</a></h3>
25769 <!--page 515 -->
25770 <pre>
25771        NULL                size_t                   struct timespec
25772        CLOCKS_PER_SEC      clock_t                  struct tm
25773        TIME_UTC            time_t
25774        clock_t clock(void);
25775        double difftime(time_t time1, time_t time0);
25776        time_t mktime(struct tm *timeptr);
25777        time_t time(time_t *timer);
25778        int timespec_get(timespec *ts, int base);
25779        char *asctime(const struct tm *timeptr);
25780        char *ctime(const time_t *timer);
25781        struct tm *gmtime(const time_t *timer);
25782        struct tm *localtime(const time_t *timer);
25783        size_t strftime(char * restrict s,
25784             size_t maxsize,
25785             const char * restrict format,
25786             const struct tm * restrict timeptr);
25787        __STDC_WANT_LIB_EXT1__
25788          errno_t
25789          rsize_t
25790          errno_t asctime_s(char *s, rsize_t maxsize,
25791               const struct tm *timeptr);
25792          errno_t ctime_s(char *s, rsize_t maxsize,
25793               const time_t *timer);
25794          struct tm *gmtime_s(const time_t * restrict timer,
25795               struct tm * restrict result);
25796          struct tm *localtime_s(const time_t * restrict timer,
25797               struct tm * restrict result);
25798 </pre>
25799
25800 <p><small><a href="#Contents">Contents</a></small>
25801 <h3><a name="B.27" href="#B.27">B.27 Unicode utilities &lt;uchar.h&gt;</a></h3>
25802 <pre>
25803          mbstate_t    size_t             char16_t        char32_t
25804          size_t mbrtoc16(char16_t * restrict pc16,
25805               const char * restrict s, size_t n,
25806               mbstate_t * restrict ps);
25807          size_t c16rtomb(char * restrict s, char16_t c16,
25808               mbstate_t * restrict ps);
25809          size_t mbrtoc32(char32_t * restrict pc32,
25810               const char * restrict s, size_t n,
25811               mbstate_t * restrict ps);
25812          size_t c32rtomb(char * restrict s, char32_t c32,
25813               mbstate_t * restrict ps);
25814 </pre>
25815
25816 <p><small><a href="#Contents">Contents</a></small>
25817 <h3><a name="B.28" href="#B.28">B.28 Extended multibyte/wide character utilities &lt;wchar.h&gt;</a></h3>
25818 <!--page 516 -->
25819 <!--page 517 -->
25820 <!--page 518 -->
25821 <!--page 519 -->
25822 <!--page 520 -->
25823 <pre>
25824          wchar_t            wint_t                   WCHAR_MAX
25825          size_t             struct tm                WCHAR_MIN
25826          mbstate_t          NULL                     WEOF
25827          int fwprintf(FILE * restrict stream,
25828               const wchar_t * restrict format, ...);
25829          int fwscanf(FILE * restrict stream,
25830               const wchar_t * restrict format, ...);
25831          int swprintf(wchar_t * restrict s, size_t n,
25832               const wchar_t * restrict format, ...);
25833          int swscanf(const wchar_t * restrict s,
25834               const wchar_t * restrict format, ...);
25835          int vfwprintf(FILE * restrict stream,
25836               const wchar_t * restrict format, va_list arg);
25837        int vfwscanf(FILE * restrict stream,
25838             const wchar_t * restrict format, va_list arg);
25839        int vswprintf(wchar_t * restrict s, size_t n,
25840             const wchar_t * restrict format, va_list arg);
25841        int vswscanf(const wchar_t * restrict s,
25842             const wchar_t * restrict format, va_list arg);
25843        int vwprintf(const wchar_t * restrict format,
25844             va_list arg);
25845        int vwscanf(const wchar_t * restrict format,
25846             va_list arg);
25847        int wprintf(const wchar_t * restrict format, ...);
25848        int wscanf(const wchar_t * restrict format, ...);
25849        wint_t fgetwc(FILE *stream);
25850        wchar_t *fgetws(wchar_t * restrict s, int n,
25851             FILE * restrict stream);
25852        wint_t fputwc(wchar_t c, FILE *stream);
25853        int fputws(const wchar_t * restrict s,
25854             FILE * restrict stream);
25855        int fwide(FILE *stream, int mode);
25856        wint_t getwc(FILE *stream);
25857        wint_t getwchar(void);
25858        wint_t putwc(wchar_t c, FILE *stream);
25859        wint_t putwchar(wchar_t c);
25860        wint_t ungetwc(wint_t c, FILE *stream);
25861        double wcstod(const wchar_t * restrict nptr,
25862             wchar_t ** restrict endptr);
25863        float wcstof(const wchar_t * restrict nptr,
25864             wchar_t ** restrict endptr);
25865        long double wcstold(const wchar_t * restrict nptr,
25866             wchar_t ** restrict endptr);
25867        long int wcstol(const wchar_t * restrict nptr,
25868             wchar_t ** restrict endptr, int base);
25869        long long int wcstoll(const wchar_t * restrict nptr,
25870             wchar_t ** restrict endptr, int base);
25871        unsigned long int wcstoul(const wchar_t * restrict nptr,
25872             wchar_t ** restrict endptr, int base);
25873        unsigned long long int wcstoull(
25874             const wchar_t * restrict nptr,
25875             wchar_t ** restrict endptr, int base);
25876          wchar_t *wcscpy(wchar_t * restrict s1,
25877               const wchar_t * restrict s2);
25878          wchar_t *wcsncpy(wchar_t * restrict s1,
25879               const wchar_t * restrict s2, size_t n);
25880          wchar_t *wmemcpy(wchar_t * restrict s1,
25881               const wchar_t * restrict s2, size_t n);
25882          wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
25883               size_t n);
25884          wchar_t *wcscat(wchar_t * restrict s1,
25885               const wchar_t * restrict s2);
25886          wchar_t *wcsncat(wchar_t * restrict s1,
25887               const wchar_t * restrict s2, size_t n);
25888          int wcscmp(const wchar_t *s1, const wchar_t *s2);
25889          int wcscoll(const wchar_t *s1, const wchar_t *s2);
25890          int wcsncmp(const wchar_t *s1, const wchar_t *s2,
25891               size_t n);
25892          size_t wcsxfrm(wchar_t * restrict s1,
25893               const wchar_t * restrict s2, size_t n);
25894          int wmemcmp(const wchar_t *s1, const wchar_t *s2,
25895               size_t n);
25896          wchar_t *wcschr(const wchar_t *s, wchar_t c);
25897          size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
25898          wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
25899          wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
25900          size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
25901          wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
25902          wchar_t *wcstok(wchar_t * restrict s1,
25903               const wchar_t * restrict s2,
25904               wchar_t ** restrict ptr);
25905          wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
25906          size_t wcslen(const wchar_t *s);
25907          wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
25908          size_t wcsftime(wchar_t * restrict s, size_t maxsize,
25909               const wchar_t * restrict format,
25910               const struct tm * restrict timeptr);
25911          wint_t btowc(int c);
25912          int wctob(wint_t c);
25913          int mbsinit(const mbstate_t *ps);
25914          size_t mbrlen(const char * restrict s, size_t n,
25915               mbstate_t * restrict ps);
25916        size_t mbrtowc(wchar_t * restrict pwc,
25917             const char * restrict s, size_t n,
25918             mbstate_t * restrict ps);
25919        size_t wcrtomb(char * restrict s, wchar_t wc,
25920             mbstate_t * restrict ps);
25921        size_t mbsrtowcs(wchar_t * restrict dst,
25922             const char ** restrict src, size_t len,
25923             mbstate_t * restrict ps);
25924        size_t wcsrtombs(char * restrict dst,
25925             const wchar_t ** restrict src, size_t len,
25926             mbstate_t * restrict ps);
25927        __STDC_WANT_LIB_EXT1__
25928        errno_t
25929        rsize_t
25930        int fwprintf_s(FILE * restrict stream,
25931             const wchar_t * restrict format, ...);
25932        int fwscanf_s(FILE * restrict stream,
25933             const wchar_t * restrict format, ...);
25934        int snwprintf_s(wchar_t * restrict s,
25935             rsize_t n,
25936             const wchar_t * restrict format, ...);
25937        int swprintf_s(wchar_t * restrict s, rsize_t n,
25938             const wchar_t * restrict format, ...);
25939        int swscanf_s(const wchar_t * restrict s,
25940             const wchar_t * restrict format, ...);
25941        int vfwprintf_s(FILE * restrict stream,
25942             const wchar_t * restrict format,
25943             va_list arg);
25944        int vfwscanf_s(FILE * restrict stream,
25945             const wchar_t * restrict format, va_list arg);
25946        int vsnwprintf_s(wchar_t * restrict s,
25947             rsize_t n,
25948             const wchar_t * restrict format,
25949             va_list arg);
25950        int vswprintf_s(wchar_t * restrict s,
25951             rsize_t n,
25952             const wchar_t * restrict format,
25953             va_list arg);
25954          int vswscanf_s(const wchar_t * restrict s,
25955               const wchar_t * restrict format,
25956               va_list arg);
25957          int vwprintf_s(const wchar_t * restrict format,
25958               va_list arg);
25959          int vwscanf_s(const wchar_t * restrict format,
25960               va_list arg);
25961          int wprintf_s(const wchar_t * restrict format, ...);
25962          int wscanf_s(const wchar_t * restrict format, ...);
25963          errno_t wcscpy_s(wchar_t * restrict s1,
25964               rsize_t s1max,
25965               const wchar_t * restrict s2);
25966          errno_t wcsncpy_s(wchar_t * restrict s1,
25967               rsize_t s1max,
25968               const wchar_t * restrict s2,
25969               rsize_t n);
25970          errno_t wmemcpy_s(wchar_t * restrict s1,
25971               rsize_t s1max,
25972               const wchar_t * restrict s2,
25973               rsize_t n);
25974          errno_t wmemmove_s(wchar_t *s1, rsize_t s1max,
25975               const wchar_t *s2, rsize_t n);
25976          errno_t wcscat_s(wchar_t * restrict s1,
25977               rsize_t s1max,
25978               const wchar_t * restrict s2);
25979          errno_t wcsncat_s(wchar_t * restrict s1,
25980               rsize_t s1max,
25981               const wchar_t * restrict s2,
25982               rsize_t n);
25983          wchar_t *wcstok_s(wchar_t * restrict s1,
25984               rsize_t * restrict s1max,
25985               const wchar_t * restrict s2,
25986               wchar_t ** restrict ptr);
25987          size_t wcsnlen_s(const wchar_t *s, size_t maxsize);
25988          errno_t wcrtomb_s(size_t * restrict retval,
25989               char * restrict s, rsize_t smax,
25990               wchar_t wc, mbstate_t * restrict ps);
25991        errno_t mbsrtowcs_s(size_t * restrict retval,
25992             wchar_t * restrict dst, rsize_t dstmax,
25993             const char ** restrict src, rsize_t len,
25994             mbstate_t * restrict ps);
25995        errno_t wcsrtombs_s(size_t * restrict retval,
25996             char * restrict dst, rsize_t dstmax,
25997             const wchar_t ** restrict src, rsize_t len,
25998             mbstate_t * restrict ps);
25999 </pre>
26000
26001 <p><small><a href="#Contents">Contents</a></small>
26002 <h3><a name="B.29" href="#B.29">B.29 Wide character classification and mapping utilities &lt;wctype.h&gt;</a></h3>
26003 <!--page 521 -->
26004 <pre>
26005        wint_t         wctrans_t         wctype_t        WEOF
26006        int iswalnum(wint_t wc);
26007        int iswalpha(wint_t wc);
26008        int iswblank(wint_t wc);
26009        int iswcntrl(wint_t wc);
26010        int iswdigit(wint_t wc);
26011        int iswgraph(wint_t wc);
26012        int iswlower(wint_t wc);
26013        int iswprint(wint_t wc);
26014        int iswpunct(wint_t wc);
26015        int iswspace(wint_t wc);
26016        int iswupper(wint_t wc);
26017        int iswxdigit(wint_t wc);
26018        int iswctype(wint_t wc, wctype_t desc);
26019        wctype_t wctype(const char *property);
26020        wint_t towlower(wint_t wc);
26021        wint_t towupper(wint_t wc);
26022        wint_t towctrans(wint_t wc, wctrans_t desc);
26023        wctrans_t wctrans(const char *property);
26024 </pre>
26025
26026 <p><small><a href="#Contents">Contents</a></small>
26027 <h2><a name="C" href="#C">Annex C</a></h2>
26028 <pre>
26029                                      (informative)
26030                                    Sequence points
26031 </pre>
26032 <p><a name="Cp1" href="#Cp1"><small>1</small></a>
26033  The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
26034 <ul>
26035 <li>  Between the evaluations of the function designator and actual arguments in a function
26036  call and the actual call. (<a href="#6.5.2.2">6.5.2.2</a>).
26037 <li>  Between the evaluations of the first and second operands of the following operators:
26038  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>).
26039 <li>  Between the evaluations of the first operand of the conditional ? : operator and
26040  whichever of the second and third operands is evaluated (<a href="#6.5.15">6.5.15</a>).
26041 <li>  The end of a full declarator: declarators (<a href="#6.7.6">6.7.6</a>);
26042 <li>  Between the evaluation of a full expression and the next full expression to be
26043  evaluated. The following are full expressions: an initializer that is not part of a
26044  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
26045  controlling expression of a selection statement (if or switch) (<a href="#6.8.4">6.8.4</a>); the
26046  controlling expression of a while or do statement (<a href="#6.8.5">6.8.5</a>); each of the (optional)
26047  expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the (optional) expression in a return
26048  statement (<a href="#6.8.6.4">6.8.6.4</a>).
26049 <li>  Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
26050 <li>  After the actions associated with each formatted input/output function conversion
26051  specifier (<a href="#7.21.6">7.21.6</a>, <a href="#7.29.2">7.29.2</a>).
26052 <li>  Immediately before and immediately after each call to a comparison function, and
26053  also between any call to a comparison function and any movement of the objects
26054  passed as arguments to that call (<a href="#7.22.5">7.22.5</a>).
26055 <!--page 522 -->
26056 </ul>
26057
26058 <p><small><a href="#Contents">Contents</a></small>
26059 <h2><a name="D" href="#D">Annex D</a></h2>
26060 <pre>
26061                                      (normative)
26062                 Universal character names for identifiers
26063 </pre>
26064 <p><a name="Dp1" href="#Dp1"><small>1</small></a>
26065  This clause lists the hexadecimal code values that are valid in universal character names
26066  in identifiers.
26067
26068 <p><small><a href="#Contents">Contents</a></small>
26069 <h3><a name="D.1" href="#D.1">D.1 Ranges of characters allowed</a></h3>
26070 <p><a name="D.1p1" href="#D.1p1"><small>1</small></a>
26071  00A8, 00AA, 00AD, 00AF, 00B2-00B5, 00B7-00BA, 00BC-00BE, 00C0-00D6,
26072  00D8-00F6, 00F8-00FF
26073 <p><a name="D.1p2" href="#D.1p2"><small>2</small></a>
26074  0100-167F, 1681-180D, 180F-1FFF
26075 <p><a name="D.1p3" href="#D.1p3"><small>3</small></a>
26076  200B-200D, 202A-202E, 203F-2040, 2054, 2060-206F
26077 <p><a name="D.1p4" href="#D.1p4"><small>4</small></a>
26078  2070-218F, 2460-24FF, 2776-2793, 2C00-2DFF, 2E80-2FFF
26079 <p><a name="D.1p5" href="#D.1p5"><small>5</small></a>
26080  3004-3007, 3021-302F, 3031-303F
26081 <p><a name="D.1p6" href="#D.1p6"><small>6</small></a>
26082  3040-D7FF
26083 <p><a name="D.1p7" href="#D.1p7"><small>7</small></a>
26084  F900-FD3D, FD40-FDCF, FDF0-FE44, FE47-FFFD
26085 <p><a name="D.1p8" href="#D.1p8"><small>8</small></a>
26086  10000-1FFFD, 20000-2FFFD, 30000-3FFFD, 40000-4FFFD, 50000-5FFFD,
26087  60000-6FFFD, 70000-7FFFD, 80000-8FFFD, 90000-9FFFD, A0000-AFFFD,
26088  B0000-BFFFD, C0000-CFFFD, D0000-DFFFD, E0000-EFFFD
26089
26090 <p><small><a href="#Contents">Contents</a></small>
26091 <h3><a name="D.2" href="#D.2">D.2 Ranges of characters disallowed initially</a></h3>
26092 <p><a name="D.2p1" href="#D.2p1"><small>1</small></a>
26093  0300-036F, 1DC0-1DFF, 20D0-20FF, FE20-FE2F
26094 <!--page 523 -->
26095
26096 <p><small><a href="#Contents">Contents</a></small>
26097 <h2><a name="E" href="#E">Annex E</a></h2>
26098 <pre>
26099                                     (informative)
26100                              Implementation limits
26101 </pre>
26102 <p><a name="Ep1" href="#Ep1"><small>1</small></a>
26103  The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
26104  minimum magnitudes shown shall be replaced by implementation-defined magnitudes
26105  with the same sign. The values shall all be constant expressions suitable for use in #if
26106  preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
26107 <pre>
26108          #define    CHAR_BIT                               8
26109          #define    CHAR_MAX          UCHAR_MAX or SCHAR_MAX
26110          #define    CHAR_MIN                  0 or SCHAR_MIN
26111          #define    INT_MAX                           +32767
26112          #define    INT_MIN                           -32767
26113          #define    LONG_MAX                     +2147483647
26114          #define    LONG_MIN                     -2147483647
26115          #define    LLONG_MAX           +9223372036854775807
26116          #define    LLONG_MIN           -9223372036854775807
26117          #define    MB_LEN_MAX                             1
26118          #define    SCHAR_MAX                           +127
26119          #define    SCHAR_MIN                           -127
26120          #define    SHRT_MAX                          +32767
26121          #define    SHRT_MIN                          -32767
26122          #define    UCHAR_MAX                            255
26123          #define    USHRT_MAX                          65535
26124          #define    UINT_MAX                           65535
26125          #define    ULONG_MAX                     4294967295
26126          #define    ULLONG_MAX          18446744073709551615
26127 </pre>
26128 <p><a name="Ep2" href="#Ep2"><small>2</small></a>
26129  The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
26130  FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
26131  directives; all floating values shall be constant expressions. The components are
26132  described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
26133 <p><a name="Ep3" href="#Ep3"><small>3</small></a>
26134  The values given in the following list shall be replaced by implementation-defined
26135  expressions:
26136 <pre>
26137          #define FLT_EVAL_METHOD
26138          #define FLT_ROUNDS
26139 </pre>
26140 <p><a name="Ep4" href="#Ep4"><small>4</small></a>
26141  The values given in the following list shall be replaced by implementation-defined
26142  constant expressions that are greater or equal in magnitude (absolute value) to those
26143  shown, with the same sign:
26144 <!--page 524 -->
26145 <pre>
26146         #define    DLB_DECIMAL_DIG                                10
26147         #define    DBL_DIG                                        10
26148         #define    DBL_MANT_DIG
26149         #define    DBL_MAX_10_EXP                               +37
26150         #define    DBL_MAX_EXP
26151         #define    DBL_MIN_10_EXP                               -37
26152         #define    DBL_MIN_EXP
26153         #define    DECIMAL_DIG                                    10
26154         #define    FLT_DECIMAL_DIG                                 6
26155         #define    FLT_DIG                                         6
26156         #define    FLT_MANT_DIG
26157         #define    FLT_MAX_10_EXP                               +37
26158         #define    FLT_MAX_EXP
26159         #define    FLT_MIN_10_EXP                               -37
26160         #define    FLT_MIN_EXP
26161         #define    FLT_RADIX                                       2
26162         #define    LDLB_DECIMAL_DIG                               10
26163         #define    LDBL_DIG                                       10
26164         #define    LDBL_MANT_DIG
26165         #define    LDBL_MAX_10_EXP                              +37
26166         #define    LDBL_MAX_EXP
26167         #define    LDBL_MIN_10_EXP                              -37
26168         #define    LDBL_MIN_EXP
26169 </pre>
26170 <p><a name="Ep5" href="#Ep5"><small>5</small></a>
26171  The values given in the following list shall be replaced by implementation-defined
26172  constant expressions with values that are greater than or equal to those shown:
26173 <pre>
26174         #define DBL_MAX                                       1E+37
26175         #define FLT_MAX                                       1E+37
26176         #define LDBL_MAX                                      1E+37
26177 </pre>
26178 <p><a name="Ep6" href="#Ep6"><small>6</small></a>
26179  The values given in the following list shall be replaced by implementation-defined
26180  constant expressions with (positive) values that are less than or equal to those shown:
26181 <!--page 525 -->
26182 <pre>
26183         #define    DBL_EPSILON                                 1E-9
26184         #define    DBL_MIN                                    1E-37
26185         #define    FLT_EPSILON                                 1E-5
26186         #define    FLT_MIN                                    1E-37
26187         #define    LDBL_EPSILON                                1E-9
26188         #define    LDBL_MIN                                   1E-37
26189 </pre>
26190
26191 <p><small><a href="#Contents">Contents</a></small>
26192 <h2><a name="F" href="#F">Annex F</a></h2>
26193 <pre>
26194                                            (normative)
26195                        IEC 60559 floating-point arithmetic
26196 </pre>
26197
26198 <p><small><a href="#Contents">Contents</a></small>
26199 <h3><a name="F.1" href="#F.1">F.1 Introduction</a></h3>
26200 <p><a name="F.1p1" href="#F.1p1"><small>1</small></a>
26201  This annex specifies C language support for the IEC 60559 floating-point standard. The
26202  IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
26203  microprocessor systems, second edition (IEC 60559:1989), previously designated
26204  IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
26205  (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
26206  Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
26207  dependencies on radix and word length. IEC 60559 generally refers to the floating-point
26208  standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
26209  defines __STDC_IEC_559__ shall conform to the specifications in this annex.<sup><a href="#note356"><b>356)</b></a></sup>
26210  Where a binding between the C language and IEC 60559 is indicated, the
26211  IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since
26212  negative and positive infinity are representable in IEC 60559 formats, all real numbers lie
26213  within the range of representable values.
26214
26215 <p><b>Footnotes</b>
26216 <p><small><a name="note356" href="#note356">356)</a> Implementations that do not define __STDC_IEC_559__ are not required to conform to these
26217  specifications.
26218 </small>
26219
26220 <p><small><a href="#Contents">Contents</a></small>
26221 <h3><a name="F.2" href="#F.2">F.2 Types</a></h3>
26222 <p><a name="F.2p1" href="#F.2p1"><small>1</small></a>
26223  The C floating types match the IEC 60559 formats as follows:
26224 <ul>
26225 <li>  The float type matches the IEC 60559 single format.
26226 <li>  The double type matches the IEC 60559 double format.
26227 <li>  The long double type matches an IEC 60559 extended format,<sup><a href="#note357"><b>357)</b></a></sup> else a
26228  non-IEC 60559 extended format, else the IEC 60559 double format.
26229 </ul>
26230  Any non-IEC 60559 extended format used for the long double type shall have more
26231  precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note358"><b>358)</b></a></sup>
26232  
26233  
26234  
26235  
26236 <!--page 526 -->
26237 <p><b>Recommended practice</b>
26238 <p><a name="F.2p2" href="#F.2p2"><small>2</small></a>
26239  The long double type should match an IEC 60559 extended format.
26240
26241 <p><b>Footnotes</b>
26242 <p><small><a name="note357" href="#note357">357)</a> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
26243  and quadruple 128-bit IEC 60559 formats.
26244 </small>
26245 <p><small><a name="note358" href="#note358">358)</a> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
26246  all double values.
26247 </small>
26248
26249 <p><small><a href="#Contents">Contents</a></small>
26250 <h4><a name="F.2.1" href="#F.2.1">F.2.1 Infinities, signed zeros, and NaNs</a></h4>
26251 <p><a name="F.2.1p1" href="#F.2.1p1"><small>1</small></a>
26252  This specification does not define the behavior of signaling NaNs.<sup><a href="#note359"><b>359)</b></a></sup> It generally uses
26253  the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
26254  functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
26255
26256 <p><b>Footnotes</b>
26257 <p><small><a name="note359" href="#note359">359)</a> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
26258  sufficient for closure of the arithmetic.
26259 </small>
26260
26261 <p><small><a href="#Contents">Contents</a></small>
26262 <h3><a name="F.3" href="#F.3">F.3 Operators and functions</a></h3>
26263 <p><a name="F.3p1" href="#F.3p1"><small>1</small></a>
26264  C operators and functions provide IEC 60559 required and recommended facilities as
26265  listed below.
26266 <ul>
26267 <li>  The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
26268  divide operations.
26269 <li>  The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
26270 <li>  The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
26271  operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
26272  with additional information.
26273 <li>  The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
26274  floating-point number to an integer value (in the same precision). The nearbyint
26275  functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
26276  Appendix to ANSI/IEEE 854.
26277 <li>  The conversions for floating types provide the IEC 60559 conversions between
26278  floating-point precisions.
26279 <li>  The conversions from integer to floating types provide the IEC 60559 conversions
26280  from integer to floating point.
26281 <li>  The conversions from floating to integer types provide IEC 60559-like conversions
26282  but always round toward zero.
26283 <li>  The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
26284  conversions, which honor the directed rounding mode, from floating point to the
26285  long int and long long int integer formats. The lrint and llrint
26286  functions can be used to implement IEC 60559 conversions from floating to other
26287  integer formats.
26288 <li>  The translation time conversion of floating constants and the strtod, strtof,
26289  strtold, fprintf, fscanf, and related library functions in <a href="#7.22">&lt;stdlib.h&gt;</a>,
26290  
26291  
26292 <!--page 527 -->
26293   <a href="#7.21">&lt;stdio.h&gt;</a>, and <a href="#7.29">&lt;wchar.h&gt;</a> provide IEC 60559 binary-decimal conversions. The
26294   strtold function in <a href="#7.22">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
26295   Appendix to ANSI/IEEE 854.
26296 <li>  The relational and equality operators provide IEC 60559 comparisons. IEC 60559
26297  identifies a need for additional comparison predicates to facilitate writing code that
26298  accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
26299  isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
26300  supplement the language operators to address this need. The islessgreater and
26301  isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
26302  the unordered predicate recommended in the Appendix to IEC 60559.
26303 <li>  The feclearexcept, feraiseexcept, and fetestexcept functions in
26304  <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
26305  exception status flags. The fegetexceptflag and fesetexceptflag
26306  functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
26307  one time. These functions are used in conjunction with the type fexcept_t and the
26308  floating-point     exception      macros      (FE_INEXACT,         FE_DIVBYZERO,
26309  FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
26310 <li>  The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
26311  to select among the IEC 60559 directed rounding modes represented by the rounding
26312  direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
26313  FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
26314  IEC 60559 directed rounding modes.
26315 <li>  The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
26316  <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
26317  the IEC 60559 status flags and control modes.
26318 <li>  The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
26319  recommended in the Appendix to IEC 60559.
26320 <li>  The fabs functions in <a href="#7.12">&lt;math.h&gt;</a> provide the abs function recommended in the
26321  Appendix to IEC 60559.
26322 <li>  The unary minus (-) operator provides the unary minus (-) operation recommended
26323  in the Appendix to IEC 60559.
26324 <li>  The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
26325  recommended in the Appendix to IEC 60559.
26326 <li>  The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
26327  Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
26328 <li>  The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
26329  function recommended in the Appendix to IEC 60559 (but with a minor change to
26330 <!--page 528 -->
26331    better handle signed zeros).
26332 <li>  The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
26333  the Appendix to IEC 60559.
26334 <li>  The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
26335  Appendix to IEC 60559.
26336 <li>  The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
26337  conjunction with the number classification macros (FP_NAN, FP_INFINITE,
26338  FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
26339  function recommended in the Appendix to IEC 60559 (except that the classification
26340  macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
26341 </ul>
26342
26343 <p><small><a href="#Contents">Contents</a></small>
26344 <h3><a name="F.4" href="#F.4">F.4 Floating to integer conversion</a></h3>
26345 <p><a name="F.4p1" href="#F.4p1"><small>1</small></a>
26346  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
26347  (even for NaN). Otherwise, if the floating value is infinite or NaN or if the integral part
26348  of the floating value exceeds the range of the integer type, then the ''invalid'' floating-
26349  point exception is raised and the resulting value is unspecified. Otherwise, the resulting
26350  value is determined by <a href="#6.3.1.4">6.3.1.4</a>. Conversion of an integral floating value that does not
26351  exceed the range of the integer type raises no floating-point exceptions; whether
26352  conversion of a non-integral floating value raises the ''inexact'' floating-point exception is
26353  unspecified.<sup><a href="#note360"><b>360)</b></a></sup>
26354
26355 <p><b>Footnotes</b>
26356 <p><small><a name="note360" href="#note360">360)</a> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
26357  conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
26358  cases where it matters, library functions can be used to effect such conversions with or without raising
26359  the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
26360  <a href="#7.12">&lt;math.h&gt;</a>.
26361 </small>
26362
26363 <p><small><a href="#Contents">Contents</a></small>
26364 <h3><a name="F.5" href="#F.5">F.5 Binary-decimal conversion</a></h3>
26365 <p><a name="F.5p1" href="#F.5p1"><small>1</small></a>
26366  Conversion from the widest supported IEC 60559 format to decimal with
26367  DECIMAL_DIG digits and back is the identity function.<sup><a href="#note361"><b>361)</b></a></sup>
26368 <p><a name="F.5p2" href="#F.5p2"><small>2</small></a>
26369  Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
26370  particular, conversion between any supported IEC 60559 format and decimal with
26371  DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
26372  rounding mode), which assures that conversion from the widest supported IEC 60559
26373  format to decimal with DECIMAL_DIG digits and back is the identity function.
26374  
26375  
26376  
26377 <!--page 529 -->
26378 <p><a name="F.5p3" href="#F.5p3"><small>3</small></a>
26379  Functions such as strtod that convert character sequences to floating types honor the
26380  rounding direction. Hence, if the rounding direction might be upward or downward, the
26381  implementation cannot convert a minus-signed sequence by negating the converted
26382  unsigned sequence.
26383
26384 <p><b>Footnotes</b>
26385 <p><small><a name="note361" href="#note361">361)</a> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
26386  DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
26387  IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
26388  DBL_DIG are 18 and 15, respectively, for these formats.)
26389 </small>
26390
26391 <p><small><a href="#Contents">Contents</a></small>
26392 <h3><a name="F.6" href="#F.6">F.6 The return statement</a></h3>
26393  If the return expression is evaluated in a floating-point format different from the return
26394  type, the expression is converted as if by assignment<sup><a href="#note362"><b>362)</b></a></sup> to the return type of the function
26395  and the resulting value is returned to the caller.
26396
26397 <p><b>Footnotes</b>
26398 <p><small><a name="note362" href="#note362">362)</a> Assignment removes any extra range and precision.
26399 </small>
26400
26401 <p><small><a href="#Contents">Contents</a></small>
26402 <h3><a name="F.7" href="#F.7">F.7 Contracted expressions</a></h3>
26403 <p><a name="F.7p1" href="#F.7p1"><small>1</small></a>
26404  A contracted expression is correctly rounded (once) and treats infinities, NaNs, signed
26405  zeros, subnormals, and the rounding directions in a manner consistent with the basic
26406  arithmetic operations covered by IEC 60559.
26407 <p><b>Recommended practice</b>
26408 <p><a name="F.7p2" href="#F.7p2"><small>2</small></a>
26409  A contracted expression should raise floating-point exceptions in a manner generally
26410  consistent with the basic arithmetic operations.
26411
26412 <p><small><a href="#Contents">Contents</a></small>
26413 <h3><a name="F.8" href="#F.8">F.8 Floating-point environment</a></h3>
26414 <p><a name="F.8p1" href="#F.8p1"><small>1</small></a>
26415  The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
26416  point exception status flags and directed-rounding control modes. It includes also
26417  IEC 60559 dynamic rounding precision and trap enablement modes, if the
26418  implementation supports them.<sup><a href="#note363"><b>363)</b></a></sup>
26419
26420 <p><b>Footnotes</b>
26421 <p><small><a name="note363" href="#note363">363)</a> This specification does not require dynamic rounding precision nor trap enablement modes.
26422 </small>
26423
26424 <p><small><a href="#Contents">Contents</a></small>
26425 <h4><a name="F.8.1" href="#F.8.1">F.8.1 Environment management</a></h4>
26426 <p><a name="F.8.1p1" href="#F.8.1p1"><small>1</small></a>
26427  IEC 60559 requires that floating-point operations implicitly raise floating-point exception
26428  status flags, and that rounding control modes can be set explicitly to affect result values of
26429  floating-point operations. When the state for the FENV_ACCESS pragma (defined in
26430  <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
26431  which respect sequence points.<sup><a href="#note364"><b>364)</b></a></sup>
26432  
26433  
26434  
26435  
26436 <!--page 530 -->
26437
26438 <p><b>Footnotes</b>
26439 <p><small><a name="note364" href="#note364">364)</a> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
26440  point control modes will be the default ones and the floating-point status flags will not be tested,
26441  which allows certain optimizations (see <a href="#F.9">F.9</a>).
26442 </small>
26443
26444 <p><small><a href="#Contents">Contents</a></small>
26445 <h4><a name="F.8.2" href="#F.8.2">F.8.2 Translation</a></h4>
26446 <p><a name="F.8.2p1" href="#F.8.2p1"><small>1</small></a>
26447  During translation the IEC 60559 default modes are in effect:
26448 <ul>
26449 <li>  The rounding direction mode is rounding to nearest.
26450 <li>  The rounding precision mode (if supported) is set so that results are not shortened.
26451 <li>  Trapping or stopping (if supported) is disabled on all floating-point exceptions.
26452 </ul>
26453 <p><b>Recommended practice</b>
26454 <p><a name="F.8.2p2" href="#F.8.2p2"><small>2</small></a>
26455  The implementation should produce a diagnostic message for each translation-time
26456  floating-point exception, other than ''inexact'';<sup><a href="#note365"><b>365)</b></a></sup> the implementation should then
26457  proceed with the translation of the program.
26458
26459 <p><b>Footnotes</b>
26460 <p><small><a name="note365" href="#note365">365)</a> As floating constants are converted to appropriate internal representations at translation time, their
26461  conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
26462  (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
26463  strtod, provide execution-time conversion of numeric strings.
26464 </small>
26465
26466 <p><small><a href="#Contents">Contents</a></small>
26467 <h4><a name="F.8.3" href="#F.8.3">F.8.3 Execution</a></h4>
26468 <p><a name="F.8.3p1" href="#F.8.3p1"><small>1</small></a>
26469  At program startup the floating-point environment is initialized as prescribed by
26470  IEC 60559:
26471 <ul>
26472 <li>  All floating-point exception status flags are cleared.
26473 <li>  The rounding direction mode is rounding to nearest.
26474 <li>  The dynamic rounding precision mode (if supported) is set so that results are not
26475  shortened.
26476 <li>  Trapping or stopping (if supported) is disabled on all floating-point exceptions.
26477 </ul>
26478
26479 <p><small><a href="#Contents">Contents</a></small>
26480 <h4><a name="F.8.4" href="#F.8.4">F.8.4 Constant expressions</a></h4>
26481 <p><a name="F.8.4p1" href="#F.8.4p1"><small>1</small></a>
26482  An arithmetic constant expression of floating type, other than one in an initializer for an
26483  object that has static or thread storage duration, is evaluated (as if) during execution; thus,
26484  it is affected by any operative floating-point control modes and raises floating-point
26485  exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
26486  is ''on'').<sup><a href="#note366"><b>366)</b></a></sup>
26487 <p><a name="F.8.4p2" href="#F.8.4p2"><small>2</small></a>
26488  EXAMPLE
26489  
26490  
26491  
26492 <!--page 531 -->
26493 <pre>
26494           #include <a href="#7.6">&lt;fenv.h&gt;</a>
26495           #pragma STDC FENV_ACCESS ON
26496           void f(void)
26497           {
26498                 float w[] = { 0.0/0.0 };                  //   raises an exception
26499                 static float x = 0.0/0.0;                 //   does not raise an exception
26500                 float y = 0.0/0.0;                        //   raises an exception
26501                 double z = 0.0/0.0;                       //   raises an exception
26502                 /* ... */
26503           }
26504 </pre>
26505 <p><a name="F.8.4p3" href="#F.8.4p3"><small>3</small></a>
26506  For the static initialization, the division is done at translation time, raising no (execution-time) floating-
26507  point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
26508  execution time.
26509  
26510
26511 <p><b>Footnotes</b>
26512 <p><small><a name="note366" href="#note366">366)</a> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
26513  are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
26514  1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
26515  efficiency of translation-time evaluation through static initialization, such as
26516
26517 <pre>
26518           const static double one_third = 1.0/3.0;
26519 </pre>
26520 </small>
26521
26522 <p><small><a href="#Contents">Contents</a></small>
26523 <h4><a name="F.8.5" href="#F.8.5">F.8.5 Initialization</a></h4>
26524 <p><a name="F.8.5p1" href="#F.8.5p1"><small>1</small></a>
26525  All computation for automatic initialization is done (as if) at execution time; thus, it is
26526  affected by any operative modes and raises floating-point exceptions as required by
26527  IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
26528  for initialization of objects that have static or thread storage duration is done (as if) at
26529  translation time.
26530 <p><a name="F.8.5p2" href="#F.8.5p2"><small>2</small></a>
26531  EXAMPLE
26532 <pre>
26533           #include <a href="#7.6">&lt;fenv.h&gt;</a>
26534           #pragma STDC FENV_ACCESS ON
26535           void f(void)
26536           {
26537                 float u[] = { 1.1e75 };                  //   raises exceptions
26538                 static float v = 1.1e75;                 //   does not raise exceptions
26539                 float w = 1.1e75;                        //   raises exceptions
26540                 double x = 1.1e75;                       //   may raise exceptions
26541                 float y = 1.1e75f;                       //   may raise exceptions
26542                 long double z = 1.1e75;                  //   does not raise exceptions
26543                 /* ... */
26544           }
26545 </pre>
26546 <p><a name="F.8.5p3" href="#F.8.5p3"><small>3</small></a>
26547  The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
26548  done at translation time. The automatic initialization of u and w require an execution-time conversion to
26549  float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
26550  of x and y entail execution-time conversion; however, in some expression evaluation methods, the
26551  conversions is not to a narrower format, in which case no floating-point exception is raised.<sup><a href="#note367"><b>367)</b></a></sup> The
26552  automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
26553  point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
26554  
26555  
26556  
26557 <!--page 532 -->
26558  their internal representations occur at translation time in all cases.
26559  
26560
26561 <p><b>Footnotes</b>
26562 <p><small><a name="note367" href="#note367">367)</a> Use of float_t and double_t variables increases the likelihood of translation-time computation.
26563  For example, the automatic initialization
26564
26565 <pre>
26566           double_t x = 1.1e75;
26567 </pre>
26568  could be done at translation time, regardless of the expression evaluation method.
26569 </small>
26570
26571 <p><small><a href="#Contents">Contents</a></small>
26572 <h4><a name="F.8.6" href="#F.8.6">F.8.6 Changing the environment</a></h4>
26573 <p><a name="F.8.6p1" href="#F.8.6p1"><small>1</small></a>
26574  Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
26575  change floating-point status flags and control modes just as indicated by their
26576  specifications (including conformance to IEC 60559). They do not change flags or modes
26577  (so as to be detectable by the user) in any other cases.
26578 <p><a name="F.8.6p2" href="#F.8.6p2"><small>2</small></a>
26579  If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
26580  valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
26581  ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
26582  before ''inexact''.
26583
26584 <p><small><a href="#Contents">Contents</a></small>
26585 <h3><a name="F.9" href="#F.9">F.9 Optimization</a></h3>
26586 <p><a name="F.9p1" href="#F.9p1"><small>1</small></a>
26587  This section identifies code transformations that might subvert IEC 60559-specified
26588  behavior, and others that do not.
26589
26590 <p><small><a href="#Contents">Contents</a></small>
26591 <h4><a name="F.9.1" href="#F.9.1">F.9.1 Global transformations</a></h4>
26592 <p><a name="F.9.1p1" href="#F.9.1p1"><small>1</small></a>
26593  Floating-point arithmetic operations and external function calls may entail side effects
26594  which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
26595  ''on''. The flags and modes in the floating-point environment may be regarded as global
26596  variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
26597  flags.
26598 <p><a name="F.9.1p2" href="#F.9.1p2"><small>2</small></a>
26599  Concern about side effects may inhibit code motion and removal of seemingly useless
26600  code. For example, in
26601 <pre>
26602           #include <a href="#7.6">&lt;fenv.h&gt;</a>
26603           #pragma STDC FENV_ACCESS ON
26604           void f(double x)
26605           {
26606                /* ... */
26607                for (i = 0; i &lt; n; i++) x + 1;
26608                /* ... */
26609           }
26610 </pre>
26611  x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
26612  body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
26613  course these optimizations are valid if the implementation can rule out the nettlesome
26614  cases.)
26615 <p><a name="F.9.1p3" href="#F.9.1p3"><small>3</small></a>
26616  This specification does not require support for trap handlers that maintain information
26617  about the order or count of floating-point exceptions. Therefore, between function calls,
26618  floating-point exceptions need not be precise: the actual order and number of occurrences
26619  of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
26620 <!--page 533 -->
26621  the preceding loop could be treated as
26622 <pre>
26623           if (0 &lt; n) x + 1;
26624 </pre>
26625
26626 <p><small><a href="#Contents">Contents</a></small>
26627 <h4><a name="F.9.2" href="#F.9.2">F.9.2 Expression transformations</a></h4>
26628 <p><a name="F.9.2p1" href="#F.9.2p1"><small>1</small></a>
26629  x/2 &lt;-&gt; x x 0.5          Although similar transformations involving inexact constants
26630 <pre>
26631                         generally do not yield numerically equivalent expressions, if the
26632                         constants are exact then such transformations can be made on
26633                         IEC 60559 machines and others that round perfectly.
26634 </pre>
26635  1 x x and x/1 -&gt; x The expressions 1 x x, x/1, and x are equivalent (on IEC 60559
26636 <pre>
26637                    machines, among others).<sup><a href="#note368"><b>368)</b></a></sup>
26638 </pre>
26639  x/x -&gt; 1.0             The expressions x/x and 1.0 are not equivalent if x can be zero,
26640 <pre>
26641                         infinite, or NaN.
26642 </pre>
26643  x - y &lt;-&gt; x + (-y)       The expressions x - y, x + (-y), and (-y) + x are equivalent (on
26644 <pre>
26645                         IEC 60559 machines, among others).
26646 </pre>
26647  x - y &lt;-&gt; -(y - x)       The expressions x - y and -(y - x) are not equivalent because 1 - 1
26648 <pre>
26649                         is +0 but -(1 - 1) is -0 (in the default rounding direction).<sup><a href="#note369"><b>369)</b></a></sup>
26650 </pre>
26651  x - x -&gt; 0.0           The expressions x - x and 0.0 are not equivalent if x is a NaN or
26652 <pre>
26653                         infinite.
26654 </pre>
26655  0 x x -&gt; 0.0           The expressions 0 x x and 0.0 are not equivalent if x is a NaN,
26656 <pre>
26657                         infinite, or -0.
26658 </pre>
26659  x+0-&gt; x                 The expressions x + 0 and x are not equivalent if x is -0, because
26660 <pre>
26661                         (-0) + (+0) yields +0 (in the default rounding direction), not -0.
26662 </pre>
26663  x-0-&gt; x                 (+0) - (+0) yields -0 when rounding is downward (toward -(inf)), but
26664 <pre>
26665                         +0 otherwise, and (-0) - (+0) always yields -0; so, if the state of the
26666                         FENV_ACCESS pragma is ''off'', promising default rounding, then
26667                         the implementation can replace x - 0 by x, even if x might be zero.
26668 </pre>
26669  -x &lt;-&gt; 0 - x             The expressions -x and 0 - x are not equivalent if x is +0, because
26670 <pre>
26671                         -(+0) yields -0, but 0 - (+0) yields +0 (unless rounding is
26672                         downward).
26673 </pre>
26674  
26675 <!--page 534 -->
26676
26677 <p><b>Footnotes</b>
26678 <p><small><a name="note368" href="#note368">368)</a> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
26679  other transformations that remove arithmetic operators.
26680 </small>
26681 <p><small><a name="note369" href="#note369">369)</a> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
26682  Examples include:
26683
26684 <pre>
26685     1/(1/ (+-) (inf)) is (+-) (inf)
26686 </pre>
26687  and
26688
26689 <pre>
26690     conj(csqrt(z)) is csqrt(conj(z)),
26691 </pre>
26692  for complex z.
26693 </small>
26694
26695 <p><small><a href="#Contents">Contents</a></small>
26696 <h4><a name="F.9.3" href="#F.9.3">F.9.3 Relational operators</a></h4>
26697 <p><a name="F.9.3p1" href="#F.9.3p1"><small>1</small></a>
26698  x != x -&gt; false           The expression x != x is true if x is a NaN.
26699  x = x -&gt; true            The expression x = x is false if x is a NaN.
26700  x &lt; y -&gt; isless(x,y) (and similarly for &lt;=, &gt;, &gt;=) Though numerically equal, these
26701 <pre>
26702                 expressions are not equivalent because of side effects when x or y is a
26703                 NaN and the state of the FENV_ACCESS pragma is ''on''. This
26704                 transformation, which would be desirable if extra code were required
26705                 to cause the ''invalid'' floating-point exception for unordered cases,
26706                 could be performed provided the state of the FENV_ACCESS pragma
26707                 is ''off''.
26708 </pre>
26709  The sense of relational operators shall be maintained. This includes handling unordered
26710  cases as expressed by the source code.
26711 <p><a name="F.9.3p2" href="#F.9.3p2"><small>2</small></a>
26712  EXAMPLE
26713 <pre>
26714           // calls g and raises ''invalid'' if a and b are unordered
26715           if (a &lt; b)
26716                   f();
26717           else
26718                   g();
26719 </pre>
26720  is not equivalent to
26721 <pre>
26722           // calls f and raises ''invalid'' if a and b are unordered
26723           if (a &gt;= b)
26724                   g();
26725           else
26726                   f();
26727 </pre>
26728  nor to
26729 <pre>
26730           // calls f without raising ''invalid'' if a and b are unordered
26731           if (isgreaterequal(a,b))
26732                   g();
26733           else
26734                   f();
26735 </pre>
26736  nor, unless the state of the FENV_ACCESS pragma is ''off'', to
26737 <pre>
26738           // calls g without raising ''invalid'' if a and b are unordered
26739           if (isless(a,b))
26740                   f();
26741           else
26742                   g();
26743 </pre>
26744  but is equivalent to
26745 <!--page 535 -->
26746 <pre>
26747          if (!(a &lt; b))
26748                g();
26749          else
26750                f();
26751 </pre>
26752  
26753
26754 <p><small><a href="#Contents">Contents</a></small>
26755 <h4><a name="F.9.4" href="#F.9.4">F.9.4 Constant arithmetic</a></h4>
26756 <p><a name="F.9.4p1" href="#F.9.4p1"><small>1</small></a>
26757  The implementation shall honor floating-point exceptions raised by execution-time
26758  constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.8.4">F.8.4</a>
26759  and <a href="#F.8.5">F.8.5</a>.) An operation on constants that raises no floating-point exception can be
26760  folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
26761  further check is required to assure that changing the rounding direction to downward does
26762  not alter the sign of the result,<sup><a href="#note370"><b>370)</b></a></sup> and implementations that support dynamic rounding
26763  precision modes shall assure further that the result of the operation raises no floating-
26764  point exception when converted to the semantic type of the operation.
26765
26766 <p><b>Footnotes</b>
26767 <p><small><a name="note370" href="#note370">370)</a> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
26768 </small>
26769
26770 <p><small><a href="#Contents">Contents</a></small>
26771 <h3><a name="F.10" href="#F.10">F.10 Mathematics &lt;math.h&gt;</a></h3>
26772 <p><a name="F.10p1" href="#F.10p1"><small>1</small></a>
26773  This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
26774  for IEC 60559 implementations.
26775 <p><a name="F.10p2" href="#F.10p2"><small>2</small></a>
26776  The Standard C macro HUGE_VAL and its float and long double analogs,
26777  HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
26778  infinities.
26779 <p><a name="F.10p3" href="#F.10p3"><small>3</small></a>
26780  Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
26781  IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
26782  other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
26783  (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
26784  in a manner consistent with the basic arithmetic operations covered by IEC 60559.
26785 <p><a name="F.10p4" href="#F.10p4"><small>4</small></a>
26786  The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
26787  nonzero value.
26788 <p><a name="F.10p5" href="#F.10p5"><small>5</small></a>
26789  The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
26790  subsequent subclauses of this annex.
26791 <p><a name="F.10p6" href="#F.10p6"><small>6</small></a>
26792  The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
26793  rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
26794  whose magnitude is too large.
26795 <p><a name="F.10p7" href="#F.10p7"><small>7</small></a>
26796  The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
26797  subnormal or zero) and suffers loss of accuracy.<sup><a href="#note371"><b>371)</b></a></sup>
26798  
26799  
26800 <!--page 536 -->
26801 <p><a name="F.10p8" href="#F.10p8"><small>8</small></a>
26802  Whether or when library functions raise the ''inexact'' floating-point exception is
26803  unspecified, unless explicitly specified otherwise.
26804 <p><a name="F.10p9" href="#F.10p9"><small>9</small></a>
26805  Whether or when library functions raise an undeserved ''underflow'' floating-point
26806  exception is unspecified.<sup><a href="#note372"><b>372)</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
26807  not raise spurious floating-point exceptions (detectable by the user), other than the
26808  ''inexact'' floating-point exception.
26809 <p><a name="F.10p10" href="#F.10p10"><small>10</small></a>
26810  Whether the functions honor the rounding direction mode is implementation-defined,
26811  unless explicitly specified otherwise.
26812 <p><a name="F.10p11" href="#F.10p11"><small>11</small></a>
26813  Functions with a NaN argument return a NaN result and raise no floating-point exception,
26814  except where stated otherwise.
26815 <p><a name="F.10p12" href="#F.10p12"><small>12</small></a>
26816  The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
26817  For families of functions, the specifications apply to all of the functions even though only
26818  the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
26819  occurs in both an argument and the result, the result has the same sign as the argument.
26820 <p><b>Recommended practice</b>
26821 <p><a name="F.10p13" href="#F.10p13"><small>13</small></a>
26822  If a function with one or more NaN arguments returns a NaN result, the result should be
26823  the same as one of the NaN arguments (after possible type conversion), except perhaps
26824  for the sign.
26825
26826 <p><b>Footnotes</b>
26827 <p><small><a name="note371" href="#note371">371)</a> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
26828  when the floating-point exception is raised.
26829 </small>
26830 <p><small><a name="note372" href="#note372">372)</a> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
26831  avoiding them would be too costly.
26832 </small>
26833
26834 <p><small><a href="#Contents">Contents</a></small>
26835 <h4><a name="F.10.1" href="#F.10.1">F.10.1 Trigonometric functions</a></h4>
26836
26837 <p><small><a href="#Contents">Contents</a></small>
26838 <h5><a name="F.10.1.1" href="#F.10.1.1">F.10.1.1 The acos functions</a></h5>
26839 <p><a name="F.10.1.1p1" href="#F.10.1.1p1"><small>1</small></a>
26840 <ul>
26841 <li>  acos(1) returns +0.
26842 <li>  acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
26843  | x | &gt; 1.
26844 </ul>
26845
26846 <p><small><a href="#Contents">Contents</a></small>
26847 <h5><a name="F.10.1.2" href="#F.10.1.2">F.10.1.2 The asin functions</a></h5>
26848 <p><a name="F.10.1.2p1" href="#F.10.1.2p1"><small>1</small></a>
26849 <ul>
26850 <li>  asin((+-)0) returns (+-)0.
26851 <li>  asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
26852  | x | &gt; 1.
26853  
26854  
26855  
26856  
26857 <!--page 537 -->
26858 </ul>
26859
26860 <p><small><a href="#Contents">Contents</a></small>
26861 <h5><a name="F.10.1.3" href="#F.10.1.3">F.10.1.3 The atan functions</a></h5>
26862 <p><a name="F.10.1.3p1" href="#F.10.1.3p1"><small>1</small></a>
26863 <ul>
26864 <li>  atan((+-)0) returns (+-)0.
26865 <li>  atan((+-)(inf)) returns (+-)pi /2.
26866 </ul>
26867
26868 <p><small><a href="#Contents">Contents</a></small>
26869 <h5><a name="F.10.1.4" href="#F.10.1.4">F.10.1.4 The atan2 functions</a></h5>
26870 <p><a name="F.10.1.4p1" href="#F.10.1.4p1"><small>1</small></a>
26871 <ul>
26872 <li>  atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note373"><b>373)</b></a></sup>
26873 <li>  atan2((+-)0, +0) returns (+-)0.
26874 <li>  atan2((+-)0, x) returns (+-)pi for x &lt; 0.
26875 <li>  atan2((+-)0, x) returns (+-)0 for x &gt; 0.
26876 <li>  atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
26877 <li>  atan2(y, (+-)0) returns pi /2 for y &gt; 0.
26878 <li>  atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
26879 <li>  atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
26880 <li>  atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
26881 <li>  atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
26882 <li>  atan2((+-)(inf), +(inf)) returns (+-)pi /4.
26883 </ul>
26884
26885 <p><b>Footnotes</b>
26886 <p><small><a name="note373" href="#note373">373)</a> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
26887  the ''divide-by-zero'' floating-point exception.
26888 </small>
26889
26890 <p><small><a href="#Contents">Contents</a></small>
26891 <h5><a name="F.10.1.5" href="#F.10.1.5">F.10.1.5 The cos functions</a></h5>
26892 <p><a name="F.10.1.5p1" href="#F.10.1.5p1"><small>1</small></a>
26893 <ul>
26894 <li>  cos((+-)0) returns 1.
26895 <li>  cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
26896 </ul>
26897
26898 <p><small><a href="#Contents">Contents</a></small>
26899 <h5><a name="F.10.1.6" href="#F.10.1.6">F.10.1.6 The sin functions</a></h5>
26900 <p><a name="F.10.1.6p1" href="#F.10.1.6p1"><small>1</small></a>
26901 <ul>
26902 <li>  sin((+-)0) returns (+-)0.
26903 <li>  sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
26904 </ul>
26905
26906 <p><small><a href="#Contents">Contents</a></small>
26907 <h5><a name="F.10.1.7" href="#F.10.1.7">F.10.1.7 The tan functions</a></h5>
26908 <p><a name="F.10.1.7p1" href="#F.10.1.7p1"><small>1</small></a>
26909 <ul>
26910 <li>  tan((+-)0) returns (+-)0.
26911 <li>  tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
26912  
26913  
26914  
26915  
26916 <!--page 538 -->
26917 </ul>
26918
26919 <p><small><a href="#Contents">Contents</a></small>
26920 <h4><a name="F.10.2" href="#F.10.2">F.10.2 Hyperbolic functions</a></h4>
26921
26922 <p><small><a href="#Contents">Contents</a></small>
26923 <h5><a name="F.10.2.1" href="#F.10.2.1">F.10.2.1 The acosh functions</a></h5>
26924 <p><a name="F.10.2.1p1" href="#F.10.2.1p1"><small>1</small></a>
26925 <ul>
26926 <li>  acosh(1) returns +0.
26927 <li>  acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
26928 <li>  acosh(+(inf)) returns +(inf).
26929 </ul>
26930
26931 <p><small><a href="#Contents">Contents</a></small>
26932 <h5><a name="F.10.2.2" href="#F.10.2.2">F.10.2.2 The asinh functions</a></h5>
26933 <p><a name="F.10.2.2p1" href="#F.10.2.2p1"><small>1</small></a>
26934 <ul>
26935 <li>  asinh((+-)0) returns (+-)0.
26936 <li>  asinh((+-)(inf)) returns (+-)(inf).
26937 </ul>
26938
26939 <p><small><a href="#Contents">Contents</a></small>
26940 <h5><a name="F.10.2.3" href="#F.10.2.3">F.10.2.3 The atanh functions</a></h5>
26941 <p><a name="F.10.2.3p1" href="#F.10.2.3p1"><small>1</small></a>
26942 <ul>
26943 <li>  atanh((+-)0) returns (+-)0.
26944 <li>  atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
26945 <li>  atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
26946  | x | &gt; 1.
26947 </ul>
26948
26949 <p><small><a href="#Contents">Contents</a></small>
26950 <h5><a name="F.10.2.4" href="#F.10.2.4">F.10.2.4 The cosh functions</a></h5>
26951 <p><a name="F.10.2.4p1" href="#F.10.2.4p1"><small>1</small></a>
26952 <ul>
26953 <li>  cosh((+-)0) returns 1.
26954 <li>  cosh((+-)(inf)) returns +(inf).
26955 </ul>
26956
26957 <p><small><a href="#Contents">Contents</a></small>
26958 <h5><a name="F.10.2.5" href="#F.10.2.5">F.10.2.5 The sinh functions</a></h5>
26959 <p><a name="F.10.2.5p1" href="#F.10.2.5p1"><small>1</small></a>
26960 <ul>
26961 <li>  sinh((+-)0) returns (+-)0.
26962 <li>  sinh((+-)(inf)) returns (+-)(inf).
26963 </ul>
26964
26965 <p><small><a href="#Contents">Contents</a></small>
26966 <h5><a name="F.10.2.6" href="#F.10.2.6">F.10.2.6 The tanh functions</a></h5>
26967 <p><a name="F.10.2.6p1" href="#F.10.2.6p1"><small>1</small></a>
26968 <ul>
26969 <li>  tanh((+-)0) returns (+-)0.
26970 <li>  tanh((+-)(inf)) returns (+-)1.
26971 </ul>
26972
26973 <p><small><a href="#Contents">Contents</a></small>
26974 <h4><a name="F.10.3" href="#F.10.3">F.10.3 Exponential and logarithmic functions</a></h4>
26975
26976 <p><small><a href="#Contents">Contents</a></small>
26977 <h5><a name="F.10.3.1" href="#F.10.3.1">F.10.3.1 The exp functions</a></h5>
26978 <p><a name="F.10.3.1p1" href="#F.10.3.1p1"><small>1</small></a>
26979 <ul>
26980 <li>  exp((+-)0) returns 1.
26981 <li>  exp(-(inf)) returns +0.
26982 <li>  exp(+(inf)) returns +(inf).
26983 <!--page 539 -->
26984 </ul>
26985
26986 <p><small><a href="#Contents">Contents</a></small>
26987 <h5><a name="F.10.3.2" href="#F.10.3.2">F.10.3.2 The exp2 functions</a></h5>
26988 <p><a name="F.10.3.2p1" href="#F.10.3.2p1"><small>1</small></a>
26989 <ul>
26990 <li>  exp2((+-)0) returns 1.
26991 <li>  exp2(-(inf)) returns +0.
26992 <li>  exp2(+(inf)) returns +(inf).
26993 </ul>
26994
26995 <p><small><a href="#Contents">Contents</a></small>
26996 <h5><a name="F.10.3.3" href="#F.10.3.3">F.10.3.3 The expm1 functions</a></h5>
26997 <p><a name="F.10.3.3p1" href="#F.10.3.3p1"><small>1</small></a>
26998 <ul>
26999 <li>  expm1((+-)0) returns (+-)0.
27000 <li>  expm1(-(inf)) returns -1.
27001 <li>  expm1(+(inf)) returns +(inf).
27002 </ul>
27003
27004 <p><small><a href="#Contents">Contents</a></small>
27005 <h5><a name="F.10.3.4" href="#F.10.3.4">F.10.3.4 The frexp functions</a></h5>
27006 <p><a name="F.10.3.4p1" href="#F.10.3.4p1"><small>1</small></a>
27007 <ul>
27008 <li>  frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
27009 <li>  frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
27010  pointed to by exp.
27011 <li>  frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
27012  (and returns a NaN).
27013 </ul>
27014 <p><a name="F.10.3.4p2" href="#F.10.3.4p2"><small>2</small></a>
27015  frexp raises no floating-point exceptions.
27016 <p><a name="F.10.3.4p3" href="#F.10.3.4p3"><small>3</small></a>
27017  When the radix of the argument is a power of 2, the returned value is exact and is
27018  independent of the current rounding direction mode.
27019 <p><a name="F.10.3.4p4" href="#F.10.3.4p4"><small>4</small></a>
27020  On a binary system, the body of the frexp function might be
27021 <pre>
27022          {
27023                 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
27024                 return scalbn(value, -(*exp));
27025          }
27026 </pre>
27027
27028 <p><small><a href="#Contents">Contents</a></small>
27029 <h5><a name="F.10.3.5" href="#F.10.3.5">F.10.3.5 The ilogb functions</a></h5>
27030 <p><a name="F.10.3.5p1" href="#F.10.3.5p1"><small>1</small></a>
27031  When the correct result is representable in the range of the return type, the returned value
27032  is exact and is independent of the current rounding direction mode.
27033 <p><a name="F.10.3.5p2" href="#F.10.3.5p2"><small>2</small></a>
27034  If the correct result is outside the range of the return type, the numeric result is
27035  unspecified and the ''invalid'' floating-point exception is raised.
27036 <p><a name="F.10.3.5p3" href="#F.10.3.5p3"><small>3</small></a>
27037  ilogb(x), for x zero, infinite, or NaN, raises the ''invalid'' floating-point exception and
27038  returns the value specified in <a href="#7.12.6.5">7.12.6.5</a>.
27039 <!--page 540 -->
27040
27041 <p><small><a href="#Contents">Contents</a></small>
27042 <h5><a name="F.10.3.6" href="#F.10.3.6">F.10.3.6 The ldexp functions</a></h5>
27043 <p><a name="F.10.3.6p1" href="#F.10.3.6p1"><small>1</small></a>
27044  On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
27045
27046 <p><small><a href="#Contents">Contents</a></small>
27047 <h5><a name="F.10.3.7" href="#F.10.3.7">F.10.3.7 The log functions</a></h5>
27048 <p><a name="F.10.3.7p1" href="#F.10.3.7p1"><small>1</small></a>
27049 <ul>
27050 <li>  log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
27051 <li>  log(1) returns +0.
27052 <li>  log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
27053 <li>  log(+(inf)) returns +(inf).
27054 </ul>
27055
27056 <p><small><a href="#Contents">Contents</a></small>
27057 <h5><a name="F.10.3.8" href="#F.10.3.8">F.10.3.8 The log10 functions</a></h5>
27058 <p><a name="F.10.3.8p1" href="#F.10.3.8p1"><small>1</small></a>
27059 <ul>
27060 <li>  log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
27061 <li>  log10(1) returns +0.
27062 <li>  log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
27063 <li>  log10(+(inf)) returns +(inf).
27064 </ul>
27065
27066 <p><small><a href="#Contents">Contents</a></small>
27067 <h5><a name="F.10.3.9" href="#F.10.3.9">F.10.3.9 The log1p functions</a></h5>
27068 <p><a name="F.10.3.9p1" href="#F.10.3.9p1"><small>1</small></a>
27069 <ul>
27070 <li>  log1p((+-)0) returns (+-)0.
27071 <li>  log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
27072 <li>  log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
27073  x &lt; -1.
27074 <li>  log1p(+(inf)) returns +(inf).
27075 </ul>
27076
27077 <p><small><a href="#Contents">Contents</a></small>
27078 <h5><a name="F.10.3.10" href="#F.10.3.10">F.10.3.10 The log2 functions</a></h5>
27079 <p><a name="F.10.3.10p1" href="#F.10.3.10p1"><small>1</small></a>
27080 <ul>
27081 <li>  log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
27082 <li>  log2(1) returns +0.
27083 <li>  log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
27084 <li>  log2(+(inf)) returns +(inf).
27085 </ul>
27086
27087 <p><small><a href="#Contents">Contents</a></small>
27088 <h5><a name="F.10.3.11" href="#F.10.3.11">F.10.3.11 The logb functions</a></h5>
27089 <p><a name="F.10.3.11p1" href="#F.10.3.11p1"><small>1</small></a>
27090 <ul>
27091 <li>  logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
27092 <li>  logb((+-)(inf)) returns +(inf).
27093 </ul>
27094 <p><a name="F.10.3.11p2" href="#F.10.3.11p2"><small>2</small></a>
27095  The returned value is exact and is independent of the current rounding direction mode.
27096 <!--page 541 -->
27097
27098 <p><small><a href="#Contents">Contents</a></small>
27099 <h5><a name="F.10.3.12" href="#F.10.3.12">F.10.3.12 The modf functions</a></h5>
27100 <p><a name="F.10.3.12p1" href="#F.10.3.12p1"><small>1</small></a>
27101 <ul>
27102 <li>  modf((+-)x, iptr) returns a result with the same sign as x.
27103 <li>  modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
27104 <li>  modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
27105  NaN).
27106 </ul>
27107 <p><a name="F.10.3.12p2" href="#F.10.3.12p2"><small>2</small></a>
27108  The returned values are exact and are independent of the current rounding direction
27109  mode.
27110 <p><a name="F.10.3.12p3" href="#F.10.3.12p3"><small>3</small></a>
27111  modf behaves as though implemented by
27112 <pre>
27113          #include <a href="#7.12">&lt;math.h&gt;</a>
27114          #include <a href="#7.6">&lt;fenv.h&gt;</a>
27115          #pragma STDC FENV_ACCESS ON
27116          double modf(double value, double *iptr)
27117          {
27118               int save_round = fegetround();
27119               fesetround(FE_TOWARDZERO);
27120               *iptr = nearbyint(value);
27121               fesetround(save_round);
27122               return copysign(
27123                    isinf(value) ? 0.0 :
27124                         value - (*iptr), value);
27125          }
27126 </pre>
27127
27128 <p><small><a href="#Contents">Contents</a></small>
27129 <h5><a name="F.10.3.13" href="#F.10.3.13">F.10.3.13 The scalbn and scalbln functions</a></h5>
27130 <p><a name="F.10.3.13p1" href="#F.10.3.13p1"><small>1</small></a>
27131 <ul>
27132 <li>  scalbn((+-)0, n) returns (+-)0.
27133 <li>  scalbn(x, 0) returns x.
27134 <li>  scalbn((+-)(inf), n) returns (+-)(inf).
27135 </ul>
27136 <p><a name="F.10.3.13p2" href="#F.10.3.13p2"><small>2</small></a>
27137  If the calculation does not overflow or underflow, the returned value is exact and
27138  independent of the current rounding direction mode.
27139 <!--page 542 -->
27140
27141 <p><small><a href="#Contents">Contents</a></small>
27142 <h4><a name="F.10.4" href="#F.10.4">F.10.4 Power and absolute value functions</a></h4>
27143
27144 <p><small><a href="#Contents">Contents</a></small>
27145 <h5><a name="F.10.4.1" href="#F.10.4.1">F.10.4.1 The cbrt functions</a></h5>
27146 <p><a name="F.10.4.1p1" href="#F.10.4.1p1"><small>1</small></a>
27147 <ul>
27148 <li>  cbrt((+-)0) returns (+-)0.
27149 <li>  cbrt((+-)(inf)) returns (+-)(inf).
27150 </ul>
27151
27152 <p><small><a href="#Contents">Contents</a></small>
27153 <h5><a name="F.10.4.2" href="#F.10.4.2">F.10.4.2 The fabs functions</a></h5>
27154 <p><a name="F.10.4.2p1" href="#F.10.4.2p1"><small>1</small></a>
27155 <ul>
27156 <li>  fabs((+-)0) returns +0.
27157 <li>  fabs((+-)(inf)) returns +(inf).
27158 </ul>
27159 <p><a name="F.10.4.2p2" href="#F.10.4.2p2"><small>2</small></a>
27160  The returned value is exact and is independent of the current rounding direction mode.
27161
27162 <p><small><a href="#Contents">Contents</a></small>
27163 <h5><a name="F.10.4.3" href="#F.10.4.3">F.10.4.3 The hypot functions</a></h5>
27164 <p><a name="F.10.4.3p1" href="#F.10.4.3p1"><small>1</small></a>
27165 <ul>
27166 <li>  hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
27167 <li>  hypot(x, (+-)0) is equivalent to fabs(x).
27168 <li>  hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
27169 </ul>
27170
27171 <p><small><a href="#Contents">Contents</a></small>
27172 <h5><a name="F.10.4.4" href="#F.10.4.4">F.10.4.4 The pow functions</a></h5>
27173 <p><a name="F.10.4.4p1" href="#F.10.4.4p1"><small>1</small></a>
27174 <ul>
27175 <li>  pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
27176  for y an odd integer &lt; 0.
27177 <li>  pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
27178  for y &lt; 0, finite, and not an odd integer.
27179 <li>  pow((+-)0, -(inf)) returns +(inf) and may raise the ''divide-by-zero'' floating-point
27180  exception.
27181 <li>  pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
27182 <li>  pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
27183 <li>  pow(-1, (+-)(inf)) returns 1.
27184 <li>  pow(+1, y) returns 1 for any y, even a NaN.
27185 <li>  pow(x, (+-)0) returns 1 for any x, even a NaN.
27186 <li>  pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
27187  finite x &lt; 0 and finite non-integer y.
27188 <li>  pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
27189 <li>  pow(x, -(inf)) returns +0 for | x | &gt; 1.
27190 <li>  pow(x, +(inf)) returns +0 for | x | &lt; 1.
27191 <li>  pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
27192 <!--page 543 -->
27193 <li>  pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
27194 <li>  pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
27195 <li>  pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
27196 <li>  pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
27197 <li>  pow(+(inf), y) returns +0 for y &lt; 0.
27198 <li>  pow(+(inf), y) returns +(inf) for y &gt; 0.
27199 </ul>
27200
27201 <p><small><a href="#Contents">Contents</a></small>
27202 <h5><a name="F.10.4.5" href="#F.10.4.5">F.10.4.5 The sqrt functions</a></h5>
27203 <p><a name="F.10.4.5p1" href="#F.10.4.5p1"><small>1</small></a>
27204  sqrt is fully specified as a basic arithmetic operation in IEC 60559. The returned value
27205  is dependent on the current rounding direction mode.
27206
27207 <p><small><a href="#Contents">Contents</a></small>
27208 <h4><a name="F.10.5" href="#F.10.5">F.10.5 Error and gamma functions</a></h4>
27209
27210 <p><small><a href="#Contents">Contents</a></small>
27211 <h5><a name="F.10.5.1" href="#F.10.5.1">F.10.5.1 The erf functions</a></h5>
27212 <p><a name="F.10.5.1p1" href="#F.10.5.1p1"><small>1</small></a>
27213 <ul>
27214 <li>  erf((+-)0) returns (+-)0.
27215 <li>  erf((+-)(inf)) returns (+-)1.
27216 </ul>
27217
27218 <p><small><a href="#Contents">Contents</a></small>
27219 <h5><a name="F.10.5.2" href="#F.10.5.2">F.10.5.2 The erfc functions</a></h5>
27220 <p><a name="F.10.5.2p1" href="#F.10.5.2p1"><small>1</small></a>
27221 <ul>
27222 <li>  erfc(-(inf)) returns 2.
27223 <li>  erfc(+(inf)) returns +0.
27224 </ul>
27225
27226 <p><small><a href="#Contents">Contents</a></small>
27227 <h5><a name="F.10.5.3" href="#F.10.5.3">F.10.5.3 The lgamma functions</a></h5>
27228 <p><a name="F.10.5.3p1" href="#F.10.5.3p1"><small>1</small></a>
27229 <ul>
27230 <li>  lgamma(1) returns +0.
27231 <li>  lgamma(2) returns +0.
27232 <li>  lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
27233  x a negative integer or zero.
27234 <li>  lgamma(-(inf)) returns +(inf).
27235 <li>  lgamma(+(inf)) returns +(inf).
27236 </ul>
27237
27238 <p><small><a href="#Contents">Contents</a></small>
27239 <h5><a name="F.10.5.4" href="#F.10.5.4">F.10.5.4 The tgamma functions</a></h5>
27240 <p><a name="F.10.5.4p1" href="#F.10.5.4p1"><small>1</small></a>
27241 <ul>
27242 <li>  tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
27243 <li>  tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
27244  negative integer.
27245 <li>  tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
27246 <li>  tgamma(+(inf)) returns +(inf).
27247 <!--page 544 -->
27248 </ul>
27249
27250 <p><small><a href="#Contents">Contents</a></small>
27251 <h4><a name="F.10.6" href="#F.10.6">F.10.6 Nearest integer functions</a></h4>
27252
27253 <p><small><a href="#Contents">Contents</a></small>
27254 <h5><a name="F.10.6.1" href="#F.10.6.1">F.10.6.1 The ceil functions</a></h5>
27255 <p><a name="F.10.6.1p1" href="#F.10.6.1p1"><small>1</small></a>
27256 <ul>
27257 <li>  ceil((+-)0) returns (+-)0.
27258 <li>  ceil((+-)(inf)) returns (+-)(inf).
27259 </ul>
27260 <p><a name="F.10.6.1p2" href="#F.10.6.1p2"><small>2</small></a>
27261  The returned value is independent of the current rounding direction mode.
27262 <p><a name="F.10.6.1p3" href="#F.10.6.1p3"><small>3</small></a>
27263  The double version of ceil behaves as though implemented by
27264 <pre>
27265         #include <a href="#7.12">&lt;math.h&gt;</a>
27266         #include <a href="#7.6">&lt;fenv.h&gt;</a>
27267         #pragma STDC FENV_ACCESS ON
27268         double ceil(double x)
27269         {
27270              double result;
27271              int save_round = fegetround();
27272              fesetround(FE_UPWARD);
27273              result = rint(x); // or nearbyint instead of rint
27274              fesetround(save_round);
27275              return result;
27276         }
27277 </pre>
27278 <p><a name="F.10.6.1p4" href="#F.10.6.1p4"><small>4</small></a>
27279  The ceil functions may, but are not required to, raise the ''inexact'' floating-point
27280  exception for finite non-integer arguments, as this implementation does.
27281
27282 <p><small><a href="#Contents">Contents</a></small>
27283 <h5><a name="F.10.6.2" href="#F.10.6.2">F.10.6.2 The floor functions</a></h5>
27284 <p><a name="F.10.6.2p1" href="#F.10.6.2p1"><small>1</small></a>
27285 <ul>
27286 <li>  floor((+-)0) returns (+-)0.
27287 <li>  floor((+-)(inf)) returns (+-)(inf).
27288 </ul>
27289 <p><a name="F.10.6.2p2" href="#F.10.6.2p2"><small>2</small></a>
27290  The returned value and is independent of the current rounding direction mode.
27291 <p><a name="F.10.6.2p3" href="#F.10.6.2p3"><small>3</small></a>
27292  See the sample implementation for ceil in <a href="#F.10.6.1">F.10.6.1</a>. The floor functions may, but are
27293  not required to, raise the ''inexact'' floating-point exception for finite non-integer
27294  arguments, as that implementation does.
27295
27296 <p><small><a href="#Contents">Contents</a></small>
27297 <h5><a name="F.10.6.3" href="#F.10.6.3">F.10.6.3 The nearbyint functions</a></h5>
27298 <p><a name="F.10.6.3p1" href="#F.10.6.3p1"><small>1</small></a>
27299  The nearbyint functions use IEC 60559 rounding according to the current rounding
27300  direction. They do not raise the ''inexact'' floating-point exception if the result differs in
27301  value from the argument.
27302 <ul>
27303 <li>  nearbyint((+-)0) returns (+-)0 (for all rounding directions).
27304 <li>  nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
27305 <!--page 545 -->
27306 </ul>
27307
27308 <p><small><a href="#Contents">Contents</a></small>
27309 <h5><a name="F.10.6.4" href="#F.10.6.4">F.10.6.4 The rint functions</a></h5>
27310 <p><a name="F.10.6.4p1" href="#F.10.6.4p1"><small>1</small></a>
27311  The rint functions differ from the nearbyint functions only in that they do raise the
27312  ''inexact'' floating-point exception if the result differs in value from the argument.
27313
27314 <p><small><a href="#Contents">Contents</a></small>
27315 <h5><a name="F.10.6.5" href="#F.10.6.5">F.10.6.5 The lrint and llrint functions</a></h5>
27316 <p><a name="F.10.6.5p1" href="#F.10.6.5p1"><small>1</small></a>
27317  The lrint and llrint functions provide floating-to-integer conversion as prescribed
27318  by IEC 60559. They round according to the current rounding direction. If the rounded
27319  value is outside the range of the return type, the numeric result is unspecified and the
27320  ''invalid'' floating-point exception is raised. When they raise no other floating-point
27321  exception and the result differs from the argument, they raise the ''inexact'' floating-point
27322  exception.
27323
27324 <p><small><a href="#Contents">Contents</a></small>
27325 <h5><a name="F.10.6.6" href="#F.10.6.6">F.10.6.6 The round functions</a></h5>
27326 <p><a name="F.10.6.6p1" href="#F.10.6.6p1"><small>1</small></a>
27327 <ul>
27328 <li>  round((+-)0) returns (+-)0.
27329 <li>  round((+-)(inf)) returns (+-)(inf).
27330 </ul>
27331 <p><a name="F.10.6.6p2" href="#F.10.6.6p2"><small>2</small></a>
27332  The returned value is independent of the current rounding direction mode.
27333 <p><a name="F.10.6.6p3" href="#F.10.6.6p3"><small>3</small></a>
27334  The double version of round behaves as though implemented by
27335 <pre>
27336          #include <a href="#7.12">&lt;math.h&gt;</a>
27337          #include <a href="#7.6">&lt;fenv.h&gt;</a>
27338          #pragma STDC FENV_ACCESS ON
27339          double round(double x)
27340          {
27341               double result;
27342               fenv_t save_env;
27343               feholdexcept(&amp;save_env);
27344               result = rint(x);
27345               if (fetestexcept(FE_INEXACT)) {
27346                    fesetround(FE_TOWARDZERO);
27347                    result = rint(copysign(0.5 + fabs(x), x));
27348               }
27349               feupdateenv(&amp;save_env);
27350               return result;
27351          }
27352 </pre>
27353  The round functions may, but are not required to, raise the ''inexact'' floating-point
27354  exception for finite non-integer numeric arguments, as this implementation does.
27355 <!--page 546 -->
27356
27357 <p><small><a href="#Contents">Contents</a></small>
27358 <h5><a name="F.10.6.7" href="#F.10.6.7">F.10.6.7 The lround and llround functions</a></h5>
27359 <p><a name="F.10.6.7p1" href="#F.10.6.7p1"><small>1</small></a>
27360  The lround and llround functions differ from the lrint and llrint functions
27361  with the default rounding direction just in that the lround and llround functions
27362  round halfway cases away from zero and need not raise the ''inexact'' floating-point
27363  exception for non-integer arguments that round to within the range of the return type.
27364
27365 <p><small><a href="#Contents">Contents</a></small>
27366 <h5><a name="F.10.6.8" href="#F.10.6.8">F.10.6.8 The trunc functions</a></h5>
27367 <p><a name="F.10.6.8p1" href="#F.10.6.8p1"><small>1</small></a>
27368  The trunc functions use IEC 60559 rounding toward zero (regardless of the current
27369  rounding direction). The returned value is exact.
27370 <ul>
27371 <li>  trunc((+-)0) returns (+-)0.
27372 <li>  trunc((+-)(inf)) returns (+-)(inf).
27373 </ul>
27374 <p><a name="F.10.6.8p2" href="#F.10.6.8p2"><small>2</small></a>
27375  The returned value is independent of the current rounding direction mode. The trunc
27376  functions may, but are not required to, raise the ''inexact'' floating-point exception for
27377  finite non-integer arguments.
27378
27379 <p><small><a href="#Contents">Contents</a></small>
27380 <h4><a name="F.10.7" href="#F.10.7">F.10.7 Remainder functions</a></h4>
27381
27382 <p><small><a href="#Contents">Contents</a></small>
27383 <h5><a name="F.10.7.1" href="#F.10.7.1">F.10.7.1 The fmod functions</a></h5>
27384 <p><a name="F.10.7.1p1" href="#F.10.7.1p1"><small>1</small></a>
27385 <ul>
27386 <li>  fmod((+-)0, y) returns (+-)0 for y not zero.
27387 <li>  fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
27388  infinite or y zero (and neither is a NaN).
27389 <li>  fmod(x, (+-)(inf)) returns x for x not infinite.
27390 </ul>
27391 <p><a name="F.10.7.1p2" href="#F.10.7.1p2"><small>2</small></a>
27392  When subnormal results are supported, the returned value is exact and is independent of
27393  the current rounding direction mode.
27394 <p><a name="F.10.7.1p3" href="#F.10.7.1p3"><small>3</small></a>
27395  The double version of fmod behaves as though implemented by
27396 <!--page 547 -->
27397 <pre>
27398         #include <a href="#7.12">&lt;math.h&gt;</a>
27399         #include <a href="#7.6">&lt;fenv.h&gt;</a>
27400         #pragma STDC FENV_ACCESS ON
27401         double fmod(double x, double y)
27402         {
27403              double result;
27404              result = remainder(fabs(x), (y = fabs(y)));
27405              if (signbit(result)) result += y;
27406              return copysign(result, x);
27407         }
27408 </pre>
27409
27410 <p><small><a href="#Contents">Contents</a></small>
27411 <h5><a name="F.10.7.2" href="#F.10.7.2">F.10.7.2 The remainder functions</a></h5>
27412 <p><a name="F.10.7.2p1" href="#F.10.7.2p1"><small>1</small></a>
27413  The remainder functions are fully specified as a basic arithmetic operation in
27414  IEC 60559.
27415 <p><a name="F.10.7.2p2" href="#F.10.7.2p2"><small>2</small></a>
27416  When subnormal results are supported, the returned value is exact and is independent of
27417  the current rounding direction mode.
27418
27419 <p><small><a href="#Contents">Contents</a></small>
27420 <h5><a name="F.10.7.3" href="#F.10.7.3">F.10.7.3 The remquo functions</a></h5>
27421 <p><a name="F.10.7.3p1" href="#F.10.7.3p1"><small>1</small></a>
27422  The remquo functions follow the specifications for the remainder functions. They
27423  have no further specifications special to IEC 60559 implementations.
27424 <p><a name="F.10.7.3p2" href="#F.10.7.3p2"><small>2</small></a>
27425  When subnormal results are supported, the returned value is exact and is independent of
27426  the current rounding direction mode.
27427
27428 <p><small><a href="#Contents">Contents</a></small>
27429 <h4><a name="F.10.8" href="#F.10.8">F.10.8 Manipulation functions</a></h4>
27430
27431 <p><small><a href="#Contents">Contents</a></small>
27432 <h5><a name="F.10.8.1" href="#F.10.8.1">F.10.8.1 The copysign functions</a></h5>
27433 <p><a name="F.10.8.1p1" href="#F.10.8.1p1"><small>1</small></a>
27434  copysign is specified in the Appendix to IEC 60559.
27435 <p><a name="F.10.8.1p2" href="#F.10.8.1p2"><small>2</small></a>
27436  The returned value is exact and is independent of the current rounding direction mode.
27437
27438 <p><small><a href="#Contents">Contents</a></small>
27439 <h5><a name="F.10.8.2" href="#F.10.8.2">F.10.8.2 The nan functions</a></h5>
27440 <p><a name="F.10.8.2p1" href="#F.10.8.2p1"><small>1</small></a>
27441  All IEC 60559 implementations support quiet NaNs, in all floating formats.
27442 <p><a name="F.10.8.2p2" href="#F.10.8.2p2"><small>2</small></a>
27443  The returned value is exact and is independent of the current rounding direction mode.
27444
27445 <p><small><a href="#Contents">Contents</a></small>
27446 <h5><a name="F.10.8.3" href="#F.10.8.3">F.10.8.3 The nextafter functions</a></h5>
27447 <p><a name="F.10.8.3p1" href="#F.10.8.3p1"><small>1</small></a>
27448 <ul>
27449 <li>  nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
27450  for x finite and the function value infinite.
27451 <li>  nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
27452  exceptions for the function value subnormal or zero and x != y.
27453 </ul>
27454 <p><a name="F.10.8.3p2" href="#F.10.8.3p2"><small>2</small></a>
27455  Even though underflow or overflow can occur, the returned value is independent of the
27456  current rounding direction mode.
27457
27458 <p><small><a href="#Contents">Contents</a></small>
27459 <h5><a name="F.10.8.4" href="#F.10.8.4">F.10.8.4 The nexttoward functions</a></h5>
27460 <p><a name="F.10.8.4p1" href="#F.10.8.4p1"><small>1</small></a>
27461  No additional requirements beyond those on nextafter.
27462 <p><a name="F.10.8.4p2" href="#F.10.8.4p2"><small>2</small></a>
27463  Even though underflow or overflow can occur, the returned value is independent of the
27464  current rounding direction mode.
27465 <!--page 548 -->
27466
27467 <p><small><a href="#Contents">Contents</a></small>
27468 <h4><a name="F.10.9" href="#F.10.9">F.10.9 Maximum, minimum, and positive difference functions</a></h4>
27469
27470 <p><small><a href="#Contents">Contents</a></small>
27471 <h5><a name="F.10.9.1" href="#F.10.9.1">F.10.9.1 The fdim functions</a></h5>
27472 <p><a name="F.10.9.1p1" href="#F.10.9.1p1"><small>1</small></a>
27473  No additional requirements.
27474
27475 <p><small><a href="#Contents">Contents</a></small>
27476 <h5><a name="F.10.9.2" href="#F.10.9.2">F.10.9.2 The fmax functions</a></h5>
27477 <p><a name="F.10.9.2p1" href="#F.10.9.2p1"><small>1</small></a>
27478  If just one argument is a NaN, the fmax functions return the other argument (if both
27479  arguments are NaNs, the functions return a NaN).
27480 <p><a name="F.10.9.2p2" href="#F.10.9.2p2"><small>2</small></a>
27481  The returned value is exact and is independent of the current rounding direction mode.
27482 <p><a name="F.10.9.2p3" href="#F.10.9.2p3"><small>3</small></a>
27483  The body of the fmax function might be<sup><a href="#note374"><b>374)</b></a></sup>
27484 <pre>
27485         { return (isgreaterequal(x, y) ||
27486              isnan(y)) ? x : y; }
27487 </pre>
27488
27489 <p><b>Footnotes</b>
27490 <p><small><a name="note374" href="#note374">374)</a> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
27491  return +0; however, implementation in software might be impractical.
27492 </small>
27493
27494 <p><small><a href="#Contents">Contents</a></small>
27495 <h5><a name="F.10.9.3" href="#F.10.9.3">F.10.9.3 The fmin functions</a></h5>
27496 <p><a name="F.10.9.3p1" href="#F.10.9.3p1"><small>1</small></a>
27497  The fmin functions are analogous to the fmax functions (see <a href="#F.10.9.2">F.10.9.2</a>).
27498 <p><a name="F.10.9.3p2" href="#F.10.9.3p2"><small>2</small></a>
27499  The returned value is exact and is independent of the current rounding direction mode.
27500
27501 <p><small><a href="#Contents">Contents</a></small>
27502 <h4><a name="F.10.10" href="#F.10.10">F.10.10 Floating multiply-add</a></h4>
27503
27504 <p><small><a href="#Contents">Contents</a></small>
27505 <h5><a name="F.10.10.1" href="#F.10.10.1">F.10.10.1 The fma functions</a></h5>
27506 <p><a name="F.10.10.1p1" href="#F.10.10.1p1"><small>1</small></a>
27507 <ul>
27508 <li>  fma(x, y, z) computes xy + z, correctly rounded once.
27509 <li>  fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
27510  exception if one of x and y is infinite, the other is zero, and z is a NaN.
27511 <li>  fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
27512  one of x and y is infinite, the other is zero, and z is not a NaN.
27513 <li>  fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
27514  times y is an exact infinity and z is also an infinity but with the opposite sign.
27515  
27516  
27517  
27518  
27519 <!--page 549 -->
27520 </ul>
27521
27522 <p><small><a href="#Contents">Contents</a></small>
27523 <h4><a name="F.10.11" href="#F.10.11">F.10.11 Comparison macros</a></h4>
27524 <p><a name="F.10.11p1" href="#F.10.11p1"><small>1</small></a>
27525  Relational operators and their corresponding comparison macros (<a href="#7.12.14">7.12.14</a>) produce
27526  equivalent result values, even if argument values are represented in wider formats. Thus,
27527  comparison macro arguments represented in formats wider than their semantic types are
27528  not converted to the semantic types, unless the wide evaluation method converts operands
27529  of relational operators to their semantic types. The standard wide evaluation methods
27530  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
27531  operands of relational operators to their semantic types.
27532 <!--page 550 -->
27533
27534 <p><small><a href="#Contents">Contents</a></small>
27535 <h2><a name="G" href="#G">Annex G</a></h2>
27536 <pre>
27537                                        (normative)
27538                 IEC 60559-compatible complex arithmetic
27539 </pre>
27540
27541 <p><small><a href="#Contents">Contents</a></small>
27542 <h3><a name="G.1" href="#G.1">G.1 Introduction</a></h3>
27543 <p><a name="G.1p1" href="#G.1p1"><small>1</small></a>
27544  This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
27545  IEC 60559 real floating-point arithmetic. An implementation that defines
27546  __STDC_IEC_559_COMPLEX__ shall conform to the specifications in this annex.<sup><a href="#note375"><b>375)</b></a></sup>
27547
27548 <p><b>Footnotes</b>
27549 <p><small><a name="note375" href="#note375">375)</a> Implementations that do not define __STDC_IEC_559_COMPLEX__ are not required to conform
27550  to these specifications.
27551 </small>
27552
27553 <p><small><a href="#Contents">Contents</a></small>
27554 <h3><a name="G.2" href="#G.2">G.2 Types</a></h3>
27555 <p><a name="G.2p1" href="#G.2p1"><small>1</small></a>
27556  There is a new keyword _Imaginary, which is used to specify imaginary types. It is
27557  used as a type specifier within declaration specifiers in the same way as _Complex is
27558  (thus, _Imaginary float is a valid type name).
27559 <p><a name="G.2p2" href="#G.2p2"><small>2</small></a>
27560  There are three imaginary types, designated as float _Imaginary, double
27561  _Imaginary, and long double _Imaginary. The imaginary types (along with
27562  the real floating and complex types) are floating types.
27563 <p><a name="G.2p3" href="#G.2p3"><small>3</small></a>
27564  For imaginary types, the corresponding real type is given by deleting the keyword
27565  _Imaginary from the type name.
27566 <p><a name="G.2p4" href="#G.2p4"><small>4</small></a>
27567  Each imaginary type has the same representation and alignment requirements as the
27568  corresponding real type. The value of an object of imaginary type is the value of the real
27569  representation times the imaginary unit.
27570 <p><a name="G.2p5" href="#G.2p5"><small>5</small></a>
27571  The imaginary type domain comprises the imaginary types.
27572
27573 <p><small><a href="#Contents">Contents</a></small>
27574 <h3><a name="G.3" href="#G.3">G.3 Conventions</a></h3>
27575 <p><a name="G.3p1" href="#G.3p1"><small>1</small></a>
27576  A complex or imaginary value with at least one infinite part is regarded as an infinity
27577  (even if its other part is a NaN). A complex or imaginary value is a finite number if each
27578  of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
27579  a zero if each of its parts is a zero.
27580  
27581  
27582  
27583  
27584 <!--page 551 -->
27585
27586 <p><small><a href="#Contents">Contents</a></small>
27587 <h3><a name="G.4" href="#G.4">G.4 Conversions</a></h3>
27588
27589 <p><small><a href="#Contents">Contents</a></small>
27590 <h4><a name="G.4.1" href="#G.4.1">G.4.1 Imaginary types</a></h4>
27591 <p><a name="G.4.1p1" href="#G.4.1p1"><small>1</small></a>
27592  Conversions among imaginary types follow rules analogous to those for real floating
27593  types.
27594
27595 <p><small><a href="#Contents">Contents</a></small>
27596 <h4><a name="G.4.2" href="#G.4.2">G.4.2 Real and imaginary</a></h4>
27597 <p><a name="G.4.2p1" href="#G.4.2p1"><small>1</small></a>
27598  When a value of imaginary type is converted to a real type other than _Bool,<sup><a href="#note376"><b>376)</b></a></sup> the
27599  result is a positive zero.
27600 <p><a name="G.4.2p2" href="#G.4.2p2"><small>2</small></a>
27601  When a value of real type is converted to an imaginary type, the result is a positive
27602  imaginary zero.
27603
27604 <p><b>Footnotes</b>
27605 <p><small><a name="note376" href="#note376">376)</a> See <a href="#6.3.1.2">6.3.1.2</a>.
27606 </small>
27607
27608 <p><small><a href="#Contents">Contents</a></small>
27609 <h4><a name="G.4.3" href="#G.4.3">G.4.3 Imaginary and complex</a></h4>
27610 <p><a name="G.4.3p1" href="#G.4.3p1"><small>1</small></a>
27611  When a value of imaginary type is converted to a complex type, the real part of the
27612  complex result value is a positive zero and the imaginary part of the complex result value
27613  is determined by the conversion rules for the corresponding real types.
27614 <p><a name="G.4.3p2" href="#G.4.3p2"><small>2</small></a>
27615  When a value of complex type is converted to an imaginary type, the real part of the
27616  complex value is discarded and the value of the imaginary part is converted according to
27617  the conversion rules for the corresponding real types.
27618
27619 <p><small><a href="#Contents">Contents</a></small>
27620 <h3><a name="G.5" href="#G.5">G.5 Binary operators</a></h3>
27621 <p><a name="G.5p1" href="#G.5p1"><small>1</small></a>
27622  The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
27623  operation with an imaginary operand.
27624 <p><a name="G.5p2" href="#G.5p2"><small>2</small></a>
27625  For most operand types, the value of the result of a binary operator with an imaginary or
27626  complex operand is completely determined, with reference to real arithmetic, by the usual
27627  mathematical formula. For some operand types, the usual mathematical formula is
27628  problematic because of its treatment of infinities and because of undue overflow or
27629  underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
27630  not completely determined.
27631  
27632  
27633  
27634  
27635 <!--page 552 -->
27636
27637 <p><small><a href="#Contents">Contents</a></small>
27638 <h4><a name="G.5.1" href="#G.5.1">G.5.1 Multiplicative operators</a></h4>
27639 <p><b>Semantics</b>
27640 <p><a name="G.5.1p1" href="#G.5.1p1"><small>1</small></a>
27641  If one operand has real type and the other operand has imaginary type, then the result has
27642  imaginary type. If both operands have imaginary type, then the result has real type. (If
27643  either operand has complex type, then the result has complex type.)
27644 <p><a name="G.5.1p2" href="#G.5.1p2"><small>2</small></a>
27645  If the operands are not both complex, then the result and floating-point exception
27646  behavior of the * operator is defined by the usual mathematical formula:
27647 <pre>
27648         *                  u                   iv                 u + iv
27649 </pre>
27650  
27651 <pre>
27652         x                  xu                i(xv)            (xu) + i(xv)
27653 </pre>
27654  
27655 <pre>
27656         iy               i(yu)                -yv            (-yv) + i(yu)
27657 </pre>
27658  
27659 <pre>
27660         x + iy       (xu) + i(yu)        (-yv) + i(xv)
27661 </pre>
27662 <p><a name="G.5.1p3" href="#G.5.1p3"><small>3</small></a>
27663  If the second operand is not complex, then the result and floating-point exception
27664  behavior of the / operator is defined by the usual mathematical formula:
27665 <pre>
27666         /                   u                       iv
27667 </pre>
27668  
27669 <pre>
27670         x                  x/u                 i(-x/v)
27671 </pre>
27672  
27673 <pre>
27674         iy               i(y/u)                     y/v
27675 </pre>
27676  
27677 <pre>
27678         x + iy       (x/u) + i(y/u)        (y/v) + i(-x/v)
27679 </pre>
27680 <p><a name="G.5.1p4" href="#G.5.1p4"><small>4</small></a>
27681  The * and / operators satisfy the following infinity properties for all real, imaginary, and
27682  complex operands:<sup><a href="#note377"><b>377)</b></a></sup>
27683 <ul>
27684 <li>  if one operand is an infinity and the other operand is a nonzero finite number or an
27685  infinity, then the result of the * operator is an infinity;
27686 <li>  if the first operand is an infinity and the second operand is a finite number, then the
27687  result of the / operator is an infinity;
27688 <li>  if the first operand is a finite number and the second operand is an infinity, then the
27689  result of the / operator is a zero;
27690  
27691  
27692  
27693  
27694 <!--page 553 -->
27695 <li>  if the first operand is a nonzero finite number or an infinity and the second operand is
27696  a zero, then the result of the / operator is an infinity.
27697 </ul>
27698 <p><a name="G.5.1p5" href="#G.5.1p5"><small>5</small></a>
27699  If both operands of the * operator are complex or if the second operand of the / operator
27700  is complex, the operator raises floating-point exceptions if appropriate for the calculation
27701  of the parts of the result, and may raise spurious floating-point exceptions.
27702 <p><a name="G.5.1p6" href="#G.5.1p6"><small>6</small></a>
27703  EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
27704  that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
27705 <!--page 554 -->
27706 <pre>
27707           #include <a href="#7.12">&lt;math.h&gt;</a>
27708           #include <a href="#7.3">&lt;complex.h&gt;</a>
27709           /* Multiply z * w ... */
27710           double complex _Cmultd(double complex z, double complex w)
27711           {
27712                  #pragma STDC FP_CONTRACT OFF
27713                  double a, b, c, d, ac, bd, ad, bc, x, y;
27714                  a = creal(z); b = cimag(z);
27715                  c = creal(w); d = cimag(w);
27716                  ac = a * c;       bd = b * d;
27717                  ad = a * d;       bc = b * c;
27718                  x = ac - bd; y = ad + bc;
27719                  if (isnan(x) &amp;&amp; isnan(y)) {
27720                          /* Recover infinities that computed as NaN+iNaN ... */
27721                          int recalc = 0;
27722                          if (isinf(a) || isinf(b)) { // z is infinite
27723                                  /* "Box" the infinity and change NaNs in the other factor to 0 */
27724                                  a = copysign(isinf(a) ? 1.0 : 0.0, a);
27725                                  b = copysign(isinf(b) ? 1.0 : 0.0, b);
27726                                  if (isnan(c)) c = copysign(0.0, c);
27727                                  if (isnan(d)) d = copysign(0.0, d);
27728                                  recalc = 1;
27729                          }
27730                          if (isinf(c) || isinf(d)) { // w is infinite
27731                                  /* "Box" the infinity and change NaNs in the other factor to 0 */
27732                                  c = copysign(isinf(c) ? 1.0 : 0.0, c);
27733                                  d = copysign(isinf(d) ? 1.0 : 0.0, d);
27734                                  if (isnan(a)) a = copysign(0.0, a);
27735                                  if (isnan(b)) b = copysign(0.0, b);
27736                                  recalc = 1;
27737                          }
27738                          if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
27739                                                 isinf(ad) || isinf(bc))) {
27740                                  /* Recover infinities from overflow by changing NaNs to 0 ... */
27741                                  if (isnan(a)) a = copysign(0.0, a);
27742                                  if (isnan(b)) b = copysign(0.0, b);
27743                                  if (isnan(c)) c = copysign(0.0, c);
27744                                  if (isnan(d)) d = copysign(0.0, d);
27745                                  recalc = 1;
27746                          }
27747                          if (recalc) {
27748                                    x = INFINITY * ( a * c - b * d );
27749                                    y = INFINITY * ( a * d + b * c );
27750                         }
27751                   }
27752                   return x + I * y;
27753          }
27754 </pre>
27755 <p><a name="G.5.1p7" href="#G.5.1p7"><small>7</small></a>
27756  This implementation achieves the required treatment of infinities at the cost of only one isnan test in
27757  ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
27758  
27759 <p><a name="G.5.1p8" href="#G.5.1p8"><small>8</small></a>
27760  EXAMPLE 2      Division of two double _Complex operands could be implemented as follows.
27761 <!--page 555 -->
27762 <pre>
27763          #include <a href="#7.12">&lt;math.h&gt;</a>
27764          #include <a href="#7.3">&lt;complex.h&gt;</a>
27765          /* Divide z / w ... */
27766          double complex _Cdivd(double complex z, double complex w)
27767          {
27768                 #pragma STDC FP_CONTRACT OFF
27769                 double a, b, c, d, logbw, denom, x, y;
27770                 int ilogbw = 0;
27771                 a = creal(z); b = cimag(z);
27772                 c = creal(w); d = cimag(w);
27773                 logbw = logb(fmax(fabs(c), fabs(d)));
27774                 if (isfinite(logbw)) {
27775                        ilogbw = (int)logbw;
27776                        c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
27777                 }
27778                 denom = c * c + d * d;
27779                 x = scalbn((a * c + b * d) / denom, -ilogbw);
27780                 y = scalbn((b * c - a * d) / denom, -ilogbw);
27781                   /* Recover infinities and zeros that computed as NaN+iNaN;                 */
27782                   /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
27783                   if (isnan(x) &amp;&amp; isnan(y)) {
27784                         if ((denom == 0.0) &amp;&amp;
27785                               (!isnan(a) || !isnan(b))) {
27786                               x = copysign(INFINITY, c) * a;
27787                               y = copysign(INFINITY, c) * b;
27788                         }
27789                         else if ((isinf(a) || isinf(b)) &amp;&amp;
27790                               isfinite(c) &amp;&amp; isfinite(d)) {
27791                               a = copysign(isinf(a) ? 1.0 : 0.0,                        a);
27792                               b = copysign(isinf(b) ? 1.0 : 0.0,                        b);
27793                               x = INFINITY * ( a * c + b * d );
27794                               y = INFINITY * ( b * c - a * d );
27795                         }
27796                         else if ((logbw == INFINITY) &amp;&amp;
27797                               isfinite(a) &amp;&amp; isfinite(b)) {
27798                               c = copysign(isinf(c) ? 1.0 : 0.0,                        c);
27799                               d = copysign(isinf(d) ? 1.0 : 0.0,                        d);
27800                               x = 0.0 * ( a * c + b * d );
27801                               y = 0.0 * ( b * c - a * d );
27802                         }
27803                   }
27804                   return x + I * y;
27805          }
27806 </pre>
27807 <p><a name="G.5.1p9" href="#G.5.1p9"><small>9</small></a>
27808  Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
27809  for multiplication. In the spirit of the multiplication example above, this code does not defend against
27810  overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
27811  with division, provides better roundoff characteristics.
27812  
27813
27814 <p><b>Footnotes</b>
27815 <p><small><a name="note377" href="#note377">377)</a> These properties are already implied for those cases covered in the tables, but are required for all cases
27816  (at least where the state for CX_LIMITED_RANGE is ''off'').
27817 </small>
27818
27819 <p><small><a href="#Contents">Contents</a></small>
27820 <h4><a name="G.5.2" href="#G.5.2">G.5.2 Additive operators</a></h4>
27821 <p><b>Semantics</b>
27822 <p><a name="G.5.2p1" href="#G.5.2p1"><small>1</small></a>
27823  If both operands have imaginary type, then the result has imaginary type. (If one operand
27824  has real type and the other operand has imaginary type, or if either operand has complex
27825  type, then the result has complex type.)
27826 <p><a name="G.5.2p2" href="#G.5.2p2"><small>2</small></a>
27827  In all cases the result and floating-point exception behavior of a + or - operator is defined
27828  by the usual mathematical formula:
27829 <pre>
27830         + or -              u                       iv                    u + iv
27831 </pre>
27832  
27833 <pre>
27834         x                 x(+-)u                     x (+-) iv              (x (+-) u) (+-) iv
27835 </pre>
27836  
27837 <pre>
27838         iy               (+-)u + iy                 i(y (+-) v)             (+-)u + i(y (+-) v)
27839 </pre>
27840  
27841 <pre>
27842         x + iy         (x (+-) u) + iy            x + i(y (+-) v)        (x (+-) u) + i(y (+-) v)
27843 </pre>
27844
27845 <p><small><a href="#Contents">Contents</a></small>
27846 <h3><a name="G.6" href="#G.6">G.6 Complex arithmetic &lt;complex.h&gt;</a></h3>
27847 <p><a name="G.6p1" href="#G.6p1"><small>1</small></a>
27848  The macros
27849 <pre>
27850          imaginary
27851 </pre>
27852  and
27853 <pre>
27854          _Imaginary_I
27855 </pre>
27856  are defined, respectively, as _Imaginary and a constant expression of type const
27857  float _Imaginary with the value of the imaginary unit. The macro
27858 <pre>
27859          I
27860 </pre>
27861  is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
27862  the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
27863  imaginary.
27864 <p><a name="G.6p2" href="#G.6p2"><small>2</small></a>
27865  This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
27866  particularly suited to IEC 60559 implementations. For families of functions, the
27867  specifications apply to all of the functions even though only the principal function is
27868 <!--page 556 -->
27869  shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
27870  and the result, the result has the same sign as the argument.
27871 <p><a name="G.6p3" href="#G.6p3"><small>3</small></a>
27872  The functions are continuous onto both sides of their branch cuts, taking into account the
27873  sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)2.  -
27874 <p><a name="G.6p4" href="#G.6p4"><small>4</small></a>
27875  Since complex and imaginary values are composed of real values, each function may be
27876  regarded as computing real values from real values. Except as noted, the functions treat
27877  real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
27878  manner consistent with the specifications for real functions in F.10.<sup><a href="#note378"><b>378)</b></a></sup>
27879 <p><a name="G.6p5" href="#G.6p5"><small>5</small></a>
27880  The functions cimag, conj, cproj, and creal are fully specified for all
27881  implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
27882  point exceptions.
27883 <p><a name="G.6p6" href="#G.6p6"><small>6</small></a>
27884  Each of the functions cabs and carg is specified by a formula in terms of a real
27885  function (whose special cases are covered in <a href="#F">annex F</a>):
27886 <pre>
27887          cabs(x + iy) = hypot(x, y)
27888          carg(x + iy) = atan2(y, x)
27889 </pre>
27890 <p><a name="G.6p7" href="#G.6p7"><small>7</small></a>
27891  Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
27892  a formula in terms of other complex functions (whose special cases are specified below):
27893 <pre>
27894          casin(z)        =   -i casinh(iz)
27895          catan(z)        =   -i catanh(iz)
27896          ccos(z)         =   ccosh(iz)
27897          csin(z)         =   -i csinh(iz)
27898          ctan(z)         =   -i ctanh(iz)
27899 </pre>
27900 <p><a name="G.6p8" href="#G.6p8"><small>8</small></a>
27901  For the other functions, the following subclauses specify behavior for special cases,
27902  including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
27903  families of functions, the specifications apply to all of the functions even though only the
27904  principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
27905  specifications for the upper half-plane imply the specifications for the lower half-plane; if
27906  the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
27907  specifications for the first quadrant imply the specifications for the other three quadrants.
27908 <p><a name="G.6p9" href="#G.6p9"><small>9</small></a>
27909  In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
27910  
27911  
27912  
27913  
27914 <!--page 557 -->
27915
27916 <p><b>Footnotes</b>
27917 <p><small><a name="note378" href="#note378">378)</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
27918  other part is a NaN.
27919 </small>
27920
27921 <p><small><a href="#Contents">Contents</a></small>
27922 <h4><a name="G.6.1" href="#G.6.1">G.6.1 Trigonometric functions</a></h4>
27923
27924 <p><small><a href="#Contents">Contents</a></small>
27925 <h5><a name="G.6.1.1" href="#G.6.1.1">G.6.1.1 The cacos functions</a></h5>
27926 <p><a name="G.6.1.1p1" href="#G.6.1.1p1"><small>1</small></a>
27927 <ul>
27928 <li>  cacos(conj(z)) = conj(cacos(z)).
27929 <li>  cacos((+-)0 + i0) returns pi /2 - i0.
27930 <li>  cacos((+-)0 + iNaN) returns pi /2 + iNaN.
27931 <li>  cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
27932 <li>  cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
27933  point exception, for nonzero finite x.
27934 <li>  cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
27935 <li>  cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
27936 <li>  cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
27937 <li>  cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
27938 <li>  cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
27939  result is unspecified).
27940 <li>  cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
27941  point exception, for finite y.
27942 <li>  cacos(NaN + i (inf)) returns NaN - i (inf).
27943 <li>  cacos(NaN + iNaN) returns NaN + iNaN.
27944 </ul>
27945
27946 <p><small><a href="#Contents">Contents</a></small>
27947 <h4><a name="G.6.2" href="#G.6.2">G.6.2 Hyperbolic functions</a></h4>
27948
27949 <p><small><a href="#Contents">Contents</a></small>
27950 <h5><a name="G.6.2.1" href="#G.6.2.1">G.6.2.1 The cacosh functions</a></h5>
27951 <p><a name="G.6.2.1p1" href="#G.6.2.1p1"><small>1</small></a>
27952 <ul>
27953 <li>  cacosh(conj(z)) = conj(cacosh(z)).
27954 <li>  cacosh((+-)0 + i0) returns +0 + ipi /2.
27955 <li>  cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
27956 <li>  cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
27957  floating-point exception, for finite x.
27958 <li>  cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
27959 <li>  cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
27960 <li>  cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
27961 <li>  cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
27962 <li>  cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
27963 <!--page 558 -->
27964 <li>  cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
27965  floating-point exception, for finite y.
27966 <li>  cacosh(NaN + i (inf)) returns +(inf) + iNaN.
27967 <li>  cacosh(NaN + iNaN) returns NaN + iNaN.
27968 </ul>
27969
27970 <p><small><a href="#Contents">Contents</a></small>
27971 <h5><a name="G.6.2.2" href="#G.6.2.2">G.6.2.2 The casinh functions</a></h5>
27972 <p><a name="G.6.2.2p1" href="#G.6.2.2p1"><small>1</small></a>
27973 <ul>
27974 <li>  casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
27975 <li>  casinh(+0 + i0) returns 0 + i0.
27976 <li>  casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
27977 <li>  casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
27978  floating-point exception, for finite x.
27979 <li>  casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
27980 <li>  casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
27981 <li>  casinh(+(inf) + iNaN) returns +(inf) + iNaN.
27982 <li>  casinh(NaN + i0) returns NaN + i0.
27983 <li>  casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
27984  floating-point exception, for finite nonzero y.
27985 <li>  casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
27986  is unspecified).
27987 <li>  casinh(NaN + iNaN) returns NaN + iNaN.
27988 </ul>
27989
27990 <p><small><a href="#Contents">Contents</a></small>
27991 <h5><a name="G.6.2.3" href="#G.6.2.3">G.6.2.3 The catanh functions</a></h5>
27992 <p><a name="G.6.2.3p1" href="#G.6.2.3p1"><small>1</small></a>
27993 <ul>
27994 <li>  catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
27995 <li>  catanh(+0 + i0) returns +0 + i0.
27996 <li>  catanh(+0 + iNaN) returns +0 + iNaN.
27997 <li>  catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
27998  exception.
27999 <li>  catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
28000 <li>  catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
28001  floating-point exception, for nonzero finite x.
28002 <li>  catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
28003 <li>  catanh(+(inf) + i (inf)) returns +0 + ipi /2.
28004 <li>  catanh(+(inf) + iNaN) returns +0 + iNaN.
28005 <!--page 559 -->
28006 <li>  catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
28007  floating-point exception, for finite y.
28008 <li>  catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
28009  unspecified).
28010 <li>  catanh(NaN + iNaN) returns NaN + iNaN.
28011 </ul>
28012
28013 <p><small><a href="#Contents">Contents</a></small>
28014 <h5><a name="G.6.2.4" href="#G.6.2.4">G.6.2.4 The ccosh functions</a></h5>
28015 <p><a name="G.6.2.4p1" href="#G.6.2.4p1"><small>1</small></a>
28016 <ul>
28017 <li>  ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
28018 <li>  ccosh(+0 + i0) returns 1 + i0.
28019 <li>  ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
28020  result is unspecified) and raises the ''invalid'' floating-point exception.
28021 <li>  ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
28022  result is unspecified).
28023 <li>  ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
28024  exception, for finite nonzero x.
28025 <li>  ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28026  point exception, for finite nonzero x.
28027 <li>  ccosh(+(inf) + i0) returns +(inf) + i0.
28028 <li>  ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
28029 <li>  ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
28030  unspecified) and raises the ''invalid'' floating-point exception.
28031 <li>  ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
28032 <li>  ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
28033  result is unspecified).
28034 <li>  ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28035  point exception, for all nonzero numbers y.
28036 <li>  ccosh(NaN + iNaN) returns NaN + iNaN.
28037 </ul>
28038
28039 <p><small><a href="#Contents">Contents</a></small>
28040 <h5><a name="G.6.2.5" href="#G.6.2.5">G.6.2.5 The csinh functions</a></h5>
28041 <p><a name="G.6.2.5p1" href="#G.6.2.5p1"><small>1</small></a>
28042 <ul>
28043 <li>  csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
28044 <li>  csinh(+0 + i0) returns +0 + i0.
28045 <li>  csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
28046  unspecified) and raises the ''invalid'' floating-point exception.
28047 <li>  csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
28048  unspecified).
28049 <!--page 560 -->
28050 <li>  csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
28051  exception, for positive finite x.
28052 <li>  csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28053  point exception, for finite nonzero x.
28054 <li>  csinh(+(inf) + i0) returns +(inf) + i0.
28055 <li>  csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
28056 <li>  csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
28057  unspecified) and raises the ''invalid'' floating-point exception.
28058 <li>  csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
28059  is unspecified).
28060 <li>  csinh(NaN + i0) returns NaN + i0.
28061 <li>  csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28062  point exception, for all nonzero numbers y.
28063 <li>  csinh(NaN + iNaN) returns NaN + iNaN.
28064 </ul>
28065
28066 <p><small><a href="#Contents">Contents</a></small>
28067 <h5><a name="G.6.2.6" href="#G.6.2.6">G.6.2.6 The ctanh functions</a></h5>
28068 <p><a name="G.6.2.6p1" href="#G.6.2.6p1"><small>1</small></a>
28069 <ul>
28070 <li>  ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
28071 <li>  ctanh(+0 + i0) returns +0 + i0.
28072 <li>  ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
28073  exception, for finite x.
28074 <li>  ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28075  point exception, for finite x.
28076 <li>  ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
28077 <li>  ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
28078  is unspecified).
28079 <li>  ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
28080  result is unspecified).
28081 <li>  ctanh(NaN + i0) returns NaN + i0.
28082 <li>  ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28083  point exception, for all nonzero numbers y.
28084 <li>  ctanh(NaN + iNaN) returns NaN + iNaN.
28085 <!--page 561 -->
28086 </ul>
28087
28088 <p><small><a href="#Contents">Contents</a></small>
28089 <h4><a name="G.6.3" href="#G.6.3">G.6.3 Exponential and logarithmic functions</a></h4>
28090
28091 <p><small><a href="#Contents">Contents</a></small>
28092 <h5><a name="G.6.3.1" href="#G.6.3.1">G.6.3.1 The cexp functions</a></h5>
28093 <p><a name="G.6.3.1p1" href="#G.6.3.1p1"><small>1</small></a>
28094 <ul>
28095 <li>  cexp(conj(z)) = conj(cexp(z)).
28096 <li>  cexp((+-)0 + i0) returns 1 + i0.
28097 <li>  cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
28098  exception, for finite x.
28099 <li>  cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28100  point exception, for finite x.
28101 <li>  cexp(+(inf) + i0) returns +(inf) + i0.
28102 <li>  cexp(-(inf) + iy) returns +0 cis(y), for finite y.
28103 <li>  cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
28104 <li>  cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
28105  the result are unspecified).
28106 <li>  cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
28107  exception (where the sign of the real part of the result is unspecified).
28108 <li>  cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
28109  of the result are unspecified).
28110 <li>  cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
28111  is unspecified).
28112 <li>  cexp(NaN + i0) returns NaN + i0.
28113 <li>  cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28114  point exception, for all nonzero numbers y.
28115 <li>  cexp(NaN + iNaN) returns NaN + iNaN.
28116 </ul>
28117
28118 <p><small><a href="#Contents">Contents</a></small>
28119 <h5><a name="G.6.3.2" href="#G.6.3.2">G.6.3.2 The clog functions</a></h5>
28120 <p><a name="G.6.3.2p1" href="#G.6.3.2p1"><small>1</small></a>
28121 <ul>
28122 <li>  clog(conj(z)) = conj(clog(z)).
28123 <li>  clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
28124  exception.
28125 <li>  clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
28126  exception.
28127 <li>  clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
28128 <li>  clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28129  point exception, for finite x.
28130 <!--page 562 -->
28131 <li>  clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
28132 <li>  clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
28133 <li>  clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
28134 <li>  clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
28135 <li>  clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
28136 <li>  clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28137  point exception, for finite y.
28138 <li>  clog(NaN + i (inf)) returns +(inf) + iNaN.
28139 <li>  clog(NaN + iNaN) returns NaN + iNaN.
28140 </ul>
28141
28142 <p><small><a href="#Contents">Contents</a></small>
28143 <h4><a name="G.6.4" href="#G.6.4">G.6.4 Power and absolute-value functions</a></h4>
28144
28145 <p><small><a href="#Contents">Contents</a></small>
28146 <h5><a name="G.6.4.1" href="#G.6.4.1">G.6.4.1 The cpow functions</a></h5>
28147 <p><a name="G.6.4.1p1" href="#G.6.4.1p1"><small>1</small></a>
28148  The cpow functions raise floating-point exceptions if appropriate for the calculation of
28149  the parts of the result, and may also raise spurious floating-point exceptions.<sup><a href="#note379"><b>379)</b></a></sup>
28150
28151 <p><b>Footnotes</b>
28152 <p><small><a name="note379" href="#note379">379)</a> This allows cpow( z , c ) to be implemented as cexp(c      clog( z )) without precluding
28153  implementations that treat special cases more carefully.
28154 </small>
28155
28156 <p><small><a href="#Contents">Contents</a></small>
28157 <h5><a name="G.6.4.2" href="#G.6.4.2">G.6.4.2 The csqrt functions</a></h5>
28158 <p><a name="G.6.4.2p1" href="#G.6.4.2p1"><small>1</small></a>
28159 <ul>
28160 <li>  csqrt(conj(z)) = conj(csqrt(z)).
28161 <li>  csqrt((+-)0 + i0) returns +0 + i0.
28162 <li>  csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
28163 <li>  csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28164  point exception, for finite x.
28165 <li>  csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
28166 <li>  csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
28167 <li>  csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
28168  result is unspecified).
28169 <li>  csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
28170 <li>  csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
28171  point exception, for finite y.
28172 <li>  csqrt(NaN + iNaN) returns NaN + iNaN.
28173  
28174  
28175  
28176  
28177 <!--page 563 -->
28178 </ul>
28179
28180 <p><small><a href="#Contents">Contents</a></small>
28181 <h3><a name="G.7" href="#G.7">G.7 Type-generic math &lt;tgmath.h&gt;</a></h3>
28182 <p><a name="G.7p1" href="#G.7p1"><small>1</small></a>
28183  Type-generic macros that accept complex arguments also accept imaginary arguments. If
28184  an argument is imaginary, the macro expands to an expression whose type is real,
28185  imaginary, or complex, as appropriate for the particular function: if the argument is
28186  imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
28187  types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
28188  the types of the others are complex.
28189 <p><a name="G.7p2" href="#G.7p2"><small>2</small></a>
28190  Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
28191  sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
28192  functions:
28193 <!--page 564 -->
28194 <pre>
28195          cos(iy)     =   cosh(y)
28196          sin(iy)     =   i sinh(y)
28197          tan(iy)     =   i tanh(y)
28198          cosh(iy)    =   cos(y)
28199          sinh(iy)    =   i sin(y)
28200          tanh(iy)    =   i tan(y)
28201          asin(iy)    =   i asinh(y)
28202          atan(iy)    =   i atanh(y)
28203          asinh(iy)   =   i asin(y)
28204          atanh(iy)   =   i atan(y)
28205 </pre>
28206
28207 <p><small><a href="#Contents">Contents</a></small>
28208 <h2><a name="H" href="#H">Annex H</a></h2>
28209 <pre>
28210                                      (informative)
28211                      Language independent arithmetic
28212 </pre>
28213
28214 <p><small><a href="#Contents">Contents</a></small>
28215 <h3><a name="H.1" href="#H.1">H.1 Introduction</a></h3>
28216 <p><a name="H.1p1" href="#H.1p1"><small>1</small></a>
28217  This annex documents the extent to which the C language supports the ISO/IEC 10967-1
28218  standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
28219  IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
28220
28221 <p><small><a href="#Contents">Contents</a></small>
28222 <h3><a name="H.2" href="#H.2">H.2 Types</a></h3>
28223 <p><a name="H.2p1" href="#H.2p1"><small>1</small></a>
28224  The relevant C arithmetic types meet the requirements of LIA-1 types if an
28225  implementation adds notification of exceptional arithmetic operations and meets the 1
28226  unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
28227
28228 <p><small><a href="#Contents">Contents</a></small>
28229 <h4><a name="H.2.1" href="#H.2.1">H.2.1 Boolean type</a></h4>
28230 <p><a name="H.2.1p1" href="#H.2.1p1"><small>1</small></a>
28231  The LIA-1 data type Boolean is implemented by the C data type bool with values of
28232  true and false, all from <a href="#7.18">&lt;stdbool.h&gt;</a>.
28233
28234 <p><small><a href="#Contents">Contents</a></small>
28235 <h4><a name="H.2.2" href="#H.2.2">H.2.2 Integer types</a></h4>
28236 <p><a name="H.2.2p1" href="#H.2.2p1"><small>1</small></a>
28237  The signed C integer types int, long int, long long int, and the corresponding
28238  unsigned types are compatible with LIA-1. If an implementation adds support for the
28239  LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
28240  LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
28241  in that overflows or out-of-bounds results silently wrap. An implementation that defines
28242  signed integer types as also being modulo need not detect integer overflow, in which case,
28243  only integer divide-by-zero need be detected.
28244 <p><a name="H.2.2p2" href="#H.2.2p2"><small>2</small></a>
28245  The parameters for the integer data types can be accessed by the following:
28246  maxint        INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
28247 <pre>
28248                ULLONG_MAX
28249 </pre>
28250  minint        INT_MIN, LONG_MIN, LLONG_MIN
28251 <p><a name="H.2.2p3" href="#H.2.2p3"><small>3</small></a>
28252  The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
28253  is always 0 for the unsigned types, and is not provided for those types.
28254 <!--page 565 -->
28255
28256 <p><small><a href="#Contents">Contents</a></small>
28257 <h5><a name="H.2.2.1" href="#H.2.2.1">H.2.2.1 Integer operations</a></h5>
28258 <p><a name="H.2.2.1p1" href="#H.2.2.1p1"><small>1</small></a>
28259  The integer operations on integer types are the following:
28260  addI           x + y
28261  subI           x - y
28262  mulI           x * y
28263  divI, divtI    x / y
28264  remI, remtI    x % y
28265  negI           -x
28266  absI           abs(x), labs(x), llabs(x)
28267  eqI            x == y
28268  neqI           x != y
28269  lssI           x &lt; y
28270  leqI           x &lt;= y
28271  gtrI           x &gt; y
28272  geqI           x &gt;= y
28273  where x and y are expressions of the same integer type.
28274
28275 <p><small><a href="#Contents">Contents</a></small>
28276 <h4><a name="H.2.3" href="#H.2.3">H.2.3 Floating-point types</a></h4>
28277 <p><a name="H.2.3p1" href="#H.2.3p1"><small>1</small></a>
28278  The C floating-point types float, double, and long double are compatible with
28279  LIA-1. If an implementation adds support for the LIA-1 exceptional values
28280  ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
28281  with LIA-1. An implementation that uses IEC 60559 floating-point formats and
28282  operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
28283  conformant types.
28284
28285 <p><small><a href="#Contents">Contents</a></small>
28286 <h5><a name="H.2.3.1" href="#H.2.3.1">H.2.3.1 Floating-point parameters</a></h5>
28287 <p><a name="H.2.3.1p1" href="#H.2.3.1p1"><small>1</small></a>
28288  The parameters for a floating point data type can be accessed by the following:
28289  r              FLT_RADIX
28290  p              FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
28291  emax           FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
28292  emin           FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
28293 <p><a name="H.2.3.1p2" href="#H.2.3.1p2"><small>2</small></a>
28294  The derived constants for the floating point types are accessed by the following:
28295 <!--page 566 -->
28296  fmax          FLT_MAX, DBL_MAX, LDBL_MAX
28297  fminN         FLT_MIN, DBL_MIN, LDBL_MIN
28298  epsilon       FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
28299  rnd_style     FLT_ROUNDS
28300
28301 <p><small><a href="#Contents">Contents</a></small>
28302 <h5><a name="H.2.3.2" href="#H.2.3.2">H.2.3.2 Floating-point operations</a></h5>
28303 <p><a name="H.2.3.2p1" href="#H.2.3.2p1"><small>1</small></a>
28304  The floating-point operations on floating-point types are the following:
28305  addF          x + y
28306  subF          x - y
28307  mulF          x * y
28308  divF          x / y
28309  negF          -x
28310  absF          fabsf(x), fabs(x), fabsl(x)
28311  exponentF     1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
28312  scaleF        scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
28313 <pre>
28314                scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
28315 </pre>
28316  intpartF      modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
28317  fractpartF    modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
28318  eqF           x == y
28319  neqF          x != y
28320  lssF          x &lt; y
28321  leqF          x &lt;= y
28322  gtrF          x &gt; y
28323  geqF          x &gt;= y
28324  where x and y are expressions of the same floating point type, n is of type int, and li
28325  is of type long int.
28326
28327 <p><small><a href="#Contents">Contents</a></small>
28328 <h5><a name="H.2.3.3" href="#H.2.3.3">H.2.3.3 Rounding styles</a></h5>
28329 <p><a name="H.2.3.3p1" href="#H.2.3.3p1"><small>1</small></a>
28330  The C Standard requires all floating types to use the same radix and rounding style, so
28331  that only one identifier for each is provided to map to LIA-1.
28332 <p><a name="H.2.3.3p2" href="#H.2.3.3p2"><small>2</small></a>
28333  The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
28334  truncate      FLT_ROUNDS == 0
28335 <!--page 567 -->
28336  nearest       FLT_ROUNDS == 1
28337  other         FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
28338  provided that an implementation extends FLT_ROUNDS to cover the rounding style used
28339  in all relevant LIA-1 operations, not just addition as in C.
28340
28341 <p><small><a href="#Contents">Contents</a></small>
28342 <h4><a name="H.2.4" href="#H.2.4">H.2.4 Type conversions</a></h4>
28343 <p><a name="H.2.4p1" href="#H.2.4p1"><small>1</small></a>
28344  The LIA-1 type conversions are the following type casts:
28345  cvtI' -&gt; I     (int)i, (long int)i, (long long int)i,
28346 <pre>
28347                (unsigned int)i, (unsigned long int)i,
28348                (unsigned long long int)i
28349 </pre>
28350  cvtF -&gt; I      (int)x, (long int)x, (long long int)x,
28351 <pre>
28352                (unsigned int)x, (unsigned long int)x,
28353                (unsigned long long int)x
28354 </pre>
28355  cvtI -&gt; F      (float)i, (double)i, (long double)i
28356  cvtF' -&gt; F     (float)x, (double)x, (long double)x
28357 <p><a name="H.2.4p2" href="#H.2.4p2"><small>2</small></a>
28358  In the above conversions from floating to integer, the use of (cast)x can be replaced with
28359  (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
28360  (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
28361  conversion functions, lrint(), llrint(), lround(), and llround(), can be
28362  used. They all meet LIA-1's requirements on floating to integer rounding for in-range
28363  values. For out-of-range values, the conversions shall silently wrap for the modulo types.
28364 <p><a name="H.2.4p3" href="#H.2.4p3"><small>3</small></a>
28365  The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
28366  fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
28367  65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
28368  to 65535.0 which can then be cast to unsigned short int. But, the
28369  remainder() function is not useful for doing silent wrapping to signed integer types,
28370  e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
28371  range -32767.0 to +32768.0 which is not, in general, in the range of signed short
28372  int.
28373 <p><a name="H.2.4p4" href="#H.2.4p4"><small>4</small></a>
28374  C's conversions (casts) from floating-point to floating-point can meet LIA-1
28375  requirements if an implementation uses round-to-nearest (IEC 60559 default).
28376 <p><a name="H.2.4p5" href="#H.2.4p5"><small>5</small></a>
28377  C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
28378  implementation uses round-to-nearest.
28379 <!--page 568 -->
28380
28381 <p><small><a href="#Contents">Contents</a></small>
28382 <h3><a name="H.3" href="#H.3">H.3 Notification</a></h3>
28383 <p><a name="H.3p1" href="#H.3p1"><small>1</small></a>
28384  Notification is the process by which a user or program is informed that an exceptional
28385  arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
28386  allows an implementation to cause a notification to occur when any arithmetic operation
28387  returns an exceptional value as defined in LIA-1 clause 5.
28388
28389 <p><small><a href="#Contents">Contents</a></small>
28390 <h4><a name="H.3.1" href="#H.3.1">H.3.1 Notification alternatives</a></h4>
28391 <p><a name="H.3.1p1" href="#H.3.1p1"><small>1</small></a>
28392  LIA-1 requires at least the following two alternatives for handling of notifications:
28393  setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
28394  resume.
28395 <p><a name="H.3.1p2" href="#H.3.1p2"><small>2</small></a>
28396  An implementation need only support a given notification alternative for the entire
28397  program. An implementation may support the ability to switch between notification
28398  alternatives during execution, but is not required to do so. An implementation can
28399  provide separate selection for each kind of notification, but this is not required.
28400 <p><a name="H.3.1p3" href="#H.3.1p3"><small>3</small></a>
28401  C allows an implementation to provide notification. C's SIGFPE (for traps) and
28402  FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
28403  can provide LIA-1 notification.
28404 <p><a name="H.3.1p4" href="#H.3.1p4"><small>4</small></a>
28405  C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
28406  provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
28407  math library function calls. User-provided signal handlers for SIGFPE allow for trap-
28408  and-resume behavior with the same constraint.
28409
28410 <p><small><a href="#Contents">Contents</a></small>
28411 <h5><a name="H.3.1.1" href="#H.3.1.1">H.3.1.1 Indicators</a></h5>
28412 <p><a name="H.3.1.1p1" href="#H.3.1.1p1"><small>1</small></a>
28413  C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
28414 <p><a name="H.3.1.1p2" href="#H.3.1.1p2"><small>2</small></a>
28415  The following mapping is for floating-point types:
28416  undefined                FE_INVALID, FE_DIVBYZERO
28417  floating_overflow         FE_OVERFLOW
28418  underflow                FE_UNDERFLOW
28419 <p><a name="H.3.1.1p3" href="#H.3.1.1p3"><small>3</small></a>
28420  The floating-point indicator interrogation and manipulation operations are:
28421  set_indicators          feraiseexcept(i)
28422  clear_indicators        feclearexcept(i)
28423  test_indicators         fetestexcept(i)
28424  current_indicators      fetestexcept(FE_ALL_EXCEPT)
28425  where i is an expression of type int representing a subset of the LIA-1 indicators.
28426 <p><a name="H.3.1.1p4" href="#H.3.1.1p4"><small>4</small></a>
28427  C allows an implementation to provide the following LIA-1 required behavior: at
28428  program termination if any indicator is set the implementation shall send an unambiguous
28429 <!--page 569 -->
28430  and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
28431 <p><a name="H.3.1.1p5" href="#H.3.1.1p5"><small>5</small></a>
28432  LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
28433  This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
28434  point indicators.
28435
28436 <p><small><a href="#Contents">Contents</a></small>
28437 <h5><a name="H.3.1.2" href="#H.3.1.2">H.3.1.2 Traps</a></h5>
28438 <p><a name="H.3.1.2p1" href="#H.3.1.2p1"><small>1</small></a>
28439  C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
28440  math library functions (which are not permitted to invoke a user's signal handler for
28441  SIGFPE). An implementation can provide an alternative of notification through
28442  termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
28443 <p><a name="H.3.1.2p2" href="#H.3.1.2p2"><small>2</small></a>
28444  LIA-1 does not require that traps be precise.
28445 <p><a name="H.3.1.2p3" href="#H.3.1.2p3"><small>3</small></a>
28446  C does require that SIGFPE be the signal corresponding to LIA-1 arithmetic exceptions,
28447  if there is any signal raised for them.
28448 <p><a name="H.3.1.2p4" href="#H.3.1.2p4"><small>4</small></a>
28449  C supports signal handlers for SIGFPE and allows trapping of LIA-1 arithmetic
28450  exceptions. When LIA-1 arithmetic exceptions do trap, C's signal-handler mechanism
28451  allows trap-and-terminate (either default implementation behavior or user replacement for
28452  it) or trap-and-resume, at the programmer's option.
28453 <!--page 570 -->
28454
28455 <p><small><a href="#Contents">Contents</a></small>
28456 <h2><a name="I" href="#I">Annex I</a></h2>
28457 <pre>
28458                                      (informative)
28459                                 Common warnings
28460 </pre>
28461 <p><a name="Ip1" href="#Ip1"><small>1</small></a>
28462  An implementation may generate warnings in many situations, none of which are
28463  specified as part of this International Standard. The following are a few of the more
28464  common situations.
28465 <p><a name="Ip2" href="#Ip2"><small>2</small></a>
28466 <ul>
28467 <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>).
28468 <li>  A block with initialization of an object that has automatic storage duration is jumped
28469  into (<a href="#6.2.4">6.2.4</a>).
28470 <li>  An implicit narrowing conversion is encountered, such as the assignment of a long
28471  int or a double to an int, or a pointer to void to a pointer to any type other than
28472  a character type (<a href="#6.3">6.3</a>).
28473 <li>  A hexadecimal floating constant cannot be represented exactly in its evaluation format
28474  (<a href="#6.4.4.2">6.4.4.2</a>).
28475 <li>  An integer character constant includes more than one character or a wide character
28476  constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
28477 <li>  The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
28478 <li>  An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
28479  lvalue in one operand, and a side effect to, or an access to the value of, the identical
28480  lvalue in the other operand (<a href="#6.5">6.5</a>).
28481 <li>  A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
28482 <li>  The arguments in a function call do not agree in number and type with those of the
28483  parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
28484 <li>  An object is defined but not used (<a href="#6.7">6.7</a>).
28485 <li>  A value is given to an object of an enumerated type other than by assignment of an
28486  enumeration constant that is a member of that type, or an enumeration object that has
28487  the same type, or the value of a function that returns the same enumerated type
28488  (<a href="#6.7.2.2">6.7.2.2</a>).
28489 <li>  An aggregate has a partly bracketed initialization (<a href="#6.7.8">6.7.8</a>).
28490 <li>  A statement cannot be reached (<a href="#6.8">6.8</a>).
28491 <li>  A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
28492 <li>  A constant expression is used as the controlling expression of a selection statement
28493  (<a href="#6.8.4">6.8.4</a>).
28494 <!--page 571 -->
28495 <li>  An incorrectly formed preprocessing group is encountered while skipping a
28496  preprocessing group (<a href="#6.10.1">6.10.1</a>).
28497 <li>  An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
28498 <!--page 572 -->
28499 </ul>
28500
28501 <p><small><a href="#Contents">Contents</a></small>
28502 <h2><a name="J" href="#J">Annex J</a></h2>
28503 <pre>
28504                                      (informative)
28505                                   Portability issues
28506 </pre>
28507 <p><a name="Jp1" href="#Jp1"><small>1</small></a>
28508  This annex collects some information about portability that appears in this International
28509  Standard.
28510
28511 <p><small><a href="#Contents">Contents</a></small>
28512 <h3><a name="J.1" href="#J.1">J.1 Unspecified behavior</a></h3>
28513 <p><a name="J.1p1" href="#J.1p1"><small>1</small></a>
28514  The following are unspecified:
28515 <ul>
28516 <li>  The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
28517 <li>  The termination status returned to the hosted environment if the return type of main
28518  is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
28519 <li>  The values of objects that are neither lock-free atomic objects nor of type volatile
28520  sig_atomic_t and the state of the floating-point environment, when the
28521  processing of the abstract machine is interrupted by receipt of a signal (<a href="#5.1.2.3">5.1.2.3</a>).
28522 <li>  The behavior of the display device if a printing character is written when the active
28523  position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
28524 <li>  The behavior of the display device if a backspace character is written when the active
28525  position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
28526 <li>  The behavior of the display device if a horizontal tab character is written when the
28527  active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
28528 <li>  The behavior of the display device if a vertical tab character is written when the active
28529  position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
28530 <li>  How an extended source character that does not correspond to a universal character
28531  name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
28532 <li>  Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
28533 <li>  The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
28534 <li>  The values of bytes that correspond to union members other than the one last stored
28535  into (<a href="#6.2.6.1">6.2.6.1</a>).
28536 <li>  The representation used when storing a value in an object that has more than one
28537  object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
28538 <li>  The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
28539 <li>  Whether certain operators can generate negative zeros and whether a negative zero
28540  becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
28541 <!--page 573 -->
28542 <li>  Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
28543 <li>  The order in which subexpressions are evaluated and the order in which side effects
28544  take place, except as specified for the function-call (), &amp;&amp;, ||, ? :, and comma
28545  operators (<a href="#6.5">6.5</a>).
28546 <li>  The order in which the function designator, arguments, and subexpressions within the
28547  arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
28548 <li>  The order of side effects among compound literal initialization list expressions
28549  (<a href="#6.5.2.5">6.5.2.5</a>).
28550 <li>  The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
28551 <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>).
28552 <li>  Whether a call to an inline function uses the inline definition or the external definition
28553  of the function (<a href="#6.7.4">6.7.4</a>).
28554 <li>  Whether or not a size expression is evaluated when it is part of the operand of a
28555  sizeof operator and changing the value of the size expression would not affect the
28556  result of the operator (<a href="#6.7.6.2">6.7.6.2</a>).
28557 <li>  The order in which any side effects occur among the initialization list expressions in
28558  an initializer (<a href="#6.7.9">6.7.9</a>).
28559 <li>  The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
28560 <li>  When a fully expanded macro replacement list contains a function-like macro name
28561  as its last preprocessing token and the next preprocessing token from the source file is
28562  a (, and the fully expanded replacement of that macro ends with the name of the first
28563  macro and the next preprocessing token from the source file is again a (, whether that
28564  is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
28565 <li>  The order in which # and ## operations are evaluated during macro substitution
28566  (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
28567 <li>  The state of the floating-point status flags when execution passes from a part of the
28568  program translated with FENV_ACCESS ''off'' to a part translated with
28569  FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
28570 <li>  The order in which feraiseexcept raises floating-point exceptions, except as
28571  stated in <a href="#F.8.6">F.8.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
28572 <li>  Whether math_errhandling is a macro or an identifier with external linkage
28573  (<a href="#7.12">7.12</a>).
28574 <li>  The results of the frexp functions when the specified value is not a floating-point
28575  number (<a href="#7.12.6.4">7.12.6.4</a>).
28576 <!--page 574 -->
28577 <li>  The numeric result of the ilogb functions when the correct value is outside the
28578  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>).
28579 <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>).
28580 <li>  The value stored by the remquo functions in the object pointed to by quo when y is
28581  zero (<a href="#7.12.10.3">7.12.10.3</a>).
28582 <li>  Whether a comparison macro argument that is represented in a format wider than its
28583  semantic type is converted to the semantic type (<a href="#7.12.14">7.12.14</a>).
28584 <li>  Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
28585 <li>  Whether va_copy and va_end are macros or identifiers with external linkage
28586  (<a href="#7.16.1">7.16.1</a>).
28587 <li>  The hexadecimal digit before the decimal point when a non-normalized floating-point
28588  number is printed with an a or A conversion specifier (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
28589 <li>  The value of the file position indicator after a successful call to the ungetc function
28590  for a text stream, or the ungetwc function for any stream, until all pushed-back
28591  characters are read or discarded (<a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.29.3.10">7.29.3.10</a>).
28592 <li>  The details of the value stored by the fgetpos function (<a href="#7.21.9.1">7.21.9.1</a>).
28593 <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>).
28594 <li>  Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
28595  functions convert a minus-signed sequence to a negative number directly or by
28596  negating the value resulting from converting the corresponding unsigned sequence
28597  (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>).
28598 <li>  The order and contiguity of storage allocated by successive calls to the calloc,
28599  malloc, and realloc functions (<a href="#7.22.3">7.22.3</a>).
28600 <li>  The amount of storage allocated by a successful call to the calloc, malloc, or
28601  realloc function when 0 bytes was requested (<a href="#7.22.3">7.22.3</a>).
28602 <li>  Whether a call to the atexit function that does not happen before the exit
28603  function is called will succeed (<a href="#7.22.4.2">7.22.4.2</a>).
28604 <li>  Whether a call to the at_quick_exit function that does not happen before the
28605  quick_exit function is called will succeed (<a href="#7.22.4.3">7.22.4.3</a>).
28606 <li>  Which of two elements that compare as equal is matched by the bsearch function
28607  (<a href="#7.22.5.1">7.22.5.1</a>).
28608 <li>  The order of two elements that compare as equal in an array sorted by the qsort
28609  function (<a href="#7.22.5.2">7.22.5.2</a>).
28610 <!--page 575 -->
28611 <li>  The encoding of the calendar time returned by the time function (<a href="#7.27.2.4">7.27.2.4</a>).
28612 <li>  The characters stored by the strftime or wcsftime function if any of the time
28613  values being converted is outside the normal range (<a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.5.1">7.29.5.1</a>).
28614 <li>  Whether an encoding error occurs if a wchar_t value that does not correspond to a
28615  member of the extended character set appears in the format string for a function in
28616  <a href="#7.29.2">7.29.2</a> or <a href="#7.29.5">7.29.5</a> and the specified semantics do not require that value to be processed
28617  by wcrtomb (<a href="#7.29.1">7.29.1</a>).
28618 <li>  The conversion state after an encoding error occurs (<a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>,
28619  <a href="#7.29.6.4.2">7.29.6.4.2</a>,
28620 <li>  The resulting value when the ''invalid'' floating-point exception is raised during
28621  IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
28622 <li>  Whether conversion of non-integer IEC 60559 floating values to integer raises the
28623  ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
28624 <li>  Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
28625  exception in an IEC 60559 conformant implementation (<a href="#F.10">F.10</a>).
28626 <li>  Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
28627  floating-point exception in an IEC 60559 conformant implementation (<a href="#F.10">F.10</a>).
28628 <li>  The exponent value stored by frexp for a NaN or infinity (<a href="#F.10.3.4">F.10.3.4</a>).
28629 <li>  The numeric result returned by the lrint, llrint, lround, and llround
28630  functions if the rounded value is outside the range of the return type (<a href="#F.10.6.5">F.10.6.5</a>,
28631  <a href="#F.10.6.7">F.10.6.7</a>).
28632 <li>  The sign of one part of the complex result of several math functions for certain
28633  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>,
28634  <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>).
28635 </ul>
28636
28637 <p><small><a href="#Contents">Contents</a></small>
28638 <h3><a name="J.2" href="#J.2">J.2 Undefined behavior</a></h3>
28639 <p><a name="J.2p1" href="#J.2p1"><small>1</small></a>
28640  The behavior is undefined in the following circumstances:
28641 <ul>
28642 <li>  A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
28643  (clause 4).
28644 <li>  A nonempty source file does not end in a new-line character which is not immediately
28645  preceded by a backslash character or ends in a partial preprocessing token or
28646  comment (<a href="#5.1.1.2">5.1.1.2</a>).
28647 <li>  Token concatenation produces a character sequence matching the syntax of a
28648  universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
28649 <li>  A program in a hosted environment does not define a function named main using one
28650  of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
28651 <!--page 576 -->
28652 <li>  The execution of a program contains a data race (<a href="#5.1.2.4">5.1.2.4</a>).
28653 <li>  A character not in the basic source character set is encountered in a source file, except
28654  in an identifier, a character constant, a string literal, a header name, a comment, or a
28655  preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
28656 <li>  An identifier, comment, string literal, character constant, or header name contains an
28657  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>).
28658 <li>  The same identifier has both internal and external linkage in the same translation unit
28659  (<a href="#6.2.2">6.2.2</a>).
28660 <li>  An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
28661 <li>  The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
28662 <li>  The value of an object with automatic storage duration is used while it is
28663  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>).
28664 <li>  A trap representation is read by an lvalue expression that does not have character type
28665  (<a href="#6.2.6.1">6.2.6.1</a>).
28666 <li>  A trap representation is produced by a side effect that modifies any part of the object
28667  using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
28668 <li>  The operands to certain operators are such that they could produce a negative zero
28669  result, but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
28670 <li>  Two declarations of the same object or function specify types that are not compatible
28671  (<a href="#6.2.7">6.2.7</a>).
28672 <li>  A program requires the formation of a composite type from a variable length array
28673  type whose size is specified by an expression that is not evaluated (<a href="#6.2.7">6.2.7</a>).
28674 <li>  Conversion to or from an integer type produces a value outside the range that can be
28675  represented (<a href="#6.3.1.4">6.3.1.4</a>).
28676 <li>  Demotion of one real floating type to another produces a value outside the range that
28677  can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
28678 <li>  An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
28679 <li>  A non-array lvalue with an incomplete type is used in a context that requires the value
28680  of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
28681 <li>  An lvalue designating an object of automatic storage duration that could have been
28682  declared with the register storage class is used in a context that requires the value
28683  of the designated object, but the object is uninitialized. (<a href="#6.3.2.1">6.3.2.1</a>).
28684 <li>  An lvalue having array type is converted to a pointer to the initial element of the
28685  array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
28686 <!--page 577 -->
28687 <li>  An attempt is made to use the value of a void expression, or an implicit or explicit
28688  conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
28689 <li>  Conversion of a pointer to an integer type produces a value outside the range that can
28690  be represented (<a href="#6.3.2.3">6.3.2.3</a>).
28691 <li>  Conversion between two pointer types produces a result that is incorrectly aligned
28692  (<a href="#6.3.2.3">6.3.2.3</a>).
28693 <li>  A pointer is used to call a function whose type is not compatible with the referenced
28694  type (<a href="#6.3.2.3">6.3.2.3</a>).
28695 <li>  An unmatched ' or " character is encountered on a logical source line during
28696  tokenization (<a href="#6.4">6.4</a>).
28697 <li>  A reserved keyword token is used in translation phase 7 or 8 for some purpose other
28698  than as a keyword (<a href="#6.4.1">6.4.1</a>).
28699 <li>  A universal character name in an identifier does not designate a character whose
28700  encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
28701 <li>  The initial character of an identifier is a universal character name designating a digit
28702  (<a href="#6.4.2.1">6.4.2.1</a>).
28703 <li>  Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
28704 <li>  The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
28705 <li>  The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
28706 <li>  The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
28707  delimiters, or the characters ', \, //, or /* occur in the sequence between the "
28708  delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
28709 <li>  A side effect on a scalar object is unsequenced relative to either a different side effect
28710  on the same scalar object or a value computation using the value of the same scalar
28711  object (<a href="#6.5">6.5</a>).
28712 <li>  An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
28713 <li>  An object has its stored value accessed other than by an lvalue of an allowable type
28714  (<a href="#6.5">6.5</a>).
28715 <li>  For a call to a function without a function prototype in scope, the number of
28716  arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
28717 <li>  For call to a function without a function prototype in scope where the function is
28718  defined with a function prototype, either the prototype ends with an ellipsis or the
28719  types of the arguments after promotion are not compatible with the types of the
28720  parameters (<a href="#6.5.2.2">6.5.2.2</a>).
28721 <!--page 578 -->
28722 <li>  For a call to a function without a function prototype in scope where the function is not
28723  defined with a function prototype, the types of the arguments after promotion are not
28724  compatible with those of the parameters after promotion (with certain exceptions)
28725  (<a href="#6.5.2.2">6.5.2.2</a>).
28726 <li>  A function is defined with a type that is not compatible with the type (of the
28727  expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
28728 <li>  A member of an atomic structure or union is accessed (<a href="#6.5.2.3">6.5.2.3</a>).
28729 <li>  The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
28730 <li>  A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
28731 <li>  The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
28732 <li>  Addition or subtraction of a pointer into, or just beyond, an array object and an
28733  integer type produces a result that does not point into, or just beyond, the same array
28734  object (<a href="#6.5.6">6.5.6</a>).
28735 <li>  Addition or subtraction of a pointer into, or just beyond, an array object and an
28736  integer type produces a result that points just beyond the array object and is used as
28737  the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
28738 <li>  Pointers that do not point into, or just beyond, the same array object are subtracted
28739  (<a href="#6.5.6">6.5.6</a>).
28740 <li>  An array subscript is out of range, even if an object is apparently accessible with the
28741  given subscript (as in the lvalue expression a[1][7] given the declaration int
28742  a[4][5]) (<a href="#6.5.6">6.5.6</a>).
28743 <li>  The result of subtracting two pointers is not representable in an object of type
28744  ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
28745 <li>  An expression is shifted by a negative number or by an amount greater than or equal
28746  to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
28747 <li>  An expression having signed promoted type is left-shifted and either the value of the
28748  expression is negative or the result of shifting would be not be representable in the
28749  promoted type (<a href="#6.5.7">6.5.7</a>).
28750 <li>  Pointers that do not point to the same aggregate or union (nor just beyond the same
28751  array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
28752 <li>  An object is assigned to an inexactly overlapping object or to an exactly overlapping
28753  object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
28754 <li>  An expression that is required to be an integer constant expression does not have an
28755  integer type; has operands that are not integer constants, enumeration constants,
28756  character constants, sizeof expressions whose results are integer constants,
28757 <!--page 579 -->
28758   _Alignof expressions, or immediately-cast floating constants; or contains casts
28759   (outside operands to sizeof and _Alignof operators) other than conversions of
28760   arithmetic types to integer types (<a href="#6.6">6.6</a>).
28761 <li>  A constant expression in an initializer is not, or does not evaluate to, one of the
28762  following: an arithmetic constant expression, a null pointer constant, an address
28763  constant, or an address constant for a complete object type plus or minus an integer
28764  constant expression (<a href="#6.6">6.6</a>).
28765 <li>  An arithmetic constant expression does not have arithmetic type; has operands that
28766  are not integer constants, floating constants, enumeration constants, character
28767  constants, sizeof expressions whose results are integer constants, or _Alignof
28768  expressions; or contains casts (outside operands to sizeof or _Alignof operators)
28769  other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
28770 <li>  The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
28771  address &amp;, or indirection * operator or a pointer cast in creating an address constant
28772  (<a href="#6.6">6.6</a>).
28773 <li>  An identifier for an object is declared with no linkage and the type of the object is
28774  incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
28775 <li>  A function is declared at block scope with an explicit storage-class specifier other
28776  than extern (<a href="#6.7.1">6.7.1</a>).
28777 <li>  A structure or union is defined without any named members (including those
28778  specified indirectly via anonymous structures and unions) (<a href="#6.7.2.1">6.7.2.1</a>).
28779 <li>  An attempt is made to access, or generate a pointer to just past, a flexible array
28780  member of a structure when the referenced object provides no elements for that array
28781  (<a href="#6.7.2.1">6.7.2.1</a>).
28782 <li>  When the complete type is needed, an incomplete structure or union type is not
28783  completed in the same scope by another declaration of the tag that defines the content
28784  (<a href="#6.7.2.3">6.7.2.3</a>).
28785 <li>  An attempt is made to modify an object defined with a const-qualified type through
28786  use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
28787 <li>  An attempt is made to refer to an object defined with a volatile-qualified type through
28788  use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
28789 <li>  The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
28790 <li>  Two qualified types that are required to be compatible do not have the identically
28791  qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
28792 <li>  An object which has been modified is accessed through a restrict-qualified pointer to
28793  a const-qualified type, or through a restrict-qualified pointer and another pointer that
28794 <!--page 580 -->
28795   are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
28796 <li>  A restrict-qualified pointer is assigned a value based on another restricted pointer
28797  whose associated block neither began execution before the block associated with this
28798  pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
28799 <li>  A function with external linkage is declared with an inline function specifier, but is
28800  not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
28801 <li>  A function declared with a _Noreturn function specifier returns to its caller (<a href="#6.7.4">6.7.4</a>).
28802 <li>  The definition of an object has an alignment specifier and another declaration of that
28803  object has a different alignment specifier (<a href="#6.7.5">6.7.5</a>).
28804 <li>  Declarations of an object in different translation units have different alignment
28805  specifiers (<a href="#6.7.5">6.7.5</a>).
28806 <li>  Two pointer types that are required to be compatible are not identically qualified, or
28807  are not pointers to compatible types (<a href="#6.7.6.1">6.7.6.1</a>).
28808 <li>  The size expression in an array declaration is not a constant expression and evaluates
28809  at program execution time to a nonpositive value (<a href="#6.7.6.2">6.7.6.2</a>).
28810 <li>  In a context requiring two array types to be compatible, they do not have compatible
28811  element types, or their size specifiers evaluate to unequal values (<a href="#6.7.6.2">6.7.6.2</a>).
28812 <li>  A declaration of an array parameter includes the keyword static within the [ and
28813  ] and the corresponding argument does not provide access to the first element of an
28814  array with at least the specified number of elements (<a href="#6.7.6.3">6.7.6.3</a>).
28815 <li>  A storage-class specifier or type qualifier modifies the keyword void as a function
28816  parameter type list (<a href="#6.7.6.3">6.7.6.3</a>).
28817 <li>  In a context requiring two function types to be compatible, they do not have
28818  compatible return types, or their parameters disagree in use of the ellipsis terminator
28819  or the number and type of parameters (after default argument promotion, when there
28820  is no parameter type list or when one type is specified by a function definition with an
28821  identifier list) (<a href="#6.7.6.3">6.7.6.3</a>).
28822 <li>  The value of an unnamed member of a structure or union is used (<a href="#6.7.9">6.7.9</a>).
28823 <li>  The initializer for a scalar is neither a single expression nor a single expression
28824  enclosed in braces (<a href="#6.7.9">6.7.9</a>).
28825 <li>  The initializer for a structure or union object that has automatic storage duration is
28826  neither an initializer list nor a single expression that has compatible structure or union
28827  type (<a href="#6.7.9">6.7.9</a>).
28828 <li>  The initializer for an aggregate or union, other than an array initialized by a string
28829  literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.9">6.7.9</a>).
28830 <!--page 581 -->
28831 <li>  An identifier with external linkage is used, but in the program there does not exist
28832  exactly one external definition for the identifier, or the identifier is not used and there
28833  exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
28834 <li>  A function definition includes an identifier list, but the types of the parameters are not
28835  declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
28836 <li>  An adjusted parameter type in a function definition is not a complete object type
28837  (<a href="#6.9.1">6.9.1</a>).
28838 <li>  A function that accepts a variable number of arguments is defined without a
28839  parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
28840 <li>  The } that terminates a function is reached, and the value of the function call is used
28841  by the caller (<a href="#6.9.1">6.9.1</a>).
28842 <li>  An identifier for an object with internal linkage and an incomplete type is declared
28843  with a tentative definition (<a href="#6.9.2">6.9.2</a>).
28844 <li>  The token defined is generated during the expansion of a #if or #elif
28845  preprocessing directive, or the use of the defined unary operator does not match
28846  one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
28847 <li>  The #include preprocessing directive that results after expansion does not match
28848  one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
28849 <li>  The character sequence in an #include preprocessing directive does not start with a
28850  letter (<a href="#6.10.2">6.10.2</a>).
28851 <li>  There are sequences of preprocessing tokens within the list of macro arguments that
28852  would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
28853 <li>  The result of the preprocessing operator # is not a valid character string literal
28854  (<a href="#6.10.3.2">6.10.3.2</a>).
28855 <li>  The result of the preprocessing operator ## is not a valid preprocessing token
28856  (<a href="#6.10.3.3">6.10.3.3</a>).
28857 <li>  The #line preprocessing directive that results after expansion does not match one of
28858  the two well-defined forms, or its digit sequence specifies zero or a number greater
28859  than 2147483647 (<a href="#6.10.4">6.10.4</a>).
28860 <li>  A non-STDC #pragma preprocessing directive that is documented as causing
28861  translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
28862 <li>  A #pragma STDC preprocessing directive does not match one of the well-defined
28863  forms (<a href="#6.10.6">6.10.6</a>).
28864 <li>  The name of a predefined macro, or the identifier defined, is the subject of a
28865  #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
28866 <!--page 582 -->
28867 <li>  An attempt is made to copy an object to an overlapping object by use of a library
28868  function, other than as explicitly allowed (e.g., memmove) (clause 7).
28869 <li>  A file with the same name as one of the standard headers, not provided as part of the
28870  implementation, is placed in any of the standard places that are searched for included
28871  source files (<a href="#7.1.2">7.1.2</a>).
28872 <li>  A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
28873 <li>  A function, object, type, or macro that is specified as being declared or defined by
28874  some standard header is used before any header that declares or defines it is included
28875  (<a href="#7.1.2">7.1.2</a>).
28876 <li>  A standard header is included while a macro is defined with the same name as a
28877  keyword (<a href="#7.1.2">7.1.2</a>).
28878 <li>  The program attempts to declare a library function itself, rather than via a standard
28879  header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
28880 <li>  The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
28881  (<a href="#7.1.3">7.1.3</a>).
28882 <li>  The program removes the definition of a macro whose name begins with an
28883  underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
28884 <li>  An argument to a library function has an invalid value or a type not expected by a
28885  function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
28886 <li>  The pointer passed to a library function array parameter does not have a value such
28887  that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
28888 <li>  The macro definition of assert is suppressed in order to access an actual function
28889  (<a href="#7.2">7.2</a>).
28890 <li>  The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
28891 <li>  The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
28892  any context other than outside all external declarations or preceding all explicit
28893  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>).
28894 <li>  The value of an argument to a character handling function is neither equal to the value
28895  of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
28896 <li>  A macro definition of errno is suppressed in order to access an actual object, or the
28897  program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
28898 <li>  Part of the program tests floating-point status flags, sets floating-point control modes,
28899  or runs under non-default mode settings, but was translated with the state for the
28900  FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
28901 <!--page 583 -->
28902 <li>  The exception-mask argument for one of the functions that provide access to the
28903  floating-point status flags has a nonzero value not obtained by bitwise OR of the
28904  floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
28905 <li>  The fesetexceptflag function is used to set floating-point status flags that were
28906  not specified in the call to the fegetexceptflag function that provided the value
28907  of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
28908 <li>  The argument to fesetenv or feupdateenv is neither an object set by a call to
28909  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>).
28910 <li>  The value of the result of an integer arithmetic or conversion function cannot be
28911  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>).
28912 <li>  The program modifies the string pointed to by the value returned by the setlocale
28913  function (<a href="#7.11.1.1">7.11.1.1</a>).
28914 <li>  The program modifies the structure pointed to by the value returned by the
28915  localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
28916 <li>  A macro definition of math_errhandling is suppressed or the program defines
28917  an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
28918 <li>  An argument to a floating-point classification or comparison macro is not of real
28919  floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
28920 <li>  A macro definition of setjmp is suppressed in order to access an actual function, or
28921  the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
28922 <li>  An invocation of the setjmp macro occurs other than in an allowed context
28923  (<a href="#7.13.2.1">7.13.2.1</a>).
28924 <li>  The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
28925 <li>  After a longjmp, there is an attempt to access the value of an object of automatic
28926  storage duration that does not have volatile-qualified type, local to the function
28927  containing the invocation of the corresponding setjmp macro, that was changed
28928  between the setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
28929 <li>  The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
28930 <li>  A signal handler returns when the signal corresponded to a computational exception
28931  (<a href="#7.14.1.1">7.14.1.1</a>).
28932 <li>  A signal handler called in response to SIGFPE, SIGILL, SIGSEGV, or any other
28933  implementation-defined value corresponding to a computational exception returns
28934  (<a href="#7.14.1.1">7.14.1.1</a>).
28935 <li>  A signal occurs as the result of calling the abort or raise function, and the signal
28936  handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
28937 <!--page 584 -->
28938 <li>  A signal occurs other than as the result of calling the abort or raise function, and
28939  the signal handler refers to an object with static or thread storage duration that is not a
28940  lock-free atomic object other than by assigning a value to an object declared as
28941  volatile sig_atomic_t, or calls any function in the standard library other
28942  than the abort function, the _Exit function, the quick_exit function, or the
28943  signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
28944 <li>  The value of errno is referred to after a signal occurred other than as the result of
28945  calling the abort or raise function and the corresponding signal handler obtained
28946  a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
28947 <li>  A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
28948 <li>  The signal function is used in a multi-threaded program (<a href="#7.14.1.1">7.14.1.1</a>).
28949 <li>  A function with a variable number of arguments attempts to access its varying
28950  arguments other than through a properly declared and initialized va_list object, or
28951  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>).
28952 <li>  The macro va_arg is invoked using the parameter ap that was passed to a function
28953  that invoked the macro va_arg with the same parameter (<a href="#7.16">7.16</a>).
28954 <li>  A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
28955  order to access an actual function, or the program defines an external identifier with
28956  the name va_copy or va_end (<a href="#7.16.1">7.16.1</a>).
28957 <li>  The va_start or va_copy macro is invoked without a corresponding invocation
28958  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>,
28959  <a href="#7.16.1.4">7.16.1.4</a>).
28960 <li>  The type parameter to the va_arg macro is not such that a pointer to an object of
28961  that type can be obtained simply by postfixing a * (<a href="#7.16.1.1">7.16.1.1</a>).
28962 <li>  The va_arg macro is invoked when there is no actual next argument, or with a
28963  specified type that is not compatible with the promoted type of the actual next
28964  argument, with certain exceptions (<a href="#7.16.1.1">7.16.1.1</a>).
28965 <li>  The va_copy or va_start macro is called to initialize a va_list that was
28966  previously initialized by either macro without an intervening invocation of the
28967  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>).
28968 <li>  The parameter parmN of a va_start macro is declared with the register
28969  storage class, with a function or array type, or with a type that is not compatible with
28970  the type that results after application of the default argument promotions (<a href="#7.16.1.4">7.16.1.4</a>).
28971 <li>  The member designator parameter of an offsetof macro is an invalid right
28972  operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.19">7.19</a>).
28973 <!--page 585 -->
28974 <li>  The argument in an instance of one of the integer-constant macros is not a decimal,
28975  octal, or hexadecimal constant, or it has a value that exceeds the limits for the
28976  corresponding type (<a href="#7.20.4">7.20.4</a>).
28977 <li>  A byte input/output function is applied to a wide-oriented stream, or a wide character
28978  input/output function is applied to a byte-oriented stream (<a href="#7.21.2">7.21.2</a>).
28979 <li>  Use is made of any portion of a file beyond the most recent wide character written to
28980  a wide-oriented stream (<a href="#7.21.2">7.21.2</a>).
28981 <li>  The value of a pointer to a FILE object is used after the associated file is closed
28982  (<a href="#7.21.3">7.21.3</a>).
28983 <li>  The stream for the fflush function points to an input stream or to an update stream
28984  in which the most recent operation was input (<a href="#7.21.5.2">7.21.5.2</a>).
28985 <li>  The string pointed to by the mode argument in a call to the fopen function does not
28986  exactly match one of the specified character sequences (<a href="#7.21.5.3">7.21.5.3</a>).
28987 <li>  An output operation on an update stream is followed by an input operation without an
28988  intervening call to the fflush function or a file positioning function, or an input
28989  operation on an update stream is followed by an output operation with an intervening
28990  call to a file positioning function (<a href="#7.21.5.3">7.21.5.3</a>).
28991 <li>  An attempt is made to use the contents of the array that was supplied in a call to the
28992  setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>).
28993 <li>  There are insufficient arguments for the format in a call to one of the formatted
28994  input/output functions, or an argument does not have an appropriate type (<a href="#7.21.6.1">7.21.6.1</a>,
28995  <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
28996 <li>  The format in a call to one of the formatted input/output functions or to the
28997  strftime or wcsftime function is not a valid multibyte character sequence that
28998  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.27.3.5">7.27.3.5</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>,
28999  <a href="#7.29.5.1">7.29.5.1</a>).
29000 <li>  In a call to one of the formatted output functions, a precision appears with a
29001  conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29002 <li>  A conversion specification for a formatted output function uses an asterisk to denote
29003  an argument-supplied field width or precision, but the corresponding argument is not
29004  provided (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29005 <li>  A conversion specification for a formatted output function uses a # or 0 flag with a
29006  conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29007 <li>  A conversion specification for one of the formatted input/output functions uses a
29008  length modifier with a conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>,
29009  <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29010 <!--page 586 -->
29011 <li>  An s conversion specifier is encountered by one of the formatted output functions,
29012  and the argument is missing the null terminator (unless a precision is specified that
29013  does not require null termination) (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29014 <li>  An n conversion specification for one of the formatted input/output functions includes
29015  any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.21.6.1">7.21.6.1</a>,
29016  <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29017 <li>  A % conversion specifier is encountered by one of the formatted input/output
29018  functions, but the complete conversion specification is not exactly %% (<a href="#7.21.6.1">7.21.6.1</a>,
29019  <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29020 <li>  An invalid conversion specification is found in the format for one of the formatted
29021  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>,
29022  <a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.5.1">7.29.5.1</a>).
29023 <li>  The number of characters or wide characters transmitted by a formatted output
29024  function (or written to an array, or that would have been written to an array) is greater
29025  than INT_MAX (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29026 <li>  The number of input items assigned by a formatted input function is greater than
29027  INT_MAX (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29028 <li>  The result of a conversion by one of the formatted input functions cannot be
29029  represented in the corresponding object, or the receiving object does not have an
29030  appropriate type (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29031 <li>  A c, s, or [ conversion specifier is encountered by one of the formatted input
29032  functions, and the array pointed to by the corresponding argument is not large enough
29033  to accept the input sequence (and a null terminator if the conversion specifier is s or
29034  [) (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29035 <li>  A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
29036  formatted input functions, but the input is not a valid multibyte character sequence
29037  that begins in the initial shift state (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29038 <li>  The input item for a %p conversion by one of the formatted input functions is not a
29039  value converted earlier during the same program execution (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29040 <li>  The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
29041  vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
29042  vwscanf function is called with an improperly initialized va_list argument, or
29043  the argument is used (other than in an invocation of va_end) after the function
29044  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>,
29045  <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.2.10</a>).
29046 <li>  The contents of the array supplied in a call to the fgets or fgetws function are
29047  used after a read error occurred (<a href="#7.21.7.2">7.21.7.2</a>, <a href="#7.29.3.2">7.29.3.2</a>).
29048 <!--page 587 -->
29049 <li>  The file position indicator for a binary stream is used after a call to the ungetc
29050  function where its value was zero before the call (<a href="#7.21.7.10">7.21.7.10</a>).
29051 <li>  The file position indicator for a stream is used after an error occurred during a call to
29052  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>).
29053 <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>).
29054 <li>  The fseek function is called for a text stream with a nonzero offset and either the
29055  offset was not returned by a previous successful call to the ftell function on a
29056  stream associated with the same file or whence is not SEEK_SET (<a href="#7.21.9.2">7.21.9.2</a>).
29057 <li>  The fsetpos function is called to set a position that was not returned by a previous
29058  successful call to the fgetpos function on a stream associated with the same file
29059  (<a href="#7.21.9.3">7.21.9.3</a>).
29060 <li>  A non-null pointer returned by a call to the calloc, malloc, or realloc function
29061  with a zero requested size is used to access an object (<a href="#7.22.3">7.22.3</a>).
29062 <li>  The value of a pointer that refers to space deallocated by a call to the free or
29063  realloc function is used (<a href="#7.22.3">7.22.3</a>).
29064 <li>  The alignment requested of the aligned_alloc function is not valid or not
29065  supported by the implementation, or the size requested is not an integral multiple of
29066  the alignment (<a href="#7.22.3.1">7.22.3.1</a>).
29067 <li>  The pointer argument to the free or realloc function does not match a pointer
29068  earlier returned by a memory management function, or the space has been deallocated
29069  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>).
29070 <li>  The value of the object allocated by the malloc function is used (<a href="#7.22.3.4">7.22.3.4</a>).
29071 <li>  The value of any bytes in a new object allocated by the realloc function beyond
29072  the size of the old object are used (<a href="#7.22.3.5">7.22.3.5</a>).
29073 <li>  The program calls the exit or quick_exit function more than once, or calls both
29074  functions (<a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.7">7.22.4.7</a>).
29075 <li>  During the call to a function registered with the atexit or at_quick_exit
29076  function, a call is made to the longjmp function that would terminate the call to the
29077  registered function (<a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.7">7.22.4.7</a>).
29078 <li>  The string set up by the getenv or strerror function is modified by the program
29079  (<a href="#7.22.4.6">7.22.4.6</a>, <a href="#7.24.6.2">7.24.6.2</a>).
29080 <li>  A signal is raised while the quick_exit function is executing (<a href="#7.22.4.7">7.22.4.7</a>).
29081 <li>  A command is executed through the system function in a way that is documented as
29082  causing termination or some other form of undefined behavior (<a href="#7.22.4.8">7.22.4.8</a>).
29083 <!--page 588 -->
29084 <li>  A searching or sorting utility function is called with an invalid pointer argument, even
29085  if the number of elements is zero (<a href="#7.22.5">7.22.5</a>).
29086 <li>  The comparison function called by a searching or sorting utility function alters the
29087  contents of the array being searched or sorted, or returns ordering values
29088  inconsistently (<a href="#7.22.5">7.22.5</a>).
29089 <li>  The array being searched by the bsearch function does not have its elements in
29090  proper order (<a href="#7.22.5.1">7.22.5.1</a>).
29091 <li>  The current conversion state is used by a multibyte/wide character conversion
29092  function after changing the LC_CTYPE category (<a href="#7.22.7">7.22.7</a>).
29093 <li>  A string or wide string utility function is instructed to access an array beyond the end
29094  of an object (<a href="#7.24.1">7.24.1</a>, <a href="#7.29.4">7.29.4</a>).
29095 <li>  A string or wide string utility function is called with an invalid pointer argument, even
29096  if the length is zero (<a href="#7.24.1">7.24.1</a>, <a href="#7.29.4">7.29.4</a>).
29097 <li>  The contents of the destination array are used after a call to the strxfrm,
29098  strftime, wcsxfrm, or wcsftime function in which the specified length was
29099  too small to hold the entire null-terminated result (<a href="#7.24.4.5">7.24.4.5</a>, <a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.4.4.4">7.29.4.4.4</a>,
29100  <a href="#7.29.5.1">7.29.5.1</a>).
29101 <li>  The first argument in the very first call to the strtok or wcstok is a null pointer
29102  (<a href="#7.24.5.8">7.24.5.8</a>, <a href="#7.29.4.5.7">7.29.4.5.7</a>).
29103 <li>  The type of an argument to a type-generic macro is not compatible with the type of
29104  the corresponding parameter of the selected function (<a href="#7.25">7.25</a>).
29105 <li>  A complex argument is supplied for a generic parameter of a type-generic macro that
29106  has no corresponding complex function (<a href="#7.25">7.25</a>).
29107 <li>  At least one member of the broken-down time passed to asctime contains a value
29108  outside its normal range, or the calculated year exceeds four digits or is less than the
29109  year 1000 (<a href="#7.27.3.1">7.27.3.1</a>).
29110 <li>  The argument corresponding to an s specifier without an l qualifier in a call to the
29111  fwprintf function does not point to a valid multibyte character sequence that
29112  begins in the initial shift state (<a href="#7.29.2.11">7.29.2.11</a>).
29113 <li>  In a call to the wcstok function, the object pointed to by ptr does not have the
29114  value stored by the previous call for the same wide string (<a href="#7.29.4.5.7">7.29.4.5.7</a>).
29115 <li>  An mbstate_t object is used inappropriately (<a href="#7.29.6">7.29.6</a>).
29116 <li>  The value of an argument of type wint_t to a wide character classification or case
29117  mapping function is neither equal to the value of WEOF nor representable as a
29118  wchar_t (<a href="#7.30.1">7.30.1</a>).
29119 <!--page 589 -->
29120 <li>  The iswctype function is called using a different LC_CTYPE category from the
29121  one in effect for the call to the wctype function that returned the description
29122  (<a href="#7.30.2.2.1">7.30.2.2.1</a>).
29123 <li>  The towctrans function is called using a different LC_CTYPE category from the
29124  one in effect for the call to the wctrans function that returned the description
29125  (<a href="#7.30.3.2.1">7.30.3.2.1</a>).
29126 </ul>
29127
29128 <p><small><a href="#Contents">Contents</a></small>
29129 <h3><a name="J.3" href="#J.3">J.3 Implementation-defined behavior</a></h3>
29130 <p><a name="J.3p1" href="#J.3p1"><small>1</small></a>
29131  A conforming implementation is required to document its choice of behavior in each of
29132  the areas listed in this subclause. The following are implementation-defined:
29133
29134 <p><small><a href="#Contents">Contents</a></small>
29135 <h4><a name="J.3.1" href="#J.3.1">J.3.1 Translation</a></h4>
29136 <p><a name="J.3.1p1" href="#J.3.1p1"><small>1</small></a>
29137 <ul>
29138 <li>  How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
29139 <li>  Whether each nonempty sequence of white-space characters other than new-line is
29140  retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
29141 </ul>
29142
29143 <p><small><a href="#Contents">Contents</a></small>
29144 <h4><a name="J.3.2" href="#J.3.2">J.3.2 Environment</a></h4>
29145 <p><a name="J.3.2p1" href="#J.3.2p1"><small>1</small></a>
29146 <ul>
29147 <li>  The mapping between physical source file multibyte characters and the source
29148  character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
29149 <li>  The name and type of the function called at program startup in a freestanding
29150  environment (<a href="#5.1.2.1">5.1.2.1</a>).
29151 <li>  The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
29152 <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>).
29153 <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>).
29154 <li>  What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
29155 <li>  Whether a program can have more than one thread of execution in a freestanding
29156  environment (<a href="#5.1.2.4">5.1.2.4</a>).
29157 <li>  The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
29158 <li>  Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
29159  computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
29160 <li>  Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
29161  program startup (<a href="#7.14.1.1">7.14.1.1</a>).
29162 <li>  The set of environment names and the method for altering the environment list used
29163  by the getenv function (<a href="#7.22.4.6">7.22.4.6</a>).
29164 <li>  The manner of execution of the string by the system function (<a href="#7.22.4.8">7.22.4.8</a>).
29165 <!--page 590 -->
29166 </ul>
29167
29168 <p><small><a href="#Contents">Contents</a></small>
29169 <h4><a name="J.3.3" href="#J.3.3">J.3.3 Identifiers</a></h4>
29170 <p><a name="J.3.3p1" href="#J.3.3p1"><small>1</small></a>
29171 <ul>
29172 <li>  Which additional multibyte characters may appear in identifiers and their
29173  correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
29174 <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>).
29175 </ul>
29176
29177 <p><small><a href="#Contents">Contents</a></small>
29178 <h4><a name="J.3.4" href="#J.3.4">J.3.4 Characters</a></h4>
29179 <p><a name="J.3.4p1" href="#J.3.4p1"><small>1</small></a>
29180 <ul>
29181 <li>  The number of bits in a byte (<a href="#3.6">3.6</a>).
29182 <li>  The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
29183 <li>  The unique value of the member of the execution character set produced for each of
29184  the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
29185 <li>  The value of a char object into which has been stored any character other than a
29186  member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
29187 <li>  Which of signed char or unsigned char has the same range, representation,
29188  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>).
29189 <li>  The mapping of members of the source character set (in character constants and string
29190  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>).
29191 <li>  The value of an integer character constant containing more than one character or
29192  containing a character or escape sequence that does not map to a single-byte
29193  execution character (<a href="#6.4.4.4">6.4.4.4</a>).
29194 <li>  The value of a wide character constant containing more than one multibyte character
29195  or a single multibyte character that maps to multiple members of the extended
29196  execution character set, or containing a multibyte character or escape sequence not
29197  represented in the extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
29198 <li>  The current locale used to convert a wide character constant consisting of a single
29199  multibyte character that maps to a member of the extended execution character set
29200  into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
29201 <li>  Whether differently-prefixed wide string literal tokens can be concatenated and, if so,
29202  the treatment of the resulting multibyte character sequence (<a href="#6.4.5">6.4.5</a>).
29203 <li>  The current locale used to convert a wide string literal into corresponding wide
29204  character codes (<a href="#6.4.5">6.4.5</a>).
29205 <li>  The value of a string literal containing a multibyte character or escape sequence not
29206  represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
29207 <li>  The encoding of any of wchar_t, char16_t, and char32_t where the
29208  corresponding  standard   encoding macro      (__STDC_ISO_10646__,
29209  __STDC_UTF_16__, or __STDC_UTF_32__) is not defined (<a href="#6.10.8.2">6.10.8.2</a>).
29210 <!--page 591 -->
29211 </ul>
29212
29213 <p><small><a href="#Contents">Contents</a></small>
29214 <h4><a name="J.3.5" href="#J.3.5">J.3.5 Integers</a></h4>
29215 <p><a name="J.3.5p1" href="#J.3.5p1"><small>1</small></a>
29216 <ul>
29217 <li>  Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
29218 <li>  Whether signed integer types are represented using sign and magnitude, two's
29219  complement, or ones' complement, and whether the extraordinary value is a trap
29220  representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
29221 <li>  The rank of any extended integer type relative to another extended integer type with
29222  the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
29223 <li>  The result of, or the signal raised by, converting an integer to a signed integer type
29224  when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
29225 <li>  The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
29226 </ul>
29227
29228 <p><small><a href="#Contents">Contents</a></small>
29229 <h4><a name="J.3.6" href="#J.3.6">J.3.6 Floating point</a></h4>
29230 <p><a name="J.3.6p1" href="#J.3.6p1"><small>1</small></a>
29231 <ul>
29232 <li>  The accuracy of the floating-point operations and of the library functions in
29233  <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>).
29234 <li>  The accuracy of the conversions between floating-point internal representations and
29235  string representations performed by the library functions in <a href="#7.21">&lt;stdio.h&gt;</a>,
29236  <a href="#7.22">&lt;stdlib.h&gt;</a>, and <a href="#7.29">&lt;wchar.h&gt;</a> (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
29237 <li>  The rounding behaviors characterized by non-standard values of FLT_ROUNDS
29238  (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
29239 <li>  The evaluation methods characterized by non-standard negative values of
29240  FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
29241 <li>  The direction of rounding when an integer is converted to a floating-point number that
29242  cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
29243 <li>  The direction of rounding when a floating-point number is converted to a narrower
29244  floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
29245 <li>  How the nearest representable value or the larger or smaller representable value
29246  immediately adjacent to the nearest representable value is chosen for certain floating
29247  constants (<a href="#6.4.4.2">6.4.4.2</a>).
29248 <li>  Whether and how floating expressions are contracted when not disallowed by the
29249  FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
29250 <li>  The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
29251 <li>  Additional floating-point exceptions, rounding           modes,     environments,   and
29252  classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
29253 <li>  The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>).
29254 <!--page 592 -->
29255 </ul>
29256
29257 <p><small><a href="#Contents">Contents</a></small>
29258 <h4><a name="J.3.7" href="#J.3.7">J.3.7 Arrays and pointers</a></h4>
29259 <p><a name="J.3.7p1" href="#J.3.7p1"><small>1</small></a>
29260 <ul>
29261 <li>  The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
29262 <li>  The size of the result of subtracting two pointers to elements of the same array
29263  (<a href="#6.5.6">6.5.6</a>).
29264 </ul>
29265
29266 <p><small><a href="#Contents">Contents</a></small>
29267 <h4><a name="J.3.8" href="#J.3.8">J.3.8 Hints</a></h4>
29268 <p><a name="J.3.8p1" href="#J.3.8p1"><small>1</small></a>
29269 <ul>
29270 <li>  The extent to which suggestions made by using the register storage-class
29271  specifier are effective (<a href="#6.7.1">6.7.1</a>).
29272 <li>  The extent to which suggestions made by using the inline function specifier are
29273  effective (<a href="#6.7.4">6.7.4</a>).
29274 </ul>
29275
29276 <p><small><a href="#Contents">Contents</a></small>
29277 <h4><a name="J.3.9" href="#J.3.9">J.3.9 Structures, unions, enumerations, and bit-fields</a></h4>
29278 <p><a name="J.3.9p1" href="#J.3.9p1"><small>1</small></a>
29279 <ul>
29280 <li>  Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
29281  unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
29282 <li>  Allowable bit-field types other than _Bool, signed int, and unsigned int
29283  (<a href="#6.7.2.1">6.7.2.1</a>).
29284 <li>  Whether atomic types are permitted for bit-fields (<a href="#6.7.2.1">6.7.2.1</a>).
29285 <li>  Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
29286 <li>  The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
29287 <li>  The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
29288  no problem unless binary data written by one implementation is read by another.
29289 <li>  The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
29290 </ul>
29291
29292 <p><small><a href="#Contents">Contents</a></small>
29293 <h4><a name="J.3.10" href="#J.3.10">J.3.10 Qualifiers</a></h4>
29294 <p><a name="J.3.10p1" href="#J.3.10p1"><small>1</small></a>
29295 <ul>
29296 <li>  What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
29297 </ul>
29298
29299 <p><small><a href="#Contents">Contents</a></small>
29300 <h4><a name="J.3.11" href="#J.3.11">J.3.11 Preprocessing directives</a></h4>
29301 <p><a name="J.3.11p1" href="#J.3.11p1"><small>1</small></a>
29302 <ul>
29303 <li>  The locations within #pragma directives where header name preprocessing tokens
29304  are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
29305 <li>  How sequences in both forms of header names are mapped to headers or external
29306  source file names (<a href="#6.4.7">6.4.7</a>).
29307 <li>  Whether the value of a character constant in a constant expression that controls
29308  conditional inclusion matches the value of the same character constant in the
29309  execution character set (<a href="#6.10.1">6.10.1</a>).
29310 <li>  Whether the value of a single-character character constant in a constant expression
29311  that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
29312 <!--page 593 -->
29313 <li>  The places that are searched for an included &lt; &gt; delimited header, and how the places
29314  are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
29315 <li>  How the named source file is searched for in an included " " delimited header
29316  (<a href="#6.10.2">6.10.2</a>).
29317 <li>  The method by which preprocessing tokens (possibly resulting from macro
29318  expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
29319 <li>  The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
29320 <li>  Whether the # operator inserts a \ character before the \ character that begins a
29321  universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
29322 <li>  The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
29323 <li>  The definitions for __DATE__ and __TIME__ when respectively, the date and
29324  time of translation are not available (<a href="#6.10.8.1">6.10.8.1</a>).
29325 </ul>
29326
29327 <p><small><a href="#Contents">Contents</a></small>
29328 <h4><a name="J.3.12" href="#J.3.12">J.3.12 Library functions</a></h4>
29329 <p><a name="J.3.12p1" href="#J.3.12p1"><small>1</small></a>
29330 <ul>
29331 <li>  Any library facilities available to a freestanding program, other than the minimal set
29332  required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
29333 <li>  The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
29334 <li>  The representation of the floating-point               status   flags   stored   by   the
29335  fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
29336 <li>  Whether the feraiseexcept function raises the ''inexact'' floating-point
29337  exception in addition to the ''overflow'' or ''underflow'' floating-point exception
29338  (<a href="#7.6.2.3">7.6.2.3</a>).
29339 <li>  Strings other than "C" and "" that may be passed as the second argument to the
29340  setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
29341 <li>  The types defined for float_t and double_t when the value of the
29342  FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
29343 <li>  Domain errors for the mathematics functions, other than those required by this
29344  International Standard (<a href="#7.12.1">7.12.1</a>).
29345 <li>  The values returned by the mathematics functions on domain errors or pole errors
29346  (<a href="#7.12.1">7.12.1</a>).
29347 <li>  The values returned by the mathematics functions on underflow range errors, whether
29348  errno is set to the value of the macro ERANGE when the integer expression
29349  math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
29350  floating-point exception is raised when the integer expression math_errhandling
29351  &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
29352 <!--page 594 -->
29353 <li>  Whether a domain error occurs or zero is returned when an fmod function has a
29354  second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
29355 <li>  Whether a domain error occurs or zero is returned when a remainder function has
29356  a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
29357 <li>  The base-2 logarithm of the modulus used by the remquo functions in reducing the
29358  quotient (<a href="#7.12.10.3">7.12.10.3</a>).
29359 <li>  Whether a domain error occurs or zero is returned when a remquo function has a
29360  second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
29361 <li>  Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
29362  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>).
29363 <li>  The null pointer constant to which the macro NULL expands (<a href="#7.19">7.19</a>).
29364 <li>  Whether the last line of a text stream requires a terminating new-line character
29365  (<a href="#7.21.2">7.21.2</a>).
29366 <li>  Whether space characters that are written out to a text stream immediately before a
29367  new-line character appear when read in (<a href="#7.21.2">7.21.2</a>).
29368 <li>  The number of null characters that may be appended to data written to a binary
29369  stream (<a href="#7.21.2">7.21.2</a>).
29370 <li>  Whether the file position indicator of an append-mode stream is initially positioned at
29371  the beginning or end of the file (<a href="#7.21.3">7.21.3</a>).
29372 <li>  Whether a write on a text stream causes the associated file to be truncated beyond that
29373  point (<a href="#7.21.3">7.21.3</a>).
29374 <li>  The characteristics of file buffering (<a href="#7.21.3">7.21.3</a>).
29375 <li>  Whether a zero-length file actually exists (<a href="#7.21.3">7.21.3</a>).
29376 <li>  The rules for composing valid file names (<a href="#7.21.3">7.21.3</a>).
29377 <li>  Whether the same file can be simultaneously open multiple times (<a href="#7.21.3">7.21.3</a>).
29378 <li>  The nature and choice of encodings used for multibyte characters in files (<a href="#7.21.3">7.21.3</a>).
29379 <li>  The effect of the remove function on an open file (<a href="#7.21.4.1">7.21.4.1</a>).
29380 <li>  The effect if a file with the new name exists prior to a call to the rename function
29381  (<a href="#7.21.4.2">7.21.4.2</a>).
29382 <li>  Whether an open temporary file is removed upon abnormal program termination
29383  (<a href="#7.21.4.3">7.21.4.3</a>).
29384 <li>  Which changes of mode are permitted (if any), and under what circumstances
29385  (<a href="#7.21.5.4">7.21.5.4</a>).
29386 <!--page 595 -->
29387 <li>  The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
29388  sequence printed for a NaN (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29389 <li>  The output for %p conversion in the fprintf or fwprintf function (<a href="#7.21.6.1">7.21.6.1</a>,
29390  <a href="#7.29.2.1">7.29.2.1</a>).
29391 <li>  The interpretation of a - character that is neither the first nor the last character, nor
29392  the second where a ^ character is the first, in the scanlist for %[ conversion in the
29393  fscanf or fwscanf function (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>).
29394 <li>  The set of sequences matched by a %p conversion and the interpretation of the
29395  corresponding input item in the fscanf or fwscanf function (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
29396 <li>  The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
29397  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>).
29398 <li>  The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
29399  converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
29400  function (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>).
29401 <li>  Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
29402  function sets errno to ERANGE when underflow occurs (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>).
29403 <li>  Whether the calloc, malloc, and realloc functions return a null pointer or a
29404  pointer to an allocated object when the size requested is zero (<a href="#7.22.3">7.22.3</a>).
29405 <li>  Whether open streams with unwritten buffered data are flushed, open streams are
29406  closed, or temporary files are removed when the abort or _Exit function is called
29407  (<a href="#7.22.4.1">7.22.4.1</a>, <a href="#7.22.4.5">7.22.4.5</a>).
29408 <li>  The termination status returned to the host environment by the abort, exit,
29409  _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>).
29410 <li>  The value returned by the system function when its argument is not a null pointer
29411  (<a href="#7.22.4.8">7.22.4.8</a>).
29412 <li>  The range and precision of times representable in clock_t and time_t (<a href="#7.27">7.27</a>).               *
29413 <li>  The local time zone and Daylight Saving Time (<a href="#7.27.1">7.27.1</a>).
29414 <li>  The era for the clock function (<a href="#7.27.2.1">7.27.2.1</a>).
29415 <li>  The TIME_UTC epoch (<a href="#7.27.2.5">7.27.2.5</a>).
29416 <li>  The replacement string for the %Z specifier to the strftime, and wcsftime
29417  functions in the "C" locale (<a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.5.1">7.29.5.1</a>).
29418 <li>  Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
29419  IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.10">F.10</a>).
29420 <!--page 596 -->
29421 </ul>
29422
29423 <p><small><a href="#Contents">Contents</a></small>
29424 <h4><a name="J.3.13" href="#J.3.13">J.3.13 Architecture</a></h4>
29425 <p><a name="J.3.13p1" href="#J.3.13p1"><small>1</small></a>
29426 <ul>
29427 <li>  The values or expressions assigned to the macros specified in the headers
29428  <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>).
29429 <li>  The result of attempting to indirectly access an object with automatic or thread
29430  storage duration from a thread other than the one with which it is associated (<a href="#6.2.4">6.2.4</a>).
29431 <li>  The number, order, and encoding of bytes in any object (when not explicitly specified
29432  in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
29433 <li>  Whether any extended alignments are supported and the contexts in which they are
29434  supported (<a href="#6.2.8">6.2.8</a>).
29435 <li>  Valid alignment values other than those returned by an _Alignof expression for
29436  fundamental types, if any (<a href="#6.2.8">6.2.8</a>).
29437 <li>  The value of the result of the sizeof and _Alignof operators (<a href="#6.5.3.4">6.5.3.4</a>).
29438 </ul>
29439
29440 <p><small><a href="#Contents">Contents</a></small>
29441 <h3><a name="J.4" href="#J.4">J.4 Locale-specific behavior</a></h3>
29442 <p><a name="J.4p1" href="#J.4p1"><small>1</small></a>
29443  The following characteristics of a hosted environment are locale-specific and are required
29444  to be documented by the implementation:
29445 <ul>
29446 <li>  Additional members of the source and execution character sets beyond the basic
29447  character set (<a href="#5.2.1">5.2.1</a>).
29448 <li>  The presence, meaning, and representation of additional multibyte characters in the
29449  execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
29450 <li>  The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
29451 <li>  The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
29452 <li>  The decimal-point character (<a href="#7.1.1">7.1.1</a>).
29453 <li>  The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a>).
29454 <li>  The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a>).
29455 <li>  The sets of characters tested for by the isalpha, isblank, islower, ispunct,
29456  isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
29457  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>,
29458  <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.3">7.30.2.1.3</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.2.1.10">7.30.2.1.10</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>).
29459 <li>  The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
29460 <li>  Additional subject sequences accepted by the numeric conversion functions (<a href="#7.22.1">7.22.1</a>,
29461  <a href="#7.29.4.1">7.29.4.1</a>).
29462 <li>  The collation sequence of the execution character set (<a href="#7.24.4.3">7.24.4.3</a>, <a href="#7.29.4.4.2">7.29.4.4.2</a>).
29463 <!--page 597 -->
29464 <li>  The contents of the error message strings set up by the strerror function
29465  (<a href="#7.24.6.2">7.24.6.2</a>).
29466 <li>  The formats for time and date (<a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.5.1">7.29.5.1</a>).
29467 <li>  Character mappings that are supported by the towctrans function (<a href="#7.30.1">7.30.1</a>).
29468 <li>  Character classifications that are supported by the iswctype function (<a href="#7.30.1">7.30.1</a>).
29469 </ul>
29470
29471 <p><small><a href="#Contents">Contents</a></small>
29472 <h3><a name="J.5" href="#J.5">J.5 Common extensions</a></h3>
29473 <p><a name="J.5p1" href="#J.5p1"><small>1</small></a>
29474  The following extensions are widely used in many systems, but are not portable to all
29475  implementations. The inclusion of any extension that may cause a strictly conforming
29476  program to become invalid renders an implementation nonconforming. Examples of such
29477  extensions are new keywords, extra library functions declared in standard headers, or
29478  predefined macros with names that do not begin with an underscore.
29479
29480 <p><small><a href="#Contents">Contents</a></small>
29481 <h4><a name="J.5.1" href="#J.5.1">J.5.1 Environment arguments</a></h4>
29482 <p><a name="J.5.1p1" href="#J.5.1p1"><small>1</small></a>
29483  In a hosted environment, the main function receives a third argument, char *envp[],
29484  that points to a null-terminated array of pointers to char, each of which points to a string
29485  that provides information about the environment for this execution of the program
29486  (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
29487
29488 <p><small><a href="#Contents">Contents</a></small>
29489 <h4><a name="J.5.2" href="#J.5.2">J.5.2 Specialized identifiers</a></h4>
29490 <p><a name="J.5.2p1" href="#J.5.2p1"><small>1</small></a>
29491  Characters other than the underscore _, letters, and digits, that are not part of the basic
29492  source character set (such as the dollar sign $, or characters in national character sets)
29493  may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
29494
29495 <p><small><a href="#Contents">Contents</a></small>
29496 <h4><a name="J.5.3" href="#J.5.3">J.5.3 Lengths and cases of identifiers</a></h4>
29497 <p><a name="J.5.3p1" href="#J.5.3p1"><small>1</small></a>
29498  All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
29499
29500 <p><small><a href="#Contents">Contents</a></small>
29501 <h4><a name="J.5.4" href="#J.5.4">J.5.4 Scopes of identifiers</a></h4>
29502 <p><a name="J.5.4p1" href="#J.5.4p1"><small>1</small></a>
29503  A function identifier, or the identifier of an object the declaration of which contains the
29504  keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
29505
29506 <p><small><a href="#Contents">Contents</a></small>
29507 <h4><a name="J.5.5" href="#J.5.5">J.5.5 Writable string literals</a></h4>
29508 <p><a name="J.5.5p1" href="#J.5.5p1"><small>1</small></a>
29509  String literals are modifiable (in which case, identical string literals should denote distinct
29510  objects) (<a href="#6.4.5">6.4.5</a>).
29511 <!--page 598 -->
29512
29513 <p><small><a href="#Contents">Contents</a></small>
29514 <h4><a name="J.5.6" href="#J.5.6">J.5.6 Other arithmetic types</a></h4>
29515 <p><a name="J.5.6p1" href="#J.5.6p1"><small>1</small></a>
29516  Additional arithmetic types, such as __int128 or double double, and their
29517  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
29518  more range or precision than long double, may be used for evaluating expressions of
29519  other floating types, and may be used to define float_t or double_t. Additional
29520  floating types may also have less range or precision than float.
29521
29522 <p><small><a href="#Contents">Contents</a></small>
29523 <h4><a name="J.5.7" href="#J.5.7">J.5.7 Function pointer casts</a></h4>
29524 <p><a name="J.5.7p1" href="#J.5.7p1"><small>1</small></a>
29525  A pointer to an object or to void may be cast to a pointer to a function, allowing data to
29526  be invoked as a function (<a href="#6.5.4">6.5.4</a>).
29527 <p><a name="J.5.7p2" href="#J.5.7p2"><small>2</small></a>
29528  A pointer to a function may be cast to a pointer to an object or to void, allowing a
29529  function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
29530
29531 <p><small><a href="#Contents">Contents</a></small>
29532 <h4><a name="J.5.8" href="#J.5.8">J.5.8 Extended bit-field types</a></h4>
29533 <p><a name="J.5.8p1" href="#J.5.8p1"><small>1</small></a>
29534  A bit-field may be declared with a type other than _Bool, unsigned int, or
29535  signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
29536
29537 <p><small><a href="#Contents">Contents</a></small>
29538 <h4><a name="J.5.9" href="#J.5.9">J.5.9 The fortran keyword</a></h4>
29539 <p><a name="J.5.9p1" href="#J.5.9p1"><small>1</small></a>
29540  The fortran function specifier may be used in a function declaration to indicate that
29541  calls suitable for FORTRAN should be generated, or that a different representation for the
29542  external name is to be generated (<a href="#6.7.4">6.7.4</a>).
29543
29544 <p><small><a href="#Contents">Contents</a></small>
29545 <h4><a name="J.5.10" href="#J.5.10">J.5.10 The asm keyword</a></h4>
29546 <p><a name="J.5.10p1" href="#J.5.10p1"><small>1</small></a>
29547  The asm keyword may be used to insert assembly language directly into the translator
29548  output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
29549 <pre>
29550         asm ( character-string-literal );
29551 </pre>
29552
29553 <p><small><a href="#Contents">Contents</a></small>
29554 <h4><a name="J.5.11" href="#J.5.11">J.5.11 Multiple external definitions</a></h4>
29555 <p><a name="J.5.11p1" href="#J.5.11p1"><small>1</small></a>
29556  There may be more than one external definition for the identifier of an object, with or
29557  without the explicit use of the keyword extern; if the definitions disagree, or more than
29558  one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
29559 <!--page 599 -->
29560
29561 <p><small><a href="#Contents">Contents</a></small>
29562 <h4><a name="J.5.12" href="#J.5.12">J.5.12 Predefined macro names</a></h4>
29563 <p><a name="J.5.12p1" href="#J.5.12p1"><small>1</small></a>
29564  Macro names that do not begin with an underscore, describing the translation and
29565  execution environments, are defined by the implementation before translation begins
29566  (<a href="#6.10.8">6.10.8</a>).
29567
29568 <p><small><a href="#Contents">Contents</a></small>
29569 <h4><a name="J.5.13" href="#J.5.13">J.5.13 Floating-point status flags</a></h4>
29570 <p><a name="J.5.13p1" href="#J.5.13p1"><small>1</small></a>
29571  If any floating-point status flags are set on normal termination after all calls to functions
29572  registered by the atexit function have been made (see <a href="#7.22.4.4">7.22.4.4</a>), the implementation
29573  writes some diagnostics indicating the fact to the stderr stream, if it is still open,
29574
29575 <p><small><a href="#Contents">Contents</a></small>
29576 <h4><a name="J.5.14" href="#J.5.14">J.5.14 Extra arguments for signal handlers</a></h4>
29577 <p><a name="J.5.14p1" href="#J.5.14p1"><small>1</small></a>
29578  Handlers for specific signals are called with extra arguments in addition to the signal
29579  number (<a href="#7.14.1.1">7.14.1.1</a>).
29580
29581 <p><small><a href="#Contents">Contents</a></small>
29582 <h4><a name="J.5.15" href="#J.5.15">J.5.15 Additional stream types and file-opening modes</a></h4>
29583 <p><a name="J.5.15p1" href="#J.5.15p1"><small>1</small></a>
29584  Additional mappings from files to streams are supported (<a href="#7.21.2">7.21.2</a>).
29585 <p><a name="J.5.15p2" href="#J.5.15p2"><small>2</small></a>
29586  Additional file-opening modes may be specified by characters appended to the mode
29587  argument of the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
29588
29589 <p><small><a href="#Contents">Contents</a></small>
29590 <h4><a name="J.5.16" href="#J.5.16">J.5.16 Defined file position indicator</a></h4>
29591 <p><a name="J.5.16p1" href="#J.5.16p1"><small>1</small></a>
29592  The file position indicator is decremented by each successful call to the ungetc or
29593  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>,
29594  <a href="#7.29.3.10">7.29.3.10</a>).
29595
29596 <p><small><a href="#Contents">Contents</a></small>
29597 <h4><a name="J.5.17" href="#J.5.17">J.5.17 Math error reporting</a></h4>
29598 <p><a name="J.5.17p1" href="#J.5.17p1"><small>1</small></a>
29599  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
29600  instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
29601  <a href="#7.12">7.12</a>).
29602 <!--page 600 -->
29603
29604 <p><small><a href="#Contents">Contents</a></small>
29605 <h2><a name="K" href="#K">Annex K</a></h2>
29606 <pre>
29607                                        (normative)
29608                            Bounds-checking interfaces
29609 </pre>
29610
29611 <p><small><a href="#Contents">Contents</a></small>
29612 <h3><a name="K.1" href="#K.1">K.1 Background</a></h3>
29613 <p><a name="K.1p1" href="#K.1p1"><small>1</small></a>
29614  Traditionally, the C Library has contained many functions that trust the programmer to
29615  provide output character arrays big enough to hold the result being produced. Not only
29616  do these functions not check that the arrays are big enough, they frequently lack the
29617  information needed to perform such checks. While it is possible to write safe, robust, and
29618  error-free code using the existing library, the library tends to promote programming styles
29619  that lead to mysterious failures if a result is too big for the provided array.
29620 <p><a name="K.1p2" href="#K.1p2"><small>2</small></a>
29621  A common programming style is to declare character arrays large enough to handle most
29622  practical cases. However, if these arrays are not large enough to handle the resulting
29623  strings, data can be written past the end of the array overwriting other data and program
29624  structures. The program never gets any indication that a problem exists, and so never has
29625  a chance to recover or to fail gracefully.
29626 <p><a name="K.1p3" href="#K.1p3"><small>3</small></a>
29627  Worse, this style of programming has compromised the security of computers and
29628  networks. Buffer overflows can often be exploited to run arbitrary code with the
29629  permissions of the vulnerable (defective) program.
29630 <p><a name="K.1p4" href="#K.1p4"><small>4</small></a>
29631  If the programmer writes runtime checks to verify lengths before calling library
29632  functions, then those runtime checks frequently duplicate work done inside the library
29633  functions, which discover string lengths as a side effect of doing their job.
29634 <p><a name="K.1p5" href="#K.1p5"><small>5</small></a>
29635  This annex provides alternative library functions that promote safer, more secure
29636  programming. The alternative functions verify that output buffers are large enough for
29637  the intended result and return a failure indicator if they are not. Data is never written past
29638  the end of an array. All string results are null terminated.
29639 <p><a name="K.1p6" href="#K.1p6"><small>6</small></a>
29640  This annex also addresses another problem that complicates writing robust code:
29641  functions that are not reentrant because they return pointers to static objects owned by the
29642  function. Such functions can be troublesome since a previously returned result can
29643  change if the function is called again, perhaps by another thread.
29644 <!--page 601 -->
29645
29646 <p><small><a href="#Contents">Contents</a></small>
29647 <h3><a name="K.2" href="#K.2">K.2 Scope</a></h3>
29648 <p><a name="K.2p1" href="#K.2p1"><small>1</small></a>
29649  This annex specifies a series of optional extensions that can be useful in the mitigation of
29650  security vulnerabilities in programs, and comprise new functions, macros, and types
29651  declared or defined in existing standard headers.
29652 <p><a name="K.2p2" href="#K.2p2"><small>2</small></a>
29653  An implementation that defines __STDC_LIB_EXT1__ shall conform to the
29654  specifications in this annex.<sup><a href="#note380"><b>380)</b></a></sup>
29655 <p><a name="K.2p3" href="#K.2p3"><small>3</small></a>
29656  Subclause <a href="#K.3">K.3</a> should be read as if it were merged into the parallel structure of named
29657  subclauses of clause 7.
29658
29659 <p><b>Footnotes</b>
29660 <p><small><a name="note380" href="#note380">380)</a> Implementations that do not define __STDC_LIB_EXT1__ are not required to conform to these
29661  specifications.
29662 </small>
29663
29664 <p><small><a href="#Contents">Contents</a></small>
29665 <h3><a name="K.3" href="#K.3">K.3 Library</a></h3>
29666
29667 <p><small><a href="#Contents">Contents</a></small>
29668 <h4><a name="K.3.1" href="#K.3.1">K.3.1 Introduction</a></h4>
29669
29670 <p><small><a href="#Contents">Contents</a></small>
29671 <h5><a name="K.3.1.1" href="#K.3.1.1">K.3.1.1 Standard headers</a></h5>
29672 <p><a name="K.3.1.1p1" href="#K.3.1.1p1"><small>1</small></a>
29673  The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are not
29674  declared or defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
29675  defined as a macro which expands to the integer constant 0 at the point in the source file
29676  where the appropriate header is first included.
29677 <p><a name="K.3.1.1p2" href="#K.3.1.1p2"><small>2</small></a>
29678  The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are
29679  declared and defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
29680  defined as a macro which expands to the integer constant 1 at the point in the source file
29681  where the appropriate header is first included.<sup><a href="#note381"><b>381)</b></a></sup>
29682 <p><a name="K.3.1.1p3" href="#K.3.1.1p3"><small>3</small></a>
29683  It is implementation-defined whether the functions, macros, and types declared or defined
29684  in <a href="#K.3">K.3</a> and its subclauses are declared or defined by their respective headers if
29685  __STDC_WANT_LIB_EXT1__ is not defined as a macro at the point in the source file
29686  where the appropriate header is first included.<sup><a href="#note382"><b>382)</b></a></sup>
29687 <p><a name="K.3.1.1p4" href="#K.3.1.1p4"><small>4</small></a>
29688  Within a preprocessing translation unit, __STDC_WANT_LIB_EXT1__ shall be
29689  defined identically for all inclusions of any headers from subclause <a href="#K.3">K.3</a>. If
29690  __STDC_WANT_LIB_EXT1__ is defined differently for any such inclusion, the
29691  implementation shall issue a diagnostic as if a preprocessor error directive were used.
29692  
29693  
29694 <!--page 602 -->
29695
29696 <p><b>Footnotes</b>
29697 <p><small><a name="note381" href="#note381">381)</a> Future revisions of this International Standard may define meanings for other values of
29698  __STDC_WANT_LIB_EXT1__.
29699 </small>
29700 <p><small><a name="note382" href="#note382">382)</a> Subclause <a href="#7.1.3">7.1.3</a> reserves certain names and patterns of names that an implementation may use in
29701  headers. All other names are not reserved, and a conforming implementation is not permitted to use
29702  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
29703  unreserved name is defined in a header when __STDC_WANT_LIB_EXT1__ is defined as 0, the
29704  implementation is not conforming.
29705 </small>
29706
29707 <p><small><a href="#Contents">Contents</a></small>
29708 <h5><a name="K.3.1.2" href="#K.3.1.2">K.3.1.2 Reserved identifiers</a></h5>
29709 <p><a name="K.3.1.2p1" href="#K.3.1.2p1"><small>1</small></a>
29710  Each macro name in any of the following subclauses is reserved for use as specified if it
29711  is defined by any of its associated headers when included; unless explicitly stated
29712  otherwise (see <a href="#7.1.4">7.1.4</a>).
29713 <p><a name="K.3.1.2p2" href="#K.3.1.2p2"><small>2</small></a>
29714  All identifiers with external linkage in any of the following subclauses are reserved for
29715  use as identifiers with external linkage if any of them are used by the program. None of
29716  them are reserved if none of them are used.
29717 <p><a name="K.3.1.2p3" href="#K.3.1.2p3"><small>3</small></a>
29718  Each identifier with file scope listed in any of the following subclauses is reserved for use
29719  as a macro name and as an identifier with file scope in the same name space if it is
29720  defined by any of its associated headers when included.
29721
29722 <p><small><a href="#Contents">Contents</a></small>
29723 <h5><a name="K.3.1.3" href="#K.3.1.3">K.3.1.3 Use of errno</a></h5>
29724 <p><a name="K.3.1.3p1" href="#K.3.1.3p1"><small>1</small></a>
29725  An implementation may set errno for the functions defined in this annex, but is not
29726  required to.
29727
29728 <p><small><a href="#Contents">Contents</a></small>
29729 <h5><a name="K.3.1.4" href="#K.3.1.4">K.3.1.4 Runtime-constraint violations</a></h5>
29730 <p><a name="K.3.1.4p1" href="#K.3.1.4p1"><small>1</small></a>
29731  Most functions in this annex include as part of their specification a list of runtime-
29732  constraints. These runtime-constraints are requirements on the program using the
29733  library.<sup><a href="#note383"><b>383)</b></a></sup>
29734 <p><a name="K.3.1.4p2" href="#K.3.1.4p2"><small>2</small></a>
29735  Implementations shall verify that the runtime-constraints for a function are not violated
29736  by the program. If a runtime-constraint is violated, the implementation shall call the
29737  currently registered runtime-constraint handler (see set_constraint_handler_s
29738  in <a href="#7.22">&lt;stdlib.h&gt;</a>). Multiple runtime-constraint violations in the same call to a library
29739  function result in only one call to the runtime-constraint handler. It is unspecified which
29740  one of the multiple runtime-constraint violations cause the handler to be called.
29741 <p><a name="K.3.1.4p3" href="#K.3.1.4p3"><small>3</small></a>
29742  If the runtime-constraints section for a function states an action to be performed when a
29743  runtime-constraint violation occurs, the function shall perform the action before calling
29744  the runtime-constraint handler. If the runtime-constraints section lists actions that are
29745  prohibited when a runtime-constraint violation occurs, then such actions are prohibited to
29746  the function both before calling the handler and after the handler returns.
29747 <p><a name="K.3.1.4p4" href="#K.3.1.4p4"><small>4</small></a>
29748  The runtime-constraint handler might not return. If the handler does return, the library
29749  function whose runtime-constraint was violated shall return some indication of failure as
29750  given by the returns section in the function's specification.
29751  
29752  
29753  
29754 <!--page 603 -->
29755
29756 <p><b>Footnotes</b>
29757 <p><small><a name="note383" href="#note383">383)</a> Although runtime-constraints replace many cases of undefined behavior, undefined behavior still
29758  exists in this annex. Implementations are free to detect any case of undefined behavior and treat it as a
29759  runtime-constraint violation by calling the runtime-constraint handler. This license comes directly
29760  from the definition of undefined behavior.
29761 </small>
29762
29763 <p><small><a href="#Contents">Contents</a></small>
29764 <h4><a name="K.3.2" href="#K.3.2">K.3.2 Errors &lt;errno.h&gt;</a></h4>
29765 <p><a name="K.3.2p1" href="#K.3.2p1"><small>1</small></a>
29766  The header <a href="#7.5">&lt;errno.h&gt;</a> defines a type.
29767 <p><a name="K.3.2p2" href="#K.3.2p2"><small>2</small></a>
29768  The type is
29769 <pre>
29770           errno_t
29771 </pre>
29772  which is type int.<sup><a href="#note384"><b>384)</b></a></sup>
29773
29774 <p><b>Footnotes</b>
29775 <p><small><a name="note384" href="#note384">384)</a> As a matter of programming style, errno_t may be used as the type of something that deals only
29776  with the values that might be found in errno. For example, a function which returns the value of
29777  errno might be declared as having the return type errno_t.
29778 </small>
29779
29780 <p><small><a href="#Contents">Contents</a></small>
29781 <h4><a name="K.3.3" href="#K.3.3">K.3.3 Common definitions &lt;stddef.h&gt;</a></h4>
29782 <p><a name="K.3.3p1" href="#K.3.3p1"><small>1</small></a>
29783  The header <a href="#7.19">&lt;stddef.h&gt;</a> defines a type.
29784 <p><a name="K.3.3p2" href="#K.3.3p2"><small>2</small></a>
29785  The type is
29786 <pre>
29787           rsize_t
29788 </pre>
29789  which is the type size_t.<sup><a href="#note385"><b>385)</b></a></sup>
29790
29791 <p><b>Footnotes</b>
29792 <p><small><a name="note385" href="#note385">385)</a> See the description of the RSIZE_MAX macro in <a href="#7.20">&lt;stdint.h&gt;</a>.
29793 </small>
29794
29795 <p><small><a href="#Contents">Contents</a></small>
29796 <h4><a name="K.3.4" href="#K.3.4">K.3.4 Integer types &lt;stdint.h&gt;</a></h4>
29797 <p><a name="K.3.4p1" href="#K.3.4p1"><small>1</small></a>
29798  The header <a href="#7.20">&lt;stdint.h&gt;</a> defines a macro.
29799 <p><a name="K.3.4p2" href="#K.3.4p2"><small>2</small></a>
29800  The macro is
29801 <pre>
29802           RSIZE_MAX
29803 </pre>
29804  which expands to a value<sup><a href="#note386"><b>386)</b></a></sup> of type size_t. Functions that have parameters of type
29805  rsize_t consider it a runtime-constraint violation if the values of those parameters are
29806  greater than RSIZE_MAX.
29807 <p><b>Recommended practice</b>
29808 <p><a name="K.3.4p3" href="#K.3.4p3"><small>3</small></a>
29809  Extremely large object sizes are frequently a sign that an object's size was calculated
29810  incorrectly. For example, negative numbers appear as very large positive numbers when
29811  converted to an unsigned type like size_t. Also, some implementations do not support
29812  objects as large as the maximum value that can be represented by type size_t.
29813 <p><a name="K.3.4p4" href="#K.3.4p4"><small>4</small></a>
29814  For those reasons, it is sometimes beneficial to restrict the range of object sizes to detect
29815  programming errors. For implementations targeting machines with large address spaces,
29816  it is recommended that RSIZE_MAX be defined as the smaller of the size of the largest
29817  object supported or (SIZE_MAX &gt;&gt; 1), even if this limit is smaller than the size of
29818  some legitimate, but very large, objects. Implementations targeting machines with small
29819  address spaces may wish to define RSIZE_MAX as SIZE_MAX, which means that there
29820  
29821 <!--page 604 -->
29822  is no object size that is considered a runtime-constraint violation.
29823
29824 <p><b>Footnotes</b>
29825 <p><small><a name="note386" href="#note386">386)</a> The macro RSIZE_MAX need not expand to a constant expression.
29826 </small>
29827
29828 <p><small><a href="#Contents">Contents</a></small>
29829 <h4><a name="K.3.5" href="#K.3.5">K.3.5 Input/output &lt;stdio.h&gt;</a></h4>
29830 <p><a name="K.3.5p1" href="#K.3.5p1"><small>1</small></a>
29831  The header <a href="#7.21">&lt;stdio.h&gt;</a> defines several macros and two types.
29832 <p><a name="K.3.5p2" href="#K.3.5p2"><small>2</small></a>
29833  The macros are
29834 <pre>
29835         L_tmpnam_s
29836 </pre>
29837  which expands to an integer constant expression that is the size needed for an array of
29838  char large enough to hold a temporary file name string generated by the tmpnam_s
29839  function;
29840 <pre>
29841         TMP_MAX_S
29842 </pre>
29843  which expands to an integer constant expression that is the maximum number of unique
29844  file names that can be generated by the tmpnam_s function.
29845 <p><a name="K.3.5p3" href="#K.3.5p3"><small>3</small></a>
29846  The types are
29847 <pre>
29848         errno_t
29849 </pre>
29850  which is type int; and
29851 <pre>
29852         rsize_t
29853 </pre>
29854  which is the type size_t.
29855
29856 <p><small><a href="#Contents">Contents</a></small>
29857 <h5><a name="K.3.5.1" href="#K.3.5.1">K.3.5.1 Operations on files</a></h5>
29858
29859 <p><small><a href="#Contents">Contents</a></small>
29860 <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>
29861 <p><b>Synopsis</b>
29862 <p><a name="K.3.5.1.1p1" href="#K.3.5.1.1p1"><small>1</small></a>
29863 <pre>
29864         #define __STDC_WANT_LIB_EXT1__ 1
29865         #include <a href="#7.21">&lt;stdio.h&gt;</a>
29866         errno_t tmpfile_s(FILE * restrict * restrict streamptr);
29867 </pre>
29868  Runtime-constraints
29869 <p><a name="K.3.5.1.1p2" href="#K.3.5.1.1p2"><small>2</small></a>
29870  streamptr shall not be a null pointer.
29871 <p><a name="K.3.5.1.1p3" href="#K.3.5.1.1p3"><small>3</small></a>
29872  If there is a runtime-constraint violation, tmpfile_s does not attempt to create a file.
29873 <p><b>Description</b>
29874 <p><a name="K.3.5.1.1p4" href="#K.3.5.1.1p4"><small>4</small></a>
29875  The tmpfile_s function creates a temporary binary file that is different from any other
29876  existing file and that will automatically be removed when it is closed or at program
29877  termination. If the program terminates abnormally, whether an open temporary file is
29878  removed is implementation-defined. The file is opened for update with "wb+" mode
29879  with the meaning that mode has in the fopen_s function (including the mode's effect
29880  on exclusive access and file permissions).
29881 <!--page 605 -->
29882 <p><a name="K.3.5.1.1p5" href="#K.3.5.1.1p5"><small>5</small></a>
29883  If the file was created successfully, then the pointer to FILE pointed to by streamptr
29884  will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
29885  to FILE pointed to by streamptr will be set to a null pointer.
29886 <p><b>Recommended practice</b>
29887  It should be possible to open at least TMP_MAX_S temporary files during the lifetime of
29888  the program (this limit may be shared with tmpnam_s) and there should be no limit on
29889  the number simultaneously open other than this limit and any limit on the number of open
29890  files (FOPEN_MAX).
29891 <p><b>Returns</b>
29892 <p><a name="K.3.5.1.1p6" href="#K.3.5.1.1p6"><small>6</small></a>
29893  The tmpfile_s function returns zero if it created the file. If it did not create the file or
29894  there was a runtime-constraint violation, tmpfile_s returns a nonzero value.
29895
29896 <p><small><a href="#Contents">Contents</a></small>
29897 <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>
29898 <p><b>Synopsis</b>
29899 <p><a name="K.3.5.1.2p1" href="#K.3.5.1.2p1"><small>1</small></a>
29900 <pre>
29901          #define __STDC_WANT_LIB_EXT1__ 1
29902          #include <a href="#7.21">&lt;stdio.h&gt;</a>
29903          errno_t tmpnam_s(char *s, rsize_t maxsize);
29904 </pre>
29905  Runtime-constraints
29906 <p><a name="K.3.5.1.2p2" href="#K.3.5.1.2p2"><small>2</small></a>
29907  s shall not be a null pointer. maxsize shall be less than or equal to RSIZE_MAX.
29908  maxsize shall be greater than the length of the generated file name string.
29909 <p><b>Description</b>
29910 <p><a name="K.3.5.1.2p3" href="#K.3.5.1.2p3"><small>3</small></a>
29911  The tmpnam_s function generates a string that is a valid file name and that is not the
29912  same as the name of an existing file.<sup><a href="#note387"><b>387)</b></a></sup> The function is potentially capable of generating
29913  TMP_MAX_S different strings, but any or all of them may already be in use by existing
29914  files and thus not be suitable return values. The lengths of these strings shall be less than
29915  the value of the L_tmpnam_s macro.
29916 <p><a name="K.3.5.1.2p4" href="#K.3.5.1.2p4"><small>4</small></a>
29917  The tmpnam_s function generates a different string each time it is called.
29918 <p><a name="K.3.5.1.2p5" href="#K.3.5.1.2p5"><small>5</small></a>
29919  It is assumed that s points to an array of at least maxsize characters. This array will be
29920  set to generated string, as specified below.
29921  
29922  
29923  
29924 <!--page 606 -->
29925 <p><a name="K.3.5.1.2p6" href="#K.3.5.1.2p6"><small>6</small></a>
29926  The implementation shall behave as if no library function except tmpnam calls the
29927  tmpnam_s function.<sup><a href="#note388"><b>388)</b></a></sup>
29928 <p><b>Recommended practice</b>
29929 <p><a name="K.3.5.1.2p7" href="#K.3.5.1.2p7"><small>7</small></a>
29930  After a program obtains a file name using the tmpnam_s function and before the
29931  program creates a file with that name, the possibility exists that someone else may create
29932  a file with that same name. To avoid this race condition, the tmpfile_s function
29933  should be used instead of tmpnam_s when possible. One situation that requires the use
29934  of the tmpnam_s function is when the program needs to create a temporary directory
29935  rather than a temporary file.
29936 <p><b>Returns</b>
29937 <p><a name="K.3.5.1.2p8" href="#K.3.5.1.2p8"><small>8</small></a>
29938  If no suitable string can be generated, or if there is a runtime-constraint violation, the
29939  tmpnam_s function writes a null character to s[0] (only if s is not null and maxsize
29940  is greater than zero) and returns a nonzero value.
29941 <p><a name="K.3.5.1.2p9" href="#K.3.5.1.2p9"><small>9</small></a>
29942  Otherwise, the tmpnam_s function writes the string in the array pointed to by s and
29943  returns zero.
29944 <p><b>Environmental limits</b>
29945 <p><a name="K.3.5.1.2p10" href="#K.3.5.1.2p10"><small>10</small></a>
29946  The value of the macro TMP_MAX_S shall be at least 25.
29947
29948 <p><b>Footnotes</b>
29949 <p><small><a name="note387" href="#note387">387)</a> Files created using strings generated by the tmpnam_s function are temporary only in the sense that
29950  their names should not collide with those generated by conventional naming rules for the
29951  implementation. It is still necessary to use the remove function to remove such files when their use
29952  is ended, and before program termination. Implementations should take care in choosing the patterns
29953  used for names returned by tmpnam_s. For example, making a thread id part of the names avoids the
29954  race condition and possible conflict when multiple programs run simultaneously by the same user
29955  generate the same temporary file names.
29956 </small>
29957 <p><small><a name="note388" href="#note388">388)</a> An implementation may have tmpnam call tmpnam_s (perhaps so there is only one naming
29958  convention for temporary files), but this is not required.
29959 </small>
29960
29961 <p><small><a href="#Contents">Contents</a></small>
29962 <h5><a name="K.3.5.2" href="#K.3.5.2">K.3.5.2 File access functions</a></h5>
29963
29964 <p><small><a href="#Contents">Contents</a></small>
29965 <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>
29966 <p><b>Synopsis</b>
29967 <p><a name="K.3.5.2.1p1" href="#K.3.5.2.1p1"><small>1</small></a>
29968 <pre>
29969         #define __STDC_WANT_LIB_EXT1__ 1
29970         #include <a href="#7.21">&lt;stdio.h&gt;</a>
29971         errno_t fopen_s(FILE * restrict * restrict streamptr,
29972              const char * restrict filename,
29973              const char * restrict mode);
29974 </pre>
29975  Runtime-constraints
29976 <p><a name="K.3.5.2.1p2" href="#K.3.5.2.1p2"><small>2</small></a>
29977  None of streamptr, filename, or mode shall be a null pointer.
29978 <p><a name="K.3.5.2.1p3" href="#K.3.5.2.1p3"><small>3</small></a>
29979  If there is a runtime-constraint violation, fopen_s does not attempt to open a file.
29980  Furthermore, if streamptr is not a null pointer, fopen_s sets *streamptr to the
29981  null pointer.
29982  
29983  
29984  
29985  
29986 <!--page 607 -->
29987 <p><b>Description</b>
29988 <p><a name="K.3.5.2.1p4" href="#K.3.5.2.1p4"><small>4</small></a>
29989  The fopen_s function opens the file whose name is the string pointed to by
29990  filename, and associates a stream with it.
29991 <p><a name="K.3.5.2.1p5" href="#K.3.5.2.1p5"><small>5</small></a>
29992  The mode string shall be as described for fopen, with the addition that modes starting
29993  with the character 'w' or 'a' may be preceded by the character 'u', see below:
29994  uw             truncate to zero length or create text file for writing, default
29995 <pre>
29996                 permissions
29997 </pre>
29998  uwx            create text file for writing, default permissions
29999  ua             append; open or create text file for writing at end-of-file, default
30000 <pre>
30001                 permissions
30002 </pre>
30003  uwb            truncate to zero length or create binary file for writing, default
30004 <pre>
30005                 permissions
30006 </pre>
30007  uwbx           create binary file for writing, default permissions
30008  uab            append; open or create binary file for writing at end-of-file, default
30009 <pre>
30010                 permissions
30011 </pre>
30012  uw+            truncate to zero length or create text file for update, default
30013 <pre>
30014                 permissions
30015 </pre>
30016  uw+x           create text file for update, default permissions
30017  ua+            append; open or create text file for update, writing at end-of-file,
30018 <pre>
30019                 default permissions
30020 </pre>
30021  uw+b or uwb+   truncate to zero length or create binary file for update, default
30022 <pre>
30023                 permissions
30024 </pre>
30025  uw+bx or uwb+x create binary file for update, default permissions
30026  ua+b or uab+   append; open or create binary file for update, writing at end-of-file,
30027 <pre>
30028                 default permissions
30029 </pre>
30030 <p><a name="K.3.5.2.1p6" href="#K.3.5.2.1p6"><small>6</small></a>
30031  Opening a file with exclusive mode ('x' as the last character in the mode argument)
30032  fails if the file already exists or cannot be created.
30033 <p><a name="K.3.5.2.1p7" href="#K.3.5.2.1p7"><small>7</small></a>
30034  To the extent that the underlying system supports the concepts, files opened for writing
30035  shall be opened with exclusive (also known as non-shared) access. If the file is being
30036  created, and the first character of the mode string is not 'u', to the extent that the
30037  underlying system supports it, the file shall have a file permission that prevents other
30038  users on the system from accessing the file. If the file is being created and first character
30039  of the mode string is 'u', then by the time the file has been closed, it shall have the
30040  system default file access permissions.<sup><a href="#note389"><b>389)</b></a></sup>
30041 <p><a name="K.3.5.2.1p8" href="#K.3.5.2.1p8"><small>8</small></a>
30042  If the file was opened successfully, then the pointer to FILE pointed to by streamptr
30043  will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
30044  
30045  
30046 <!--page 608 -->
30047  to FILE pointed to by streamptr will be set to a null pointer.
30048 <p><b>Returns</b>
30049 <p><a name="K.3.5.2.1p9" href="#K.3.5.2.1p9"><small>9</small></a>
30050  The fopen_s function returns zero if it opened the file. If it did not open the file or if
30051  there was a runtime-constraint violation, fopen_s returns a nonzero value.
30052
30053 <p><b>Footnotes</b>
30054 <p><small><a name="note389" href="#note389">389)</a> These are the same permissions that the file would have been created with by fopen.
30055 </small>
30056
30057 <p><small><a href="#Contents">Contents</a></small>
30058 <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>
30059 <p><b>Synopsis</b>
30060 <p><a name="K.3.5.2.2p1" href="#K.3.5.2.2p1"><small>1</small></a>
30061 <pre>
30062         #define __STDC_WANT_LIB_EXT1__ 1
30063         #include <a href="#7.21">&lt;stdio.h&gt;</a>
30064         errno_t freopen_s(FILE * restrict * restrict newstreamptr,
30065              const char * restrict filename,
30066              const char * restrict mode,
30067              FILE * restrict stream);
30068 </pre>
30069  Runtime-constraints
30070 <p><a name="K.3.5.2.2p2" href="#K.3.5.2.2p2"><small>2</small></a>
30071  None of newstreamptr, mode, and stream shall be a null pointer.
30072 <p><a name="K.3.5.2.2p3" href="#K.3.5.2.2p3"><small>3</small></a>
30073  If there is a runtime-constraint violation, freopen_s neither attempts to close any file
30074  associated with stream nor attempts to open a file. Furthermore, if newstreamptr is
30075  not a null pointer, fopen_s sets *newstreamptr to the null pointer.
30076 <p><b>Description</b>
30077 <p><a name="K.3.5.2.2p4" href="#K.3.5.2.2p4"><small>4</small></a>
30078  The freopen_s function opens the file whose name is the string pointed to by
30079  filename and associates the stream pointed to by stream with it. The mode
30080  argument has the same meaning as in the fopen_s function (including the mode's effect
30081  on exclusive access and file permissions).
30082 <p><a name="K.3.5.2.2p5" href="#K.3.5.2.2p5"><small>5</small></a>
30083  If filename is a null pointer, the freopen_s function attempts to change the mode of
30084  the stream to that specified by mode, as if the name of the file currently associated with
30085  the stream had been used. It is implementation-defined which changes of mode are
30086  permitted (if any), and under what circumstances.
30087 <p><a name="K.3.5.2.2p6" href="#K.3.5.2.2p6"><small>6</small></a>
30088  The freopen_s function first attempts to close any file that is associated with stream.
30089  Failure to close the file is ignored. The error and end-of-file indicators for the stream are
30090  cleared.
30091 <p><a name="K.3.5.2.2p7" href="#K.3.5.2.2p7"><small>7</small></a>
30092  If the file was opened successfully, then the pointer to FILE pointed to by
30093  newstreamptr will be set to the value of stream. Otherwise, the pointer to FILE
30094  pointed to by newstreamptr will be set to a null pointer.
30095 <p><b>Returns</b>
30096 <p><a name="K.3.5.2.2p8" href="#K.3.5.2.2p8"><small>8</small></a>
30097  The freopen_s function returns zero if it opened the file. If it did not open the file or
30098  there was a runtime-constraint violation, freopen_s returns a nonzero value.
30099 <!--page 609 -->
30100
30101 <p><small><a href="#Contents">Contents</a></small>
30102 <h5><a name="K.3.5.3" href="#K.3.5.3">K.3.5.3 Formatted input/output functions</a></h5>
30103 <p><a name="K.3.5.3p1" href="#K.3.5.3p1"><small>1</small></a>
30104  Unless explicitly stated otherwise, if the execution of a function described in this
30105  subclause causes copying to take place between objects that overlap, the objects take on
30106  unspecified values.
30107
30108 <p><small><a href="#Contents">Contents</a></small>
30109 <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>
30110 <p><b>Synopsis</b>
30111 <p><a name="K.3.5.3.1p1" href="#K.3.5.3.1p1"><small>1</small></a>
30112 <pre>
30113           #define __STDC_WANT_LIB_EXT1__ 1
30114           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30115           int fprintf_s(FILE * restrict stream,
30116                const char * restrict format, ...);
30117 </pre>
30118  Runtime-constraints
30119 <p><a name="K.3.5.3.1p2" href="#K.3.5.3.1p2"><small>2</small></a>
30120  Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note390"><b>390)</b></a></sup> (modified or
30121  not by flags, field width, or precision) shall not appear in the string pointed to by
30122  format. Any argument to fprintf_s corresponding to a %s specifier shall not be a
30123  null pointer.
30124 <p><a name="K.3.5.3.1p3" href="#K.3.5.3.1p3"><small>3</small></a>
30125  If there is a runtime-constraint violation,<sup><a href="#note391"><b>391)</b></a></sup> the fprintf_s function does not attempt
30126  to produce further output, and it is unspecified to what extent fprintf_s produced
30127  output before discovering the runtime-constraint violation.
30128 <p><b>Description</b>
30129 <p><a name="K.3.5.3.1p4" href="#K.3.5.3.1p4"><small>4</small></a>
30130  The fprintf_s function is equivalent to the fprintf function except for the explicit
30131  runtime-constraints listed above.
30132 <p><b>Returns</b>
30133 <p><a name="K.3.5.3.1p5" href="#K.3.5.3.1p5"><small>5</small></a>
30134  The fprintf_s function returns the number of characters transmitted, or a negative
30135  value if an output error, encoding error, or runtime-constraint violation occurred.
30136  
30137  
30138  
30139  
30140 <!--page 610 -->
30141
30142 <p><b>Footnotes</b>
30143 <p><small><a name="note390" href="#note390">390)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30144  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30145  format string was %%n.
30146 </small>
30147 <p><small><a name="note391" href="#note391">391)</a> Because an implementation may treat any undefined behavior as a runtime-constraint violation, an
30148  implementation may treat any unsupported specifiers in the string pointed to by format as a runtime-
30149  constraint violation.
30150 </small>
30151
30152 <p><small><a href="#Contents">Contents</a></small>
30153 <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>
30154 <p><b>Synopsis</b>
30155 <p><a name="K.3.5.3.2p1" href="#K.3.5.3.2p1"><small>1</small></a>
30156 <pre>
30157          #define __STDC_WANT_LIB_EXT1__ 1
30158          #include <a href="#7.21">&lt;stdio.h&gt;</a>
30159          int fscanf_s(FILE * restrict stream,
30160               const char * restrict format, ...);
30161 </pre>
30162  Runtime-constraints
30163 <p><a name="K.3.5.3.2p2" href="#K.3.5.3.2p2"><small>2</small></a>
30164  Neither stream nor format shall be a null pointer. Any argument indirected though in
30165  order to store converted input shall not be a null pointer.
30166 <p><a name="K.3.5.3.2p3" href="#K.3.5.3.2p3"><small>3</small></a>
30167  If there is a runtime-constraint violation,<sup><a href="#note392"><b>392)</b></a></sup> the fscanf_s function does not attempt to
30168  perform further input, and it is unspecified to what extent fscanf_s performed input
30169  before discovering the runtime-constraint violation.
30170 <p><b>Description</b>
30171 <p><a name="K.3.5.3.2p4" href="#K.3.5.3.2p4"><small>4</small></a>
30172  The fscanf_s function is equivalent to fscanf except that the c, s, and [ conversion
30173  specifiers apply to a pair of arguments (unless assignment suppression is indicated by a
30174  *). The first of these arguments is the same as for fscanf. That argument is
30175  immediately followed in the argument list by the second argument, which has type
30176  rsize_t and gives the number of elements in the array pointed to by the first argument
30177  of the pair. If the first argument points to a scalar object, it is considered to be an array of
30178  one element.<sup><a href="#note393"><b>393)</b></a></sup>
30179 <p><a name="K.3.5.3.2p5" href="#K.3.5.3.2p5"><small>5</small></a>
30180  A matching failure occurs if the number of elements in a receiving object is insufficient to
30181  hold the converted input (including any trailing null character).
30182 <p><b>Returns</b>
30183 <p><a name="K.3.5.3.2p6" href="#K.3.5.3.2p6"><small>6</small></a>
30184  The fscanf_s function returns the value of the macro EOF if an input failure occurs
30185  before any conversion or if there is a runtime-constraint violation. Otherwise, the
30186  
30187 <!--page 611 -->
30188  fscanf_s function returns the number of input items assigned, which can be fewer than
30189  provided for, or even zero, in the event of an early matching failure.
30190 <p><a name="K.3.5.3.2p7" href="#K.3.5.3.2p7"><small>7</small></a>
30191  EXAMPLE 1        The call:
30192 <pre>
30193           #define __STDC_WANT_LIB_EXT1__ 1
30194           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30195           /* ... */
30196           int n, i; float x; char name[50];
30197           n = fscanf_s(stdin, "%d%f%s", &amp;i, &amp;x, name, (rsize_t) 50);
30198 </pre>
30199  with the input line:
30200 <pre>
30201           25 54.32E-1 thompson
30202 </pre>
30203  will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
30204  thompson\0.
30205  
30206 <p><a name="K.3.5.3.2p8" href="#K.3.5.3.2p8"><small>8</small></a>
30207  EXAMPLE 2        The call:
30208 <pre>
30209           #define __STDC_WANT_LIB_EXT1__ 1
30210           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30211           /* ... */
30212           int n; char s[5];
30213           n = fscanf_s(stdin, "%s", s, sizeof s);
30214 </pre>
30215  with the input line:
30216 <pre>
30217           hello
30218 </pre>
30219  will assign to n the value 0 since a matching failure occurred because the sequence hello\0 requires an
30220  array of six characters to store it.
30221  
30222
30223 <p><b>Footnotes</b>
30224 <p><small><a name="note392" href="#note392">392)</a> Because an implementation may treat any undefined behavior as a runtime-constraint violation, an
30225  implementation may treat any unsupported specifiers in the string pointed to by format as a runtime-
30226  constraint violation.
30227 </small>
30228 <p><small><a name="note393" href="#note393">393)</a> If the format is known at translation time, an implementation may issue a diagnostic for any argument
30229  used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
30230  argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
30231  the format is not known at translation time. For example, an implementation may issue a diagnostic
30232  for each argument after format that has of type pointer to one of char, signed char,
30233  unsigned char, or void that is not followed by an argument of a type compatible with
30234  rsize_t. The diagnostic could warn that unless the pointer is being used with a conversion specifier
30235  using the hh length modifier, a length argument must follow the pointer argument. Another useful
30236  diagnostic could flag any non-pointer argument following format that did not have a type
30237  compatible with rsize_t.
30238 </small>
30239
30240 <p><small><a href="#Contents">Contents</a></small>
30241 <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>
30242 <p><b>Synopsis</b>
30243 <p><a name="K.3.5.3.3p1" href="#K.3.5.3.3p1"><small>1</small></a>
30244 <pre>
30245           #define __STDC_WANT_LIB_EXT1__ 1
30246           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30247           int printf_s(const char * restrict format, ...);
30248 </pre>
30249  Runtime-constraints
30250 <p><a name="K.3.5.3.3p2" href="#K.3.5.3.3p2"><small>2</small></a>
30251  format shall not be a null pointer. The %n specifier<sup><a href="#note394"><b>394)</b></a></sup> (modified or not by flags, field
30252  width, or precision) shall not appear in the string pointed to by format. Any argument
30253  to printf_s corresponding to a %s specifier shall not be a null pointer.
30254 <p><a name="K.3.5.3.3p3" href="#K.3.5.3.3p3"><small>3</small></a>
30255  If there is a runtime-constraint violation, the printf_s function does not attempt to
30256  produce further output, and it is unspecified to what extent printf_s produced output
30257  before discovering the runtime-constraint violation.
30258  
30259  
30260 <!--page 612 -->
30261 <p><b>Description</b>
30262 <p><a name="K.3.5.3.3p4" href="#K.3.5.3.3p4"><small>4</small></a>
30263  The printf_s function is equivalent to the printf function except for the explicit
30264  runtime-constraints listed above.
30265 <p><b>Returns</b>
30266 <p><a name="K.3.5.3.3p5" href="#K.3.5.3.3p5"><small>5</small></a>
30267  The printf_s function returns the number of characters transmitted, or a negative
30268  value if an output error, encoding error, or runtime-constraint violation occurred.
30269
30270 <p><b>Footnotes</b>
30271 <p><small><a name="note394" href="#note394">394)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30272  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30273  format string was %%n.
30274 </small>
30275
30276 <p><small><a href="#Contents">Contents</a></small>
30277 <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>
30278 <p><b>Synopsis</b>
30279 <p><a name="K.3.5.3.4p1" href="#K.3.5.3.4p1"><small>1</small></a>
30280 <pre>
30281         #define __STDC_WANT_LIB_EXT1__ 1
30282         #include <a href="#7.21">&lt;stdio.h&gt;</a>
30283         int scanf_s(const char * restrict format, ...);
30284 </pre>
30285  Runtime-constraints
30286 <p><a name="K.3.5.3.4p2" href="#K.3.5.3.4p2"><small>2</small></a>
30287  format shall not be a null pointer. Any argument indirected though in order to store
30288  converted input shall not be a null pointer.
30289 <p><a name="K.3.5.3.4p3" href="#K.3.5.3.4p3"><small>3</small></a>
30290  If there is a runtime-constraint violation, the scanf_s function does not attempt to
30291  perform further input, and it is unspecified to what extent scanf_s performed input
30292  before discovering the runtime-constraint violation.
30293 <p><b>Description</b>
30294 <p><a name="K.3.5.3.4p4" href="#K.3.5.3.4p4"><small>4</small></a>
30295  The scanf_s function is equivalent to fscanf_s with the argument stdin
30296  interposed before the arguments to scanf_s.
30297 <p><b>Returns</b>
30298 <p><a name="K.3.5.3.4p5" href="#K.3.5.3.4p5"><small>5</small></a>
30299  The scanf_s function returns the value of the macro EOF if an input failure occurs
30300  before any conversion or if there is a runtime-constraint violation. Otherwise, the
30301  scanf_s function returns the number of input items assigned, which can be fewer than
30302  provided for, or even zero, in the event of an early matching failure.
30303
30304 <p><small><a href="#Contents">Contents</a></small>
30305 <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>
30306 <p><b>Synopsis</b>
30307 <p><a name="K.3.5.3.5p1" href="#K.3.5.3.5p1"><small>1</small></a>
30308 <pre>
30309         #define __STDC_WANT_LIB_EXT1__ 1
30310         #include <a href="#7.21">&lt;stdio.h&gt;</a>
30311         int snprintf_s(char * restrict s, rsize_t n,
30312              const char * restrict format, ...);
30313 </pre>
30314  Runtime-constraints
30315 <p><a name="K.3.5.3.5p2" href="#K.3.5.3.5p2"><small>2</small></a>
30316  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
30317  than RSIZE_MAX. The %n specifier<sup><a href="#note395"><b>395)</b></a></sup> (modified or not by flags, field width, or
30318  precision) shall not appear in the string pointed to by format. Any argument to
30319 <!--page 613 -->
30320  snprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
30321  error shall occur.
30322 <p><a name="K.3.5.3.5p3" href="#K.3.5.3.5p3"><small>3</small></a>
30323  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
30324  than zero and less than RSIZE_MAX, then the snprintf_s function sets s[0] to the
30325  null character.
30326 <p><b>Description</b>
30327 <p><a name="K.3.5.3.5p4" href="#K.3.5.3.5p4"><small>4</small></a>
30328  The snprintf_s function is equivalent to the snprintf function except for the
30329  explicit runtime-constraints listed above.
30330 <p><a name="K.3.5.3.5p5" href="#K.3.5.3.5p5"><small>5</small></a>
30331  The snprintf_s function, unlike sprintf_s, will truncate the result to fit within the
30332  array pointed to by s.
30333 <p><b>Returns</b>
30334 <p><a name="K.3.5.3.5p6" href="#K.3.5.3.5p6"><small>6</small></a>
30335  The snprintf_s function returns the number of characters that would have been
30336  written had n been sufficiently large, not counting the terminating null character, or a
30337  negative value if a runtime-constraint violation occurred. Thus, the null-terminated
30338  output has been completely written if and only if the returned value is nonnegative and
30339  less than n.
30340
30341 <p><b>Footnotes</b>
30342 <p><small><a name="note395" href="#note395">395)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30343  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30344  format string was %%n.
30345 </small>
30346
30347 <p><small><a href="#Contents">Contents</a></small>
30348 <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>
30349 <p><b>Synopsis</b>
30350 <p><a name="K.3.5.3.6p1" href="#K.3.5.3.6p1"><small>1</small></a>
30351 <pre>
30352           #define __STDC_WANT_LIB_EXT1__ 1
30353           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30354           int sprintf_s(char * restrict s, rsize_t n,
30355                const char * restrict format, ...);
30356 </pre>
30357  Runtime-constraints
30358 <p><a name="K.3.5.3.6p2" href="#K.3.5.3.6p2"><small>2</small></a>
30359  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
30360  than RSIZE_MAX. The number of characters (including the trailing null) required for the
30361  result to be written to the array pointed to by s shall not be greater than n. The %n
30362  specifier<sup><a href="#note396"><b>396)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
30363  string pointed to by format. Any argument to sprintf_s corresponding to a %s
30364  specifier shall not be a null pointer. No encoding error shall occur.
30365  
30366  
30367  
30368 <!--page 614 -->
30369 <p><a name="K.3.5.3.6p3" href="#K.3.5.3.6p3"><small>3</small></a>
30370  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
30371  than zero and less than RSIZE_MAX, then the sprintf_s function sets s[0] to the
30372  null character.
30373 <p><b>Description</b>
30374 <p><a name="K.3.5.3.6p4" href="#K.3.5.3.6p4"><small>4</small></a>
30375  The sprintf_s function is equivalent to the sprintf function except for the
30376  parameter n and the explicit runtime-constraints listed above.
30377 <p><a name="K.3.5.3.6p5" href="#K.3.5.3.6p5"><small>5</small></a>
30378  The sprintf_s function, unlike snprintf_s, treats a result too big for the array
30379  pointed to by s as a runtime-constraint violation.
30380 <p><b>Returns</b>
30381 <p><a name="K.3.5.3.6p6" href="#K.3.5.3.6p6"><small>6</small></a>
30382  If no runtime-constraint violation occurred, the sprintf_s function returns the number
30383  of characters written in the array, not counting the terminating null character. If an
30384  encoding error occurred, sprintf_s returns a negative value. If any other runtime-
30385  constraint violation occurred, sprintf_s returns zero.
30386
30387 <p><b>Footnotes</b>
30388 <p><small><a name="note396" href="#note396">396)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30389  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30390  format string was %%n.
30391 </small>
30392
30393 <p><small><a href="#Contents">Contents</a></small>
30394 <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>
30395 <p><b>Synopsis</b>
30396 <p><a name="K.3.5.3.7p1" href="#K.3.5.3.7p1"><small>1</small></a>
30397 <pre>
30398         #define __STDC_WANT_LIB_EXT1__ 1
30399         #include <a href="#7.21">&lt;stdio.h&gt;</a>
30400         int sscanf_s(const char * restrict s,
30401              const char * restrict format, ...);
30402 </pre>
30403  Runtime-constraints
30404 <p><a name="K.3.5.3.7p2" href="#K.3.5.3.7p2"><small>2</small></a>
30405  Neither s nor format shall be a null pointer. Any argument indirected though in order
30406  to store converted input shall not be a null pointer.
30407 <p><a name="K.3.5.3.7p3" href="#K.3.5.3.7p3"><small>3</small></a>
30408  If there is a runtime-constraint violation, the sscanf_s function does not attempt to
30409  perform further input, and it is unspecified to what extent sscanf_s performed input
30410  before discovering the runtime-constraint violation.
30411 <p><b>Description</b>
30412 <p><a name="K.3.5.3.7p4" href="#K.3.5.3.7p4"><small>4</small></a>
30413  The sscanf_s function is equivalent to fscanf_s, except that input is obtained from
30414  a string (specified by the argument s) rather than from a stream. Reaching the end of the
30415  string is equivalent to encountering end-of-file for the fscanf_s function. If copying
30416  takes place between objects that overlap, the objects take on unspecified values.
30417 <p><b>Returns</b>
30418 <p><a name="K.3.5.3.7p5" href="#K.3.5.3.7p5"><small>5</small></a>
30419  The sscanf_s function returns the value of the macro EOF if an input failure occurs
30420  before any conversion or if there is a runtime-constraint violation. Otherwise, the
30421  sscanf_s function returns the number of input items assigned, which can be fewer than
30422  provided for, or even zero, in the event of an early matching failure.
30423 <!--page 615 -->
30424
30425 <p><small><a href="#Contents">Contents</a></small>
30426 <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>
30427 <p><b>Synopsis</b>
30428 <p><a name="K.3.5.3.8p1" href="#K.3.5.3.8p1"><small>1</small></a>
30429 <pre>
30430           #define __STDC_WANT_LIB_EXT1__ 1
30431           #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30432           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30433           int vfprintf_s(FILE * restrict stream,
30434                const char * restrict format,
30435                va_list arg);
30436 </pre>
30437  Runtime-constraints
30438 <p><a name="K.3.5.3.8p2" href="#K.3.5.3.8p2"><small>2</small></a>
30439  Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note397"><b>397)</b></a></sup> (modified or
30440  not by flags, field width, or precision) shall not appear in the string pointed to by
30441  format. Any argument to vfprintf_s corresponding to a %s specifier shall not be a
30442  null pointer.
30443 <p><a name="K.3.5.3.8p3" href="#K.3.5.3.8p3"><small>3</small></a>
30444  If there is a runtime-constraint violation, the vfprintf_s function does not attempt to
30445  produce further output, and it is unspecified to what extent vfprintf_s produced
30446  output before discovering the runtime-constraint violation.
30447 <p><b>Description</b>
30448 <p><a name="K.3.5.3.8p4" href="#K.3.5.3.8p4"><small>4</small></a>
30449  The vfprintf_s function is equivalent to the vfprintf function except for the
30450  explicit runtime-constraints listed above.
30451 <p><b>Returns</b>
30452 <p><a name="K.3.5.3.8p5" href="#K.3.5.3.8p5"><small>5</small></a>
30453  The vfprintf_s function returns the number of characters transmitted, or a negative
30454  value if an output error, encoding error, or runtime-constraint violation occurred.
30455
30456 <p><b>Footnotes</b>
30457 <p><small><a name="note397" href="#note397">397)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30458  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30459  format string was %%n.
30460 </small>
30461
30462 <p><small><a href="#Contents">Contents</a></small>
30463 <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>
30464 <p><b>Synopsis</b>
30465 <p><a name="K.3.5.3.9p1" href="#K.3.5.3.9p1"><small>1</small></a>
30466 <pre>
30467           #define __STDC_WANT_LIB_EXT1__ 1
30468           #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30469           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30470           int vfscanf_s(FILE * restrict stream,
30471                const char * restrict format,
30472                va_list arg);
30473 </pre>
30474  
30475  
30476  
30477  
30478 <!--page 616 -->
30479  Runtime-constraints
30480 <p><a name="K.3.5.3.9p2" href="#K.3.5.3.9p2"><small>2</small></a>
30481  Neither stream nor format shall be a null pointer. Any argument indirected though in
30482  order to store converted input shall not be a null pointer.
30483 <p><a name="K.3.5.3.9p3" href="#K.3.5.3.9p3"><small>3</small></a>
30484  If there is a runtime-constraint violation, the vfscanf_s function does not attempt to
30485  perform further input, and it is unspecified to what extent vfscanf_s performed input
30486  before discovering the runtime-constraint violation.
30487 <p><b>Description</b>
30488 <p><a name="K.3.5.3.9p4" href="#K.3.5.3.9p4"><small>4</small></a>
30489  The vfscanf_s function is equivalent to fscanf_s, with the variable argument list
30490  replaced by arg, which shall have been initialized by the va_start macro (and
30491  possibly subsequent va_arg calls). The vfscanf_s function does not invoke the
30492  va_end macro.<sup><a href="#note398"><b>398)</b></a></sup>
30493 <p><b>Returns</b>
30494 <p><a name="K.3.5.3.9p5" href="#K.3.5.3.9p5"><small>5</small></a>
30495  The vfscanf_s function returns the value of the macro EOF if an input failure occurs
30496  before any conversion or if there is a runtime-constraint violation. Otherwise, the
30497  vfscanf_s function returns the number of input items assigned, which can be fewer
30498  than provided for, or even zero, in the event of an early matching failure.
30499
30500 <p><b>Footnotes</b>
30501 <p><small><a name="note398" href="#note398">398)</a> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
30502  vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
30503  indeterminate.
30504 </small>
30505
30506 <p><small><a href="#Contents">Contents</a></small>
30507 <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>
30508 <p><b>Synopsis</b>
30509 <p><a name="K.3.5.3.10p1" href="#K.3.5.3.10p1"><small>1</small></a>
30510 <pre>
30511           #define __STDC_WANT_LIB_EXT1__ 1
30512           #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30513           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30514           int vprintf_s(const char * restrict format,
30515                va_list arg);
30516 </pre>
30517  Runtime-constraints
30518 <p><a name="K.3.5.3.10p2" href="#K.3.5.3.10p2"><small>2</small></a>
30519  format shall not be a null pointer. The %n specifier<sup><a href="#note399"><b>399)</b></a></sup> (modified or not by flags, field
30520  width, or precision) shall not appear in the string pointed to by format. Any argument
30521  to vprintf_s corresponding to a %s specifier shall not be a null pointer.
30522 <p><a name="K.3.5.3.10p3" href="#K.3.5.3.10p3"><small>3</small></a>
30523  If there is a runtime-constraint violation, the vprintf_s function does not attempt to
30524  produce further output, and it is unspecified to what extent vprintf_s produced output
30525  before discovering the runtime-constraint violation.
30526  
30527 <!--page 617 -->
30528 <p><b>Description</b>
30529 <p><a name="K.3.5.3.10p4" href="#K.3.5.3.10p4"><small>4</small></a>
30530  The vprintf_s function is equivalent to the vprintf function except for the explicit
30531  runtime-constraints listed above.
30532 <p><b>Returns</b>
30533 <p><a name="K.3.5.3.10p5" href="#K.3.5.3.10p5"><small>5</small></a>
30534  The vprintf_s function returns the number of characters transmitted, or a negative
30535  value if an output error, encoding error, or runtime-constraint violation occurred.
30536
30537 <p><b>Footnotes</b>
30538 <p><small><a name="note399" href="#note399">399)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30539  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30540  format string was %%n.
30541 </small>
30542
30543 <p><small><a href="#Contents">Contents</a></small>
30544 <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>
30545 <p><b>Synopsis</b>
30546 <p><a name="K.3.5.3.11p1" href="#K.3.5.3.11p1"><small>1</small></a>
30547 <pre>
30548          #define __STDC_WANT_LIB_EXT1__ 1
30549          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30550          #include <a href="#7.21">&lt;stdio.h&gt;</a>
30551          int vscanf_s(const char * restrict format,
30552               va_list arg);
30553 </pre>
30554  Runtime-constraints
30555 <p><a name="K.3.5.3.11p2" href="#K.3.5.3.11p2"><small>2</small></a>
30556  format shall not be a null pointer. Any argument indirected though in order to store
30557  converted input shall not be a null pointer.
30558 <p><a name="K.3.5.3.11p3" href="#K.3.5.3.11p3"><small>3</small></a>
30559  If there is a runtime-constraint violation, the vscanf_s function does not attempt to
30560  perform further input, and it is unspecified to what extent vscanf_s performed input
30561  before discovering the runtime-constraint violation.
30562 <p><b>Description</b>
30563 <p><a name="K.3.5.3.11p4" href="#K.3.5.3.11p4"><small>4</small></a>
30564  The vscanf_s function is equivalent to scanf_s, with the variable argument list
30565  replaced by arg, which shall have been initialized by the va_start macro (and
30566  possibly subsequent va_arg calls). The vscanf_s function does not invoke the
30567  va_end macro.<sup><a href="#note400"><b>400)</b></a></sup>
30568 <p><b>Returns</b>
30569 <p><a name="K.3.5.3.11p5" href="#K.3.5.3.11p5"><small>5</small></a>
30570  The vscanf_s function returns the value of the macro EOF if an input failure occurs
30571  before any conversion or if there is a runtime-constraint violation. Otherwise, the
30572  vscanf_s function returns the number of input items assigned, which can be fewer than
30573  provided for, or even zero, in the event of an early matching failure.
30574  
30575  
30576  
30577  
30578 <!--page 618 -->
30579
30580 <p><b>Footnotes</b>
30581 <p><small><a name="note400" href="#note400">400)</a> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
30582  vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
30583  indeterminate.
30584 </small>
30585
30586 <p><small><a href="#Contents">Contents</a></small>
30587 <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>
30588 <p><b>Synopsis</b>
30589 <p><a name="K.3.5.3.12p1" href="#K.3.5.3.12p1"><small>1</small></a>
30590 <pre>
30591           #define __STDC_WANT_LIB_EXT1__ 1
30592           #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30593           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30594           int vsnprintf_s(char * restrict s, rsize_t n,
30595                const char * restrict format,
30596                va_list arg);
30597 </pre>
30598  Runtime-constraints
30599 <p><a name="K.3.5.3.12p2" href="#K.3.5.3.12p2"><small>2</small></a>
30600  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
30601  than RSIZE_MAX. The %n specifier<sup><a href="#note401"><b>401)</b></a></sup> (modified or not by flags, field width, or
30602  precision) shall not appear in the string pointed to by format. Any argument to
30603  vsnprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
30604  error shall occur.
30605 <p><a name="K.3.5.3.12p3" href="#K.3.5.3.12p3"><small>3</small></a>
30606  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
30607  than zero and less than RSIZE_MAX, then the vsnprintf_s function sets s[0] to the
30608  null character.
30609 <p><b>Description</b>
30610 <p><a name="K.3.5.3.12p4" href="#K.3.5.3.12p4"><small>4</small></a>
30611  The vsnprintf_s function is equivalent to the vsnprintf function except for the
30612  explicit runtime-constraints listed above.
30613 <p><a name="K.3.5.3.12p5" href="#K.3.5.3.12p5"><small>5</small></a>
30614  The vsnprintf_s function, unlike vsprintf_s, will truncate the result to fit within
30615  the array pointed to by s.
30616 <p><b>Returns</b>
30617 <p><a name="K.3.5.3.12p6" href="#K.3.5.3.12p6"><small>6</small></a>
30618  The vsnprintf_s function returns the number of characters that would have been
30619  written had n been sufficiently large, not counting the terminating null character, or a
30620  negative value if a runtime-constraint violation occurred. Thus, the null-terminated
30621  output has been completely written if and only if the returned value is nonnegative and
30622  less than n.
30623  
30624  
30625  
30626  
30627 <!--page 619 -->
30628
30629 <p><b>Footnotes</b>
30630 <p><small><a name="note401" href="#note401">401)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30631  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30632  format string was %%n.
30633 </small>
30634
30635 <p><small><a href="#Contents">Contents</a></small>
30636 <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>
30637 <p><b>Synopsis</b>
30638 <p><a name="K.3.5.3.13p1" href="#K.3.5.3.13p1"><small>1</small></a>
30639 <pre>
30640           #define __STDC_WANT_LIB_EXT1__ 1
30641           #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30642           #include <a href="#7.21">&lt;stdio.h&gt;</a>
30643           int vsprintf_s(char * restrict s, rsize_t n,
30644                const char * restrict format,
30645                va_list arg);
30646 </pre>
30647  Runtime-constraints
30648 <p><a name="K.3.5.3.13p2" href="#K.3.5.3.13p2"><small>2</small></a>
30649  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
30650  than RSIZE_MAX. The number of characters (including the trailing null) required for the
30651  result to be written to the array pointed to by s shall not be greater than n. The %n
30652  specifier<sup><a href="#note402"><b>402)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
30653  string pointed to by format. Any argument to vsprintf_s corresponding to a %s
30654  specifier shall not be a null pointer. No encoding error shall occur.
30655 <p><a name="K.3.5.3.13p3" href="#K.3.5.3.13p3"><small>3</small></a>
30656  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
30657  than zero and less than RSIZE_MAX, then the vsprintf_s function sets s[0] to the
30658  null character.
30659 <p><b>Description</b>
30660 <p><a name="K.3.5.3.13p4" href="#K.3.5.3.13p4"><small>4</small></a>
30661  The vsprintf_s function is equivalent to the vsprintf function except for the
30662  parameter n and the explicit runtime-constraints listed above.
30663 <p><a name="K.3.5.3.13p5" href="#K.3.5.3.13p5"><small>5</small></a>
30664  The vsprintf_s function, unlike vsnprintf_s, treats a result too big for the array
30665  pointed to by s as a runtime-constraint violation.
30666 <p><b>Returns</b>
30667 <p><a name="K.3.5.3.13p6" href="#K.3.5.3.13p6"><small>6</small></a>
30668  If no runtime-constraint violation occurred, the vsprintf_s function returns the
30669  number of characters written in the array, not counting the terminating null character. If
30670  an encoding error occurred, vsprintf_s returns a negative value. If any other
30671  runtime-constraint violation occurred, vsprintf_s returns zero.
30672  
30673  
30674  
30675  
30676 <!--page 620 -->
30677
30678 <p><b>Footnotes</b>
30679 <p><small><a name="note402" href="#note402">402)</a> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
30680  at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
30681  format string was %%n.
30682 </small>
30683
30684 <p><small><a href="#Contents">Contents</a></small>
30685 <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>
30686 <p><b>Synopsis</b>
30687 <p><a name="K.3.5.3.14p1" href="#K.3.5.3.14p1"><small>1</small></a>
30688 <pre>
30689         #define __STDC_WANT_LIB_EXT1__ 1
30690         #include <a href="#7.16">&lt;stdarg.h&gt;</a>
30691         #include <a href="#7.21">&lt;stdio.h&gt;</a>
30692         int vsscanf_s(const char * restrict s,
30693              const char * restrict format,
30694              va_list arg);
30695 </pre>
30696  Runtime-constraints
30697 <p><a name="K.3.5.3.14p2" href="#K.3.5.3.14p2"><small>2</small></a>
30698  Neither s nor format shall be a null pointer. Any argument indirected though in order
30699  to store converted input shall not be a null pointer.
30700 <p><a name="K.3.5.3.14p3" href="#K.3.5.3.14p3"><small>3</small></a>
30701  If there is a runtime-constraint violation, the vsscanf_s function does not attempt to
30702  perform further input, and it is unspecified to what extent vsscanf_s performed input
30703  before discovering the runtime-constraint violation.
30704 <p><b>Description</b>
30705 <p><a name="K.3.5.3.14p4" href="#K.3.5.3.14p4"><small>4</small></a>
30706  The vsscanf_s function is equivalent to sscanf_s, with the variable argument list
30707  replaced by arg, which shall have been initialized by the va_start macro (and
30708  possibly subsequent va_arg calls). The vsscanf_s function does not invoke the
30709  va_end macro.<sup><a href="#note403"><b>403)</b></a></sup>
30710 <p><b>Returns</b>
30711 <p><a name="K.3.5.3.14p5" href="#K.3.5.3.14p5"><small>5</small></a>
30712  The vsscanf_s function returns the value of the macro EOF if an input failure occurs
30713  before any conversion or if there is a runtime-constraint violation. Otherwise, the
30714  vscanf_s function returns the number of input items assigned, which can be fewer than
30715  provided for, or even zero, in the event of an early matching failure.
30716
30717 <p><b>Footnotes</b>
30718 <p><small><a name="note403" href="#note403">403)</a> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
30719  vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
30720  indeterminate.
30721 </small>
30722
30723 <p><small><a href="#Contents">Contents</a></small>
30724 <h5><a name="K.3.5.4" href="#K.3.5.4">K.3.5.4 Character input/output functions</a></h5>
30725
30726 <p><small><a href="#Contents">Contents</a></small>
30727 <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>
30728 <p><b>Synopsis</b>
30729 <p><a name="K.3.5.4.1p1" href="#K.3.5.4.1p1"><small>1</small></a>
30730 <pre>
30731         #define __STDC_WANT_LIB_EXT1__ 1
30732         #include <a href="#7.21">&lt;stdio.h&gt;</a>
30733         char *gets_s(char *s, rsize_t n);
30734 </pre>
30735  
30736  
30737  
30738  
30739 <!--page 621 -->
30740  Runtime-constraints
30741 <p><a name="K.3.5.4.1p2" href="#K.3.5.4.1p2"><small>2</small></a>
30742  s shall not be a null pointer. n shall neither be equal to zero nor be greater than
30743  RSIZE_MAX. A new-line character, end-of-file, or read error shall occur within reading
30744  n-1 characters from stdin.<sup><a href="#note404"><b>404)</b></a></sup>
30745 <p><a name="K.3.5.4.1p3" href="#K.3.5.4.1p3"><small>3</small></a>
30746  If there is a runtime-constraint violation, s[0] is set to the null character, and characters
30747  are read and discarded from stdin until a new-line character is read, or end-of-file or a
30748  read error occurs.
30749 <p><b>Description</b>
30750 <p><a name="K.3.5.4.1p4" href="#K.3.5.4.1p4"><small>4</small></a>
30751  The gets_s function reads at most one less than the number of characters specified by n
30752  from the stream pointed to by stdin, into the array pointed to by s. No additional
30753  characters are read after a new-line character (which is discarded) or after end-of-file.
30754  The discarded new-line character does not count towards number of characters read. A
30755  null character is written immediately after the last character read into the array.
30756 <p><a name="K.3.5.4.1p5" href="#K.3.5.4.1p5"><small>5</small></a>
30757  If end-of-file is encountered and no characters have been read into the array, or if a read
30758  error occurs during the operation, then s[0] is set to the null character, and the other
30759  elements of s take unspecified values.
30760 <p><b>Recommended practice</b>
30761 <p><a name="K.3.5.4.1p6" href="#K.3.5.4.1p6"><small>6</small></a>
30762  The fgets function allows properly-written programs to safely process input lines too
30763  long to store in the result array. In general this requires that callers of fgets pay
30764  attention to the presence or absence of a new-line character in the result array. Consider
30765  using fgets (along with any needed processing based on new-line characters) instead of
30766  gets_s.
30767 <p><b>Returns</b>
30768 <p><a name="K.3.5.4.1p7" href="#K.3.5.4.1p7"><small>7</small></a>
30769  The gets_s function returns s if successful. If there was a runtime-constraint violation,
30770  or if end-of-file is encountered and no characters have been read into the array, or if a
30771  read error occurs during the operation, then a null pointer is returned.
30772  
30773  
30774  
30775  
30776 <!--page 622 -->
30777
30778 <p><b>Footnotes</b>
30779 <p><small><a name="note404" href="#note404">404)</a> The gets_s function, unlike the historical gets function, makes it a runtime-constraint violation for
30780  a line of input to overflow the buffer to store it. Unlike the fgets function, gets_s maintains a
30781  one-to-one relationship between input lines and successful calls to gets_s. Programs that use gets
30782  expect such a relationship.
30783 </small>
30784
30785 <p><small><a href="#Contents">Contents</a></small>
30786 <h4><a name="K.3.6" href="#K.3.6">K.3.6 General utilities &lt;stdlib.h&gt;</a></h4>
30787 <p><a name="K.3.6p1" href="#K.3.6p1"><small>1</small></a>
30788  The header <a href="#7.22">&lt;stdlib.h&gt;</a> defines three types.
30789 <p><a name="K.3.6p2" href="#K.3.6p2"><small>2</small></a>
30790  The types are
30791 <pre>
30792          errno_t
30793 </pre>
30794  which is type int; and
30795 <pre>
30796          rsize_t
30797 </pre>
30798  which is the type size_t; and
30799 <pre>
30800          constraint_handler_t
30801 </pre>
30802  which has the following definition
30803 <pre>
30804          typedef void (*constraint_handler_t)(
30805               const char * restrict msg,
30806               void * restrict ptr,
30807               errno_t error);
30808 </pre>
30809
30810 <p><small><a href="#Contents">Contents</a></small>
30811 <h5><a name="K.3.6.1" href="#K.3.6.1">K.3.6.1 Runtime-constraint handling</a></h5>
30812
30813 <p><small><a href="#Contents">Contents</a></small>
30814 <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>
30815 <p><b>Synopsis</b>
30816 <p><a name="K.3.6.1.1p1" href="#K.3.6.1.1p1"><small>1</small></a>
30817 <pre>
30818          #define __STDC_WANT_LIB_EXT1__ 1
30819          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
30820          constraint_handler_t set_constraint_handler_s(
30821               constraint_handler_t handler);
30822 </pre>
30823 <p><b>Description</b>
30824 <p><a name="K.3.6.1.1p2" href="#K.3.6.1.1p2"><small>2</small></a>
30825  The set_constraint_handler_s function sets the runtime-constraint handler to
30826  be handler. The runtime-constraint handler is the function to be called when a library
30827  function detects a runtime-constraint violation. Only the most recent handler registered
30828  with set_constraint_handler_s is called when a runtime-constraint violation
30829  occurs.
30830 <p><a name="K.3.6.1.1p3" href="#K.3.6.1.1p3"><small>3</small></a>
30831  When the handler is called, it is passed the following arguments in the following order:
30832 <ol>
30833 <li>  A pointer to a character string describing the runtime-constraint violation.
30834 <li>  A null pointer or a pointer to an implementation defined object.
30835 <li>  If the function calling the handler has a return type declared as errno_t, the
30836  return value of the function is passed. Otherwise, a positive value of type
30837  errno_t is passed.
30838 <!--page 623 -->
30839 </ol>
30840 <p><a name="K.3.6.1.1p4" href="#K.3.6.1.1p4"><small>4</small></a>
30841  The implementation has a default constraint handler that is used if no calls to the
30842  set_constraint_handler_s function have been made. The behavior of the
30843  default handler is implementation-defined, and it may cause the program to exit or abort.
30844 <p><a name="K.3.6.1.1p5" href="#K.3.6.1.1p5"><small>5</small></a>
30845  If the handler argument to set_constraint_handler_s is a null pointer, the
30846  implementation default handler becomes the current constraint handler.
30847 <p><b>Returns</b>
30848 <p><a name="K.3.6.1.1p6" href="#K.3.6.1.1p6"><small>6</small></a>
30849  The set_constraint_handler_s function returns a pointer to the previously
30850  registered handler.<sup><a href="#note405"><b>405)</b></a></sup>
30851
30852 <p><b>Footnotes</b>
30853 <p><small><a name="note405" href="#note405">405)</a> If the previous handler was registered by calling set_constraint_handler_s with a null
30854  pointer argument, a pointer to the implementation default handler is returned (not NULL).
30855 </small>
30856
30857 <p><small><a href="#Contents">Contents</a></small>
30858 <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>
30859 <p><b>Synopsis</b>
30860 <p><a name="K.3.6.1.2p1" href="#K.3.6.1.2p1"><small>1</small></a>
30861 <pre>
30862          #define __STDC_WANT_LIB_EXT1__ 1
30863          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
30864          void abort_handler_s(
30865               const char * restrict msg,
30866               void * restrict ptr,
30867               errno_t error);
30868 </pre>
30869 <p><b>Description</b>
30870 <p><a name="K.3.6.1.2p2" href="#K.3.6.1.2p2"><small>2</small></a>
30871  A pointer to the abort_handler_s function shall be a suitable argument to the
30872  set_constraint_handler_s function.
30873 <p><a name="K.3.6.1.2p3" href="#K.3.6.1.2p3"><small>3</small></a>
30874  The abort_handler_s function writes a message on the standard error stream in an
30875  implementation-defined format. The message shall include the string pointed to by msg.
30876  The abort_handler_s function then calls the abort function.<sup><a href="#note406"><b>406)</b></a></sup>
30877 <p><b>Returns</b>
30878 <p><a name="K.3.6.1.2p4" href="#K.3.6.1.2p4"><small>4</small></a>
30879  The abort_handler_s function does not return to its caller.
30880  
30881  
30882  
30883  
30884 <!--page 624 -->
30885
30886 <p><b>Footnotes</b>
30887 <p><small><a name="note406" href="#note406">406)</a> Many implementations invoke a debugger when the abort function is called.
30888 </small>
30889
30890 <p><small><a href="#Contents">Contents</a></small>
30891 <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>
30892 <p><b>Synopsis</b>
30893 <p><a name="K.3.6.1.3p1" href="#K.3.6.1.3p1"><small>1</small></a>
30894 <pre>
30895           #define __STDC_WANT_LIB_EXT1__ 1
30896           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
30897           void ignore_handler_s(
30898                const char * restrict msg,
30899                void * restrict ptr,
30900                errno_t error);
30901 </pre>
30902 <p><b>Description</b>
30903 <p><a name="K.3.6.1.3p2" href="#K.3.6.1.3p2"><small>2</small></a>
30904  A pointer to the ignore_handler_s function shall be a suitable argument to the
30905  set_constraint_handler_s function.
30906 <p><a name="K.3.6.1.3p3" href="#K.3.6.1.3p3"><small>3</small></a>
30907  The ignore_handler_s function simply returns to its caller.<sup><a href="#note407"><b>407)</b></a></sup>
30908 <p><b>Returns</b>
30909 <p><a name="K.3.6.1.3p4" href="#K.3.6.1.3p4"><small>4</small></a>
30910  The ignore_handler_s function returns no value.
30911
30912 <p><b>Footnotes</b>
30913 <p><small><a name="note407" href="#note407">407)</a> If the runtime-constraint handler is set to the ignore_handler_s function, any library function in
30914  which a runtime-constraint violation occurs will return to its caller. The caller can determine whether
30915  a runtime-constraint violation occurred based on the library function's specification (usually, the
30916  library function returns a nonzero errno_t).
30917 </small>
30918
30919 <p><small><a href="#Contents">Contents</a></small>
30920 <h5><a name="K.3.6.2" href="#K.3.6.2">K.3.6.2 Communication with the environment</a></h5>
30921
30922 <p><small><a href="#Contents">Contents</a></small>
30923 <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>
30924 <p><b>Synopsis</b>
30925 <p><a name="K.3.6.2.1p1" href="#K.3.6.2.1p1"><small>1</small></a>
30926 <pre>
30927           #define __STDC_WANT_LIB_EXT1__ 1
30928           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
30929           errno_t getenv_s(size_t * restrict len,
30930                      char * restrict value, rsize_t maxsize,
30931                      const char * restrict name);
30932 </pre>
30933  Runtime-constraints
30934 <p><a name="K.3.6.2.1p2" href="#K.3.6.2.1p2"><small>2</small></a>
30935  name shall not be a null pointer. maxsize shall neither equal zero nor be greater than
30936  RSIZE_MAX. If maxsize is not equal to zero, then value shall not be a null pointer.
30937 <p><a name="K.3.6.2.1p3" href="#K.3.6.2.1p3"><small>3</small></a>
30938  If there is a runtime-constraint violation, the integer pointed to by len is set to 0 (if len
30939  is not null), and the environment list is not searched.
30940 <p><b>Description</b>
30941 <p><a name="K.3.6.2.1p4" href="#K.3.6.2.1p4"><small>4</small></a>
30942  The getenv_s function searches an environment list, provided by the host environment,
30943  for a string that matches the string pointed to by name.
30944  
30945  
30946 <!--page 625 -->
30947 <p><a name="K.3.6.2.1p5" href="#K.3.6.2.1p5"><small>5</small></a>
30948  If that name is found then getenv_s performs the following actions. If len is not a
30949  null pointer, the length of the string associated with the matched list member is stored in
30950  the integer pointed to by len. If the length of the associated string is less than maxsize,
30951  then the associated string is copied to the array pointed to by value.
30952 <p><a name="K.3.6.2.1p6" href="#K.3.6.2.1p6"><small>6</small></a>
30953  If that name is not found then getenv_s performs the following actions. If len is not
30954  a null pointer, zero is stored in the integer pointed to by len. If maxsize is greater than
30955  zero, then value[0] is set to the null character.
30956 <p><a name="K.3.6.2.1p7" href="#K.3.6.2.1p7"><small>7</small></a>
30957  The set of environment names and the method for altering the environment list are
30958  implementation-defined. The getenv_s function need not avoid data races with other
30959  threads of execution that modify the environment list.<sup><a href="#note408"><b>408)</b></a></sup>
30960 <p><b>Returns</b>
30961 <p><a name="K.3.6.2.1p8" href="#K.3.6.2.1p8"><small>8</small></a>
30962  The getenv_s function returns zero if the specified name is found and the associated
30963  string was successfully stored in value. Otherwise, a nonzero value is returned.
30964
30965 <p><b>Footnotes</b>
30966 <p><small><a name="note408" href="#note408">408)</a> Many implementations provide non-standard functions that modify the environment list.
30967 </small>
30968
30969 <p><small><a href="#Contents">Contents</a></small>
30970 <h5><a name="K.3.6.3" href="#K.3.6.3">K.3.6.3 Searching and sorting utilities</a></h5>
30971 <p><a name="K.3.6.3p1" href="#K.3.6.3p1"><small>1</small></a>
30972  These utilities make use of a comparison function to search or sort arrays of unspecified
30973  type. Where an argument declared as size_t nmemb specifies the length of the array
30974  for a function, if nmemb has the value zero on a call to that function, then the comparison
30975  function is not called, a search finds no matching element, sorting performs no
30976  rearrangement, and the pointer to the array may be null.
30977 <p><a name="K.3.6.3p2" href="#K.3.6.3p2"><small>2</small></a>
30978  The implementation shall ensure that the second argument of the comparison function
30979  (when called from bsearch_s), or both arguments (when called from qsort_s), are
30980  pointers to elements of the array.<sup><a href="#note409"><b>409)</b></a></sup> The first argument when called from bsearch_s
30981  shall equal key.
30982 <p><a name="K.3.6.3p3" href="#K.3.6.3p3"><small>3</small></a>
30983  The comparison function shall not alter the contents of either the array or search key. The
30984  implementation may reorder elements of the array between calls to the comparison
30985  function, but shall not otherwise alter the contents of any individual element.
30986 <p><a name="K.3.6.3p4" href="#K.3.6.3p4"><small>4</small></a>
30987  When the same objects (consisting of size bytes, irrespective of their current positions
30988  in the array) are passed more than once to the comparison function, the results shall be
30989  consistent with one another. That is, for qsort_s they shall define a total ordering on
30990  the array, and for bsearch_s the same object shall always compare the same way with
30991  the key.
30992  
30993 <!--page 626 -->
30994 <p><a name="K.3.6.3p5" href="#K.3.6.3p5"><small>5</small></a>
30995  A sequence point occurs immediately before and immediately after each call to the
30996  comparison function, and also between any call to the comparison function and any
30997  movement of the objects passed as arguments to that call.
30998
30999 <p><b>Footnotes</b>
31000 <p><small><a name="note409" href="#note409">409)</a> That is, if the value passed is p, then the following expressions are always valid and nonzero:
31001
31002 <pre>
31003           ((char *)p - (char *)base) % size == 0
31004           (char *)p &gt;= (char *)base
31005           (char *)p &lt; (char *)base + nmemb * size
31006 </pre>
31007 </small>
31008
31009 <p><small><a href="#Contents">Contents</a></small>
31010 <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>
31011 <p><b>Synopsis</b>
31012 <p><a name="K.3.6.3.1p1" href="#K.3.6.3.1p1"><small>1</small></a>
31013 <pre>
31014           #define __STDC_WANT_LIB_EXT1__ 1
31015           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
31016           void *bsearch_s(const void *key, const void *base,
31017                rsize_t nmemb, rsize_t size,
31018                int (*compar)(const void *k, const void *y,
31019                                void *context),
31020                void *context);
31021 </pre>
31022  Runtime-constraints
31023 <p><a name="K.3.6.3.1p2" href="#K.3.6.3.1p2"><small>2</small></a>
31024  Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to
31025  zero, then none of key, base, or compar shall be a null pointer.
31026 <p><a name="K.3.6.3.1p3" href="#K.3.6.3.1p3"><small>3</small></a>
31027  If there is a runtime-constraint violation, the bsearch_s function does not search the
31028  array.
31029 <p><b>Description</b>
31030 <p><a name="K.3.6.3.1p4" href="#K.3.6.3.1p4"><small>4</small></a>
31031  The bsearch_s function searches an array of nmemb objects, the initial element of
31032  which is pointed to by base, for an element that matches the object pointed to by key.
31033  The size of each element of the array is specified by size.
31034 <p><a name="K.3.6.3.1p5" href="#K.3.6.3.1p5"><small>5</small></a>
31035  The comparison function pointed to by compar is called with three arguments. The first
31036  two point to the key object and to an array element, in that order. The function shall
31037  return an integer less than, equal to, or greater than zero if the key object is considered,
31038  respectively, to be less than, to match, or to be greater than the array element. The array
31039  shall consist of: all the elements that compare less than, all the elements that compare
31040  equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note410"><b>410)</b></a></sup>
31041  The third argument to the comparison function is the context argument passed to
31042  bsearch_s. The sole use of context by bsearch_s is to pass it to the comparison
31043  function.<sup><a href="#note411"><b>411)</b></a></sup>
31044  
31045  
31046  
31047  
31048 <!--page 627 -->
31049 <p><b>Returns</b>
31050 <p><a name="K.3.6.3.1p6" href="#K.3.6.3.1p6"><small>6</small></a>
31051  The bsearch_s function returns a pointer to a matching element of the array, or a null
31052  pointer if no match is found or there is a runtime-constraint violation. If two elements
31053  compare as equal, which element is matched is unspecified.
31054
31055 <p><b>Footnotes</b>
31056 <p><small><a name="note410" href="#note410">410)</a> In practice, this means that the entire array has been sorted according to the comparison function.
31057 </small>
31058 <p><small><a name="note411" href="#note411">411)</a> The context argument is for the use of the comparison function in performing its duties. For
31059  example, it might specify a collating sequence used by the comparison function.
31060 </small>
31061
31062 <p><small><a href="#Contents">Contents</a></small>
31063 <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>
31064 <p><b>Synopsis</b>
31065 <p><a name="K.3.6.3.2p1" href="#K.3.6.3.2p1"><small>1</small></a>
31066 <pre>
31067          #define __STDC_WANT_LIB_EXT1__ 1
31068          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
31069          errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
31070               int (*compar)(const void *x, const void *y,
31071                               void *context),
31072               void *context);
31073 </pre>
31074  Runtime-constraints
31075 <p><a name="K.3.6.3.2p2" href="#K.3.6.3.2p2"><small>2</small></a>
31076  Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to
31077  zero, then neither base nor compar shall be a null pointer.
31078 <p><a name="K.3.6.3.2p3" href="#K.3.6.3.2p3"><small>3</small></a>
31079  If there is a runtime-constraint violation, the qsort_s function does not sort the array.
31080 <p><b>Description</b>
31081 <p><a name="K.3.6.3.2p4" href="#K.3.6.3.2p4"><small>4</small></a>
31082  The qsort_s function sorts an array of nmemb objects, the initial element of which is
31083  pointed to by base. The size of each object is specified by size.
31084 <p><a name="K.3.6.3.2p5" href="#K.3.6.3.2p5"><small>5</small></a>
31085  The contents of the array are sorted into ascending order according to a comparison
31086  function pointed to by compar, which is called with three arguments. The first two
31087  point to the objects being compared. The function shall return an integer less than, equal
31088  to, or greater than zero if the first argument is considered to be respectively less than,
31089  equal to, or greater than the second. The third argument to the comparison function is the
31090  context argument passed to qsort_s. The sole use of context by qsort_s is to
31091  pass it to the comparison function.<sup><a href="#note412"><b>412)</b></a></sup>
31092 <p><a name="K.3.6.3.2p6" href="#K.3.6.3.2p6"><small>6</small></a>
31093  If two elements compare as equal, their relative order in the resulting sorted array is
31094  unspecified.
31095 <p><b>Returns</b>
31096 <p><a name="K.3.6.3.2p7" href="#K.3.6.3.2p7"><small>7</small></a>
31097  The qsort_s function returns zero if there was no runtime-constraint violation.
31098  Otherwise, a nonzero value is returned.
31099  
31100  
31101  
31102  
31103 <!--page 628 -->
31104
31105 <p><b>Footnotes</b>
31106 <p><small><a name="note412" href="#note412">412)</a> The context argument is for the use of the comparison function in performing its duties. For
31107  example, it might specify a collating sequence used by the comparison function.
31108 </small>
31109
31110 <p><small><a href="#Contents">Contents</a></small>
31111 <h5><a name="K.3.6.4" href="#K.3.6.4">K.3.6.4 Multibyte/wide character conversion functions</a></h5>
31112 <p><a name="K.3.6.4p1" href="#K.3.6.4p1"><small>1</small></a>
31113  The behavior of the multibyte character functions is affected by the LC_CTYPE category
31114  of the current locale. For a state-dependent encoding, each function is placed into its
31115  initial conversion state by a call for which its character pointer argument, s, is a null
31116  pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
31117  state of the function to be altered as necessary. A call with s as a null pointer causes
31118  these functions to set the int pointed to by their status argument to a nonzero value if
31119  encodings have state dependency, and zero otherwise.<sup><a href="#note413"><b>413)</b></a></sup> Changing the LC_CTYPE
31120  category causes the conversion state of these functions to be indeterminate.
31121
31122 <p><b>Footnotes</b>
31123 <p><small><a name="note413" href="#note413">413)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
31124  character codes, but are grouped with an adjacent multibyte character.
31125 </small>
31126
31127 <p><small><a href="#Contents">Contents</a></small>
31128 <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>
31129 <p><b>Synopsis</b>
31130 <p><a name="K.3.6.4.1p1" href="#K.3.6.4.1p1"><small>1</small></a>
31131 <pre>
31132          #define __STDC_WANT_LIB_EXT1__ 1
31133          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
31134          errno_t wctomb_s(int * restrict status,
31135               char * restrict s,
31136               rsize_t smax,
31137               wchar_t wc);
31138 </pre>
31139  Runtime-constraints
31140 <p><a name="K.3.6.4.1p2" href="#K.3.6.4.1p2"><small>2</small></a>
31141  Let n denote the number of bytes needed to represent the multibyte character
31142  corresponding to the wide character given by wc (including any shift sequences).
31143 <p><a name="K.3.6.4.1p3" href="#K.3.6.4.1p3"><small>3</small></a>
31144  If s is not a null pointer, then smax shall not be less than n, and smax shall not be
31145  greater than RSIZE_MAX. If s is a null pointer, then smax shall equal zero.
31146 <p><a name="K.3.6.4.1p4" href="#K.3.6.4.1p4"><small>4</small></a>
31147  If there is a runtime-constraint violation, wctomb_s does not modify the int pointed to
31148  by status, and if s is not a null pointer, no more than smax elements in the array
31149  pointed to by s will be accessed.
31150 <p><b>Description</b>
31151 <p><a name="K.3.6.4.1p5" href="#K.3.6.4.1p5"><small>5</small></a>
31152  The wctomb_s function determines n and stores the multibyte character representation
31153  of wc in the array whose first element is pointed to by s (if s is not a null pointer). The
31154  number of characters stored never exceeds MB_CUR_MAX or smax. If wc is a null wide
31155  character, a null byte is stored, preceded by any shift sequence needed to restore the
31156  initial shift state, and the function is left in the initial conversion state.
31157 <p><a name="K.3.6.4.1p6" href="#K.3.6.4.1p6"><small>6</small></a>
31158  The implementation shall behave as if no library function calls the wctomb_s function.
31159  
31160  
31161  
31162 <!--page 629 -->
31163 <p><a name="K.3.6.4.1p7" href="#K.3.6.4.1p7"><small>7</small></a>
31164  If s is a null pointer, the wctomb_s function stores into the int pointed to by status a
31165  nonzero or zero value, if multibyte character encodings, respectively, do or do not have
31166  state-dependent encodings.
31167 <p><a name="K.3.6.4.1p8" href="#K.3.6.4.1p8"><small>8</small></a>
31168  If s is not a null pointer, the wctomb_s function stores into the int pointed to by
31169  status either n or -1 if wc, respectively, does or does not correspond to a valid
31170  multibyte character.
31171 <p><a name="K.3.6.4.1p9" href="#K.3.6.4.1p9"><small>9</small></a>
31172  In no case will the int pointed to by status be set to a value greater than the
31173  MB_CUR_MAX macro.
31174 <p><b>Returns</b>
31175 <p><a name="K.3.6.4.1p10" href="#K.3.6.4.1p10"><small>10</small></a>
31176  The wctomb_s function returns zero if successful, and a nonzero value if there was a
31177  runtime-constraint violation or wc did not correspond to a valid multibyte character.
31178
31179 <p><small><a href="#Contents">Contents</a></small>
31180 <h5><a name="K.3.6.5" href="#K.3.6.5">K.3.6.5 Multibyte/wide string conversion functions</a></h5>
31181 <p><a name="K.3.6.5p1" href="#K.3.6.5p1"><small>1</small></a>
31182  The behavior of the multibyte string functions is affected by the LC_CTYPE category of
31183  the current locale.
31184
31185 <p><small><a href="#Contents">Contents</a></small>
31186 <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>
31187 <p><b>Synopsis</b>
31188 <p><a name="K.3.6.5.1p1" href="#K.3.6.5.1p1"><small>1</small></a>
31189 <pre>
31190          #include <a href="#7.22">&lt;stdlib.h&gt;</a>
31191          errno_t mbstowcs_s(size_t * restrict retval,
31192               wchar_t * restrict dst, rsize_t dstmax,
31193               const char * restrict src, rsize_t len);
31194 </pre>
31195  Runtime-constraints
31196 <p><a name="K.3.6.5.1p2" href="#K.3.6.5.1p2"><small>2</small></a>
31197  Neither retval nor src shall be a null pointer. If dst is not a null pointer, then
31198  neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null pointer,
31199  then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall not equal
31200  zero. If dst is not a null pointer and len is not less than dstmax, then a null character
31201  shall occur within the first dstmax multibyte characters of the array pointed to by src.
31202 <p><a name="K.3.6.5.1p3" href="#K.3.6.5.1p3"><small>3</small></a>
31203  If there is a runtime-constraint violation, then mbstowcs_s does the following. If
31204  retval is not a null pointer, then mbstowcs_s sets *retval to (size_t)(-1). If
31205  dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
31206  then mbstowcs_s sets dst[0] to the null wide character.
31207 <p><b>Description</b>
31208 <p><a name="K.3.6.5.1p4" href="#K.3.6.5.1p4"><small>4</small></a>
31209  The mbstowcs_s function converts a sequence of multibyte characters that begins in
31210  the initial shift state from the array pointed to by src into a sequence of corresponding
31211  wide characters. If dst is not a null pointer, the converted characters are stored into the
31212  array pointed to by dst. Conversion continues up to and including a terminating null
31213  character, which is also stored. Conversion stops earlier in two cases: when a sequence of
31214 <!--page 630 -->
31215  bytes is encountered that does not form a valid multibyte character, or (if dst is not a
31216  null pointer) when len wide characters have been stored into the array pointed to by
31217  dst.<sup><a href="#note414"><b>414)</b></a></sup> If dst is not a null pointer and no null wide character was stored into the array
31218  pointed to by dst, then dst[len] is set to the null wide character. Each conversion
31219  takes place as if by a call to the mbrtowc function.
31220 <p><a name="K.3.6.5.1p5" href="#K.3.6.5.1p5"><small>5</small></a>
31221  Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
31222  sequence of bytes that do not form a valid multibyte character, an encoding error occurs:
31223  the mbstowcs_s function stores the value (size_t)(-1) into *retval.
31224  Otherwise, the mbstowcs_s function stores into *retval the number of multibyte
31225  characters successfully converted, not including the terminating null character (if any).
31226 <p><a name="K.3.6.5.1p6" href="#K.3.6.5.1p6"><small>6</small></a>
31227  All elements following the terminating null wide character (if any) written by
31228  mbstowcs_s in the array of dstmax wide characters pointed to by dst take
31229  unspecified values when mbstowcs_s returns.<sup><a href="#note415"><b>415)</b></a></sup>
31230 <p><a name="K.3.6.5.1p7" href="#K.3.6.5.1p7"><small>7</small></a>
31231  If copying takes place between objects that overlap, the objects take on unspecified
31232  values.
31233 <p><b>Returns</b>
31234 <p><a name="K.3.6.5.1p8" href="#K.3.6.5.1p8"><small>8</small></a>
31235  The mbstowcs_s function returns zero if no runtime-constraint violation and no
31236  encoding error occurred. Otherwise, a nonzero value is returned.
31237
31238 <p><b>Footnotes</b>
31239 <p><small><a name="note414" href="#note414">414)</a> Thus, the value of len is ignored if dst is a null pointer.
31240 </small>
31241 <p><small><a name="note415" href="#note415">415)</a> This allows an implementation to attempt converting the multibyte string before discovering a
31242  terminating null character did not occur where required.
31243 </small>
31244
31245 <p><small><a href="#Contents">Contents</a></small>
31246 <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>
31247 <p><b>Synopsis</b>
31248 <p><a name="K.3.6.5.2p1" href="#K.3.6.5.2p1"><small>1</small></a>
31249 <pre>
31250           #include <a href="#7.22">&lt;stdlib.h&gt;</a>
31251           errno_t wcstombs_s(size_t * restrict retval,
31252                char * restrict dst, rsize_t dstmax,
31253                const wchar_t * restrict src, rsize_t len);
31254 </pre>
31255  Runtime-constraints
31256 <p><a name="K.3.6.5.2p2" href="#K.3.6.5.2p2"><small>2</small></a>
31257  Neither retval nor src shall be a null pointer. If dst is not a null pointer, then
31258  neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null pointer,
31259  then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall not equal
31260  zero. If dst is not a null pointer and len is not less than dstmax, then the conversion
31261  shall have been stopped (see below) because a terminating null wide character was
31262  reached or because an encoding error occurred.
31263  
31264  
31265  
31266  
31267 <!--page 631 -->
31268 <p><a name="K.3.6.5.2p3" href="#K.3.6.5.2p3"><small>3</small></a>
31269  If there is a runtime-constraint violation, then wcstombs_s does the following. If
31270  retval is not a null pointer, then wcstombs_s sets *retval to (size_t)(-1). If
31271  dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
31272  then wcstombs_s sets dst[0] to the null character.
31273 <p><b>Description</b>
31274 <p><a name="K.3.6.5.2p4" href="#K.3.6.5.2p4"><small>4</small></a>
31275  The wcstombs_s function converts a sequence of wide characters from the array
31276  pointed to by src into a sequence of corresponding multibyte characters that begins in
31277  the initial shift state. If dst is not a null pointer, the converted characters are then stored
31278  into the array pointed to by dst. Conversion continues up to and including a terminating
31279  null wide character, which is also stored. Conversion stops earlier in two cases:
31280 <ul>
31281 <li>  when a wide character is reached that does not correspond to a valid multibyte
31282  character;
31283 <li>  (if dst is not a null pointer) when the next multibyte character would exceed the
31284    limit of n total bytes to be stored into the array pointed to by dst. If the wide
31285    character being converted is the null wide character, then n is the lesser of len or
31286    dstmax. Otherwise, n is the lesser of len or dstmax-1.
31287 </ul>
31288  If the conversion stops without converting a null wide character and dst is not a null
31289  pointer, then a null character is stored into the array pointed to by dst immediately
31290  following any multibyte characters already stored. Each conversion takes place as if by a
31291  call to the wcrtomb function.<sup><a href="#note416"><b>416)</b></a></sup>
31292 <p><a name="K.3.6.5.2p5" href="#K.3.6.5.2p5"><small>5</small></a>
31293  Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
31294  wide character that does not correspond to a valid multibyte character, an encoding error
31295  occurs: the wcstombs_s function stores the value (size_t)(-1) into *retval.
31296  Otherwise, the wcstombs_s function stores into *retval the number of bytes in the
31297  resulting multibyte character sequence, not including the terminating null character (if
31298  any).
31299 <p><a name="K.3.6.5.2p6" href="#K.3.6.5.2p6"><small>6</small></a>
31300  All elements following the terminating null character (if any) written by wcstombs_s
31301  in the array of dstmax elements pointed to by dst take unspecified values when
31302  wcstombs_s returns.<sup><a href="#note417"><b>417)</b></a></sup>
31303 <p><a name="K.3.6.5.2p7" href="#K.3.6.5.2p7"><small>7</small></a>
31304  If copying takes place between objects that overlap, the objects take on unspecified
31305  values.
31306  
31307  
31308 <!--page 632 -->
31309 <p><b>Returns</b>
31310 <p><a name="K.3.6.5.2p8" href="#K.3.6.5.2p8"><small>8</small></a>
31311  The wcstombs_s function returns zero if no runtime-constraint violation and no
31312  encoding error occurred. Otherwise, a nonzero value is returned.
31313
31314 <p><b>Footnotes</b>
31315 <p><small><a name="note416" href="#note416">416)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
31316  include those necessary to reach the initial shift state immediately before the null byte. However, if
31317  the conversion stops before a terminating null wide character has been reached, the result will be null
31318  terminated, but might not end in the initial shift state.
31319 </small>
31320 <p><small><a name="note417" href="#note417">417)</a> When len is not less than dstmax, the implementation might fill the array before discovering a
31321  runtime-constraint violation.
31322 </small>
31323
31324 <p><small><a href="#Contents">Contents</a></small>
31325 <h4><a name="K.3.7" href="#K.3.7">K.3.7 String handling &lt;string.h&gt;</a></h4>
31326 <p><a name="K.3.7p1" href="#K.3.7p1"><small>1</small></a>
31327  The header <a href="#7.24">&lt;string.h&gt;</a> defines two types.
31328 <p><a name="K.3.7p2" href="#K.3.7p2"><small>2</small></a>
31329  The types are
31330 <pre>
31331         errno_t
31332 </pre>
31333  which is type int; and
31334 <pre>
31335         rsize_t
31336 </pre>
31337  which is the type size_t.
31338
31339 <p><small><a href="#Contents">Contents</a></small>
31340 <h5><a name="K.3.7.1" href="#K.3.7.1">K.3.7.1 Copying functions</a></h5>
31341
31342 <p><small><a href="#Contents">Contents</a></small>
31343 <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>
31344 <p><b>Synopsis</b>
31345 <p><a name="K.3.7.1.1p1" href="#K.3.7.1.1p1"><small>1</small></a>
31346 <pre>
31347         #define __STDC_WANT_LIB_EXT1__ 1
31348         #include <a href="#7.24">&lt;string.h&gt;</a>
31349         errno_t memcpy_s(void * restrict s1, rsize_t s1max,
31350              const void * restrict s2, rsize_t n);
31351 </pre>
31352  Runtime-constraints
31353 <p><a name="K.3.7.1.1p2" href="#K.3.7.1.1p2"><small>2</small></a>
31354  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
31355  RSIZE_MAX. n shall not be greater than s1max. Copying shall not take place between
31356  objects that overlap.
31357 <p><a name="K.3.7.1.1p3" href="#K.3.7.1.1p3"><small>3</small></a>
31358  If there is a runtime-constraint violation, the memcpy_s function stores zeros in the first
31359  s1max characters of the object pointed to by s1 if s1 is not a null pointer and s1max is
31360  not greater than RSIZE_MAX.
31361 <p><b>Description</b>
31362 <p><a name="K.3.7.1.1p4" href="#K.3.7.1.1p4"><small>4</small></a>
31363  The memcpy_s function copies n characters from the object pointed to by s2 into the
31364  object pointed to by s1.
31365 <p><b>Returns</b>
31366 <p><a name="K.3.7.1.1p5" href="#K.3.7.1.1p5"><small>5</small></a>
31367  The memcpy_s function returns zero if there was no runtime-constraint violation.
31368  Otherwise, a nonzero value is returned.
31369 <!--page 633 -->
31370
31371 <p><small><a href="#Contents">Contents</a></small>
31372 <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>
31373 <p><b>Synopsis</b>
31374 <p><a name="K.3.7.1.2p1" href="#K.3.7.1.2p1"><small>1</small></a>
31375 <pre>
31376          #define __STDC_WANT_LIB_EXT1__ 1
31377          #include <a href="#7.24">&lt;string.h&gt;</a>
31378          errno_t memmove_s(void *s1, rsize_t s1max,
31379               const void *s2, rsize_t n);
31380 </pre>
31381  Runtime-constraints
31382 <p><a name="K.3.7.1.2p2" href="#K.3.7.1.2p2"><small>2</small></a>
31383  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
31384  RSIZE_MAX. n shall not be greater than s1max.
31385 <p><a name="K.3.7.1.2p3" href="#K.3.7.1.2p3"><small>3</small></a>
31386  If there is a runtime-constraint violation, the memmove_s function stores zeros in the
31387  first s1max characters of the object pointed to by s1 if s1 is not a null pointer and
31388  s1max is not greater than RSIZE_MAX.
31389 <p><b>Description</b>
31390 <p><a name="K.3.7.1.2p4" href="#K.3.7.1.2p4"><small>4</small></a>
31391  The memmove_s function copies n characters from the object pointed to by s2 into the
31392  object pointed to by s1. This copying takes place as if the n characters from the object
31393  pointed to by s2 are first copied into a temporary array of n characters that does not
31394  overlap the objects pointed to by s1 or s2, and then the n characters from the temporary
31395  array are copied into the object pointed to by s1.
31396 <p><b>Returns</b>
31397 <p><a name="K.3.7.1.2p5" href="#K.3.7.1.2p5"><small>5</small></a>
31398  The memmove_s function returns zero if there was no runtime-constraint violation.
31399  Otherwise, a nonzero value is returned.
31400
31401 <p><small><a href="#Contents">Contents</a></small>
31402 <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>
31403 <p><b>Synopsis</b>
31404 <p><a name="K.3.7.1.3p1" href="#K.3.7.1.3p1"><small>1</small></a>
31405 <pre>
31406          #define __STDC_WANT_LIB_EXT1__ 1
31407          #include <a href="#7.24">&lt;string.h&gt;</a>
31408          errno_t strcpy_s(char * restrict s1,
31409               rsize_t s1max,
31410               const char * restrict s2);
31411 </pre>
31412  Runtime-constraints
31413 <p><a name="K.3.7.1.3p2" href="#K.3.7.1.3p2"><small>2</small></a>
31414  Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
31415  s1max shall not equal zero. s1max shall be greater than strnlen_s(s2, s1max).
31416  Copying shall not take place between objects that overlap.
31417 <p><a name="K.3.7.1.3p3" href="#K.3.7.1.3p3"><small>3</small></a>
31418  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
31419  greater than zero and not greater than RSIZE_MAX, then strcpy_s sets s1[0] to the
31420  null character.
31421 <!--page 634 -->
31422 <p><b>Description</b>
31423 <p><a name="K.3.7.1.3p4" href="#K.3.7.1.3p4"><small>4</small></a>
31424  The strcpy_s function copies the string pointed to by s2 (including the terminating
31425  null character) into the array pointed to by s1.
31426 <p><a name="K.3.7.1.3p5" href="#K.3.7.1.3p5"><small>5</small></a>
31427  All elements following the terminating null character (if any) written by strcpy_s in
31428  the array of s1max characters pointed to by s1 take unspecified values when
31429  strcpy_s returns.<sup><a href="#note418"><b>418)</b></a></sup>
31430 <p><b>Returns</b>
31431 <p><a name="K.3.7.1.3p6" href="#K.3.7.1.3p6"><small>6</small></a>
31432  The strcpy_s function returns zero<sup><a href="#note419"><b>419)</b></a></sup> if there was no runtime-constraint violation.
31433  Otherwise, a nonzero value is returned.
31434
31435 <p><b>Footnotes</b>
31436 <p><small><a name="note418" href="#note418">418)</a> This allows an implementation to copy characters from s2 to s1 while simultaneously checking if
31437  any of those characters are null. Such an approach might write a character to every element of s1
31438  before discovering that the first element should be set to the null character.
31439 </small>
31440 <p><small><a name="note419" href="#note419">419)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 fit
31441  within the array pointed to by s1 and that the result in s1 is null terminated.
31442 </small>
31443
31444 <p><small><a href="#Contents">Contents</a></small>
31445 <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>
31446 <p><b>Synopsis</b>
31447 <p><a name="K.3.7.1.4p1" href="#K.3.7.1.4p1"><small>1</small></a>
31448 <pre>
31449          #define __STDC_WANT_LIB_EXT1__ 1
31450          #include <a href="#7.24">&lt;string.h&gt;</a>
31451          errno_t strncpy_s(char * restrict s1,
31452               rsize_t s1max,
31453               const char * restrict s2,
31454               rsize_t n);
31455 </pre>
31456  Runtime-constraints
31457 <p><a name="K.3.7.1.4p2" href="#K.3.7.1.4p2"><small>2</small></a>
31458  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
31459  RSIZE_MAX. s1max shall not equal zero. If n is not less than s1max, then s1max
31460  shall be greater than strnlen_s(s2, s1max). Copying shall not take place between
31461  objects that overlap.
31462 <p><a name="K.3.7.1.4p3" href="#K.3.7.1.4p3"><small>3</small></a>
31463  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
31464  greater than zero and not greater than RSIZE_MAX, then strncpy_s sets s1[0] to the
31465  null character.
31466 <p><b>Description</b>
31467 <p><a name="K.3.7.1.4p4" href="#K.3.7.1.4p4"><small>4</small></a>
31468  The strncpy_s function copies not more than n successive characters (characters that
31469  follow a null character are not copied) from the array pointed to by s2 to the array
31470  pointed to by s1. If no null character was copied from s2, then s1[n] is set to a null
31471  character.
31472  
31473  
31474 <!--page 635 -->
31475 <p><a name="K.3.7.1.4p5" href="#K.3.7.1.4p5"><small>5</small></a>
31476  All elements following the terminating null character (if any) written by strncpy_s in
31477  the array of s1max characters pointed to by s1 take unspecified values when
31478  strncpy_s returns.<sup><a href="#note420"><b>420)</b></a></sup>
31479 <p><b>Returns</b>
31480 <p><a name="K.3.7.1.4p6" href="#K.3.7.1.4p6"><small>6</small></a>
31481  The strncpy_s function returns zero<sup><a href="#note421"><b>421)</b></a></sup> if there was no runtime-constraint violation.
31482  Otherwise, a nonzero value is returned.
31483 <p><a name="K.3.7.1.4p7" href="#K.3.7.1.4p7"><small>7</small></a>
31484  EXAMPLE 1 The strncpy_s function can be used to copy a string without the danger that the result
31485  will not be null terminated or that characters will be written past the end of the destination array.
31486 <pre>
31487          #define __STDC_WANT_LIB_EXT1__ 1
31488          #include <a href="#7.24">&lt;string.h&gt;</a>
31489          /* ... */
31490          char src1[100] = "hello";
31491          char src2[7] = {'g', 'o', 'o', 'd', 'b', 'y', 'e'};
31492          char dst1[6], dst2[5], dst3[5];
31493          int r1, r2, r3;
31494          r1 = strncpy_s(dst1, 6, src1, 100);
31495          r2 = strncpy_s(dst2, 5, src2, 7);
31496          r3 = strncpy_s(dst3, 5, src2, 4);
31497 </pre>
31498  The first call will assign to r1 the value zero and to dst1 the sequence hello\0.
31499  The second call will assign to r2 a nonzero value and to dst2 the sequence \0.
31500  The third call will assign to r3 the value zero and to dst3 the sequence good\0.
31501  
31502
31503 <p><b>Footnotes</b>
31504 <p><small><a name="note420" href="#note420">420)</a> This allows an implementation to copy characters from s2 to s1 while simultaneously checking if
31505  any of those characters are null. Such an approach might write a character to every element of s1
31506  before discovering that the first element should be set to the null character.
31507 </small>
31508 <p><small><a name="note421" href="#note421">421)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 fit
31509  within the array pointed to by s1 and that the result in s1 is null terminated.
31510 </small>
31511
31512 <p><small><a href="#Contents">Contents</a></small>
31513 <h5><a name="K.3.7.2" href="#K.3.7.2">K.3.7.2 Concatenation functions</a></h5>
31514
31515 <p><small><a href="#Contents">Contents</a></small>
31516 <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>
31517 <p><b>Synopsis</b>
31518 <p><a name="K.3.7.2.1p1" href="#K.3.7.2.1p1"><small>1</small></a>
31519 <pre>
31520          #define __STDC_WANT_LIB_EXT1__ 1
31521          #include <a href="#7.24">&lt;string.h&gt;</a>
31522          errno_t strcat_s(char * restrict s1,
31523               rsize_t s1max,
31524               const char * restrict s2);
31525 </pre>
31526  Runtime-constraints
31527 <p><a name="K.3.7.2.1p2" href="#K.3.7.2.1p2"><small>2</small></a>
31528  Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
31529  strcat_s.
31530  
31531  
31532  
31533  
31534 <!--page 636 -->
31535 <p><a name="K.3.7.2.1p3" href="#K.3.7.2.1p3"><small>3</small></a>
31536  Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
31537  s1max shall not equal zero. m shall not equal zero.<sup><a href="#note422"><b>422)</b></a></sup> m shall be greater than
31538  strnlen_s(s2, m). Copying shall not take place between objects that overlap.
31539 <p><a name="K.3.7.2.1p4" href="#K.3.7.2.1p4"><small>4</small></a>
31540  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
31541  greater than zero and not greater than RSIZE_MAX, then strcat_s sets s1[0] to the
31542  null character.
31543 <p><b>Description</b>
31544 <p><a name="K.3.7.2.1p5" href="#K.3.7.2.1p5"><small>5</small></a>
31545  The strcat_s function appends a copy of the string pointed to by s2 (including the
31546  terminating null character) to the end of the string pointed to by s1. The initial character
31547  from s2 overwrites the null character at the end of s1.
31548 <p><a name="K.3.7.2.1p6" href="#K.3.7.2.1p6"><small>6</small></a>
31549  All elements following the terminating null character (if any) written by strcat_s in
31550  the array of s1max characters pointed to by s1 take unspecified values when
31551  strcat_s returns.<sup><a href="#note423"><b>423)</b></a></sup>
31552 <p><b>Returns</b>
31553 <p><a name="K.3.7.2.1p7" href="#K.3.7.2.1p7"><small>7</small></a>
31554  The strcat_s function returns zero<sup><a href="#note424"><b>424)</b></a></sup> if there was no runtime-constraint violation.
31555  Otherwise, a nonzero value is returned.
31556
31557 <p><b>Footnotes</b>
31558 <p><small><a name="note422" href="#note422">422)</a> Zero means that s1 was not null terminated upon entry to strcat_s.
31559 </small>
31560 <p><small><a name="note423" href="#note423">423)</a> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
31561  any of those characters are null. Such an approach might write a character to every element of s1
31562  before discovering that the first element should be set to the null character.
31563 </small>
31564 <p><small><a name="note424" href="#note424">424)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 were
31565  appended to the string pointed to by s1 and that the result in s1 is null terminated.
31566 </small>
31567
31568 <p><small><a href="#Contents">Contents</a></small>
31569 <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>
31570 <p><b>Synopsis</b>
31571 <p><a name="K.3.7.2.2p1" href="#K.3.7.2.2p1"><small>1</small></a>
31572 <pre>
31573          #define __STDC_WANT_LIB_EXT1__ 1
31574          #include <a href="#7.24">&lt;string.h&gt;</a>
31575          errno_t strncat_s(char * restrict s1,
31576               rsize_t s1max,
31577               const char * restrict s2,
31578               rsize_t n);
31579 </pre>
31580  Runtime-constraints
31581 <p><a name="K.3.7.2.2p2" href="#K.3.7.2.2p2"><small>2</small></a>
31582  Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
31583  strncat_s.
31584 <p><a name="K.3.7.2.2p3" href="#K.3.7.2.2p3"><small>3</small></a>
31585  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
31586  RSIZE_MAX. s1max shall not equal zero. m shall not equal zero.<sup><a href="#note425"><b>425)</b></a></sup> If n is not less
31587  
31588  
31589 <!--page 637 -->
31590  than m, then m shall be greater than strnlen_s(s2, m). Copying shall not take
31591  place between objects that overlap.
31592 <p><a name="K.3.7.2.2p4" href="#K.3.7.2.2p4"><small>4</small></a>
31593  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
31594  greater than zero and not greater than RSIZE_MAX, then strncat_s sets s1[0] to the
31595  null character.
31596 <p><b>Description</b>
31597 <p><a name="K.3.7.2.2p5" href="#K.3.7.2.2p5"><small>5</small></a>
31598  The strncat_s function appends not more than n successive characters (characters
31599  that follow a null character are not copied) from the array pointed to by s2 to the end of
31600  the string pointed to by s1. The initial character from s2 overwrites the null character at
31601  the end of s1. If no null character was copied from s2, then s1[s1max-m+n] is set to
31602  a null character.
31603 <p><a name="K.3.7.2.2p6" href="#K.3.7.2.2p6"><small>6</small></a>
31604  All elements following the terminating null character (if any) written by strncat_s in
31605  the array of s1max characters pointed to by s1 take unspecified values when
31606  strncat_s returns.<sup><a href="#note426"><b>426)</b></a></sup>
31607 <p><b>Returns</b>
31608 <p><a name="K.3.7.2.2p7" href="#K.3.7.2.2p7"><small>7</small></a>
31609  The strncat_s function returns zero<sup><a href="#note427"><b>427)</b></a></sup> if there was no runtime-constraint violation.
31610  Otherwise, a nonzero value is returned.
31611 <p><a name="K.3.7.2.2p8" href="#K.3.7.2.2p8"><small>8</small></a>
31612  EXAMPLE 1 The strncat_s function can be used to copy a string without the danger that the result
31613  will not be null terminated or that characters will be written past the end of the destination array.
31614 <pre>
31615          #define __STDC_WANT_LIB_EXT1__ 1
31616          #include <a href="#7.24">&lt;string.h&gt;</a>
31617          /* ... */
31618          char s1[100] = "good";
31619          char s2[6] = "hello";
31620          char s3[6] = "hello";
31621          char s4[7] = "abc";
31622          char s5[1000] = "bye";
31623          int r1, r2, r3, r4;
31624          r1 = strncat_s(s1, 100, s5, 1000);
31625          r2 = strncat_s(s2, 6, "", 1);
31626          r3 = strncat_s(s3, 6, "X", 2);
31627          r4 = strncat_s(s4, 7, "defghijklmn", 3);
31628 </pre>
31629  After the first call r1 will have the value zero and s1 will contain the sequence goodbye\0.
31630  
31631  
31632  
31633 <!--page 638 -->
31634  After the second call r2 will have the value zero and s2 will contain the sequence hello\0.
31635  After the third call r3 will have a nonzero value and s3 will contain the sequence \0.
31636  After the fourth call r4 will have the value zero and s4 will contain the sequence abcdef\0.
31637  
31638
31639 <p><b>Footnotes</b>
31640 <p><small><a name="note425" href="#note425">425)</a> Zero means that s1 was not null terminated upon entry to strncat_s.
31641 </small>
31642 <p><small><a name="note426" href="#note426">426)</a> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
31643  any of those characters are null. Such an approach might write a character to every element of s1
31644  before discovering that the first element should be set to the null character.
31645 </small>
31646 <p><small><a name="note427" href="#note427">427)</a> A zero return value implies that all of the requested characters from the string pointed to by s2 were
31647  appended to the string pointed to by s1 and that the result in s1 is null terminated.
31648 </small>
31649
31650 <p><small><a href="#Contents">Contents</a></small>
31651 <h5><a name="K.3.7.3" href="#K.3.7.3">K.3.7.3 Search functions</a></h5>
31652
31653 <p><small><a href="#Contents">Contents</a></small>
31654 <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>
31655 <p><b>Synopsis</b>
31656 <p><a name="K.3.7.3.1p1" href="#K.3.7.3.1p1"><small>1</small></a>
31657 <pre>
31658          #define __STDC_WANT_LIB_EXT1__ 1
31659          #include <a href="#7.24">&lt;string.h&gt;</a>
31660          char *strtok_s(char * restrict s1,
31661               rsize_t * restrict s1max,
31662               const char * restrict s2,
31663               char ** restrict ptr);
31664 </pre>
31665  Runtime-constraints
31666 <p><a name="K.3.7.3.1p2" href="#K.3.7.3.1p2"><small>2</small></a>
31667  None of s1max, s2, or ptr shall be a null pointer. If s1 is a null pointer, then *ptr
31668  shall not be a null pointer. The value of *s1max shall not be greater than RSIZE_MAX.
31669  The end of the token found shall occur within the first *s1max characters of s1 for the
31670  first call, and shall occur within the first *s1max characters of where searching resumes
31671  on subsequent calls.
31672 <p><a name="K.3.7.3.1p3" href="#K.3.7.3.1p3"><small>3</small></a>
31673  If there is a runtime-constraint violation, the strtok_s function does not indirect
31674  through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr.
31675 <p><b>Description</b>
31676 <p><a name="K.3.7.3.1p4" href="#K.3.7.3.1p4"><small>4</small></a>
31677  A sequence of calls to the strtok_s function breaks the string pointed to by s1 into a
31678  sequence of tokens, each of which is delimited by a character from the string pointed to
31679  by s2. The fourth argument points to a caller-provided char pointer into which the
31680  strtok_s function stores information necessary for it to continue scanning the same
31681  string.
31682 <p><a name="K.3.7.3.1p5" href="#K.3.7.3.1p5"><small>5</small></a>
31683  The first call in a sequence has a non-null first argument and s1max points to an object
31684  whose value is the number of elements in the character array pointed to by the first
31685  argument. The first call stores an initial value in the object pointed to by ptr and
31686  updates the value pointed to by s1max to reflect the number of elements that remain in
31687  relation to ptr. Subsequent calls in the sequence have a null first argument and the
31688  objects pointed to by s1max and ptr are required to have the values stored by the
31689  previous call in the sequence, which are then updated. The separator string pointed to by
31690  s2 may be different from call to call.
31691 <p><a name="K.3.7.3.1p6" href="#K.3.7.3.1p6"><small>6</small></a>
31692  The first call in the sequence searches the string pointed to by s1 for the first character
31693  that is not contained in the current separator string pointed to by s2. If no such character
31694  is found, then there are no tokens in the string pointed to by s1 and the strtok_s
31695  function returns a null pointer. If such a character is found, it is the start of the first token.
31696 <!--page 639 -->
31697 <p><a name="K.3.7.3.1p7" href="#K.3.7.3.1p7"><small>7</small></a>
31698  The strtok_s function then searches from there for the first character in s1 that is
31699  contained in the current separator string. If no such character is found, the current token
31700  extends to the end of the string pointed to by s1, and subsequent searches in the same
31701  string for a token return a null pointer. If such a character is found, it is overwritten by a
31702  null character, which terminates the current token.
31703 <p><a name="K.3.7.3.1p8" href="#K.3.7.3.1p8"><small>8</small></a>
31704  In all cases, the strtok_s function stores sufficient information in the pointer pointed
31705  to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
31706  value for ptr, shall start searching just past the element overwritten by a null character
31707  (if any).
31708 <p><b>Returns</b>
31709 <p><a name="K.3.7.3.1p9" href="#K.3.7.3.1p9"><small>9</small></a>
31710  The strtok_s function returns a pointer to the first character of a token, or a null
31711  pointer if there is no token or there is a runtime-constraint violation.
31712 <p><a name="K.3.7.3.1p10" href="#K.3.7.3.1p10"><small>10</small></a>
31713  EXAMPLE
31714 <pre>
31715          #define __STDC_WANT_LIB_EXT1__ 1
31716          #include <a href="#7.24">&lt;string.h&gt;</a>
31717          static char str1[] = "?a???b,,,#c";
31718          static char str2[] = "\t \t";
31719          char *t, *ptr1, *ptr2;
31720          rsize_t max1 = sizeof (str1);
31721          rsize_t max2 = sizeof (str2);
31722          t   =   strtok_s(str1,   &amp;max1,   "?", &amp;ptr1);        //   t   points to the token "a"
31723          t   =   strtok_s(NULL,   &amp;max1,   ",", &amp;ptr1);        //   t   points to the token "??b"
31724          t   =   strtok_s(str2,   &amp;max2,   " \t", &amp;ptr2);      //   t   is a null pointer
31725          t   =   strtok_s(NULL,   &amp;max1,   "#,", &amp;ptr1);       //   t   points to the token "c"
31726          t   =   strtok_s(NULL,   &amp;max1,   "?", &amp;ptr1);        //   t   is a null pointer
31727 </pre>
31728  
31729
31730 <p><small><a href="#Contents">Contents</a></small>
31731 <h5><a name="K.3.7.4" href="#K.3.7.4">K.3.7.4 Miscellaneous functions</a></h5>
31732
31733 <p><small><a href="#Contents">Contents</a></small>
31734 <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>
31735 <p><b>Synopsis</b>
31736 <p><a name="K.3.7.4.1p1" href="#K.3.7.4.1p1"><small>1</small></a>
31737 <pre>
31738          #define __STDC_WANT_LIB_EXT1__ 1
31739          #include <a href="#7.24">&lt;string.h&gt;</a>
31740          errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
31741 </pre>
31742  Runtime-constraints
31743 <p><a name="K.3.7.4.1p2" href="#K.3.7.4.1p2"><small>2</small></a>
31744  s shall not be a null pointer. Neither smax nor n shall be greater than RSIZE_MAX. n
31745  shall not be greater than smax.
31746 <p><a name="K.3.7.4.1p3" href="#K.3.7.4.1p3"><small>3</small></a>
31747  If there is a runtime-constraint violation, then if s is not a null pointer and smax is not
31748  greater than RSIZE_MAX, the memset_s function stores the value of c (converted to an
31749  unsigned char) into each of the first smax characters of the object pointed to by s.
31750 <!--page 640 -->
31751 <p><b>Description</b>
31752 <p><a name="K.3.7.4.1p4" href="#K.3.7.4.1p4"><small>4</small></a>
31753  The memset_s function copies the value of c (converted to an unsigned char) into
31754  each of the first n characters of the object pointed to by s. Unlike memset, any call to
31755  the memset_s function shall be evaluated strictly according to the rules of the abstract
31756  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
31757  assume that the memory indicated by s and n may be accessible in the future and thus
31758  must contain the values indicated by c.
31759 <p><b>Returns</b>
31760 <p><a name="K.3.7.4.1p5" href="#K.3.7.4.1p5"><small>5</small></a>
31761  The memset_s function returns zero if there was no runtime-constraint violation.
31762  Otherwise, a nonzero value is returned.
31763
31764 <p><small><a href="#Contents">Contents</a></small>
31765 <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>
31766 <p><b>Synopsis</b>
31767 <p><a name="K.3.7.4.2p1" href="#K.3.7.4.2p1"><small>1</small></a>
31768 <pre>
31769         #define __STDC_WANT_LIB_EXT1__ 1
31770         #include <a href="#7.24">&lt;string.h&gt;</a>
31771         errno_t strerror_s(char *s, rsize_t maxsize,
31772              errno_t errnum);
31773 </pre>
31774  Runtime-constraints
31775 <p><a name="K.3.7.4.2p2" href="#K.3.7.4.2p2"><small>2</small></a>
31776  s shall not be a null pointer. maxsize shall not be greater than RSIZE_MAX.
31777  maxsize shall not equal zero.
31778 <p><a name="K.3.7.4.2p3" href="#K.3.7.4.2p3"><small>3</small></a>
31779  If there is a runtime-constraint violation, then the array (if any) pointed to by s is not
31780  modified.
31781 <p><b>Description</b>
31782 <p><a name="K.3.7.4.2p4" href="#K.3.7.4.2p4"><small>4</small></a>
31783  The strerror_s function maps the number in errnum to a locale-specific message
31784  string. Typically, the values for errnum come from errno, but strerror_s shall
31785  map any value of type int to a message.
31786 <p><a name="K.3.7.4.2p5" href="#K.3.7.4.2p5"><small>5</small></a>
31787  If the length of the desired string is less than maxsize, then the string is copied to the
31788  array pointed to by s.
31789 <p><a name="K.3.7.4.2p6" href="#K.3.7.4.2p6"><small>6</small></a>
31790  Otherwise, if maxsize is greater than zero, then maxsize-1 characters are copied
31791  from the string to the array pointed to by s and then s[maxsize-1] is set to the null
31792  character. Then, if maxsize is greater than 3, then s[maxsize-2],
31793  s[maxsize-3], and s[maxsize-4] are set to the character period (.).
31794 <p><b>Returns</b>
31795 <p><a name="K.3.7.4.2p7" href="#K.3.7.4.2p7"><small>7</small></a>
31796  The strerror_s function returns zero if the length of the desired string was less than
31797  maxsize and there was no runtime-constraint violation. Otherwise, the strerror_s
31798  function returns a nonzero value.
31799 <!--page 641 -->
31800
31801 <p><small><a href="#Contents">Contents</a></small>
31802 <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>
31803 <p><b>Synopsis</b>
31804 <p><a name="K.3.7.4.3p1" href="#K.3.7.4.3p1"><small>1</small></a>
31805 <pre>
31806          #define __STDC_WANT_LIB_EXT1__ 1
31807          #include <a href="#7.24">&lt;string.h&gt;</a>
31808          size_t strerrorlen_s(errno_t errnum);
31809 </pre>
31810 <p><b>Description</b>
31811 <p><a name="K.3.7.4.3p2" href="#K.3.7.4.3p2"><small>2</small></a>
31812  The strerrorlen_s function calculates the length of the (untruncated) locale-specific
31813  message string that the strerror_s function maps to errnum.
31814 <p><b>Returns</b>
31815 <p><a name="K.3.7.4.3p3" href="#K.3.7.4.3p3"><small>3</small></a>
31816  The strerrorlen_s function returns the number of characters (not including the null
31817  character) in the full message string.
31818
31819 <p><small><a href="#Contents">Contents</a></small>
31820 <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>
31821 <p><b>Synopsis</b>
31822 <p><a name="K.3.7.4.4p1" href="#K.3.7.4.4p1"><small>1</small></a>
31823 <pre>
31824          #define __STDC_WANT_LIB_EXT1__ 1
31825          #include <a href="#7.24">&lt;string.h&gt;</a>
31826          size_t strnlen_s(const char *s, size_t maxsize);
31827 </pre>
31828 <p><b>Description</b>
31829 <p><a name="K.3.7.4.4p2" href="#K.3.7.4.4p2"><small>2</small></a>
31830  The strnlen_s function computes the length of the string pointed to by s.
31831 <p><b>Returns</b>
31832 <p><a name="K.3.7.4.4p3" href="#K.3.7.4.4p3"><small>3</small></a>
31833  If s is a null pointer,<sup><a href="#note428"><b>428)</b></a></sup> then the strnlen_s function returns zero.
31834 <p><a name="K.3.7.4.4p4" href="#K.3.7.4.4p4"><small>4</small></a>
31835  Otherwise, the strnlen_s function returns the number of characters that precede the
31836  terminating null character. If there is no null character in the first maxsize characters of
31837  s then strnlen_s returns maxsize. At most the first maxsize characters of s shall
31838  be accessed by strnlen_s.
31839  
31840  
31841  
31842  
31843 <!--page 642 -->
31844
31845 <p><b>Footnotes</b>
31846 <p><small><a name="note428" href="#note428">428)</a> Note that the strnlen_s function has no runtime-constraints. This lack of runtime-constraints
31847  along with the values returned for a null pointer or an unterminated string argument make
31848  strnlen_s useful in algorithms that gracefully handle such exceptional data.
31849 </small>
31850
31851 <p><small><a href="#Contents">Contents</a></small>
31852 <h4><a name="K.3.8" href="#K.3.8">K.3.8 Date and time &lt;time.h&gt;</a></h4>
31853 <p><a name="K.3.8p1" href="#K.3.8p1"><small>1</small></a>
31854  The header <a href="#7.27">&lt;time.h&gt;</a> defines two types.
31855 <p><a name="K.3.8p2" href="#K.3.8p2"><small>2</small></a>
31856  The types are
31857 <pre>
31858          errno_t
31859 </pre>
31860  which is type int; and
31861 <pre>
31862          rsize_t
31863 </pre>
31864  which is the type size_t.
31865
31866 <p><small><a href="#Contents">Contents</a></small>
31867 <h5><a name="K.3.8.1" href="#K.3.8.1">K.3.8.1 Components of time</a></h5>
31868 <p><a name="K.3.8.1p1" href="#K.3.8.1p1"><small>1</small></a>
31869  A broken-down time is normalized if the values of the members of the tm structure are in
31870  their normal rages.<sup><a href="#note429"><b>429)</b></a></sup>
31871
31872 <p><b>Footnotes</b>
31873 <p><small><a name="note429" href="#note429">429)</a> The normal ranges are defined in <a href="#7.27.1">7.27.1</a>.
31874 </small>
31875
31876 <p><small><a href="#Contents">Contents</a></small>
31877 <h5><a name="K.3.8.2" href="#K.3.8.2">K.3.8.2 Time conversion functions</a></h5>
31878 <p><a name="K.3.8.2p1" href="#K.3.8.2p1"><small>1</small></a>
31879  Like the strftime function, the asctime_s and ctime_s functions do not return a
31880  pointer to a static object, and other library functions are permitted to call them.
31881
31882 <p><small><a href="#Contents">Contents</a></small>
31883 <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>
31884 <p><b>Synopsis</b>
31885 <p><a name="K.3.8.2.1p1" href="#K.3.8.2.1p1"><small>1</small></a>
31886 <pre>
31887          #define __STDC_WANT_LIB_EXT1__ 1
31888          #include <a href="#7.27">&lt;time.h&gt;</a>
31889          errno_t asctime_s(char *s, rsize_t maxsize,
31890               const struct tm *timeptr);
31891 </pre>
31892  Runtime-constraints
31893 <p><a name="K.3.8.2.1p2" href="#K.3.8.2.1p2"><small>2</small></a>
31894  Neither s nor timeptr shall be a null pointer. maxsize shall not be less than 26 and
31895  shall not be greater than RSIZE_MAX. The broken-down time pointed to by timeptr
31896  shall be normalized. The calendar year represented by the broken-down time pointed to
31897  by timeptr shall not be less than calendar year 0 and shall not be greater than calendar
31898  year 9999.
31899 <p><a name="K.3.8.2.1p3" href="#K.3.8.2.1p3"><small>3</small></a>
31900  If there is a runtime-constraint violation, there is no attempt to convert the time, and
31901  s[0] is set to a null character if s is not a null pointer and maxsize is not zero and is
31902  not greater than RSIZE_MAX.
31903 <p><b>Description</b>
31904 <p><a name="K.3.8.2.1p4" href="#K.3.8.2.1p4"><small>4</small></a>
31905  The asctime_s function converts the normalized broken-down time in the structure
31906  pointed to by timeptr into a 26 character (including the null character) string in the
31907  
31908  
31909 <!--page 643 -->
31910  form
31911 <pre>
31912          Sun Sep 16 01:03:52 1973\n\0
31913 </pre>
31914  The fields making up this string are (in order):
31915 <ol>
31916 <li>  The name of the day of the week represented by timeptr-&gt;tm_wday using the
31917  following three character weekday names: Sun, Mon, Tue, Wed, Thu, Fri, and Sat.
31918 <li>  The character space.
31919 <li>  The name of the month represented by timeptr-&gt;tm_mon using the following
31920  three character month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct,
31921  Nov, and Dec.
31922 <li>  The character space.
31923 <li>  The value of timeptr-&gt;tm_mday as if printed using the fprintf format
31924  "%2d".
31925 <li>  The character space.
31926 <li>  The value of timeptr-&gt;tm_hour as if printed using the fprintf format
31927  "%.2d".
31928 <li>  The character colon.
31929 <li>  The value of timeptr-&gt;tm_min as if printed using the fprintf format
31930  "%.2d".
31931 <li>  The character colon.
31932 <li>  The value of timeptr-&gt;tm_sec as if printed using the fprintf format
31933  "%.2d".
31934 <li>  The character space.
31935 <li>  The value of timeptr-&gt;tm_year + 1900 as if printed using the fprintf
31936  format "%4d".
31937 <li>  The character new line.
31938 <li>  The null character.
31939 </ol>
31940 <p><b>Recommended practice</b>
31941  The strftime function allows more flexible formatting and supports locale-specific
31942  behavior. If you do not require the exact form of the result string produced by the
31943  asctime_s function, consider using the strftime function instead.
31944 <p><b>Returns</b>
31945 <p><a name="K.3.8.2.1p5" href="#K.3.8.2.1p5"><small>5</small></a>
31946  The asctime_s function returns zero if the time was successfully converted and stored
31947  into the array pointed to by s. Otherwise, it returns a nonzero value.
31948 <!--page 644 -->
31949
31950 <p><small><a href="#Contents">Contents</a></small>
31951 <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>
31952 <p><b>Synopsis</b>
31953 <p><a name="K.3.8.2.2p1" href="#K.3.8.2.2p1"><small>1</small></a>
31954 <pre>
31955         #define __STDC_WANT_LIB_EXT1__ 1
31956         #include <a href="#7.27">&lt;time.h&gt;</a>
31957         errno_t ctime_s(char *s, rsize_t maxsize,
31958              const time_t *timer);
31959 </pre>
31960  Runtime-constraints
31961 <p><a name="K.3.8.2.2p2" href="#K.3.8.2.2p2"><small>2</small></a>
31962  Neither s nor timer shall be a null pointer. maxsize shall not be less than 26 and
31963  shall not be greater than RSIZE_MAX.
31964 <p><a name="K.3.8.2.2p3" href="#K.3.8.2.2p3"><small>3</small></a>
31965  If there is a runtime-constraint violation, s[0] is set to a null character if s is not a null
31966  pointer and maxsize is not equal zero and is not greater than RSIZE_MAX.
31967 <p><b>Description</b>
31968 <p><a name="K.3.8.2.2p4" href="#K.3.8.2.2p4"><small>4</small></a>
31969  The ctime_s function converts the calendar time pointed to by timer to local time in
31970  the form of a string. It is equivalent to
31971 <pre>
31972         asctime_s(s, maxsize, localtime_s(timer))
31973 </pre>
31974 <p><b>Recommended practice</b>
31975  The strftime function allows more flexible formatting and supports locale-specific
31976  behavior. If you do not require the exact form of the result string produced by the
31977  ctime_s function, consider using the strftime function instead.
31978 <p><b>Returns</b>
31979 <p><a name="K.3.8.2.2p5" href="#K.3.8.2.2p5"><small>5</small></a>
31980  The ctime_s function returns zero if the time was successfully converted and stored
31981  into the array pointed to by s. Otherwise, it returns a nonzero value.
31982
31983 <p><small><a href="#Contents">Contents</a></small>
31984 <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>
31985 <p><b>Synopsis</b>
31986 <p><a name="K.3.8.2.3p1" href="#K.3.8.2.3p1"><small>1</small></a>
31987 <pre>
31988         #define __STDC_WANT_LIB_EXT1__ 1
31989         #include <a href="#7.27">&lt;time.h&gt;</a>
31990         struct tm *gmtime_s(const time_t * restrict timer,
31991              struct tm * restrict result);
31992 </pre>
31993  Runtime-constraints
31994 <p><a name="K.3.8.2.3p2" href="#K.3.8.2.3p2"><small>2</small></a>
31995  Neither timer nor result shall be a null pointer.
31996 <p><a name="K.3.8.2.3p3" href="#K.3.8.2.3p3"><small>3</small></a>
31997  If there is a runtime-constraint violation, there is no attempt to convert the time.
31998 <p><b>Description</b>
31999 <p><a name="K.3.8.2.3p4" href="#K.3.8.2.3p4"><small>4</small></a>
32000  The gmtime_s function converts the calendar time pointed to by timer into a broken-
32001  down time, expressed as UTC. The broken-down time is stored in the structure pointed
32002 <!--page 645 -->
32003  to by result.
32004 <p><b>Returns</b>
32005 <p><a name="K.3.8.2.3p5" href="#K.3.8.2.3p5"><small>5</small></a>
32006  The gmtime_s function returns result, or a null pointer if the specified time cannot
32007  be converted to UTC or there is a runtime-constraint violation.
32008
32009 <p><small><a href="#Contents">Contents</a></small>
32010 <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>
32011 <p><b>Synopsis</b>
32012 <p><a name="K.3.8.2.4p1" href="#K.3.8.2.4p1"><small>1</small></a>
32013 <pre>
32014           #define __STDC_WANT_LIB_EXT1__ 1
32015           #include <a href="#7.27">&lt;time.h&gt;</a>
32016           struct tm *localtime_s(const time_t * restrict timer,
32017                struct tm * restrict result);
32018 </pre>
32019  Runtime-constraints
32020 <p><a name="K.3.8.2.4p2" href="#K.3.8.2.4p2"><small>2</small></a>
32021  Neither timer nor result shall be a null pointer.
32022 <p><a name="K.3.8.2.4p3" href="#K.3.8.2.4p3"><small>3</small></a>
32023  If there is a runtime-constraint violation, there is no attempt to convert the time.
32024 <p><b>Description</b>
32025 <p><a name="K.3.8.2.4p4" href="#K.3.8.2.4p4"><small>4</small></a>
32026  The localtime_s function converts the calendar time pointed to by timer into a
32027  broken-down time, expressed as local time. The broken-down time is stored in the
32028  structure pointed to by result.
32029 <p><b>Returns</b>
32030 <p><a name="K.3.8.2.4p5" href="#K.3.8.2.4p5"><small>5</small></a>
32031  The localtime_s function returns result, or a null pointer if the specified time
32032  cannot be converted to local time or there is a runtime-constraint violation.
32033
32034 <p><small><a href="#Contents">Contents</a></small>
32035 <h4><a name="K.3.9" href="#K.3.9">K.3.9 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a></h4>
32036 <p><a name="K.3.9p1" href="#K.3.9p1"><small>1</small></a>
32037  The header <a href="#7.29">&lt;wchar.h&gt;</a> defines two types.
32038 <p><a name="K.3.9p2" href="#K.3.9p2"><small>2</small></a>
32039  The types are
32040 <pre>
32041           errno_t
32042 </pre>
32043  which is type int; and
32044 <pre>
32045           rsize_t
32046 </pre>
32047  which is the type size_t.
32048 <p><a name="K.3.9p3" href="#K.3.9p3"><small>3</small></a>
32049  Unless explicitly stated otherwise, if the execution of a function described in this
32050  subclause causes copying to take place between objects that overlap, the objects take on
32051  unspecified values.
32052 <!--page 646 -->
32053
32054 <p><small><a href="#Contents">Contents</a></small>
32055 <h5><a name="K.3.9.1" href="#K.3.9.1">K.3.9.1 Formatted wide character input/output functions</a></h5>
32056
32057 <p><small><a href="#Contents">Contents</a></small>
32058 <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>
32059 <p><b>Synopsis</b>
32060 <p><a name="K.3.9.1.1p1" href="#K.3.9.1.1p1"><small>1</small></a>
32061 <pre>
32062          #define __STDC_WANT_LIB_EXT1__ 1
32063          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32064          int fwprintf_s(FILE * restrict stream,
32065               const wchar_t * restrict format, ...);
32066 </pre>
32067  Runtime-constraints
32068 <p><a name="K.3.9.1.1p2" href="#K.3.9.1.1p2"><small>2</small></a>
32069  Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note430"><b>430)</b></a></sup> (modified or
32070  not by flags, field width, or precision) shall not appear in the wide string pointed to by
32071  format. Any argument to fwprintf_s corresponding to a %s specifier shall not be a
32072  null pointer.
32073 <p><a name="K.3.9.1.1p3" href="#K.3.9.1.1p3"><small>3</small></a>
32074  If there is a runtime-constraint violation, the fwprintf_s function does not attempt to
32075  produce further output, and it is unspecified to what extent fwprintf_s produced
32076  output before discovering the runtime-constraint violation.
32077 <p><b>Description</b>
32078 <p><a name="K.3.9.1.1p4" href="#K.3.9.1.1p4"><small>4</small></a>
32079  The fwprintf_s function is equivalent to the fwprintf function except for the
32080  explicit runtime-constraints listed above.
32081 <p><b>Returns</b>
32082 <p><a name="K.3.9.1.1p5" href="#K.3.9.1.1p5"><small>5</small></a>
32083  The fwprintf_s function returns the number of wide characters transmitted, or a
32084  negative value if an output error, encoding error, or runtime-constraint violation occurred.
32085
32086 <p><b>Footnotes</b>
32087 <p><small><a name="note430" href="#note430">430)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32088  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32089  example, if the entire format string was L"%%n".
32090 </small>
32091
32092 <p><small><a href="#Contents">Contents</a></small>
32093 <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>
32094 <p><b>Synopsis</b>
32095 <p><a name="K.3.9.1.2p1" href="#K.3.9.1.2p1"><small>1</small></a>
32096 <pre>
32097          #define __STDC_WANT_LIB_EXT1__ 1
32098          #include <a href="#7.21">&lt;stdio.h&gt;</a>
32099          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32100          int fwscanf_s(FILE * restrict stream,
32101               const wchar_t * restrict format, ...);
32102 </pre>
32103  Runtime-constraints
32104 <p><a name="K.3.9.1.2p2" href="#K.3.9.1.2p2"><small>2</small></a>
32105  Neither stream nor format shall be a null pointer. Any argument indirected though in
32106  order to store converted input shall not be a null pointer.
32107  
32108  
32109 <!--page 647 -->
32110 <p><a name="K.3.9.1.2p3" href="#K.3.9.1.2p3"><small>3</small></a>
32111  If there is a runtime-constraint violation, the fwscanf_s function does not attempt to
32112  perform further input, and it is unspecified to what extent fwscanf_s performed input
32113  before discovering the runtime-constraint violation.
32114 <p><b>Description</b>
32115 <p><a name="K.3.9.1.2p4" href="#K.3.9.1.2p4"><small>4</small></a>
32116  The fwscanf_s function is equivalent to fwscanf except that the c, s, and [
32117  conversion specifiers apply to a pair of arguments (unless assignment suppression is
32118  indicated by a *). The first of these arguments is the same as for fwscanf. That
32119  argument is immediately followed in the argument list by the second argument, which has
32120  type size_t and gives the number of elements in the array pointed to by the first
32121  argument of the pair. If the first argument points to a scalar object, it is considered to be
32122  an array of one element.<sup><a href="#note431"><b>431)</b></a></sup>
32123 <p><a name="K.3.9.1.2p5" href="#K.3.9.1.2p5"><small>5</small></a>
32124  A matching failure occurs if the number of elements in a receiving object is insufficient to
32125  hold the converted input (including any trailing null character).
32126 <p><b>Returns</b>
32127 <p><a name="K.3.9.1.2p6" href="#K.3.9.1.2p6"><small>6</small></a>
32128  The fwscanf_s function returns the value of the macro EOF if an input failure occurs
32129  before any conversion or if there is a runtime-constraint violation. Otherwise, the
32130  fwscanf_s function returns the number of input items assigned, which can be fewer
32131  than provided for, or even zero, in the event of an early matching failure.
32132
32133 <p><b>Footnotes</b>
32134 <p><small><a name="note431" href="#note431">431)</a> If the format is known at translation time, an implementation may issue a diagnostic for any argument
32135  used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
32136  argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
32137  the format is not known at translation time. For example, an implementation may issue a diagnostic
32138  for each argument after format that has of type pointer to one of char, signed char,
32139  unsigned char, or void that is not followed by an argument of a type compatible with
32140  rsize_t. The diagnostic could warn that unless the pointer is being used with a conversion specifier
32141  using the hh length modifier, a length argument must follow the pointer argument. Another useful
32142  diagnostic could flag any non-pointer argument following format that did not have a type
32143  compatible with rsize_t.
32144 </small>
32145
32146 <p><small><a href="#Contents">Contents</a></small>
32147 <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>
32148 <p><b>Synopsis</b>
32149 <p><a name="K.3.9.1.3p1" href="#K.3.9.1.3p1"><small>1</small></a>
32150 <pre>
32151          #define __STDC_WANT_LIB_EXT1__ 1
32152          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32153          int snwprintf_s(wchar_t * restrict s,
32154               rsize_t n,
32155               const wchar_t * restrict format, ...);
32156 </pre>
32157  Runtime-constraints
32158 <p><a name="K.3.9.1.3p2" href="#K.3.9.1.3p2"><small>2</small></a>
32159  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
32160  than RSIZE_MAX. The %n specifier<sup><a href="#note432"><b>432)</b></a></sup> (modified or not by flags, field width, or
32161  
32162 <!--page 648 -->
32163  precision) shall not appear in the wide string pointed to by format. Any argument to
32164  snwprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
32165  error shall occur.
32166 <p><a name="K.3.9.1.3p3" href="#K.3.9.1.3p3"><small>3</small></a>
32167  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
32168  than zero and less than RSIZE_MAX, then the snwprintf_s function sets s[0] to the
32169  null wide character.
32170 <p><b>Description</b>
32171 <p><a name="K.3.9.1.3p4" href="#K.3.9.1.3p4"><small>4</small></a>
32172  The snwprintf_s function is equivalent to the swprintf function except for the
32173  explicit runtime-constraints listed above.
32174 <p><a name="K.3.9.1.3p5" href="#K.3.9.1.3p5"><small>5</small></a>
32175  The snwprintf_s function, unlike swprintf_s, will truncate the result to fit within
32176  the array pointed to by s.
32177 <p><b>Returns</b>
32178 <p><a name="K.3.9.1.3p6" href="#K.3.9.1.3p6"><small>6</small></a>
32179  The snwprintf_s function returns the number of wide characters that would have
32180  been written had n been sufficiently large, not counting the terminating wide null
32181  character, or a negative value if a runtime-constraint violation occurred. Thus, the null-
32182  terminated output has been completely written if and only if the returned value is
32183  nonnegative and less than n.
32184
32185 <p><b>Footnotes</b>
32186 <p><small><a name="note432" href="#note432">432)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32187  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32188  example, if the entire format string was L"%%n".
32189 </small>
32190
32191 <p><small><a href="#Contents">Contents</a></small>
32192 <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>
32193 <p><b>Synopsis</b>
32194 <p><a name="K.3.9.1.4p1" href="#K.3.9.1.4p1"><small>1</small></a>
32195 <pre>
32196          #define __STDC_WANT_LIB_EXT1__ 1
32197          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32198          int swprintf_s(wchar_t * restrict s, rsize_t n,
32199               const wchar_t * restrict format, ...);
32200 </pre>
32201  Runtime-constraints
32202 <p><a name="K.3.9.1.4p2" href="#K.3.9.1.4p2"><small>2</small></a>
32203  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
32204  than RSIZE_MAX. The number of wide characters (including the trailing null) required
32205  for the result to be written to the array pointed to by s shall not be greater than n. The %n
32206  specifier<sup><a href="#note433"><b>433)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
32207  wide string pointed to by format. Any argument to swprintf_s corresponding to a
32208  %s specifier shall not be a null pointer. No encoding error shall occur.
32209  
32210  
32211 <!--page 649 -->
32212 <p><a name="K.3.9.1.4p3" href="#K.3.9.1.4p3"><small>3</small></a>
32213  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
32214  than zero and less than RSIZE_MAX, then the swprintf_s function sets s[0] to the
32215  null wide character.
32216 <p><b>Description</b>
32217 <p><a name="K.3.9.1.4p4" href="#K.3.9.1.4p4"><small>4</small></a>
32218  The swprintf_s function is equivalent to the swprintf function except for the
32219  explicit runtime-constraints listed above.
32220 <p><a name="K.3.9.1.4p5" href="#K.3.9.1.4p5"><small>5</small></a>
32221  The swprintf_s function, unlike snwprintf_s, treats a result too big for the array
32222  pointed to by s as a runtime-constraint violation.
32223 <p><b>Returns</b>
32224 <p><a name="K.3.9.1.4p6" href="#K.3.9.1.4p6"><small>6</small></a>
32225  If no runtime-constraint violation occurred, the swprintf_s function returns the
32226  number of wide characters written in the array, not counting the terminating null wide
32227  character. If an encoding error occurred or if n or more wide characters are requested to
32228  be written, swprintf_s returns a negative value. If any other runtime-constraint
32229  violation occurred, swprintf_s returns zero.
32230
32231 <p><b>Footnotes</b>
32232 <p><small><a name="note433" href="#note433">433)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32233  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32234  example, if the entire format string was L"%%n".
32235 </small>
32236
32237 <p><small><a href="#Contents">Contents</a></small>
32238 <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>
32239 <p><b>Synopsis</b>
32240 <p><a name="K.3.9.1.5p1" href="#K.3.9.1.5p1"><small>1</small></a>
32241 <pre>
32242          #define __STDC_WANT_LIB_EXT1__ 1
32243          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32244          int swscanf_s(const wchar_t * restrict s,
32245               const wchar_t * restrict format, ...);
32246 </pre>
32247  Runtime-constraints
32248 <p><a name="K.3.9.1.5p2" href="#K.3.9.1.5p2"><small>2</small></a>
32249  Neither s nor format shall be a null pointer. Any argument indirected though in order
32250  to store converted input shall not be a null pointer.
32251 <p><a name="K.3.9.1.5p3" href="#K.3.9.1.5p3"><small>3</small></a>
32252  If there is a runtime-constraint violation, the swscanf_s function does not attempt to
32253  perform further input, and it is unspecified to what extent swscanf_s performed input
32254  before discovering the runtime-constraint violation.
32255 <p><b>Description</b>
32256 <p><a name="K.3.9.1.5p4" href="#K.3.9.1.5p4"><small>4</small></a>
32257  The swscanf_s function is equivalent to fwscanf_s, except that the argument s
32258  specifies a wide string from which the input is to be obtained, rather than from a stream.
32259  Reaching the end of the wide string is equivalent to encountering end-of-file for the
32260  fwscanf_s function.
32261 <p><b>Returns</b>
32262 <p><a name="K.3.9.1.5p5" href="#K.3.9.1.5p5"><small>5</small></a>
32263  The swscanf_s function returns the value of the macro EOF if an input failure occurs
32264  before any conversion or if there is a runtime-constraint violation. Otherwise, the
32265  swscanf_s function returns the number of input items assigned, which can be fewer
32266  than provided for, or even zero, in the event of an early matching failure.
32267 <!--page 650 -->
32268
32269 <p><small><a href="#Contents">Contents</a></small>
32270 <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>
32271 <p><b>Synopsis</b>
32272 <p><a name="K.3.9.1.6p1" href="#K.3.9.1.6p1"><small>1</small></a>
32273 <pre>
32274          #define __STDC_WANT_LIB_EXT1__ 1
32275          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32276          #include <a href="#7.21">&lt;stdio.h&gt;</a>
32277          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32278          int vfwprintf_s(FILE * restrict stream,
32279               const wchar_t * restrict format,
32280               va_list arg);
32281 </pre>
32282  Runtime-constraints
32283 <p><a name="K.3.9.1.6p2" href="#K.3.9.1.6p2"><small>2</small></a>
32284  Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note434"><b>434)</b></a></sup> (modified or
32285  not by flags, field width, or precision) shall not appear in the wide string pointed to by
32286  format. Any argument to vfwprintf_s corresponding to a %s specifier shall not be
32287  a null pointer.
32288 <p><a name="K.3.9.1.6p3" href="#K.3.9.1.6p3"><small>3</small></a>
32289  If there is a runtime-constraint violation, the vfwprintf_s function does not attempt
32290  to produce further output, and it is unspecified to what extent vfwprintf_s produced
32291  output before discovering the runtime-constraint violation.
32292 <p><b>Description</b>
32293 <p><a name="K.3.9.1.6p4" href="#K.3.9.1.6p4"><small>4</small></a>
32294  The vfwprintf_s function is equivalent to the vfwprintf function except for the
32295  explicit runtime-constraints listed above.
32296 <p><b>Returns</b>
32297 <p><a name="K.3.9.1.6p5" href="#K.3.9.1.6p5"><small>5</small></a>
32298  The vfwprintf_s function returns the number of wide characters transmitted, or a
32299  negative value if an output error, encoding error, or runtime-constraint violation occurred.
32300
32301 <p><b>Footnotes</b>
32302 <p><small><a name="note434" href="#note434">434)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32303  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32304  example, if the entire format string was L"%%n".
32305 </small>
32306
32307 <p><small><a href="#Contents">Contents</a></small>
32308 <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>
32309 <p><b>Synopsis</b>
32310 <p><a name="K.3.9.1.7p1" href="#K.3.9.1.7p1"><small>1</small></a>
32311 <pre>
32312          #define __STDC_WANT_LIB_EXT1__ 1
32313          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32314          #include <a href="#7.21">&lt;stdio.h&gt;</a>
32315          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32316          int vfwscanf_s(FILE * restrict stream,
32317               const wchar_t * restrict format, va_list arg);
32318 </pre>
32319  
32320  
32321  
32322 <!--page 651 -->
32323  Runtime-constraints
32324 <p><a name="K.3.9.1.7p2" href="#K.3.9.1.7p2"><small>2</small></a>
32325  Neither stream nor format shall be a null pointer. Any argument indirected though in
32326  order to store converted input shall not be a null pointer.
32327 <p><a name="K.3.9.1.7p3" href="#K.3.9.1.7p3"><small>3</small></a>
32328  If there is a runtime-constraint violation, the vfwscanf_s function does not attempt to
32329  perform further input, and it is unspecified to what extent vfwscanf_s performed input
32330  before discovering the runtime-constraint violation.
32331 <p><b>Description</b>
32332 <p><a name="K.3.9.1.7p4" href="#K.3.9.1.7p4"><small>4</small></a>
32333  The vfwscanf_s function is equivalent to fwscanf_s, with the variable argument
32334  list replaced by arg, which shall have been initialized by the va_start macro (and
32335  possibly subsequent va_arg calls). The vfwscanf_s function does not invoke the
32336  va_end macro.<sup><a href="#note435"><b>435)</b></a></sup>
32337 <p><b>Returns</b>
32338 <p><a name="K.3.9.1.7p5" href="#K.3.9.1.7p5"><small>5</small></a>
32339  The vfwscanf_s function returns the value of the macro EOF if an input failure occurs
32340  before any conversion or if there is a runtime-constraint violation. Otherwise, the
32341  vfwscanf_s function returns the number of input items assigned, which can be fewer
32342  than provided for, or even zero, in the event of an early matching failure.
32343
32344 <p><b>Footnotes</b>
32345 <p><small><a name="note435" href="#note435">435)</a> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
32346  value of arg after the return is indeterminate.
32347 </small>
32348
32349 <p><small><a href="#Contents">Contents</a></small>
32350 <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>
32351 <p><b>Synopsis</b>
32352 <p><a name="K.3.9.1.8p1" href="#K.3.9.1.8p1"><small>1</small></a>
32353 <pre>
32354          #define __STDC_WANT_LIB_EXT1__ 1
32355          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32356          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32357          int vsnwprintf_s(wchar_t * restrict s,
32358               rsize_t n,
32359               const wchar_t * restrict format,
32360               va_list arg);
32361 </pre>
32362  Runtime-constraints
32363 <p><a name="K.3.9.1.8p2" href="#K.3.9.1.8p2"><small>2</small></a>
32364  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
32365  than RSIZE_MAX. The %n specifier<sup><a href="#note436"><b>436)</b></a></sup> (modified or not by flags, field width, or
32366  precision) shall not appear in the wide string pointed to by format. Any argument to
32367  vsnwprintf_s corresponding to a %s specifier shall not be a null pointer. No
32368  encoding error shall occur.
32369  
32370 <!--page 652 -->
32371 <p><a name="K.3.9.1.8p3" href="#K.3.9.1.8p3"><small>3</small></a>
32372  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
32373  than zero and less than RSIZE_MAX, then the vsnwprintf_s function sets s[0] to
32374  the null wide character.
32375 <p><b>Description</b>
32376 <p><a name="K.3.9.1.8p4" href="#K.3.9.1.8p4"><small>4</small></a>
32377  The vsnwprintf_s function is equivalent to the vswprintf function except for the
32378  explicit runtime-constraints listed above.
32379 <p><a name="K.3.9.1.8p5" href="#K.3.9.1.8p5"><small>5</small></a>
32380  The vsnwprintf_s function, unlike vswprintf_s, will truncate the result to fit
32381  within the array pointed to by s.
32382 <p><b>Returns</b>
32383 <p><a name="K.3.9.1.8p6" href="#K.3.9.1.8p6"><small>6</small></a>
32384  The vsnwprintf_s function returns the number of wide characters that would have
32385  been written had n been sufficiently large, not counting the terminating null character, or
32386  a negative value if a runtime-constraint violation occurred. Thus, the null-terminated
32387  output has been completely written if and only if the returned value is nonnegative and
32388  less than n.
32389
32390 <p><b>Footnotes</b>
32391 <p><small><a name="note436" href="#note436">436)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32392  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32393  example, if the entire format string was L"%%n".
32394 </small>
32395
32396 <p><small><a href="#Contents">Contents</a></small>
32397 <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>
32398 <p><b>Synopsis</b>
32399 <p><a name="K.3.9.1.9p1" href="#K.3.9.1.9p1"><small>1</small></a>
32400 <pre>
32401          #define __STDC_WANT_LIB_EXT1__ 1
32402          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32403          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32404          int vswprintf_s(wchar_t * restrict s,
32405               rsize_t n,
32406               const wchar_t * restrict format,
32407               va_list arg);
32408 </pre>
32409  Runtime-constraints
32410 <p><a name="K.3.9.1.9p2" href="#K.3.9.1.9p2"><small>2</small></a>
32411  Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
32412  than RSIZE_MAX. The number of wide characters (including the trailing null) required
32413  for the result to be written to the array pointed to by s shall not be greater than n. The %n
32414  specifier<sup><a href="#note437"><b>437)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
32415  wide string pointed to by format. Any argument to vswprintf_s corresponding to a
32416  %s specifier shall not be a null pointer. No encoding error shall occur.
32417 <p><a name="K.3.9.1.9p3" href="#K.3.9.1.9p3"><small>3</small></a>
32418  If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
32419  than zero and less than RSIZE_MAX, then the vswprintf_s function sets s[0] to the
32420  null wide character.
32421  
32422 <!--page 653 -->
32423 <p><b>Description</b>
32424 <p><a name="K.3.9.1.9p4" href="#K.3.9.1.9p4"><small>4</small></a>
32425  The vswprintf_s function is equivalent to the vswprintf function except for the
32426  explicit runtime-constraints listed above.
32427 <p><a name="K.3.9.1.9p5" href="#K.3.9.1.9p5"><small>5</small></a>
32428  The vswprintf_s function, unlike vsnwprintf_s, treats a result too big for the
32429  array pointed to by s as a runtime-constraint violation.
32430 <p><b>Returns</b>
32431 <p><a name="K.3.9.1.9p6" href="#K.3.9.1.9p6"><small>6</small></a>
32432  If no runtime-constraint violation occurred, the vswprintf_s function returns the
32433  number of wide characters written in the array, not counting the terminating null wide
32434  character. If an encoding error occurred or if n or more wide characters are requested to
32435  be written, vswprintf_s returns a negative value. If any other runtime-constraint
32436  violation occurred, vswprintf_s returns zero.
32437
32438 <p><b>Footnotes</b>
32439 <p><small><a name="note437" href="#note437">437)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32440  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32441  example, if the entire format string was L"%%n".
32442 </small>
32443
32444 <p><small><a href="#Contents">Contents</a></small>
32445 <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>
32446 <p><b>Synopsis</b>
32447 <p><a name="K.3.9.1.10p1" href="#K.3.9.1.10p1"><small>1</small></a>
32448 <pre>
32449          #define __STDC_WANT_LIB_EXT1__ 1
32450          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32451          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32452          int vswscanf_s(const wchar_t * restrict s,
32453               const wchar_t * restrict format,
32454               va_list arg);
32455 </pre>
32456  Runtime-constraints
32457 <p><a name="K.3.9.1.10p2" href="#K.3.9.1.10p2"><small>2</small></a>
32458  Neither s nor format shall be a null pointer. Any argument indirected though in order
32459  to store converted input shall not be a null pointer.
32460 <p><a name="K.3.9.1.10p3" href="#K.3.9.1.10p3"><small>3</small></a>
32461  If there is a runtime-constraint violation, the vswscanf_s function does not attempt to
32462  perform further input, and it is unspecified to what extent vswscanf_s performed input
32463  before discovering the runtime-constraint violation.
32464 <p><b>Description</b>
32465 <p><a name="K.3.9.1.10p4" href="#K.3.9.1.10p4"><small>4</small></a>
32466  The vswscanf_s function is equivalent to swscanf_s, with the variable argument
32467  list replaced by arg, which shall have been initialized by the va_start macro (and
32468  possibly subsequent va_arg calls). The vswscanf_s function does not invoke the
32469  va_end macro.<sup><a href="#note438"><b>438)</b></a></sup>
32470  
32471  
32472  
32473  
32474 <!--page 654 -->
32475 <p><b>Returns</b>
32476 <p><a name="K.3.9.1.10p5" href="#K.3.9.1.10p5"><small>5</small></a>
32477  The vswscanf_s function returns the value of the macro EOF if an input failure occurs
32478  before any conversion or if there is a runtime-constraint violation. Otherwise, the
32479  vswscanf_s function returns the number of input items assigned, which can be fewer
32480  than provided for, or even zero, in the event of an early matching failure.
32481
32482 <p><b>Footnotes</b>
32483 <p><small><a name="note438" href="#note438">438)</a> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
32484  value of arg after the return is indeterminate.
32485 </small>
32486
32487 <p><small><a href="#Contents">Contents</a></small>
32488 <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>
32489 <p><b>Synopsis</b>
32490 <p><a name="K.3.9.1.11p1" href="#K.3.9.1.11p1"><small>1</small></a>
32491 <pre>
32492          #define __STDC_WANT_LIB_EXT1__ 1
32493          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32494          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32495          int vwprintf_s(const wchar_t * restrict format,
32496               va_list arg);
32497 </pre>
32498  Runtime-constraints
32499 <p><a name="K.3.9.1.11p2" href="#K.3.9.1.11p2"><small>2</small></a>
32500  format shall not be a null pointer. The %n specifier<sup><a href="#note439"><b>439)</b></a></sup> (modified or not by flags, field
32501  width, or precision) shall not appear in the wide string pointed to by format. Any
32502  argument to vwprintf_s corresponding to a %s specifier shall not be a null pointer.
32503 <p><a name="K.3.9.1.11p3" href="#K.3.9.1.11p3"><small>3</small></a>
32504  If there is a runtime-constraint violation, the vwprintf_s function does not attempt to
32505  produce further output, and it is unspecified to what extent vwprintf_s produced
32506  output before discovering the runtime-constraint violation.
32507 <p><b>Description</b>
32508 <p><a name="K.3.9.1.11p4" href="#K.3.9.1.11p4"><small>4</small></a>
32509  The vwprintf_s function is equivalent to the vwprintf function except for the
32510  explicit runtime-constraints listed above.
32511 <p><b>Returns</b>
32512 <p><a name="K.3.9.1.11p5" href="#K.3.9.1.11p5"><small>5</small></a>
32513  The vwprintf_s function returns the number of wide characters transmitted, or a
32514  negative value if an output error, encoding error, or runtime-constraint violation occurred.
32515  
32516  
32517  
32518  
32519 <!--page 655 -->
32520
32521 <p><b>Footnotes</b>
32522 <p><small><a name="note439" href="#note439">439)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32523  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32524  example, if the entire format string was L"%%n".
32525 </small>
32526
32527 <p><small><a href="#Contents">Contents</a></small>
32528 <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>
32529 <p><b>Synopsis</b>
32530 <p><a name="K.3.9.1.12p1" href="#K.3.9.1.12p1"><small>1</small></a>
32531 <pre>
32532          #define __STDC_WANT_LIB_EXT1__ 1
32533          #include <a href="#7.16">&lt;stdarg.h&gt;</a>
32534          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32535          int vwscanf_s(const wchar_t * restrict format,
32536               va_list arg);
32537 </pre>
32538  Runtime-constraints
32539 <p><a name="K.3.9.1.12p2" href="#K.3.9.1.12p2"><small>2</small></a>
32540  format shall not be a null pointer. Any argument indirected though in order to store
32541  converted input shall not be a null pointer.
32542 <p><a name="K.3.9.1.12p3" href="#K.3.9.1.12p3"><small>3</small></a>
32543  If there is a runtime-constraint violation, the vwscanf_s function does not attempt to
32544  perform further input, and it is unspecified to what extent vwscanf_s performed input
32545  before discovering the runtime-constraint violation.
32546 <p><b>Description</b>
32547 <p><a name="K.3.9.1.12p4" href="#K.3.9.1.12p4"><small>4</small></a>
32548  The vwscanf_s function is equivalent to wscanf_s, with the variable argument list
32549  replaced by arg, which shall have been initialized by the va_start macro (and
32550  possibly subsequent va_arg calls). The vwscanf_s function does not invoke the
32551  va_end macro.<sup><a href="#note440"><b>440)</b></a></sup>
32552 <p><b>Returns</b>
32553 <p><a name="K.3.9.1.12p5" href="#K.3.9.1.12p5"><small>5</small></a>
32554  The vwscanf_s function returns the value of the macro EOF if an input failure occurs
32555  before any conversion or if there is a runtime-constraint violation. Otherwise, the
32556  vwscanf_s function returns the number of input items assigned, which can be fewer
32557  than provided for, or even zero, in the event of an early matching failure.
32558
32559 <p><b>Footnotes</b>
32560 <p><small><a name="note440" href="#note440">440)</a> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
32561  value of arg after the return is indeterminate.
32562 </small>
32563
32564 <p><small><a href="#Contents">Contents</a></small>
32565 <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>
32566 <p><b>Synopsis</b>
32567 <p><a name="K.3.9.1.13p1" href="#K.3.9.1.13p1"><small>1</small></a>
32568 <pre>
32569          #define __STDC_WANT_LIB_EXT1__ 1
32570          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32571          int wprintf_s(const wchar_t * restrict format, ...);
32572 </pre>
32573  Runtime-constraints
32574 <p><a name="K.3.9.1.13p2" href="#K.3.9.1.13p2"><small>2</small></a>
32575  format shall not be a null pointer. The %n specifier<sup><a href="#note441"><b>441)</b></a></sup> (modified or not by flags, field
32576  
32577 <!--page 656 -->
32578  width, or precision) shall not appear in the wide string pointed to by format. Any
32579  argument to wprintf_s corresponding to a %s specifier shall not be a null pointer.
32580 <p><a name="K.3.9.1.13p3" href="#K.3.9.1.13p3"><small>3</small></a>
32581  If there is a runtime-constraint violation, the wprintf_s function does not attempt to
32582  produce further output, and it is unspecified to what extent wprintf_s produced output
32583  before discovering the runtime-constraint violation.
32584 <p><b>Description</b>
32585 <p><a name="K.3.9.1.13p4" href="#K.3.9.1.13p4"><small>4</small></a>
32586  The wprintf_s function is equivalent to the wprintf function except for the explicit
32587  runtime-constraints listed above.
32588 <p><b>Returns</b>
32589 <p><a name="K.3.9.1.13p5" href="#K.3.9.1.13p5"><small>5</small></a>
32590  The wprintf_s function returns the number of wide characters transmitted, or a
32591  negative value if an output error, encoding error, or runtime-constraint violation occurred.
32592
32593 <p><b>Footnotes</b>
32594 <p><small><a name="note441" href="#note441">441)</a> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
32595  string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
32596  example, if the entire format string was L"%%n".
32597 </small>
32598
32599 <p><small><a href="#Contents">Contents</a></small>
32600 <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>
32601 <p><b>Synopsis</b>
32602 <p><a name="K.3.9.1.14p1" href="#K.3.9.1.14p1"><small>1</small></a>
32603 <pre>
32604         #define __STDC_WANT_LIB_EXT1__ 1
32605         #include <a href="#7.29">&lt;wchar.h&gt;</a>
32606         int wscanf_s(const wchar_t * restrict format, ...);
32607 </pre>
32608  Runtime-constraints
32609 <p><a name="K.3.9.1.14p2" href="#K.3.9.1.14p2"><small>2</small></a>
32610  format shall not be a null pointer. Any argument indirected though in order to store
32611  converted input shall not be a null pointer.
32612 <p><a name="K.3.9.1.14p3" href="#K.3.9.1.14p3"><small>3</small></a>
32613  If there is a runtime-constraint violation, the wscanf_s function does not attempt to
32614  perform further input, and it is unspecified to what extent wscanf_s performed input
32615  before discovering the runtime-constraint violation.
32616 <p><b>Description</b>
32617 <p><a name="K.3.9.1.14p4" href="#K.3.9.1.14p4"><small>4</small></a>
32618  The wscanf_s function is equivalent to fwscanf_s with the argument stdin
32619  interposed before the arguments to wscanf_s.
32620 <p><b>Returns</b>
32621 <p><a name="K.3.9.1.14p5" href="#K.3.9.1.14p5"><small>5</small></a>
32622  The wscanf_s function returns the value of the macro EOF if an input failure occurs
32623  before any conversion or if there is a runtime-constraint violation. Otherwise, the
32624  wscanf_s function returns the number of input items assigned, which can be fewer than
32625  provided for, or even zero, in the event of an early matching failure.
32626 <!--page 657 -->
32627
32628 <p><small><a href="#Contents">Contents</a></small>
32629 <h5><a name="K.3.9.2" href="#K.3.9.2">K.3.9.2 General wide string utilities</a></h5>
32630
32631 <p><small><a href="#Contents">Contents</a></small>
32632 <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>
32633
32634 <p><small><a href="#Contents">Contents</a></small>
32635 <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>
32636 <p><b>Synopsis</b>
32637 <p><a name="K.3.9.2.1.1p1" href="#K.3.9.2.1.1p1"><small>1</small></a>
32638 <pre>
32639          #define __STDC_WANT_LIB_EXT1__ 1
32640          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32641          errno_t wcscpy_s(wchar_t * restrict s1,
32642               rsize_t s1max,
32643               const wchar_t * restrict s2);
32644 </pre>
32645  Runtime-constraints
32646 <p><a name="K.3.9.2.1.1p2" href="#K.3.9.2.1.1p2"><small>2</small></a>
32647  Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
32648  s1max shall not equal zero. s1max shall be greater than wcsnlen_s(s2, s1max).
32649  Copying shall not take place between objects that overlap.
32650 <p><a name="K.3.9.2.1.1p3" href="#K.3.9.2.1.1p3"><small>3</small></a>
32651  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
32652  greater than zero and not greater than RSIZE_MAX, then wcscpy_s sets s1[0] to the
32653  null wide character.
32654 <p><b>Description</b>
32655 <p><a name="K.3.9.2.1.1p4" href="#K.3.9.2.1.1p4"><small>4</small></a>
32656  The wcscpy_s function copies the wide string pointed to by s2 (including the
32657  terminating null wide character) into the array pointed to by s1.
32658 <p><a name="K.3.9.2.1.1p5" href="#K.3.9.2.1.1p5"><small>5</small></a>
32659  All elements following the terminating null wide character (if any) written by
32660  wcscpy_s in the array of s1max wide characters pointed to by s1 take unspecified
32661  values when wcscpy_s returns.<sup><a href="#note442"><b>442)</b></a></sup>
32662 <p><b>Returns</b>
32663 <p><a name="K.3.9.2.1.1p6" href="#K.3.9.2.1.1p6"><small>6</small></a>
32664  The wcscpy_s function returns zero<sup><a href="#note443"><b>443)</b></a></sup> if there was no runtime-constraint violation.
32665  Otherwise, a nonzero value is returned.
32666  
32667  
32668  
32669  
32670 <!--page 658 -->
32671
32672 <p><b>Footnotes</b>
32673 <p><small><a name="note442" href="#note442">442)</a> This allows an implementation to copy wide characters from s2 to s1 while simultaneously checking
32674  if any of those wide characters are null. Such an approach might write a wide character to every
32675  element of s1 before discovering that the first element should be set to the null wide character.
32676 </small>
32677 <p><small><a name="note443" href="#note443">443)</a> A zero return value implies that all of the requested wide characters from the string pointed to by s2
32678  fit within the array pointed to by s1 and that the result in s1 is null terminated.
32679 </small>
32680
32681 <p><small><a href="#Contents">Contents</a></small>
32682 <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>
32683 <p><b>Synopsis</b>
32684 <p><a name="K.3.9.2.1.2p7" href="#K.3.9.2.1.2p7"><small>7</small></a>
32685 <pre>
32686          #define __STDC_WANT_LIB_EXT1__ 1
32687          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32688          errno_t wcsncpy_s(wchar_t * restrict s1,
32689               rsize_t s1max,
32690               const wchar_t * restrict s2,
32691               rsize_t n);
32692 </pre>
32693  Runtime-constraints
32694 <p><a name="K.3.9.2.1.2p8" href="#K.3.9.2.1.2p8"><small>8</small></a>
32695  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
32696  RSIZE_MAX. s1max shall not equal zero. If n is not less than s1max, then s1max
32697  shall be greater than wcsnlen_s(s2, s1max). Copying shall not take place between
32698  objects that overlap.
32699 <p><a name="K.3.9.2.1.2p9" href="#K.3.9.2.1.2p9"><small>9</small></a>
32700  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
32701  greater than zero and not greater than RSIZE_MAX, then wcsncpy_s sets s1[0] to the
32702  null wide character.
32703 <p><b>Description</b>
32704 <p><a name="K.3.9.2.1.2p10" href="#K.3.9.2.1.2p10"><small>10</small></a>
32705  The wcsncpy_s function copies not more than n successive wide characters (wide
32706  characters that follow a null wide character are not copied) from the array pointed to by
32707  s2 to the array pointed to by s1. If no null wide character was copied from s2, then
32708  s1[n] is set to a null wide character.
32709 <p><a name="K.3.9.2.1.2p11" href="#K.3.9.2.1.2p11"><small>11</small></a>
32710  All elements following the terminating null wide character (if any) written by
32711  wcsncpy_s in the array of s1max wide characters pointed to by s1 take unspecified
32712  values when wcsncpy_s returns.<sup><a href="#note444"><b>444)</b></a></sup>
32713 <p><b>Returns</b>
32714 <p><a name="K.3.9.2.1.2p12" href="#K.3.9.2.1.2p12"><small>12</small></a>
32715  The wcsncpy_s function returns zero<sup><a href="#note445"><b>445)</b></a></sup> if there was no runtime-constraint violation.
32716  Otherwise, a nonzero value is returned.
32717 <p><a name="K.3.9.2.1.2p13" href="#K.3.9.2.1.2p13"><small>13</small></a>
32718  EXAMPLE 1 The wcsncpy_s function can be used to copy a wide string without the danger that the
32719  result will not be null terminated or that wide characters will be written past the end of the destination
32720  array.
32721  
32722  
32723  
32724  
32725 <!--page 659 -->
32726 <pre>
32727          #define __STDC_WANT_LIB_EXT1__ 1
32728          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32729          /* ... */
32730          wchar_t src1[100] = L"hello";
32731          wchar_t src2[7] = {L'g', L'o', L'o', L'd', L'b', L'y', L'e'};
32732          wchar_t dst1[6], dst2[5], dst3[5];
32733          int r1, r2, r3;
32734          r1 = wcsncpy_s(dst1, 6, src1, 100);
32735          r2 = wcsncpy_s(dst2, 5, src2, 7);
32736          r3 = wcsncpy_s(dst3, 5, src2, 4);
32737 </pre>
32738  The first call will assign to r1 the value zero and to dst1 the sequence of wide characters hello\0.
32739  The second call will assign to r2 a nonzero value and to dst2 the sequence of wide characters \0.
32740  The third call will assign to r3 the value zero and to dst3 the sequence of wide characters good\0.
32741  
32742
32743 <p><b>Footnotes</b>
32744 <p><small><a name="note444" href="#note444">444)</a> This allows an implementation to copy wide characters from s2 to s1 while simultaneously checking
32745  if any of those wide characters are null. Such an approach might write a wide character to every
32746  element of s1 before discovering that the first element should be set to the null wide character.
32747 </small>
32748 <p><small><a name="note445" href="#note445">445)</a> A zero return value implies that all of the requested wide characters from the string pointed to by s2
32749  fit within the array pointed to by s1 and that the result in s1 is null terminated.
32750 </small>
32751
32752 <p><small><a href="#Contents">Contents</a></small>
32753 <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>
32754 <p><b>Synopsis</b>
32755 <p><a name="K.3.9.2.1.3p14" href="#K.3.9.2.1.3p14"><small>14</small></a>
32756 <pre>
32757          #define __STDC_WANT_LIB_EXT1__ 1
32758          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32759          errno_t wmemcpy_s(wchar_t * restrict s1,
32760               rsize_t s1max,
32761               const wchar_t * restrict s2,
32762               rsize_t n);
32763 </pre>
32764  Runtime-constraints
32765 <p><a name="K.3.9.2.1.3p15" href="#K.3.9.2.1.3p15"><small>15</small></a>
32766  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
32767  RSIZE_MAX. n shall not be greater than s1max. Copying shall not take place between
32768  objects that overlap.
32769 <p><a name="K.3.9.2.1.3p16" href="#K.3.9.2.1.3p16"><small>16</small></a>
32770  If there is a runtime-constraint violation, the wmemcpy_s function stores zeros in the
32771  first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and
32772  s1max is not greater than RSIZE_MAX.
32773 <p><b>Description</b>
32774 <p><a name="K.3.9.2.1.3p17" href="#K.3.9.2.1.3p17"><small>17</small></a>
32775  The wmemcpy_s function copies n successive wide characters from the object pointed
32776  to by s2 into the object pointed to by s1.
32777 <p><b>Returns</b>
32778 <p><a name="K.3.9.2.1.3p18" href="#K.3.9.2.1.3p18"><small>18</small></a>
32779  The wmemcpy_s function returns zero if there was no runtime-constraint violation.
32780  Otherwise, a nonzero value is returned.
32781 <!--page 660 -->
32782
32783 <p><small><a href="#Contents">Contents</a></small>
32784 <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>
32785 <p><b>Synopsis</b>
32786 <p><a name="K.3.9.2.1.4p19" href="#K.3.9.2.1.4p19"><small>19</small></a>
32787 <pre>
32788         #define __STDC_WANT_LIB_EXT1__ 1
32789         #include <a href="#7.29">&lt;wchar.h&gt;</a>
32790         errno_t wmemmove_s(wchar_t *s1, rsize_t s1max,
32791              const wchar_t *s2, rsize_t n);
32792 </pre>
32793  Runtime-constraints
32794 <p><a name="K.3.9.2.1.4p20" href="#K.3.9.2.1.4p20"><small>20</small></a>
32795  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
32796  RSIZE_MAX. n shall not be greater than s1max.
32797 <p><a name="K.3.9.2.1.4p21" href="#K.3.9.2.1.4p21"><small>21</small></a>
32798  If there is a runtime-constraint violation, the wmemmove_s function stores zeros in the
32799  first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and
32800  s1max is not greater than RSIZE_MAX.
32801 <p><b>Description</b>
32802 <p><a name="K.3.9.2.1.4p22" href="#K.3.9.2.1.4p22"><small>22</small></a>
32803  The wmemmove_s function copies n successive wide characters from the object pointed
32804  to by s2 into the object pointed to by s1. This copying takes place as if the n wide
32805  characters from the object pointed to by s2 are first copied into a temporary array of n
32806  wide characters that does not overlap the objects pointed to by s1 or s2, and then the n
32807  wide characters from the temporary array are copied into the object pointed to by s1.
32808 <p><b>Returns</b>
32809 <p><a name="K.3.9.2.1.4p23" href="#K.3.9.2.1.4p23"><small>23</small></a>
32810  The wmemmove_s function returns zero if there was no runtime-constraint violation.
32811  Otherwise, a nonzero value is returned.
32812
32813 <p><small><a href="#Contents">Contents</a></small>
32814 <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>
32815
32816 <p><small><a href="#Contents">Contents</a></small>
32817 <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>
32818 <p><b>Synopsis</b>
32819 <p><a name="K.3.9.2.2.1p1" href="#K.3.9.2.2.1p1"><small>1</small></a>
32820 <pre>
32821         #define __STDC_WANT_LIB_EXT1__ 1
32822         #include <a href="#7.29">&lt;wchar.h&gt;</a>
32823         errno_t wcscat_s(wchar_t * restrict s1,
32824              rsize_t s1max,
32825              const wchar_t * restrict s2);
32826 </pre>
32827  Runtime-constraints
32828 <p><a name="K.3.9.2.2.1p2" href="#K.3.9.2.2.1p2"><small>2</small></a>
32829  Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
32830  wcscat_s.
32831 <p><a name="K.3.9.2.2.1p3" href="#K.3.9.2.2.1p3"><small>3</small></a>
32832  Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
32833  s1max shall not equal zero. m shall not equal zero.<sup><a href="#note446"><b>446)</b></a></sup> m shall be greater than
32834  wcsnlen_s(s2, m). Copying shall not take place between objects that overlap.
32835 <!--page 661 -->
32836 <p><a name="K.3.9.2.2.1p4" href="#K.3.9.2.2.1p4"><small>4</small></a>
32837  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
32838  greater than zero and not greater than RSIZE_MAX, then wcscat_s sets s1[0] to the
32839  null wide character.
32840 <p><b>Description</b>
32841 <p><a name="K.3.9.2.2.1p5" href="#K.3.9.2.2.1p5"><small>5</small></a>
32842  The wcscat_s function appends a copy of the wide string pointed to by s2 (including
32843  the terminating null wide character) to the end of the wide string pointed to by s1. The
32844  initial wide character from s2 overwrites the null wide character at the end of s1.
32845 <p><a name="K.3.9.2.2.1p6" href="#K.3.9.2.2.1p6"><small>6</small></a>
32846  All elements following the terminating null wide character (if any) written by
32847  wcscat_s in the array of s1max wide characters pointed to by s1 take unspecified
32848  values when wcscat_s returns.<sup><a href="#note447"><b>447)</b></a></sup>
32849 <p><b>Returns</b>
32850 <p><a name="K.3.9.2.2.1p7" href="#K.3.9.2.2.1p7"><small>7</small></a>
32851  The wcscat_s function returns zero<sup><a href="#note448"><b>448)</b></a></sup> if there was no runtime-constraint violation.
32852  Otherwise, a nonzero value is returned.
32853
32854 <p><b>Footnotes</b>
32855 <p><small><a name="note446" href="#note446">446)</a> Zero means that s1 was not null terminated upon entry to wcscat_s.
32856 </small>
32857 <p><small><a name="note447" href="#note447">447)</a> This allows an implementation to append wide characters from s2 to s1 while simultaneously
32858  checking if any of those wide characters are null. Such an approach might write a wide character to
32859  every element of s1 before discovering that the first element should be set to the null wide character.
32860 </small>
32861 <p><small><a name="note448" href="#note448">448)</a> A zero return value implies that all of the requested wide characters from the wide string pointed to by
32862  s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
32863 </small>
32864
32865 <p><small><a href="#Contents">Contents</a></small>
32866 <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>
32867 <p><b>Synopsis</b>
32868 <p><a name="K.3.9.2.2.2p8" href="#K.3.9.2.2.2p8"><small>8</small></a>
32869 <pre>
32870           #define __STDC_WANT_LIB_EXT1__ 1
32871           #include <a href="#7.29">&lt;wchar.h&gt;</a>
32872           errno_t wcsncat_s(wchar_t * restrict s1,
32873                rsize_t s1max,
32874                const wchar_t * restrict s2,
32875                rsize_t n);
32876 </pre>
32877  Runtime-constraints
32878 <p><a name="K.3.9.2.2.2p9" href="#K.3.9.2.2.2p9"><small>9</small></a>
32879  Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
32880  wcsncat_s.
32881 <p><a name="K.3.9.2.2.2p10" href="#K.3.9.2.2.2p10"><small>10</small></a>
32882  Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
32883  RSIZE_MAX. s1max shall not equal zero. m shall not equal zero.<sup><a href="#note449"><b>449)</b></a></sup> If n is not less
32884  than m, then m shall be greater than wcsnlen_s(s2, m). Copying shall not take
32885  place between objects that overlap.
32886  
32887  
32888 <!--page 662 -->
32889 <p><a name="K.3.9.2.2.2p11" href="#K.3.9.2.2.2p11"><small>11</small></a>
32890  If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
32891  greater than zero and not greater than RSIZE_MAX, then wcsncat_s sets s1[0] to the
32892  null wide character.
32893 <p><b>Description</b>
32894 <p><a name="K.3.9.2.2.2p12" href="#K.3.9.2.2.2p12"><small>12</small></a>
32895  The wcsncat_s function appends not more than n successive wide characters (wide
32896  characters that follow a null wide character are not copied) from the array pointed to by
32897  s2 to the end of the wide string pointed to by s1. The initial wide character from s2
32898  overwrites the null wide character at the end of s1. If no null wide character was copied
32899  from s2, then s1[s1max-m+n] is set to a null wide character.
32900 <p><a name="K.3.9.2.2.2p13" href="#K.3.9.2.2.2p13"><small>13</small></a>
32901  All elements following the terminating null wide character (if any) written by
32902  wcsncat_s in the array of s1max wide characters pointed to by s1 take unspecified
32903  values when wcsncat_s returns.<sup><a href="#note450"><b>450)</b></a></sup>
32904 <p><b>Returns</b>
32905 <p><a name="K.3.9.2.2.2p14" href="#K.3.9.2.2.2p14"><small>14</small></a>
32906  The wcsncat_s function returns zero<sup><a href="#note451"><b>451)</b></a></sup> if there was no runtime-constraint violation.
32907  Otherwise, a nonzero value is returned.
32908 <p><a name="K.3.9.2.2.2p15" href="#K.3.9.2.2.2p15"><small>15</small></a>
32909  EXAMPLE 1 The wcsncat_s function can be used to copy a wide string without the danger that the
32910  result will not be null terminated or that wide characters will be written past the end of the destination
32911  array.
32912 <pre>
32913           #define __STDC_WANT_LIB_EXT1__ 1
32914           #include <a href="#7.29">&lt;wchar.h&gt;</a>
32915           /* ... */
32916           wchar_t s1[100] = L"good";
32917           wchar_t s2[6] = L"hello";
32918           wchar_t s3[6] = L"hello";
32919           wchar_t s4[7] = L"abc";
32920           wchar_t s5[1000] = L"bye";
32921           int r1, r2, r3, r4;
32922           r1 = wcsncat_s(s1, 100, s5, 1000);
32923           r2 = wcsncat_s(s2, 6, L"", 1);
32924           r3 = wcsncat_s(s3, 6, L"X", 2);
32925           r4 = wcsncat_s(s4, 7, L"defghijklmn", 3);
32926 </pre>
32927  After the first call r1 will have the value zero and s1 will be the wide character sequence goodbye\0.
32928  After the second call r2 will have the value zero and s2 will be the wide character sequence hello\0.
32929  After the third call r3 will have a nonzero value and s3 will be the wide character sequence \0.
32930  After the fourth call r4 will have the value zero and s4 will be the wide character sequence abcdef\0.
32931  
32932  
32933  
32934  
32935 <!--page 663 -->
32936
32937 <p><b>Footnotes</b>
32938 <p><small><a name="note449" href="#note449">449)</a> Zero means that s1 was not null terminated upon entry to wcsncat_s.
32939 </small>
32940 <p><small><a name="note450" href="#note450">450)</a> This allows an implementation to append wide characters from s2 to s1 while simultaneously
32941  checking if any of those wide characters are null. Such an approach might write a wide character to
32942  every element of s1 before discovering that the first element should be set to the null wide character.
32943 </small>
32944 <p><small><a name="note451" href="#note451">451)</a> A zero return value implies that all of the requested wide characters from the wide string pointed to by
32945  s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
32946 </small>
32947
32948 <p><small><a href="#Contents">Contents</a></small>
32949 <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>
32950
32951 <p><small><a href="#Contents">Contents</a></small>
32952 <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>
32953 <p><b>Synopsis</b>
32954 <p><a name="K.3.9.2.3.1p1" href="#K.3.9.2.3.1p1"><small>1</small></a>
32955 <pre>
32956          #define __STDC_WANT_LIB_EXT1__ 1
32957          #include <a href="#7.29">&lt;wchar.h&gt;</a>
32958          wchar_t *wcstok_s(wchar_t * restrict s1,
32959               rsize_t * restrict s1max,
32960               const wchar_t * restrict s2,
32961               wchar_t ** restrict ptr);
32962 </pre>
32963  Runtime-constraints
32964 <p><a name="K.3.9.2.3.1p2" href="#K.3.9.2.3.1p2"><small>2</small></a>
32965  None of s1max, s2, or ptr shall be a null pointer. If s1 is a null pointer, then *ptr
32966  shall not be a null pointer. The value of *s1max shall not be greater than RSIZE_MAX.
32967  The end of the token found shall occur within the first *s1max wide characters of s1 for
32968  the first call, and shall occur within the first *s1max wide characters of where searching
32969  resumes on subsequent calls.
32970 <p><a name="K.3.9.2.3.1p3" href="#K.3.9.2.3.1p3"><small>3</small></a>
32971  If there is a runtime-constraint violation, the wcstok_s function does not indirect
32972  through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr.
32973 <p><b>Description</b>
32974 <p><a name="K.3.9.2.3.1p4" href="#K.3.9.2.3.1p4"><small>4</small></a>
32975  A sequence of calls to the wcstok_s function breaks the wide string pointed to by s1
32976  into a sequence of tokens, each of which is delimited by a wide character from the wide
32977  string pointed to by s2. The fourth argument points to a caller-provided wchar_t
32978  pointer into which the wcstok_s function stores information necessary for it to
32979  continue scanning the same wide string.
32980 <p><a name="K.3.9.2.3.1p5" href="#K.3.9.2.3.1p5"><small>5</small></a>
32981  The first call in a sequence has a non-null first argument and s1max points to an object
32982  whose value is the number of elements in the wide character array pointed to by the first
32983  argument. The first call stores an initial value in the object pointed to by ptr and
32984  updates the value pointed to by s1max to reflect the number of elements that remain in
32985  relation to ptr. Subsequent calls in the sequence have a null first argument and the
32986  objects pointed to by s1max and ptr are required to have the values stored by the
32987  previous call in the sequence, which are then updated. The separator wide string pointed
32988  to by s2 may be different from call to call.
32989 <p><a name="K.3.9.2.3.1p6" href="#K.3.9.2.3.1p6"><small>6</small></a>
32990  The first call in the sequence searches the wide string pointed to by s1 for the first wide
32991  character that is not contained in the current separator wide string pointed to by s2. If no
32992  such wide character is found, then there are no tokens in the wide string pointed to by s1
32993  and the wcstok_s function returns a null pointer. If such a wide character is found, it is
32994  the start of the first token.
32995 <!--page 664 -->
32996 <p><a name="K.3.9.2.3.1p7" href="#K.3.9.2.3.1p7"><small>7</small></a>
32997  The wcstok_s function then searches from there for the first wide character in s1 that
32998  is contained in the current separator wide string. If no such wide character is found, the
32999  current token extends to the end of the wide string pointed to by s1, and subsequent
33000  searches in the same wide string for a token return a null pointer. If such a wide character
33001  is found, it is overwritten by a null wide character, which terminates the current token.
33002 <p><a name="K.3.9.2.3.1p8" href="#K.3.9.2.3.1p8"><small>8</small></a>
33003  In all cases, the wcstok_s function stores sufficient information in the pointer pointed
33004  to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
33005  value for ptr, shall start searching just past the element overwritten by a null wide
33006  character (if any).
33007 <p><b>Returns</b>
33008 <p><a name="K.3.9.2.3.1p9" href="#K.3.9.2.3.1p9"><small>9</small></a>
33009  The wcstok_s function returns a pointer to the first wide character of a token, or a null
33010  pointer if there is no token or there is a runtime-constraint violation.
33011 <p><a name="K.3.9.2.3.1p10" href="#K.3.9.2.3.1p10"><small>10</small></a>
33012  EXAMPLE
33013 <pre>
33014         #define __STDC_WANT_LIB_EXT1__ 1
33015         #include <a href="#7.29">&lt;wchar.h&gt;</a>
33016         static wchar_t str1[] = L"?a???b,,,#c";
33017         static wchar_t str2[] = L"\t \t";
33018         wchar_t *t, *ptr1, *ptr2;
33019         rsize_t max1 = wcslen(str1)+1;
33020         rsize_t max2 = wcslen(str2)+1;
33021         t   =   wcstok_s(str1,   &amp;max1,   "?", &amp;ptr1);        //   t   points to the token "a"
33022         t   =   wcstok_s(NULL,   &amp;max1,   ",", &amp;ptr1);        //   t   points to the token "??b"
33023         t   =   wcstok_s(str2,   &amp;max2,   " \t", &amp;ptr2);      //   t   is a null pointer
33024         t   =   wcstok_s(NULL,   &amp;max1,   "#,", &amp;ptr1);       //   t   points to the token "c"
33025         t   =   wcstok_s(NULL,   &amp;max1,   "?", &amp;ptr1);        //   t   is a null pointer
33026 </pre>
33027  
33028
33029 <p><small><a href="#Contents">Contents</a></small>
33030 <h5><a name="K.3.9.2.4" href="#K.3.9.2.4">K.3.9.2.4 Miscellaneous functions</a></h5>
33031
33032 <p><small><a href="#Contents">Contents</a></small>
33033 <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>
33034 <p><b>Synopsis</b>
33035 <p><a name="K.3.9.2.4.1p1" href="#K.3.9.2.4.1p1"><small>1</small></a>
33036 <pre>
33037         #define __STDC_WANT_LIB_EXT1__ 1
33038         #include <a href="#7.29">&lt;wchar.h&gt;</a>
33039         size_t wcsnlen_s(const wchar_t *s, size_t maxsize);
33040 </pre>
33041 <p><b>Description</b>
33042 <p><a name="K.3.9.2.4.1p2" href="#K.3.9.2.4.1p2"><small>2</small></a>
33043  The wcsnlen_s function computes the length of the wide string pointed to by s.
33044 <p><b>Returns</b>
33045 <p><a name="K.3.9.2.4.1p3" href="#K.3.9.2.4.1p3"><small>3</small></a>
33046  If s is a null pointer,<sup><a href="#note452"><b>452)</b></a></sup> then the wcsnlen_s function returns zero.
33047 <p><a name="K.3.9.2.4.1p4" href="#K.3.9.2.4.1p4"><small>4</small></a>
33048  Otherwise, the wcsnlen_s function returns the number of wide characters that precede
33049  the terminating null wide character. If there is no null wide character in the first
33050  maxsize wide characters of s then wcsnlen_s returns maxsize. At most the first
33051 <!--page 665 -->
33052  maxsize wide characters of s shall be accessed by wcsnlen_s.
33053
33054 <p><b>Footnotes</b>
33055 <p><small><a name="note452" href="#note452">452)</a> Note that the wcsnlen_s function has no runtime-constraints. This lack of runtime-constraints
33056  along with the values returned for a null pointer or an unterminated wide string argument make
33057  wcsnlen_s useful in algorithms that gracefully handle such exceptional data.
33058 </small>
33059
33060 <p><small><a href="#Contents">Contents</a></small>
33061 <h5><a name="K.3.9.3" href="#K.3.9.3">K.3.9.3 Extended multibyte/wide character conversion utilities</a></h5>
33062
33063 <p><small><a href="#Contents">Contents</a></small>
33064 <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>
33065 <p><a name="K.3.9.3.1p1" href="#K.3.9.3.1p1"><small>1</small></a>
33066  Unlike wcrtomb, wcrtomb_s does not permit the ps parameter (the pointer to the
33067  conversion state) to be a null pointer.
33068
33069 <p><small><a href="#Contents">Contents</a></small>
33070 <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>
33071 <p><b>Synopsis</b>
33072 <p><a name="K.3.9.3.1.1p2" href="#K.3.9.3.1.1p2"><small>2</small></a>
33073 <pre>
33074          #include <a href="#7.29">&lt;wchar.h&gt;</a>
33075          errno_t wcrtomb_s(size_t * restrict retval,
33076               char * restrict s, rsize_t smax,
33077               wchar_t wc, mbstate_t * restrict ps);
33078 </pre>
33079  Runtime-constraints
33080 <p><a name="K.3.9.3.1.1p3" href="#K.3.9.3.1.1p3"><small>3</small></a>
33081  Neither retval nor ps shall be a null pointer. If s is not a null pointer, then smax
33082  shall not equal zero and shall not be greater than RSIZE_MAX. If s is not a null pointer,
33083  then smax shall be not be less than the number of bytes to be stored in the array pointed
33084  to by s. If s is a null pointer, then smax shall equal zero.
33085 <p><a name="K.3.9.3.1.1p4" href="#K.3.9.3.1.1p4"><small>4</small></a>
33086  If there is a runtime-constraint violation, then wcrtomb_s does the following. If s is
33087  not a null pointer and smax is greater than zero and not greater than RSIZE_MAX, then
33088  wcrtomb_s sets s[0] to the null character. If retval is not a null pointer, then
33089  wcrtomb_s sets *retval to (size_t)(-1).
33090 <p><b>Description</b>
33091 <p><a name="K.3.9.3.1.1p5" href="#K.3.9.3.1.1p5"><small>5</small></a>
33092  If s is a null pointer, the wcrtomb_s function is equivalent to the call
33093 <pre>
33094                  wcrtomb_s(&amp;retval, buf, sizeof buf, L'\0', ps)
33095 </pre>
33096  where retval and buf are internal variables of the appropriate types, and the size of
33097  buf is greater than MB_CUR_MAX.
33098 <p><a name="K.3.9.3.1.1p6" href="#K.3.9.3.1.1p6"><small>6</small></a>
33099  If s is not a null pointer, the wcrtomb_s function determines the number of bytes
33100  needed to represent the multibyte character that corresponds to the wide character given
33101  by wc (including any shift sequences), and stores the multibyte character representation
33102  in the array whose first element is pointed to by s. At most MB_CUR_MAX bytes are
33103  stored. If wc is a null wide character, a null byte is stored, preceded by any shift
33104  sequence needed to restore the initial shift state; the resulting state described is the initial
33105  conversion state.
33106  
33107 <!--page 666 -->
33108 <p><a name="K.3.9.3.1.1p7" href="#K.3.9.3.1.1p7"><small>7</small></a>
33109  If wc does not correspond to a valid multibyte character, an encoding error occurs: the
33110  wcrtomb_s function stores the value (size_t)(-1) into *retval and the
33111  conversion state is unspecified. Otherwise, the wcrtomb_s function stores into
33112  *retval the number of bytes (including any shift sequences) stored in the array pointed
33113  to by s.
33114 <p><b>Returns</b>
33115 <p><a name="K.3.9.3.1.1p8" href="#K.3.9.3.1.1p8"><small>8</small></a>
33116  The wcrtomb_s function returns zero if no runtime-constraint violation and no
33117  encoding error occurred. Otherwise, a nonzero value is returned.
33118
33119 <p><small><a href="#Contents">Contents</a></small>
33120 <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>
33121 <p><a name="K.3.9.3.2p1" href="#K.3.9.3.2p1"><small>1</small></a>
33122  Unlike mbsrtowcs and wcsrtombs, mbsrtowcs_s and wcsrtombs_s do not
33123  permit the ps parameter (the pointer to the conversion state) to be a null pointer.
33124
33125 <p><small><a href="#Contents">Contents</a></small>
33126 <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>
33127 <p><b>Synopsis</b>
33128 <p><a name="K.3.9.3.2.1p2" href="#K.3.9.3.2.1p2"><small>2</small></a>
33129 <pre>
33130         #include <a href="#7.29">&lt;wchar.h&gt;</a>
33131         errno_t mbsrtowcs_s(size_t * restrict retval,
33132              wchar_t * restrict dst, rsize_t dstmax,
33133              const char ** restrict src, rsize_t len,
33134              mbstate_t * restrict ps);
33135 </pre>
33136  Runtime-constraints
33137 <p><a name="K.3.9.3.2.1p3" href="#K.3.9.3.2.1p3"><small>3</small></a>
33138  None of retval, src, *src, or ps shall be null pointers. If dst is not a null pointer,
33139  then neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null
33140  pointer, then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall
33141  not equal zero. If dst is not a null pointer and len is not less than dstmax, then a null
33142  character shall occur within the first dstmax multibyte characters of the array pointed to
33143  by *src.
33144 <p><a name="K.3.9.3.2.1p4" href="#K.3.9.3.2.1p4"><small>4</small></a>
33145  If there is a runtime-constraint violation, then mbsrtowcs_s does the following. If
33146  retval is not a null pointer, then mbsrtowcs_s sets *retval to (size_t)(-1).
33147  If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
33148  then mbsrtowcs_s sets dst[0] to the null wide character.
33149 <p><b>Description</b>
33150 <p><a name="K.3.9.3.2.1p5" href="#K.3.9.3.2.1p5"><small>5</small></a>
33151  The mbsrtowcs_s function converts a sequence of multibyte characters that begins in
33152  the conversion state described by the object pointed to by ps, from the array indirectly
33153  pointed to by src into a sequence of corresponding wide characters. If dst is not a null
33154  pointer, the converted characters are stored into the array pointed to by dst. Conversion
33155  continues up to and including a terminating null character, which is also stored.
33156  Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
33157  not form a valid multibyte character, or (if dst is not a null pointer) when len wide
33158 <!--page 667 -->
33159  characters have been stored into the array pointed to by dst.<sup><a href="#note453"><b>453)</b></a></sup> If dst is not a null
33160  pointer and no null wide character was stored into the array pointed to by dst, then
33161  dst[len] is set to the null wide character. Each conversion takes place as if by a call
33162  to the mbrtowc function.
33163 <p><a name="K.3.9.3.2.1p6" href="#K.3.9.3.2.1p6"><small>6</small></a>
33164  If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
33165  pointer (if conversion stopped due to reaching a terminating null character) or the address
33166  just past the last multibyte character converted (if any). If conversion stopped due to
33167  reaching a terminating null character and if dst is not a null pointer, the resulting state
33168  described is the initial conversion state.
33169 <p><a name="K.3.9.3.2.1p7" href="#K.3.9.3.2.1p7"><small>7</small></a>
33170  Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
33171  sequence of bytes that do not form a valid multibyte character, an encoding error occurs:
33172  the mbsrtowcs_s function stores the value (size_t)(-1) into *retval and the
33173  conversion state is unspecified. Otherwise, the mbsrtowcs_s function stores into
33174  *retval the number of multibyte characters successfully converted, not including the
33175  terminating null character (if any).
33176 <p><a name="K.3.9.3.2.1p8" href="#K.3.9.3.2.1p8"><small>8</small></a>
33177  All elements following the terminating null wide character (if any) written by
33178  mbsrtowcs_s in the array of dstmax wide characters pointed to by dst take
33179  unspecified values when mbsrtowcs_s returns.<sup><a href="#note454"><b>454)</b></a></sup>
33180 <p><a name="K.3.9.3.2.1p9" href="#K.3.9.3.2.1p9"><small>9</small></a>
33181  If copying takes place between objects that overlap, the objects take on unspecified
33182  values.
33183 <p><b>Returns</b>
33184 <p><a name="K.3.9.3.2.1p10" href="#K.3.9.3.2.1p10"><small>10</small></a>
33185  The mbsrtowcs_s function returns zero if no runtime-constraint violation and no
33186  encoding error occurred. Otherwise, a nonzero value is returned.
33187
33188 <p><b>Footnotes</b>
33189 <p><small><a name="note453" href="#note453">453)</a> Thus, the value of len is ignored if dst is a null pointer.
33190 </small>
33191 <p><small><a name="note454" href="#note454">454)</a> This allows an implementation to attempt converting the multibyte string before discovering a
33192  terminating null character did not occur where required.
33193 </small>
33194
33195 <p><small><a href="#Contents">Contents</a></small>
33196 <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>
33197 <p><b>Synopsis</b>
33198 <p><a name="K.3.9.3.2.2p11" href="#K.3.9.3.2.2p11"><small>11</small></a>
33199 <pre>
33200           #include <a href="#7.29">&lt;wchar.h&gt;</a>
33201           errno_t wcsrtombs_s(size_t * restrict retval,
33202                char * restrict dst, rsize_t dstmax,
33203                const wchar_t ** restrict src, rsize_t len,
33204                mbstate_t * restrict ps);
33205 </pre>
33206  
33207  
33208  
33209  
33210 <!--page 668 -->
33211  Runtime-constraints
33212 <p><a name="K.3.9.3.2.2p12" href="#K.3.9.3.2.2p12"><small>12</small></a>
33213  None of retval, src, *src, or ps shall be null pointers. If dst is not a null pointer,
33214  then neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null
33215  pointer, then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall
33216  not equal zero. If dst is not a null pointer and len is not less than dstmax, then the
33217  conversion shall have been stopped (see below) because a terminating null wide character
33218  was reached or because an encoding error occurred.
33219 <p><a name="K.3.9.3.2.2p13" href="#K.3.9.3.2.2p13"><small>13</small></a>
33220  If there is a runtime-constraint violation, then wcsrtombs_s does the following. If
33221  retval is not a null pointer, then wcsrtombs_s sets *retval to (size_t)(-1).
33222  If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
33223  then wcsrtombs_s sets dst[0] to the null character.
33224 <p><b>Description</b>
33225 <p><a name="K.3.9.3.2.2p14" href="#K.3.9.3.2.2p14"><small>14</small></a>
33226  The wcsrtombs_s function converts a sequence of wide characters from the array
33227  indirectly pointed to by src into a sequence of corresponding multibyte characters that
33228  begins in the conversion state described by the object pointed to by ps. If dst is not a
33229  null pointer, the converted characters are then stored into the array pointed to by dst.
33230  Conversion continues up to and including a terminating null wide character, which is also
33231  stored. Conversion stops earlier in two cases:
33232 <ul>
33233 <li>  when a wide character is reached that does not correspond to a valid multibyte
33234  character;
33235 <li>  (if dst is not a null pointer) when the next multibyte character would exceed the
33236    limit of n total bytes to be stored into the array pointed to by dst. If the wide
33237    character being converted is the null wide character, then n is the lesser of len or
33238    dstmax. Otherwise, n is the lesser of len or dstmax-1.
33239 </ul>
33240  If the conversion stops without converting a null wide character and dst is not a null
33241  pointer, then a null character is stored into the array pointed to by dst immediately
33242  following any multibyte characters already stored. Each conversion takes place as if by a
33243  call to the wcrtomb function.<sup><a href="#note455"><b>455)</b></a></sup>
33244 <p><a name="K.3.9.3.2.2p15" href="#K.3.9.3.2.2p15"><small>15</small></a>
33245  If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
33246  pointer (if conversion stopped due to reaching a terminating null wide character) or the
33247  address just past the last wide character converted (if any). If conversion stopped due to
33248  reaching a terminating null wide character, the resulting state described is the initial
33249  conversion state.
33250  
33251  
33252 <!--page 669 -->
33253 <p><a name="K.3.9.3.2.2p16" href="#K.3.9.3.2.2p16"><small>16</small></a>
33254  Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
33255  wide character that does not correspond to a valid multibyte character, an encoding error
33256  occurs: the wcsrtombs_s function stores the value (size_t)(-1) into *retval
33257  and the conversion state is unspecified. Otherwise, the wcsrtombs_s function stores
33258  into *retval the number of bytes in the resulting multibyte character sequence, not
33259  including the terminating null character (if any).
33260 <p><a name="K.3.9.3.2.2p17" href="#K.3.9.3.2.2p17"><small>17</small></a>
33261  All elements following the terminating null character (if any) written by wcsrtombs_s
33262  in the array of dstmax elements pointed to by dst take unspecified values when
33263  wcsrtombs_s returns.<sup><a href="#note456"><b>456)</b></a></sup>
33264 <p><a name="K.3.9.3.2.2p18" href="#K.3.9.3.2.2p18"><small>18</small></a>
33265  If copying takes place between objects that overlap, the objects take on unspecified
33266  values.
33267 <p><b>Returns</b>
33268 <p><a name="K.3.9.3.2.2p19" href="#K.3.9.3.2.2p19"><small>19</small></a>
33269  The wcsrtombs_s function returns zero if no runtime-constraint violation and no
33270  encoding error occurred. Otherwise, a nonzero value is returned.
33271  
33272  
33273  
33274  
33275 <!--page 670 -->
33276
33277 <p><b>Footnotes</b>
33278 <p><small><a name="note455" href="#note455">455)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
33279  include those necessary to reach the initial shift state immediately before the null byte. However, if
33280  the conversion stops before a terminating null wide character has been reached, the result will be null
33281  terminated, but might not end in the initial shift state.
33282 </small>
33283 <p><small><a name="note456" href="#note456">456)</a> When len is not less than dstmax, the implementation might fill the array before discovering a
33284  runtime-constraint violation.
33285 </small>
33286
33287 <p><small><a href="#Contents">Contents</a></small>
33288 <h2><a name="L" href="#L">Annex L</a></h2>
33289 <pre>
33290                                             (normative)
33291                                          Analyzability
33292 </pre>
33293
33294 <p><small><a href="#Contents">Contents</a></small>
33295 <h3><a name="L.1" href="#L.1">L.1 Scope</a></h3>
33296 <p><a name="L.1p1" href="#L.1p1"><small>1</small></a>
33297  This annex specifies optional behavior that can aid in the analyzability of C programs.
33298 <p><a name="L.1p2" href="#L.1p2"><small>2</small></a>
33299  An implementation that defines __STDC_ANALYZABLE__ shall conform to the
33300  specifications in this annex.<sup><a href="#note457"><b>457)</b></a></sup>
33301
33302 <p><b>Footnotes</b>
33303 <p><small><a name="note457" href="#note457">457)</a> Implementations that do not define __STDC_ANALYZABLE__ are not required to conform to these
33304  specifications.
33305 </small>
33306
33307 <p><small><a href="#Contents">Contents</a></small>
33308 <h3><a name="L.2" href="#L.2">L.2 Definitions</a></h3>
33309
33310 <p><small><a href="#Contents">Contents</a></small>
33311 <h4><a name="L.2.1" href="#L.2.1">L.2.1</a></h4>
33312 <p><a name="L.2.1p1" href="#L.2.1p1"><small>1</small></a>
33313  out-of-bounds store
33314  an (attempted) access (<a href="#3.1">3.1</a>) that, at run time, for a given computational state, would
33315  modify (or, for an object declared volatile, fetch) one or more bytes that lie outside
33316  the bounds permitted by this Standard.
33317
33318 <p><small><a href="#Contents">Contents</a></small>
33319 <h4><a name="L.2.2" href="#L.2.2">L.2.2</a></h4>
33320 <p><a name="L.2.2p1" href="#L.2.2p1"><small>1</small></a>
33321  bounded undefined behavior
33322  undefined behavior (<a href="#3.4.3">3.4.3</a>) that does not perform an out-of-bounds store.
33323 <p><a name="L.2.2p2" href="#L.2.2p2"><small>2</small></a>
33324  NOTE 1    The behavior might perform a trap.
33325  
33326 <p><a name="L.2.2p3" href="#L.2.2p3"><small>3</small></a>
33327  NOTE 2    Any values produced or stored might be indeterminate values.
33328  
33329
33330 <p><small><a href="#Contents">Contents</a></small>
33331 <h4><a name="L.2.3" href="#L.2.3">L.2.3</a></h4>
33332 <p><a name="L.2.3p1" href="#L.2.3p1"><small>1</small></a>
33333  critical undefined behavior
33334  undefined behavior that is not bounded undefined behavior.
33335 <p><a name="L.2.3p2" href="#L.2.3p2"><small>2</small></a>
33336  NOTE     The behavior might perform an out-of-bounds store or perform a trap.
33337  
33338  
33339  
33340  
33341 <!--page 671 -->
33342
33343 <p><small><a href="#Contents">Contents</a></small>
33344 <h3><a name="L.3" href="#L.3">L.3 Requirements</a></h3>
33345 <p><a name="L.3p1" href="#L.3p1"><small>1</small></a>
33346  If the program performs a trap (<a href="#3.19.5">3.19.5</a>), the implementation is permitted to invoke a
33347  runtime-constraint handler. Any such semantics are implementation-defined.
33348 <p><a name="L.3p2" href="#L.3p2"><small>2</small></a>
33349  All undefined behavior shall be limited to bounded undefined behavior, except for the
33350  following which are permitted to result in critical undefined behavior:
33351 <ul>
33352 <li>  An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
33353 <li>  A store is performed to an object that has two incompatible declarations (<a href="#6.2.7">6.2.7</a>),
33354 <li>  A pointer is used to call a function whose type is not compatible with the referenced
33355  type (<a href="#6.2.7">6.2.7</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>).
33356 <li>  An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
33357 <li>  The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
33358 <li>  The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
33359 <li>  Addition or subtraction of a pointer into, or just beyond, an array object and an
33360  integer type produces a result that points just beyond the array object and is used as
33361  the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
33362 <li>  An attempt is made to modify an object defined with a const-qualified type through
33363  use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
33364 <li>  An argument to a function or macro defined in the standard library has an invalid
33365  value or a type not expected by a function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
33366 <li>  The longjmp function is called with a jmp_buf argument where the most recent
33367  invocation of the setjmp macro in the same invocation of the program with the
33368  corresponding jmp_buf argument is nonexistent, or the invocation was from another
33369  thread of execution, or the function containing the invocation has terminated
33370  execution in the interim, or the invocation was within the scope of an identifier with
33371  variably modified type and execution has left that scope in the interim (<a href="#7.13.2.1">7.13.2.1</a>).
33372 <li>  The value of a pointer that refers to space deallocated by a call to the free or realloc
33373  function is used (<a href="#7.22.3">7.22.3</a>).
33374 <li>  A string or wide string utility function accesses an array beyond the end of an object
33375  (<a href="#7.24.1">7.24.1</a>, <a href="#7.29.4">7.29.4</a>).
33376 <!--page 672 -->
33377 </ul>
33378
33379 <p><small><a href="#Contents">Contents</a></small>
33380 <h2><a name="Bibliography" href="#Bibliography">Bibliography</a></h2>
33381 <ol>
33382 <li>  ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
33383  published in The C Programming Language by Brian W. Kernighan and Dennis
33384  M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
33385 <li>  1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
33386  California, USA, November 1984.
33387 <li>  ANSI X3/TR-1-82 (1982), American National Dictionary for Information
33388  Processing Systems, Information Processing Systems Technical Report.
33389 <li>  ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
33390  Arithmetic.
33391 <li>  ANSI/IEEE 854-1988, American National Standard for Radix-Independent
33392  Floating-Point Arithmetic.
33393 <li>  IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
33394  second edition (previously designated IEC 559:1989).
33395 <li>  ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
33396  symbols for use in the physical sciences and technology.
33397 <li>  ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
33398  information interchange.
33399 <li>  ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
33400  Fundamental terms.
33401 <li>  ISO 4217:1995, Codes for the representation of currencies and funds.
33402 <li>  ISO 8601:1988, Data elements and interchange formats -- Information
33403  interchange -- Representation of dates and times.
33404 <li>  ISO/IEC 9899:1990, Programming languages -- C.
33405 <li>  ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
33406 <li>  ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
33407 <li>  ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
33408 <li>  ISO/IEC 9899:1999, Programming languages -- C.
33409 <li>  ISO/IEC 9899:1999/Cor.1:2001, Technical Corrigendum 1.
33410 <li>  ISO/IEC 9899:1999/Cor.2:2004, Technical Corrigendum 2.
33411 <li>  ISO/IEC 9899:1999/Cor.3:2007, Technical Corrigendum 3.
33412 <!--page 673 -->
33413 <li>  ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
33414  Interface (POSIX) -- Part 2: Shell and Utilities.
33415 <li>  ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
33416  preparation of programming language standards.
33417 <li>  ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
33418  Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
33419 <li>  ISO/IEC 10646-1/COR1:1996,         Technical       Corrigendum       1      to
33420  ISO/IEC 10646-1:1993.
33421 <li>  ISO/IEC 10646-1/COR2:1998,         Technical       Corrigendum       2      to
33422  ISO/IEC 10646-1:1993.
33423 <li>  ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
33424  Transformation Format for 16 planes of group 00 (UTF-16).
33425 <li>  ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
33426  Transformation Format 8 (UTF-8).
33427 <li>  ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
33428 <li>  ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
33429 <li>  ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
33430  syllables.
33431 <li>  ISO/IEC 10646-1/AMD6:1997,       Amendment     6   to   ISO/IEC 10646-1:1993
33432  Tibetan.
33433 <li>  ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
33434  additional characters.
33435 <li>  ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
33436 <li>  ISO/IEC 10646-1/AMD9:1997,       Amendment     9   to   ISO/IEC 10646-1:1993
33437  Identifiers for characters.
33438 <li>  ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
33439  Ethiopic.
33440 <li>  ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
33441  Unified Canadian Aboriginal Syllabics.
33442 <li>  ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
33443  Cherokee.
33444 <li>  ISO/IEC 10967-1:1994, Information technology -- Language independent
33445  arithmetic -- Part 1: Integer and floating point arithmetic.
33446 <!--page 674 -->
33447 <li>  ISO/IEC TR 19769:2004, Information technology -- Programming languages,
33448  their environments and system software interfaces -- Extensions for the
33449  programming language C to support new character data types.
33450 <li>  ISO/IEC TR 24731-1:2007, Information technology -- Programming languages,
33451  their environments and system software interfaces -- Extensions to the C library
33452  -- Part 1: Bounds-checking interfaces.
33453 <!--page 675 -->
33454 </ol>
33455
33456 <p><small><a href="#Contents">Contents</a></small>
33457 <h2><a name="Index" href="#Index">Index</a></h2>
33458 <pre>
33459  [^ 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>
33460                                                                 , (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>,
33461  [_ 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>
33462  ! (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>
33463  != (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>
33464  # 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>
33465  # 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>
33466  # punctuator, <a href="#6.10">6.10</a>                                             -= (subtraction assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
33467  ## 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>
33468  #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>,
33469  #elif preprocessing directive, <a href="#6.10.1">6.10.1</a>                               <a href="#6.5.2.3">6.5.2.3</a>
33470  #else preprocessing directive, <a href="#6.10.1">6.10.1</a>                          . punctuator, <a href="#6.7.9">6.7.9</a>
33471  #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>
33472  #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>
33473  #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>
33474       <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>
33475  #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>
33476  #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>
33477  #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>
33478       <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>,
33479  #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>
33480  #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>
33481  #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>
33482       <a href="#7.1.4">7.1.4</a>                                                     &lt;: (alternative spelling of [), <a href="#6.4.6">6.4.6</a>
33483  % (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>
33484  %: (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>
33485  %:%: (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>
33486  %= (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>
33487  %&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>,
33488  &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.25">7.25</a>, <a href="#7.31.1">7.31.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
33489  &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.31.2">7.31.2</a>
33490  &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.31.3">7.31.3</a>, <a href="#K.3.2">K.3.2</a>
33491  &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>,
33492  ' ' (space character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>,                <a href="#7.31.4">7.31.4</a>, <a href="#F">F</a>, <a href="#H">H</a>
33493       <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.30.2.1.3">7.30.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>,
33494  ( ) (cast operator), <a href="#6.5.4">6.5.4</a>                                          <a href="#7.29.4.1.1">7.29.4.1.1</a>
33495  ( ) (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.31.5">7.31.5</a>
33496  ( ) (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>
33497  ( ){ } (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>
33498  * (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.31.6">7.31.6</a>
33499  * (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.25">7.25</a>, <a href="#F">F</a>,
33500  * (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>
33501       <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>
33502  *= (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.31.7">7.31.7</a>
33503  + (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>
33504       <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>
33505  + (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>,
33506  ++ (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.31.8">7.31.8</a>
33507  ++ (prefix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a>                <a href="#7.18">&lt;stdbool.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>, <a href="#H">H</a>
33508  += (addition assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
33509 <!--page 676 -->
33510  <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>,            \u (universal character names), <a href="#6.4.3">6.4.3</a>
33511       <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>                     \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>,
33512  <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>,                      <a href="#7.4.1.10">7.4.1.10</a>
33513       <a href="#7.20">7.20</a>, <a href="#7.31.10">7.31.10</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>                            \x hexadecimal digits (hexadecimal-character
33514  <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.31.11">7.31.11</a>, <a href="#F">F</a>,                   escape sequence), <a href="#6.4.4.4">6.4.4.4</a>
33515       <a href="#K.3.5">K.3.5</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>
33516  <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.31.12">7.31.12</a>, <a href="#F">F</a>,             ^= (bitwise exclusive OR assignment operator),
33517       <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a>                                              <a href="#6.5.16.2">6.5.16.2</a>
33518  <a href="#7.23">&lt;stdnoreturn.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.23">7.23</a>                             __alignas_is_defined macro, <a href="#7.15">7.15</a>
33519  <a href="#7.24">&lt;string.h&gt;</a> header, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>                     __alignof_is_defined macro, <a href="#7.15">7.15</a>
33520  <a href="#7.25">&lt;tgmath.h&gt;</a> header, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                __bool_true_false_are_defined
33521  <a href="#7.26">&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.26">7.26</a>,                       macro, <a href="#7.18">7.18</a>
33522       <a href="#7.31.15">7.31.15</a>                                                __cplusplus macro, <a href="#6.10.8">6.10.8</a>
33523  <a href="#7.27">&lt;time.h&gt;</a> header, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>               __DATE__ macro, <a href="#6.10.8.1">6.10.8.1</a>
33524  <a href="#7.28">&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.28">7.28</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>
33525  <a href="#7.29">&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.29">7.29</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>
33526       <a href="#7.31.16">7.31.16</a>, <a href="#F">F</a>, <a href="#K.3.9">K.3.9</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>
33527  <a href="#7.30">&lt;wctype.h&gt;</a> header, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>                            __STDC_, <a href="#6.11.9">6.11.9</a>
33528  = (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__ macro, <a href="#6.10.8.1">6.10.8.1</a>
33529  = (simple assignment operator), <a href="#6.5.16.1">6.5.16.1</a>                    __STDC_ANALYZABLE__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#L.1">L.1</a>
33530  == (equality operator), <a href="#6.5.9">6.5.9</a>                               __STDC_HOSTED__ macro, <a href="#6.10.8.1">6.10.8.1</a>
33531  &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a>                            __STDC_IEC_559__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#F.1">F.1</a>
33532  &gt;= (greater-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a>               __STDC_IEC_559_COMPLEX__ macro,
33533  &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>                        <a href="#6.10.8.3">6.10.8.3</a>, <a href="#G.1">G.1</a>
33534  &gt;&gt;= (right-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a>             __STDC_ISO_10646__ macro, <a href="#6.10.8.2">6.10.8.2</a>
33535  ? : (conditional operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.15">6.5.15</a>                 __STDC_LIB_EXT1__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#K.2">K.2</a>
33536  ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a>                            __STDC_MB_MIGHT_NEQ_WC__ macro,
33537  [ ] (array subscript operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>                 <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.19">7.19</a>
33538  [ ] (brackets punctuator), <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a>                   __STDC_NO_ATOMICS__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
33539  \ (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>                 <a href="#7.17.1">7.17.1</a>
33540  \ (escape character), <a href="#6.4.4.4">6.4.4.4</a>                               __STDC_NO_COMPLEX__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
33541  \" (double-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>,                      <a href="#7.3.1">7.3.1</a>
33542       <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a>                                          __STDC_NO_THREADS__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
33543  \\ (backslash escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a>                  <a href="#7.26.1">7.26.1</a>
33544  \' (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_NO_VLA__ macro, <a href="#6.10.8.3">6.10.8.3</a>
33545  \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_UTF_16__ macro, <a href="#6.10.8.2">6.10.8.2</a>
33546    padding of binary stream, <a href="#7.21.2">7.21.2</a>                          __STDC_UTF_32__ macro, <a href="#6.10.8.2">6.10.8.2</a>
33547  \? (question-mark escape sequence), <a href="#6.4.4.4">6.4.4.4</a>                 __STDC_VERSION__ macro, <a href="#6.10.8.1">6.10.8.1</a>
33548  \a (alert escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>                  __STDC_WANT_LIB_EXT1__ macro, <a href="#K.3.1.1">K.3.1.1</a>
33549  \b (backspace escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>              __TIME__ macro, <a href="#6.10.8.1">6.10.8.1</a>
33550  \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>,             __VA_ARGS__ identifier, <a href="#6.10.3">6.10.3</a>, <a href="#6.10.3.1">6.10.3.1</a>
33551       <a href="#7.4.1.10">7.4.1.10</a>                                               _Alignas, <a href="#6.7.5">6.7.5</a>
33552  \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>,              _Alignof 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>
33553       <a href="#7.4.1.10">7.4.1.10</a>                                               _Atomic type qualifier, <a href="#6.7.3">6.7.3</a>
33554  \octal digits (octal-character escape sequence),            _Atomic type specifier, <a href="#6.7.2.4">6.7.2.4</a>
33555       <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="#F.4">F.4</a>
33556  \r (carriage-return escape sequence), <a href="#5.2.2">5.2.2</a>,                _Bool type conversions, <a href="#6.3.1.2">6.3.1.2</a>
33557       <a href="#6.4.4.4">6.4.4.4</a>, <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>
33558  \t (horizontal-tab escape sequence), <a href="#5.2.2">5.2.2</a>,                 _Complex_I macro, <a href="#7.3.1">7.3.1</a>
33559       <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.30.2.1.3">7.30.2.1.3</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>
33560  \U (universal character names), <a href="#6.4.3">6.4.3</a>                       _Imaginary keyword, <a href="#G.2">G.2</a>
33561 <!--page 677 -->
33562  _Imaginary types, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>                                   aliasing, <a href="#6.5">6.5</a>
33563  _Imaginary_I macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a>                               alignas macro, <a href="#7.15">7.15</a>
33564  _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>                     aligned_alloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.1">7.22.3.1</a>
33565  _IOLBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.6">7.21.5.6</a>                               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>
33566  _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>                        pointer, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.3">6.3.2.3</a>
33567  _Noreturn, <a href="#6.7.4">6.7.4</a>                                                structure/union member, <a href="#6.7.2.1">6.7.2.1</a>
33568  _Noreturn header, <a href="#7.23">7.23</a>                                       alignment header, <a href="#7.15">7.15</a>
33569  _Pragma operator, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a>                            alignment specifier, <a href="#6.7.5">6.7.5</a>
33570  _Static_assert, <a href="#6.7.10">6.7.10</a>, <a href="#7.2">7.2</a>                                  alignof macro, <a href="#7.15">7.15</a>
33571  _Thread_local storage-class specifier, <a href="#6.2.4">6.2.4</a>,                 allocated storage, order and contiguity, <a href="#7.22.3">7.22.3</a>
33572       <a href="#6.7.1">6.7.1</a>, <a href="#7.26.1">7.26.1</a>                                           alternative spellings header, <a href="#7.9">7.9</a>
33573  { } (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>,            and macro, <a href="#7.9">7.9</a>
33574       <a href="#6.8.2">6.8.2</a>                                                   AND operators
33575  { } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a>                        bitwise (&amp;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a>
33576  | (bitwise inclusive OR operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>              bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a>
33577  |= (bitwise inclusive OR assignment operator),                  logical (&amp;&amp;), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a>
33578       <a href="#6.5.16.2">6.5.16.2</a>                                                and_eq macro, <a href="#7.9">7.9</a>
33579  || (logical OR operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a>                    anonymous structure, <a href="#6.7.2.1">6.7.2.1</a>
33580  ~ (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>            anonymous union, <a href="#6.7.2.1">6.7.2.1</a>
33581                                                               ANSI/IEEE 754, <a href="#F.1">F.1</a>
33582  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>,                   ANSI/IEEE 854, <a href="#F.1">F.1</a>
33583        <a href="#7.22.4.1">7.22.4.1</a>, <a href="#K.3.6.1.2">K.3.6.1.2</a>                                    argc (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a>
33584  abort_handler_s function, <a href="#K.3.6.1.2">K.3.6.1.2</a>                          argument, <a href="#3.3">3.3</a>
33585  abs function, <a href="#7.22.6.1">7.22.6.1</a>                                          array, <a href="#6.9.1">6.9.1</a>
33586  absolute-value functions                                        default promotions, <a href="#6.5.2.2">6.5.2.2</a>
33587     complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a>                                        function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
33588     integer, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.22.6.1">7.22.6.1</a>                                   macro, substitution, <a href="#6.10.3.1">6.10.3.1</a>
33589     real, <a href="#7.12.7">7.12.7</a>, <a href="#F.10.4">F.10.4</a>                                      argument, complex, <a href="#7.3.9.1">7.3.9.1</a>
33590  abstract declarator, <a href="#6.7.7">6.7.7</a>                                   argv (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a>
33591  abstract machine, <a href="#5.1.2.3">5.1.2.3</a>                                    arithmetic constant expression, <a href="#6.6">6.6</a>
33592  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 conversions, usual, see usual arithmetic
33593  accuracy, see floating-point accuracy                               conversions
33594  acos functions, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#F.10.1.1">F.10.1.1</a>                           arithmetic operators
33595  acos type-generic macro, <a href="#7.25">7.25</a>                                   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>
33596  acosh functions, <a href="#7.12.5.1">7.12.5.1</a>, <a href="#F.10.2.1">F.10.2.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>
33597  acosh type-generic macro, <a href="#7.25">7.25</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>
33598  acquire fence, <a href="#7.17.4">7.17.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>
33599  acquire operation, <a href="#5.1.2.4">5.1.2.4</a>                                      shift, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
33600  active position, <a href="#5.2.2">5.2.2</a>                                          unary, <a href="#6.5.3.3">6.5.3.3</a>
33601  actual argument, <a href="#3.3">3.3</a>                                         arithmetic types, <a href="#6.2.5">6.2.5</a>
33602  actual parameter (deprecated), <a href="#3.3">3.3</a>                           arithmetic, pointer, <a href="#6.5.6">6.5.6</a>
33603  addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a>                  array
33604  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>,               argument, <a href="#6.9.1">6.9.1</a>
33605        <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>                                         declarator, <a href="#6.7.6.2">6.7.6.2</a>
33606  additive expressions, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a>                              initialization, <a href="#6.7.9">6.7.9</a>
33607  address constant, <a href="#6.6">6.6</a>                                           multidimensional, <a href="#6.5.2.1">6.5.2.1</a>
33608  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>                          parameter, <a href="#6.9.1">6.9.1</a>
33609  address-free, <a href="#7.17.5">7.17.5</a>                                            storage order, <a href="#6.5.2.1">6.5.2.1</a>
33610  aggregate initialization, <a href="#6.7.9">6.7.9</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>
33611  aggregate types, <a href="#6.2.5">6.2.5</a>                                          subscripting, <a href="#6.5.2.1">6.5.2.1</a>
33612  alert escape sequence (\a), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>                      type, <a href="#6.2.5">6.2.5</a>
33613 <!--page 678 -->
33614     type conversion, <a href="#6.3.2.1">6.3.2.1</a>                                       <a href="#7.17.7.5">7.17.7.5</a>
33615     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>                  atomic_flag type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.8">7.17.8</a>
33616  arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>                                  atomic_flag_clear functions, <a href="#7.17.8.2">7.17.8.2</a>
33617  as-if rule, <a href="#5.1.2.3">5.1.2.3</a>                                           ATOMIC_FLAG_INIT macro, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.8">7.17.8</a>
33618  ASCII code set, <a href="#5.2.1.1">5.2.1.1</a>                                       atomic_flag_test_and_set functions,
33619  asctime function, <a href="#7.27.3.1">7.27.3.1</a>                                        <a href="#7.17.8.1">7.17.8.1</a>
33620  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>                        atomic_init generic function, <a href="#7.17.2.2">7.17.2.2</a>
33621  asin functions, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#F.10.1.2">F.10.1.2</a>                            ATOMIC_INT_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
33622  asin type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                            atomic_is_lock_free generic function,
33623  asinh functions, <a href="#7.12.5.2">7.12.5.2</a>, <a href="#F.10.2.2">F.10.2.2</a>                               <a href="#7.17.5.1">7.17.5.1</a>
33624  asinh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                           ATOMIC_LLONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
33625  asm keyword, <a href="#J.5.10">J.5.10</a>                                           atomic_load generic functions, <a href="#7.17.7.2">7.17.7.2</a>
33626  assert macro, <a href="#7.2.1.1">7.2.1.1</a>                                         ATOMIC_LONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
33627  assert.h header, <a href="#7.2">7.2</a>                                          ATOMIC_LLONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
33628  assignment                                                    ATOMIC_SHORT_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
33629     compound, <a href="#6.5.16.2">6.5.16.2</a>                                         atomic_signal_fence function, <a href="#7.17.4.2">7.17.4.2</a>
33630     conversion, <a href="#6.5.16.1">6.5.16.1</a>                                       atomic_store generic functions, <a href="#7.17.7.1">7.17.7.1</a>
33631     expression, <a href="#6.5.16">6.5.16</a>                                         atomic_thread_fence function, <a href="#7.17.4.1">7.17.4.1</a>
33632     operators, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a>                                 ATOMIC_VAR_INIT macro, <a href="#7.17.2.1">7.17.2.1</a>
33633     simple, <a href="#6.5.16.1">6.5.16.1</a>                                           ATOMIC_WCHAR_T_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
33634  associativity of operators, <a href="#6.5">6.5</a>                               atomics header, <a href="#7.17">7.17</a>, <a href="#7.31.8">7.31.8</a>
33635  asterisk punctuator (*), <a href="#6.7.6.1">6.7.6.1</a>, <a href="#6.7.6.2">6.7.6.2</a>                     auto storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
33636  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>,                   automatic storage duration, <a href="#5.2.3">5.2.3</a>, <a href="#6.2.4">6.2.4</a>
33637       <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>
33638  atan functions, <a href="#7.12.4.3">7.12.4.3</a>, <a href="#F.10.1.3">F.10.1.3</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>
33639  atan type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                            backslash escape sequence (\\), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a>
33640  atan2 functions, <a href="#7.12.4.4">7.12.4.4</a>, <a href="#F.10.1.4">F.10.1.4</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>
33641  atan2 type-generic macro, <a href="#7.25">7.25</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>
33642  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 types, <a href="#6.2.5">6.2.5</a>
33643  atanh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                           behavior, <a href="#3.4">3.4</a>
33644  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>,                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>,
33645       <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>                                     <a href="#7.21.9.4">7.21.9.4</a>
33646  atof function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.1">7.22.1.1</a>                               bit, <a href="#3.5">3.5</a>
33647  atoi 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>
33648  atol 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>
33649  atoll function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a>                              bit-field, <a href="#6.7.2.1">6.7.2.1</a>
33650  atomic lock-free macros, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.5">7.17.5</a>                       bitand macro, <a href="#7.9">7.9</a>
33651  atomic operations, <a href="#5.1.2.4">5.1.2.4</a>                                    bitor macro, <a href="#7.9">7.9</a>
33652  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>,               bitwise operators, <a href="#6.5">6.5</a>
33653       <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>,              AND, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a>
33654       <a href="#7.17.6">7.17.6</a>                                                      AND assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a>
33655  ATOMIC_CHAR_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>
33656  ATOMIC_CHAR16_T_LOCK_FREE macro,                                 exclusive OR, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
33657       <a href="#7.17.1">7.17.1</a>                                                      exclusive OR assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
33658  ATOMIC_CHAR32_T_LOCK_FREE macro,                                 inclusive OR, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>
33659       <a href="#7.17.1">7.17.1</a>                                                      inclusive OR assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
33660  ATOMIC_CHAR_LOCK_FREE macro, <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>
33661  atomic_compare_exchange generic                               blank character, <a href="#7.4.1.3">7.4.1.3</a>
33662       functions, <a href="#7.17.7.4">7.17.7.4</a>                                      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>
33663  atomic_exchange generic functions, <a href="#7.17.7.3">7.17.7.3</a>                   block scope, <a href="#6.2.1">6.2.1</a>
33664  atomic_fetch and modify generic functions,                    block structure, <a href="#6.2.1">6.2.1</a>
33665 <!--page 679 -->
33666  bold type convention, <a href="#6.1">6.1</a>                                        type-generic macro for, <a href="#7.25">7.25</a>
33667  bool macro, <a href="#7.18">7.18</a>                                               cast expression, <a href="#6.5.4">6.5.4</a>
33668  boolean type, <a href="#6.3.1.2">6.3.1.2</a>                                          cast operator (( )), <a href="#6.5.4">6.5.4</a>
33669  boolean type and values header, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>                   catan functions, <a href="#7.3.5.3">7.3.5.3</a>, <a href="#G.6">G.6</a>
33670  boolean type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a>                        type-generic macro for, <a href="#7.25">7.25</a>
33671  bounded undefined behavior, <a href="#L.2.2">L.2.2</a>                               catanh functions, <a href="#7.3.6.3">7.3.6.3</a>, <a href="#G.6.2.3">G.6.2.3</a>
33672  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>,                type-generic macro for, <a href="#7.25">7.25</a>
33673       <a href="#6.8.2">6.8.2</a>                                                     cbrt functions, <a href="#7.12.7.1">7.12.7.1</a>, <a href="#F.10.4.1">F.10.4.1</a>
33674  brackets operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>                      cbrt type-generic macro, <a href="#7.25">7.25</a>
33675  brackets punctuator ([ ]), <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a>                      ccos functions, <a href="#7.3.5.4">7.3.5.4</a>, <a href="#G.6">G.6</a>
33676  branch cuts, <a href="#7.3.3">7.3.3</a>                                               type-generic macro for, <a href="#7.25">7.25</a>
33677  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>
33678  broken-down time, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.3">7.27.3</a>,                      type-generic macro for, <a href="#7.25">7.25</a>
33679       <a href="#7.27.3.1">7.27.3.1</a>, <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#7.27.3.5">7.27.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>
33680       <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.25">7.25</a>
33681  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.31.1">7.31.1</a>
33682  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.31.1">7.31.1</a>
33683  btowc function, <a href="#7.29.6.1.1">7.29.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>
33684  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.25">7.25</a>
33685  byte, <a href="#3.6">3.6</a>, <a href="#6.5.3.4">6.5.3.4</a>                                             cexp2 function, <a href="#7.31.1">7.31.1</a>
33686  byte input/output functions, <a href="#7.21.1">7.21.1</a>                            cexpm1 function, <a href="#7.31.1">7.31.1</a>
33687  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>,
33688                                                                      <a href="#K.3.9.1.2">K.3.9.1.2</a>
33689  <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>,
33690  c16rtomb function, <a href="#7.28.1.2">7.28.1.2</a>                                         <a href="#6.3.1.8">6.3.1.8</a>
33691  c32rtomb function, <a href="#7.28.1.4">7.28.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.7.9">6.7.9</a>, <a href="#6.10.8.2">6.10.8.2</a>,
33692  cabs functions, <a href="#7.3.8.1">7.3.8.1</a>, <a href="#G.6">G.6</a>                                        <a href="#7.28">7.28</a>
33693    type-generic macro for, <a href="#7.25">7.25</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.7.9">6.7.9</a>, <a href="#6.10.8.2">6.10.8.2</a>,
33694  cacos functions, <a href="#7.3.5.1">7.3.5.1</a>, <a href="#G.6.1.1">G.6.1.1</a>                                   <a href="#7.28">7.28</a>
33695    type-generic macro for, <a href="#7.25">7.25</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>
33696  cacosh functions, <a href="#7.3.6.1">7.3.6.1</a>, <a href="#G.6.2.1">G.6.2.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>
33697    type-generic macro for, <a href="#7.25">7.25</a>                                 CHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
33698  calendar time, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.2">7.27.2.2</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.2.4">7.27.2.4</a>,           character, <a href="#3.7">3.7</a>, <a href="#3.7.1">3.7.1</a>
33699        <a href="#7.27.3.2">7.27.3.2</a>, <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>,                 character array initialization, <a href="#6.7.9">6.7.9</a>
33700        <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>                                     character case mapping functions, <a href="#7.4.2">7.4.2</a>
33701  call by value, <a href="#6.5.2.2">6.5.2.2</a>                                           wide character, <a href="#7.30.3.1">7.30.3.1</a>
33702  call_once function, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.1">7.26.2.1</a>                                extensible, <a href="#7.30.3.2">7.30.3.2</a>
33703  calloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.2">7.22.3.2</a>                              character classification functions, <a href="#7.4.1">7.4.1</a>
33704  carg functions, <a href="#7.3.9.1">7.3.9.1</a>, <a href="#G.6">G.6</a>                                     wide character, <a href="#7.30.2.1">7.30.2.1</a>
33705  carg type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                  extensible, <a href="#7.30.2.2">7.30.2.2</a>
33706  carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</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>
33707        <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a>                                        character display semantics, <a href="#5.2.2">5.2.2</a>
33708  carries a dependency, <a href="#5.1.2.4">5.1.2.4</a>                                  character handling header, <a href="#7.4">7.4</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.31.2">7.31.2</a>
33709  case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</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>
33710  case mapping functions                                           wide character, <a href="#7.29.3">7.29.3</a>
33711    character, <a href="#7.4.2">7.4.2</a>                                             character sets, <a href="#5.2.1">5.2.1</a>
33712    wide character, <a href="#7.30.3.1">7.30.3.1</a>                                     character string literal, see string literal
33713        extensible, <a href="#7.30.3.2">7.30.3.2</a>                                     character type conversion, <a href="#6.3.1.1">6.3.1.1</a>
33714  casin functions, <a href="#7.3.5.2">7.3.5.2</a>, <a href="#G.6">G.6</a>                                  character types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.9">6.7.9</a>
33715    type-generic macro for, <a href="#7.25">7.25</a>                                 characteristics of floating types header, <a href="#7.7">7.7</a>
33716  casinh functions, <a href="#7.3.6.2">7.3.6.2</a>, <a href="#G.6.2.2">G.6.2.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>
33717 <!--page 680 -->
33718  cimag type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                           complex macro, <a href="#7.3.1">7.3.1</a>
33719  cis function, <a href="#G.6">G.6</a>                                             complex numbers, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a>
33720  classification functions                                       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>
33721     character, <a href="#7.4.1">7.4.1</a>                                           complex type domain, <a href="#6.2.5">6.2.5</a>
33722     floating-point, <a href="#7.12.3">7.12.3</a>                                      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>
33723     wide character, <a href="#7.30.2.1">7.30.2.1</a>                                   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>,
33724        extensible, <a href="#7.30.2.2">7.30.2.2</a>                                         <a href="#7.3">7.3</a>, <a href="#7.25">7.25</a>, <a href="#7.31.1">7.31.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
33725  clearerr function, <a href="#7.21.10.1">7.21.10.1</a>                                  compliance, see conformance
33726  clgamma function, <a href="#7.31.1">7.31.1</a>                                      components of time, <a href="#7.27.1">7.27.1</a>, <a href="#K.3.8.1">K.3.8.1</a>
33727  clock function, <a href="#7.27.2.1">7.27.2.1</a>                                      composite type, <a href="#6.2.7">6.2.7</a>
33728  clock_t type, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.1">7.27.2.1</a>                                compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
33729  CLOCKS_PER_SEC macro, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.1">7.27.2.1</a>                        compound literals, <a href="#6.5.2.5">6.5.2.5</a>
33730  clog functions, <a href="#7.3.7.2">7.3.7.2</a>, <a href="#G.6.3.2">G.6.3.2</a>                              compound statement, <a href="#6.8.2">6.8.2</a>
33731     type-generic macro for, <a href="#7.25">7.25</a>                               compound-literal operator (( ){ }), <a href="#6.5.2.5">6.5.2.5</a>
33732  clog10 function, <a href="#7.31.1">7.31.1</a>                                       concatenation functions
33733  clog1p function, <a href="#7.31.1">7.31.1</a>                                         string, <a href="#7.24.3">7.24.3</a>, <a href="#K.3.7.2">K.3.7.2</a>
33734  clog2 function, <a href="#7.31.1">7.31.1</a>                                          wide string, <a href="#7.29.4.3">7.29.4.3</a>, <a href="#K.3.9.2.2">K.3.9.2.2</a>
33735  CMPLX macros, <a href="#7.3.9.3">7.3.9.3</a>                                         concatenation, preprocessing, see preprocessing
33736  cnd_broadcast function, <a href="#7.26.3.1">7.26.3.1</a>, <a href="#7.26.3.5">7.26.3.5</a>,                        concatenation
33737        <a href="#7.26.3.6">7.26.3.6</a>                                                conceptual models, <a href="#5.1">5.1</a>
33738  cnd_destroy function, <a href="#7.26.3.2">7.26.3.2</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>,
33739  cnd_init function, <a href="#7.26.3.3">7.26.3.3</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>
33740  cnd_signal function, <a href="#7.26.3.4">7.26.3.4</a>, <a href="#7.26.3.5">7.26.3.5</a>,                      conditional inclusion, <a href="#6.10.1">6.10.1</a>
33741        <a href="#7.26.3.6">7.26.3.6</a>                                                conditional operator (? :), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.15">6.5.15</a>
33742  cnd_t type, <a href="#7.26.1">7.26.1</a>                                            conflict, <a href="#5.1.2.4">5.1.2.4</a>
33743  cnd_timedwait function, <a href="#7.26.3.5">7.26.3.5</a>                              conformance, <a href="#4">4</a>
33744  cnd_wait function, <a href="#7.26.3.3">7.26.3.3</a>, <a href="#7.26.3.6">7.26.3.6</a>                         conj functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a>
33745  collating sequences, <a href="#5.2.1">5.2.1</a>                                    conj type-generic macro, <a href="#7.25">7.25</a>
33746  colon punctuator (:), <a href="#6.7.2.1">6.7.2.1</a>                                 const type qualifier, <a href="#6.7.3">6.7.3</a>
33747  comma operator (,), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.17">6.5.17</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>
33748  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>,           constant expression, <a href="#6.6">6.6</a>, <a href="#F.8.4">F.8.4</a>
33749        <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a>                                          constants, <a href="#6.4.4">6.4.4</a>
33750  command processor, <a href="#7.22.4.8">7.22.4.8</a>                                     as primary expression, <a href="#6.5.1">6.5.1</a>
33751  comment delimiters (/* */ and //), <a href="#6.4.9">6.4.9</a>                        character, <a href="#6.4.4.4">6.4.4.4</a>
33752  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>                                   enumeration, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
33753  common definitions header, <a href="#7.19">7.19</a>                                  floating, <a href="#6.4.4.2">6.4.4.2</a>
33754  common extensions, <a href="#J.5">J.5</a>                                          hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
33755  common initial sequence, <a href="#6.5.2.3">6.5.2.3</a>                                integer, <a href="#6.4.4.1">6.4.4.1</a>
33756  common real type, <a href="#6.3.1.8">6.3.1.8</a>                                       octal, <a href="#6.4.4.1">6.4.4.1</a>
33757  common warnings, <a href="#I">I</a>                                            constraint, <a href="#3.8">3.8</a>, <a href="#4">4</a>
33758  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>,             constraint_handler_t type, <a href="#K.3.6">K.3.6</a>
33759        <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>                           consume operation, <a href="#5.1.2.4">5.1.2.4</a>
33760     string, <a href="#7.24.4">7.24.4</a>                                             content of structure/union/enumeration, <a href="#6.7.2.3">6.7.2.3</a>
33761     wide string, <a href="#7.29.4.4">7.29.4.4</a>                                      contiguity of allocated storage, <a href="#7.22.3">7.22.3</a>
33762  comparison macros, <a href="#7.12.14">7.12.14</a>                                    continue statement, <a href="#6.8.6.2">6.8.6.2</a>
33763  comparison, pointer, <a href="#6.5.8">6.5.8</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>
33764  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 character, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>
33765  compl macro, <a href="#7.9">7.9</a>                                              control wide character, <a href="#7.30.2">7.30.2</a>
33766  complement operator (~), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a>                     conversion, <a href="#6.3">6.3</a>
33767  complete type, <a href="#6.2.5">6.2.5</a>                                            arithmetic operands, <a href="#6.3.1">6.3.1</a>
33768  complex arithmetic header, <a href="#7.3">7.3</a>, <a href="#7.31.1">7.31.1</a>                          array argument, <a href="#6.9.1">6.9.1</a>
33769 <!--page 681 -->
33770    array parameter, <a href="#6.9.1">6.9.1</a>                                       correctly rounded result, <a href="#3.9">3.9</a>
33771    arrays, <a href="#6.3.2.1">6.3.2.1</a>                                              corresponding real type, <a href="#6.2.5">6.2.5</a>
33772    boolean, <a href="#6.3.1.2">6.3.1.2</a>                                             cos functions, <a href="#7.12.4.5">7.12.4.5</a>, <a href="#F.10.1.5">F.10.1.5</a>
33773    boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>                   cos type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
33774    by assignment, <a href="#6.5.16.1">6.5.16.1</a>                                      cosh functions, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#F.10.2.4">F.10.2.4</a>
33775    by return statement, <a href="#6.8.6.4">6.8.6.4</a>                                 cosh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
33776    complex types, <a href="#6.3.1.6">6.3.1.6</a>                                       cpow functions, <a href="#7.3.8.2">7.3.8.2</a>, <a href="#G.6.4.1">G.6.4.1</a>
33777    explicit, <a href="#6.3">6.3</a>                                                   type-generic macro for, <a href="#7.25">7.25</a>
33778    function, <a href="#6.3.2.1">6.3.2.1</a>                                            cproj functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a>
33779    function argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>                            cproj type-generic macro, <a href="#7.25">7.25</a>
33780    function designators, <a href="#6.3.2.1">6.3.2.1</a>                                creal functions, <a href="#7.3.9.6">7.3.9.6</a>, <a href="#G.6">G.6</a>
33781    function parameter, <a href="#6.9.1">6.9.1</a>                                    creal type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
33782    imaginary, <a href="#G.4.1">G.4.1</a>                                             critical undefined behavior, <a href="#L.2.3">L.2.3</a>
33783    imaginary and complex, <a href="#G.4.3">G.4.3</a>                                 csin functions, <a href="#7.3.5.5">7.3.5.5</a>, <a href="#G.6">G.6</a>
33784    implicit, <a href="#6.3">6.3</a>                                                   type-generic macro for, <a href="#7.25">7.25</a>
33785    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>
33786    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.25">7.25</a>
33787    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>
33788    real and imaginary, <a href="#G.4.2">G.4.2</a>                                       type-generic macro for, <a href="#7.25">7.25</a>
33789    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>
33790    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.25">7.25</a>
33791    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>
33792    usual arithmetic, see usual arithmetic                          type-generic macro for, <a href="#7.25">7.25</a>
33793          conversions                                            ctgamma function, <a href="#7.31.1">7.31.1</a>
33794    void type, <a href="#6.3.2.2">6.3.2.2</a>                                           ctime function, <a href="#7.27.3.2">7.27.3.2</a>
33795  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>
33796    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.31.2">7.31.2</a>
33797       extended, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a>                                 current object, <a href="#6.7.9">6.7.9</a>
33798       restartable, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.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>
33799    multibyte/wide string, <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>
33800       restartable, <a href="#7.29.6.4">7.29.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.2.2">7.22.2.2</a>, <a href="#7.22.3">7.22.3</a>,
33801    numeric, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a>                                          <a href="#7.22.4.6">7.22.4.6</a>, <a href="#7.24.5.8">7.24.5.8</a>, <a href="#7.24.6.2">7.24.6.2</a>, <a href="#7.27.3">7.27.3</a>, <a href="#7.28.1">7.28.1</a>,
33802       wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1">7.29.4.1</a>                                 <a href="#7.29.6.3">7.29.6.3</a>, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.6.2.1">K.3.6.2.1</a>
33803    single byte/wide character, <a href="#7.29.6.1">7.29.6.1</a>                         data stream, see streams
33804    time, <a href="#7.27.3">7.27.3</a>, <a href="#K.3.8.2">K.3.8.2</a>                                        date and time header, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>
33805       wide character, <a href="#7.29.5">7.29.5</a>                                    Daylight Saving Time, <a href="#7.27.1">7.27.1</a>
33806  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.29.2.1">7.29.2.1</a>,             DBL_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33807       <a href="#7.29.2.2">7.29.2.2</a>                                                  DBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33808  conversion state, <a href="#7.22.7">7.22.7</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.28.1.1">7.28.1.1</a>,                    DBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33809       <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.6">7.29.6</a>,                     DBL_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33810       <a href="#7.29.6.2.1">7.29.6.2.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>,             DBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33811       <a href="#7.29.6.4">7.29.6.4</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.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>
33812       <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>
33813       <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>
33814  conversion state functions, <a href="#7.29.6.2">7.29.6.2</a>                           DBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33815  copying functions                                              DBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33816    string, <a href="#7.24.2">7.24.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>
33817    wide string, <a href="#7.29.4.2">7.29.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>
33818  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>
33819       <a href="#F.10.8.1">F.10.8.1</a>                                                  decimal digit, <a href="#5.2.1">5.2.1</a>
33820  copysign type-generic macro, <a href="#7.25">7.25</a>                              decimal-point character, <a href="#7.1.1">7.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
33821 <!--page 682 -->
33822  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>,                           <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.2">F.2</a>
33823        <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.5">F.5</a>                     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>,
33824  declaration specifiers, <a href="#6.7">6.7</a>                                        <a href="#6.3.1.8">6.3.1.8</a>
33825  declarations, <a href="#6.7">6.7</a>                                             double-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a>
33826     function, <a href="#6.7.6.3">6.7.6.3</a>                                          double-quote escape sequence (\"), <a href="#6.4.4.4">6.4.4.4</a>,
33827     pointer, <a href="#6.7.6.1">6.7.6.1</a>                                               <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a>
33828     structure/union, <a href="#6.7.2.1">6.7.2.1</a>                                   double_t type, <a href="#7.12">7.12</a>
33829     typedef, <a href="#6.7.8">6.7.8</a>
33830  declarator, <a href="#6.7.6">6.7.6</a>                                             EDOM macro, <a href="#7.5">7.5</a>, <a href="#7.12.1">7.12.1</a>, see also domain error
33831     abstract, <a href="#6.7.7">6.7.7</a>                                            effective type, <a href="#6.5">6.5</a>
33832  declarator type derivation, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.6">6.7.6</a>                      EILSEQ macro, <a href="#7.5">7.5</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.28.1.1">7.28.1.1</a>, <a href="#7.28.1.2">7.28.1.2</a>,
33833  decrement operators, see arithmetic operators,                      <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.3">7.29.3.3</a>,
33834        increment and decrement                                       <a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>,
33835  default argument promotions, <a href="#6.5.2.2">6.5.2.2</a>                                see also encoding error
33836  default initialization, <a href="#6.7.9">6.7.9</a>                                 element type, <a href="#6.2.5">6.2.5</a>
33837  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>
33838  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>
33839  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>
33840  definition, <a href="#6.7">6.7</a>                                                else statement, <a href="#6.8.4.1">6.8.4.1</a>
33841     function, <a href="#6.9.1">6.9.1</a>                                            empty statement, <a href="#6.8.3">6.8.3</a>
33842  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.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
33843  derived declarator types, <a href="#6.2.5">6.2.5</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>, <a href="#7.21.6.8">7.21.6.8</a>,
33844  derived types, <a href="#6.2.5">6.2.5</a>                                                <a href="#7.21.6.10">7.21.6.10</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.28.1.1">7.28.1.1</a>,
33845  designated initializer, <a href="#6.7.9">6.7.9</a>                                       <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>,
33846  destringizing, <a href="#6.10.9">6.10.9</a>                                               <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.2.3">7.29.2.3</a>, <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.7">7.29.2.7</a>,
33847  device input/output, <a href="#5.1.2.3">5.1.2.3</a>                                        <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.11">7.29.2.11</a>, <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.2">7.29.3.2</a>,
33848  diagnostic message, <a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>                                   <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.3.4">7.29.3.4</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>,
33849  diagnostics, <a href="#5.1.1.3">5.1.1.3</a>                                                <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</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>,
33850  diagnostics header, <a href="#7.2">7.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>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>
33851  difftime function, <a href="#7.27.2.2">7.27.2.2</a>                                   end-of-file, <a href="#7.29.1">7.29.1</a>
33852  digit, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</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>,
33853  digraphs, <a href="#6.4.6">6.4.6</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>,
33854  direct input/output functions, <a href="#7.21.8">7.21.8</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.29.3.1">7.29.3.1</a>,
33855  display device, <a href="#5.2.2">5.2.2</a>                                               <a href="#7.29.3.10">7.29.3.10</a>
33856  div function, <a href="#7.22.6.2">7.22.6.2</a>                                        end-of-file macro, see EOF macro
33857  div_t type, <a href="#7.22">7.22</a>                                              end-of-line indicator, <a href="#5.2.1">5.2.1</a>
33858  division assignment operator (/=), <a href="#6.5.16.2">6.5.16.2</a>                   endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
33859  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>             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>
33860  do statement, <a href="#6.8.5.2">6.8.5.2</a>                                         enumerated type, <a href="#6.2.5">6.2.5</a>
33861  documentation of implementation, <a href="#4">4</a>                            enumeration, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.2">6.7.2.2</a>
33862  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 constant, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
33863        <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>,                 enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
33864        <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>,               enumeration members, <a href="#6.7.2.2">6.7.2.2</a>
33865        <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>,                 enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
33866        <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>               enumeration tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
33867  dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>                                     enumerator, <a href="#6.7.2.2">6.7.2.2</a>
33868  double _Complex type, <a href="#6.2.5">6.2.5</a>                                   environment, <a href="#5">5</a>
33869  double _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>,                     environment functions, <a href="#7.22.4">7.22.4</a>, <a href="#K.3.6.2">K.3.6.2</a>
33870        <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</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>
33871  double _Imaginary type, <a href="#G.2">G.2</a>                                   environmental considerations, <a href="#5.2">5.2</a>
33872  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>,                 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>,
33873 <!--page 683 -->
33874        <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>,           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>
33875        <a href="#7.22.4.3">7.22.4.3</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>                             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>
33876  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>,                     evaluation of expression, <a href="#5.1.2.3">5.1.2.3</a>
33877        <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>,                  evaluation order, see order of evaluation
33878        <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>,                  exceptional condition, <a href="#6.5">6.5</a>
33879        <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>,                   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>
33880        <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.2.4">7.29.2.4</a>,                    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>
33881        <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#7.29.2.12">7.29.2.12</a>,                 exclusive OR operators
33882        <a href="#7.29.3.4">7.29.3.4</a>, <a href="#7.29.6.1.1">7.29.6.1.1</a>, <a href="#7.29.6.1.2">7.29.6.1.2</a>, <a href="#K.3.5.3.7">K.3.5.3.7</a>,                bitwise (^), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
33883        <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>,               bitwise assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
33884        <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>,             executable program, <a href="#5.1.1.1">5.1.1.1</a>
33885        <a href="#K.3.9.1.14">K.3.9.1.14</a>                                                execution character set, <a href="#5.2.1">5.2.1</a>
33886  epoch, <a href="#7.27.2.5">7.27.2.5</a>                                                 execution environment, <a href="#5">5</a>, <a href="#5.1.2">5.1.2</a>, see also
33887  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>                       environmental limits
33888  equal-to operator, see equality operator                        execution sequence, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.8">6.8</a>
33889  equality expressions, <a href="#6.5.9">6.5.9</a>                                     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>,
33890  equality operator (==), <a href="#6.5.9">6.5.9</a>                                        <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>, <a href="#7.26.5.5">7.26.5.5</a>
33891  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>,                    EXIT_FAILURE macro, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a>
33892        <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.29.4.1.1">7.29.4.1.1</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>, see           EXIT_SUCCESS macro, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.26.5.5">7.26.5.5</a>
33893        also range error, pole error                              exp functions, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#F.10.3.1">F.10.3.1</a>
33894  erf functions, <a href="#7.12.8.1">7.12.8.1</a>, <a href="#F.10.5.1">F.10.5.1</a>                               exp type-generic macro, <a href="#7.25">7.25</a>
33895  erf type-generic macro, <a href="#7.25">7.25</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>
33896  erfc functions, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#F.10.5.2">F.10.5.2</a>                              exp2 type-generic macro, <a href="#7.25">7.25</a>
33897  erfc type-generic macro, <a href="#7.25">7.25</a>                                   explicit conversion, <a href="#6.3">6.3</a>
33898  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 functions, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#F.10.3.3">F.10.3.3</a>
33899        <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>,            expm1 type-generic macro, <a href="#7.25">7.25</a>
33900        <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.24.6.2">7.24.6.2</a>, <a href="#7.28.1.1">7.28.1.1</a>,           exponent part, <a href="#6.4.4.2">6.4.4.2</a>
33901        <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.3.1">7.29.3.1</a>,                   exponential functions
33902        <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>,               complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
33903        <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#J.5.17">J.5.17</a>,                 real, <a href="#7.12.6">7.12.6</a>, <a href="#F.10.3">F.10.3</a>
33904        <a href="#K.3.1.3">K.3.1.3</a>, <a href="#K.3.7.4.2">K.3.7.4.2</a>                                        expression, <a href="#6.5">6.5</a>
33905  errno.h header, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a>, <a href="#K.3.2">K.3.2</a>                                assignment, <a href="#6.5.16">6.5.16</a>
33906  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>,                     cast, <a href="#6.5.4">6.5.4</a>
33907        <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>                                         constant, <a href="#6.6">6.6</a>
33908  error                                                             evaluation, <a href="#5.1.2.3">5.1.2.3</a>
33909     domain, see domain error                                       full, <a href="#6.8">6.8</a>
33910     encoding, see encoding error                                   order of evaluation, see order of evaluation
33911     pole, see pole error                                           parenthesized, <a href="#6.5.1">6.5.1</a>
33912     range, see range error                                         primary, <a href="#6.5.1">6.5.1</a>
33913  error conditions, <a href="#7.12.1">7.12.1</a>                                          unary, <a href="#6.5.3">6.5.3</a>
33914  error functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.10.5">F.10.5</a>                                 expression statement, <a href="#6.8.3">6.8.3</a>
33915  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 alignment, <a href="#6.2.8">6.2.8</a>
33916        <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 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>
33917        <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 characters, <a href="#5.2.1">5.2.1</a>
33918        <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.3">7.29.3.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>,
33919  error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a>                             <a href="#7.20">7.20</a>
33920  error-handling functions, <a href="#7.21.10">7.21.10</a>, <a href="#7.24.6.2">7.24.6.2</a>,                    extended multibyte and wide character utilities
33921        <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>                                           header, <a href="#7.29">7.29</a>, <a href="#7.31.16">7.31.16</a>
33922  errors header, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a>                                      extended multibyte/wide character conversion
33923  escape character (\), <a href="#6.4.4.4">6.4.4.4</a>                                        utilities, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
33924  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 case mapping functions,
33925 <!--page 684 -->
33926       <a href="#7.30.3.2">7.30.3.2</a>                                                     <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.8.1">7.21.8.1</a>
33927  extensible wide character classification functions,           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>
33928       <a href="#7.30.2.2">7.30.2.2</a>                                                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>
33929  extern storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.7.1">6.7.1</a>                  fgetwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.29.3.1">7.29.3.1</a>,
33930  external definition, <a href="#6.9">6.9</a>                                           <a href="#7.29.3.6">7.29.3.6</a>
33931  external identifiers, underscore, <a href="#7.1.3">7.1.3</a>                       fgetws function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.2">7.29.3.2</a>
33932  external linkage, <a href="#6.2.2">6.2.2</a>                                      field width, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>
33933  external name, <a href="#6.4.2.1">6.4.2.1</a>                                       file, <a href="#7.21.3">7.21.3</a>
33934  external object definitions, <a href="#6.9.2">6.9.2</a>                              access functions, <a href="#7.21.5">7.21.5</a>, <a href="#K.3.5.2">K.3.5.2</a>
33935                                                                 name, <a href="#7.21.3">7.21.3</a>
33936  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>                        operations, <a href="#7.21.4">7.21.4</a>, <a href="#K.3.5.1">K.3.5.1</a>
33937  fabs type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                             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>,
33938  false macro, <a href="#7.18">7.18</a>                                                    <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>,
33939  fclose function, <a href="#7.21.5.1">7.21.5.1</a>                                            <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>,
33940  fdim functions, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#F.10.9.1">F.10.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>, <a href="#7.21.9.5">7.21.9.5</a>, <a href="#7.29.3.1">7.29.3.1</a>,
33941  fdim type-generic macro, <a href="#7.25">7.25</a>                                        <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.3.10">7.29.3.10</a>
33942  FE_ALL_EXCEPT macro, <a href="#7.6">7.6</a>                                       positioning functions, <a href="#7.21.9">7.21.9</a>
33943  FE_DFL_ENV macro, <a href="#7.6">7.6</a>                                        file scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.9">6.9</a>
33944  FE_DIVBYZERO macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>                           FILE type, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>
33945  FE_DOWNWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>                                  FILENAME_MAX macro, <a href="#7.21.1">7.21.1</a>
33946  FE_INEXACT macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>                                   flags, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>, see also floating-point
33947  FE_INVALID macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>                                  status flag
33948  FE_OVERFLOW macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>                            flexible array member, <a href="#6.7.2.1">6.7.2.1</a>
33949  FE_TONEAREST macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>                                 float _Complex type, <a href="#6.2.5">6.2.5</a>
33950  FE_TOWARDZERO 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>,
33951  FE_UNDERFLOW 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>
33952  FE_UPWARD 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>
33953  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, <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>
33954  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>            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>,
33955  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>                     <a href="#6.3.1.8">6.3.1.8</a>
33956  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>                       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>,
33957  feholdexcept function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.3">7.6.4.3</a>,                          <a href="#7.29.4.1.1">7.29.4.1.1</a>
33958       <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>                                            float_t type, <a href="#7.12">7.12</a>
33959  fence, <a href="#5.1.2.4">5.1.2.4</a>                                               floating constant, <a href="#6.4.4.2">6.4.4.2</a>
33960  fences, <a href="#7.17.4">7.17.4</a>                                               floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a>
33961  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>,                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>,
33962       <a href="#7.31.4">7.31.4</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>
33963  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>
33964       <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>,
33965  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
33966  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>
33967  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>
33968  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>
33969  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>
33970  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 environment header, <a href="#7.6">7.6</a>, <a href="#7.31.4">7.31.4</a>
33971  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 exception, <a href="#7.6">7.6</a>, <a href="#7.6.2">7.6.2</a>, <a href="#F.10">F.10</a>
33972  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 number, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.2.5">6.2.5</a>
33973  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 rounding mode, <a href="#5.2.4.2.2">5.2.4.2.2</a>
33974  fexcept_t type, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>                                     floating-point status flag, <a href="#7.6">7.6</a>, <a href="#F.8.6">F.8.6</a>
33975  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 functions, <a href="#7.12.9.2">7.12.9.2</a>, <a href="#F.10.6.2">F.10.6.2</a>
33976  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>,                    floor type-generic macro, <a href="#7.25">7.25</a>
33977 <!--page 685 -->
33978  FLT_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                              FP_NAN macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
33979  FLT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                      FP_NORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
33980  FLT_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                  FP_SUBNORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
33981  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>,                  FP_ZERO macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
33982       <a href="#F.10.11">F.10.11</a>                                                  fpclassify macro, <a href="#7.12.3.1">7.12.3.1</a>, <a href="#F.3">F.3</a>
33983  FLT_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                              fpos_t type, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>
33984  FLT_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                 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>,
33985  FLT_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                            <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>,
33986  FLT_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                     <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.3">F.3</a>, <a href="#K.3.5.3.1">K.3.5.3.1</a>
33987  FLT_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                  fprintf_s function, <a href="#K.3.5.3.1">K.3.5.3.1</a>
33988  FLT_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                      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>,
33989  FLT_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                     <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.21.8.2">7.21.8.2</a>
33990  FLT_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                  fputs function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.4">7.21.7.4</a>
33991  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>,               fputwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.29.3.3">7.29.3.3</a>,
33992       <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>                                           <a href="#7.29.3.8">7.29.3.8</a>
33993  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>                         fputws function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.4">7.29.3.4</a>
33994  FLT_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                 fread function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.8.1">7.21.8.1</a>
33995  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>                     free function, <a href="#7.22.3.3">7.22.3.3</a>, <a href="#7.22.3.5">7.22.3.5</a>
33996  fma type-generic macro, <a href="#7.25">7.25</a>                                  freestanding execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>,
33997  fmax functions, <a href="#7.12.12.2">7.12.12.2</a>, <a href="#F.10.9.2">F.10.9.2</a>                                 <a href="#5.1.2.1">5.1.2.1</a>
33998  fmax type-generic macro, <a href="#7.25">7.25</a>                                 freopen function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.4">7.21.5.4</a>
33999  fmin functions, <a href="#7.12.12.3">7.12.12.3</a>, <a href="#F.10.9.3">F.10.9.3</a>                           freopen_s function, <a href="#K.3.5.2.2">K.3.5.2.2</a>
34000  fmin type-generic macro, <a href="#7.25">7.25</a>                                 frexp functions, <a href="#7.12.6.4">7.12.6.4</a>, <a href="#F.10.3.4">F.10.3.4</a>
34001  fmod functions, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#F.10.7.1">F.10.7.1</a>                           frexp type-generic macro, <a href="#7.25">7.25</a>
34002  fmod type-generic macro, <a href="#7.25">7.25</a>                                 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>,
34003  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="#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>
34004  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>,                    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>,
34005       <a href="#K.3.5.1.1">K.3.5.1.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>
34006  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>,                       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>,
34007       <a href="#K.3.5.2.2">K.3.5.2.2</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.29.3.10">7.29.3.10</a>
34008  for statement, <a href="#6.8.5">6.8.5</a>, <a href="#6.8.5.3">6.8.5.3</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>,
34009  form-feed character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</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.29.3.10">7.29.3.10</a>
34010  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>,               ftell function, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a>
34011       <a href="#7.4.1.10">7.4.1.10</a>                                                 full declarator, <a href="#6.7.6">6.7.6</a>
34012  formal argument (deprecated), <a href="#3.16">3.16</a>                            full expression, <a href="#6.8">6.8</a>
34013  formal parameter, <a href="#3.16">3.16</a>                                        fully buffered stream, <a href="#7.21.3">7.21.3</a>
34014  format conversion of integer types header, <a href="#7.8">7.8</a>,               function
34015       <a href="#7.31.5">7.31.5</a>                                                      argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
34016  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>
34017       <a href="#K.3.5.3">K.3.5.3</a>                                                     call, <a href="#6.5.2.2">6.5.2.2</a>
34018     wide character, <a href="#7.29.2">7.29.2</a>, <a href="#K.3.9.1">K.3.9.1</a>                                  library, <a href="#7.1.4">7.1.4</a>
34019  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>
34020  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>
34021  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>
34022       also contracted expression                                  image, <a href="#5.2.3">5.2.3</a>
34023  FP_FAST_FMA macro, <a href="#7.12">7.12</a>                                          inline, <a href="#6.7.4">6.7.4</a>
34024  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>
34025  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>
34026  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>
34027  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>
34028  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>,
34029 <!--page 686 -->
34030           <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>           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
34031     prototype scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.7.6.2">6.7.6.2</a>                             header names, <a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>, <a href="#6.10.2">6.10.2</a>
34032     recursive call, <a href="#6.5.2.2">6.5.2.2</a>                                     hexadecimal constant, <a href="#6.4.4.1">6.4.4.1</a>
34033     return, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>                                        hexadecimal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
34034     scope, <a href="#6.2.1">6.2.1</a>                                                hexadecimal prefix, <a href="#6.4.4.1">6.4.4.1</a>
34035     type, <a href="#6.2.5">6.2.5</a>                                                 hexadecimal-character escape sequence
34036     type conversion, <a href="#6.3.2.1">6.3.2.1</a>                                         (\x hexadecimal digits), <a href="#6.4.4.4">6.4.4.4</a>
34037  function specifiers, <a href="#6.7.4">6.7.4</a>                                      high-order bit, <a href="#3.6">3.6</a>
34038  function type, <a href="#6.2.5">6.2.5</a>                                           horizontal-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
34039  function-call operator (( )), <a href="#6.5.2.2">6.5.2.2</a>                          horizontal-tab escape sequence (\r), <a href="#7.30.2.1.3">7.30.2.1.3</a>
34040  function-like macro, <a href="#6.10.3">6.10.3</a>                                    horizontal-tab escape sequence (\t), <a href="#5.2.2">5.2.2</a>,
34041  fundamental alignment, <a href="#6.2.8">6.2.8</a>                                        <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>
34042  future directions                                              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>
34043     language, <a href="#6.11">6.11</a>                                              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>,
34044     library, <a href="#7.31">7.31</a>                                                    <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.10">F.10</a>
34045  fwide function, <a href="#7.21.2">7.21.2</a>, <a href="#7.29.3.5">7.29.3.5</a>                               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>,
34046  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>,                         <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.10">F.10</a>
34047        <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.2.3">7.29.2.3</a>, <a href="#7.29.2.5">7.29.2.5</a>,                  HUGE_VALL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>,
34048        <a href="#7.29.2.11">7.29.2.11</a>, <a href="#K.3.9.1.1">K.3.9.1.1</a>                                          <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.10">F.10</a>
34049  fwprintf_s function, <a href="#K.3.9.1.1">K.3.9.1.1</a>                                 hyperbolic functions
34050  fwrite function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.8.2">7.21.8.2</a>                                complex, <a href="#7.3.6">7.3.6</a>, <a href="#G.6.2">G.6.2</a>
34051  fwscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.2">7.29.2.2</a>,                       real, <a href="#7.12.5">7.12.5</a>, <a href="#F.10.2">F.10.2</a>
34052        <a href="#7.29.2.4">7.29.2.4</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.12">7.29.2.12</a>, <a href="#7.29.3.10">7.29.3.10</a>,                hypot functions, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#F.10.4.3">F.10.4.3</a>
34053        <a href="#K.3.9.1.2">K.3.9.1.2</a>                                                hypot type-generic macro, <a href="#7.25">7.25</a>
34054  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>,
34055        <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>                                    <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>
34056                                                                 identifier, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.5.1">6.5.1</a>
34057  gamma functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.10.5">F.10.5</a>                                   linkage, see linkage
34058  general utilities, <a href="#K.3.6">K.3.6</a>                                          maximum length, <a href="#6.4.2.1">6.4.2.1</a>
34059    wide string, <a href="#7.29.4">7.29.4</a>, <a href="#K.3.9.2">K.3.9.2</a>                                    name spaces, <a href="#6.2.3">6.2.3</a>
34060  general utilities header, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</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>
34061  general wide string utilities, <a href="#7.29.4">7.29.4</a>, <a href="#K.3.9.2">K.3.9.2</a>                    scope, <a href="#6.2.1">6.2.1</a>
34062  generic association, <a href="#6.5.1.1">6.5.1.1</a>                                      type, <a href="#6.2.5">6.2.5</a>
34063  generic parameters, <a href="#7.25">7.25</a>                                       identifier list, <a href="#6.7.6">6.7.6</a>
34064  generic selection, <a href="#6.5.1">6.5.1</a>, <a href="#6.5.1.1">6.5.1.1</a>                              identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a>
34065  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>
34066  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>,
34067  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>,
34068  getenv_s function, <a href="#K.3.6.2.1">K.3.6.2.1</a>                                         <a href="#H.1">H.1</a>
34069  gets function, <a href="#K.3.5.4.1">K.3.5.4.1</a>                                       IEEE 754, <a href="#F.1">F.1</a>
34070  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>
34071  getwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.6">7.29.3.6</a>, <a href="#7.29.3.7">7.29.3.7</a>                     IEEE floating-point arithmetic standard, see
34072  getwchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.7">7.29.3.7</a>                                  IEC 60559, ANSI/IEEE 754,
34073  gmtime function, <a href="#7.27.3.3">7.27.3.3</a>                                            ANSI/IEEE 854
34074  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>,
34075  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>
34076  graphic characters, <a href="#5.2.1">5.2.1</a>                                      if statement, <a href="#6.8.4.1">6.8.4.1</a>
34077  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>
34078  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>
34079                                                                 ignore_handler_s function, <a href="#K.3.6.1.3">K.3.6.1.3</a>
34080  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>
34081 <!--page 687 -->
34082  ilogb type-generic macro, <a href="#7.25">7.25</a>                                         formatted, <a href="#7.29.2">7.29.2</a>, <a href="#K.3.9.1">K.3.9.1</a>
34083  imaginary macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a>                                      input/output header, <a href="#7.21">7.21</a>, <a href="#7.31.11">7.31.11</a>, <a href="#K.3.5">K.3.5</a>
34084  imaginary numbers, <a href="#G">G</a>                                             input/output, device, <a href="#5.1.2.3">5.1.2.3</a>
34085  imaginary type domain, <a href="#G.2">G.2</a>                                       int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.7.2">6.7.2</a>
34086  imaginary types, <a href="#G">G</a>                                               int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
34087  imaxabs function, <a href="#7.8.2.1">7.8.2.1</a>                                              <a href="#6.3.1.8">6.3.1.8</a>
34088  imaxdiv function, <a href="#7.8">7.8</a>, <a href="#7.8.2.2">7.8.2.2</a>                                   INT_FASTN_MAX macros, <a href="#7.20.2.3">7.20.2.3</a>
34089  imaxdiv_t type, <a href="#7.8">7.8</a>                                              INT_FASTN_MIN macros, <a href="#7.20.2.3">7.20.2.3</a>
34090  implementation, <a href="#3.12">3.12</a>                                             int_fastN_t types, <a href="#7.20.1.3">7.20.1.3</a>
34091  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>,                 INT_LEASTN_MAX macros, <a href="#7.20.2.2">7.20.2.2</a>
34092        <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                  INT_LEASTN_MIN macros, <a href="#7.20.2.2">7.20.2.2</a>
34093        limits                                                     int_leastN_t types, <a href="#7.20.1.2">7.20.1.2</a>
34094  implementation-defined behavior, <a href="#3.4.1">3.4.1</a>, <a href="#4">4</a>, <a href="#J.3">J.3</a>                    INT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
34095  implementation-defined value, <a href="#3.19.1">3.19.1</a>                              INT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>
34096  implicit conversion, <a href="#6.3">6.3</a>                                         integer arithmetic functions, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>,
34097  implicit initialization, <a href="#6.7.9">6.7.9</a>                                         <a href="#7.22.6">7.22.6</a>
34098  include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.2">6.10.2</a>                 integer character constant, <a href="#6.4.4.4">6.4.4.4</a>
34099  inclusive OR operators                                           integer constant, <a href="#6.4.4.1">6.4.4.1</a>
34100     bitwise (|), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>                                  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>,
34101     bitwise assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>                                   <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>,
34102  incomplete type, <a href="#6.2.5">6.2.5</a>                                                 <a href="#7.1.4">7.1.4</a>
34103  increment operators, see arithmetic operators,                   integer conversion rank, <a href="#6.3.1.1">6.3.1.1</a>
34104        increment and decrement                                    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>,
34105  indeterminate value, <a href="#3.19.2">3.19.2</a>                                            <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.3.3">6.5.3.3</a>, <a href="#6.5.7">6.5.7</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#7.20.2">7.20.2</a>, <a href="#7.20.3">7.20.3</a>,
34106  indeterminately sequenced, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>,                           <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>
34107        <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,              integer suffix, <a href="#6.4.4.1">6.4.4.1</a>
34108        unsequenced                                                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>,
34109  indirection operator (*), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>                             <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
34110  inequality operator (!=), <a href="#6.5.9">6.5.9</a>                                  integer types, <a href="#6.2.5">6.2.5</a>, <a href="#7.20">7.20</a>
34111  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>
34112  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>                             integer types header, <a href="#7.20">7.20</a>, <a href="#7.31.10">7.31.10</a>
34113  initial position, <a href="#5.2.2">5.2.2</a>                                          inter-thread happens before, <a href="#5.1.2.4">5.1.2.4</a>
34114  initial shift state, <a href="#5.2.1.2">5.2.1.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>
34115  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 linkage, <a href="#6.2.2">6.2.2</a>
34116        <a href="#F.8.5">F.8.5</a>                                                      internal name, <a href="#6.4.2.1">6.4.2.1</a>
34117     in blocks, <a href="#6.8">6.8</a>                                                interrupt, <a href="#5.2.3">5.2.3</a>
34118  initializer, <a href="#6.7.9">6.7.9</a>                                               INTMAX_C macro, <a href="#7.20.4.2">7.20.4.2</a>
34119     permitted form, <a href="#6.6">6.6</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>
34120     string literal, <a href="#6.3.2.1">6.3.2.1</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>
34121  inline, <a href="#6.7.4">6.7.4</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>,
34122  inner scope, <a href="#6.2.1">6.2.1</a>                                                     <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
34123  input failure, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.10">7.29.2.10</a>,                    INTN_C macros, <a href="#7.20.4.1">7.20.4.1</a>
34124        <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_MAX macros, <a href="#7.20.2.1">7.20.2.1</a>
34125        <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_MIN macros, <a href="#7.20.2.1">7.20.2.1</a>
34126        <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>              intN_t types, <a href="#7.20.1.1">7.20.1.1</a>
34127  input/output functions                                           INTPTR_MAX macro, <a href="#7.20.2.4">7.20.2.4</a>
34128     character, <a href="#7.21.7">7.21.7</a>, <a href="#K.3.5.4">K.3.5.4</a>                                    INTPTR_MIN macro, <a href="#7.20.2.4">7.20.2.4</a>
34129     direct, <a href="#7.21.8">7.21.8</a>                                                intptr_t type, <a href="#7.20.1.4">7.20.1.4</a>
34130     formatted, <a href="#7.21.6">7.21.6</a>, <a href="#K.3.5.3">K.3.5.3</a>                                    inttypes.h header, <a href="#7.8">7.8</a>, <a href="#7.31.5">7.31.5</a>
34131        wide character, <a href="#7.29.2">7.29.2</a>, <a href="#K.3.9.1">K.3.9.1</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>
34132     wide character, <a href="#7.29.3">7.29.3</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>
34133 <!--page 688 -->
34134  isblank function, <a href="#7.4.1.3">7.4.1.3</a>                                     iswpunct function, <a href="#7.30.2.1">7.30.2.1</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>,
34135  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>,                        <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.2.1.10">7.30.2.1.10</a>,
34136      <a href="#7.4.1.11">7.4.1.11</a>                                                        <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>
34137  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>,                  iswspace function, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>,
34138      <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>                                     <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.6">7.30.2.1.6</a>,
34139  isfinite macro, <a href="#7.12.3.2">7.12.3.2</a>, <a href="#F.3">F.3</a>                                       <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.2.1.10">7.30.2.1.10</a>,
34140  isgraph function, <a href="#7.4.1.6">7.4.1.6</a>                                           <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>
34141  isgreater macro, <a href="#7.12.14.1">7.12.14.1</a>, <a href="#F.3">F.3</a>                               iswupper function, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>,
34142  isgreaterequal macro, <a href="#7.12.14.2">7.12.14.2</a>, <a href="#F.3">F.3</a>                                <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.3.1.1">7.30.3.1.1</a>, <a href="#7.30.3.1.2">7.30.3.1.2</a>
34143  isinf macro, <a href="#7.12.3.3">7.12.3.3</a>                                         iswxdigit function, <a href="#7.30.2.1.12">7.30.2.1.12</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>
34144  isless macro, <a href="#7.12.14.3">7.12.14.3</a>, <a href="#F.3">F.3</a>                                  isxdigit function, <a href="#7.4.1.12">7.4.1.12</a>, <a href="#7.11.1.1">7.11.1.1</a>
34145  islessequal macro, <a href="#7.12.14.4">7.12.14.4</a>, <a href="#F.3">F.3</a>                             italic type convention, <a href="#3">3</a>, <a href="#6.1">6.1</a>
34146  islessgreater macro, <a href="#7.12.14.5">7.12.14.5</a>, <a href="#F.3">F.3</a>                           iteration statements, <a href="#6.8.5">6.8.5</a>
34147  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>,
34148      <a href="#7.4.2.2">7.4.2.2</a>                                                   jmp_buf type, <a href="#7.13">7.13</a>
34149  isnan macro, <a href="#7.12.3.4">7.12.3.4</a>, <a href="#F.3">F.3</a>                                    jump statements, <a href="#6.8.6">6.8.6</a>
34150  isnormal macro, <a href="#7.12.3.5">7.12.3.5</a>
34151  ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>                                               keywords, <a href="#6.4.1">6.4.1</a>, <a href="#G.2">G.2</a>, <a href="#J.5.9">J.5.9</a>, <a href="#J.5.10">J.5.10</a>
34152  ISO 4217, <a href="#2">2</a>, <a href="#7.11.2.1">7.11.2.1</a>                                         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>
34153  ISO 8601, <a href="#2">2</a>, <a href="#7.27.3.5">7.27.3.5</a>                                         known constant size, <a href="#6.2.5">6.2.5</a>
34154  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>
34155  ISO/IEC 10976-1, <a href="#H.1">H.1</a>                                          L_tmpnam macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.4">7.21.4.4</a>
34156  ISO/IEC 2382-1, <a href="#2">2</a>, <a href="#3">3</a>                                          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>
34157  ISO/IEC 646, <a href="#2">2</a>, <a href="#5.2.1.1">5.2.1.1</a>                                       label name, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.3">6.2.3</a>
34158  ISO/IEC 9945-2, <a href="#7.11">7.11</a>                                          labeled statement, <a href="#6.8.1">6.8.1</a>
34159  iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a>                                       labs function, <a href="#7.22.6.1">7.22.6.1</a>
34160  isprint function, <a href="#5.2.2">5.2.2</a>, <a href="#7.4.1.8">7.4.1.8</a>                              language, <a href="#6">6</a>
34161  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>,                     future directions, <a href="#6.11">6.11</a>
34162      <a href="#7.4.1.11">7.4.1.11</a>                                                     syntax summary, <a href="#A">A</a>
34163  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>,                  Latin alphabet, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
34164      <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>
34165      <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.2.2">7.29.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.24.4.3">7.24.4.3</a>,
34166  isunordered macro, <a href="#7.12.14.6">7.12.14.6</a>, <a href="#F.3">F.3</a>                                   <a href="#7.29.4.4.2">7.29.4.4.2</a>
34167  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>,
34168      <a href="#7.4.2.2">7.4.2.2</a>                                                         <a href="#7.22.8">7.22.8</a>, <a href="#7.29.6">7.29.6</a>, <a href="#7.30.1">7.30.1</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>,
34169  iswalnum function, <a href="#7.30.2.1.1">7.30.2.1.1</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>,                          <a href="#7.30.3.2.1">7.30.3.2.1</a>, <a href="#7.30.3.2.2">7.30.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>
34170      <a href="#7.30.2.1.10">7.30.2.1.10</a>, <a href="#7.30.2.2.1">7.30.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>
34171  iswalpha function, <a href="#7.30.2.1.1">7.30.2.1.1</a>, <a href="#7.30.2.1.2">7.30.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>
34172      <a href="#7.30.2.2.1">7.30.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.27.3.5">7.27.3.5</a>
34173  iswblank function, <a href="#7.30.2.1.3">7.30.2.1.3</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>                     lconv structure type, <a href="#7.11">7.11</a>
34174  iswcntrl function, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.4">7.30.2.1.4</a>,                    LDBL_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34175      <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>                       LDBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34176  iswctype function, <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>                     LDBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34177  iswdigit function, <a href="#7.30.2.1.1">7.30.2.1.1</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>,                    LDBL_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34178      <a href="#7.30.2.1.5">7.30.2.1.5</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>           LDBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34179  iswgraph function, <a href="#7.30.2.1">7.30.2.1</a>, <a href="#7.30.2.1.6">7.30.2.1.6</a>,                      LDBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34180      <a href="#7.30.2.1.10">7.30.2.1.10</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>                                   LDBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34181  iswlower function, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>,                    LDBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34182      <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.3.1.1">7.30.3.1.1</a>, <a href="#7.30.3.1.2">7.30.3.1.2</a>                        LDBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34183  iswprint function, <a href="#7.30.2.1.6">7.30.2.1.6</a>, <a href="#7.30.2.1.8">7.30.2.1.8</a>,                    LDBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34184      <a href="#7.30.2.2.1">7.30.2.2.1</a>                                                LDBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
34185 <!--page 689 -->
34186  LDBL_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>                             llround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.7">F.10.6.7</a>
34187  ldexp functions, <a href="#7.12.6.6">7.12.6.6</a>, <a href="#F.10.3.6">F.10.3.6</a>                        llround type-generic macro, <a href="#7.25">7.25</a>
34188  ldexp type-generic macro, <a href="#7.25">7.25</a>                             local time, <a href="#7.27.1">7.27.1</a>
34189  ldiv function, <a href="#7.22.6.2">7.22.6.2</a>                                    locale, <a href="#3.4.2">3.4.2</a>
34190  ldiv_t type, <a href="#7.22">7.22</a>                                          locale-specific behavior, <a href="#3.4.2">3.4.2</a>, <a href="#J.4">J.4</a>
34191  leading underscore in identifiers, <a href="#7.1.3">7.1.3</a>                    locale.h header, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
34192  left-shift assignment operator (&lt;&lt;=), <a href="#6.5.16.2">6.5.16.2</a>             localeconv function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
34193  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>                   localization header, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
34194  length                                                     localtime function, <a href="#7.27.3.4">7.27.3.4</a>
34195     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>                 localtime_s function, <a href="#K.3.8.2.4">K.3.8.2.4</a>
34196     function name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a>                 log functions, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#F.10.3.7">F.10.3.7</a>
34197     identifier, <a href="#6.4.2.1">6.4.2.1</a>                                      log type-generic macro, <a href="#7.25">7.25</a>
34198     internal name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>                         log10 functions, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#F.10.3.8">F.10.3.8</a>
34199  length function, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.24.6.3">7.24.6.3</a>, <a href="#7.29.4.6.1">7.29.4.6.1</a>,           log10 type-generic macro, <a href="#7.25">7.25</a>
34200        <a href="#7.29.6.3.1">7.29.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>                   log1p functions, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#F.10.3.9">F.10.3.9</a>
34201  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.29.2.1">7.29.2.1</a>,              log1p type-generic macro, <a href="#7.25">7.25</a>
34202        <a href="#7.29.2.2">7.29.2.2</a>                                             log2 functions, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#F.10.3.10">F.10.3.10</a>
34203  less-than operator (&lt;), <a href="#6.5.8">6.5.8</a>                              log2 type-generic macro, <a href="#7.25">7.25</a>
34204  less-than-or-equal-to operator (&lt;=), <a href="#6.5.8">6.5.8</a>                 logarithmic functions
34205  letter, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>                                           complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
34206  lexical elements, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>                               real, <a href="#7.12.6">7.12.6</a>, <a href="#F.10.3">F.10.3</a>
34207  lgamma functions, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#F.10.5.3">F.10.5.3</a>                       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>
34208  lgamma type-generic macro, <a href="#7.25">7.25</a>                            logb type-generic macro, <a href="#7.25">7.25</a>
34209  library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7">7</a>, <a href="#K.3">K.3</a>                                   logical operators
34210     future directions, <a href="#7.31">7.31</a>                                    AND (&amp;&amp;), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a>
34211     summary, <a href="#B">B</a>                                                 negation (!), <a href="#6.5.3.3">6.5.3.3</a>
34212     terms, <a href="#7.1.1">7.1.1</a>                                               OR (||), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a>
34213     use of functions, <a href="#7.1.4">7.1.4</a>                                 logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
34214  lifetime, <a href="#6.2.4">6.2.4</a>                                            long double _Complex type, <a href="#6.2.5">6.2.5</a>
34215  limits                                                     long double _Complex type conversion,
34216     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>
34217     implementation, see implementation limits               long double _Imaginary type, <a href="#G.2">G.2</a>
34218     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>
34219     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>,
34220  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.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.2">F.2</a>
34221  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>,
34222  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>
34223  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>,
34224  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.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
34225     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>,
34226  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>
34227        <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>
34228  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>,
34229  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.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
34230  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>,
34231  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>
34232        <a href="#7.29.4.1.2">7.29.4.1.2</a>                                           long long integer suffix, ll or LL, <a href="#6.4.4.1">6.4.4.1</a>
34233  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.29.4.1.2">7.29.4.1.2</a>
34234        <a href="#7.29.4.1.2">7.29.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.29.4.1.2">7.29.4.1.2</a>
34235  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>,
34236  llrint type-generic macro, <a href="#7.25">7.25</a>                                 <a href="#7.22.4.7">7.22.4.7</a>
34237 <!--page 690 -->
34238  loop body, <a href="#6.8.5">6.8.5</a>                                                    <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.6.3.1">7.29.6.3.1</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>,
34239  low-order bit, <a href="#3.6">3.6</a>                                                  <a href="#7.29.6.4.1">7.29.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>
34240  lowercase letter, <a href="#5.2.1">5.2.1</a>                                        mbsinit function, <a href="#7.29.6.2.1">7.29.6.2.1</a>
34241  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>                       mbsrtowcs function, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
34242  lrint type-generic macro, <a href="#7.25">7.25</a>                                 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>
34243  lround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.7">F.10.6.7</a>                           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>,
34244  lround type-generic macro, <a href="#7.25">7.25</a>                                     <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28">7.28</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>,
34245  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>,                   <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.6">7.29.6</a>, <a href="#7.29.6.2.1">7.29.6.2.1</a>, <a href="#7.29.6.3">7.29.6.3</a>,
34246       <a href="#6.7.2.4">6.7.2.4</a>                                                        <a href="#7.29.6.3.1">7.29.6.3.1</a>, <a href="#7.29.6.4">7.29.6.4</a>
34247  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>,                  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.29.6.4">7.29.6.4</a>
34248       <a href="#6.5.16.2">6.5.16.2</a>                                                  mbstowcs_s function, <a href="#K.3.6.5.1">K.3.6.5.1</a>
34249                                                                 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>,
34250  macro argument substitution, <a href="#6.10.3.1">6.10.3.1</a>                               <a href="#7.22.8.1">7.22.8.1</a>, <a href="#7.29.6.3">7.29.6.3</a>
34251  macro definition                                                member access operators (. and -&gt;), <a href="#6.5.2.3">6.5.2.3</a>
34252    library function, <a href="#7.1.4">7.1.4</a>                                      member alignment, <a href="#6.7.2.1">6.7.2.1</a>
34253  macro invocation, <a href="#6.10.3">6.10.3</a>                                       memchr function, <a href="#7.24.5.1">7.24.5.1</a>
34254  macro name, <a href="#6.10.3">6.10.3</a>                                             memcmp function, <a href="#7.24.4">7.24.4</a>, <a href="#7.24.4.1">7.24.4.1</a>
34255    length, <a href="#5.2.4.1">5.2.4.1</a>                                              memcpy function, <a href="#7.24.2.1">7.24.2.1</a>
34256    predefined, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>                                    memcpy_s function, <a href="#K.3.7.1.1">K.3.7.1.1</a>
34257    redefinition, <a href="#6.10.3">6.10.3</a>                                          memmove function, <a href="#7.24.2.2">7.24.2.2</a>
34258    scope, <a href="#6.10.3.5">6.10.3.5</a>                                              memmove_s function, <a href="#K.3.7.1.2">K.3.7.1.2</a>
34259  macro parameter, <a href="#6.10.3">6.10.3</a>                                        memory location, <a href="#3.14">3.14</a>
34260  macro preprocessor, <a href="#6.10">6.10</a>                                       memory management functions, <a href="#7.22.3">7.22.3</a>
34261  macro replacement, <a href="#6.10.3">6.10.3</a>                                      memory_order type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.3">7.17.3</a>
34262  magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a>                                    memset function, <a href="#7.24.6.1">7.24.6.1</a>, <a href="#K.3.7.4.1">K.3.7.4.1</a>
34263  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>,           memset_s function, <a href="#K.3.7.4.1">K.3.7.4.1</a>
34264       <a href="#7.21.3">7.21.3</a>                                                    minimum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a>
34265  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>                    minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
34266  manipulation functions                                         miscellaneous functions
34267    complex, <a href="#7.3.9">7.3.9</a>                                                 string, <a href="#7.24.6">7.24.6</a>, <a href="#K.3.7.4">K.3.7.4</a>
34268    real, <a href="#7.12.11">7.12.11</a>, <a href="#F.10.8">F.10.8</a>                                          wide string, <a href="#7.29.4.6">7.29.4.6</a>, <a href="#K.3.9.2.4">K.3.9.2.4</a>
34269  matching failure, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.10">7.29.2.10</a>,               mktime function, <a href="#7.27.2.3">7.27.2.3</a>
34270       <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>                         modf functions, <a href="#7.12.6.12">7.12.6.12</a>, <a href="#F.10.3.12">F.10.3.12</a>
34271  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.25">7.25</a>, <a href="#F">F</a>,                  modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
34272       <a href="#F.10">F.10</a>, <a href="#J.5.17">J.5.17</a>                                              modification order, <a href="#5.1.2.4">5.1.2.4</a>
34273  MATH_ERREXCEPT macro, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a>                               modulus functions, <a href="#7.12.6.12">7.12.6.12</a>
34274  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>                      modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
34275  MATH_ERRNO macro, <a href="#7.12">7.12</a>                                         mtx_destroy function, <a href="#7.26.4.1">7.26.4.1</a>
34276  mathematics header, <a href="#7.12">7.12</a>                                       mtx_init function, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.4.2">7.26.4.2</a>
34277  max_align_t type, <a href="#7.19">7.19</a>                                         mtx_lock function, <a href="#7.26.4.3">7.26.4.3</a>
34278  maximal munch, <a href="#6.4">6.4</a>                                             mtx_t type, <a href="#7.26.1">7.26.1</a>
34279  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.26.4.4">7.26.4.4</a>
34280  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.26.4.5">7.26.4.5</a>
34281       <a href="#7.22.7.3">7.22.7.3</a>, <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>,                 mtx_unlock function, <a href="#7.26.4.3">7.26.4.3</a>, <a href="#7.26.4.4">7.26.4.4</a>,
34282       <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.26.4.5">7.26.4.5</a>, <a href="#7.26.4.6">7.26.4.6</a>
34283  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>
34284  mblen function, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.29.6.3">7.29.6.3</a>                             multibyte conversion functions
34285  mbrlen function, <a href="#7.29.6.3.1">7.29.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>
34286  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.28.1.1">7.28.1.1</a>                         extended, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
34287  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.28.1.3">7.28.1.3</a>                         restartable, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>
34288  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>
34289 <!--page 691 -->
34290       restartable, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>                           not macro, <a href="#7.9">7.9</a>
34291  multibyte string, <a href="#7.1.1">7.1.1</a>                                         not-equal-to operator, see inequality operator
34292  multibyte/wide character conversion functions,                  not_eq macro, <a href="#7.9">7.9</a>
34293       <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a>                                            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>
34294   extended, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a>                                        padding of binary stream, <a href="#7.21.2">7.21.2</a>
34295   restartable, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>                       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.24.1">7.24.1</a>,
34296  multibyte/wide string conversion functions,                          <a href="#7.27.1">7.27.1</a>, <a href="#7.29.1">7.29.1</a>
34297       <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>                                            null pointer, <a href="#6.3.2.3">6.3.2.3</a>
34298   restartable, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>                               null pointer constant, <a href="#6.3.2.3">6.3.2.3</a>
34299  multidimensional array, <a href="#6.5.2.1">6.5.2.1</a>                                 null preprocessing directive, <a href="#6.10.7">6.10.7</a>
34300  multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>               null statement, <a href="#6.8.3">6.8.3</a>
34301  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>,               null wide character, <a href="#7.1.1">7.1.1</a>
34302       <a href="#G.5.1">G.5.1</a>                                                      number classification macros, <a href="#7.12">7.12</a>, <a href="#7.12.3.1">7.12.3.1</a>
34303  multiplicative expressions, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>                        numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a>
34304                                                                    wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1">7.29.4.1</a>
34305  n-char sequence, <a href="#7.22.1.3">7.22.1.3</a>                                       numerical limits, <a href="#5.2.4.2">5.2.4.2</a>
34306  n-wchar sequence, <a href="#7.29.4.1.1">7.29.4.1.1</a>
34307  name                                                            object, <a href="#3.15">3.15</a>
34308    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>                            object representation, <a href="#6.2.6.1">6.2.6.1</a>
34309    file, <a href="#7.21.3">7.21.3</a>                                                   object type, <a href="#6.2.5">6.2.5</a>
34310    internal, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>                                    object-like macro, <a href="#6.10.3">6.10.3</a>
34311    label, <a href="#6.2.3">6.2.3</a>                                                  observable behavior, <a href="#5.1.2.3">5.1.2.3</a>
34312    structure/union member, <a href="#6.2.3">6.2.3</a>                                 obsolescence, <a href="#6.11">6.11</a>, <a href="#7.31">7.31</a>
34313  name spaces, <a href="#6.2.3">6.2.3</a>                                              octal constant, <a href="#6.4.4.1">6.4.4.1</a>
34314  named label, <a href="#6.8.1">6.8.1</a>                                              octal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
34315  NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                                  octal-character escape sequence (\octal digits),
34316  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>                            <a href="#6.4.4.4">6.4.4.4</a>
34317  NAN macro, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a>                                          offsetof macro, <a href="#7.19">7.19</a>
34318  NDEBUG macro, <a href="#7.2">7.2</a>                                               on-off switch, <a href="#6.10.6">6.10.6</a>
34319  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>,                   once_flag type, <a href="#7.26.1">7.26.1</a>
34320       <a href="#F.10.6.3">F.10.6.3</a>                                                   ONCE_FLAG_INIT macro, <a href="#7.26.1">7.26.1</a>
34321  nearbyint type-generic macro, <a href="#7.25">7.25</a>                              ones' complement, <a href="#6.2.6.2">6.2.6.2</a>
34322  nearest integer functions, <a href="#7.12.9">7.12.9</a>, <a href="#F.10.6">F.10.6</a>                       operand, <a href="#6.4.6">6.4.6</a>, <a href="#6.5">6.5</a>
34323  negation operator (!), <a href="#6.5.3.3">6.5.3.3</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>
34324  negative zero, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.12.11.1">7.12.11.1</a>                               operations on files, <a href="#7.21.4">7.21.4</a>, <a href="#K.3.5.1">K.3.5.1</a>
34325  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>           operator, <a href="#6.4.6">6.4.6</a>
34326  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>,                  operators, <a href="#6.5">6.5</a>
34327       <a href="#7.4.1.10">7.4.1.10</a>                                                     _Alignof, <a href="#6.5.3.4">6.5.3.4</a>
34328  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>,                   additive, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>
34329       <a href="#F.10.8.3">F.10.8.3</a>                                                     assignment, <a href="#6.5.16">6.5.16</a>
34330  nextafter type-generic macro, <a href="#7.25">7.25</a>                                associativity, <a href="#6.5">6.5</a>
34331  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>                    equality, <a href="#6.5.9">6.5.9</a>
34332  nexttoward type-generic macro, <a href="#7.25">7.25</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>
34333  no linkage, <a href="#6.2.2">6.2.2</a>                                                 postfix, <a href="#6.5.2">6.5.2</a>
34334  no-return function, <a href="#6.7.4">6.7.4</a>                                         precedence, <a href="#6.5">6.5</a>
34335  non-stop floating-point control mode, <a href="#7.6.4.2">7.6.4.2</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>
34336  nongraphic characters, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>                             relational, <a href="#6.5.8">6.5.8</a>
34337  nonlocal jumps header, <a href="#7.13">7.13</a>                                       shift, <a href="#6.5.7">6.5.7</a>
34338  noreturn macro, <a href="#7.23">7.23</a>                                              sizeof, <a href="#6.5.3.4">6.5.3.4</a>
34339  norm, complex, <a href="#7.3.8.1">7.3.8.1</a>                                            unary, <a href="#6.5.3">6.5.3</a>
34340  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>
34341 <!--page 692 -->
34342  optional features, see conditional features                     portability, <a href="#4">4</a>, <a href="#J">J</a>
34343  or macro, <a href="#7.9">7.9</a>                                                   position indicator, file, see file position indicator
34344  OR operators                                                    positive difference, <a href="#7.12.12.1">7.12.12.1</a>
34345     bitwise exclusive (^), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>                       positive difference functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a>
34346     bitwise exclusive assignment (^=), <a href="#6.5.16.2">6.5.16.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>
34347     bitwise inclusive (|), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>                       postfix expressions, <a href="#6.5.2">6.5.2</a>
34348     bitwise inclusive assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>                  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>
34349     logical (||), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a>                                pow functions, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#F.10.4.4">F.10.4.4</a>
34350  or_eq macro, <a href="#7.9">7.9</a>                                                pow type-generic macro, <a href="#7.25">7.25</a>
34351  order of allocated storage, <a href="#7.22.3">7.22.3</a>                              power functions
34352  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>,              complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a>
34353        see also sequence points                                     real, <a href="#7.12.7">7.12.7</a>, <a href="#F.10.4">F.10.4</a>
34354  ordinary identifier name space, <a href="#6.2.3">6.2.3</a>                            pp-number, <a href="#6.4.8">6.4.8</a>
34355  orientation of stream, <a href="#7.21.2">7.21.2</a>, <a href="#7.29.3.5">7.29.3.5</a>                         pragma operator, <a href="#6.10.9">6.10.9</a>
34356  out-of-bounds store, <a href="#L.2.1">L.2.1</a>                                      pragma preprocessing directive, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a>
34357  outer scope, <a href="#6.2.1">6.2.1</a>                                              precedence of operators, <a href="#6.5">6.5</a>
34358  over-aligned, <a href="#6.2.8">6.2.8</a>                                             precedence of syntax rules, <a href="#5.1.1.2">5.1.1.2</a>
34359                                                                  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.29.2.1">7.29.2.1</a>
34360  padding                                                            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>
34361    binary stream, <a href="#7.21.2">7.21.2</a>                                         predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
34362    bits, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.20.1.1">7.20.1.1</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>
34363    structure/union, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.7.2.1">6.7.2.1</a>                             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>
34364  parameter, <a href="#3.16">3.16</a>                                                 preprocessing concatenation, <a href="#6.10.3.3">6.10.3.3</a>
34365     array, <a href="#6.9.1">6.9.1</a>                                                 preprocessing directives, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10">6.10</a>
34366     ellipsis, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a>                                    preprocessing file, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.10">6.10</a>
34367     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>                                preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
34368     macro, <a href="#6.10.3">6.10.3</a>                                                preprocessing operators
34369     main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>                                        #, <a href="#6.10.3.2">6.10.3.2</a>
34370     program, <a href="#5.1.2.2.1">5.1.2.2.1</a>                                              ##, <a href="#6.10.3.3">6.10.3.3</a>
34371  parameter type list, <a href="#6.7.6.3">6.7.6.3</a>                                       _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a>
34372  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>                defined, <a href="#6.10.1">6.10.1</a>
34373  parenthesized expression, <a href="#6.5.1">6.5.1</a>                                 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>
34374  parse state, <a href="#7.21.2">7.21.2</a>                                             preprocessing translation unit, <a href="#5.1.1.1">5.1.1.1</a>
34375  perform a trap, <a href="#3.19.5">3.19.5</a>                                          preprocessor, <a href="#6.10">6.10</a>
34376  permitted form of initializer, <a href="#6.6">6.6</a>                              PRIcFASTN macros, <a href="#7.8.1">7.8.1</a>
34377  perror function, <a href="#7.21.10.4">7.21.10.4</a>                                      PRIcLEASTN macros, <a href="#7.8.1">7.8.1</a>
34378  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>
34379  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>
34380  placemarker, <a href="#6.10.3.3">6.10.3.3</a>                                           PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
34381  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>
34382  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>,
34383  pointer comparison, <a href="#6.5.8">6.5.8</a>                                             <a href="#K.3.5.3.3">K.3.5.3.3</a>
34384  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>
34385  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>
34386  pointer to function, <a href="#6.5.2.2">6.5.2.2</a>                                    printing wide character, <a href="#7.30.2">7.30.2</a>
34387  pointer type, <a href="#6.2.5">6.2.5</a>                                             program diagnostics, <a href="#7.2.1">7.2.1</a>
34388  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>
34389  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>
34390  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>
34391        <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>
34392        <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>
34393 <!--page 693 -->
34394  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>                   recursion, <a href="#6.5.2.2">6.5.2.2</a>
34395  program structure, <a href="#5.1.1.1">5.1.1.1</a>                                   recursive function call, <a href="#6.5.2.2">6.5.2.2</a>
34396  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>,              redefinition of macro, <a href="#6.10.3">6.10.3</a>
34397       <a href="#5.1.2.3">5.1.2.3</a>                                                 reentrancy, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>
34398  program, conforming, <a href="#4">4</a>                                          library functions, <a href="#7.1.4">7.1.4</a>
34399  program, strictly conforming, <a href="#4">4</a>                              referenced type, <a href="#6.2.5">6.2.5</a>
34400  promotions                                                   register storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
34401    default argument, <a href="#6.5.2.2">6.5.2.2</a>                                  relational expressions, <a href="#6.5.8">6.5.8</a>
34402    integer, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.3.1.1">6.3.1.1</a>                                  relaxed atomic operations, <a href="#5.1.2.4">5.1.2.4</a>
34403  prototype, see function prototype                            release fence, <a href="#7.17.4">7.17.4</a>
34404  pseudo-random sequence functions, <a href="#7.22.2">7.22.2</a>                     release operation, <a href="#5.1.2.4">5.1.2.4</a>
34405  PTRDIFF_MAX macro, <a href="#7.20.3">7.20.3</a>                                    release sequence, <a href="#5.1.2.4">5.1.2.4</a>
34406  PTRDIFF_MIN macro, <a href="#7.20.3">7.20.3</a>                                    reliability of data, interrupted, <a href="#5.1.2.3">5.1.2.3</a>
34407  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>,              remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a>
34408       <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>                            remainder functions, <a href="#7.12.10">7.12.10</a>, <a href="#F.10.7">F.10.7</a>
34409  punctuators, <a href="#6.4.6">6.4.6</a>                                           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>,
34410  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>                          <a href="#F.10.7.2">F.10.7.2</a>
34411  putchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.8">7.21.7.8</a>                           remainder operator (%), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>
34412  puts function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.9">7.21.7.9</a>                              remainder type-generic macro, <a href="#7.25">7.25</a>
34413  putwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.8">7.29.3.8</a>, <a href="#7.29.3.9">7.29.3.9</a>                   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>
34414  putwchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.9">7.29.3.9</a>                          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>
34415                                                               remquo type-generic macro, <a href="#7.25">7.25</a>
34416  qsort function, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.2">7.22.5.2</a>                             rename function, <a href="#7.21.4.2">7.21.4.2</a>
34417  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>                         representations of types, <a href="#6.2.6">6.2.6</a>
34418  qualified types, <a href="#6.2.5">6.2.5</a>                                           pointer, <a href="#6.2.5">6.2.5</a>
34419  qualified version of type, <a href="#6.2.5">6.2.5</a>                              rescanning and replacement, <a href="#6.10.3.4">6.10.3.4</a>
34420  question-mark escape sequence (\?), <a href="#6.4.4.4">6.4.4.4</a>                  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>
34421  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>,                     restartable multibyte/wide character conversion
34422       <a href="#7.22.4.7">7.22.4.7</a>                                                      functions, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>
34423  quiet NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>                                         restartable multibyte/wide string conversion
34424                                                                     functions, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
34425  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>           restore calling environment function, <a href="#7.13.2">7.13.2</a>
34426  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>                      restrict type qualifier, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a>
34427  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>
34428  range                                                        return statement, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
34429     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>,
34430  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.29.3.10">7.29.3.10</a>
34431        <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>
34432        <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>
34433        <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>
34434        <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.25">7.25</a>
34435  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>
34436  read-modify-write operations, <a href="#5.1.2.4">5.1.2.4</a>                        round type-generic macro, <a href="#7.25">7.25</a>
34437  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>
34438        <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>,
34439  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>,
34440  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>,
34441  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>,
34442  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>,
34443  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>,
34444  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>,
34445 <!--page 694 -->
34446       <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>,                 <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>
34447       <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>,                    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>
34448       <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>,                    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>
34449       <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>                                  setjmp.h header, <a href="#7.13">7.13</a>
34450  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>,                  setlocale function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
34451       <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>                     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>,
34452  runtime-constraint, <a href="#3.18">3.18</a>                                             <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a>
34453  Runtime-constraint handling functions, <a href="#K.3.6.1">K.3.6.1</a>                 shall, <a href="#4">4</a>
34454  rvalue, <a href="#6.3.2.1">6.3.2.1</a>                                                shift expressions, <a href="#6.5.7">6.5.7</a>
34455                                                                 shift sequence, <a href="#7.1.1">7.1.1</a>
34456  same scope, <a href="#6.2.1">6.2.1</a>                                              shift states, <a href="#5.2.1.2">5.2.1.2</a>
34457  save calling environment function, <a href="#7.13.1">7.13.1</a>                      short identifier, character, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.3">6.4.3</a>
34458  scalar types, <a href="#6.2.5">6.2.5</a>                                            short int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.21.6.1">7.21.6.1</a>,
34459  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>                          <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
34460  scalbln type-generic macro, <a href="#7.25">7.25</a>                               short int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
34461  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>                           <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
34462  scalbn type-generic macro, <a href="#7.25">7.25</a>                                SHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
34463  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>                    SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
34464  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>                        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>,
34465  scanlist, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>                                         <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>,
34466  scanset, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>                                          <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.29.3.6">7.29.3.6</a>, <a href="#7.29.3.8">7.29.3.8</a>, <a href="#F.8.1">F.8.1</a>, <a href="#F.9.1">F.9.1</a>,
34467  SCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>                                           <a href="#F.9.3">F.9.3</a>
34468  SCHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>                                     SIG_ATOMIC_MAX macro, <a href="#7.20.3">7.20.3</a>
34469  SCNcFASTN macros, <a href="#7.8.1">7.8.1</a>                                        SIG_ATOMIC_MIN macro, <a href="#7.20.3">7.20.3</a>
34470  SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>                                       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>,
34471  SCNcMAX macros, <a href="#7.8.1">7.8.1</a>                                                <a href="#7.20.3">7.20.3</a>
34472  SCNcN macros, <a href="#7.8.1">7.8.1</a>                                            SIG_DFL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
34473  SCNcPTR macros, <a href="#7.8.1">7.8.1</a>                                          SIG_ERR macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
34474  scope of identifier, <a href="#6.2.1">6.2.1</a>, <a href="#6.9.2">6.9.2</a>                               SIG_IGN macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
34475  search functions                                               SIGABRT macro, <a href="#7.14">7.14</a>, <a href="#7.22.4.1">7.22.4.1</a>
34476     string, <a href="#7.24.5">7.24.5</a>, <a href="#K.3.7.3">K.3.7.3</a>                                     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.2">J.2</a>, <a href="#J.5.17">J.5.17</a>
34477     utility, <a href="#7.22.5">7.22.5</a>, <a href="#K.3.6.3">K.3.6.3</a>                                    SIGILL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.2">J.2</a>
34478     wide string, <a href="#7.29.4.5">7.29.4.5</a>, <a href="#K.3.9.2.3">K.3.9.2.3</a>                            SIGINT macro, <a href="#7.14">7.14</a>
34479  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>
34480  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>
34481  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>
34482  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>
34483  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>
34484  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 handling header, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
34485        <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>                                             signal.h header, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
34486  separate compilation, <a href="#5.1.1.1">5.1.1.1</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>
34487  separate translation, <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>
34488  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>,             signbit macro, <a href="#7.12.3.6">7.12.3.6</a>, <a href="#F.3">F.3</a>
34489        <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>,              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>,
34490        <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.29.2">7.29.2</a>, <a href="#C">C</a>, <a href="#K.3.6.3">K.3.6.3</a>                      <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.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>
34491  sequenced after, see sequenced before                          signed character, <a href="#6.3.1.1">6.3.1.1</a>
34492  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 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>
34493        <a href="#6.5.16">6.5.16</a>, see also indeterminately sequenced,              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>,
34494        unsequenced                                                    <a href="#6.3.1.8">6.3.1.8</a>
34495  sequencing of statements, <a href="#6.8">6.8</a>                                  signed types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>
34496  set_constraint_handler_s function,                             significand part, <a href="#6.4.4.2">6.4.4.2</a>
34497 <!--page 695 -->
34498  SIGSEGV macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.2">J.2</a>                                <a href="#7.8">&lt;inttypes.h&gt;</a>, <a href="#7.8">7.8</a>, <a href="#7.31.5">7.31.5</a>
34499  SIGTERM macro, <a href="#7.14">7.14</a>                                               <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#4">4</a>, <a href="#7.9">7.9</a>
34500  simple assignment operator (=), <a href="#6.5.16.1">6.5.16.1</a>                          <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
34501  sin functions, <a href="#7.12.4.6">7.12.4.6</a>, <a href="#F.10.1.6">F.10.1.6</a>                                 <a href="#7.11">&lt;locale.h&gt;</a>, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
34502  sin type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                 <a href="#7.12">&lt;math.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.25">7.25</a>, <a href="#F">F</a>, <a href="#F.10">F.10</a>,
34503  single-byte character, <a href="#3.7.1">3.7.1</a>, <a href="#5.2.1.2">5.2.1.2</a>                                   <a href="#J.5.17">J.5.17</a>
34504  single-byte/wide character conversion functions,                  <a href="#7.13">&lt;setjmp.h&gt;</a>, <a href="#7.13">7.13</a>
34505       <a href="#7.29.6.1">7.29.6.1</a>                                                     <a href="#7.14">&lt;signal.h&gt;</a>, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
34506  single-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a>                              <a href="#7.15">&lt;stdalign.h&gt;</a>, <a href="#4">4</a>, <a href="#7.15">7.15</a>
34507  single-quote escape sequence (\'), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>                 <a href="#7.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>
34508  singularity, <a href="#7.12.1">7.12.1</a>                                               <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>,
34509  sinh functions, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#F.10.2.5">F.10.2.5</a>                                      <a href="#7.31.8">7.31.8</a>
34510  sinh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                <a href="#7.18">&lt;stdbool.h&gt;</a>, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>, <a href="#H">H</a>
34511  SIZE_MAX macro, <a href="#7.20.3">7.20.3</a>                                            <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>,
34512  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>,                      <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>
34513       <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.24.1">7.24.1</a>, <a href="#7.27.1">7.27.1</a>, <a href="#7.28">7.28</a>,              <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>,
34514       <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>,                          <a href="#7.31.10">7.31.10</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>
34515       <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>                 <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.31.11">7.31.11</a>, <a href="#F">F</a>, <a href="#K.3.5">K.3.5</a>
34516  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>                          <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.31.12">7.31.12</a>, <a href="#F">F</a>,
34517  sizes of integer types header, <a href="#7.10">7.10</a>                                     <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a>
34518  snprintf function, <a href="#7.21.6.5">7.21.6.5</a>, <a href="#7.21.6.12">7.21.6.12</a>,                           <a href="#7.23">&lt;stdnoreturn.h&gt;</a>, <a href="#4">4</a>, <a href="#7.23">7.23</a>
34519       <a href="#K.3.5.3.5">K.3.5.3.5</a>                                                    <a href="#7.24">&lt;string.h&gt;</a>, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>
34520  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>                         <a href="#7.25">&lt;tgmath.h&gt;</a>, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
34521  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>                        <a href="#7.26">&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.26">7.26</a>, <a href="#7.31.15">7.31.15</a>
34522  sorting utility functions, <a href="#7.22.5">7.22.5</a>, <a href="#K.3.6.3">K.3.6.3</a>                        <a href="#7.27">&lt;time.h&gt;</a>, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>
34523  source character set, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>                              <a href="#7.28">&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.28">7.28</a>
34524  source file, <a href="#5.1.1.1">5.1.1.1</a>                                               <a href="#7.29">&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.29">7.29</a>, <a href="#7.31.16">7.31.16</a>,
34525     name, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8.1">6.10.8.1</a>                                               <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a>
34526  source file inclusion, <a href="#6.10.2">6.10.2</a>                                      <a href="#7.30">&lt;wctype.h&gt;</a>, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>
34527  source lines, <a href="#5.1.1.2">5.1.1.2</a>                                          standard input stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>
34528  source text, <a href="#5.1.1.2">5.1.1.2</a>                                           standard integer types, <a href="#6.2.5">6.2.5</a>
34529  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>,           standard output stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>
34530       <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.30.2.1.3">7.30.2.1.3</a>                                      standard signed integer types, <a href="#6.2.5">6.2.5</a>
34531  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>               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>
34532  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>                       statements, <a href="#6.8">6.8</a>
34533  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>                           break, <a href="#6.8.6.3">6.8.6.3</a>
34534  sqrt type-generic macro, <a href="#7.25">7.25</a>                                     compound, <a href="#6.8.2">6.8.2</a>
34535  srand function, <a href="#7.22.2.2">7.22.2.2</a>                                          continue, <a href="#6.8.6.2">6.8.6.2</a>
34536  sscanf function, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.14">7.21.6.14</a>                              do, <a href="#6.8.5.2">6.8.5.2</a>
34537  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>                          else, <a href="#6.8.4.1">6.8.4.1</a>
34538  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>                  expression, <a href="#6.8.3">6.8.3</a>
34539  standard headers, <a href="#4">4</a>, <a href="#7.1.2">7.1.2</a>                                        for, <a href="#6.8.5.3">6.8.5.3</a>
34540     <a href="#7.2">&lt;assert.h&gt;</a>, <a href="#7.2">7.2</a>                                                goto, <a href="#6.8.6.1">6.8.6.1</a>
34541     <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>,                  if, <a href="#6.8.4.1">6.8.4.1</a>
34542          <a href="#7.25">7.25</a>, <a href="#7.31.1">7.31.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>                                 iteration, <a href="#6.8.5">6.8.5</a>
34543     <a href="#7.4">&lt;ctype.h&gt;</a>, <a href="#7.4">7.4</a>, <a href="#7.31.2">7.31.2</a>                                         jump, <a href="#6.8.6">6.8.6</a>
34544     <a href="#7.5">&lt;errno.h&gt;</a>, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a>, <a href="#K.3.2">K.3.2</a>                                  labeled, <a href="#6.8.1">6.8.1</a>
34545     <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>,                       null, <a href="#6.8.3">6.8.3</a>
34546          <a href="#7.31.4">7.31.4</a>, <a href="#F">F</a>, <a href="#H">H</a>                                              return, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
34547     <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>,                        selection, <a href="#6.8.4">6.8.4</a>
34548          <a href="#7.29.4.1.1">7.29.4.1.1</a>                                                sequencing, <a href="#6.8">6.8</a>
34549 <!--page 696 -->
34550     switch, <a href="#6.8.4.2">6.8.4.2</a>                                           strerrorlen_s function, <a href="#K.3.7.4.3">K.3.7.4.3</a>
34551     while, <a href="#6.8.5.1">6.8.5.1</a>                                            strftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.27.3">7.27.3</a>, <a href="#7.27.3.5">7.27.3.5</a>,
34552  static assertions, <a href="#6.7.10">6.7.10</a>                                          <a href="#7.29.5.1">7.29.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>
34553  static storage duration, <a href="#6.2.4">6.2.4</a>                               stricter, <a href="#6.2.8">6.2.8</a>
34554  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>           strictly conforming program, <a href="#4">4</a>
34555  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>               string, <a href="#7.1.1">7.1.1</a>
34556  static_assert declaration, <a href="#6.7.10">6.7.10</a>                               comparison functions, <a href="#7.24.4">7.24.4</a>
34557  static_assert macro, <a href="#7.2">7.2</a>                                        concatenation functions, <a href="#7.24.3">7.24.3</a>, <a href="#K.3.7.2">K.3.7.2</a>
34558  stdalign.h header, <a href="#4">4</a>, <a href="#7.15">7.15</a>                                      conversion functions, <a href="#7.11.1.1">7.11.1.1</a>
34559  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>                               copying functions, <a href="#7.24.2">7.24.2</a>, <a href="#K.3.7.1">K.3.7.1</a>
34560  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>,                      library function conventions, <a href="#7.24.1">7.24.1</a>
34561        <a href="#7.31.8">7.31.8</a>                                                    literal, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.7.9">6.7.9</a>
34562  stdbool.h header, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>, <a href="#H">H</a>                            miscellaneous functions, <a href="#7.24.6">7.24.6</a>, <a href="#K.3.7.4">K.3.7.4</a>
34563  STDC, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a>                                            numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a>
34564  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>,                  search functions, <a href="#7.24.5">7.24.5</a>, <a href="#K.3.7.3">K.3.7.3</a>
34565        <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>                     string handling header, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>
34566  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>                         string.h header, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>
34567  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>,               stringizing, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.9">6.10.9</a>
34568        <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.29.2.12">7.29.2.12</a>, <a href="#7.29.3.7">7.29.3.7</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>,              strlen function, <a href="#7.24.6.3">7.24.6.3</a>
34569        <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>                                  strncat function, <a href="#7.24.3.2">7.24.3.2</a>
34570  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>,              strncat_s function, <a href="#K.3.7.2.2">K.3.7.2.2</a>
34571        <a href="#7.31.10">7.31.10</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>                                  strncmp function, <a href="#7.24.4">7.24.4</a>, <a href="#7.24.4.4">7.24.4.4</a>
34572  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.31.11">7.31.11</a>, <a href="#F">F</a>,                 strncpy function, <a href="#7.24.2.4">7.24.2.4</a>
34573        <a href="#K.3.5">K.3.5</a>                                                  strncpy_s function, <a href="#K.3.7.1.4">K.3.7.1.4</a>
34574  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.31.12">7.31.12</a>, <a href="#F">F</a>,                strnlen_s function, <a href="#K.3.7.4.4">K.3.7.4.4</a>
34575        <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a>                                         stronger, <a href="#6.2.8">6.2.8</a>
34576  stdnoreturn.h header, <a href="#4">4</a>, <a href="#7.23">7.23</a>                                strpbrk function, <a href="#7.24.5.4">7.24.5.4</a>
34577  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>,              strrchr function, <a href="#7.24.5.5">7.24.5.5</a>
34578        <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.29.2.11">7.29.2.11</a>, <a href="#7.29.3.9">7.29.3.9</a>                strspn function, <a href="#7.24.5.6">7.24.5.6</a>
34579  storage duration, <a href="#6.2.4">6.2.4</a>                                      strstr function, <a href="#7.24.5.7">7.24.5.7</a>
34580  storage order of array, <a href="#6.5.2.1">6.5.2.1</a>                              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>,
34581  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>                          <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.3">F.3</a>
34582  storage-class specifiers, <a href="#6.7.1">6.7.1</a>, <a href="#6.11.5">6.11.5</a>                       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>
34583  strcat function, <a href="#7.24.3.1">7.24.3.1</a>                                    strtoimax function, <a href="#7.8.2.3">7.8.2.3</a>
34584  strcat_s function, <a href="#K.3.7.2.1">K.3.7.2.1</a>                                 strtok function, <a href="#7.24.5.8">7.24.5.8</a>
34585  strchr function, <a href="#7.24.5.2">7.24.5.2</a>                                    strtok_s function, <a href="#K.3.7.3.1">K.3.7.3.1</a>
34586  strcmp function, <a href="#7.24.4">7.24.4</a>, <a href="#7.24.4.2">7.24.4.2</a>                            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>,
34587  strcoll function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.4.3">7.24.4.3</a>, <a href="#7.24.4.5">7.24.4.5</a>                     <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.2.2">7.29.2.2</a>
34588  strcpy function, <a href="#7.24.2.3">7.24.2.3</a>                                    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>
34589  strcpy_s function, <a href="#K.3.7.1.3">K.3.7.1.3</a>                                 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>
34590  strcspn function, <a href="#7.24.5.3">7.24.5.3</a>                                   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>,
34591  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.29.2.2">7.29.2.2</a>
34592     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>
34593     line buffered, <a href="#7.21.3">7.21.3</a>                                     strtoumax function, <a href="#7.8.2.3">7.8.2.3</a>
34594     orientation, <a href="#7.21.2">7.21.2</a>                                       struct hack, see flexible array member
34595     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>
34596     standard input, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>                            struct timespec, <a href="#7.27.1">7.27.1</a>
34597     standard output, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>                           struct tm, <a href="#7.27.1">7.27.1</a>
34598     unbuffered, <a href="#7.21.3">7.21.3</a>                                        structure
34599  strerror function, <a href="#7.21.10.4">7.21.10.4</a>, <a href="#7.24.6.2">7.24.6.2</a>                          arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
34600  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>                       content, <a href="#6.7.2.3">6.7.2.3</a>
34601 <!--page 697 -->
34602    dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>                                    thrd_current function, <a href="#7.26.5.2">7.26.5.2</a>
34603    initialization, <a href="#6.7.9">6.7.9</a>                                        thrd_detach function, <a href="#7.26.5.3">7.26.5.3</a>
34604    member alignment, <a href="#6.7.2.1">6.7.2.1</a>                                    thrd_equal function, <a href="#7.26.5.4">7.26.5.4</a>
34605    member name space, <a href="#6.2.3">6.2.3</a>                                     thrd_exit function, <a href="#7.26.5.5">7.26.5.5</a>
34606    member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a>                        thrd_join function, <a href="#7.26.5.6">7.26.5.6</a>
34607    pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>                               thrd_sleep function, <a href="#7.26.5.7">7.26.5.7</a>
34608    specifier, <a href="#6.7.2.1">6.7.2.1</a>                                            thrd_start_t type, <a href="#7.26.1">7.26.1</a>
34609    tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>                                          thrd_t type, <a href="#7.26.1">7.26.1</a>
34610    type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a>                                         thrd_yield function, <a href="#7.26.5.8">7.26.5.8</a>
34611  strxfrm function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.4.5">7.24.4.5</a>                           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>,
34612  subnormal floating-point numbers, <a href="#5.2.4.2.2">5.2.4.2.2</a>                          <a href="#K.3.6.2.1">K.3.6.2.1</a>
34613  subscripting, <a href="#6.5.2.1">6.5.2.1</a>                                          thread storage duration, <a href="#6.2.4">6.2.4</a>, <a href="#7.6">7.6</a>
34614  subtraction assignment operator (-=), <a href="#6.5.16.2">6.5.16.2</a>                 threads header, <a href="#7.26">7.26</a>, <a href="#7.31.15">7.31.15</a>
34615  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>           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.26">7.26</a>,
34616  suffix                                                                <a href="#7.31.15">7.31.15</a>
34617    floating constant, <a href="#6.4.4.2">6.4.4.2</a>                                    time
34618    integer constant, <a href="#6.4.4.1">6.4.4.1</a>                                       broken down, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.3">7.27.3</a>, <a href="#7.27.3.1">7.27.3.1</a>,
34619  switch body, <a href="#6.8.4.2">6.8.4.2</a>                                                   <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#7.27.3.5">7.27.3.5</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>,
34620  switch case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</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>
34621  switch default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>                              calendar, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.2">7.27.2.2</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.2.4">7.27.2.4</a>,
34622  switch statement, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>                                        <a href="#7.27.3.2">7.27.3.2</a>, <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>,
34623  swprintf function, <a href="#7.29.2.3">7.29.2.3</a>, <a href="#7.29.2.7">7.29.2.7</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>
34624       <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>                                         components, <a href="#7.27.1">7.27.1</a>, <a href="#K.3.8.1">K.3.8.1</a>
34625  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>                         conversion functions, <a href="#7.27.3">7.27.3</a>, <a href="#K.3.8.2">K.3.8.2</a>
34626  swscanf function, <a href="#7.29.2.4">7.29.2.4</a>, <a href="#7.29.2.8">7.29.2.8</a>                                 wide character, <a href="#7.29.5">7.29.5</a>
34627  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>                         local, <a href="#7.27.1">7.27.1</a>
34628  symbols, <a href="#3">3</a>                                                        manipulation functions, <a href="#7.27.2">7.27.2</a>
34629  synchronization operation, <a href="#5.1.2.4">5.1.2.4</a>                                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>
34630  synchronize with, <a href="#5.1.2.4">5.1.2.4</a>                                      time base, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.5">7.27.2.5</a>
34631  syntactic categories, <a href="#6.1">6.1</a>                                      time function, <a href="#7.27.2.4">7.27.2.4</a>
34632  syntax notation, <a href="#6.1">6.1</a>                                           time.h header, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>
34633  syntax rule precedence, <a href="#5.1.1.2">5.1.1.2</a>                                time_t type, <a href="#7.27.1">7.27.1</a>
34634  syntax summary, language, <a href="#A">A</a>                                    TIME_UTC macro, <a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.26.4.4">7.26.4.4</a>, <a href="#7.26.5.7">7.26.5.7</a>,
34635  system function, <a href="#7.22.4.8">7.22.4.8</a>                                           <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.5">7.27.2.5</a>
34636                                                                 timespec structure type, <a href="#7.27.1">7.27.1</a>
34637  tab characters, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>                                     timespec_get function, <a href="#7.27.2.5">7.27.2.5</a>
34638  tag compatibility, <a href="#6.2.7">6.2.7</a>                                       tm structure type, <a href="#7.27.1">7.27.1</a>, <a href="#7.29.1">7.29.1</a>, <a href="#K.3.8.1">K.3.8.1</a>
34639  tag name space, <a href="#6.2.3">6.2.3</a>                                          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>
34640  tags, <a href="#6.7.2.3">6.7.2.3</a>                                                  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>
34641  tan functions, <a href="#7.12.4.7">7.12.4.7</a>, <a href="#F.10.1.7">F.10.1.7</a>                              tmpfile function, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a>
34642  tan type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                              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>
34643  tanh functions, <a href="#7.12.5.6">7.12.5.6</a>, <a href="#F.10.2.6">F.10.2.6</a>                             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>,
34644  tanh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                   <a href="#K.3.5.1.2">K.3.5.1.2</a>
34645  temporary lifetime, <a href="#6.2.4">6.2.4</a>                                      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>
34646  tentative definition, <a href="#6.9.2">6.9.2</a>                                     token, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, see also preprocessing tokens
34647  terms, <a href="#3">3</a>                                                       token concatenation, <a href="#6.10.3.3">6.10.3.3</a>
34648  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>            token pasting, <a href="#6.10.3.3">6.10.3.3</a>
34649  tgamma functions, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#F.10.5.4">F.10.5.4</a>                           tolower function, <a href="#7.4.2.1">7.4.2.1</a>
34650  tgamma type-generic macro, <a href="#7.25">7.25</a>                                toupper function, <a href="#7.4.2.2">7.4.2.2</a>
34651  tgmath.h header, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                     towctrans function, <a href="#7.30.3.2.1">7.30.3.2.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>
34652  thrd_create function, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.5.1">7.26.5.1</a>                         towlower function, <a href="#7.30.3.1.1">7.30.3.1.1</a>, <a href="#7.30.3.2.1">7.30.3.2.1</a>
34653 <!--page 698 -->
34654  towupper function, <a href="#7.30.3.1.2">7.30.3.1.2</a>, <a href="#7.30.3.2.1">7.30.3.2.1</a>                       UCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
34655  translation environment, <a href="#5">5</a>, <a href="#5.1.1">5.1.1</a>                               UINT_FASTN_MAX macros, <a href="#7.20.2.3">7.20.2.3</a>
34656  translation limits, <a href="#5.2.4.1">5.2.4.1</a>                                     uint_fastN_t types, <a href="#7.20.1.3">7.20.1.3</a>
34657  translation phases, <a href="#5.1.1.2">5.1.1.2</a>                                     uint_least16_t type, <a href="#7.28">7.28</a>
34658  translation unit, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.9">6.9</a>                                  uint_least32_t type, <a href="#7.28">7.28</a>
34659  trap, see perform a trap                                        UINT_LEASTN_MAX macros, <a href="#7.20.2.2">7.20.2.2</a>
34660  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>,                  uint_leastN_t types, <a href="#7.20.1.2">7.20.1.2</a>
34661        <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.5.2.3">6.5.2.3</a>                                          UINT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
34662  trigonometric functions                                         UINTMAX_C macro, <a href="#7.20.4.2">7.20.4.2</a>
34663     complex, <a href="#7.3.5">7.3.5</a>, <a href="#G.6.1">G.6.1</a>                                        UINTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.20.2.5">7.20.2.5</a>
34664     real, <a href="#7.12.4">7.12.4</a>, <a href="#F.10.1">F.10.1</a>                                         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>,
34665  trigraph sequences, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1.1">5.2.1.1</a>                                 <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
34666  true macro, <a href="#7.18">7.18</a>                                                UINTN_C macros, <a href="#7.20.4.1">7.20.4.1</a>
34667  trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.10.6.8">F.10.6.8</a>                             UINTN_MAX macros, <a href="#7.20.2.1">7.20.2.1</a>
34668  trunc type-generic macro, <a href="#7.25">7.25</a>                                  uintN_t types, <a href="#7.20.1.1">7.20.1.1</a>
34669  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>                 UINTPTR_MAX macro, <a href="#7.20.2.4">7.20.2.4</a>
34670  truncation toward zero, <a href="#6.5.5">6.5.5</a>                                   uintptr_t type, <a href="#7.20.1.4">7.20.1.4</a>
34671  tss_create function, <a href="#7.26.6.1">7.26.6.1</a>                                   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>,
34672  tss_delete function, <a href="#7.26.6.2">7.26.6.2</a>                                        <a href="#7.29.4.1.2">7.29.4.1.2</a>
34673  TSS_DTOR_ITERATIONS macro, <a href="#7.26.1">7.26.1</a>                               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>,
34674  tss_dtor_t type, <a href="#7.26.1">7.26.1</a>                                              <a href="#7.29.4.1.2">7.29.4.1.2</a>
34675  tss_get function, <a href="#7.26.6.3">7.26.6.3</a>                                      unary arithmetic operators, <a href="#6.5.3.3">6.5.3.3</a>
34676  tss_set function, <a href="#7.26.6.4">7.26.6.4</a>                                      unary expression, <a href="#6.5.3">6.5.3</a>
34677  tss_t type, <a href="#7.26.1">7.26.1</a>                                              unary minus operator (-), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a>
34678  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>                             unary operators, <a href="#6.5.3">6.5.3</a>
34679  type category, <a href="#6.2.5">6.2.5</a>                                            unary plus operator (+), <a href="#6.5.3.3">6.5.3.3</a>
34680  type conversion, <a href="#6.3">6.3</a>                                            unbuffered stream, <a href="#7.21.3">7.21.3</a>
34681  type definitions, <a href="#6.7.8">6.7.8</a>                                          undef preprocessing directive, <a href="#6.10.3.5">6.10.3.5</a>, <a href="#7.1.3">7.1.3</a>,
34682  type domain, <a href="#6.2.5">6.2.5</a>, <a href="#G.2">G.2</a>                                              <a href="#7.1.4">7.1.4</a>
34683  type names, <a href="#6.7.7">6.7.7</a>                                               undefined behavior, <a href="#3.4.3">3.4.3</a>, <a href="#4">4</a>, <a href="#J.2">J.2</a>
34684  type punning, <a href="#6.5.2.3">6.5.2.3</a>                                           underscore character, <a href="#6.4.2.1">6.4.2.1</a>
34685  type qualifiers, <a href="#6.7.3">6.7.3</a>                                           underscore, leading, in identifier, <a href="#7.1.3">7.1.3</a>
34686  type specifiers, <a href="#6.7.2">6.7.2</a>                                           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>,
34687  type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>                                        <a href="#7.21.9.3">7.21.9.3</a>
34688  type-generic math header, <a href="#7.25">7.25</a>                                  ungetwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.10">7.29.3.10</a>
34689  typedef declaration, <a href="#6.7.8">6.7.8</a>                                      Unicode, <a href="#7.28">7.28</a>, see also char16_t type,
34690  typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.8">6.7.8</a>                         char32_t type, wchar_t type
34691  types, <a href="#6.2.5">6.2.5</a>                                                    Unicode required set, <a href="#6.10.8.2">6.10.8.2</a>
34692     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>,           unicode utilities header, <a href="#7.28">7.28</a>
34693           <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>           union
34694     character, <a href="#6.7.9">6.7.9</a>                                               arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
34695     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>                         content, <a href="#6.7.2.3">6.7.2.3</a>
34696     complex, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a>                                              dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>
34697     composite, <a href="#6.2.7">6.2.7</a>                                               initialization, <a href="#6.7.9">6.7.9</a>
34698     const qualified, <a href="#6.7.3">6.7.3</a>                                          member alignment, <a href="#6.7.2.1">6.7.2.1</a>
34699     conversions, <a href="#6.3">6.3</a>                                               member name space, <a href="#6.2.3">6.2.3</a>
34700     imaginary, <a href="#G">G</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>
34701     restrict qualified, <a href="#6.7.3">6.7.3</a>                                       pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
34702     volatile qualified, <a href="#6.7.3">6.7.3</a>                                       specifier, <a href="#6.7.2.1">6.7.2.1</a>
34703                                                                    tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
34704  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.28">7.28</a>                              type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a>
34705 <!--page 699 -->
34706  universal character name, <a href="#6.4.3">6.4.3</a>                                value bits, <a href="#6.2.6.2">6.2.6.2</a>
34707  unnormalized floating-point numbers, <a href="#5.2.4.2.2">5.2.4.2.2</a>                  variable arguments, <a href="#6.10.3">6.10.3</a>
34708  unqualified type, <a href="#6.2.5">6.2.5</a>                                         variable arguments header, <a href="#7.16">7.16</a>
34709  unqualified version of type, <a href="#6.2.5">6.2.5</a>                              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>
34710  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                    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>
34711        indeterminately sequenced, sequenced                     vertical-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
34712        before                                                   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>,
34713  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>                            <a href="#7.4.1.10">7.4.1.10</a>
34714  unsigned integer suffix, u or <a href="#U">U</a>, <a href="#6.4.4.1">6.4.4.1</a>                        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>
34715  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>                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>,
34716  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>,                         <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>
34717        <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>                                         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>
34718  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>,              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>,
34719        <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>                                            <a href="#K.3.5.3.14">K.3.5.3.14</a>
34720  unspecified behavior, <a href="#3.4.4">3.4.4</a>, <a href="#4">4</a>, <a href="#J.1">J.1</a>                             vfwprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.5">7.29.2.5</a>, <a href="#K.3.9.1.6">K.3.9.1.6</a>
34721  unspecified value, <a href="#3.19.3">3.19.3</a>                                       vfwprintf_s function, <a href="#K.3.9.1.6">K.3.9.1.6</a>
34722  uppercase letter, <a href="#5.2.1">5.2.1</a>                                        vfwscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.3.10">7.29.3.10</a>
34723  use of library functions, <a href="#7.1.4">7.1.4</a>                                vfwscanf_s function, <a href="#K.3.9.1.7">K.3.9.1.7</a>
34724  USHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>                                     visibility of identifier, <a href="#6.2.1">6.2.1</a>
34725  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>,           visible sequence of side effects, <a href="#5.1.2.4">5.1.2.4</a>
34726        <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>             visible side effect, <a href="#5.1.2.4">5.1.2.4</a>
34727  UTF-16, <a href="#6.10.8.2">6.10.8.2</a>                                               VLA, see variable length array
34728  UTF-32, <a href="#6.10.8.2">6.10.8.2</a>                                               void expression, <a href="#6.3.2.2">6.3.2.2</a>
34729  UTF-8 string literal, see string literal                       void function parameter, <a href="#6.7.6.3">6.7.6.3</a>
34730  utilities, general, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</a>, <a href="#K.3.6">K.3.6</a>                       void type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.2">6.3.2.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>,
34731     wide string, <a href="#7.29.4">7.29.4</a>, <a href="#K.3.9.2">K.3.9.2</a>                                     <a href="#K.3.9.1.2">K.3.9.1.2</a>
34732  utilities, unicode, <a href="#7.28">7.28</a>                                       void type conversion, <a href="#6.3.2.2">6.3.2.2</a>
34733                                                                 volatile storage, <a href="#5.1.2.3">5.1.2.3</a>
34734  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>,                volatile type qualifier, <a href="#6.7.3">6.7.3</a>
34735       <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>,                  volatile-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a>
34736       <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>,               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>,
34737       <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>,                        <a href="#K.3.5.3.10">K.3.5.3.10</a>
34738       <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.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>,               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>,
34739       <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>                  <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>
34740  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>,                  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>
34741       <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a>                                        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>,
34742  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>,                        <a href="#K.3.5.3.14">K.3.5.3.14</a>
34743       <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>,                  vsnprintf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.12">7.21.6.12</a>,
34744       <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>,                    <a href="#K.3.5.3.12">K.3.5.3.12</a>
34745       <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>,                   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>,
34746       <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.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>,                    <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>
34747       <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>             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>
34748  va_list type, <a href="#7.16">7.16</a>, <a href="#7.16.1.3">7.16.1.3</a>                                   vsprintf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.13">7.21.6.13</a>,
34749  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>,                             <a href="#K.3.5.3.13">K.3.5.3.13</a>
34750       <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>,                   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>,
34751       <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="#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>
34752       <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.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>,                 vsscanf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.14">7.21.6.14</a>
34753       <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.2.10</a>,                  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>,
34754       <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>,                  <a href="#K.3.5.3.14">K.3.5.3.14</a>
34755       <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>                                    vswprintf function, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#K.3.9.1.8">K.3.9.1.8</a>,
34756  value, <a href="#3.19">3.19</a>                                                         <a href="#K.3.9.1.9">K.3.9.1.9</a>
34757 <!--page 700 -->
34758  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.29.4.1.2">7.29.4.1.2</a>
34759  vswscanf function, <a href="#7.29.2.8">7.29.2.8</a>                                  wcstombs function, <a href="#7.22.8.2">7.22.8.2</a>, <a href="#7.29.6.4">7.29.6.4</a>
34760  vswscanf_s function, <a href="#K.3.9.1.10">K.3.9.1.10</a>                              wcstombs_s function, <a href="#K.3.6.5.2">K.3.6.5.2</a>
34761  vwprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#K.3.9.1.11">K.3.9.1.11</a>              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.29.2.2">7.29.2.2</a>,
34762  vwprintf_s function, <a href="#K.3.9.1.11">K.3.9.1.11</a>                                   <a href="#7.29.4.1.2">7.29.4.1.2</a>
34763  vwscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#7.29.3.10">7.29.3.10</a>               wcstoull function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>
34764  vwscanf_s function, <a href="#K.3.9.1.12">K.3.9.1.12</a>                               wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a>
34765                                                               wcsxfrm function, <a href="#7.29.4.4.4">7.29.4.4.4</a>
34766  warnings, <a href="#I">I</a>                                                  wctob function, <a href="#7.29.6.1.2">7.29.6.1.2</a>, <a href="#7.30.2.1">7.30.2.1</a>
34767  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.29">7.29</a>, <a href="#7.31.16">7.31.16</a>,            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.29.6.3">7.29.6.3</a>
34768      <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a>                                                 wctomb_s function, <a href="#K.3.6.4.1">K.3.6.4.1</a>
34769  WCHAR_MAX macro, <a href="#7.20.3">7.20.3</a>, <a href="#7.29.1">7.29.1</a>                              wctrans function, <a href="#7.30.3.2.1">7.30.3.2.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>
34770  WCHAR_MIN macro, <a href="#7.20.3">7.20.3</a>, <a href="#7.29.1">7.29.1</a>                              wctrans_t type, <a href="#7.30.1">7.30.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>
34771  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>,           wctype function, <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>
34772      <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.29.1">7.29.1</a>,                wctype.h header, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>
34773      <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>                                       wctype_t type, <a href="#7.30.1">7.30.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>
34774  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.29.1">7.29.1</a>,                  weaker, <a href="#6.2.8">6.2.8</a>
34775      <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#J.1">J.1</a>,                   WEOF macro, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.3.6">7.29.3.6</a>,
34776      <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>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>                             <a href="#7.29.3.7">7.29.3.7</a>, <a href="#7.29.3.8">7.29.3.8</a>, <a href="#7.29.3.9">7.29.3.9</a>, <a href="#7.29.3.10">7.29.3.10</a>,
34777  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>                        <a href="#7.29.6.1.1">7.29.6.1.1</a>, <a href="#7.30.1">7.30.1</a>
34778  wcscat function, <a href="#7.29.4.3.1">7.29.4.3.1</a>                                  while statement, <a href="#6.8.5.1">6.8.5.1</a>
34779  wcscat_s function, <a href="#K.3.9.2.2.1">K.3.9.2.2.1</a>                               white space, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#7.4.1.10">7.4.1.10</a>,
34780  wcschr function, <a href="#7.29.4.5.1">7.29.4.5.1</a>                                       <a href="#7.30.2.1.10">7.30.2.1.10</a>
34781  wcscmp function, <a href="#7.29.4.4.1">7.29.4.4.1</a>, <a href="#7.29.4.4.4">7.29.4.4.4</a>                      white-space characters, <a href="#6.4">6.4</a>
34782  wcscoll function, <a href="#7.29.4.4.2">7.29.4.4.2</a>, <a href="#7.29.4.4.4">7.29.4.4.4</a>                     wide character, <a href="#3.7.3">3.7.3</a>
34783  wcscpy function, <a href="#7.29.4.2.1">7.29.4.2.1</a>                                    case mapping functions, <a href="#7.30.3.1">7.30.3.1</a>
34784  wcscpy_s function, <a href="#K.3.9.2.1.1">K.3.9.2.1.1</a>                                    extensible, <a href="#7.30.3.2">7.30.3.2</a>
34785  wcscspn function, <a href="#7.29.4.5.2">7.29.4.5.2</a>                                   classification functions, <a href="#7.30.2.1">7.30.2.1</a>
34786  wcsftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.29.5.1">7.29.5.1</a>                             extensible, <a href="#7.30.2.2">7.30.2.2</a>
34787  wcslen function, <a href="#7.29.4.6.1">7.29.4.6.1</a>                                    constant, <a href="#6.4.4.4">6.4.4.4</a>
34788  wcsncat function, <a href="#7.29.4.3.2">7.29.4.3.2</a>                                   formatted input/output functions, <a href="#7.29.2">7.29.2</a>,
34789  wcsncat_s function, <a href="#K.3.9.2.2.2">K.3.9.2.2.2</a>                                      <a href="#K.3.9.1">K.3.9.1</a>
34790  wcsncmp function, <a href="#7.29.4.4.3">7.29.4.4.3</a>                                   input functions, <a href="#7.21.1">7.21.1</a>
34791  wcsncpy function, <a href="#7.29.4.2.2">7.29.4.2.2</a>                                   input/output functions, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3">7.29.3</a>
34792  wcsncpy_s function, <a href="#K.3.9.2.1.2">K.3.9.2.1.2</a>                                output functions, <a href="#7.21.1">7.21.1</a>
34793  wcsnlen_s function, <a href="#K.3.9.2.4.1">K.3.9.2.4.1</a>                                single-byte conversion functions, <a href="#7.29.6.1">7.29.6.1</a>
34794  wcspbrk function, <a href="#7.29.4.5.3">7.29.4.5.3</a>                                 wide character classification and mapping utilities
34795  wcsrchr function, <a href="#7.29.4.5.4">7.29.4.5.4</a>                                      header, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>
34796  wcsrtombs function, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>                    wide string, <a href="#7.1.1">7.1.1</a>
34797  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>                 wide string comparison functions, <a href="#7.29.4.4">7.29.4.4</a>
34798  wcsspn function, <a href="#7.29.4.5.5">7.29.4.5.5</a>                                  wide string concatenation functions, <a href="#7.29.4.3">7.29.4.3</a>,
34799  wcsstr function, <a href="#7.29.4.5.6">7.29.4.5.6</a>                                       <a href="#K.3.9.2.2">K.3.9.2.2</a>
34800  wcstod function, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>                          wide string copying functions, <a href="#7.29.4.2">7.29.4.2</a>, <a href="#K.3.9.2.1">K.3.9.2.1</a>
34801  wcstod function, <a href="#7.29.4.1.1">7.29.4.1.1</a>                                  wide string literal, see string literal
34802  wcstof function, <a href="#7.29.4.1.1">7.29.4.1.1</a>                                  wide string miscellaneous functions, <a href="#7.29.4.6">7.29.4.6</a>,
34803  wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a>                                       <a href="#K.3.9.2.4">K.3.9.2.4</a>
34804  wcstok function, <a href="#7.29.4.5.7">7.29.4.5.7</a>                                  wide string numeric conversion functions, <a href="#7.8.2.4">7.8.2.4</a>,
34805  wcstok_s function, <a href="#K.3.9.2.3.1">K.3.9.2.3.1</a>                                    <a href="#7.29.4.1">7.29.4.1</a>
34806  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.29.2.2">7.29.2.2</a>,                wide string search functions, <a href="#7.29.4.5">7.29.4.5</a>, <a href="#K.3.9.2.3">K.3.9.2.3</a>
34807      <a href="#7.29.4.1.2">7.29.4.1.2</a>                                               wide-oriented stream, <a href="#7.21.2">7.21.2</a>
34808  wcstold function, <a href="#7.29.4.1.1">7.29.4.1.1</a>                                 width, <a href="#6.2.6.2">6.2.6.2</a>
34809 <!--page 701 -->
34810  WINT_MAX macro, <a href="#7.20.3">7.20.3</a>
34811  WINT_MIN macro, <a href="#7.20.3">7.20.3</a>
34812  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.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>,
34813     <a href="#7.30.1">7.30.1</a>
34814  wmemchr function, <a href="#7.29.4.5.8">7.29.4.5.8</a>
34815  wmemcmp function, <a href="#7.29.4.4.5">7.29.4.4.5</a>
34816  wmemcpy function, <a href="#7.29.4.2.3">7.29.4.2.3</a>
34817  wmemcpy_s function, <a href="#K.3.9.2.1.3">K.3.9.2.1.3</a>
34818  wmemmove function, <a href="#7.29.4.2.4">7.29.4.2.4</a>
34819  wmemmove_s function, <a href="#K.3.9.2.1.4">K.3.9.2.1.4</a>
34820  wmemset function, <a href="#7.29.4.6.2">7.29.4.6.2</a>
34821  wprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.11">7.29.2.11</a>,
34822     <a href="#K.3.9.1.13">K.3.9.1.13</a>
34823  wprintf_s function, <a href="#K.3.9.1.13">K.3.9.1.13</a>
34824  wscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#7.29.2.12">7.29.2.12</a>,
34825     <a href="#7.29.3.10">7.29.3.10</a>
34826  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>
34827  
34828  xor macro, <a href="#7.9">7.9</a>
34829  xor_eq macro, <a href="#7.9">7.9</a>                                   *
34830 </pre>
34831 <p><small><a href="#Contents">Contents</a></small>
34832 </body></html>